MCPcopy Index your code
hub / github.com/UNLINEARITY/Obsidian-CodeSpace / queueAllCodeEmbedsInDocument

Function queueAllCodeEmbedsInDocument

src/code_embed.ts:373–390  ·  view source on GitHub ↗
(doc: Document, docWindow: Window, plugin: CodeSpacePlugin)

Source from the content-addressed store, hash-verified

371}
372
373function queueAllCodeEmbedsInDocument(doc: Document, docWindow: Window, plugin: CodeSpacePlugin) {
374 doc.querySelectorAll(".file-embed").forEach((element) => {
375 const embedEl = element as HTMLElement;
376 const sourcePath = resolveSourcePathForEmbed(embedEl, plugin);
377 if (!sourcePath) {
378 docWindow.setTimeout(() => {
379 const retrySourcePath = resolveSourcePathForEmbed(embedEl, plugin);
380 if (!retrySourcePath) return;
381 rememberSourcePath(embedEl, retrySourcePath);
382 scheduleProcessCodeEmbed(embedEl, plugin, retrySourcePath);
383 }, 120);
384 return;
385 }
386
387 rememberSourcePath(embedEl, sourcePath);
388 scheduleProcessCodeEmbed(embedEl, plugin, sourcePath);
389 });
390}
391
392export function queueCodeEmbedsInElement(rootEl: HTMLElement, plugin: CodeSpacePlugin, sourcePath: string) {
393 if (!sourcePath) return;

Callers 2

refreshFunction · 0.85

Calls 3

rememberSourcePathFunction · 0.85
scheduleProcessCodeEmbedFunction · 0.85

Tested by

no test coverage detected