phormat 0.0.5
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/README.md +102 -0
- package/dist/assets/example-test.svelte +228 -0
- package/dist/debug/JsonDebug.svelte +19 -0
- package/dist/debug/JsonDebug.svelte.d.ts +6 -0
- package/dist/debug/JsonDebugNode.svelte +138 -0
- package/dist/debug/JsonDebugNode.svelte.d.ts +11 -0
- package/dist/demo/documentLifecycle.d.ts +57 -0
- package/dist/demo/documentLifecycle.js +196 -0
- package/dist/demo/index.d.ts +2 -0
- package/dist/demo/index.js +2 -0
- package/dist/editor/BlockEditor.svelte +112 -0
- package/dist/editor/BlockEditor.svelte.d.ts +7 -0
- package/dist/editor/BlockRow.svelte +76 -0
- package/dist/editor/BlockRow.svelte.d.ts +20 -0
- package/dist/editor/Editor.svelte +103 -0
- package/dist/editor/Editor.svelte.d.ts +7 -0
- package/dist/editor/MarkdownEditor.svelte.d.ts +160 -0
- package/dist/editor/MarkdownEditor.svelte.js +1119 -0
- package/dist/editor/NestedRowChrome.svelte +160 -0
- package/dist/editor/NestedRowChrome.svelte.d.ts +20 -0
- package/dist/editor/PhormatEditor.svelte +206 -0
- package/dist/editor/PhormatEditor.svelte.d.ts +26 -0
- package/dist/editor/RawMarkdownPanel.svelte +39 -0
- package/dist/editor/RawMarkdownPanel.svelte.d.ts +6 -0
- package/dist/editor/block-specs/BlockSpecMissing.svelte +12 -0
- package/dist/editor/block-specs/BlockSpecMissing.svelte.d.ts +7 -0
- package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte +32 -0
- package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/blockquote/commands.d.ts +2 -0
- package/dist/editor/block-specs/blockquote/commands.js +65 -0
- package/dist/editor/block-specs/blockquote/index.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/index.js +5 -0
- package/dist/editor/block-specs/blockquote/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/inlineSecondPass.js +35 -0
- package/dist/editor/block-specs/blockquote/parse.d.ts +16 -0
- package/dist/editor/block-specs/blockquote/parse.js +188 -0
- package/dist/editor/block-specs/blockquote/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/blockquote/reconcile.js +9 -0
- package/dist/editor/block-specs/blockquote/serialize.d.ts +6 -0
- package/dist/editor/block-specs/blockquote/serialize.js +55 -0
- package/dist/editor/block-specs/blockquote/types.d.ts +20 -0
- package/dist/editor/block-specs/blockquote/types.js +1 -0
- package/dist/editor/block-specs/blockquoteSpec.d.ts +4 -0
- package/dist/editor/block-specs/blockquoteSpec.js +37 -0
- package/dist/editor/block-specs/callout/CalloutRenderer.svelte +38 -0
- package/dist/editor/block-specs/callout/CalloutRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte +14 -0
- package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte.d.ts +7 -0
- package/dist/editor/block-specs/callout/commands.d.ts +2 -0
- package/dist/editor/block-specs/callout/commands.js +65 -0
- package/dist/editor/block-specs/callout/icons.d.ts +10 -0
- package/dist/editor/block-specs/callout/icons.js +52 -0
- package/dist/editor/block-specs/callout/index.d.ts +9 -0
- package/dist/editor/block-specs/callout/index.js +7 -0
- package/dist/editor/block-specs/callout/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/callout/inlineSecondPass.js +9 -0
- package/dist/editor/block-specs/callout/parse.d.ts +9 -0
- package/dist/editor/block-specs/callout/parse.js +83 -0
- package/dist/editor/block-specs/callout/parseBody.d.ts +6 -0
- package/dist/editor/block-specs/callout/parseBody.js +290 -0
- package/dist/editor/block-specs/callout/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/callout/reconcile.js +8 -0
- package/dist/editor/block-specs/callout/serialize.d.ts +5 -0
- package/dist/editor/block-specs/callout/serialize.js +65 -0
- package/dist/editor/block-specs/callout/types.d.ts +7 -0
- package/dist/editor/block-specs/callout/types.js +1 -0
- package/dist/editor/block-specs/calloutSpec.d.ts +2 -0
- package/dist/editor/block-specs/calloutSpec.js +23 -0
- package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte +18 -0
- package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/codeFence/commands.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/commands.js +1 -0
- package/dist/editor/block-specs/codeFence/index.d.ts +5 -0
- package/dist/editor/block-specs/codeFence/index.js +4 -0
- package/dist/editor/block-specs/codeFence/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/codeFence/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/codeFence/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/reconcile.js +5 -0
- package/dist/editor/block-specs/codeFence/serialize.d.ts +2 -0
- package/dist/editor/block-specs/codeFence/serialize.js +8 -0
- package/dist/editor/block-specs/codeFence/types.d.ts +6 -0
- package/dist/editor/block-specs/codeFence/types.js +1 -0
- package/dist/editor/block-specs/codeFenceSpec.d.ts +2 -0
- package/dist/editor/block-specs/codeFenceSpec.js +23 -0
- package/dist/editor/block-specs/columns/ColumnsRenderer.svelte +18 -0
- package/dist/editor/block-specs/columns/ColumnsRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/columns/EditableColumns.svelte +16 -0
- package/dist/editor/block-specs/columns/EditableColumns.svelte.d.ts +4 -0
- package/dist/editor/block-specs/columns/commands.d.ts +2 -0
- package/dist/editor/block-specs/columns/commands.js +1 -0
- package/dist/editor/block-specs/columns/index.d.ts +6 -0
- package/dist/editor/block-specs/columns/index.js +5 -0
- package/dist/editor/block-specs/columns/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/columns/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/columns/parse.d.ts +20 -0
- package/dist/editor/block-specs/columns/parse.js +111 -0
- package/dist/editor/block-specs/columns/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/columns/reconcile.js +6 -0
- package/dist/editor/block-specs/columns/serialize.d.ts +2 -0
- package/dist/editor/block-specs/columns/serialize.js +16 -0
- package/dist/editor/block-specs/columns/types.d.ts +4 -0
- package/dist/editor/block-specs/columns/types.js +1 -0
- package/dist/editor/block-specs/columnsSpec.d.ts +2 -0
- package/dist/editor/block-specs/columnsSpec.js +24 -0
- package/dist/editor/block-specs/heading/HeaderRenderer.svelte +30 -0
- package/dist/editor/block-specs/heading/HeaderRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/heading/commands.d.ts +2 -0
- package/dist/editor/block-specs/heading/commands.js +41 -0
- package/dist/editor/block-specs/heading/edit.d.ts +10 -0
- package/dist/editor/block-specs/heading/edit.js +33 -0
- package/dist/editor/block-specs/heading/index.d.ts +7 -0
- package/dist/editor/block-specs/heading/index.js +6 -0
- package/dist/editor/block-specs/heading/inlineSecondPass.d.ts +4 -0
- package/dist/editor/block-specs/heading/inlineSecondPass.js +20 -0
- package/dist/editor/block-specs/heading/parse.d.ts +5 -0
- package/dist/editor/block-specs/heading/parse.js +18 -0
- package/dist/editor/block-specs/heading/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/heading/reconcile.js +8 -0
- package/dist/editor/block-specs/heading/serialize.d.ts +2 -0
- package/dist/editor/block-specs/heading/serialize.js +9 -0
- package/dist/editor/block-specs/heading/types.d.ts +5 -0
- package/dist/editor/block-specs/heading/types.js +1 -0
- package/dist/editor/block-specs/headingSpec.d.ts +2 -0
- package/dist/editor/block-specs/headingSpec.js +28 -0
- package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte +15 -0
- package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/horizontalRule/commands.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/commands.js +1 -0
- package/dist/editor/block-specs/horizontalRule/index.d.ts +6 -0
- package/dist/editor/block-specs/horizontalRule/index.js +5 -0
- package/dist/editor/block-specs/horizontalRule/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/horizontalRule/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/horizontalRule/parse.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/parse.js +15 -0
- package/dist/editor/block-specs/horizontalRule/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/reconcile.js +5 -0
- package/dist/editor/block-specs/horizontalRule/serialize.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRule/serialize.js +3 -0
- package/dist/editor/block-specs/horizontalRule/types.d.ts +3 -0
- package/dist/editor/block-specs/horizontalRule/types.js +1 -0
- package/dist/editor/block-specs/horizontalRuleSpec.d.ts +2 -0
- package/dist/editor/block-specs/horizontalRuleSpec.js +24 -0
- package/dist/editor/block-specs/list/ListRenderer.svelte +70 -0
- package/dist/editor/block-specs/list/ListRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/list/commands.d.ts +2 -0
- package/dist/editor/block-specs/list/commands.js +65 -0
- package/dist/editor/block-specs/list/index.d.ts +6 -0
- package/dist/editor/block-specs/list/index.js +5 -0
- package/dist/editor/block-specs/list/inlineSecondPass.d.ts +6 -0
- package/dist/editor/block-specs/list/inlineSecondPass.js +78 -0
- package/dist/editor/block-specs/list/parse.d.ts +11 -0
- package/dist/editor/block-specs/list/parse.js +312 -0
- package/dist/editor/block-specs/list/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/list/reconcile.js +6 -0
- package/dist/editor/block-specs/list/serialize.d.ts +4 -0
- package/dist/editor/block-specs/list/serialize.js +83 -0
- package/dist/editor/block-specs/list/types.d.ts +27 -0
- package/dist/editor/block-specs/list/types.js +1 -0
- package/dist/editor/block-specs/listSpec.d.ts +4 -0
- package/dist/editor/block-specs/listSpec.js +24 -0
- package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte +22 -0
- package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/paragraph/commands.d.ts +2 -0
- package/dist/editor/block-specs/paragraph/commands.js +41 -0
- package/dist/editor/block-specs/paragraph/edit.d.ts +10 -0
- package/dist/editor/block-specs/paragraph/edit.js +69 -0
- package/dist/editor/block-specs/paragraph/index.d.ts +7 -0
- package/dist/editor/block-specs/paragraph/index.js +6 -0
- package/dist/editor/block-specs/paragraph/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/paragraph/inlineSecondPass.js +25 -0
- package/dist/editor/block-specs/paragraph/parse.d.ts +9 -0
- package/dist/editor/block-specs/paragraph/parse.js +76 -0
- package/dist/editor/block-specs/paragraph/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/paragraph/reconcile.js +9 -0
- package/dist/editor/block-specs/paragraph/serialize.d.ts +4 -0
- package/dist/editor/block-specs/paragraph/serialize.js +39 -0
- package/dist/editor/block-specs/paragraph/types.d.ts +10 -0
- package/dist/editor/block-specs/paragraph/types.js +1 -0
- package/dist/editor/block-specs/paragraphSpec.d.ts +2 -0
- package/dist/editor/block-specs/paragraphSpec.js +24 -0
- package/dist/editor/block-specs/registry.d.ts +10 -0
- package/dist/editor/block-specs/registry.js +34 -0
- package/dist/editor/block-specs/table/TableRenderer.svelte +53 -0
- package/dist/editor/block-specs/table/TableRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/table/commands.d.ts +2 -0
- package/dist/editor/block-specs/table/commands.js +1 -0
- package/dist/editor/block-specs/table/edit.d.ts +10 -0
- package/dist/editor/block-specs/table/edit.js +127 -0
- package/dist/editor/block-specs/table/editCommands.d.ts +18 -0
- package/dist/editor/block-specs/table/editCommands.js +87 -0
- package/dist/editor/block-specs/table/index.d.ts +8 -0
- package/dist/editor/block-specs/table/index.js +6 -0
- package/dist/editor/block-specs/table/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/table/inlineSecondPass.js +22 -0
- package/dist/editor/block-specs/table/parse.d.ts +17 -0
- package/dist/editor/block-specs/table/parse.js +181 -0
- package/dist/editor/block-specs/table/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/table/reconcile.js +6 -0
- package/dist/editor/block-specs/table/serialize.d.ts +3 -0
- package/dist/editor/block-specs/table/serialize.js +32 -0
- package/dist/editor/block-specs/table/types.d.ts +11 -0
- package/dist/editor/block-specs/table/types.js +1 -0
- package/dist/editor/block-specs/tableSpec.d.ts +2 -0
- package/dist/editor/block-specs/tableSpec.js +25 -0
- package/dist/editor/block-specs/toc/EditableToc.svelte +16 -0
- package/dist/editor/block-specs/toc/EditableToc.svelte.d.ts +4 -0
- package/dist/editor/block-specs/toc/TocRenderer.svelte +22 -0
- package/dist/editor/block-specs/toc/TocRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/toc/commands.d.ts +2 -0
- package/dist/editor/block-specs/toc/commands.js +1 -0
- package/dist/editor/block-specs/toc/index.d.ts +6 -0
- package/dist/editor/block-specs/toc/index.js +5 -0
- package/dist/editor/block-specs/toc/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/toc/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/toc/parse.d.ts +10 -0
- package/dist/editor/block-specs/toc/parse.js +43 -0
- package/dist/editor/block-specs/toc/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/toc/reconcile.js +5 -0
- package/dist/editor/block-specs/toc/serialize.d.ts +2 -0
- package/dist/editor/block-specs/toc/serialize.js +6 -0
- package/dist/editor/block-specs/toc/types.d.ts +8 -0
- package/dist/editor/block-specs/toc/types.js +1 -0
- package/dist/editor/block-specs/tocSpec.d.ts +2 -0
- package/dist/editor/block-specs/tocSpec.js +24 -0
- package/dist/editor/block-specs/toggle/ToggleRenderer.svelte +19 -0
- package/dist/editor/block-specs/toggle/ToggleRenderer.svelte.d.ts +21 -0
- package/dist/editor/block-specs/toggle/commands.d.ts +2 -0
- package/dist/editor/block-specs/toggle/commands.js +1 -0
- package/dist/editor/block-specs/toggle/index.d.ts +7 -0
- package/dist/editor/block-specs/toggle/index.js +5 -0
- package/dist/editor/block-specs/toggle/inlineSecondPass.d.ts +3 -0
- package/dist/editor/block-specs/toggle/inlineSecondPass.js +5 -0
- package/dist/editor/block-specs/toggle/parse.d.ts +9 -0
- package/dist/editor/block-specs/toggle/parse.js +78 -0
- package/dist/editor/block-specs/toggle/reconcile.d.ts +2 -0
- package/dist/editor/block-specs/toggle/reconcile.js +6 -0
- package/dist/editor/block-specs/toggle/serialize.d.ts +4 -0
- package/dist/editor/block-specs/toggle/serialize.js +13 -0
- package/dist/editor/block-specs/toggle/types.d.ts +5 -0
- package/dist/editor/block-specs/toggle/types.js +1 -0
- package/dist/editor/block-specs/toggleSpec.d.ts +2 -0
- package/dist/editor/block-specs/toggleSpec.js +24 -0
- package/dist/editor/block-specs/types.d.ts +26 -0
- package/dist/editor/block-specs/types.js +1 -0
- package/dist/editor/blocks/EditableBlockquote.svelte +52 -0
- package/dist/editor/blocks/EditableBlockquote.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableBlockquoteNodes.svelte +134 -0
- package/dist/editor/blocks/EditableBlockquoteNodes.svelte.d.ts +14 -0
- package/dist/editor/blocks/EditableBlockquoteParagraph.svelte +44 -0
- package/dist/editor/blocks/EditableBlockquoteParagraph.svelte.d.ts +12 -0
- package/dist/editor/blocks/EditableCallout.svelte +182 -0
- package/dist/editor/blocks/EditableCallout.svelte.d.ts +11 -0
- package/dist/editor/blocks/EditableCalloutListItemRow.svelte +169 -0
- package/dist/editor/blocks/EditableCalloutListItemRow.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableCalloutNodes.svelte +91 -0
- package/dist/editor/blocks/EditableCalloutNodes.svelte.d.ts +13 -0
- package/dist/editor/blocks/EditableCalloutParagraph.svelte +39 -0
- package/dist/editor/blocks/EditableCalloutParagraph.svelte.d.ts +12 -0
- package/dist/editor/blocks/EditableCodeBlock.svelte +43 -0
- package/dist/editor/blocks/EditableCodeBlock.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableHeading.svelte +161 -0
- package/dist/editor/blocks/EditableHeading.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableHorizontalRule.svelte +20 -0
- package/dist/editor/blocks/EditableHorizontalRule.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableInlineSurface.svelte +423 -0
- package/dist/editor/blocks/EditableInlineSurface.svelte.d.ts +26 -0
- package/dist/editor/blocks/EditableList.svelte +77 -0
- package/dist/editor/blocks/EditableList.svelte.d.ts +17 -0
- package/dist/editor/blocks/EditableListItemRow.svelte +231 -0
- package/dist/editor/blocks/EditableListItemRow.svelte.d.ts +19 -0
- package/dist/editor/blocks/EditableParagraph.svelte +208 -0
- package/dist/editor/blocks/EditableParagraph.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableParagraphNodes.svelte +89 -0
- package/dist/editor/blocks/EditableParagraphNodes.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableTable.svelte +83 -0
- package/dist/editor/blocks/EditableTable.svelte.d.ts +10 -0
- package/dist/editor/blocks/EditableTableCell.svelte +89 -0
- package/dist/editor/blocks/EditableTableCell.svelte.d.ts +15 -0
- package/dist/editor/blocks/EditableToggle.svelte +94 -0
- package/dist/editor/blocks/EditableToggle.svelte.d.ts +10 -0
- package/dist/editor/commandMenu.d.ts +18 -0
- package/dist/editor/commandMenu.js +83 -0
- package/dist/editor/commandRegistry.d.ts +48 -0
- package/dist/editor/commandRegistry.js +133 -0
- package/dist/editor/context/assetBaseUrl.d.ts +6 -0
- package/dist/editor/context/assetBaseUrl.js +20 -0
- package/dist/editor/dom/editorHistoryKeydown.d.ts +6 -0
- package/dist/editor/dom/editorHistoryKeydown.js +31 -0
- package/dist/editor/dom/plainEnterKeydown.d.ts +12 -0
- package/dist/editor/dom/plainEnterKeydown.js +53 -0
- package/dist/editor/dom/plaintextCaret.d.ts +12 -0
- package/dist/editor/dom/plaintextCaret.js +61 -0
- package/dist/editor/dom/syncDocumentSelectionFocus.d.ts +17 -0
- package/dist/editor/dom/syncDocumentSelectionFocus.js +56 -0
- package/dist/editor/draftPersistence.d.ts +27 -0
- package/dist/editor/draftPersistence.js +83 -0
- package/dist/editor/editorHistoryHandle.d.ts +16 -0
- package/dist/editor/editorHistoryHandle.js +22 -0
- package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte +174 -0
- package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte.d.ts +8 -0
- package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte +181 -0
- package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte.d.ts +3 -0
- package/dist/editor/inlineChrome/inlineChromeActions.d.ts +17 -0
- package/dist/editor/inlineChrome/inlineChromeActions.js +148 -0
- package/dist/editor/inlineChrome/inlineChromeState.svelte.d.ts +23 -0
- package/dist/editor/inlineChrome/inlineChromeState.svelte.js +21 -0
- package/dist/editor/inlineChrome/inlineToolbarIcons.d.ts +14 -0
- package/dist/editor/inlineChrome/inlineToolbarIcons.js +14 -0
- package/dist/editor/inlineChrome/inlineWrapActive.d.ts +3 -0
- package/dist/editor/inlineChrome/inlineWrapActive.js +19 -0
- package/dist/editor/inlineChrome/selectionRect.d.ts +2 -0
- package/dist/editor/inlineChrome/selectionRect.js +23 -0
- package/dist/editor/model/blockEditCommands.d.ts +73 -0
- package/dist/editor/model/blockEditCommands.js +719 -0
- package/dist/editor/model/blockTree.d.ts +39 -0
- package/dist/editor/model/blockTree.js +185 -0
- package/dist/editor/model/blockTreeDrop.d.ts +9 -0
- package/dist/editor/model/blockTreeDrop.js +295 -0
- package/dist/editor/model/blockTreeMutations.d.ts +10 -0
- package/dist/editor/model/blockTreeMutations.js +68 -0
- package/dist/editor/model/calloutEditCommands.d.ts +39 -0
- package/dist/editor/model/calloutEditCommands.js +305 -0
- package/dist/editor/model/documentSelection.d.ts +8 -0
- package/dist/editor/model/documentSelection.js +56 -0
- package/dist/editor/model/documentSelectionFromSource.d.ts +3 -0
- package/dist/editor/model/documentSelectionFromSource.js +45 -0
- package/dist/editor/model/documentToRenderBlocks.d.ts +3 -0
- package/dist/editor/model/documentToRenderBlocks.js +13 -0
- package/dist/editor/model/editorPipeline.bench.d.ts +1 -0
- package/dist/editor/model/editorPipeline.bench.js +27 -0
- package/dist/editor/model/editorTransactions.d.ts +20 -0
- package/dist/editor/model/editorTransactions.js +68 -0
- package/dist/editor/model/emptyParagraph.d.ts +11 -0
- package/dist/editor/model/emptyParagraph.js +25 -0
- package/dist/editor/model/enterCommands.d.ts +16 -0
- package/dist/editor/model/enterCommands.js +288 -0
- package/dist/editor/model/extensionSyntaxWarnings.d.ts +29 -0
- package/dist/editor/model/extensionSyntaxWarnings.js +122 -0
- package/dist/editor/model/findBlockAtSourceOffset.d.ts +3 -0
- package/dist/editor/model/findBlockAtSourceOffset.js +20 -0
- package/dist/editor/model/fixtures/serialization-fidelity/reorder-gaps.svelte +4 -0
- package/dist/editor/model/focusOutcome.d.ts +25 -0
- package/dist/editor/model/focusOutcome.js +1 -0
- package/dist/editor/model/incrementalReparse.d.ts +16 -0
- package/dist/editor/model/incrementalReparse.js +111 -0
- package/dist/editor/model/index.d.ts +22 -0
- package/dist/editor/model/index.js +19 -0
- package/dist/editor/model/inlineDraftCommit.d.ts +17 -0
- package/dist/editor/model/inlineDraftCommit.js +187 -0
- package/dist/editor/model/inlineDraftMerge.d.ts +8 -0
- package/dist/editor/model/inlineDraftMerge.js +81 -0
- package/dist/editor/model/inlineEditCommands.d.ts +28 -0
- package/dist/editor/model/inlineEditCommands.js +581 -0
- package/dist/editor/model/inlinePlain.d.ts +3 -0
- package/dist/editor/model/inlinePlain.js +28 -0
- package/dist/editor/model/inlineSecondPass.d.ts +4 -0
- package/dist/editor/model/inlineSecondPass.js +47 -0
- package/dist/editor/model/line-utils.d.ts +14 -0
- package/dist/editor/model/line-utils.js +38 -0
- package/dist/editor/model/listEditCommands.d.ts +56 -0
- package/dist/editor/model/listEditCommands.js +299 -0
- package/dist/editor/model/nestedContainerTransactions.d.ts +36 -0
- package/dist/editor/model/nestedContainerTransactions.js +336 -0
- package/dist/editor/model/parseMarkdownDocument.d.ts +2 -0
- package/dist/editor/model/parseMarkdownDocument.js +324 -0
- package/dist/editor/model/quoteEditCommands.d.ts +39 -0
- package/dist/editor/model/quoteEditCommands.js +323 -0
- package/dist/editor/model/reconcileBlockIds.d.ts +9 -0
- package/dist/editor/model/reconcileBlockIds.js +297 -0
- package/dist/editor/model/reparseOptions.d.ts +12 -0
- package/dist/editor/model/reparseOptions.js +1 -0
- package/dist/editor/model/resolveEnterPlainSnapshot.d.ts +6 -0
- package/dist/editor/model/resolveEnterPlainSnapshot.js +23 -0
- package/dist/editor/model/richInlines.d.ts +16 -0
- package/dist/editor/model/richInlines.js +494 -0
- package/dist/editor/model/serializeInlineNodes.d.ts +3 -0
- package/dist/editor/model/serializeInlineNodes.js +45 -0
- package/dist/editor/model/serializeMarkdownDocument.d.ts +30 -0
- package/dist/editor/model/serializeMarkdownDocument.js +150 -0
- package/dist/editor/model/structureParseWarnings.d.ts +10 -0
- package/dist/editor/model/structureParseWarnings.js +60 -0
- package/dist/editor/model/syntheticInlineRanges.d.ts +3 -0
- package/dist/editor/model/syntheticInlineRanges.js +36 -0
- package/dist/editor/model/types.d.ts +185 -0
- package/dist/editor/model/types.js +26 -0
- package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte +20 -0
- package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/autolinks/index.d.ts +2 -0
- package/dist/editor/plugins/autolinks/index.js +4 -0
- package/dist/editor/plugins/autolinks/parse-autolinks.d.ts +2 -0
- package/dist/editor/plugins/autolinks/parse-autolinks.js +68 -0
- package/dist/editor/plugins/autolinks/types.d.ts +6 -0
- package/dist/editor/plugins/autolinks/types.js +1 -0
- package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte +15 -0
- package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/emphasis/index.d.ts +2 -0
- package/dist/editor/plugins/emphasis/index.js +4 -0
- package/dist/editor/plugins/emphasis/parse-emphasis.d.ts +2 -0
- package/dist/editor/plugins/emphasis/parse-emphasis.js +188 -0
- package/dist/editor/plugins/emphasis/types.d.ts +24 -0
- package/dist/editor/plugins/emphasis/types.js +1 -0
- package/dist/editor/plugins/escaping/EscapingRenderer.svelte +18 -0
- package/dist/editor/plugins/escaping/EscapingRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/escaping/index.d.ts +2 -0
- package/dist/editor/plugins/escaping/index.js +4 -0
- package/dist/editor/plugins/escaping/parse-escaping.d.ts +6 -0
- package/dist/editor/plugins/escaping/parse-escaping.js +26 -0
- package/dist/editor/plugins/escaping/types.d.ts +10 -0
- package/dist/editor/plugins/escaping/types.js +1 -0
- package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte +25 -0
- package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/extended-task-list/index.d.ts +2 -0
- package/dist/editor/plugins/extended-task-list/index.js +4 -0
- package/dist/editor/plugins/extended-task-list/parse-extended-task-list.d.ts +2 -0
- package/dist/editor/plugins/extended-task-list/parse-extended-task-list.js +35 -0
- package/dist/editor/plugins/extended-task-list/types.d.ts +6 -0
- package/dist/editor/plugins/extended-task-list/types.js +1 -0
- package/dist/editor/plugins/highlight/HighlightRenderer.svelte +16 -0
- package/dist/editor/plugins/highlight/HighlightRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/highlight/index.d.ts +2 -0
- package/dist/editor/plugins/highlight/index.js +4 -0
- package/dist/editor/plugins/highlight/parse-highlights.d.ts +4 -0
- package/dist/editor/plugins/highlight/parse-highlights.js +49 -0
- package/dist/editor/plugins/highlight/types.d.ts +6 -0
- package/dist/editor/plugins/highlight/types.js +1 -0
- package/dist/editor/plugins/index.d.ts +1 -0
- package/dist/editor/plugins/index.js +1 -0
- package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte +53 -0
- package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/links-images/index.d.ts +2 -0
- package/dist/editor/plugins/links-images/index.js +4 -0
- package/dist/editor/plugins/links-images/parse-image-layout.d.ts +28 -0
- package/dist/editor/plugins/links-images/parse-image-layout.js +147 -0
- package/dist/editor/plugins/links-images/parse-links-images.d.ts +25 -0
- package/dist/editor/plugins/links-images/parse-links-images.js +236 -0
- package/dist/editor/plugins/links-images/resolve-asset-url.d.ts +5 -0
- package/dist/editor/plugins/links-images/resolve-asset-url.js +21 -0
- package/dist/editor/plugins/links-images/types.d.ts +11 -0
- package/dist/editor/plugins/links-images/types.js +1 -0
- package/dist/editor/plugins/mention/MentionRenderer.svelte +18 -0
- package/dist/editor/plugins/mention/MentionRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/mention/index.d.ts +2 -0
- package/dist/editor/plugins/mention/index.js +4 -0
- package/dist/editor/plugins/mention/parse-mentions.d.ts +2 -0
- package/dist/editor/plugins/mention/parse-mentions.js +54 -0
- package/dist/editor/plugins/mention/types.d.ts +14 -0
- package/dist/editor/plugins/mention/types.js +1 -0
- package/dist/editor/plugins/raw-text/RawTextRenderer.svelte +19 -0
- package/dist/editor/plugins/raw-text/RawTextRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/raw-text/index.d.ts +2 -0
- package/dist/editor/plugins/raw-text/index.js +4 -0
- package/dist/editor/plugins/raw-text/types.d.ts +4 -0
- package/dist/editor/plugins/raw-text/types.js +1 -0
- package/dist/editor/plugins/shared/InlineNodes.svelte +113 -0
- package/dist/editor/plugins/shared/InlineNodes.svelte.d.ts +21 -0
- package/dist/editor/plugins/shared/InlineNodesEdit.svelte +78 -0
- package/dist/editor/plugins/shared/InlineNodesEdit.svelte.d.ts +21 -0
- package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte +9 -0
- package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/strikethrough/index.d.ts +2 -0
- package/dist/editor/plugins/strikethrough/index.js +4 -0
- package/dist/editor/plugins/strikethrough/parse-strikethrough.d.ts +3 -0
- package/dist/editor/plugins/strikethrough/parse-strikethrough.js +38 -0
- package/dist/editor/plugins/strikethrough/types.d.ts +4 -0
- package/dist/editor/plugins/strikethrough/types.js +1 -0
- package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte +16 -0
- package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/synced-block/index.d.ts +2 -0
- package/dist/editor/plugins/synced-block/index.js +4 -0
- package/dist/editor/plugins/synced-block/parse-synced-blocks.d.ts +2 -0
- package/dist/editor/plugins/synced-block/parse-synced-blocks.js +15 -0
- package/dist/editor/plugins/synced-block/types.d.ts +4 -0
- package/dist/editor/plugins/synced-block/types.js +1 -0
- package/dist/editor/plugins/types.d.ts +19 -0
- package/dist/editor/plugins/types.js +1 -0
- package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte +15 -0
- package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte.d.ts +21 -0
- package/dist/editor/plugins/wiki-link/index.d.ts +2 -0
- package/dist/editor/plugins/wiki-link/index.js +4 -0
- package/dist/editor/plugins/wiki-link/parse-wiki-links.d.ts +2 -0
- package/dist/editor/plugins/wiki-link/parse-wiki-links.js +30 -0
- package/dist/editor/plugins/wiki-link/types.d.ts +8 -0
- package/dist/editor/plugins/wiki-link/types.js +1 -0
- package/dist/editor/taskCheckboxStates.d.ts +5 -0
- package/dist/editor/taskCheckboxStates.js +28 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/styles/index.css +6 -0
- package/package.json +84 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { paragraphBlockFromPlainText } from '../block-specs/paragraph/edit';
|
|
2
|
+
import { deepCloneBlock, deepCloneBlocks, findBlockLocation, normalizeListOrdinalsForest } from './blockTree';
|
|
3
|
+
import { inlineTextNode } from './inlineEditCommands';
|
|
4
|
+
import { inlineNodesToPlainText } from './inlinePlain';
|
|
5
|
+
import { findQuoteBlockPath, quoteEnterAtPlain } from './quoteEditCommands';
|
|
6
|
+
import { listEnterAtPlain } from './listEditCommands';
|
|
7
|
+
import { emptyParagraphBlockData } from './emptyParagraph';
|
|
8
|
+
import { replaceSourceRange } from './blockEditCommands';
|
|
9
|
+
const EMPTY_PARAGRAPH_AFTER = '\n\n \n\n';
|
|
10
|
+
function syntheticRange() {
|
|
11
|
+
return { start: -1, end: -1, startLine: -1, endLine: -1, synthetic: true };
|
|
12
|
+
}
|
|
13
|
+
export function calloutBodySyntheticParagraphId(calloutId) {
|
|
14
|
+
return `callout-body-syn:${calloutId}`;
|
|
15
|
+
}
|
|
16
|
+
export function isCalloutBodySyntheticParagraphId(blockId) {
|
|
17
|
+
return blockId.startsWith('callout-body-syn:');
|
|
18
|
+
}
|
|
19
|
+
export function makeEmptyCalloutParagraph() {
|
|
20
|
+
return {
|
|
21
|
+
type: 'paragraph',
|
|
22
|
+
id: crypto.randomUUID(),
|
|
23
|
+
sourceRange: syntheticRange(),
|
|
24
|
+
data: emptyParagraphBlockData(0),
|
|
25
|
+
inlines: [],
|
|
26
|
+
children: []
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function makeCalloutBodySyntheticParagraph(calloutId) {
|
|
30
|
+
return {
|
|
31
|
+
type: 'paragraph',
|
|
32
|
+
id: calloutBodySyntheticParagraphId(calloutId),
|
|
33
|
+
sourceRange: syntheticRange(),
|
|
34
|
+
data: emptyParagraphBlockData(0),
|
|
35
|
+
inlines: [],
|
|
36
|
+
children: []
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Write the first empty `> ` body line for an opener-only callout. */
|
|
40
|
+
export function ensureCalloutEmptyBodyTransaction(source, doc, calloutBlockIndex) {
|
|
41
|
+
const block = doc.blocks[calloutBlockIndex];
|
|
42
|
+
if (!block || block.type !== 'callout')
|
|
43
|
+
return { ok: false, error: 'Expected callout.' };
|
|
44
|
+
if ((block.children?.length ?? 0) > 0)
|
|
45
|
+
return { ok: false, error: 'Callout already has body.' };
|
|
46
|
+
const insertPos = block.sourceRange.end;
|
|
47
|
+
const insertion = '\n> ';
|
|
48
|
+
const newSource = replaceSourceRange(source, insertPos, insertPos, insertion);
|
|
49
|
+
const anchor = insertPos + 3;
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
transaction: {
|
|
53
|
+
id: `callout-empty-body:${block.id}`,
|
|
54
|
+
operations: [{ type: 'replaceSlice', range: { start: insertPos, end: insertPos }, text: insertion }],
|
|
55
|
+
selection: { anchor, focus: anchor }
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function nodeAtCalloutPath(root, path) {
|
|
60
|
+
let n = root;
|
|
61
|
+
for (const i of path) {
|
|
62
|
+
const ch = n.children?.[i];
|
|
63
|
+
if (!ch)
|
|
64
|
+
return null;
|
|
65
|
+
n = ch;
|
|
66
|
+
}
|
|
67
|
+
return n;
|
|
68
|
+
}
|
|
69
|
+
/** Path from callout root to any descendant block id (excluding the callout root itself). */
|
|
70
|
+
export function findCalloutDescendantPath(root, blockId) {
|
|
71
|
+
if (root.type !== 'callout')
|
|
72
|
+
return null;
|
|
73
|
+
function walk(node, prefix) {
|
|
74
|
+
for (let i = 0; i < (node.children?.length ?? 0); i++) {
|
|
75
|
+
const ch = node.children[i];
|
|
76
|
+
const p = [...prefix, i];
|
|
77
|
+
if (ch.id === blockId)
|
|
78
|
+
return p;
|
|
79
|
+
const nested = walk(ch, p);
|
|
80
|
+
if (nested)
|
|
81
|
+
return nested;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return walk(root, []);
|
|
86
|
+
}
|
|
87
|
+
export function calloutParagraphDisplayPlain(block) {
|
|
88
|
+
if (block.type !== 'paragraph')
|
|
89
|
+
return '';
|
|
90
|
+
if (block.inlines?.length)
|
|
91
|
+
return inlineNodesToPlainText(block.inlines);
|
|
92
|
+
return '';
|
|
93
|
+
}
|
|
94
|
+
function calloutSiblingContext(root, blockId) {
|
|
95
|
+
const path = findCalloutDescendantPath(root, blockId);
|
|
96
|
+
if (!path)
|
|
97
|
+
return null;
|
|
98
|
+
const node = nodeAtCalloutPath(root, path);
|
|
99
|
+
if (!node)
|
|
100
|
+
return null;
|
|
101
|
+
if (path.length === 0)
|
|
102
|
+
return null;
|
|
103
|
+
const parentPath = path.slice(0, -1);
|
|
104
|
+
const parent = parentPath.length === 0 ? root : nodeAtCalloutPath(root, parentPath);
|
|
105
|
+
if (!parent)
|
|
106
|
+
return null;
|
|
107
|
+
if (!parent.children)
|
|
108
|
+
parent.children = [];
|
|
109
|
+
const index = path[path.length - 1];
|
|
110
|
+
return { parent, siblings: parent.children, index, node };
|
|
111
|
+
}
|
|
112
|
+
export function calloutChildCanMoveSibling(root, blockId, direction) {
|
|
113
|
+
const ctx = calloutSiblingContext(root, blockId);
|
|
114
|
+
if (!ctx)
|
|
115
|
+
return false;
|
|
116
|
+
const newIdx = direction === 'up' ? ctx.index - 1 : ctx.index + 1;
|
|
117
|
+
return newIdx >= 0 && newIdx < ctx.siblings.length;
|
|
118
|
+
}
|
|
119
|
+
export function calloutMoveSibling(root, blockId, direction) {
|
|
120
|
+
const path = findCalloutDescendantPath(root, blockId);
|
|
121
|
+
if (!path)
|
|
122
|
+
return null;
|
|
123
|
+
const clone = deepCloneBlock(root);
|
|
124
|
+
const ctxRaw = calloutSiblingContext(clone, blockId);
|
|
125
|
+
if (!ctxRaw)
|
|
126
|
+
return null;
|
|
127
|
+
const idx = ctxRaw.index;
|
|
128
|
+
const newIdx = direction === 'up' ? idx - 1 : idx + 1;
|
|
129
|
+
if (newIdx < 0 || newIdx >= ctxRaw.siblings.length)
|
|
130
|
+
return null;
|
|
131
|
+
const kids = [...ctxRaw.siblings];
|
|
132
|
+
const [removed] = kids.splice(idx, 1);
|
|
133
|
+
if (!removed)
|
|
134
|
+
return null;
|
|
135
|
+
kids.splice(newIdx, 0, removed);
|
|
136
|
+
ctxRaw.parent.children = kids;
|
|
137
|
+
return clone;
|
|
138
|
+
}
|
|
139
|
+
export function calloutDeleteChild(root, blockId) {
|
|
140
|
+
const path = findCalloutDescendantPath(root, blockId);
|
|
141
|
+
if (!path)
|
|
142
|
+
return null;
|
|
143
|
+
const clone = deepCloneBlock(root);
|
|
144
|
+
const ctx = calloutSiblingContext(clone, blockId);
|
|
145
|
+
if (!ctx)
|
|
146
|
+
return null;
|
|
147
|
+
ctx.siblings.splice(ctx.index, 1);
|
|
148
|
+
return clone;
|
|
149
|
+
}
|
|
150
|
+
function reIdBlockTree(block) {
|
|
151
|
+
block.id = crypto.randomUUID();
|
|
152
|
+
for (const ch of block.children ?? [])
|
|
153
|
+
reIdBlockTree(ch);
|
|
154
|
+
}
|
|
155
|
+
export function calloutDuplicateChild(root, blockId) {
|
|
156
|
+
const path = findCalloutDescendantPath(root, blockId);
|
|
157
|
+
if (!path)
|
|
158
|
+
return null;
|
|
159
|
+
const clone = deepCloneBlock(root);
|
|
160
|
+
const ctx = calloutSiblingContext(clone, blockId);
|
|
161
|
+
if (!ctx)
|
|
162
|
+
return null;
|
|
163
|
+
const dup = deepCloneBlock(ctx.node);
|
|
164
|
+
reIdBlockTree(dup);
|
|
165
|
+
ctx.siblings.splice(ctx.index + 1, 0, dup);
|
|
166
|
+
return clone;
|
|
167
|
+
}
|
|
168
|
+
export function calloutSiblingIndexOffset(root, anchorId, focusId) {
|
|
169
|
+
const anchorPath = findCalloutDescendantPath(root, anchorId);
|
|
170
|
+
const focusPath = findCalloutDescendantPath(root, focusId);
|
|
171
|
+
if (!anchorPath || !focusPath || anchorPath.length !== focusPath.length)
|
|
172
|
+
return null;
|
|
173
|
+
for (let i = 0; i < anchorPath.length - 1; i++) {
|
|
174
|
+
if (anchorPath[i] !== focusPath[i])
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return focusPath[focusPath.length - 1] - anchorPath[focusPath.length - 1];
|
|
178
|
+
}
|
|
179
|
+
export function siblingFocusIdForCalloutDelete(root, blockId) {
|
|
180
|
+
const ctx = calloutSiblingContext(root, blockId);
|
|
181
|
+
if (!ctx)
|
|
182
|
+
return undefined;
|
|
183
|
+
if (ctx.index > 0)
|
|
184
|
+
return ctx.siblings[ctx.index - 1]?.id;
|
|
185
|
+
if (ctx.index + 1 < ctx.siblings.length)
|
|
186
|
+
return ctx.siblings[ctx.index + 1]?.id;
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
function paragraphPlainEmpty(block) {
|
|
190
|
+
return calloutParagraphDisplayPlain(block).length === 0;
|
|
191
|
+
}
|
|
192
|
+
function shouldExitEmptyCalloutParagraph(ctx) {
|
|
193
|
+
if (!paragraphPlainEmpty(ctx.node))
|
|
194
|
+
return false;
|
|
195
|
+
if (ctx.index > 0) {
|
|
196
|
+
const prev = ctx.siblings[ctx.index - 1];
|
|
197
|
+
return prev?.type === 'paragraph' && paragraphPlainEmpty(prev);
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
export function calloutParagraphEnterAtPlain(root, blockId, offset, plainText) {
|
|
202
|
+
if (root.type !== 'callout')
|
|
203
|
+
return null;
|
|
204
|
+
const clone = deepCloneBlock(root);
|
|
205
|
+
const ctx = calloutSiblingContext(clone, blockId);
|
|
206
|
+
if (!ctx || ctx.node.type !== 'paragraph')
|
|
207
|
+
return null;
|
|
208
|
+
const body = plainText;
|
|
209
|
+
if (body.length === 0) {
|
|
210
|
+
if (shouldExitEmptyCalloutParagraph(ctx)) {
|
|
211
|
+
ctx.siblings.splice(ctx.index, 1);
|
|
212
|
+
return { root: clone, exitToParagraph: true };
|
|
213
|
+
}
|
|
214
|
+
const next = makeEmptyCalloutParagraph();
|
|
215
|
+
ctx.siblings.splice(ctx.index + 1, 0, next);
|
|
216
|
+
return { root: clone, focusBlockId: next.id };
|
|
217
|
+
}
|
|
218
|
+
if (offset <= 0) {
|
|
219
|
+
const next = makeEmptyCalloutParagraph();
|
|
220
|
+
ctx.siblings.splice(ctx.index, 0, next);
|
|
221
|
+
return { root: clone, focusBlockId: next.id };
|
|
222
|
+
}
|
|
223
|
+
if (offset >= body.length) {
|
|
224
|
+
const next = makeEmptyCalloutParagraph();
|
|
225
|
+
ctx.siblings.splice(ctx.index + 1, 0, next);
|
|
226
|
+
return { root: clone, focusBlockId: next.id };
|
|
227
|
+
}
|
|
228
|
+
const left = body.slice(0, offset);
|
|
229
|
+
const right = body.slice(offset);
|
|
230
|
+
ctx.node.inlines = left.length > 0 ? [inlineTextNode(left)] : [];
|
|
231
|
+
ctx.node.data = paragraphBlockFromPlainText(left, 0);
|
|
232
|
+
const next = makeEmptyCalloutParagraph();
|
|
233
|
+
next.inlines = right.length > 0 ? [inlineTextNode(right)] : [];
|
|
234
|
+
next.data = paragraphBlockFromPlainText(right, 0);
|
|
235
|
+
ctx.siblings.splice(ctx.index + 1, 0, next);
|
|
236
|
+
return { root: clone, focusBlockId: next.id };
|
|
237
|
+
}
|
|
238
|
+
export function calloutListItemEnterAtPlain(root, itemId, offset, plainText, source) {
|
|
239
|
+
if (root.type !== 'callout')
|
|
240
|
+
return null;
|
|
241
|
+
const clone = deepCloneBlock(root);
|
|
242
|
+
const blocks = [clone];
|
|
243
|
+
const result = listEnterAtPlain(blocks, itemId, offset, plainText, source);
|
|
244
|
+
if (!result)
|
|
245
|
+
return null;
|
|
246
|
+
if ('demoteToParagraph' in result && result.demoteToParagraph) {
|
|
247
|
+
return { root: blocks[0], focusBlockId: result.focusBlockId };
|
|
248
|
+
}
|
|
249
|
+
return { root: blocks[0], focusBlockId: result.focusBlockId };
|
|
250
|
+
}
|
|
251
|
+
function findBlockquoteRootInCallout(callout, blockId) {
|
|
252
|
+
function walk(node, prefix) {
|
|
253
|
+
if (node.type === 'blockquote' &&
|
|
254
|
+
(node.id === blockId || findQuoteBlockPath(node, blockId) !== null)) {
|
|
255
|
+
return { node, pathFromCallout: prefix };
|
|
256
|
+
}
|
|
257
|
+
for (let i = 0; i < (node.children?.length ?? 0); i++) {
|
|
258
|
+
const ch = node.children[i];
|
|
259
|
+
const found = walk(ch, [...prefix, i]);
|
|
260
|
+
if (found)
|
|
261
|
+
return found;
|
|
262
|
+
}
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
if (callout.type !== 'callout')
|
|
266
|
+
return null;
|
|
267
|
+
for (let i = 0; i < (callout.children?.length ?? 0); i++) {
|
|
268
|
+
const ch = callout.children[i];
|
|
269
|
+
const found = walk(ch, [i]);
|
|
270
|
+
if (found)
|
|
271
|
+
return found;
|
|
272
|
+
}
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
export function calloutBlockquoteEnterAtPlain(root, blockId, offset, plainText, source) {
|
|
276
|
+
if (root.type !== 'callout')
|
|
277
|
+
return null;
|
|
278
|
+
const clone = deepCloneBlock(root);
|
|
279
|
+
const hit = findBlockquoteRootInCallout(clone, blockId);
|
|
280
|
+
if (!hit)
|
|
281
|
+
return null;
|
|
282
|
+
const innerPath = findQuoteBlockPath(hit.node, blockId);
|
|
283
|
+
if (innerPath === null)
|
|
284
|
+
return null;
|
|
285
|
+
const result = quoteEnterAtPlain(hit.node, innerPath, offset, plainText, source);
|
|
286
|
+
if (!result)
|
|
287
|
+
return null;
|
|
288
|
+
if (result.exitToParagraph) {
|
|
289
|
+
// Replace blockquote with empty paragraph sibling in callout body
|
|
290
|
+
const ctx = calloutSiblingContext(clone, hit.node.id);
|
|
291
|
+
if (!ctx)
|
|
292
|
+
return null;
|
|
293
|
+
const para = makeEmptyCalloutParagraph();
|
|
294
|
+
ctx.siblings.splice(ctx.index, 1, para);
|
|
295
|
+
return { root: clone, focusBlockId: para.id };
|
|
296
|
+
}
|
|
297
|
+
// quoteEnterAtPlain mutates hit.node in place within clone
|
|
298
|
+
return { root: clone, focusBlockId: result.focusBlockId };
|
|
299
|
+
}
|
|
300
|
+
export function calloutExitReplacementMarkdown(calloutMd, caretInCallout) {
|
|
301
|
+
const replacement = calloutMd + EMPTY_PARAGRAPH_AFTER;
|
|
302
|
+
const caret = caretInCallout + calloutMd.length + 4;
|
|
303
|
+
return { replacement, caret };
|
|
304
|
+
}
|
|
305
|
+
export { EMPTY_PARAGRAPH_AFTER };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EditorBlock } from './types';
|
|
2
|
+
/** Walk the block tree and return the first node with `id`, or null. */
|
|
3
|
+
export declare function findEditorBlockById(blocks: readonly EditorBlock[], id: string): EditorBlock | null;
|
|
4
|
+
/**
|
|
5
|
+
* When a stored leaf id is missing after reparse, find the best fingerprint match in the new tree.
|
|
6
|
+
* Returns null when no candidate meets the reconcile score threshold.
|
|
7
|
+
*/
|
|
8
|
+
export declare function tryRemapDocumentSelectionBlockId(prevBlocks: readonly EditorBlock[], nextBlocks: readonly EditorBlock[], missingId: string): string | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { blockIdentityFingerprint } from './reconcileBlockIds';
|
|
2
|
+
/** Walk the block tree and return the first node with `id`, or null. */
|
|
3
|
+
export function findEditorBlockById(blocks, id) {
|
|
4
|
+
for (const block of blocks) {
|
|
5
|
+
if (block.id === id)
|
|
6
|
+
return block;
|
|
7
|
+
if (block.children?.length) {
|
|
8
|
+
const nested = findEditorBlockById(block.children, id);
|
|
9
|
+
if (nested)
|
|
10
|
+
return nested;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
function prefixOverlap(a, b) {
|
|
16
|
+
let n = 0;
|
|
17
|
+
const max = Math.min(a.length, b.length);
|
|
18
|
+
while (n < max && a.charCodeAt(n) === b.charCodeAt(n))
|
|
19
|
+
n++;
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
const REMAP_MIN_SCORE = 55;
|
|
23
|
+
function scoreRemapCandidate(prev, next) {
|
|
24
|
+
if (prev.type !== next.type)
|
|
25
|
+
return -1;
|
|
26
|
+
const fpPrev = blockIdentityFingerprint(prev);
|
|
27
|
+
const fpNext = blockIdentityFingerprint(next);
|
|
28
|
+
const pref = prefixOverlap(fpPrev, fpNext);
|
|
29
|
+
return pref + (fpPrev === fpNext ? 200 : 0);
|
|
30
|
+
}
|
|
31
|
+
function walkAllBlocks(blocks, visit) {
|
|
32
|
+
for (const block of blocks) {
|
|
33
|
+
visit(block);
|
|
34
|
+
if (block.children?.length)
|
|
35
|
+
walkAllBlocks(block.children, visit);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* When a stored leaf id is missing after reparse, find the best fingerprint match in the new tree.
|
|
40
|
+
* Returns null when no candidate meets the reconcile score threshold.
|
|
41
|
+
*/
|
|
42
|
+
export function tryRemapDocumentSelectionBlockId(prevBlocks, nextBlocks, missingId) {
|
|
43
|
+
const prev = findEditorBlockById(prevBlocks, missingId);
|
|
44
|
+
if (!prev)
|
|
45
|
+
return null;
|
|
46
|
+
let bestId = null;
|
|
47
|
+
let bestScore = REMAP_MIN_SCORE - 1;
|
|
48
|
+
walkAllBlocks(nextBlocks, (next) => {
|
|
49
|
+
const score = scoreRemapCandidate(prev, next);
|
|
50
|
+
if (score > bestScore) {
|
|
51
|
+
bestScore = score;
|
|
52
|
+
bestId = next.id;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return bestScore >= REMAP_MIN_SCORE ? bestId : null;
|
|
56
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DocumentSelection, EditorBlock, EditorSelection } from './types';
|
|
2
|
+
/** Best-effort leaf {@link DocumentSelection} from a source-offset caret after reparse. */
|
|
3
|
+
export declare function documentSelectionFromSourceOffset(blocks: readonly EditorBlock[], source: string, selection: EditorSelection): DocumentSelection | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { headingBodySourceRange, headingDisplayPlain } from '../block-specs/heading/edit';
|
|
2
|
+
import { paragraphDisplayPlain } from '../block-specs/paragraph';
|
|
3
|
+
import { findEditorBlockById } from './documentSelection';
|
|
4
|
+
import { findEditorBlockIdAtSourceOffset } from './findBlockAtSourceOffset';
|
|
5
|
+
import { listItemDisplayPlain } from './listEditCommands';
|
|
6
|
+
import { blockquoteBodyPlain } from './quoteEditCommands';
|
|
7
|
+
import { normalizeSelectionRange } from './types';
|
|
8
|
+
function plainOffsetInBlock(block, source, sourceOffset) {
|
|
9
|
+
if (block.sourceRange.synthetic || block.sourceRange.start < 0)
|
|
10
|
+
return 0;
|
|
11
|
+
if (block.type === 'heading') {
|
|
12
|
+
const { start } = headingBodySourceRange(block, source);
|
|
13
|
+
const body = headingDisplayPlain(block);
|
|
14
|
+
return Math.max(0, Math.min(sourceOffset - start, body.length));
|
|
15
|
+
}
|
|
16
|
+
if (block.type === 'paragraph') {
|
|
17
|
+
const body = paragraphDisplayPlain(block);
|
|
18
|
+
const relative = sourceOffset - block.sourceRange.start;
|
|
19
|
+
return Math.max(0, Math.min(relative, body.length));
|
|
20
|
+
}
|
|
21
|
+
if (block.type === 'listItem') {
|
|
22
|
+
const body = listItemDisplayPlain(block, source);
|
|
23
|
+
const relative = sourceOffset - block.sourceRange.start;
|
|
24
|
+
return Math.max(0, Math.min(relative, body.length));
|
|
25
|
+
}
|
|
26
|
+
if (block.type === 'blockquote') {
|
|
27
|
+
const body = blockquoteBodyPlain(block, source);
|
|
28
|
+
const relative = sourceOffset - block.sourceRange.start;
|
|
29
|
+
return Math.max(0, Math.min(relative, body.length));
|
|
30
|
+
}
|
|
31
|
+
const relative = sourceOffset - block.sourceRange.start;
|
|
32
|
+
return Math.max(0, relative);
|
|
33
|
+
}
|
|
34
|
+
/** Best-effort leaf {@link DocumentSelection} from a source-offset caret after reparse. */
|
|
35
|
+
export function documentSelectionFromSourceOffset(blocks, source, selection) {
|
|
36
|
+
const { start } = normalizeSelectionRange(selection);
|
|
37
|
+
const blockId = findEditorBlockIdAtSourceOffset(blocks, start);
|
|
38
|
+
if (!blockId)
|
|
39
|
+
return null;
|
|
40
|
+
const block = findEditorBlockById(blocks, blockId);
|
|
41
|
+
if (!block)
|
|
42
|
+
return null;
|
|
43
|
+
const plain = plainOffsetInBlock(block, source, start);
|
|
44
|
+
return { blockId, plain: { start: plain, end: plain } };
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getBlockSpec } from '../block-specs/registry';
|
|
2
|
+
export function documentBlocksToRenderBlocks(blocks) {
|
|
3
|
+
const out = [];
|
|
4
|
+
for (const b of blocks) {
|
|
5
|
+
const spec = getBlockSpec(b.type);
|
|
6
|
+
if (spec) {
|
|
7
|
+
out.push(spec.toRenderBlock(b));
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
console.error(`documentBlocksToRenderBlocks: missing BlockSpec for type "${b.type}"`);
|
|
11
|
+
}
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { bench, describe } from 'vitest';
|
|
2
|
+
import { applyInlineSecondPass } from './inlineSecondPass';
|
|
3
|
+
import { commitParagraphInlineDraft } from './inlineDraftCommit';
|
|
4
|
+
import { tryIncrementalReparse } from './incrementalReparse';
|
|
5
|
+
import { parseMarkdownDocument } from './parseMarkdownDocument';
|
|
6
|
+
import { reconcileBlockIds } from './reconcileBlockIds';
|
|
7
|
+
function paragraphs(n) {
|
|
8
|
+
return Array.from({ length: n }, (_, i) => `Paragraph ${i} with some body text.`).join('\n\n');
|
|
9
|
+
}
|
|
10
|
+
describe('editor pipeline bench', () => {
|
|
11
|
+
const md = paragraphs(500);
|
|
12
|
+
const parsed = applyInlineSecondPass(parseMarkdownDocument(md, null));
|
|
13
|
+
const blockIndex = 250;
|
|
14
|
+
const prevReal = parsed.blocks.filter((b) => !b.sourceRange.synthetic);
|
|
15
|
+
const commit = commitParagraphInlineDraft(md, parsed, blockIndex, parsed.blocks[blockIndex].inlines ?? [], 4);
|
|
16
|
+
if (!commit.ok)
|
|
17
|
+
throw new Error('commit setup failed');
|
|
18
|
+
bench('full reparse (~500 paragraphs)', () => {
|
|
19
|
+
const docParsed = applyInlineSecondPass(parseMarkdownDocument(md, null));
|
|
20
|
+
reconcileBlockIds(prevReal, docParsed.blocks);
|
|
21
|
+
});
|
|
22
|
+
bench('incremental paragraph commit (~500 paragraphs)', () => {
|
|
23
|
+
const result = tryIncrementalReparse(commit.source, null, parsed, blockIndex, 'paragraph');
|
|
24
|
+
if (!result.ok)
|
|
25
|
+
throw new Error(result.reason);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EditorDocument, EditorTransaction, EditorSelection } from './types';
|
|
2
|
+
export type TransactionBuildErr = {
|
|
3
|
+
ok: false;
|
|
4
|
+
error: string;
|
|
5
|
+
};
|
|
6
|
+
export type TransactionBuildOk = {
|
|
7
|
+
ok: true;
|
|
8
|
+
transaction: EditorTransaction;
|
|
9
|
+
};
|
|
10
|
+
export type TransactionBuildResult = TransactionBuildOk | TransactionBuildErr;
|
|
11
|
+
/** Apply ordered slice replacements left-to-right on the current source string. */
|
|
12
|
+
export declare function applyEditorTransaction(source: string, transaction: EditorTransaction): {
|
|
13
|
+
ok: true;
|
|
14
|
+
source: string;
|
|
15
|
+
selection: EditorSelection;
|
|
16
|
+
};
|
|
17
|
+
/** Proof path for the transaction foundation — structural delete as one replaceSlice op. */
|
|
18
|
+
export declare function deleteBlockTransaction(source: string, doc: EditorDocument, blockIndex: number): TransactionBuildResult;
|
|
19
|
+
/** Inserts a copy of the block markdown after it; caret at start of duplicate body. */
|
|
20
|
+
export declare function duplicateBlockTransaction(source: string, doc: EditorDocument, blockIndex: number): TransactionBuildResult;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { clampSelection } from './types';
|
|
2
|
+
function replaceSourceSlice(source, start, end, replacement) {
|
|
3
|
+
return source.slice(0, start) + replacement + source.slice(end);
|
|
4
|
+
}
|
|
5
|
+
/** Apply ordered slice replacements left-to-right on the current source string. */
|
|
6
|
+
export function applyEditorTransaction(source, transaction) {
|
|
7
|
+
let next = source;
|
|
8
|
+
for (const op of transaction.operations) {
|
|
9
|
+
next = applyEditorOperation(next, op);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
ok: true,
|
|
13
|
+
source: next,
|
|
14
|
+
selection: clampSelection(transaction.selection, next.length)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function applyEditorOperation(source, op) {
|
|
18
|
+
if (op.type === 'replaceSlice') {
|
|
19
|
+
return replaceSourceSlice(source, op.range.start, op.range.end, op.text);
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`Unknown editor operation: ${op.type}`);
|
|
22
|
+
}
|
|
23
|
+
function assertEditableBlockIndex(doc, blockIndex, verb) {
|
|
24
|
+
const block = doc.blocks[blockIndex];
|
|
25
|
+
if (!block)
|
|
26
|
+
return { ok: false, error: 'Invalid block index.' };
|
|
27
|
+
if (block.sourceRange.start < 0)
|
|
28
|
+
return { ok: false, error: `Cannot ${verb} synthetic block.` };
|
|
29
|
+
return { ok: true, block };
|
|
30
|
+
}
|
|
31
|
+
/** Proof path for the transaction foundation — structural delete as one replaceSlice op. */
|
|
32
|
+
export function deleteBlockTransaction(source, doc, blockIndex) {
|
|
33
|
+
const checked = assertEditableBlockIndex(doc, blockIndex, 'delete');
|
|
34
|
+
if (!checked.ok)
|
|
35
|
+
return checked;
|
|
36
|
+
const block = checked.block;
|
|
37
|
+
const start = block.sourceRange.start;
|
|
38
|
+
const end = block.sourceRange.end;
|
|
39
|
+
const newSource = replaceSourceSlice(source, start, end, '');
|
|
40
|
+
const anchor = Math.min(start, newSource.length);
|
|
41
|
+
return {
|
|
42
|
+
ok: true,
|
|
43
|
+
transaction: {
|
|
44
|
+
id: `delete-block:${block.id}`,
|
|
45
|
+
operations: [{ type: 'replaceSlice', range: { start, end }, text: '' }],
|
|
46
|
+
selection: { anchor, focus: anchor }
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** Inserts a copy of the block markdown after it; caret at start of duplicate body. */
|
|
51
|
+
export function duplicateBlockTransaction(source, doc, blockIndex) {
|
|
52
|
+
const checked = assertEditableBlockIndex(doc, blockIndex, 'duplicate');
|
|
53
|
+
if (!checked.ok)
|
|
54
|
+
return checked;
|
|
55
|
+
const block = checked.block;
|
|
56
|
+
const slice = source.slice(block.sourceRange.start, block.sourceRange.end);
|
|
57
|
+
const pos = block.sourceRange.end;
|
|
58
|
+
const insertion = `\n\n${slice}`;
|
|
59
|
+
const anchor = pos + 2;
|
|
60
|
+
return {
|
|
61
|
+
ok: true,
|
|
62
|
+
transaction: {
|
|
63
|
+
id: `duplicate-block:${block.id}`,
|
|
64
|
+
operations: [{ type: 'replaceSlice', range: { start: pos, end: pos }, text: insertion }],
|
|
65
|
+
selection: { anchor, focus: anchor }
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParagraphBlock } from '../block-specs/paragraph/types';
|
|
2
|
+
import type { EditorBlock, EditorDocument } from './types';
|
|
3
|
+
/** Canonical source body for a display-empty **paragraph** block. */
|
|
4
|
+
export declare const EMPTY_PARAGRAPH_MARKER = " ";
|
|
5
|
+
/** Typical top-level gap + empty body between sibling blocks. */
|
|
6
|
+
export declare const EMPTY_PARAGRAPH_INSERTION = "\n\n \n\n";
|
|
7
|
+
/** Normalize ingest / export for an empty document. */
|
|
8
|
+
export declare function normalizeEmptySource(source: string): string;
|
|
9
|
+
export declare function isDisplayEmptyParagraph(block: EditorBlock): boolean;
|
|
10
|
+
export declare function isSoleEmptyParagraphDocument(doc: EditorDocument): boolean;
|
|
11
|
+
export declare function emptyParagraphBlockData(startLineIndex?: number): ParagraphBlock;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { paragraphDisplayPlain } from '../block-specs/paragraph/edit';
|
|
2
|
+
/** Canonical source body for a display-empty **paragraph** block. */
|
|
3
|
+
export const EMPTY_PARAGRAPH_MARKER = ' ';
|
|
4
|
+
/** Typical top-level gap + empty body between sibling blocks. */
|
|
5
|
+
export const EMPTY_PARAGRAPH_INSERTION = '\n\n \n\n';
|
|
6
|
+
/** Normalize ingest / export for an empty document. */
|
|
7
|
+
export function normalizeEmptySource(source) {
|
|
8
|
+
return source === '' ? EMPTY_PARAGRAPH_MARKER : source;
|
|
9
|
+
}
|
|
10
|
+
export function isDisplayEmptyParagraph(block) {
|
|
11
|
+
if (block.type !== 'paragraph')
|
|
12
|
+
return false;
|
|
13
|
+
return paragraphDisplayPlain(block).trim() === '';
|
|
14
|
+
}
|
|
15
|
+
export function isSoleEmptyParagraphDocument(doc) {
|
|
16
|
+
return (doc.blocks.length === 1 &&
|
|
17
|
+
doc.blocks[0].type === 'paragraph' &&
|
|
18
|
+
isDisplayEmptyParagraph(doc.blocks[0]));
|
|
19
|
+
}
|
|
20
|
+
export function emptyParagraphBlockData(startLineIndex = 0) {
|
|
21
|
+
return {
|
|
22
|
+
startLineIndex,
|
|
23
|
+
lines: [{ text: EMPTY_PARAGRAPH_MARKER, softBreakAfter: false }]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EditorDocument, EditorTransaction } from './types';
|
|
2
|
+
import type { FocusOutcome } from './focusOutcome';
|
|
3
|
+
/** @deprecated Use {@link FocusOutcome} — same shape, enter-specific name retained for builders. */
|
|
4
|
+
export type EnterFocusTarget = FocusOutcome;
|
|
5
|
+
export type EnterCommandOutcome = {
|
|
6
|
+
ok: true;
|
|
7
|
+
kind: 'transaction';
|
|
8
|
+
transaction: EditorTransaction;
|
|
9
|
+
focus: EnterFocusTarget;
|
|
10
|
+
dirtyTopLevelIndex: number;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
error: string;
|
|
14
|
+
};
|
|
15
|
+
/** Build the outcome for {@link MarkdownEditor.enterAt} from block id and live plain snapshot. */
|
|
16
|
+
export declare function buildEnterCommand(source: string, doc: EditorDocument, blockId: string, plainOffset: number, plainText: string): EnterCommandOutcome;
|