@latentic/live-markdown 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +2 -2
- package/dist/chunk-V6TY7KAL.js +8 -0
- package/dist/chunk-V6TY7KAL.js.map +1 -0
- package/dist/codemirror/CodeMirrorMarkdownEditor.d.ts +106 -0
- package/dist/codemirror/CodeMirrorMarkdownEditor.js +482 -0
- package/dist/codemirror/CodeMirrorMarkdownEditor.js.map +1 -0
- package/dist/codemirror/byteOffset.d.ts +17 -0
- package/dist/codemirror/byteOffset.js +19 -0
- package/dist/codemirror/byteOffset.js.map +1 -0
- package/dist/codemirror/caretLayer.d.ts +19 -0
- package/dist/codemirror/caretLayer.js +44 -0
- package/dist/codemirror/caretLayer.js.map +1 -0
- package/dist/codemirror/clipboard/copyRich.d.ts +37 -0
- package/dist/codemirror/clipboard/copyRich.js +72 -0
- package/dist/codemirror/clipboard/copyRich.js.map +1 -0
- package/dist/codemirror/clipboard/htmlToMarkdown.d.ts +20 -0
- package/dist/codemirror/clipboard/htmlToMarkdown.js +91 -0
- package/dist/codemirror/clipboard/htmlToMarkdown.js.map +1 -0
- package/dist/codemirror/clipboard/pasteMarkdown.d.ts +18 -0
- package/dist/codemirror/clipboard/pasteMarkdown.js +41 -0
- package/dist/codemirror/clipboard/pasteMarkdown.js.map +1 -0
- package/dist/codemirror/code/codeHighlight.d.ts +13 -0
- package/dist/codemirror/code/codeHighlight.js +15 -0
- package/dist/codemirror/code/codeHighlight.js.map +1 -0
- package/dist/codemirror/code/codeLangAffordance.d.ts +17 -0
- package/dist/codemirror/code/codeLangAffordance.js +80 -0
- package/dist/codemirror/code/codeLangAffordance.js.map +1 -0
- package/dist/codemirror/code/codeLanguageMenu.d.ts +40 -0
- package/dist/codemirror/code/codeLanguageMenu.js +184 -0
- package/dist/codemirror/code/codeLanguageMenu.js.map +1 -0
- package/dist/codemirror/code/codePalette.d.ts +39 -0
- package/dist/codemirror/code/codePalette.js +53 -0
- package/dist/codemirror/code/codePalette.js.map +1 -0
- package/dist/codemirror/code/fenceAutoClose.d.ts +30 -0
- package/dist/codemirror/code/fenceAutoClose.js +171 -0
- package/dist/codemirror/code/fenceAutoClose.js.map +1 -0
- package/dist/codemirror/code/fenceCaretGuard.d.ts +28 -0
- package/dist/codemirror/code/fenceCaretGuard.js +66 -0
- package/dist/codemirror/code/fenceCaretGuard.js.map +1 -0
- package/dist/codemirror/code/fenceDeleteGuards.d.ts +22 -0
- package/dist/codemirror/code/fenceDeleteGuards.js +105 -0
- package/dist/codemirror/code/fenceDeleteGuards.js.map +1 -0
- package/dist/codemirror/code/fenceTabIndent.d.ts +8 -0
- package/dist/codemirror/code/fenceTabIndent.js +50 -0
- package/dist/codemirror/code/fenceTabIndent.js.map +1 -0
- package/dist/codemirror/code/highlightFence.d.ts +25 -0
- package/dist/codemirror/code/highlightFence.js +45 -0
- package/dist/codemirror/code/highlightFence.js.map +1 -0
- package/dist/codemirror/code/index.d.ts +9 -0
- package/dist/codemirror/code/index.js +8 -0
- package/dist/codemirror/code/index.js.map +1 -0
- package/dist/codemirror/core/codeContext.d.ts +32 -0
- package/dist/codemirror/core/codeContext.js +22 -0
- package/dist/codemirror/core/codeContext.js.map +1 -0
- package/dist/codemirror/core/editorTestHarness.d.ts +31 -0
- package/dist/codemirror/core/editorTestHarness.js +69 -0
- package/dist/codemirror/core/editorTestHarness.js.map +1 -0
- package/dist/codemirror/core/editorTheme.d.ts +39 -0
- package/dist/codemirror/core/editorTheme.js +498 -0
- package/dist/codemirror/core/editorTheme.js.map +1 -0
- package/dist/codemirror/core/hostFacets.d.ts +58 -0
- package/dist/codemirror/core/hostFacets.js +27 -0
- package/dist/codemirror/core/hostFacets.js.map +1 -0
- package/dist/codemirror/core/hrWidget.d.ts +22 -0
- package/dist/codemirror/core/hrWidget.js +22 -0
- package/dist/codemirror/core/hrWidget.js.map +1 -0
- package/dist/codemirror/core/htmlEscape.d.ts +6 -0
- package/dist/codemirror/core/htmlEscape.js +12 -0
- package/dist/codemirror/core/htmlEscape.js.map +1 -0
- package/dist/codemirror/core/index.d.ts +13 -0
- package/dist/codemirror/core/index.js +9 -0
- package/dist/codemirror/core/index.js.map +1 -0
- package/dist/codemirror/core/inlineScan.d.ts +49 -0
- package/dist/codemirror/core/inlineScan.js +31 -0
- package/dist/codemirror/core/inlineScan.js.map +1 -0
- package/dist/codemirror/core/lineStructure.d.ts +47 -0
- package/dist/codemirror/core/lineStructure.js +64 -0
- package/dist/codemirror/core/lineStructure.js.map +1 -0
- package/dist/codemirror/core/linkResolution.d.ts +36 -0
- package/dist/codemirror/core/linkResolution.js +58 -0
- package/dist/codemirror/core/linkResolution.js.map +1 -0
- package/dist/codemirror/core/paint.d.ts +118 -0
- package/dist/codemirror/core/paint.js +42 -0
- package/dist/codemirror/core/paint.js.map +1 -0
- package/dist/codemirror/core/parseToEnd.d.ts +24 -0
- package/dist/codemirror/core/parseToEnd.js +38 -0
- package/dist/codemirror/core/parseToEnd.js.map +1 -0
- package/dist/codemirror/core/plugin.d.ts +32 -0
- package/dist/codemirror/core/plugin.js +161 -0
- package/dist/codemirror/core/plugin.js.map +1 -0
- package/dist/codemirror/core/registry.d.ts +38 -0
- package/dist/codemirror/core/registry.js +133 -0
- package/dist/codemirror/core/registry.js.map +1 -0
- package/dist/codemirror/core/testKeys.d.ts +17 -0
- package/dist/codemirror/core/testKeys.js +11 -0
- package/dist/codemirror/core/testKeys.js.map +1 -0
- package/dist/codemirror/core/treeAt.d.ts +31 -0
- package/dist/codemirror/core/treeAt.js +10 -0
- package/dist/codemirror/core/treeAt.js.map +1 -0
- package/dist/codemirror/extensions/footnoteExtension.d.ts +9 -0
- package/dist/codemirror/extensions/footnoteExtension.js +14 -0
- package/dist/codemirror/extensions/footnoteExtension.js.map +1 -0
- package/dist/codemirror/extensions/highlightExtension.d.ts +9 -0
- package/dist/codemirror/extensions/highlightExtension.js +14 -0
- package/dist/codemirror/extensions/highlightExtension.js.map +1 -0
- package/dist/codemirror/extensions/index.d.ts +12 -0
- package/dist/codemirror/extensions/index.js +19 -0
- package/dist/codemirror/extensions/index.js.map +1 -0
- package/dist/codemirror/extensions/loader.d.ts +24 -0
- package/dist/codemirror/extensions/loader.js +33 -0
- package/dist/codemirror/extensions/loader.js.map +1 -0
- package/dist/codemirror/extensions/mathExtension.d.ts +9 -0
- package/dist/codemirror/extensions/mathExtension.js +14 -0
- package/dist/codemirror/extensions/mathExtension.js.map +1 -0
- package/dist/codemirror/extensions/mermaidExtension.d.ts +9 -0
- package/dist/codemirror/extensions/mermaidExtension.js +12 -0
- package/dist/codemirror/extensions/mermaidExtension.js.map +1 -0
- package/dist/codemirror/extensions/tableExtension.d.ts +13 -0
- package/dist/codemirror/extensions/tableExtension.js +39 -0
- package/dist/codemirror/extensions/tableExtension.js.map +1 -0
- package/dist/codemirror/extensions/types.d.ts +39 -0
- package/dist/codemirror/extensions/types.js +1 -0
- package/dist/codemirror/extensions/types.js.map +1 -0
- package/dist/codemirror/extensions/wikilinkExtension.d.ts +9 -0
- package/dist/codemirror/extensions/wikilinkExtension.js +14 -0
- package/dist/codemirror/extensions/wikilinkExtension.js.map +1 -0
- package/dist/codemirror/features/blockCommandSteps.d.ts +20 -0
- package/dist/codemirror/features/blockCommandSteps.js +83 -0
- package/dist/codemirror/features/blockCommandSteps.js.map +1 -0
- package/dist/codemirror/footnote/footnotePlugin.d.ts +10 -0
- package/dist/codemirror/footnote/footnotePlugin.js +78 -0
- package/dist/codemirror/footnote/footnotePlugin.js.map +1 -0
- package/dist/codemirror/footnote/footnoteScanRule.d.ts +9 -0
- package/dist/codemirror/footnote/footnoteScanRule.js +12 -0
- package/dist/codemirror/footnote/footnoteScanRule.js.map +1 -0
- package/dist/codemirror/footnote/index.d.ts +2 -0
- package/dist/codemirror/footnote/index.js +2 -0
- package/dist/codemirror/footnote/index.js.map +1 -0
- package/dist/codemirror/format/blockCommands.d.ts +17 -0
- package/dist/codemirror/format/blockCommands.js +176 -0
- package/dist/codemirror/format/blockCommands.js.map +1 -0
- package/dist/codemirror/format/formatCommands.d.ts +11 -0
- package/dist/codemirror/format/formatCommands.js +132 -0
- package/dist/codemirror/format/formatCommands.js.map +1 -0
- package/dist/codemirror/format/index.d.ts +4 -0
- package/dist/codemirror/format/index.js +3 -0
- package/dist/codemirror/format/index.js.map +1 -0
- package/dist/codemirror/highlight/highlightPlugin.d.ts +10 -0
- package/dist/codemirror/highlight/highlightPlugin.js +66 -0
- package/dist/codemirror/highlight/highlightPlugin.js.map +1 -0
- package/dist/codemirror/highlight/highlightScanRule.d.ts +8 -0
- package/dist/codemirror/highlight/highlightScanRule.js +12 -0
- package/dist/codemirror/highlight/highlightScanRule.js.map +1 -0
- package/dist/codemirror/highlight/index.d.ts +2 -0
- package/dist/codemirror/highlight/index.js +2 -0
- package/dist/codemirror/highlight/index.js.map +1 -0
- package/dist/codemirror/html/htmlWidget.d.ts +23 -0
- package/dist/codemirror/html/htmlWidget.js +67 -0
- package/dist/codemirror/html/htmlWidget.js.map +1 -0
- package/dist/codemirror/html/index.d.ts +4 -0
- package/dist/codemirror/html/index.js +2 -0
- package/dist/codemirror/html/index.js.map +1 -0
- package/dist/codemirror/image/imageActionMenu.d.ts +14 -0
- package/dist/codemirror/image/imageActionMenu.js +112 -0
- package/dist/codemirror/image/imageActionMenu.js.map +1 -0
- package/dist/codemirror/image/imageEditEvent.d.ts +20 -0
- package/dist/codemirror/image/imageEditEvent.js +6 -0
- package/dist/codemirror/image/imageEditEvent.js.map +1 -0
- package/dist/codemirror/image/imageInsertHandlers.d.ts +13 -0
- package/dist/codemirror/image/imageInsertHandlers.js +64 -0
- package/dist/codemirror/image/imageInsertHandlers.js.map +1 -0
- package/dist/codemirror/image/imageWidget.d.ts +49 -0
- package/dist/codemirror/image/imageWidget.js +83 -0
- package/dist/codemirror/image/imageWidget.js.map +1 -0
- package/dist/codemirror/image/index.d.ts +8 -0
- package/dist/codemirror/image/index.js +5 -0
- package/dist/codemirror/image/index.js.map +1 -0
- package/dist/codemirror/interaction/clickModel.d.ts +43 -0
- package/dist/codemirror/interaction/clickModel.js +99 -0
- package/dist/codemirror/interaction/clickModel.js.map +1 -0
- package/dist/codemirror/interaction/cursorModel.d.ts +10 -0
- package/dist/codemirror/interaction/cursorModel.js +58 -0
- package/dist/codemirror/interaction/cursorModel.js.map +1 -0
- package/dist/codemirror/interaction/deleteNormalizer.d.ts +18 -0
- package/dist/codemirror/interaction/deleteNormalizer.js +157 -0
- package/dist/codemirror/interaction/deleteNormalizer.js.map +1 -0
- package/dist/codemirror/interaction/flankingGuard.d.ts +20 -0
- package/dist/codemirror/interaction/flankingGuard.js +48 -0
- package/dist/codemirror/interaction/flankingGuard.js.map +1 -0
- package/dist/codemirror/interaction/index.d.ts +7 -0
- package/dist/codemirror/interaction/index.js +6 -0
- package/dist/codemirror/interaction/index.js.map +1 -0
- package/dist/codemirror/interaction/visiblePosition.d.ts +43 -0
- package/dist/codemirror/interaction/visiblePosition.js +98 -0
- package/dist/codemirror/interaction/visiblePosition.js.map +1 -0
- package/dist/codemirror/list/bulletWidget.d.ts +61 -0
- package/dist/codemirror/list/bulletWidget.js +84 -0
- package/dist/codemirror/list/bulletWidget.js.map +1 -0
- package/dist/codemirror/list/index.d.ts +4 -0
- package/dist/codemirror/list/index.js +3 -0
- package/dist/codemirror/list/index.js.map +1 -0
- package/dist/codemirror/list/listContinuation.d.ts +28 -0
- package/dist/codemirror/list/listContinuation.js +61 -0
- package/dist/codemirror/list/listContinuation.js.map +1 -0
- package/dist/codemirror/list/listIndent.d.ts +8 -0
- package/dist/codemirror/list/listIndent.js +95 -0
- package/dist/codemirror/list/listIndent.js.map +1 -0
- package/dist/codemirror/list/taskCheckboxWidget.d.ts +42 -0
- package/dist/codemirror/list/taskCheckboxWidget.js +47 -0
- package/dist/codemirror/list/taskCheckboxWidget.js.map +1 -0
- package/dist/codemirror/math/index.d.ts +3 -0
- package/dist/codemirror/math/index.js +2 -0
- package/dist/codemirror/math/index.js.map +1 -0
- package/dist/codemirror/math/mathPlugin.d.ts +10 -0
- package/dist/codemirror/math/mathPlugin.js +73 -0
- package/dist/codemirror/math/mathPlugin.js.map +1 -0
- package/dist/codemirror/math/mathScanRule.d.ts +16 -0
- package/dist/codemirror/math/mathScanRule.js +18 -0
- package/dist/codemirror/math/mathScanRule.js.map +1 -0
- package/dist/codemirror/math/mathWidget.d.ts +15 -0
- package/dist/codemirror/math/mathWidget.js +36 -0
- package/dist/codemirror/math/mathWidget.js.map +1 -0
- package/dist/codemirror/mermaid/index.d.ts +4 -0
- package/dist/codemirror/mermaid/index.js +3 -0
- package/dist/codemirror/mermaid/index.js.map +1 -0
- package/dist/codemirror/mermaid/mermaidPlugin.d.ts +25 -0
- package/dist/codemirror/mermaid/mermaidPlugin.js +78 -0
- package/dist/codemirror/mermaid/mermaidPlugin.js.map +1 -0
- package/dist/codemirror/mermaid/mermaidRender.d.ts +42 -0
- package/dist/codemirror/mermaid/mermaidRender.js +136 -0
- package/dist/codemirror/mermaid/mermaidRender.js.map +1 -0
- package/dist/codemirror/mermaid/mermaidWidget.d.ts +42 -0
- package/dist/codemirror/mermaid/mermaidWidget.js +142 -0
- package/dist/codemirror/mermaid/mermaidWidget.js.map +1 -0
- package/dist/codemirror/selectionLayer.d.ts +43 -0
- package/dist/codemirror/selectionLayer.js +135 -0
- package/dist/codemirror/selectionLayer.js.map +1 -0
- package/dist/codemirror/table/cellDividerWidget.d.ts +9 -0
- package/dist/codemirror/table/cellDividerWidget.js +19 -0
- package/dist/codemirror/table/cellDividerWidget.js.map +1 -0
- package/dist/codemirror/table/index.d.ts +5 -0
- package/dist/codemirror/table/index.js +4 -0
- package/dist/codemirror/table/index.js.map +1 -0
- package/dist/codemirror/table/tableArmed.d.ts +27 -0
- package/dist/codemirror/table/tableArmed.js +43 -0
- package/dist/codemirror/table/tableArmed.js.map +1 -0
- package/dist/codemirror/table/tableCell.d.ts +19 -0
- package/dist/codemirror/table/tableCell.js +15 -0
- package/dist/codemirror/table/tableCell.js.map +1 -0
- package/dist/codemirror/table/tableCellNav.d.ts +51 -0
- package/dist/codemirror/table/tableCellNav.js +47 -0
- package/dist/codemirror/table/tableCellNav.js.map +1 -0
- package/dist/codemirror/table/tableContextMenu.d.ts +22 -0
- package/dist/codemirror/table/tableContextMenu.js +139 -0
- package/dist/codemirror/table/tableContextMenu.js.map +1 -0
- package/dist/codemirror/table/tableEditCommands.d.ts +29 -0
- package/dist/codemirror/table/tableEditCommands.js +86 -0
- package/dist/codemirror/table/tableEditCommands.js.map +1 -0
- package/dist/codemirror/table/tableExcerpt.d.ts +29 -0
- package/dist/codemirror/table/tableExcerpt.js +34 -0
- package/dist/codemirror/table/tableExcerpt.js.map +1 -0
- package/dist/codemirror/table/tableField.d.ts +6 -0
- package/dist/codemirror/table/tableField.js +37 -0
- package/dist/codemirror/table/tableField.js.map +1 -0
- package/dist/codemirror/table/tableGeometry.d.ts +33 -0
- package/dist/codemirror/table/tableGeometry.js +28 -0
- package/dist/codemirror/table/tableGeometry.js.map +1 -0
- package/dist/codemirror/table/tableInline.d.ts +37 -0
- package/dist/codemirror/table/tableInline.js +105 -0
- package/dist/codemirror/table/tableInline.js.map +1 -0
- package/dist/codemirror/table/tableModel.d.ts +45 -0
- package/dist/codemirror/table/tableModel.js +98 -0
- package/dist/codemirror/table/tableModel.js.map +1 -0
- package/dist/codemirror/tablev2/bridgeRules.d.ts +48 -0
- package/dist/codemirror/tablev2/bridgeRules.js +42 -0
- package/dist/codemirror/tablev2/bridgeRules.js.map +1 -0
- package/dist/codemirror/tablev2/cellEditingSurface.d.ts +79 -0
- package/dist/codemirror/tablev2/cellEditingSurface.js +70 -0
- package/dist/codemirror/tablev2/cellEditingSurface.js.map +1 -0
- package/dist/codemirror/tablev2/cellText.d.ts +11 -0
- package/dist/codemirror/tablev2/cellText.js +12 -0
- package/dist/codemirror/tablev2/cellText.js.map +1 -0
- package/dist/codemirror/tablev2/inlineCellSurface.d.ts +38 -0
- package/dist/codemirror/tablev2/inlineCellSurface.js +162 -0
- package/dist/codemirror/tablev2/inlineCellSurface.js.map +1 -0
- package/dist/codemirror/tablev2/overlayCellSurface.d.ts +36 -0
- package/dist/codemirror/tablev2/overlayCellSurface.js +150 -0
- package/dist/codemirror/tablev2/overlayCellSurface.js.map +1 -0
- package/dist/codemirror/tablev2/tableEditingSteps.d.ts +12 -0
- package/dist/codemirror/tablev2/tableEditingSteps.js +518 -0
- package/dist/codemirror/tablev2/tableEditingSteps.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2HoverControls.d.ts +23 -0
- package/dist/codemirror/tablev2/tableV2HoverControls.js +89 -0
- package/dist/codemirror/tablev2/tableV2HoverControls.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2Interaction.d.ts +29 -0
- package/dist/codemirror/tablev2/tableV2Interaction.js +224 -0
- package/dist/codemirror/tablev2/tableV2Interaction.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2Selection.d.ts +45 -0
- package/dist/codemirror/tablev2/tableV2Selection.js +81 -0
- package/dist/codemirror/tablev2/tableV2Selection.js.map +1 -0
- package/dist/codemirror/tablev2/tableV2Sync.d.ts +13 -0
- package/dist/codemirror/tablev2/tableV2Sync.js +13 -0
- package/dist/codemirror/tablev2/tableV2Sync.js.map +1 -0
- package/dist/codemirror/tablev2/tableWidgetV2.d.ts +46 -0
- package/dist/codemirror/tablev2/tableWidgetV2.js +139 -0
- package/dist/codemirror/tablev2/tableWidgetV2.js.map +1 -0
- package/dist/codemirror/updateBus.d.ts +29 -0
- package/dist/codemirror/updateBus.js +26 -0
- package/dist/codemirror/updateBus.js.map +1 -0
- package/dist/codemirror/wikilink/index.d.ts +3 -0
- package/dist/codemirror/wikilink/index.js +2 -0
- package/dist/codemirror/wikilink/index.js.map +1 -0
- package/dist/codemirror/wikilink/wikilinkPlugin.d.ts +40 -0
- package/dist/codemirror/wikilink/wikilinkPlugin.js +89 -0
- package/dist/codemirror/wikilink/wikilinkPlugin.js.map +1 -0
- package/dist/codemirror/wikilink/wikilinkScanRule.d.ts +9 -0
- package/dist/codemirror/wikilink/wikilinkScanRule.js +13 -0
- package/dist/codemirror/wikilink/wikilinkScanRule.js.map +1 -0
- package/dist/frontmatter.d.ts +79 -0
- package/dist/frontmatter.js +58 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/imageInsert.d.ts +66 -0
- package/dist/imageInsert.js +111 -0
- package/dist/imageInsert.js.map +1 -0
- package/dist/imageSrcResolver.d.ts +55 -0
- package/dist/imageSrcResolver.js +49 -0
- package/dist/imageSrcResolver.js.map +1 -0
- package/dist/index.d.ts +35 -880
- package/dist/index.js +128 -5996
- package/dist/index.js.map +1 -1
- package/dist/links/wikilink.d.ts +26 -0
- package/dist/links/wikilink.js +54 -0
- package/dist/links/wikilink.js.map +1 -0
- package/dist/links/workspaceLink.d.ts +34 -0
- package/dist/links/workspaceLink.js +60 -0
- package/dist/links/workspaceLink.js.map +1 -0
- package/dist/types.d.ts +20 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { markdown, markdownLanguage } from "@codemirror/lang-markdown";
|
|
3
|
+
import { ensureSyntaxTree } from "@codemirror/language";
|
|
4
|
+
import { EditorSelection, EditorState } from "@codemirror/state";
|
|
5
|
+
import { EditorView } from "@codemirror/view";
|
|
6
|
+
import { markdownDecorationsPlugin } from "./plugin.js";
|
|
7
|
+
import {
|
|
8
|
+
mergeExtensions,
|
|
9
|
+
footnoteExtension,
|
|
10
|
+
highlightExtension,
|
|
11
|
+
mathExtension,
|
|
12
|
+
mermaidExtension,
|
|
13
|
+
tableExtension,
|
|
14
|
+
wikilinkExtension
|
|
15
|
+
} from "../extensions/index.js";
|
|
16
|
+
const live = [];
|
|
17
|
+
const FULL_EXTENSIONS = mergeExtensions([
|
|
18
|
+
wikilinkExtension,
|
|
19
|
+
highlightExtension,
|
|
20
|
+
footnoteExtension,
|
|
21
|
+
mathExtension,
|
|
22
|
+
mermaidExtension,
|
|
23
|
+
tableExtension()
|
|
24
|
+
]).extensions;
|
|
25
|
+
function makeEditor(doc, caret2 = 0, extra = []) {
|
|
26
|
+
const parent = document.createElement("div");
|
|
27
|
+
document.body.appendChild(parent);
|
|
28
|
+
const state = EditorState.create({
|
|
29
|
+
doc,
|
|
30
|
+
selection: EditorSelection.cursor(caret2),
|
|
31
|
+
extensions: [markdown({ base: markdownLanguage }), markdownDecorationsPlugin, ...extra]
|
|
32
|
+
});
|
|
33
|
+
if (ensureSyntaxTree(state, doc.length, 5e3) === null) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
`the markdown parse did not finish within 5s for a ${doc.length}-char document; any assertion after this would be testing an unparsed editor`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const view = new EditorView({ parent, state });
|
|
39
|
+
if (ensureSyntaxTree(view.state, doc.length, 5e3) === null) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`the markdown parse did not finish within 5s for a ${doc.length}-char document; any assertion after this would be testing an unparsed editor`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
live.push(view);
|
|
45
|
+
return view;
|
|
46
|
+
}
|
|
47
|
+
function makeFullEditor(doc, caret2 = 0, extra = []) {
|
|
48
|
+
return makeEditor(doc, caret2, [...FULL_EXTENSIONS, ...extra]);
|
|
49
|
+
}
|
|
50
|
+
function destroyEditors() {
|
|
51
|
+
for (const view of live.splice(0)) {
|
|
52
|
+
view.destroy();
|
|
53
|
+
view.dom.parentElement?.remove();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function caret(view) {
|
|
57
|
+
return view.state.selection.main.head;
|
|
58
|
+
}
|
|
59
|
+
function text(view) {
|
|
60
|
+
return view.state.doc.toString();
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
caret,
|
|
64
|
+
destroyEditors,
|
|
65
|
+
makeEditor,
|
|
66
|
+
makeFullEditor,
|
|
67
|
+
text
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=editorTestHarness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/codemirror/core/editorTestHarness.ts"],"sourcesContent":["/**\n * Test-only harness: a headless CodeMirror `EditorView` wired with the markdown\n * language + the live-preview decoration plugin, for keystroke-level tests of\n * the editor commands (cursor motion, delete, list continuation, formatting).\n *\n * CodeMirror runs under jsdom; each test FILE that uses this must declare\n * `// @vitest-environment jsdom` at its top. The Lezer tree is built eagerly so\n * the plugin's atomic/hidden ranges (which the commands consult) are present.\n *\n * Not shipped — nothing in the app imports it, so it tree-shakes out.\n */\n\nimport { markdown, markdownLanguage } from \"@codemirror/lang-markdown\";\nimport { ensureSyntaxTree } from \"@codemirror/language\";\nimport { EditorSelection, EditorState, type Extension } from \"@codemirror/state\";\nimport { EditorView } from \"@codemirror/view\";\n\nimport { markdownDecorationsPlugin } from \"./plugin\";\nimport {\n mergeExtensions,\n footnoteExtension,\n highlightExtension,\n mathExtension,\n mermaidExtension,\n tableExtension,\n wikilinkExtension,\n} from \"../extensions\";\n\nconst live: EditorView[] = [];\n\n// The full rendering extension set the real editor composes — so a rendered-\n// output test sees what the user sees (wikilinks, highlight, footnotes, math,\n// tables), not just the base markdown decorations.\nconst FULL_EXTENSIONS = mergeExtensions([\n wikilinkExtension,\n highlightExtension,\n footnoteExtension,\n mathExtension,\n mermaidExtension,\n tableExtension(),\n]).extensions;\n\n/** A headless editor over `doc` with the caret at `caret`. Extra extensions\n * (e.g. a keymap under test) can be appended. Track-and-cleanup via\n * {@link destroyEditors} in an `afterEach`. */\nexport function makeEditor(doc: string, caret = 0, extra: Extension[] = []): EditorView {\n const parent = document.createElement(\"div\");\n document.body.appendChild(parent);\n const state = EditorState.create({\n doc,\n selection: EditorSelection.cursor(caret),\n extensions: [markdown({ base: markdownLanguage }), markdownDecorationsPlugin, ...extra],\n });\n // The commands under test read the plugin's atomic/hidden ranges, which are\n // derived from the Lezer tree — so a tree that is not finished makes a guard\n // silently not fire, and the test fails as a confusing content diff rather\n // than as \"the parse did not finish\". `ensureSyntaxTree` reports that by\n // returning null; ignoring it is how a parse timeout became a mystery.\n if (ensureSyntaxTree(state, doc.length, 5000) === null) {\n throw new Error(\n `the markdown parse did not finish within 5s for a ${doc.length}-char document; ` +\n \"any assertion after this would be testing an unparsed editor\",\n );\n }\n const view = new EditorView({ parent, state });\n // Again, on the view's own state. Creating the view starts CodeMirror's\n // viewport-driven parse, and jsdom has no layout — so the viewport can be\n // tiny and `syntaxTree(view.state)` returns a tree that stops short of the\n // caret. A command asking \"am I inside a fence?\" then gets `null` and takes\n // the plain-text path, which is a wrong answer rather than a slow one.\n if (ensureSyntaxTree(view.state, doc.length, 5000) === null) {\n throw new Error(\n `the markdown parse did not finish within 5s for a ${doc.length}-char document; ` +\n \"any assertion after this would be testing an unparsed editor\",\n );\n }\n live.push(view);\n return view;\n}\n\n/** Like {@link makeEditor} but with every rendering extension the real editor\n * loads — for tests that assert the user-visible rendered output, not just the\n * source. */\nexport function makeFullEditor(doc: string, caret = 0, extra: Extension[] = []): EditorView {\n return makeEditor(doc, caret, [...FULL_EXTENSIONS, ...extra]);\n}\n\n/** Tear down every editor made since the last call. Call in `afterEach`. */\nexport function destroyEditors(): void {\n for (const view of live.splice(0)) {\n view.destroy();\n view.dom.parentElement?.remove();\n }\n}\n\n/** The current caret offset (head of the main selection). */\nexport function caret(view: EditorView): number {\n return view.state.selection.main.head;\n}\n\n/** The current document text. */\nexport function text(view: EditorView): string {\n return view.state.doc.toString();\n}\n"],"mappings":";AAYA,SAAS,UAAU,wBAAwB;AAC3C,SAAS,wBAAwB;AACjC,SAAS,iBAAiB,mBAAmC;AAC7D,SAAS,kBAAkB;AAE3B,SAAS,iCAAiC;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,OAAqB,CAAC;AAK5B,MAAM,kBAAkB,gBAAgB;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,CAAC,EAAE;AAKI,SAAS,WAAW,KAAaA,SAAQ,GAAG,QAAqB,CAAC,GAAe;AACtF,QAAM,SAAS,SAAS,cAAc,KAAK;AAC3C,WAAS,KAAK,YAAY,MAAM;AAChC,QAAM,QAAQ,YAAY,OAAO;AAAA,IAC/B;AAAA,IACA,WAAW,gBAAgB,OAAOA,MAAK;AAAA,IACvC,YAAY,CAAC,SAAS,EAAE,MAAM,iBAAiB,CAAC,GAAG,2BAA2B,GAAG,KAAK;AAAA,EACxF,CAAC;AAMD,MAAI,iBAAiB,OAAO,IAAI,QAAQ,GAAI,MAAM,MAAM;AACtD,UAAM,IAAI;AAAA,MACR,qDAAqD,IAAI,MAAM;AAAA,IAEjE;AAAA,EACF;AACA,QAAM,OAAO,IAAI,WAAW,EAAE,QAAQ,MAAM,CAAC;AAM7C,MAAI,iBAAiB,KAAK,OAAO,IAAI,QAAQ,GAAI,MAAM,MAAM;AAC3D,UAAM,IAAI;AAAA,MACR,qDAAqD,IAAI,MAAM;AAAA,IAEjE;AAAA,EACF;AACA,OAAK,KAAK,IAAI;AACd,SAAO;AACT;AAKO,SAAS,eAAe,KAAaA,SAAQ,GAAG,QAAqB,CAAC,GAAe;AAC1F,SAAO,WAAW,KAAKA,QAAO,CAAC,GAAG,iBAAiB,GAAG,KAAK,CAAC;AAC9D;AAGO,SAAS,iBAAuB;AACrC,aAAW,QAAQ,KAAK,OAAO,CAAC,GAAG;AACjC,SAAK,QAAQ;AACb,SAAK,IAAI,eAAe,OAAO;AAAA,EACjC;AACF;AAGO,SAAS,MAAM,MAA0B;AAC9C,SAAO,KAAK,MAAM,UAAU,KAAK;AACnC;AAGO,SAAS,KAAK,MAA0B;AAC7C,SAAO,KAAK,MAAM,IAAI,SAAS;AACjC;","names":["caret"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as _codemirror_state from '@codemirror/state';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Editor theme.
|
|
5
|
+
*
|
|
6
|
+
* Lives in `EditorView.baseTheme` rather than in `global.scss` for
|
|
7
|
+
* three load-bearing reasons:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Line-metric integrity.** CM6 measures line heights from the
|
|
10
|
+
* DOM through a `requestMeasure` cycle to compute click → byte
|
|
11
|
+
* and scroll → viewport mappings. Styles injected via
|
|
12
|
+
* `EditorView.theme` participate in that cycle at the right
|
|
13
|
+
* moment; styles from an external sheet can land *after* the
|
|
14
|
+
* first measurement, so clicks land on the wrong line until the
|
|
15
|
+
* next measure fires. (This was the click-drift the spike
|
|
16
|
+
* shipped — fixed by moving here.)
|
|
17
|
+
* 2. **Specificity that beats the base theme without `!important`.**
|
|
18
|
+
* CM6 ships its monospace-and-purple base theme via the same
|
|
19
|
+
* mechanism; layering `EditorView.theme` on top is the only
|
|
20
|
+
* collision-free pattern.
|
|
21
|
+
* 3. **No margin/padding on heading lines.** Margins between
|
|
22
|
+
* `.cm-line` siblings shift visual position without changing
|
|
23
|
+
* `offsetTop`, so the metric cache and the eye disagree —
|
|
24
|
+
* that's the canonical click-on-wrong-line bug. We change
|
|
25
|
+
* `font:` (which doesn't touch line-height), nothing else.
|
|
26
|
+
*
|
|
27
|
+
* Zettlr's `markdown-editor/theme/editor.ts` is the canonical
|
|
28
|
+
* reference for this pattern in the open-source ecosystem.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* `EditorView.theme` (not `baseTheme`) — `baseTheme` is the
|
|
32
|
+
* low-priority slot meant for theme packages and gets out-specifity'd
|
|
33
|
+
* by any app-level CSS (Carbon's globals in our case). `theme` is the
|
|
34
|
+
* app-priority slot; our intent is to override CM6's defaults, so
|
|
35
|
+
* this is the right tier.
|
|
36
|
+
*/
|
|
37
|
+
declare const editorBaseTheme: _codemirror_state.Extension;
|
|
38
|
+
|
|
39
|
+
export { editorBaseTheme };
|
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import "../../chunk-V6TY7KAL.js";
|
|
2
|
+
import { EditorView } from "@codemirror/view";
|
|
3
|
+
const editorBaseTheme = EditorView.theme({
|
|
4
|
+
// CM6 paints a focus outline by default. The caret IS the focus
|
|
5
|
+
// indicator in Compose; the box would be visual noise.
|
|
6
|
+
"&.cm-focused": {
|
|
7
|
+
outline: "none"
|
|
8
|
+
},
|
|
9
|
+
// Body type. Override CM6's monospace default *here* (not in the
|
|
10
|
+
// external stylesheet) so the measurement cycle sees it.
|
|
11
|
+
".cm-content": {
|
|
12
|
+
fontFamily: 'var(--cds-body-01-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)',
|
|
13
|
+
fontSize: "1rem",
|
|
14
|
+
// Tight line-height: the caret height tracks the line box
|
|
15
|
+
// (line-height × font-size), so anything above 1.4 starts to
|
|
16
|
+
// feel disproportionate. 1.4 is the value Zettlr uses for the
|
|
17
|
+
// same reason.
|
|
18
|
+
lineHeight: "1.4",
|
|
19
|
+
color: "var(--cds-text-primary, #161616)",
|
|
20
|
+
maxWidth: "48rem",
|
|
21
|
+
margin: "0 auto"
|
|
22
|
+
},
|
|
23
|
+
// Scroller padding — kept here so it's part of the same theme
|
|
24
|
+
// bundle as the content metrics.
|
|
25
|
+
".cm-scroller": {
|
|
26
|
+
padding: "1.5rem 3rem"
|
|
27
|
+
},
|
|
28
|
+
// Drawn selection (selectionLayer.ts) — ranges paint from logical state so
|
|
29
|
+
// the highlight survives the virtualized viewport. The widget tint sits
|
|
30
|
+
// ABOVE block widgets (their opaque backgrounds hide the below-layer band).
|
|
31
|
+
".cm-selectionBackground": {
|
|
32
|
+
background: "var(--cds-highlight, #d0e2ff)"
|
|
33
|
+
},
|
|
34
|
+
"&:not(.cm-focused) .cm-selectionBackground": {
|
|
35
|
+
background: "var(--cds-layer-accent-01, #e0e0e0)"
|
|
36
|
+
},
|
|
37
|
+
".cm-selectionWidgetTint": {
|
|
38
|
+
background: "rgba(15, 98, 254, 0.08)"
|
|
39
|
+
},
|
|
40
|
+
// Caret stroke. CM6 owns the height (it tracks the current line-box,
|
|
41
|
+
// so headings get a heading-sized caret automatically per spec 6.2).
|
|
42
|
+
// Width is spec's 1 px at the default root size, in rem so it follows the
|
|
43
|
+
// user's text-size preference; "thick caret" mode is a Phase-N follow-up.
|
|
44
|
+
//
|
|
45
|
+
// The COLOUR has to be stated. CodeMirror's base theme paints the caret
|
|
46
|
+
// `solid black` and only picks its lighter variant when the view theme is
|
|
47
|
+
// registered with `{ dark: true }`. This editor is themed through CSS custom
|
|
48
|
+
// properties instead, so CodeMirror believes it is always light — leaving a
|
|
49
|
+
// black caret on a dark canvas, invisible exactly where someone is typing.
|
|
50
|
+
".cm-cursor, .cm-dropCursor": {
|
|
51
|
+
borderLeftWidth: "0.0625rem",
|
|
52
|
+
borderLeftColor: "var(--cds-text-primary, #161616)"
|
|
53
|
+
},
|
|
54
|
+
// Headings — `font:` shorthand changes size + weight *without*
|
|
55
|
+
// setting line-height (it inherits the content's 1.5). The vertical
|
|
56
|
+
// breathing room is `padding` not `margin` for the click-metric
|
|
57
|
+
// reason above — sibling margins drift, sibling padding doesn't.
|
|
58
|
+
".cm-heading--1": {
|
|
59
|
+
fontWeight: "700",
|
|
60
|
+
fontSize: "2.0rem",
|
|
61
|
+
lineHeight: "1.3",
|
|
62
|
+
paddingTop: "0.6em",
|
|
63
|
+
paddingBottom: "0.2em"
|
|
64
|
+
},
|
|
65
|
+
".cm-heading--2": {
|
|
66
|
+
fontWeight: "700",
|
|
67
|
+
fontSize: "1.6rem",
|
|
68
|
+
lineHeight: "1.3",
|
|
69
|
+
paddingTop: "0.5em",
|
|
70
|
+
paddingBottom: "0.15em"
|
|
71
|
+
},
|
|
72
|
+
".cm-heading--3": {
|
|
73
|
+
fontWeight: "700",
|
|
74
|
+
fontSize: "1.3rem",
|
|
75
|
+
lineHeight: "1.3",
|
|
76
|
+
paddingTop: "0.4em",
|
|
77
|
+
paddingBottom: "0.1em"
|
|
78
|
+
},
|
|
79
|
+
".cm-heading--4": { fontWeight: "700", fontSize: "1.15rem", paddingTop: "0.3em" },
|
|
80
|
+
".cm-heading--5": { fontWeight: "700", fontSize: "1.05rem", paddingTop: "0.25em" },
|
|
81
|
+
".cm-heading--6": {
|
|
82
|
+
fontWeight: "700",
|
|
83
|
+
fontSize: "1.0rem",
|
|
84
|
+
color: "var(--cds-text-secondary, #525252)",
|
|
85
|
+
paddingTop: "0.2em"
|
|
86
|
+
},
|
|
87
|
+
// Inline / block styling. All sized by font + color only — never
|
|
88
|
+
// by margin/padding, never by line-height override.
|
|
89
|
+
".cm-strong": { fontWeight: "700" },
|
|
90
|
+
".cm-emphasis": { fontStyle: "italic" },
|
|
91
|
+
".cm-strikethrough": { textDecoration: "line-through" },
|
|
92
|
+
// Code backgrounds are translucent, never opaque: the drawn selection
|
|
93
|
+
// (selectionLayer.ts) paints BELOW the content, so an opaque background here
|
|
94
|
+
// blanks the highlight on exactly these rows/chips while the prose around
|
|
95
|
+
// them tints. The alphas composite to the intended resting colors on the
|
|
96
|
+
// white canvas — #e0e0e0 for the inline chip, #f6f8fa (GitHub-style) for
|
|
97
|
+
// fence lines.
|
|
98
|
+
".cm-inline-code": {
|
|
99
|
+
fontFamily: 'var(--cds-code-01-font-family, ui-monospace, "SF Mono", Menlo, monospace)',
|
|
100
|
+
fontSize: "0.92em",
|
|
101
|
+
padding: "0 0.25em",
|
|
102
|
+
background: "rgba(141, 141, 141, 0.27)",
|
|
103
|
+
borderRadius: "0.1875rem"
|
|
104
|
+
},
|
|
105
|
+
".cm-fenced-code": {
|
|
106
|
+
fontFamily: 'var(--cds-code-01-font-family, ui-monospace, "SF Mono", Menlo, monospace)',
|
|
107
|
+
fontSize: "0.92em",
|
|
108
|
+
background: "rgba(30, 80, 130, 0.04)",
|
|
109
|
+
paddingLeft: "0.75em",
|
|
110
|
+
paddingBottom: "0"
|
|
111
|
+
},
|
|
112
|
+
// Language tag on a fence's opener row — visible (never invisible typing)
|
|
113
|
+
// and rendered as a small pill so it reads as the block's chrome, not as a
|
|
114
|
+
// wrong-font first code line (§12.4/§12.7).
|
|
115
|
+
".cm-code-info": {
|
|
116
|
+
color: "var(--cds-text-secondary, #6f6f6f)",
|
|
117
|
+
fontSize: "0.75em",
|
|
118
|
+
background: "var(--cds-layer-accent-01, #e8ebee)",
|
|
119
|
+
padding: "0.1em 0.5em",
|
|
120
|
+
borderRadius: "999rem",
|
|
121
|
+
verticalAlign: "0.1em",
|
|
122
|
+
cursor: "pointer"
|
|
123
|
+
},
|
|
124
|
+
".cm-code-info:hover": {
|
|
125
|
+
background: "var(--cds-layer-accent-hover-01, #d1d7dc)",
|
|
126
|
+
color: "var(--cds-text-primary, #161616)"
|
|
127
|
+
},
|
|
128
|
+
// The languageless placeholder: same chip, dimmed, so every closed block
|
|
129
|
+
// has a discoverable language control.
|
|
130
|
+
".cm-code-info--unset": {
|
|
131
|
+
opacity: "0.55",
|
|
132
|
+
fontStyle: "italic"
|
|
133
|
+
},
|
|
134
|
+
".cm-blockquote": {
|
|
135
|
+
borderInlineStart: "0.1875rem solid var(--cds-border-subtle-02, #c6c6c6)",
|
|
136
|
+
paddingInlineStart: "0.75em",
|
|
137
|
+
color: "var(--cds-text-secondary, #525252)",
|
|
138
|
+
fontStyle: "italic"
|
|
139
|
+
},
|
|
140
|
+
// List-item line: small left indent so the bullet widget sits in
|
|
141
|
+
// its own column. Padding (not margin) keeps click metrics exact.
|
|
142
|
+
".cm-list-line": {
|
|
143
|
+
paddingInlineStart: "0.5em"
|
|
144
|
+
},
|
|
145
|
+
// Bullet widget — styled here so the widget's HTML inherits the
|
|
146
|
+
// right colour against body type.
|
|
147
|
+
".cm-bullet-widget": {
|
|
148
|
+
display: "inline-block",
|
|
149
|
+
width: "1em",
|
|
150
|
+
color: "var(--cds-text-secondary, #525252)",
|
|
151
|
+
fontWeight: "700"
|
|
152
|
+
},
|
|
153
|
+
// Ordered-list number (`1.`) — wider than a bullet's fixed 1em so multi-digit
|
|
154
|
+
// markers fit, with a small gap before the item text. Normal weight: a bold
|
|
155
|
+
// number reads as heavier than the body text it labels.
|
|
156
|
+
".cm-ordered-marker": {
|
|
157
|
+
width: "auto",
|
|
158
|
+
minWidth: "1.2em",
|
|
159
|
+
marginRight: "0.3em",
|
|
160
|
+
fontWeight: "normal"
|
|
161
|
+
},
|
|
162
|
+
// Task list checkbox — drawn as a Carbon checkbox, not the native control.
|
|
163
|
+
// `appearance: none` is what replaces WebKit's small rounded default; the box
|
|
164
|
+
// then matches the design system rather than approximating it with an accent
|
|
165
|
+
// colour over the native shape.
|
|
166
|
+
//
|
|
167
|
+
// Sized in `em`, not `rem`: a 1rem box beside 1rem text is as tall as the
|
|
168
|
+
// whole em box, so it towered over lowercase letters, whose cap height is
|
|
169
|
+
// nearer 0.7em. One knob — the checkbox's own `font-size` — drives the box,
|
|
170
|
+
// the tick and the baseline offset, so the parts cannot drift apart, and the
|
|
171
|
+
// control tracks the text if a list ever renders at another size.
|
|
172
|
+
".cm-task-checkbox": {
|
|
173
|
+
appearance: "none",
|
|
174
|
+
WebkitAppearance: "none",
|
|
175
|
+
boxSizing: "border-box",
|
|
176
|
+
position: "relative",
|
|
177
|
+
fontSize: "0.875em",
|
|
178
|
+
width: "1em",
|
|
179
|
+
height: "1em",
|
|
180
|
+
margin: "0 0.45em 0 0",
|
|
181
|
+
cursor: "pointer",
|
|
182
|
+
// Centres the box on the x-height rather than hanging it off the baseline.
|
|
183
|
+
verticalAlign: "-0.2em",
|
|
184
|
+
border: "0.0625em solid var(--cds-icon-primary, #161616)",
|
|
185
|
+
borderRadius: "0.0625em",
|
|
186
|
+
background: "transparent"
|
|
187
|
+
},
|
|
188
|
+
".cm-task-checkbox:checked": {
|
|
189
|
+
background: "var(--cds-icon-primary, #161616)",
|
|
190
|
+
borderColor: "var(--cds-icon-primary, #161616)"
|
|
191
|
+
},
|
|
192
|
+
// The tick: an L (right + bottom border) rotated 45° into a check.
|
|
193
|
+
//
|
|
194
|
+
// Drawn in `--cds-background`, NOT `--cds-icon-on-color`. "On color" means an
|
|
195
|
+
// icon on a branded fill and is white in every theme, while the box here is
|
|
196
|
+
// filled with `--cds-icon-primary` — which inverts. In dark that was a white
|
|
197
|
+
// tick on a near-white box: a checked item read as unchecked.
|
|
198
|
+
//
|
|
199
|
+
// `top` is the OPTICAL centre, not the geometric one. The L's ink sits below
|
|
200
|
+
// and right of its own rect centre, and `rotate(45deg)` turns that diagonal
|
|
201
|
+
// offset into a purely downward one — 0.065em of it — so the rect has to ride
|
|
202
|
+
// that much higher for the tick to look centred. Geometric centring (0.1875em)
|
|
203
|
+
// renders visibly low; the old 0.0625em was visibly high.
|
|
204
|
+
".cm-task-checkbox:checked::after": {
|
|
205
|
+
content: "''",
|
|
206
|
+
position: "absolute",
|
|
207
|
+
left: "0.3125em",
|
|
208
|
+
top: "0.125em",
|
|
209
|
+
width: "0.25em",
|
|
210
|
+
height: "0.5em",
|
|
211
|
+
border: "solid var(--cds-background, #ffffff)",
|
|
212
|
+
// 0.125em read as a heavy slab once the box shrank to 0.875em.
|
|
213
|
+
borderWidth: "0 0.1em 0.1em 0",
|
|
214
|
+
transform: "rotate(45deg)"
|
|
215
|
+
},
|
|
216
|
+
".cm-task-checkbox:focus-visible": {
|
|
217
|
+
outline: "0.125rem solid var(--cds-focus, #0f62fe)",
|
|
218
|
+
outlineOffset: "0.0625rem"
|
|
219
|
+
},
|
|
220
|
+
// Inline image widget. Constrained max-width so a single large
|
|
221
|
+
// image doesn't blow up the editor; lazy loading via `<img loading="lazy">`.
|
|
222
|
+
".cm-image-widget": {
|
|
223
|
+
display: "inline-block",
|
|
224
|
+
maxWidth: "min(100%, 32rem)",
|
|
225
|
+
height: "auto",
|
|
226
|
+
borderRadius: "0.25rem",
|
|
227
|
+
margin: "0.25em 0"
|
|
228
|
+
},
|
|
229
|
+
// Horizontal-rule widget. Inline span styled as a full-width
|
|
230
|
+
// border so the line stays inside CM6's line layout.
|
|
231
|
+
".cm-hr-widget": {
|
|
232
|
+
display: "inline-block",
|
|
233
|
+
width: "100%",
|
|
234
|
+
height: "0",
|
|
235
|
+
borderTop: "0.0625rem solid var(--cds-border-subtle-02, #c6c6c6)",
|
|
236
|
+
verticalAlign: "middle"
|
|
237
|
+
},
|
|
238
|
+
".cm-table-widget": {
|
|
239
|
+
borderCollapse: "collapse",
|
|
240
|
+
width: "100%",
|
|
241
|
+
// `fixed` distributes width evenly across columns instead of letting the
|
|
242
|
+
// auto algorithm shrink columns toward their content — with the inherited
|
|
243
|
+
// `cm-lineWrapping` word-breaking, an auto-shrunk column wraps one
|
|
244
|
+
// character per line ("T / o / p / i / c").
|
|
245
|
+
tableLayout: "fixed"
|
|
246
|
+
},
|
|
247
|
+
".cm-table-widget th, .cm-table-widget td": {
|
|
248
|
+
border: "0.0625rem solid var(--cds-border-subtle-02, #c6c6c6)",
|
|
249
|
+
padding: "0.4em 0.75em",
|
|
250
|
+
verticalAlign: "top",
|
|
251
|
+
// No native text-selection: a drag would otherwise zig-zag a ragged
|
|
252
|
+
// selection across cells (uneven heights). `tablev2` tracks the
|
|
253
|
+
// drag and tints whole cells uniformly instead; the cell editor re-enables
|
|
254
|
+
// selection for its own content (below).
|
|
255
|
+
userSelect: "none",
|
|
256
|
+
WebkitUserSelect: "none",
|
|
257
|
+
// Wrap at word boundaries like prose (overriding the `word-break: break-word`
|
|
258
|
+
// cm-lineWrapping inherits onto `.cm-content`), but still break a single
|
|
259
|
+
// over-long token (e.g. `complementarity/orchestration`) so it can't spill
|
|
260
|
+
// past its fixed-width column into the neighbour.
|
|
261
|
+
overflowWrap: "break-word",
|
|
262
|
+
wordBreak: "normal"
|
|
263
|
+
},
|
|
264
|
+
".cm-table-widget thead th": {
|
|
265
|
+
background: "var(--cds-layer-accent-01, #e8e8e8)",
|
|
266
|
+
fontWeight: "600",
|
|
267
|
+
textAlign: "left"
|
|
268
|
+
},
|
|
269
|
+
// The cell editor's own content stays selectable so a mounted cell edits
|
|
270
|
+
// normally (only the surrounding grid is locked, above).
|
|
271
|
+
".cm-table-widget .cm-content": {
|
|
272
|
+
userSelect: "text",
|
|
273
|
+
WebkitUserSelect: "text"
|
|
274
|
+
},
|
|
275
|
+
// Cell highlight: `--selected` is a drag-selection (tablev2);
|
|
276
|
+
// `--hover` previews the row/column a "Comment on this row/column" menu item
|
|
277
|
+
// targets; `--commenting` is held by the host while that comment composer is
|
|
278
|
+
// open. All read as the same even tint.
|
|
279
|
+
".cm-table-cell--selected, .cm-table-cell--hover, .cm-table-cell--commenting": {
|
|
280
|
+
backgroundColor: "var(--cds-highlight, #d0e2ff)"
|
|
281
|
+
},
|
|
282
|
+
// Hover inserters (tablev2/tableV2HoverControls.ts). The wrapper reserves a top + left
|
|
283
|
+
// padding gutter; JS parks the two "+" circles in it — clear of the grid, so
|
|
284
|
+
// they never clip at a corner or sit under the header.
|
|
285
|
+
".cm-table-wrap": {
|
|
286
|
+
position: "relative",
|
|
287
|
+
// Vertical spacing is PADDING, never margin — the same rule the headings and
|
|
288
|
+
// lists above follow. CM6 measures a block widget's height from its border
|
|
289
|
+
// box (margins excluded), so a margin here under-measures the table and
|
|
290
|
+
// drifts every click below it down onto the next line. The top padding
|
|
291
|
+
// doubles as the hover-"+" gutter.
|
|
292
|
+
paddingTop: "2.5em",
|
|
293
|
+
paddingBottom: "0.5em",
|
|
294
|
+
paddingLeft: "2em"
|
|
295
|
+
},
|
|
296
|
+
// Two-step delete (tableArmed.ts). The first Backspace/Delete next to a table
|
|
297
|
+
// parks the caret at its edge and arms it: the table gets a blue "selected"
|
|
298
|
+
// outline, and a green line is drawn at the armed edge — Zettlr's "green line
|
|
299
|
+
// cursor behind the table" cue, signalling the next press removes it. The
|
|
300
|
+
// caret is hidden while arming (it renders on the blank line just past the
|
|
301
|
+
// table, which reads as "the cursor never moved") by hiding the drawn cursor
|
|
302
|
+
// layer.
|
|
303
|
+
"&.cm-table-arming .cm-cursorLayer": {
|
|
304
|
+
display: "none"
|
|
305
|
+
},
|
|
306
|
+
".cm-table-armed .cm-table-widget": {
|
|
307
|
+
outline: "0.125rem solid var(--cds-border-interactive, #0f62fe)",
|
|
308
|
+
outlineOffset: "0.0625rem",
|
|
309
|
+
position: "relative"
|
|
310
|
+
},
|
|
311
|
+
".cm-table-wrap[data-armed-edge] .cm-table-widget::after": {
|
|
312
|
+
content: "''",
|
|
313
|
+
position: "absolute",
|
|
314
|
+
left: "0",
|
|
315
|
+
right: "0",
|
|
316
|
+
height: "0.1875rem",
|
|
317
|
+
background: "var(--cds-support-success, #24a148)",
|
|
318
|
+
pointerEvents: "none"
|
|
319
|
+
},
|
|
320
|
+
'.cm-table-wrap[data-armed-edge="end"] .cm-table-widget::after': {
|
|
321
|
+
bottom: "-0.375rem"
|
|
322
|
+
},
|
|
323
|
+
'.cm-table-wrap[data-armed-edge="start"] .cm-table-widget::after': {
|
|
324
|
+
top: "-0.375rem"
|
|
325
|
+
},
|
|
326
|
+
".cm-table-inserter": {
|
|
327
|
+
position: "absolute",
|
|
328
|
+
display: "none",
|
|
329
|
+
alignItems: "center",
|
|
330
|
+
justifyContent: "center",
|
|
331
|
+
width: "1.25rem",
|
|
332
|
+
height: "1.25rem",
|
|
333
|
+
borderRadius: "50%",
|
|
334
|
+
appearance: "none",
|
|
335
|
+
border: "none",
|
|
336
|
+
padding: "0",
|
|
337
|
+
cursor: "pointer",
|
|
338
|
+
zIndex: "3",
|
|
339
|
+
// Subtle at rest (a neutral chip); the primary accent is the hover
|
|
340
|
+
// affordance. The glyph is a centred SVG stroked with currentColor.
|
|
341
|
+
background: "var(--cds-layer-accent-01, #e0e0e0)",
|
|
342
|
+
color: "var(--cds-icon-secondary, #525252)",
|
|
343
|
+
boxShadow: "0 0.0625rem 0.125rem rgba(0, 0, 0, 0.12)",
|
|
344
|
+
transition: "background 80ms ease, color 80ms ease"
|
|
345
|
+
},
|
|
346
|
+
".cm-table-inserter:hover": {
|
|
347
|
+
background: "var(--cds-link-primary, #0f62fe)",
|
|
348
|
+
color: "#ffffff"
|
|
349
|
+
},
|
|
350
|
+
".cm-image-menu": {
|
|
351
|
+
background: "var(--cds-layer-01, #ffffff)",
|
|
352
|
+
border: "0.0625rem solid var(--cds-border-subtle-01, #e0e0e0)",
|
|
353
|
+
borderRadius: "0.125rem",
|
|
354
|
+
boxShadow: "0 0.25rem 0.75rem rgba(0, 0, 0, 0.15)",
|
|
355
|
+
padding: "0.25rem 0",
|
|
356
|
+
minWidth: "11rem",
|
|
357
|
+
fontFamily: 'var(--cds-body-01-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)',
|
|
358
|
+
fontSize: "0.875rem"
|
|
359
|
+
},
|
|
360
|
+
".cm-image-menu__item": {
|
|
361
|
+
appearance: "none",
|
|
362
|
+
background: "transparent",
|
|
363
|
+
border: "none",
|
|
364
|
+
textAlign: "start",
|
|
365
|
+
padding: "0.4rem 0.75rem",
|
|
366
|
+
cursor: "pointer",
|
|
367
|
+
width: "100%",
|
|
368
|
+
color: "var(--cds-text-primary, #161616)",
|
|
369
|
+
font: "inherit"
|
|
370
|
+
},
|
|
371
|
+
".cm-image-menu__item:hover": {
|
|
372
|
+
background: "var(--cds-layer-hover-01, #e8e8e8)"
|
|
373
|
+
},
|
|
374
|
+
".cm-image-menu__item--danger": {
|
|
375
|
+
color: "var(--cds-text-error, #da1e28)"
|
|
376
|
+
},
|
|
377
|
+
".cm-math-inline": {
|
|
378
|
+
fontFamily: "KaTeX_Main, serif"
|
|
379
|
+
},
|
|
380
|
+
".cm-math-block": {
|
|
381
|
+
display: "block",
|
|
382
|
+
margin: "0.5em 0",
|
|
383
|
+
textAlign: "center",
|
|
384
|
+
fontFamily: "KaTeX_Main, serif"
|
|
385
|
+
},
|
|
386
|
+
// A diagram reads as CONTENT, not a control: no fill or pointer on hover —
|
|
387
|
+
// just a hairline frame plus a corner "Edit" chip as the click-to-edit cue.
|
|
388
|
+
".cm-mermaid-block": {
|
|
389
|
+
position: "relative",
|
|
390
|
+
display: "flex",
|
|
391
|
+
justifyContent: "center",
|
|
392
|
+
margin: "0.5em 0",
|
|
393
|
+
padding: "0.75em",
|
|
394
|
+
borderRadius: "0.25rem"
|
|
395
|
+
},
|
|
396
|
+
".cm-mermaid-block:hover": {
|
|
397
|
+
outline: "0.0625rem solid var(--cds-border-subtle-01, #e0e0e0)"
|
|
398
|
+
},
|
|
399
|
+
// The click-to-select state — native selection paints nothing over a block
|
|
400
|
+
// widget, so the widget carries its own "I'm selected, ⌘C copies me" look.
|
|
401
|
+
".cm-mermaid-block--selected, .cm-mermaid-block--selected:hover": {
|
|
402
|
+
outline: "0.125rem solid var(--cds-focus, #0f62fe)",
|
|
403
|
+
outlineOffset: "-0.125rem",
|
|
404
|
+
background: "rgba(15, 98, 254, 0.06)"
|
|
405
|
+
},
|
|
406
|
+
".cm-mermaid-edit": {
|
|
407
|
+
position: "absolute",
|
|
408
|
+
insetBlockStart: "0.375rem",
|
|
409
|
+
insetInlineEnd: "0.375rem",
|
|
410
|
+
padding: "0.1rem 0.5rem",
|
|
411
|
+
fontSize: "0.75rem",
|
|
412
|
+
color: "var(--cds-text-secondary, #525252)",
|
|
413
|
+
background: "var(--cds-layer-01, #f4f4f4)",
|
|
414
|
+
border: "0.0625rem solid var(--cds-border-subtle-01, #e0e0e0)",
|
|
415
|
+
borderRadius: "999rem",
|
|
416
|
+
cursor: "pointer",
|
|
417
|
+
opacity: "0",
|
|
418
|
+
transition: "opacity 80ms ease"
|
|
419
|
+
},
|
|
420
|
+
".cm-mermaid-block:hover .cm-mermaid-edit": {
|
|
421
|
+
opacity: "1"
|
|
422
|
+
},
|
|
423
|
+
".cm-mermaid-block > svg": {
|
|
424
|
+
maxWidth: "100%",
|
|
425
|
+
height: "auto",
|
|
426
|
+
// Uniform click handling: SVG sub-elements otherwise swallow pointer
|
|
427
|
+
// events over parts of the diagram, making click-to-select land only on
|
|
428
|
+
// the background.
|
|
429
|
+
pointerEvents: "none"
|
|
430
|
+
},
|
|
431
|
+
".cm-mermaid-block--pending": {
|
|
432
|
+
color: "var(--cds-text-secondary, #525252)",
|
|
433
|
+
fontStyle: "italic"
|
|
434
|
+
},
|
|
435
|
+
".cm-mermaid-block--error": {
|
|
436
|
+
display: "block",
|
|
437
|
+
borderLeft: "0.1875rem solid var(--cds-support-error, #da1e28)",
|
|
438
|
+
background: "var(--cds-layer-01, #f4f4f4)"
|
|
439
|
+
},
|
|
440
|
+
".cm-mermaid-error__title": {
|
|
441
|
+
color: "var(--cds-text-error, #da1e28)",
|
|
442
|
+
fontSize: "0.875em"
|
|
443
|
+
},
|
|
444
|
+
".cm-mermaid-error__message": {
|
|
445
|
+
margin: "0.5em 0 0",
|
|
446
|
+
fontFamily: "'IBM Plex Mono', ui-monospace, monospace",
|
|
447
|
+
fontSize: "0.75em",
|
|
448
|
+
color: "var(--cds-text-secondary, #525252)",
|
|
449
|
+
whiteSpace: "pre-wrap",
|
|
450
|
+
overflowWrap: "anywhere"
|
|
451
|
+
},
|
|
452
|
+
".cm-html-inline, .cm-html-block": {
|
|
453
|
+
display: "inline"
|
|
454
|
+
},
|
|
455
|
+
".cm-html-block": {
|
|
456
|
+
display: "block",
|
|
457
|
+
margin: "0.5em 0"
|
|
458
|
+
},
|
|
459
|
+
".cm-link": {
|
|
460
|
+
color: "var(--cds-link-primary, #0f62fe)",
|
|
461
|
+
textDecoration: "underline"
|
|
462
|
+
},
|
|
463
|
+
// Wikilink label — distinguish from regular markdown links via a
|
|
464
|
+
// dashed underline so a non-technical reader can tell at a glance
|
|
465
|
+
// that this is a vault-internal target. Matches the Tiptap version
|
|
466
|
+
// (`.wikilink`).
|
|
467
|
+
".cm-wikilink": {
|
|
468
|
+
color: "var(--cds-link-primary, #0f62fe)",
|
|
469
|
+
textDecoration: "underline dashed",
|
|
470
|
+
cursor: "pointer"
|
|
471
|
+
},
|
|
472
|
+
// Explicit yellow, not var(--cds-highlight): the app maps that token to the
|
|
473
|
+
// drawn-selection color, and a mark bound to it is indistinguishable from
|
|
474
|
+
// selected text. Translucent so the below-content selection band reads
|
|
475
|
+
// through; the alpha composites to the intended #fff8c5 resting yellow on
|
|
476
|
+
// the white canvas.
|
|
477
|
+
".cm-highlight": {
|
|
478
|
+
background: "rgba(255, 235, 89, 0.35)",
|
|
479
|
+
padding: "0 0.1em",
|
|
480
|
+
borderRadius: "0.125rem"
|
|
481
|
+
},
|
|
482
|
+
".cm-footnote-ref": {
|
|
483
|
+
fontSize: "0.75em",
|
|
484
|
+
verticalAlign: "super",
|
|
485
|
+
color: "var(--cds-link-primary, #0f62fe)",
|
|
486
|
+
cursor: "pointer"
|
|
487
|
+
},
|
|
488
|
+
".cm-footnote-def": {
|
|
489
|
+
fontSize: "0.875em",
|
|
490
|
+
color: "var(--cds-text-secondary, #525252)",
|
|
491
|
+
paddingInlineStart: "0.5em",
|
|
492
|
+
borderInlineStart: "0.125rem solid var(--cds-border-subtle-02, #c6c6c6)"
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
export {
|
|
496
|
+
editorBaseTheme
|
|
497
|
+
};
|
|
498
|
+
//# sourceMappingURL=editorTheme.js.map
|