(vditor: IVditor, blockElement: HTMLElement)
| 492 | }; |
| 493 | |
| 494 | const 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 | |
| 512 | export const setupLazyCodeMirrorObserver = (_vditor: IVditor) => { |
| 513 | if (lazyCodeMirrorObserver) { |
no test coverage detected