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,89 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import EditableInlineSurface from './EditableInlineSurface.svelte';
|
|
3
|
+
import type { MarkdownEditor } from '../MarkdownEditor.svelte';
|
|
4
|
+
import type { EditorBlock, InlineNode, TableBlockData } from '../model/types';
|
|
5
|
+
import {
|
|
6
|
+
navigateTableCell,
|
|
7
|
+
tableCellDisplayPlain,
|
|
8
|
+
tableCellModelInlines
|
|
9
|
+
} from '../block-specs/table/edit';
|
|
10
|
+
import type { TableCellAlign } from '../block-specs/table/types';
|
|
11
|
+
import Icon from '@iconify/svelte';
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
editor,
|
|
15
|
+
block,
|
|
16
|
+
blockIndex,
|
|
17
|
+
row,
|
|
18
|
+
col,
|
|
19
|
+
align,
|
|
20
|
+
header = false
|
|
21
|
+
}: {
|
|
22
|
+
editor: MarkdownEditor;
|
|
23
|
+
block: EditorBlock;
|
|
24
|
+
blockIndex: number;
|
|
25
|
+
row: number;
|
|
26
|
+
col: number;
|
|
27
|
+
align: TableCellAlign;
|
|
28
|
+
header?: boolean;
|
|
29
|
+
} = $props();
|
|
30
|
+
|
|
31
|
+
const tableCell = $derived({ row, col });
|
|
32
|
+
const data = $derived(block.data as TableBlockData);
|
|
33
|
+
const displayPlain = $derived(tableCellDisplayPlain(data, row, col));
|
|
34
|
+
const modelInlines = $derived(tableCellModelInlines(data, row, col));
|
|
35
|
+
const isActiveCell = $derived(
|
|
36
|
+
editor.documentSelection?.blockId === block.id &&
|
|
37
|
+
editor.documentSelection?.tableCell?.row === row &&
|
|
38
|
+
editor.documentSelection?.tableCell?.col === col
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const alignClass: Record<NonNullable<TableCellAlign>, string> = {
|
|
42
|
+
left: 'text-left',
|
|
43
|
+
center: 'text-center',
|
|
44
|
+
right: 'text-right'
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function cellAlignClass(a: TableCellAlign): string {
|
|
48
|
+
return a ? alignClass[a] : 'text-left';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function commitDraft(inlines: InlineNode[], plainCaret: number) {
|
|
52
|
+
editor.commitTableCellInlineDraftAt(blockIndex, row, col, inlines, plainCaret);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function onTableCellNavigate(
|
|
56
|
+
direction: 'next' | 'prev' | 'down' | 'up',
|
|
57
|
+
inlines: InlineNode[],
|
|
58
|
+
plainCaret: number
|
|
59
|
+
) {
|
|
60
|
+
const next = navigateTableCell(data, row, col, direction);
|
|
61
|
+
if (!next) return;
|
|
62
|
+
editor.navigateTableCellAt(blockIndex, { row, col }, next, inlines, plainCaret);
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<svelte:element
|
|
67
|
+
this={header ? 'th' : 'td'}
|
|
68
|
+
class="border-r border-border-muted px-2 py-1 align-top relative {cellAlignClass(align)} {header
|
|
69
|
+
? 'bg-surface-base/60 font-semibold'
|
|
70
|
+
: ''} {isActiveCell ? 'bg-surface-overlay/20' : ''}"
|
|
71
|
+
>
|
|
72
|
+
<EditableInlineSurface
|
|
73
|
+
{editor}
|
|
74
|
+
blockId={block.id}
|
|
75
|
+
{modelInlines}
|
|
76
|
+
{displayPlain}
|
|
77
|
+
{tableCell}
|
|
78
|
+
singleLine
|
|
79
|
+
suppressEnterCommand
|
|
80
|
+
supportsInlineWrap
|
|
81
|
+
ariaLabel={header ? `Table header column ${col + 1}` : `Table cell row ${row + 1} column ${col + 1}`}
|
|
82
|
+
ariaMultiline={false}
|
|
83
|
+
class="min-h-5 py-0 text-sm leading-snug"
|
|
84
|
+
onFocus={() => editor.beginPlainEditSession(blockIndex)}
|
|
85
|
+
onBlur={() => editor.commitPlainEditSession()}
|
|
86
|
+
onCommit={commitDraft}
|
|
87
|
+
{onTableCellNavigate}
|
|
88
|
+
/>
|
|
89
|
+
</svelte:element>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MarkdownEditor } from '../MarkdownEditor.svelte';
|
|
2
|
+
import type { EditorBlock } from '../model/types';
|
|
3
|
+
import type { TableCellAlign } from '../block-specs/table/types';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
editor: MarkdownEditor;
|
|
6
|
+
block: EditorBlock;
|
|
7
|
+
blockIndex: number;
|
|
8
|
+
row: number;
|
|
9
|
+
col: number;
|
|
10
|
+
align: TableCellAlign;
|
|
11
|
+
header?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const EditableTableCell: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
|
+
type EditableTableCell = ReturnType<typeof EditableTableCell>;
|
|
15
|
+
export default EditableTableCell;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { MarkdownEditor } from '../MarkdownEditor.svelte';
|
|
3
|
+
import type { EditorBlock } from '../model/types';
|
|
4
|
+
import { serializeEditorBlock } from '../model';
|
|
5
|
+
import { toggleRenderer } from '../block-specs/toggle/ToggleRenderer.svelte';
|
|
6
|
+
import type { ToggleBlock } from '../block-specs/toggle/types';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
editor,
|
|
10
|
+
blockIndex,
|
|
11
|
+
block
|
|
12
|
+
}: {
|
|
13
|
+
editor: MarkdownEditor;
|
|
14
|
+
blockIndex: number;
|
|
15
|
+
block: EditorBlock;
|
|
16
|
+
} = $props();
|
|
17
|
+
|
|
18
|
+
let root = $state.raw<HTMLDivElement | null>(null);
|
|
19
|
+
let title = $state('');
|
|
20
|
+
let body = $state('');
|
|
21
|
+
|
|
22
|
+
function readToggle(): ToggleBlock {
|
|
23
|
+
return block.data as ToggleBlock;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function syncFromBlock() {
|
|
27
|
+
const d = readToggle();
|
|
28
|
+
title = d.title;
|
|
29
|
+
body = d.body;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$effect(() => {
|
|
33
|
+
void block.id;
|
|
34
|
+
void editor.document.source;
|
|
35
|
+
const el = root;
|
|
36
|
+
if (el?.contains(document.activeElement)) return;
|
|
37
|
+
syncFromBlock();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
function focusLeavingComponent(ev: FocusEvent) {
|
|
41
|
+
const next = ev.relatedTarget as Node | null;
|
|
42
|
+
if (next && root?.contains(next)) return;
|
|
43
|
+
commit();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function commit() {
|
|
47
|
+
const prev = readToggle();
|
|
48
|
+
const data: ToggleBlock = {
|
|
49
|
+
title: title.trim(),
|
|
50
|
+
body,
|
|
51
|
+
startLineIndex: prev.startLineIndex
|
|
52
|
+
};
|
|
53
|
+
const synthetic: EditorBlock = { ...block, data };
|
|
54
|
+
editor.replaceBlockMarkdown(blockIndex, serializeEditorBlock(synthetic));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const previewToggle = $derived.by((): ToggleBlock => {
|
|
58
|
+
const prev = readToggle();
|
|
59
|
+
return {
|
|
60
|
+
title: title.trim(),
|
|
61
|
+
body,
|
|
62
|
+
startLineIndex: prev.startLineIndex
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<div
|
|
68
|
+
class="rounded-md border border-border-muted/80 bg-surface-base/20 p-2"
|
|
69
|
+
bind:this={root}
|
|
70
|
+
onfocusout={focusLeavingComponent}
|
|
71
|
+
>
|
|
72
|
+
<p class="mb-2 text-xs text-txt-tertiary">Toggle</p>
|
|
73
|
+
<label class="mb-2 block text-xs text-txt-tertiary" for="toggle-title-{blockIndex}"> Title </label>
|
|
74
|
+
<input
|
|
75
|
+
id="toggle-title-{blockIndex}"
|
|
76
|
+
type="text"
|
|
77
|
+
class="mb-3 w-full rounded border border-border-default bg-surface-sunken px-2 py-1.5 text-sm text-txt-primary outline-none focus-visible:border-focus-ring"
|
|
78
|
+
bind:value={title}
|
|
79
|
+
/>
|
|
80
|
+
<label class="mb-2 block text-xs text-txt-tertiary" for="toggle-body-{blockIndex}">
|
|
81
|
+
Body (Markdown lines between <code class="text-txt-tertiary">+++</code> delimiters)
|
|
82
|
+
</label>
|
|
83
|
+
<textarea
|
|
84
|
+
id="toggle-body-{blockIndex}"
|
|
85
|
+
draggable="false"
|
|
86
|
+
class="mb-3 min-h-[6rem] w-full resize-y rounded-md border border-border-default bg-surface-sunken p-3 font-mono text-sm leading-relaxed text-txt-primary ring-0 outline-none focus-visible:border-focus-ring"
|
|
87
|
+
spellcheck={false}
|
|
88
|
+
bind:value={body}
|
|
89
|
+
></textarea>
|
|
90
|
+
<p class="mb-1 text-xs text-txt-tertiary">Preview</p>
|
|
91
|
+
<div class="rounded border border-border-muted/60 bg-surface-sunken/40 p-2">
|
|
92
|
+
{@render toggleRenderer(previewToggle)}
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MarkdownEditor } from '../MarkdownEditor.svelte';
|
|
2
|
+
import type { EditorBlock } from '../model/types';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
editor: MarkdownEditor;
|
|
5
|
+
blockIndex: number;
|
|
6
|
+
block: EditorBlock;
|
|
7
|
+
};
|
|
8
|
+
declare const EditableToggle: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type EditableToggle = ReturnType<typeof EditableToggle>;
|
|
10
|
+
export default EditableToggle;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MenuItem } from 'phoundry-ui';
|
|
2
|
+
import type { ContextMenuAPI } from 'phoundry-ui';
|
|
3
|
+
import { type EditorCommandContext, type EditorCommandSurface } from './commandRegistry.js';
|
|
4
|
+
export declare function editorCommandsToMenuItems(surface: EditorCommandSurface, ctx: EditorCommandContext, onCommand?: () => void): MenuItem[];
|
|
5
|
+
export type OpenEditorCommandMenuOptions = {
|
|
6
|
+
surface: EditorCommandSurface;
|
|
7
|
+
ctx: EditorCommandContext;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
ariaLabel: string;
|
|
11
|
+
onOpen?: () => void;
|
|
12
|
+
onClose?: (detail: {
|
|
13
|
+
commandSelected: boolean;
|
|
14
|
+
}) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare function openEditorCommandMenu(api: ContextMenuAPI, opts: OpenEditorCommandMenuOptions): void;
|
|
17
|
+
/** Reset scroll listener state — for tests only. */
|
|
18
|
+
export declare function resetEditorCommandMenuScrollListenerForTests(): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { commandsByGroup } from './commandRegistry.js';
|
|
2
|
+
function runCommand(cmd, ctx) {
|
|
3
|
+
const blockIndex = ctx.editor.document.blocks.findIndex((b) => b.id === ctx.blockId);
|
|
4
|
+
if (blockIndex < 0)
|
|
5
|
+
return;
|
|
6
|
+
cmd.run({ ...ctx, blockIndex });
|
|
7
|
+
}
|
|
8
|
+
export function editorCommandsToMenuItems(surface, ctx, onCommand) {
|
|
9
|
+
const grouped = commandsByGroup(surface, ctx);
|
|
10
|
+
if (surface === 'slash') {
|
|
11
|
+
const items = [{ type: 'label', label: 'Blocks' }];
|
|
12
|
+
for (const { commands } of grouped) {
|
|
13
|
+
for (const cmd of commands) {
|
|
14
|
+
items.push({
|
|
15
|
+
type: 'action',
|
|
16
|
+
id: cmd.id,
|
|
17
|
+
label: cmd.label,
|
|
18
|
+
disabled: !cmd.isEnabled(ctx),
|
|
19
|
+
action: () => {
|
|
20
|
+
onCommand?.();
|
|
21
|
+
runCommand(cmd, ctx);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return items;
|
|
27
|
+
}
|
|
28
|
+
const items = [];
|
|
29
|
+
for (const [gi, { group, commands }] of grouped.entries()) {
|
|
30
|
+
if (gi > 0)
|
|
31
|
+
items.push({ type: 'separator' });
|
|
32
|
+
if (group === 'turnInto') {
|
|
33
|
+
items.push({ type: 'label', label: 'Turn into' });
|
|
34
|
+
}
|
|
35
|
+
for (const cmd of commands) {
|
|
36
|
+
items.push({
|
|
37
|
+
type: 'action',
|
|
38
|
+
id: cmd.id,
|
|
39
|
+
label: cmd.label,
|
|
40
|
+
disabled: !cmd.isEnabled(ctx),
|
|
41
|
+
shortcut: cmd.shortcut?.ariaKeyShortcuts,
|
|
42
|
+
action: () => {
|
|
43
|
+
onCommand?.();
|
|
44
|
+
runCommand(cmd, ctx);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return items;
|
|
50
|
+
}
|
|
51
|
+
let scrollCleanup = null;
|
|
52
|
+
function cleanupScrollListener() {
|
|
53
|
+
scrollCleanup?.();
|
|
54
|
+
scrollCleanup = null;
|
|
55
|
+
}
|
|
56
|
+
export function openEditorCommandMenu(api, opts) {
|
|
57
|
+
cleanupScrollListener();
|
|
58
|
+
if (api.state) {
|
|
59
|
+
api.close();
|
|
60
|
+
}
|
|
61
|
+
let commandSelected = false;
|
|
62
|
+
opts.onOpen?.();
|
|
63
|
+
function onCloseWrapper() {
|
|
64
|
+
cleanupScrollListener();
|
|
65
|
+
opts.onClose?.({ commandSelected });
|
|
66
|
+
commandSelected = false;
|
|
67
|
+
}
|
|
68
|
+
function onScroll() {
|
|
69
|
+
api.close();
|
|
70
|
+
}
|
|
71
|
+
window.addEventListener('scroll', onScroll, true);
|
|
72
|
+
scrollCleanup = () => window.removeEventListener('scroll', onScroll, true);
|
|
73
|
+
api.open(() => editorCommandsToMenuItems(opts.surface, opts.ctx, () => {
|
|
74
|
+
commandSelected = true;
|
|
75
|
+
}), opts.x, opts.y, {
|
|
76
|
+
ariaLabel: opts.ariaLabel,
|
|
77
|
+
onClose: onCloseWrapper
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/** Reset scroll listener state — for tests only. */
|
|
81
|
+
export function resetEditorCommandMenuScrollListenerForTests() {
|
|
82
|
+
cleanupScrollListener();
|
|
83
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MarkdownEditor } from './MarkdownEditor.svelte';
|
|
2
|
+
import type { EditorBlockType } from './model/types';
|
|
3
|
+
export type EditorCommandSurface = 'slash' | 'blockMenu';
|
|
4
|
+
export type SlashKind = 'paragraph' | 'heading';
|
|
5
|
+
export type EditorCommandContext = {
|
|
6
|
+
editor: MarkdownEditor;
|
|
7
|
+
blockIndex: number;
|
|
8
|
+
blockId: string;
|
|
9
|
+
blockType: EditorBlockType;
|
|
10
|
+
blockSynthetic: boolean;
|
|
11
|
+
canMoveUp: boolean;
|
|
12
|
+
canMoveDown: boolean;
|
|
13
|
+
/** Leaf row id when the command targets a nested row inside a container block. */
|
|
14
|
+
nestedRowBlockId?: string;
|
|
15
|
+
/** Leaf row type for nested command filtering and inline marks. */
|
|
16
|
+
nestedRowBlockType?: EditorBlockType;
|
|
17
|
+
/** Set when resolving slash-visible commands */
|
|
18
|
+
slashKind?: SlashKind;
|
|
19
|
+
};
|
|
20
|
+
export type EditorCommandShortcut = {
|
|
21
|
+
/** e.g. Alt+Shift+ArrowUp for aria-keyshortcuts */
|
|
22
|
+
ariaKeyShortcuts: string;
|
|
23
|
+
};
|
|
24
|
+
export type EditorCommand = {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
/** Logical section for UI separators */
|
|
28
|
+
group: 'structure' | 'turnInto' | 'inline';
|
|
29
|
+
surfaces: EditorCommandSurface[];
|
|
30
|
+
/** If set, command appears only for these block types (block menu). Slash ignores blockType when slashKind matches. */
|
|
31
|
+
blockTypes?: EditorBlockType[];
|
|
32
|
+
/** When true, command appears only on nested row chrome (not top-level block chrome). */
|
|
33
|
+
nestedRowOnly?: boolean;
|
|
34
|
+
/** Slash palette: limit by editable surface kind */
|
|
35
|
+
slashKinds?: SlashKind[];
|
|
36
|
+
isEnabled: (ctx: EditorCommandContext) => boolean;
|
|
37
|
+
run: (ctx: EditorCommandContext) => void;
|
|
38
|
+
shortcut?: EditorCommandShortcut;
|
|
39
|
+
};
|
|
40
|
+
/** Structural and shared inline commands (block-specific commands come from BlockSpec registry). */
|
|
41
|
+
export declare const editorCommands: EditorCommand[];
|
|
42
|
+
export type EditorCommandId = (typeof editorCommands)[number]['id'];
|
|
43
|
+
export declare function getCommandsForSurface(surface: EditorCommandSurface, ctx: EditorCommandContext): EditorCommand[];
|
|
44
|
+
export type CommandGroupEntry = {
|
|
45
|
+
group: EditorCommand['group'];
|
|
46
|
+
commands: EditorCommand[];
|
|
47
|
+
};
|
|
48
|
+
export declare function commandsByGroup(surface: EditorCommandSurface, ctx: EditorCommandContext): CommandGroupEntry[];
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { registeredBlockSpecs } from './block-specs/registry';
|
|
2
|
+
function inlinePlainSelectionOk(ctx) {
|
|
3
|
+
if (ctx.blockSynthetic)
|
|
4
|
+
return false;
|
|
5
|
+
const type = ctx.nestedRowBlockType ?? ctx.blockType;
|
|
6
|
+
if (type !== 'paragraph' && type !== 'heading' && type !== 'listItem')
|
|
7
|
+
return false;
|
|
8
|
+
if (ctx.nestedRowBlockId) {
|
|
9
|
+
const r = ctx.editor.getDocumentSelectionPlain(ctx.nestedRowBlockId);
|
|
10
|
+
return r !== null && r.start !== r.end;
|
|
11
|
+
}
|
|
12
|
+
const r = ctx.editor.getInlinePlainFocus(ctx.blockIndex);
|
|
13
|
+
return r !== null && r.start !== r.end;
|
|
14
|
+
}
|
|
15
|
+
function inlineCmd(id, label, kind, linkHref) {
|
|
16
|
+
return {
|
|
17
|
+
id,
|
|
18
|
+
label,
|
|
19
|
+
group: 'inline',
|
|
20
|
+
surfaces: ['blockMenu'],
|
|
21
|
+
blockTypes: ['paragraph', 'heading', 'listItem'],
|
|
22
|
+
isEnabled: (ctx) => inlinePlainSelectionOk(ctx),
|
|
23
|
+
run: (ctx) => {
|
|
24
|
+
if (ctx.nestedRowBlockId) {
|
|
25
|
+
const r = ctx.editor.getDocumentSelectionPlain(ctx.nestedRowBlockId);
|
|
26
|
+
if (!r)
|
|
27
|
+
return;
|
|
28
|
+
ctx.editor.applyInlineWrapOnNestedRow(ctx.blockIndex, ctx.nestedRowBlockId, r.start, r.end, kind, linkHref);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const r = ctx.editor.getInlinePlainFocus(ctx.blockIndex);
|
|
32
|
+
if (!r)
|
|
33
|
+
return;
|
|
34
|
+
ctx.editor.applyInlineWrapAt(ctx.blockIndex, r.start, r.end, kind, linkHref);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const structuralAndInlineCommands = [
|
|
39
|
+
{
|
|
40
|
+
id: 'duplicateBlock',
|
|
41
|
+
label: 'Duplicate',
|
|
42
|
+
group: 'structure',
|
|
43
|
+
surfaces: ['blockMenu'],
|
|
44
|
+
isEnabled: (ctx) => !ctx.nestedRowBlockId && !ctx.blockSynthetic,
|
|
45
|
+
run: (ctx) => {
|
|
46
|
+
ctx.editor.duplicateBlockAt(ctx.blockIndex);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'deleteBlock',
|
|
51
|
+
label: 'Delete',
|
|
52
|
+
group: 'structure',
|
|
53
|
+
surfaces: ['blockMenu'],
|
|
54
|
+
isEnabled: (ctx) => !ctx.nestedRowBlockId,
|
|
55
|
+
run: (ctx) => {
|
|
56
|
+
ctx.editor.deleteBlockAt(ctx.blockIndex);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'moveBlockUp',
|
|
61
|
+
label: 'Move up',
|
|
62
|
+
group: 'structure',
|
|
63
|
+
surfaces: ['blockMenu'],
|
|
64
|
+
isEnabled: (ctx) => !ctx.nestedRowBlockId && ctx.canMoveUp && !ctx.blockSynthetic,
|
|
65
|
+
run: (ctx) => {
|
|
66
|
+
ctx.editor.moveBlockUpAt(ctx.blockIndex);
|
|
67
|
+
},
|
|
68
|
+
shortcut: { ariaKeyShortcuts: 'Alt+Shift+ArrowUp' }
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'moveBlockDown',
|
|
72
|
+
label: 'Move down',
|
|
73
|
+
group: 'structure',
|
|
74
|
+
surfaces: ['blockMenu'],
|
|
75
|
+
isEnabled: (ctx) => !ctx.nestedRowBlockId && ctx.canMoveDown && !ctx.blockSynthetic,
|
|
76
|
+
run: (ctx) => {
|
|
77
|
+
ctx.editor.moveBlockDownAt(ctx.blockIndex);
|
|
78
|
+
},
|
|
79
|
+
shortcut: { ariaKeyShortcuts: 'Alt+Shift+ArrowDown' }
|
|
80
|
+
},
|
|
81
|
+
inlineCmd('inlineBold', 'Bold', 'strong'),
|
|
82
|
+
inlineCmd('inlineItalic', 'Italic', 'emphasis'),
|
|
83
|
+
inlineCmd('inlineCode', 'Code', 'code'),
|
|
84
|
+
inlineCmd('inlineLink', 'Link', 'link', ''),
|
|
85
|
+
inlineCmd('inlineStrikethrough', 'Strikethrough', 'strikethrough'),
|
|
86
|
+
inlineCmd('inlineHighlight', 'Highlight', 'highlight')
|
|
87
|
+
];
|
|
88
|
+
/** Structural and shared inline commands (block-specific commands come from BlockSpec registry). */
|
|
89
|
+
export const editorCommands = structuralAndInlineCommands;
|
|
90
|
+
function allEditorCommands() {
|
|
91
|
+
return [
|
|
92
|
+
...structuralAndInlineCommands,
|
|
93
|
+
...registeredBlockSpecs().flatMap((spec) => spec.commands)
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
const topLevelStructuralCommandIds = new Set([
|
|
97
|
+
'duplicateBlock',
|
|
98
|
+
'deleteBlock',
|
|
99
|
+
'moveBlockUp',
|
|
100
|
+
'moveBlockDown'
|
|
101
|
+
]);
|
|
102
|
+
export function getCommandsForSurface(surface, ctx) {
|
|
103
|
+
return allEditorCommands().filter((cmd) => {
|
|
104
|
+
if (!cmd.surfaces.includes(surface))
|
|
105
|
+
return false;
|
|
106
|
+
if (ctx.nestedRowBlockId && topLevelStructuralCommandIds.has(cmd.id))
|
|
107
|
+
return false;
|
|
108
|
+
if (cmd.nestedRowOnly && !ctx.nestedRowBlockId)
|
|
109
|
+
return false;
|
|
110
|
+
const typeForFilter = ctx.nestedRowBlockType ?? ctx.blockType;
|
|
111
|
+
if (cmd.blockTypes && !cmd.blockTypes.includes(typeForFilter))
|
|
112
|
+
return false;
|
|
113
|
+
if (surface === 'slash' && cmd.slashKinds) {
|
|
114
|
+
const k = ctx.slashKind;
|
|
115
|
+
if (!k || !cmd.slashKinds.includes(k))
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
export function commandsByGroup(surface, ctx) {
|
|
122
|
+
const list = getCommandsForSurface(surface, ctx);
|
|
123
|
+
const order = ['structure', 'turnInto', 'inline'];
|
|
124
|
+
const map = new Map();
|
|
125
|
+
for (const g of order)
|
|
126
|
+
map.set(g, []);
|
|
127
|
+
for (const cmd of list) {
|
|
128
|
+
map.get(cmd.group).push(cmd);
|
|
129
|
+
}
|
|
130
|
+
return order
|
|
131
|
+
.map((group) => ({ group, commands: map.get(group) }))
|
|
132
|
+
.filter((e) => e.commands.length > 0);
|
|
133
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type AssetBaseUrlContext = {
|
|
2
|
+
current: string | undefined;
|
|
3
|
+
};
|
|
4
|
+
export declare function setAssetBaseUrlContext(ctx: AssetBaseUrlContext): void;
|
|
5
|
+
/** Safe href for DOM display; resolves relative paths when an asset base URL is set. */
|
|
6
|
+
export declare function hrefForDisplay(href: string): string | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
import { safeHref } from '../plugins/links-images/parse-links-images.js';
|
|
3
|
+
import { resolveAssetUrlForDom } from '../plugins/links-images/resolve-asset-url.js';
|
|
4
|
+
const ASSET_BASE_URL_KEY = Symbol('phormat-asset-base-url');
|
|
5
|
+
export function setAssetBaseUrlContext(ctx) {
|
|
6
|
+
setContext(ASSET_BASE_URL_KEY, ctx);
|
|
7
|
+
}
|
|
8
|
+
function getAssetBaseUrlContext() {
|
|
9
|
+
return getContext(ASSET_BASE_URL_KEY)?.current;
|
|
10
|
+
}
|
|
11
|
+
/** Safe href for DOM display; resolves relative paths when an asset base URL is set. */
|
|
12
|
+
export function hrefForDisplay(href) {
|
|
13
|
+
const safe = safeHref(href);
|
|
14
|
+
if (!safe)
|
|
15
|
+
return null;
|
|
16
|
+
const base = getAssetBaseUrlContext();
|
|
17
|
+
if (!base)
|
|
18
|
+
return safe;
|
|
19
|
+
return resolveAssetUrlForDom(safe, base);
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MarkdownEditor } from '../MarkdownEditor.svelte';
|
|
2
|
+
/**
|
|
3
|
+
* Intercept editor undo/redo shortcuts on plain edit surfaces.
|
|
4
|
+
* Returns true when the event was handled.
|
|
5
|
+
*/
|
|
6
|
+
export declare function handleEditorUndoRedoKeydown(editor: MarkdownEditor, e: KeyboardEvent): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function isMacPlatform() {
|
|
2
|
+
if (typeof navigator === 'undefined')
|
|
3
|
+
return false;
|
|
4
|
+
return /mac/i.test(navigator.platform);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Intercept editor undo/redo shortcuts on plain edit surfaces.
|
|
8
|
+
* Returns true when the event was handled.
|
|
9
|
+
*/
|
|
10
|
+
export function handleEditorUndoRedoKeydown(editor, e) {
|
|
11
|
+
if ((!e.metaKey && !e.ctrlKey) || e.altKey)
|
|
12
|
+
return false;
|
|
13
|
+
const key = e.key.toLowerCase();
|
|
14
|
+
if (key === 'z' && !e.shiftKey) {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
editor.undo();
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
const isMac = isMacPlatform();
|
|
20
|
+
if (key === 'z' && e.shiftKey) {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
editor.redo();
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (key === 'y' && !e.shiftKey && !isMac) {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
editor.redo();
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MarkdownEditor } from '../MarkdownEditor.svelte';
|
|
2
|
+
export type PlainEnterSurface = {
|
|
3
|
+
blockId: string;
|
|
4
|
+
getPlainText: () => string;
|
|
5
|
+
getPlainOffset: () => number;
|
|
6
|
+
};
|
|
7
|
+
/** Shared plain Enter handler — Shift+Enter stays deferred (preventDefault, no-op). */
|
|
8
|
+
export declare function handlePlainEnterKeydown(editor: MarkdownEditor, e: KeyboardEvent, surface: PlainEnterSurface): boolean;
|
|
9
|
+
export declare function plainEnterFromContentEditable(editor: MarkdownEditor, e: KeyboardEvent, blockId: string, node: HTMLDivElement): boolean;
|
|
10
|
+
/** Reinforce keydown Enter handling — handle `insertParagraph` before the browser mutates. */
|
|
11
|
+
export declare function plainEnterFromBeforeInput(editor: MarkdownEditor, e: InputEvent, blockId: string, node: HTMLDivElement): boolean;
|
|
12
|
+
export declare function plainEnterFromInput(editor: MarkdownEditor, e: KeyboardEvent, blockId: string, input: HTMLInputElement): boolean;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { plainOffsets } from './plaintextCaret';
|
|
2
|
+
/** Shared plain Enter handler — Shift+Enter stays deferred (preventDefault, no-op). */
|
|
3
|
+
export function handlePlainEnterKeydown(editor, e, surface) {
|
|
4
|
+
if (e.key === 'Enter' && e.shiftKey) {
|
|
5
|
+
e.preventDefault();
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
if (editor.shouldSuppressPlainInputForBlock(surface.blockId)) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
editor.enterAt({
|
|
14
|
+
blockId: surface.blockId,
|
|
15
|
+
plainOffset: surface.getPlainOffset(),
|
|
16
|
+
plainText: surface.getPlainText()
|
|
17
|
+
});
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
export function plainEnterFromContentEditable(editor, e, blockId, node) {
|
|
23
|
+
return handlePlainEnterKeydown(editor, e, {
|
|
24
|
+
blockId,
|
|
25
|
+
getPlainText: () => node.textContent ?? '',
|
|
26
|
+
getPlainOffset: () => {
|
|
27
|
+
const { start, end } = plainOffsets(node);
|
|
28
|
+
return Math.min(start, end);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Reinforce keydown Enter handling — handle `insertParagraph` before the browser mutates. */
|
|
33
|
+
export function plainEnterFromBeforeInput(editor, e, blockId, node) {
|
|
34
|
+
if (e.inputType !== 'insertParagraph')
|
|
35
|
+
return false;
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
if (editor.shouldSuppressPlainInputForBlock(blockId))
|
|
38
|
+
return true;
|
|
39
|
+
const { start, end } = plainOffsets(node);
|
|
40
|
+
editor.enterAt({
|
|
41
|
+
blockId,
|
|
42
|
+
plainOffset: Math.min(start, end),
|
|
43
|
+
plainText: node.textContent ?? ''
|
|
44
|
+
});
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
export function plainEnterFromInput(editor, e, blockId, input) {
|
|
48
|
+
return handlePlainEnterKeydown(editor, e, {
|
|
49
|
+
blockId,
|
|
50
|
+
getPlainText: () => input.value,
|
|
51
|
+
getPlainOffset: () => input.selectionStart ?? 0
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map DOM Selection inside a `contenteditable="plaintext-only"` root to plain-text offsets.
|
|
3
|
+
* Indices are UTF-16 code units, aligned with {@link EditorSelection} and {@link DOMString}.
|
|
4
|
+
*/
|
|
5
|
+
export declare function plainOffsets(root: HTMLElement): {
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
};
|
|
9
|
+
/** Move caret to a plain offset inside `root` (collapsed selection). */
|
|
10
|
+
export declare function setCaretPlainOffset(root: HTMLElement, offset: number): void;
|
|
11
|
+
/** True when `offset` is the start of a logical line in `plain` (after `\n` or at 0). */
|
|
12
|
+
export declare function offsetAtLineStart(plain: string, offset: number): boolean;
|