MCPcopy Create free account
hub / github.com/Make-md/makemd / openPathInElement

Function openPathInElement

src/shared/utils/openPathInElement.ts:7–30  ·  view source on GitHub ↗
(
  app: App,
  parentLeaf: WorkspaceLeaf,
  initiatingEl?: HTMLElement,
  fileName?: string,
  onShowCallback?: (leaf: FlowEditor) => Promise<unknown>
)

Source from the content-addressed store, hash-verified

5
6
7export const openPathInElement = (
8 app: App,
9 parentLeaf: WorkspaceLeaf,
10 initiatingEl?: HTMLElement,
11 fileName?: string,
12 onShowCallback?: (leaf: FlowEditor) => Promise<unknown>
13) => {
14 const parent = (parentLeaf ?? app.workspace.getLeaf()) as unknown as FlowEditorParent;
15 if (!initiatingEl) initiatingEl = parent.containerEl;
16 const hoverPopover = new FlowEditor(
17 parent,
18 initiatingEl!,
19 app,
20 undefined,
21 onShowCallback
22 );
23
24 // plugin.attachPortal(hoverPopover);
25 if (fileName)
26 hoverPopover.titleEl.textContent = fileName.substring(
27 0,
28 fileName.lastIndexOf(".")
29 );
30};

Callers 3

ObsidianUIClass · 0.90
openPathMethod · 0.90
openPathMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected