MCPcopy Create free account
hub / github.com/cweijan/vscode-office / scheduleLazyCodeBlock

Function scheduleLazyCodeBlock

vditor/src/ts/codeBlock/codeMirrorManager.ts:494–510  ·  view source on GitHub ↗
(vditor: IVditor, blockElement: HTMLElement)

Source from the content-addressed store, hash-verified

492};
493
494const scheduleLazyCodeBlock = (vditor: IVditor, blockElement: HTMLElement) => {
495 if (isSpecialBlock(blockElement)) {
496 scheduleSpecialBlock(vditor, blockElement);
497 return;
498 }
499 if (isBlockNearViewport(blockElement)) {
500 enforceMaxMounted(vditor, blockElement);
501 mountCodeMirror(blockElement, vditor, true);
502 } else {
503 if (bindings.has(blockElement)) {
504 cancelLazyTeardown(blockElement);
505 destroyCodeMirror(blockElement);
506 }
507 showPlainCodeBlockPlaceholder(blockElement);
508 }
509 registerLazyCodeBlockVisibility(vditor, blockElement);
510};
511
512export const setupLazyCodeMirrorObserver = (_vditor: IVditor) => {
513 if (lazyCodeMirrorObserver) {

Callers 2

renderCodeBlocksInScopeFunction · 0.85
renderCodeBlocksFunction · 0.85

Calls 10

isSpecialBlockFunction · 0.85
scheduleSpecialBlockFunction · 0.85
isBlockNearViewportFunction · 0.85
enforceMaxMountedFunction · 0.85
mountCodeMirrorFunction · 0.85
cancelLazyTeardownFunction · 0.85
destroyCodeMirrorFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected