(blockElement: HTMLElement)
| 414 | }; |
| 415 | |
| 416 | const destroyCodeMirror = (blockElement: HTMLElement) => { |
| 417 | cancelLazyTeardown(blockElement); |
| 418 | const binding = bindings.get(blockElement); |
| 419 | if (!binding) { |
| 420 | return; |
| 421 | } |
| 422 | window.clearTimeout(binding.syncTimer); |
| 423 | window.clearTimeout(binding.previewTimer); |
| 424 | binding.syncCode.textContent = binding.view.state.doc.toString(); |
| 425 | binding.view.destroy(); |
| 426 | bindings.delete(blockElement); |
| 427 | binding.editPre.querySelector(".cm-editor")?.remove(); |
| 428 | const wasSpecialEdit = blockElement.classList.contains(CM_EDITING_CLASS); |
| 429 | if (wasSpecialEdit) { |
| 430 | removeCodeBlockChrome(blockElement); |
| 431 | blockElement.classList.remove(CM_BLOCK_CLASS, CM_EDITING_CLASS, CM_SPLIT_CLASS); |
| 432 | } else if (isLazyManagedCodeBlock(blockElement)) { |
| 433 | showPlainCodeBlockPlaceholder(blockElement); |
| 434 | } |
| 435 | }; |
| 436 | |
| 437 | const getMountedCodeBlocks = (vditor: IVditor) => { |
| 438 | const editor = getModeEditor(vditor); |
no test coverage detected