@notectl/core 2.2.5 → 2.3.1
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/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs → AlignmentPlugin--xAFlRqE.mjs} +2 -2
- package/dist/chunks/{AlignmentPlugin-BCHxo16v.mjs.map → AlignmentPlugin--xAFlRqE.mjs.map} +1 -1
- package/dist/chunks/{AttrRegistry-DcDVyzLm.mjs → AttrRegistry-B3zB02z9.mjs} +2 -2
- package/dist/chunks/AttrRegistry-B3zB02z9.mjs.map +1 -0
- package/dist/chunks/{AttributedMarkCommands-D4W2Jgpj.mjs → AttributedMarkCommands-bagbH8Qt.mjs} +2 -2
- package/dist/chunks/{AttributedMarkCommands-D4W2Jgpj.mjs.map → AttributedMarkCommands-bagbH8Qt.mjs.map} +1 -1
- package/dist/chunks/{BidiIsolationPlugin-BddRbDCN.mjs → BidiIsolationPlugin-DBXyXpgm.mjs} +2 -2
- package/dist/chunks/{BidiIsolationPlugin-BddRbDCN.mjs.map → BidiIsolationPlugin-DBXyXpgm.mjs.map} +1 -1
- package/dist/chunks/BlockInsertion-CJusvrDL.mjs +2 -0
- package/dist/chunks/BlockInsertion-CJusvrDL.mjs.map +1 -0
- package/dist/chunks/BlockquotePlugin-Bz2glHwX.mjs +2 -0
- package/dist/chunks/{BlockquotePlugin-4V7KV_Sb.mjs.map → BlockquotePlugin-Bz2glHwX.mjs.map} +1 -1
- package/dist/chunks/{CaretNavigationPlugin-C6XBwp0N.mjs → CaretNavigationPlugin-CNsT0eb4.mjs} +2 -2
- package/dist/chunks/{CaretNavigationPlugin-C6XBwp0N.mjs.map → CaretNavigationPlugin-CNsT0eb4.mjs.map} +1 -1
- package/dist/chunks/CodeBlockPlugin-C1hrdbSZ.mjs +2 -0
- package/dist/chunks/CodeBlockPlugin-C1hrdbSZ.mjs.map +1 -0
- package/dist/chunks/{ColorGrid-CXRdpP_n.mjs → ColorGrid-C9RQoEWF.mjs} +2 -2
- package/dist/chunks/{ColorGrid-CXRdpP_n.mjs.map → ColorGrid-C9RQoEWF.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-DiA68Pzz.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-C_74bqid.mjs.map → ColorPickerPopup-DiA68Pzz.mjs.map} +1 -1
- package/dist/chunks/Commands-1dFFldi7.mjs +2 -0
- package/dist/chunks/Commands-1dFFldi7.mjs.map +1 -0
- package/dist/chunks/ContentModel-NpAj7vGW.mjs +2 -0
- package/dist/chunks/ContentModel-NpAj7vGW.mjs.map +1 -0
- package/dist/chunks/Decoration-BpoEOANl.mjs +2 -0
- package/dist/chunks/Decoration-BpoEOANl.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-C7XE0nxW.mjs → DirectionDetection-CDVSEWQ6.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-C7XE0nxW.mjs.map → DirectionDetection-CDVSEWQ6.mjs.map} +1 -1
- package/dist/chunks/Document-827l3P80.mjs +2 -0
- package/dist/chunks/Document-827l3P80.mjs.map +1 -0
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs +2 -0
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs.map +1 -0
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs +2 -0
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -0
- package/dist/chunks/FontPlugin-By-TGrQo.mjs +2 -0
- package/dist/chunks/{FontPlugin-DB1_bgam.mjs.map → FontPlugin-By-TGrQo.mjs.map} +1 -1
- package/dist/chunks/{FontSizePlugin-DFvp7Ki9.mjs → FontSizePlugin-Dln-tYXV.mjs} +2 -2
- package/dist/chunks/FontSizePlugin-Dln-tYXV.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-By1befrR.mjs +2 -0
- package/dist/chunks/FormulaPlugin-By1befrR.mjs.map +1 -0
- package/dist/chunks/GapCursorNavigation-BuXngVu-.mjs +2 -0
- package/dist/chunks/{GapCursorNavigation-ycNzuQVH.mjs.map → GapCursorNavigation-BuXngVu-.mjs.map} +1 -1
- package/dist/chunks/{GapCursorPlugin-Zvxjnr82.mjs → GapCursorPlugin-DAxVzXRs.mjs} +2 -2
- package/dist/chunks/{GapCursorPlugin-Zvxjnr82.mjs.map → GapCursorPlugin-DAxVzXRs.mjs.map} +1 -1
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +2 -0
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs.map +1 -0
- package/dist/chunks/{HardBreakPlugin-9DOyCyyM.mjs → HardBreakPlugin-DlbSlrdq.mjs} +2 -2
- package/dist/chunks/{HardBreakPlugin-9DOyCyyM.mjs.map → HardBreakPlugin-DlbSlrdq.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-uMAjPOk5.mjs +2 -0
- package/dist/chunks/{HeadingPlugin-D9yvG2Aw.mjs.map → HeadingPlugin-uMAjPOk5.mjs.map} +1 -1
- package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs → HighlightPlugin-Bj7FPkIQ.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-D4gh4RP7.mjs.map → HighlightPlugin-Bj7FPkIQ.mjs.map} +1 -1
- package/dist/chunks/HorizontalRulePlugin-DUVmTQpX.mjs +2 -0
- package/dist/chunks/HorizontalRulePlugin-DUVmTQpX.mjs.map +1 -0
- package/dist/chunks/ImagePlugin-FToCOjd5.mjs +2 -0
- package/dist/chunks/{ImagePlugin-Cp_RINtc.mjs.map → ImagePlugin-FToCOjd5.mjs.map} +1 -1
- package/dist/chunks/{InlineCodePlugin-DMr4O7c7.mjs → InlineCodePlugin-pISIoGQE.mjs} +2 -2
- package/dist/chunks/InlineCodePlugin-pISIoGQE.mjs.map +1 -0
- package/dist/chunks/InlineStyleMarkSpec-CjSRj4f_.mjs +2 -0
- package/dist/chunks/{InlineStyleMarkSpec-4R6DC7ij.mjs.map → InlineStyleMarkSpec-CjSRj4f_.mjs.map} +1 -1
- package/dist/chunks/LinkPlugin-Ct5Z180S.mjs +2 -0
- package/dist/chunks/LinkPlugin-Ct5Z180S.mjs.map +1 -0
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs +2 -0
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs.map +1 -0
- package/dist/chunks/MarkInputRule-Bdi8KPus.mjs +2 -0
- package/dist/chunks/MarkInputRule-Bdi8KPus.mjs.map +1 -0
- package/dist/chunks/MarkdownHTMLRegistry-CKEx7LkR.mjs +2 -0
- package/dist/chunks/MarkdownHTMLRegistry-CKEx7LkR.mjs.map +1 -0
- package/dist/chunks/MarkdownParser-CWt3M6jR.mjs +2 -0
- package/dist/chunks/MarkdownParser-CWt3M6jR.mjs.map +1 -0
- package/dist/chunks/MarkdownSerializer-J-i28out.mjs +2 -0
- package/dist/chunks/MarkdownSerializer-J-i28out.mjs.map +1 -0
- package/dist/chunks/{NodeResolver-ChgLF_IP.mjs → NodeResolver-Dleih-8R.mjs} +2 -2
- package/dist/chunks/{NodeResolver-ChgLF_IP.mjs.map → NodeResolver-Dleih-8R.mjs.map} +1 -1
- package/dist/chunks/NodeSelectionCommands-1PjwUDTJ.mjs +2 -0
- package/dist/chunks/{NodeSelectionCommands-Dj4VxLdD.mjs.map → NodeSelectionCommands-1PjwUDTJ.mjs.map} +1 -1
- package/dist/chunks/PluginHelpers-Dx_0hfDe.mjs +2 -0
- package/dist/chunks/{PluginHelpers-KDuTlmXm.mjs.map → PluginHelpers-Dx_0hfDe.mjs.map} +1 -1
- package/dist/chunks/{PopupManager-CyOfZUab.mjs → PopupManager-CT-fMZJn.mjs} +2 -2
- package/dist/chunks/{PopupManager-CyOfZUab.mjs.map → PopupManager-CT-fMZJn.mjs.map} +1 -1
- package/dist/chunks/PopupPositioning-BFh6Ed1D.mjs +2 -0
- package/dist/chunks/{PopupPositioning-DtUrY9bh.mjs.map → PopupPositioning-BFh6Ed1D.mjs.map} +1 -1
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs +2 -0
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs.map +1 -0
- package/dist/chunks/{PrintTypes-WdtgSj74.mjs → PrintTypes-CxU69qu3.mjs} +3 -2
- package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-o8v3msQe.mjs → RangeIterator-DP7Ud3Gp.mjs} +2 -2
- package/dist/chunks/{RangeIterator-o8v3msQe.mjs.map → RangeIterator-DP7Ud3Gp.mjs.map} +1 -1
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs +2 -0
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs.map +1 -0
- package/dist/chunks/{SimpleMark-CaQtFAau.mjs → SimpleMark-7CQcA4RK.mjs} +2 -2
- package/dist/chunks/{SimpleMark-CaQtFAau.mjs.map → SimpleMark-7CQcA4RK.mjs.map} +1 -1
- package/dist/chunks/{SmartPastePlugin-Bi_wpTCV.mjs → SmartPastePlugin-CYa_nD9v.mjs} +2 -2
- package/dist/chunks/{SmartPastePlugin-Bi_wpTCV.mjs.map → SmartPastePlugin-CYa_nD9v.mjs.map} +1 -1
- package/dist/chunks/StrikethroughPlugin-C2oWvGc3.mjs +2 -0
- package/dist/chunks/StrikethroughPlugin-C2oWvGc3.mjs.map +1 -0
- package/dist/chunks/StyleRuntime-DW6omotc.mjs +2 -0
- package/dist/chunks/StyleRuntime-DW6omotc.mjs.map +1 -0
- package/dist/chunks/{SuperSubPlugin-DVP7VnIz.mjs → SuperSubPlugin-D1xaKrSu.mjs} +2 -2
- package/dist/chunks/{SuperSubPlugin-DVP7VnIz.mjs.map → SuperSubPlugin-D1xaKrSu.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +2 -0
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +1 -0
- package/dist/chunks/TablePlugin-PJe3zwr-.mjs +2 -0
- package/dist/chunks/TablePlugin-PJe3zwr-.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-CTd9tfeG.mjs +2 -0
- package/dist/chunks/{TextColorPlugin-C1qpzEOa.mjs.map → TextColorPlugin-CTd9tfeG.mjs.map} +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-CPnKVVuI.mjs +2 -0
- package/dist/chunks/{TextDirectionAutoPlugin-CzWJjrvG.mjs.map → TextDirectionAutoPlugin-CPnKVVuI.mjs.map} +1 -1
- package/dist/chunks/{TextDirectionPlugin-DHB88HKf.mjs → TextDirectionPlugin-Bns_03vL.mjs} +2 -2
- package/dist/chunks/{TextDirectionPlugin-DHB88HKf.mjs.map → TextDirectionPlugin-Bns_03vL.mjs.map} +1 -1
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +2 -0
- package/dist/chunks/{TextDirectionService-OFOU6r_s.mjs.map → TextDirectionService-BcX07mw2.mjs.map} +1 -1
- package/dist/chunks/TextFormattingPlugin-DBVlePqj.mjs +2 -0
- package/dist/chunks/TextFormattingPlugin-DBVlePqj.mjs.map +1 -0
- package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs → ToolbarPlugin-DtfGTO_V.mjs} +2 -2
- package/dist/chunks/{ToolbarPlugin-CLz2wa2c.mjs.map → ToolbarPlugin-DtfGTO_V.mjs.map} +1 -1
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs +2 -0
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs.map +1 -0
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs +2 -0
- package/dist/chunks/{WordBoundary-DxeMBRyP.mjs.map → WordBoundary-CFpIJDNP.mjs.map} +1 -1
- package/dist/chunks/ar-Dg9PdDet.mjs +2 -0
- package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -0
- package/dist/chunks/ar-eOA3UmiE.mjs +2 -0
- package/dist/chunks/{ar-BTShmP2E.mjs.map → ar-eOA3UmiE.mjs.map} +1 -1
- package/dist/chunks/de-DJ5EkXQo.mjs +2 -0
- package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -0
- package/dist/chunks/{de-C--bRmjW.mjs → de-DRbhnS4T.mjs} +2 -2
- package/dist/chunks/{de-C--bRmjW.mjs.map → de-DRbhnS4T.mjs.map} +1 -1
- package/dist/chunks/{es-DFUVd7eO.mjs → es-BQ9dox_E.mjs} +2 -2
- package/dist/chunks/{es-DFUVd7eO.mjs.map → es-BQ9dox_E.mjs.map} +1 -1
- package/dist/chunks/es-CEAJj7aB.mjs +2 -0
- package/dist/chunks/es-CEAJj7aB.mjs.map +1 -0
- package/dist/chunks/fr-DhWQzZy3.mjs +2 -0
- package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -0
- package/dist/chunks/{fr-BaXKyPmX.mjs → fr-NVOinLyF.mjs} +2 -2
- package/dist/chunks/{fr-BaXKyPmX.mjs.map → fr-NVOinLyF.mjs.map} +1 -1
- package/dist/chunks/full-DSWM4cKQ.mjs +2 -0
- package/dist/chunks/{full-Cah3qjCT.mjs.map → full-DSWM4cKQ.mjs.map} +1 -1
- package/dist/chunks/hi-BsZzSMfL.mjs +2 -0
- package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -0
- package/dist/chunks/{hi-aH9HZG23.mjs → hi-DrC2H81d.mjs} +2 -2
- package/dist/chunks/{hi-aH9HZG23.mjs.map → hi-DrC2H81d.mjs.map} +1 -1
- package/dist/chunks/minimal-CFkkPXef.mjs +2 -0
- package/dist/chunks/{minimal-DqATlnAL.mjs.map → minimal-CFkkPXef.mjs.map} +1 -1
- package/dist/chunks/pt-BuZ7acHF.mjs +2 -0
- package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -0
- package/dist/chunks/{pt-Hy-0Xnnc.mjs → pt-CFrcl1v_.mjs} +2 -2
- package/dist/chunks/{pt-Hy-0Xnnc.mjs.map → pt-CFrcl1v_.mjs.map} +1 -1
- package/dist/chunks/rolldown-runtime-H_PjY6_i.mjs +1 -0
- package/dist/chunks/ru-CsP6mLxp.mjs +2 -0
- package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -0
- package/dist/chunks/{ru-BFpEOrVp.mjs → ru-gxbzqLL8.mjs} +2 -2
- package/dist/chunks/{ru-BFpEOrVp.mjs.map → ru-gxbzqLL8.mjs.map} +1 -1
- package/dist/chunks/src-DiAOfuOT.mjs +2 -0
- package/dist/chunks/src-DiAOfuOT.mjs.map +1 -0
- package/dist/chunks/zh-BFZOM3lF.mjs +2 -0
- package/dist/chunks/{zh-BjoyjClN.mjs.map → zh-BFZOM3lF.mjs.map} +1 -1
- package/dist/chunks/zh-CiIyOm6U.mjs +2 -0
- package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -0
- package/dist/commands/BlockInsertion.d.ts +5 -3
- package/dist/commands/BlockInsertion.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +13 -2
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/editor/ContentSerializer.d.ts +21 -0
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorConfig.d.ts +17 -0
- package/dist/editor/EditorConfig.d.ts.map +1 -1
- package/dist/editor/EditorConfigController.d.ts +10 -0
- package/dist/editor/EditorConfigController.d.ts.map +1 -1
- package/dist/editor/EditorInitializer.d.ts +4 -0
- package/dist/editor/EditorInitializer.d.ts.map +1 -1
- package/dist/editor/EditorLocale.d.ts +2 -0
- package/dist/editor/EditorLocale.d.ts.map +1 -1
- package/dist/editor/MarkdownMode.d.ts +46 -0
- package/dist/editor/MarkdownMode.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +46 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/locales/ar.d.ts.map +1 -1
- package/dist/editor/locales/de.d.ts.map +1 -1
- package/dist/editor/locales/es.d.ts.map +1 -1
- package/dist/editor/locales/fr.d.ts.map +1 -1
- package/dist/editor/locales/hi.d.ts.map +1 -1
- package/dist/editor/locales/pt.d.ts.map +1 -1
- package/dist/editor/locales/ru.d.ts.map +1 -1
- package/dist/editor/locales/zh.d.ts.map +1 -1
- package/dist/editor/styles/list.d.ts +1 -1
- package/dist/editor/styles/list.d.ts.map +1 -1
- package/dist/editor/styles/table.d.ts +1 -1
- package/dist/editor/styles/table.d.ts.map +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.d.ts +1 -0
- package/dist/html.d.ts.map +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts +2 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +7 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +10 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/MarkdownPasteDetector.d.ts +26 -0
- package/dist/input/MarkdownPasteDetector.d.ts.map +1 -0
- package/dist/input/PasteHTMLHandler.d.ts +18 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +30 -0
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/input/SelectionDocument.d.ts +2 -1
- package/dist/input/SelectionDocument.d.ts.map +1 -1
- package/dist/markdown.d.ts +17 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.mjs +1 -0
- package/dist/model/AttrRegistry.d.ts +2 -2
- package/dist/model/AttrRegistry.d.ts.map +1 -1
- package/dist/model/ContentModel.d.ts +12 -0
- package/dist/model/ContentModel.d.ts.map +1 -1
- package/dist/model/Document.d.ts +28 -3
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +15 -0
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/InlineNodeSpec.d.ts +7 -1
- package/dist/model/InlineNodeSpec.d.ts.map +1 -1
- package/dist/model/InputRule.d.ts +11 -0
- package/dist/model/InputRule.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +7 -1
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/MarkdownSyntaxRegistry.d.ts +51 -0
- package/dist/model/MarkdownSyntaxRegistry.d.ts.map +1 -0
- package/dist/model/NodeSpec.d.ts +47 -1
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/RichBlockData.d.ts +2 -0
- package/dist/model/RichBlockData.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/TableDimensions.d.ts +11 -0
- package/dist/model/TableDimensions.d.ts.map +1 -0
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/platform/EditorEventBoundary.d.ts +12 -0
- package/dist/platform/EditorEventBoundary.d.ts.map +1 -0
- package/dist/plugins/Plugin.d.ts +7 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +2 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +2 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +2 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +2 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/DisplayMathNodeSpec.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaInputRules.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaMarkdownSyntax.d.ts +4 -0
- package/dist/plugins/formula/FormulaMarkdownSyntax.d.ts.map +1 -0
- package/dist/plugins/formula/FormulaPlugin.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaTypes.d.ts +2 -0
- package/dist/plugins/formula/FormulaTypes.d.ts.map +1 -1
- package/dist/plugins/formula/InlineMathNodeSpec.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingPlugin.d.ts +2 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +2 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts +14 -0
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code/InlineCodePlugin.d.ts.map +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/link/LinkPlugin.d.ts +14 -0
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListCommands.d.ts +5 -1
- package/dist/plugins/list/ListCommands.d.ts.map +1 -1
- package/dist/plugins/list/ListInputRules.d.ts.map +1 -1
- package/dist/plugins/list/ListItemContext.d.ts +27 -0
- package/dist/plugins/list/ListItemContext.d.ts.map +1 -0
- package/dist/plugins/list/ListKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +2 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list/ListToolbarItems.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
- package/dist/plugins/print/PrintDestinationBridge.d.ts +23 -0
- package/dist/plugins/print/PrintDestinationBridge.d.ts.map +1 -0
- package/dist/plugins/print/PrintHostStyles.d.ts +50 -0
- package/dist/plugins/print/PrintHostStyles.d.ts.map +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/dist/plugins/print/PrintServiceImpl.d.ts +76 -3
- package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -1
- package/dist/plugins/print/PrintStyleCollector.d.ts +150 -21
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print/StaticHostMarker.d.ts +18 -0
- package/dist/plugins/print/StaticHostMarker.d.ts.map +1 -0
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/MarkInputRule.d.ts +9 -0
- package/dist/plugins/shared/MarkInputRule.d.ts.map +1 -0
- package/dist/plugins/shared/PopupPositioning.d.ts +2 -0
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
- package/dist/plugins/shared/index.d.ts +1 -0
- package/dist/plugins/shared/index.d.ts.map +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +2 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table/TableClipboard.d.ts +8 -0
- package/dist/plugins/table/TableClipboard.d.ts.map +1 -0
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts +11 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableControls.d.ts +6 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts +11 -2
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsLayout.d.ts +12 -3
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -1
- package/dist/plugins/table/TableGrid.d.ts +57 -0
- package/dist/plugins/table/TableGrid.d.ts.map +1 -0
- package/dist/plugins/table/TableHelpers.d.ts +4 -0
- package/dist/plugins/table/TableHelpers.d.ts.map +1 -1
- package/dist/plugins/table/TableLocale.d.ts +30 -0
- package/dist/plugins/table/TableLocale.d.ts.map +1 -1
- package/dist/plugins/table/TableNavigation.d.ts +5 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.d.ts +13 -1
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts +21 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table/TableSelection.d.ts.map +1 -1
- package/dist/plugins/table/TableSizeEditor.d.ts +11 -0
- package/dist/plugins/table/TableSizeEditor.d.ts.map +1 -0
- package/dist/plugins/table/TableSizing.d.ts +70 -0
- package/dist/plugins/table/TableSizing.d.ts.map +1 -0
- package/dist/plugins/table/index.d.ts +3 -1
- package/dist/plugins/table/index.d.ts.map +1 -1
- package/dist/plugins/table/locales/ar.d.ts.map +1 -1
- package/dist/plugins/table/locales/de.d.ts.map +1 -1
- package/dist/plugins/table/locales/es.d.ts.map +1 -1
- package/dist/plugins/table/locales/fr.d.ts.map +1 -1
- package/dist/plugins/table/locales/hi.d.ts.map +1 -1
- package/dist/plugins/table/locales/pt.d.ts.map +1 -1
- package/dist/plugins/table/locales/ru.d.ts.map +1 -1
- package/dist/plugins/table/locales/zh.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-direction-auto.mjs +1 -1
- package/dist/plugins/text-direction.mjs +1 -1
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +9 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video/VideoCommands.d.ts.map +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts +2 -0
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/HTMLSanitization.d.ts +15 -0
- package/dist/serialization/HTMLSanitization.d.ts.map +1 -0
- package/dist/serialization/MarkSerializer.d.ts +12 -0
- package/dist/serialization/MarkSerializer.d.ts.map +1 -1
- package/dist/serialization/MarkdownParser.d.ts +6 -0
- package/dist/serialization/MarkdownParser.d.ts.map +1 -0
- package/dist/serialization/MarkdownSerializer.d.ts +12 -0
- package/dist/serialization/MarkdownSerializer.d.ts.map +1 -0
- package/dist/serialization/MarkdownTypes.d.ts +59 -0
- package/dist/serialization/MarkdownTypes.d.ts.map +1 -0
- package/dist/serialization/TableDimensions.d.ts +37 -0
- package/dist/serialization/TableDimensions.d.ts.map +1 -0
- package/dist/serialization/markdown/BlockSerializers.d.ts +7 -0
- package/dist/serialization/markdown/BlockSerializers.d.ts.map +1 -0
- package/dist/serialization/markdown/BlockTokenizer.d.ts +54 -0
- package/dist/serialization/markdown/BlockTokenizer.d.ts.map +1 -0
- package/dist/serialization/markdown/GfmAutolink.d.ts +20 -0
- package/dist/serialization/markdown/GfmAutolink.d.ts.map +1 -0
- package/dist/serialization/markdown/GfmTableParser.d.ts +26 -0
- package/dist/serialization/markdown/GfmTableParser.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineAst.d.ts +34 -0
- package/dist/serialization/markdown/InlineAst.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineSerializers.d.ts +5 -0
- package/dist/serialization/markdown/InlineSerializers.d.ts.map +1 -0
- package/dist/serialization/markdown/InlineTokenizer.d.ts +5 -0
- package/dist/serialization/markdown/InlineTokenizer.d.ts.map +1 -0
- package/dist/serialization/markdown/LinkReferenceExtractor.d.ts +37 -0
- package/dist/serialization/markdown/LinkReferenceExtractor.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownContext.d.ts +32 -0
- package/dist/serialization/markdown/MarkdownContext.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownEntities.d.ts +33 -0
- package/dist/serialization/markdown/MarkdownEntities.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownEscape.d.ts +33 -0
- package/dist/serialization/markdown/MarkdownEscape.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownHTMLRegistry.d.ts +4 -0
- package/dist/serialization/markdown/MarkdownHTMLRegistry.d.ts.map +1 -0
- package/dist/serialization/markdown/MarkdownParseContext.d.ts +23 -0
- package/dist/serialization/markdown/MarkdownParseContext.d.ts.map +1 -0
- package/dist/state/Mapping.d.ts +33 -10
- package/dist/state/Mapping.d.ts.map +1 -1
- package/dist/state/StepApplication.d.ts +3 -1
- package/dist/state/StepApplication.d.ts.map +1 -1
- package/dist/state/StepHandlers.d.ts.map +1 -1
- package/dist/state/StepInversion.d.ts +2 -1
- package/dist/state/StepInversion.d.ts.map +1 -1
- package/dist/state/StepMapping.d.ts +3 -2
- package/dist/state/StepMapping.d.ts.map +1 -1
- package/dist/state/StepMaps.d.ts +3 -2
- package/dist/state/StepMaps.d.ts.map +1 -1
- package/dist/state/Steps.d.ts +34 -2
- package/dist/state/Steps.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +7 -1
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/style/StyleRuntime.d.ts +7 -0
- package/dist/style/StyleRuntime.d.ts.map +1 -1
- package/dist/test/MarkdownConformanceUtils.d.ts +12 -0
- package/dist/test/MarkdownConformanceUtils.d.ts.map +1 -0
- package/dist/view/BlockRendering.d.ts +5 -0
- package/dist/view/BlockRendering.d.ts.map +1 -1
- package/dist/view/DecorationRendering.d.ts +6 -0
- package/dist/view/DecorationRendering.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +14 -1
- package/dist/chunks/AttrRegistry-DcDVyzLm.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-6rR9tIGP.mjs +0 -2
- package/dist/chunks/BlockInsertion-6rR9tIGP.mjs.map +0 -1
- package/dist/chunks/BlockquotePlugin-4V7KV_Sb.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-DC0-BnNy.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-DC0-BnNy.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-C_74bqid.mjs +0 -2
- package/dist/chunks/Commands-BIIpx_Zd.mjs +0 -2
- package/dist/chunks/Commands-BIIpx_Zd.mjs.map +0 -1
- package/dist/chunks/Decoration-ZeyVfwJB.mjs +0 -2
- package/dist/chunks/Decoration-ZeyVfwJB.mjs.map +0 -1
- package/dist/chunks/Document-r7vLOAGA.mjs +0 -2
- package/dist/chunks/Document-r7vLOAGA.mjs.map +0 -1
- package/dist/chunks/DocumentParser-CcTSeT1B.mjs +0 -2
- package/dist/chunks/DocumentParser-CcTSeT1B.mjs.map +0 -1
- package/dist/chunks/FontPlugin-DB1_bgam.mjs +0 -2
- package/dist/chunks/FontSizePlugin-DFvp7Ki9.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-BLEcyazj.mjs +0 -2
- package/dist/chunks/FormulaPlugin-BLEcyazj.mjs.map +0 -1
- package/dist/chunks/GapCursorNavigation-ycNzuQVH.mjs +0 -2
- package/dist/chunks/HTMLUtils-C6B4UT00.mjs +0 -2
- package/dist/chunks/HTMLUtils-C6B4UT00.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-D9yvG2Aw.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-0FjHPZuA.mjs +0 -2
- package/dist/chunks/HorizontalRulePlugin-0FjHPZuA.mjs.map +0 -1
- package/dist/chunks/ImagePlugin-Cp_RINtc.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-DMr4O7c7.mjs.map +0 -1
- package/dist/chunks/InlineStyleMarkSpec-4R6DC7ij.mjs +0 -2
- package/dist/chunks/LinkPlugin-DvZ3MPgL.mjs +0 -2
- package/dist/chunks/LinkPlugin-DvZ3MPgL.mjs.map +0 -1
- package/dist/chunks/ListPlugin-CVId2dE0.mjs +0 -2
- package/dist/chunks/ListPlugin-CVId2dE0.mjs.map +0 -1
- package/dist/chunks/NodeSelectionCommands-Dj4VxLdD.mjs +0 -2
- package/dist/chunks/PluginHelpers-KDuTlmXm.mjs +0 -2
- package/dist/chunks/PopupPositioning-DtUrY9bh.mjs +0 -2
- package/dist/chunks/PrintPlugin-C6gOJT6d.mjs +0 -2
- package/dist/chunks/PrintPlugin-C6gOJT6d.mjs.map +0 -1
- package/dist/chunks/PrintTypes-WdtgSj74.mjs.map +0 -1
- package/dist/chunks/StrikethroughPlugin-BLKDRWtf.mjs +0 -2
- package/dist/chunks/StrikethroughPlugin-BLKDRWtf.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-BAutwDZT.mjs +0 -2
- package/dist/chunks/StyleRuntime-BAutwDZT.mjs.map +0 -1
- package/dist/chunks/TablePlugin-D93RR5xH.mjs +0 -2
- package/dist/chunks/TablePlugin-D93RR5xH.mjs.map +0 -1
- package/dist/chunks/TextColorPlugin-C1qpzEOa.mjs +0 -2
- package/dist/chunks/TextDirectionAutoPlugin-CzWJjrvG.mjs +0 -2
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-Cubp3e7f.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-Cubp3e7f.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-D9rQZol6.mjs +0 -2
- package/dist/chunks/VideoPlugin-D9rQZol6.mjs.map +0 -1
- package/dist/chunks/WordBoundary-DxeMBRyP.mjs +0 -2
- package/dist/chunks/ar-BTShmP2E.mjs +0 -2
- package/dist/chunks/ar-jbplYWkC.mjs +0 -2
- package/dist/chunks/ar-jbplYWkC.mjs.map +0 -1
- package/dist/chunks/de-DN-e6G5A.mjs +0 -2
- package/dist/chunks/de-DN-e6G5A.mjs.map +0 -1
- package/dist/chunks/es-CM55WeEN.mjs +0 -2
- package/dist/chunks/es-CM55WeEN.mjs.map +0 -1
- package/dist/chunks/fr-C_2i5Ono.mjs +0 -2
- package/dist/chunks/fr-C_2i5Ono.mjs.map +0 -1
- package/dist/chunks/full-Cah3qjCT.mjs +0 -2
- package/dist/chunks/hi-C9fvG91d.mjs +0 -2
- package/dist/chunks/hi-C9fvG91d.mjs.map +0 -1
- package/dist/chunks/minimal-DqATlnAL.mjs +0 -2
- package/dist/chunks/pt-GqLw5tN0.mjs +0 -2
- package/dist/chunks/pt-GqLw5tN0.mjs.map +0 -1
- package/dist/chunks/ru-4g_qsaLr.mjs +0 -2
- package/dist/chunks/ru-4g_qsaLr.mjs.map +0 -1
- package/dist/chunks/src-YY6n2SmV.mjs +0 -2
- package/dist/chunks/src-YY6n2SmV.mjs.map +0 -1
- package/dist/chunks/zh-BjoyjClN.mjs +0 -2
- package/dist/chunks/zh-DeZP08HI.mjs +0 -2
- package/dist/chunks/zh-DeZP08HI.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Commands-1dFFldi7.mjs","names":[],"sources":["../../src/model/Schema.ts","../../src/commands/GapCursorCommands.ts","../../src/commands/SelectionDeletion.ts","../../src/commands/MarkCommands.ts","../../src/commands/DeleteCommands.ts","../../src/commands/Commands.ts"],"sourcesContent":["/**\n * Schema definition for the Notectl editor.\n * Defines which node types and marks are allowed.\n */\n\nimport type { InlineNodeSpec } from './InlineNodeSpec.js';\nimport type { MarkSpec } from './MarkSpec.js';\nimport type { NodeSpec } from './NodeSpec.js';\nimport type { SchemaRegistry } from './SchemaRegistry.js';\n\nexport interface Schema {\n\treadonly nodeTypes: readonly string[];\n\treadonly markTypes: readonly string[];\n\t/** Looks up the full NodeSpec for a given type. Available when created via schemaFromRegistry. */\n\treadonly getNodeSpec?: (type: string) => NodeSpec | undefined;\n\t/** Looks up the full InlineNodeSpec for a given type. Available via schemaFromRegistry. */\n\treadonly getInlineNodeSpec?: (type: string) => InlineNodeSpec | undefined;\n\t/** Looks up the full MarkSpec for a given type. Available via schemaFromRegistry. */\n\treadonly getMarkSpec?: (type: string) => MarkSpec | undefined;\n}\n\n/** Creates the default schema with paragraph nodes and bold/italic/underline marks. */\nexport function defaultSchema(): Schema {\n\treturn {\n\t\tnodeTypes: ['paragraph'],\n\t\tmarkTypes: ['bold', 'italic', 'underline'],\n\t\tgetNodeSpec: () => undefined,\n\t};\n}\n\n/** Derives a Schema from a SchemaRegistry's registered specs. */\nexport function schemaFromRegistry(registry: SchemaRegistry): Schema {\n\treturn {\n\t\tnodeTypes: registry.getNodeTypes(),\n\t\tmarkTypes: registry.getMarkTypes(),\n\t\tgetNodeSpec: (type: string) => registry.getNodeSpec(type),\n\t\tgetInlineNodeSpec: (type: string) => registry.getInlineNodeSpec(type),\n\t\tgetMarkSpec: (type: string) => registry.getMarkSpec(type),\n\t};\n}\n\n/** Checks whether the given mark type is allowed by the schema. */\nexport function isMarkAllowed(schema: Schema, markType: string): boolean {\n\treturn schema.markTypes.includes(markType);\n}\n\n/** Checks whether the given node type is allowed by the schema. */\nexport function isNodeTypeAllowed(schema: Schema, nodeType: string): boolean {\n\treturn schema.nodeTypes.includes(nodeType);\n}\n","/**\n * Commands for GapCursor: deleting void blocks adjacent to gap cursors\n * and inserting paragraphs at gap positions.\n */\n\nimport { createEmptyParagraph, generateBlockId, getBlockLength } from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { GapCursorSelection, NodeSelection } from '../model/Selection.js';\nimport { createCollapsedSelection, createNodeSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { resolveSiblingContext } from './CommandHelpers.js';\nimport { deleteNodeSelection } from './NodeSelectionCommands.js';\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Backspace.\n *\n * - `side === 'after'` → void block is behind the cursor → delete it.\n * - `side === 'before'` → void block is ahead → navigate backward (to previous block).\n * - At document start with `side === 'before'` → `null` (no-op).\n */\nexport function deleteBackwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'after') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'before': navigate to previous block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx <= 0) return null;\n\n\tconst prevId: BlockId | undefined = blockOrder[blockIdx - 1];\n\tif (!prevId) return null;\n\n\tif (isVoidBlock(state, prevId)) {\n\t\tconst path = findNodePath(state.doc, prevId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(prevId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\tconst prevLen: number = getBlockLength(prevBlock);\n\treturn state.transaction('input').setSelection(createCollapsedSelection(prevId, prevLen)).build();\n}\n\n/**\n * Deletes the void block adjacent to a GapCursor when pressing Delete.\n *\n * - `side === 'before'` → void block is ahead of the cursor → delete it.\n * - `side === 'after'` → void block is behind → navigate forward (to next block).\n * - At document end with `side === 'after'` → `null` (no-op).\n */\nexport function deleteForwardAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tif (sel.side === 'before') {\n\t\treturn deleteVoidAtGap(state, sel);\n\t}\n\n\t// side === 'after': navigate to next block\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\n\tif (blockIdx >= blockOrder.length - 1) return null;\n\n\tconst nextId: BlockId | undefined = blockOrder[blockIdx + 1];\n\tif (!nextId) return null;\n\n\tif (isVoidBlock(state, nextId)) {\n\t\tconst path = findNodePath(state.doc, nextId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(nextId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\treturn state.transaction('input').setSelection(createCollapsedSelection(nextId, 0)).build();\n}\n\n/** Deletes the void block that the GapCursor is adjacent to, delegating to deleteNodeSelection. */\nfunction deleteVoidAtGap(state: EditorState, sel: GapCursorSelection): Transaction | null {\n\tconst path = (findNodePath(state.doc, sel.blockId) ?? []) as BlockId[];\n\tconst nodeSel: NodeSelection = createNodeSelection(sel.blockId, path);\n\treturn deleteNodeSelection(state, nodeSel);\n}\n\n/** Inserts a new paragraph at a GapCursor position (before or after the void block). */\nexport function insertParagraphAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n): Transaction | null {\n\tconst { parentPath, index } = resolveSiblingContext(state, sel.blockId);\n\tif (index < 0) return null;\n\n\tconst insertIdx: number = sel.side === 'before' ? index : index + 1;\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\treturn builder.build();\n}\n\n/** Inserts text in a new paragraph at a GapCursor position. */\nexport function insertTextAtGap(\n\tstate: EditorState,\n\tsel: GapCursorSelection,\n\ttext: string,\n\torigin: 'input' | 'paste',\n): Transaction {\n\tconst { parentPath, siblings, index } = resolveSiblingContext(state, sel.blockId);\n\tconst insertIdx: number =\n\t\tsel.side === 'before' ? Math.max(index, 0) : index >= 0 ? index + 1 : siblings.length;\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction(origin);\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.insertText(newId, 0, text, []);\n\tbuilder.setSelection(createCollapsedSelection(newId, text.length));\n\treturn builder.build();\n}\n","/**\n * Range-deletion helpers for multi-block text selections, split out of\n * Commands.ts. Handles two cases: a selection whose blocks share one root\n * ancestor (leaf range) and a selection spanning different root ancestors\n * (cross-root range).\n */\n\nimport type { BlockNode } from '../model/Document.js';\nimport {\n\tcreateEmptyParagraph,\n\tgenerateBlockId,\n\tgetBlockChildren,\n\tgetBlockLength,\n\tisLeafBlock,\n} from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\n\n/**\n * Root container types whose children are free-flowing blocks and may be\n * removed individually when trimming a partially-selected root. Structured\n * containers (a `table`, whose rows must keep equal cell counts) are excluded:\n * trimming their children would leave a schema-invalid shape, so a\n * partially-selected one is removed wholesale instead — valid, if blunt, and\n * the behavior these containers already had before trimming existed.\n */\nconst FLAT_BLOCK_CONTAINERS: ReadonlySet<string> = new Set(['blockquote', 'list_item']);\n\n/** A normalized text-selection range (document-order from/to positions). */\nexport interface DeletionRange {\n\treadonly from: { readonly blockId: BlockId; readonly offset: number };\n\treadonly to: { readonly blockId: BlockId; readonly offset: number };\n}\n\n/** Returns the root-level ancestor index in `doc.children` for a given block. */\nexport function getRootBlockIndex(state: EditorState, blockId: BlockId): number {\n\tconst path = findNodePath(state.doc, blockId);\n\tif (!path || path.length === 0) return -1;\n\tconst rootId: string = path[0] as string;\n\treturn state.doc.children.findIndex((c) => c.id === rootId);\n}\n\n/** Deletes a multi-block selection where all blocks share the same root ancestor. */\nexport function deleteLeafRange(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tblockOrder: readonly BlockId[],\n\trange: DeletionRange,\n\tfromIdx: number,\n\ttoIdx: number,\n): void {\n\tconst firstBlock = state.getBlock(range.from.blockId);\n\tif (!firstBlock) return;\n\tconst firstLen = getBlockLength(firstBlock);\n\n\tif (range.from.offset < firstLen) {\n\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, firstLen);\n\t}\n\n\tif (range.to.offset > 0) {\n\t\tbuilder.deleteTextAt(range.to.blockId, 0, range.to.offset);\n\t}\n\n\tfor (let i = fromIdx + 1; i < toIdx; i++) {\n\t\tconst midBlockId = blockOrder[i];\n\t\tif (!midBlockId) continue;\n\t\tconst midBlock = state.getBlock(midBlockId);\n\t\tif (!midBlock) continue;\n\t\tconst midLen = getBlockLength(midBlock);\n\t\tif (midLen > 0) {\n\t\t\tbuilder.deleteTextAt(midBlockId, 0, midLen);\n\t\t}\n\t\tbuilder.mergeBlocksAt(range.from.blockId, midBlockId);\n\t}\n\n\tbuilder.mergeBlocksAt(range.from.blockId, range.to.blockId);\n}\n\n/**\n * Deletes a selection spanning different root-level ancestors.\n *\n * The selected span is deleted while every unselected leaf survives. A\n * composite/container root (a multi-block `list_item`, a `blockquote`, a\n * `table`) whose boundary sits *inside* it is trimmed, not wiped: the from-root\n * keeps everything before `range.from`, the to-root keeps everything after\n * `range.to`. A container is removed wholesale only when the boundary lands at\n * its very edge (offset 0 of its first leaf, or the end of its last leaf), so\n * the whole container is genuinely inside the selection. Root blocks strictly\n * between the endpoints are always removed.\n *\n * Returns a replacement cursor block ID when the from-root was removed wholesale\n * (its cursor block went with it); undefined otherwise, since the from boundary\n * leaf then survives and hosts the caret.\n */\nexport function deleteCrossRootRange(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\trange: DeletionRange,\n\tfromRootIdx: number,\n\ttoRootIdx: number,\n): BlockId | undefined {\n\tconst fromRoot = state.doc.children[fromRootIdx];\n\tconst toRoot = state.doc.children[toRootIdx];\n\tif (!fromRoot || !toRoot) return undefined;\n\n\tconst toLeaf = state.getBlock(range.to.blockId);\n\tif (!toLeaf) return undefined;\n\n\tconst fromIsLeaf: boolean = isLeafBlock(fromRoot);\n\tconst toIsLeaf: boolean = isLeafBlock(toRoot);\n\n\t// A composite root is removed wholesale (rather than trimmed) when it is not\n\t// a flat block container, or when the boundary sits at its very edge and so\n\t// covers the whole container: the from-root's edge is offset 0 of its first\n\t// leaf, the to-root's is the end of its last leaf.\n\tconst fromAtStart: boolean =\n\t\trange.from.offset === 0 && firstLeafId(fromRoot) === range.from.blockId;\n\tconst toAtEnd: boolean =\n\t\trange.to.offset === getBlockLength(toLeaf) && lastLeafId(toRoot) === range.to.blockId;\n\tconst fromWholesale: boolean =\n\t\t!fromIsLeaf && (!FLAT_BLOCK_CONTAINERS.has(fromRoot.type) || fromAtStart);\n\tconst toWholesale: boolean = !toIsLeaf && (!FLAT_BLOCK_CONTAINERS.has(toRoot.type) || toAtEnd);\n\n\t// --- from side: keep everything before range.from within the from-root ---\n\tif (fromIsLeaf) {\n\t\tconst fromLen: number = getBlockLength(fromRoot);\n\t\tif (range.from.offset < fromLen) {\n\t\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, fromLen);\n\t\t}\n\t} else if (!fromWholesale) {\n\t\ttrimContainerTail(\n\t\t\tbuilder,\n\t\t\t[fromRoot.id],\n\t\t\tfromRoot,\n\t\t\tfindNodePath(state.doc, range.from.blockId) ?? [],\n\t\t\trange.from.blockId,\n\t\t\trange.from.offset,\n\t\t);\n\t}\n\n\t// --- to side: keep everything after range.to within the to-root ---\n\tif (toIsLeaf) {\n\t\tif (range.to.offset > 0) builder.deleteTextAt(range.to.blockId, 0, range.to.offset);\n\t} else if (!toWholesale) {\n\t\ttrimContainerHead(\n\t\t\tbuilder,\n\t\t\t[toRoot.id],\n\t\t\ttoRoot,\n\t\t\tfindNodePath(state.doc, range.to.blockId) ?? [],\n\t\t\trange.to.blockId,\n\t\t\trange.to.offset,\n\t\t);\n\t}\n\n\t// --- root-level removals: middle roots always, endpoints only when wholesale ---\n\t// A wholesale-removed from-root takes its cursor block with it, so a landing\n\t// paragraph is inserted to host the caret and any follow-up insert.\n\tlet landingId: BlockId | undefined;\n\tlet shift = 0;\n\tif (fromWholesale) {\n\t\tlandingId = generateBlockId();\n\t\tbuilder.insertNode([], fromRootIdx, createEmptyParagraph(landingId));\n\t\tshift = 1;\n\t}\n\n\tconst removeIdxs: number[] = [];\n\tif (fromWholesale) removeIdxs.push(fromRootIdx);\n\tfor (let i = fromRootIdx + 1; i < toRootIdx; i++) removeIdxs.push(i);\n\tif (toWholesale) removeIdxs.push(toRootIdx);\n\t// Descending so each positional removal stays valid against the evolving doc.\n\tfor (let k = removeIdxs.length - 1; k >= 0; k--) {\n\t\tbuilder.removeNode([], (removeIdxs[k] as number) + shift);\n\t}\n\n\t// Join the boundary only when both roots are leaves: their inline content\n\t// merges into one block (the \"outta\" behavior). Merging across a composite\n\t// boundary is deliberately skipped — trimming already preserved every\n\t// unselected leaf, and there is no single valid block to merge into.\n\tif (fromIsLeaf && toIsLeaf) {\n\t\tbuilder.mergeBlocksAt(range.from.blockId, range.to.blockId);\n\t}\n\n\treturn landingId;\n}\n\n/** The id of a block's first leaf descendant (itself when already a leaf). */\nfunction firstLeafId(block: BlockNode): BlockId {\n\tif (isLeafBlock(block)) return block.id;\n\tconst first: BlockNode | undefined = getBlockChildren(block)[0];\n\treturn first ? firstLeafId(first) : block.id;\n}\n\n/** The id of a block's last leaf descendant (itself when already a leaf). */\nfunction lastLeafId(block: BlockNode): BlockId {\n\tif (isLeafBlock(block)) return block.id;\n\tconst children: readonly BlockNode[] = getBlockChildren(block);\n\tconst last: BlockNode | undefined = children[children.length - 1];\n\treturn last ? lastLeafId(last) : block.id;\n}\n\n/**\n * Trims a container to keep only content up to `(leafId, leafOffset)`, removing\n * every child after the boundary at each level and the boundary leaf's tail\n * text. `containerPath` is the path to (and including) `container`; `leafPath`\n * is the boundary leaf's full node path, used to descend to the boundary child.\n */\nfunction trimContainerTail(\n\tbuilder: TransactionBuilder,\n\tcontainerPath: readonly BlockId[],\n\tcontainer: BlockNode,\n\tleafPath: readonly string[],\n\tleafId: BlockId,\n\tleafOffset: number,\n): void {\n\tconst children: readonly BlockNode[] = getBlockChildren(container);\n\tconst pos: number = leafPath.indexOf(container.id);\n\tconst targetChildId: string | undefined = pos >= 0 ? leafPath[pos + 1] : undefined;\n\tconst boundaryIdx: number = children.findIndex((c) => c.id === targetChildId);\n\tif (boundaryIdx < 0) return;\n\n\tfor (let i = children.length - 1; i > boundaryIdx; i--) {\n\t\tbuilder.removeNode(containerPath, i);\n\t}\n\n\tconst boundaryChild: BlockNode = children[boundaryIdx] as BlockNode;\n\tif (boundaryChild.id === leafId) {\n\t\tconst len: number = getBlockLength(boundaryChild);\n\t\tif (leafOffset < len) builder.deleteTextAt(leafId, leafOffset, len);\n\t\treturn;\n\t}\n\ttrimContainerTail(\n\t\tbuilder,\n\t\t[...containerPath, boundaryChild.id],\n\t\tboundaryChild,\n\t\tleafPath,\n\t\tleafId,\n\t\tleafOffset,\n\t);\n}\n\n/**\n * Trims a container to keep only content from `(leafId, leafOffset)` onward,\n * removing every child before the boundary at each level and the boundary\n * leaf's head text. Mirrors {@link trimContainerTail}.\n */\nfunction trimContainerHead(\n\tbuilder: TransactionBuilder,\n\tcontainerPath: readonly BlockId[],\n\tcontainer: BlockNode,\n\tleafPath: readonly string[],\n\tleafId: BlockId,\n\tleafOffset: number,\n): void {\n\tconst children: readonly BlockNode[] = getBlockChildren(container);\n\tconst pos: number = leafPath.indexOf(container.id);\n\tconst targetChildId: string | undefined = pos >= 0 ? leafPath[pos + 1] : undefined;\n\tconst boundaryIdx: number = children.findIndex((c) => c.id === targetChildId);\n\tif (boundaryIdx < 0) return;\n\n\t// Descending so each removal stays valid; the boundary keeps its identity.\n\tfor (let i = boundaryIdx - 1; i >= 0; i--) {\n\t\tbuilder.removeNode(containerPath, i);\n\t}\n\n\tconst boundaryChild: BlockNode = children[boundaryIdx] as BlockNode;\n\tif (boundaryChild.id === leafId) {\n\t\tif (leafOffset > 0) builder.deleteTextAt(leafId, 0, leafOffset);\n\t\treturn;\n\t}\n\ttrimContainerHead(\n\t\tbuilder,\n\t\t[...containerPath, boundaryChild.id],\n\t\tboundaryChild,\n\t\tleafPath,\n\t\tleafId,\n\t\tleafOffset,\n\t);\n}\n","/**\n * Mark-related commands: toggling bold/italic/underline and checking\n * whether a mark is active.\n */\n\nimport {\n\ttype BlockNode,\n\ttype Mark,\n\tgetBlockLength,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport { isMarkAllowed } from '../model/Schema.js';\nimport { isCollapsed, isTextSelection, selectionRange } from '../model/Selection.js';\nimport type { MarkTypeName } from '../model/TypeBrands.js';\nimport { markType as mkType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { resolveCursorMarks } from './CursorMarks.js';\nimport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Feature Configuration ---\n\nexport interface FeatureConfig {\n\treadonly bold: boolean;\n\treadonly italic: boolean;\n\treadonly underline: boolean;\n}\n\nconst defaultFeatures: FeatureConfig = { bold: true, italic: true, underline: true };\n\n/**\n * Toggles a mark on the current selection.\n * If collapsed, toggles stored marks. If range, applies/removes from text.\n */\nexport function toggleMark(\n\tstate: EditorState,\n\tmarkType: MarkTypeName,\n\tfeatures: FeatureConfig = defaultFeatures,\n): Transaction | null {\n\tif (isFeatureGated(markType, features)) return null;\n\tif (!isMarkAllowed(state.schema, markType)) return null;\n\tif (!isTextSelection(state.selection)) return null;\n\n\tconst mark: Mark = { type: markType };\n\tconst sel = state.selection;\n\n\tif (isCollapsed(sel)) {\n\t\t// Toggle stored marks\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks = resolveCursorMarks(state);\n\t\tconst hasIt = hasMark(currentMarks, markType);\n\t\tconst newMarks = hasIt\n\t\t\t? currentMarks.filter((m) => m.type !== markType)\n\t\t\t: [...currentMarks, mark];\n\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\t// Range selection — apply/remove mark to all blocks in range\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\t// Determine if we should add or remove\n\tconst shouldRemove = isMarkActiveInRange(state, markType);\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tif (shouldRemove) {\n\t\t\tbuilder.removeMark(blockId, from, to, mark);\n\t\t} else {\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t}\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\nexport function toggleBold(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('bold'), features);\n}\n\nexport function toggleItalic(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('italic'), features);\n}\n\nexport function toggleUnderline(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('underline'), features);\n}\n\n/** Checks if a mark is active at the current selection. */\nexport function isMarkActive(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\treturn hasMark(resolveCursorMarks(state), markType);\n\t}\n\n\treturn isMarkActiveInRange(state, markType);\n}\n\n/** Per-slice result of scanning a block for a mark. */\ntype SliceMarkStatus = 'present' | 'missing' | 'empty';\n\n/** Checks if a mark is active across the entire selection range. */\nfunction isMarkActiveInRange(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tlet sawMarkedText = false;\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst blockLen = getBlockLength(block);\n\t\tconst from = i === fromIdx ? range.from.offset : 0;\n\t\tconst to = i === toIdx ? range.to.offset : blockLen;\n\n\t\tconst status = markStatusInBlock(block, from, to, markType);\n\t\tif (status === 'missing') return false;\n\t\tif (status === 'present') sawMarkedText = true;\n\t}\n\n\t// Active only when the range actually contains text that carries the mark.\n\t// A range with no markable text (only empty blocks, or a void block such as a\n\t// lone display formula on Ctrl+A) is NOT active — returning true there would\n\t// light up every toolbar format button.\n\treturn sawMarkedText;\n}\n\n/**\n * Scans a block's `[from, to)` slice for `markType`. Returns:\n * - `missing` when some text character in the slice lacks the mark,\n * - `present` when the slice has text and all of it carries the mark,\n * - `empty` when the slice has no markable text (empty slice or only InlineNodes).\n *\n * An `empty` slice is neutral: it neither activates nor inverts the range check,\n * so an empty paragraph in the middle of a multi-block selection does not flip\n * the result (regression #130).\n */\nfunction markStatusInBlock(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tmarkType: MarkTypeName,\n): SliceMarkStatus {\n\tlet pos = 0;\n\tlet sawText = false;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst childEnd = pos + child.text.length;\n\t\t\tif (childEnd > from && pos < to) {\n\t\t\t\tsawText = true;\n\t\t\t\tif (!hasMark(child.marks, markType)) return 'missing';\n\t\t\t}\n\t\t\tpos = childEnd;\n\t\t} else {\n\t\t\t// InlineNode: atomic, width 1, carries no marks.\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn sawText ? 'present' : 'empty';\n}\n\nfunction isFeatureGated(type: MarkTypeName, features: FeatureConfig): boolean {\n\tconst key = type as string;\n\tif (key === 'bold') return !features.bold;\n\tif (key === 'italic') return !features.italic;\n\tif (key === 'underline') return !features.underline;\n\treturn false;\n}\n","/**\n * Delete commands: character, word, and soft-line deletion in both directions.\n */\n\nimport {\n\ttype BlockNode,\n\tblockOffsetToTextOffset,\n\tgetBlockLength,\n\tgetBlockText,\n\tgetContentAtOffset,\n} from '../model/Document.js';\nimport { nextGraphemeSize, prevGraphemeSize } from '../model/GraphemeUtils.js';\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../model/Selection.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { deleteSelectionCommand, mergeBlockBackward, mergeBlockForward } from './Commands.js';\nimport { deleteNodeSelection } from './NodeSelectionCommands.js';\nimport { findWordBoundaryBackward, findWordBoundaryForward } from './WordBoundary.js';\n\ninterface DeleteConfig {\n\treadonly merge: (state: EditorState) => Transaction | null;\n\treadonly range: (block: BlockNode, offset: number) => readonly [number, number] | null;\n}\n\nfunction deleteInDirection(state: EditorState, config: DeleteConfig): Transaction | null {\n\tconst sel = state.selection;\n\n\tif (isNodeSelection(sel)) return deleteNodeSelection(state, sel);\n\tif (isGapCursor(sel)) return null;\n\tif (!isCollapsed(sel)) return deleteSelectionCommand(state);\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\n\tconst range = config.range(block, sel.anchor.offset);\n\tif (!range) return config.merge(state);\n\n\tconst [from, to] = range;\n\treturn state\n\t\t.transaction('input')\n\t\t.deleteTextAt(block.id, from, to)\n\t\t.setSelection(createCollapsedSelection(block.id, from))\n\t\t.build();\n}\n\n/** Handles backspace key. */\nexport function deleteBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (block, offset) => {\n\t\t\tif (offset <= 0) return null;\n\t\t\tconst content = getContentAtOffset(block, offset - 1);\n\t\t\tif (content?.kind === 'inline') return [offset - 1, offset];\n\t\t\tconst text: string = getBlockText(block);\n\t\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\t\tconst step: number = prevGraphemeSize(text, textOffset) || 1;\n\t\t\treturn [offset - step, offset];\n\t\t},\n\t});\n}\n\n/** Handles delete key. */\nexport function deleteForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len: number = getBlockLength(block);\n\t\t\tif (offset >= len) return null;\n\t\t\tconst content = getContentAtOffset(block, offset);\n\t\t\tif (content?.kind === 'inline') return [offset, offset + 1];\n\t\t\tconst text: string = getBlockText(block);\n\t\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\t\tconst step: number = nextGraphemeSize(text, textOffset) || 1;\n\t\t\treturn [offset, offset + step];\n\t\t},\n\t});\n}\n\n/** Handles Ctrl+Backspace: delete word backward. */\nexport function deleteWordBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (block, offset) =>\n\t\t\toffset > 0 ? [findWordBoundaryBackward(block, offset), offset] : null,\n\t});\n}\n\n/** Handles Ctrl+Delete: delete word forward. */\nexport function deleteWordForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len = getBlockLength(block);\n\t\t\treturn offset < len ? [offset, findWordBoundaryForward(block, offset)] : null;\n\t\t},\n\t});\n}\n\n/** Handles Cmd+Backspace: delete to start of line/block. */\nexport function deleteSoftLineBackward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockBackward,\n\t\trange: (_block, offset) => (offset > 0 ? [0, offset] : null),\n\t});\n}\n\n/** Handles Cmd+Delete: delete to end of line/block. */\nexport function deleteSoftLineForward(state: EditorState): Transaction | null {\n\treturn deleteInDirection(state, {\n\t\tmerge: mergeBlockForward,\n\t\trange: (block, offset) => {\n\t\t\tconst len = getBlockLength(block);\n\t\t\treturn offset < len ? [offset, len] : null;\n\t\t},\n\t});\n}\n","/**\n * Core editor commands and barrel re-exports from submodules.\n *\n * This module contains text insertion, block splitting, block merging,\n * selection deletion, and select-all. Mark, delete, gap-cursor, node-selection,\n * and word-boundary commands are re-exported from their respective modules.\n */\n\nimport {\n\ttype Mark,\n\tcreateEmptyParagraph,\n\tcreateInlineNode,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tgetBlockMarksAtOffset,\n\tgetCursorMarks,\n} from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tcreateSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n\tisTextSelection,\n\tselectionRange,\n} from '../model/Selection.js';\nimport { type BlockId, inlineType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport {\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../state/NavigationQueries.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\nimport { resolveInsertPoint } from './CommandHelpers.js';\nimport { isMarkInclusive } from './CursorMarks.js';\nimport { insertParagraphAtGap, insertTextAtGap } from './GapCursorCommands.js';\nimport {\n\tdeleteNodeSelection,\n\tfindFirstLeafBlockId,\n\tfindLastLeafBlockId,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n} from './NodeSelectionCommands.js';\nimport { deleteCrossRootRange, deleteLeafRange, getRootBlockIndex } from './SelectionDeletion.js';\n\n// --- Re-exports from submodules ---\n\nexport {\n\tcanCrossBlockBoundary,\n\tisInsideIsolating,\n\tisIsolatingBlock,\n\tisVoidBlock,\n\tsharesParent,\n} from '../state/NavigationQueries.js';\n\nexport type { FeatureConfig } from './MarkCommands.js';\nexport {\n\tisMarkActive,\n\ttoggleBold,\n\ttoggleItalic,\n\ttoggleMark,\n\ttoggleUnderline,\n} from './MarkCommands.js';\n\nexport {\n\tdeleteBackward,\n\tdeleteForward,\n\tdeleteSoftLineBackward,\n\tdeleteSoftLineForward,\n\tdeleteWordBackward,\n\tdeleteWordForward,\n} from './DeleteCommands.js';\n\nexport {\n\tdeleteNodeSelection,\n\tfindFirstLeafBlockId,\n\tfindLastLeafBlockId,\n\tinsertParagraphAfterNodeSelection,\n\tinsertTextAfterNodeSelection,\n\tnavigateArrowIntoVoid,\n} from './NodeSelectionCommands.js';\n\nexport {\n\tdeleteBackwardAtGap,\n\tdeleteForwardAtGap,\n\tinsertParagraphAtGap,\n\tinsertTextAtGap,\n} from './GapCursorCommands.js';\n\nexport {\n\tfindWordBoundaryBackward,\n\tfindWordBoundaryForward,\n} from './WordBoundary.js';\n\nexport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from './AttributedMarkCommands.js';\n\nexport { forEachBlockIdInRange, forEachBlockInRange } from './RangeIterator.js';\n\n// --- Text Commands ---\n\n/** Inserts text at the current selection, replacing any selected range. */\nexport function insertTextCommand(\n\tstate: EditorState,\n\ttext: string,\n\torigin: 'input' | 'paste' = 'input',\n): Transaction {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert paragraph after void block with the text\n\tif (isNodeSelection(sel)) {\n\t\treturn insertTextAfterNodeSelection(state, sel, text, origin);\n\t}\n\n\t// GapCursor: insert paragraph at the gap position with the text\n\tif (isGapCursor(sel)) {\n\t\treturn insertTextAtGap(state, sel, text, origin);\n\t}\n\n\tconst builder = state.transaction(origin);\n\tconst marks = resolveActiveMarks(state);\n\n\tlet landingId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tlandingId = addDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst resolved = resolveInsertPoint(sel, state.getBlockOrder());\n\tconst insertBlockId: BlockId = landingId ?? resolved.blockId;\n\tconst insertOffset: number = landingId ? 0 : resolved.offset;\n\n\tbuilder.insertText(insertBlockId, insertOffset, text, marks);\n\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + text.length));\n\n\treturn builder.build();\n}\n\n/** Deletes the current selection. */\nexport function deleteSelectionCommand(state: EditorState): Transaction | null {\n\tif (isNodeSelection(state.selection)) {\n\t\treturn deleteNodeSelection(state, state.selection);\n\t}\n\tif (isGapCursor(state.selection)) return null;\n\tif (isCollapsed(state.selection)) return null;\n\n\t// Deleting a selection that spans the whole document resets it to the\n\t// canonical empty state (a single empty paragraph). Without this, the range\n\t// merge keeps the first block's type and attributes, leaving e.g. an empty\n\t// centered title behind so the placeholder never returns.\n\tif (selectionCoversDocument(state)) {\n\t\treturn clearDocument(state);\n\t}\n\n\tconst builder = state.transaction('input');\n\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\n\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\tconst cursorBlockId: BlockId = landingId ?? range.from.blockId;\n\tconst cursorOffset: number = landingId ? 0 : range.from.offset;\n\tbuilder.setSelection(createCollapsedSelection(cursorBlockId, cursorOffset));\n\n\treturn builder.build();\n}\n\n/** Splits the current block at the cursor position (Enter key). */\nexport function splitBlockCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\t// NodeSelection: insert empty paragraph after the void block\n\tif (isNodeSelection(sel)) {\n\t\treturn insertParagraphAfterNodeSelection(state, sel);\n\t}\n\n\t// GapCursor: insert empty paragraph at the gap position\n\tif (isGapCursor(sel)) {\n\t\treturn insertParagraphAtGap(state, sel);\n\t}\n\n\tconst builder = state.transaction('input');\n\n\tlet landingId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tlandingId = addDeleteSelectionSteps(state, builder);\n\t}\n\n\tconst resolved = resolveInsertPoint(sel, state.getBlockOrder());\n\tconst blockId: BlockId = landingId ?? resolved.blockId;\n\tconst offset: number = landingId ? 0 : resolved.offset;\n\tconst newBlockId = generateBlockId();\n\n\t// splitBlock operates at the same level in the tree — the StepApplication\n\t// handles this correctly because it looks up the block by ID recursively.\n\tbuilder.splitBlock(blockId, offset, newBlockId);\n\tbuilder.setSelection(createCollapsedSelection(newBlockId, 0));\n\n\treturn builder.build();\n}\n\n/** Inserts a hard line break (InlineNode) at the current cursor position. */\nexport function insertHardBreakCommand(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\n\tif (!isTextSelection(sel)) return null;\n\n\tconst builder = state.transaction('input');\n\n\tlet cursorBlockId: BlockId | undefined;\n\tif (!isCollapsed(sel)) {\n\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\tcursorBlockId = landingId;\n\t}\n\n\tif (cursorBlockId) {\n\t\t// Cross-root deletion replaced from-block; insert hard break in landing block\n\t\tbuilder.insertInlineNode(cursorBlockId, 0, createInlineNode(inlineType('hard_break')));\n\t\tbuilder.setSelection(createCollapsedSelection(cursorBlockId, 1));\n\t} else {\n\t\tconst { blockId: insertBlockId, offset: insertOffset } = resolveInsertPoint(\n\t\t\tsel,\n\t\t\tstate.getBlockOrder(),\n\t\t);\n\t\tbuilder.insertInlineNode(\n\t\t\tinsertBlockId,\n\t\t\tinsertOffset,\n\t\t\tcreateInlineNode(inlineType('hard_break')),\n\t\t);\n\t\tbuilder.setSelection(createCollapsedSelection(insertBlockId, insertOffset + 1));\n\t}\n\n\treturn builder.build();\n}\n\n/**\n * Merges the current block with the previous block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockBackward(state: EditorState): Transaction | null {\n\treturn mergeAdjacentBlock(state, 'backward');\n}\n\n/**\n * Merges the next block into the current block, respecting\n * isolating boundaries and void blocks.\n */\nexport function mergeBlockForward(state: EditorState): Transaction | null {\n\treturn mergeAdjacentBlock(state, 'forward');\n}\n\n/**\n * Shared implementation for merging adjacent blocks in either direction.\n * Validates selection, isolating boundaries, and void blocks before merging.\n */\nfunction mergeAdjacentBlock(\n\tstate: EditorState,\n\tdirection: 'backward' | 'forward',\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.anchor.blockId);\n\n\tconst adjacentIdx: number = direction === 'backward' ? blockIdx - 1 : blockIdx + 1;\n\tif (adjacentIdx < 0 || adjacentIdx >= blockOrder.length) return null;\n\n\tconst adjacentId: BlockId | undefined = blockOrder[adjacentIdx];\n\tif (!adjacentId) return null;\n\n\tif (isIsolatingBlock(state, sel.anchor.blockId) || isIsolatingBlock(state, adjacentId)) {\n\t\treturn null;\n\t}\n\tif (!sharesParent(state, sel.anchor.blockId, adjacentId)) {\n\t\tif (isInsideIsolating(state, sel.anchor.blockId)) return null;\n\t}\n\n\tif (isVoidBlock(state, adjacentId)) {\n\t\tconst path = findNodePath(state.doc, adjacentId) ?? [];\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createNodeSelection(adjacentId, path as BlockId[]))\n\t\t\t.build();\n\t}\n\n\tif (direction === 'backward') {\n\t\tconst prevBlock = state.getBlock(adjacentId);\n\t\tif (!prevBlock) return null;\n\t\tconst prevLen: number = getBlockLength(prevBlock);\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.mergeBlocksAt(adjacentId, sel.anchor.blockId)\n\t\t\t.setSelection(createCollapsedSelection(adjacentId, prevLen))\n\t\t\t.build();\n\t}\n\n\treturn state\n\t\t.transaction('input')\n\t\t.mergeBlocksAt(sel.anchor.blockId, adjacentId)\n\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, sel.anchor.offset))\n\t\t.build();\n}\n\n/** Selects all content in the editor, using leaf block endpoints. */\nexport function selectAll(state: EditorState): Transaction {\n\tconst docRange = documentRange(state);\n\tif (!docRange) return state.transaction('command').setSelection(state.selection).build();\n\n\treturn state\n\t\t.transaction('command')\n\t\t.setSelection(createSelection(docRange.from, docRange.to))\n\t\t.build();\n}\n\n// --- Internal Helpers ---\n\ninterface DocumentPosition {\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Endpoints of a full-document selection: the start of the first leaf block to\n * the end of the last leaf block. Returns `null` for an empty document.\n */\nfunction documentRange(\n\tstate: EditorState,\n): { from: DocumentPosition; to: DocumentPosition } | null {\n\tconst blocks = state.doc.children;\n\tconst firstBlock = blocks[0];\n\tconst lastBlock = blocks[blocks.length - 1];\n\tif (!firstBlock || !lastBlock) return null;\n\n\tconst firstLeafId: BlockId = findFirstLeafBlockId(firstBlock);\n\tconst lastLeafId: BlockId = findLastLeafBlockId(lastBlock);\n\tconst lastLeaf = state.getBlock(lastLeafId);\n\tconst lastLeafLen: number = lastLeaf ? getBlockLength(lastLeaf) : 0;\n\n\treturn {\n\t\tfrom: { blockId: firstLeafId, offset: 0 },\n\t\tto: { blockId: lastLeafId, offset: lastLeafLen },\n\t};\n}\n\n/** True when the current text selection spans the entire document. */\nfunction selectionCoversDocument(state: EditorState): boolean {\n\tif (!isTextSelection(state.selection)) return false;\n\tconst docRange = documentRange(state);\n\tif (!docRange) return false;\n\n\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\treturn (\n\t\trange.from.blockId === docRange.from.blockId &&\n\t\trange.from.offset === docRange.from.offset &&\n\t\trange.to.blockId === docRange.to.blockId &&\n\t\trange.to.offset === docRange.to.offset\n\t);\n}\n\n/**\n * Replaces the whole document with a single empty paragraph and places the\n * cursor inside it. The fresh paragraph is inserted before the originals are\n * removed so the document never passes through a zero-children state.\n */\nfunction clearDocument(state: EditorState): Transaction {\n\tconst newBlockId: BlockId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tconst originalCount: number = state.doc.children.length;\n\n\tbuilder.insertNode([], 0, createEmptyParagraph(newBlockId));\n\t// The originals shifted to indices 1..originalCount; remove them descending\n\t// so each index stays valid as the document shrinks.\n\tfor (let i = originalCount; i >= 1; i--) {\n\t\tbuilder.removeNode([], i);\n\t}\n\tbuilder.setSelection(createCollapsedSelection(newBlockId, 0));\n\n\treturn builder.build();\n}\n\nfunction resolveActiveMarks(state: EditorState): readonly Mark[] {\n\tif (state.storedMarks) return state.storedMarks;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return [];\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return [];\n\n\t// A range replaced by typing inherits the marks at its anchor (raw content\n\t// marks); only a collapsed cursor honors right-boundary inclusivity.\n\tif (!isCollapsed(sel)) return getBlockMarksAtOffset(block, sel.anchor.offset);\n\n\treturn getCursorMarks(block, sel.anchor.offset, (type) => isMarkInclusive(state.schema, type));\n}\n\n/**\n * Adds steps to delete the current text selection.\n * Returns a replacement cursor block ID when the original from-block\n * was inside a composite root that got removed (undefined otherwise).\n */\nexport function addDeleteSelectionSteps(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n): BlockId | undefined {\n\tif (!isTextSelection(state.selection)) return undefined;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(state.selection, blockOrder);\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tif (fromIdx === toIdx) {\n\t\tbuilder.deleteTextAt(range.from.blockId, range.from.offset, range.to.offset);\n\t\treturn undefined;\n\t}\n\n\tconst fromRootIdx: number = getRootBlockIndex(state, range.from.blockId);\n\tconst toRootIdx: number = getRootBlockIndex(state, range.to.blockId);\n\n\tif (fromRootIdx === toRootIdx || fromRootIdx < 0 || toRootIdx < 0) {\n\t\tdeleteLeafRange(state, builder, blockOrder, range, fromIdx, toIdx);\n\t\treturn undefined;\n\t}\n\n\treturn deleteCrossRootRange(state, builder, range, fromRootIdx, toRootIdx);\n}\n"],"mappings":"otBAsBA,SAAgB,IACf,MAAO,CACN,UAAW,CAAC,aACZ,UAAW,CAAC,OAAQ,SAAU,aAC9B,YAAA,OAEF,CAGA,SAAgB,EAAmB,GAClC,MAAO,CACN,UAAW,EAAS,eACpB,UAAW,EAAS,eACpB,YAAc,GAAiB,EAAS,YAAY,GACpD,kBAAoB,GAAiB,EAAS,kBAAkB,GAChE,YAAc,GAAiB,EAAS,YAAY,GAEtD,CAGA,SAAgB,EAAc,EAAgB,GAC7C,OAAO,EAAO,UAAU,SAAS,EAClC,CAGA,SAAgB,EAAkB,EAAgB,GACjD,OAAO,EAAO,UAAU,SAAS,E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M,GAAG,SAE1C,GAAI,IAAY,EAEf,YADA,EAAQ,aAAa,EAAM,KAAK,QAAS,EAAM,KAAK,OAAQ,EAAM,GAAG,QAItE,MAAM,EAAsB,EAAkB,EAAO,EAAM,KAAK,SAC1D,EAAoB,EAAkB,EAAO,EAAM,GAAG,SAE5D,KAAI,IAAgB,GAAa,EAAc,GAAK,EAAY,GAKhE,OAAO,EAAqB,EAAO,EAAS,EAAO,EAAa,IHlYjE,SACC,EACA,EACA,EACA,EACA,EACA,GAEA,MAAM,EAAa,EAAM,SAAS,EAAM,KAAK,SAC7C,IAAK,EAAY,OACjB,MAAM,EAAW,EAAe,GAE5B,EAAM,KAAK,OAAS,GACvB,EAAQ,aAAa,EAAM,KAAK,QAAS,EAAM,KAAK,OAAQ,GAGzD,EAAM,GAAG,OAAS,GACrB,EAAQ,aAAa,EAAM,GAAG,QAAS,EAAG,EAAM,GAAG,QAGpD,IAAK,IAAI,EAAI,EAAU,EAAG,EAAI,EAAO,IAAK,CACzC,MAAM,EAAa,EAAW,GAC9B,IAAK,EAAY,SACjB,MAAM,EAAW,EAAM,SAAS,GAChC,IAAK,EAAU,SACf,MAAM,EAAS,EAAe,GAC1B,EAAS,GACZ,EAAQ,aAAa,EAAY,EAAG,GAErC,EAAQ,cAAc,EAAM,KAAK,QAAS,EAC3C,CAEA,EAAQ,cAAc,EAAM,KAAK,QAAS,EAAM,GAAG,QACpD,CG6VE,CAAgB,EAAO,EAAS,EAAY,EAAO,EAAS,EAK9D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{E as t,b as n,o as e,u as o,w as r}from"./Document-827l3P80.mjs";import{a as s}from"./TypeBrands-Ch9856Gb.mjs";function c(t,n,e){const o=t.getNodeSpec(n);if(!o?.content)return!0;const r=t.getNodeSpec(e)?.group;for(const s of o.content.allow){if(s===e)return!0;if("text"!==s&&r&&s===r)return!0}return!1}function i(t,n,e){const o=t.getNodeSpec(n);if(!o?.content)return!0;const{min:r=0,max:s=Number.POSITIVE_INFINITY}=o.content,i=e.filter(t=>"text"!==t);if(i.length<r||i.length>s)return!1;for(const u of i)if(!c(t,n,u))return!1;return!0}function u(t,n){const e=[];let o=!1;for(const r of t.children){const{node:t,hoisted:s}=f(r,n);(t!==r||s.length>0)&&(o=!0),e.push(t,...s)}return o?{children:e}:t}function f(i,u){if(t(i))return{node:i,hoisted:[]};const d=[],a=[];let h=!1;const p=t=>{c(u,i.type,t.type)?d.push(t):(a.push(t),h=!0)};for(const t of i.children){if(!r(t)){d.push(t);continue}const n=f(t,u);n.node!==t&&(h=!0),p(n.node);for(const t of n.hoisted)p(t)}if(!h)return{node:i,hoisted:[]};const l=function(t,c,i){const u=(i.getNodeSpec(t.type)?.content?.allow)?.includes("text")??!1;if(0===c.length)return u?[o("")]:[e(s("paragraph"),[o("")])];const f=1===c.length?c[0]:void 0;if(u&&f&&r(f)&&"paragraph"===f.type&&!f.attrs&&!f.htmlId){const t=n(f);return t.length>0?[...t]:[o("")]}return c}(i,d,u);return{node:e(i.type,l,i.id,i.attrs,i.htmlId),hoisted:a}}export{u as n,i as r,c as t};
|
|
2
|
+
//# sourceMappingURL=ContentModel-NpAj7vGW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentModel-NpAj7vGW.mjs","names":[],"sources":["../../src/model/ContentModel.ts"],"sourcesContent":["/**\n * Content model validation for nested document structures.\n * Validates whether a parent node type can contain given child types.\n */\n\nimport type { BlockNode, ChildNode, Document } from './Document.js';\nimport {\n\tcreateBlockNode,\n\tcreateTextNode,\n\tgetInlineChildren,\n\tisBlockNode,\n\tisLeafBlock,\n} from './Document.js';\nimport type { SchemaRegistry } from './SchemaRegistry.js';\nimport { nodeType } from './TypeBrands.js';\n\n/**\n * Checks if a parent node type can contain a child node type,\n * using the content rules and group system from NodeSpec.\n */\nexport function canContain(\n\tregistry: SchemaRegistry,\n\tparentType: string,\n\tchildType: string,\n): boolean {\n\tconst parentSpec = registry.getNodeSpec(parentType);\n\tif (!parentSpec?.content) return true; // No content rule = anything allowed\n\n\tconst childSpec = registry.getNodeSpec(childType);\n\tconst childGroup = childSpec?.group;\n\n\tfor (const allowed of parentSpec.content.allow) {\n\t\tif (allowed === childType) return true;\n\t\tif (allowed === 'text') continue; // 'text' refers to TextNodes, not BlockNodes\n\t\tif (childGroup && allowed === childGroup) return true;\n\t}\n\n\treturn false;\n}\n\n/**\n * Validates whether the given children types are valid for a parent node type.\n * Checks allow list, min/max constraints.\n */\nexport function validateContent(\n\tregistry: SchemaRegistry,\n\tparentType: string,\n\tchildTypes: readonly string[],\n): boolean {\n\tconst parentSpec = registry.getNodeSpec(parentType);\n\tif (!parentSpec?.content) return true;\n\n\tconst { min = 0, max = Number.POSITIVE_INFINITY } = parentSpec.content;\n\n\t// Check count constraints (only for block children, not text)\n\tconst blockChildTypes = childTypes.filter((t) => t !== 'text');\n\tif (blockChildTypes.length < min || blockChildTypes.length > max) return false;\n\n\t// Check each child is allowed\n\tfor (const childType of blockChildTypes) {\n\t\tif (!canContain(registry, parentType, childType)) return false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Repairs a parsed document so no container holds a block its content rule\n * forbids. A disallowed block (e.g. a `table` a Markdown/HTML importer nested\n * under a `list_item`, whose flat-with-indent model cannot hold it, #194)\n * bubbles up to the nearest ancestor that allows it, and to the document root\n * otherwise — the root imposes no content rule, so relocation is always\n * lossless. Order is preserved: a hoisted block lands immediately after the\n * subtree it escaped from. Runs only with a registry; identity is preserved when\n * nothing moves so callers can skip needless work.\n */\nexport function hoistDisallowedBlocks(doc: Document, registry: SchemaRegistry): Document {\n\tconst children: BlockNode[] = [];\n\tlet changed = false;\n\tfor (const block of doc.children) {\n\t\tconst { node, hoisted } = repairContainer(block, registry);\n\t\tif (node !== block || hoisted.length > 0) changed = true;\n\t\tchildren.push(node, ...hoisted);\n\t}\n\treturn changed ? { children } : doc;\n}\n\n/**\n * Repairs one block's subtree, returning the repaired node and any descendant\n * blocks that could not be placed within it (to be hoisted by the caller).\n */\nfunction repairContainer(\n\tblock: BlockNode,\n\tregistry: SchemaRegistry,\n): { readonly node: BlockNode; readonly hoisted: readonly BlockNode[] } {\n\tif (isLeafBlock(block)) return { node: block, hoisted: [] };\n\n\tconst kept: ChildNode[] = [];\n\tconst hoisted: BlockNode[] = [];\n\tlet changed = false;\n\n\tconst place = (candidate: BlockNode): void => {\n\t\tif (canContain(registry, block.type, candidate.type)) {\n\t\t\tkept.push(candidate);\n\t\t} else {\n\t\t\thoisted.push(candidate);\n\t\t\tchanged = true;\n\t\t}\n\t};\n\n\tfor (const child of block.children) {\n\t\tif (!isBlockNode(child)) {\n\t\t\tkept.push(child);\n\t\t\tcontinue;\n\t\t}\n\t\tconst repaired = repairContainer(child, registry);\n\t\tif (repaired.node !== child) changed = true;\n\t\tplace(repaired.node);\n\t\tfor (const bubbled of repaired.hoisted) place(bubbled);\n\t}\n\n\tif (!changed) return { node: block, hoisted: [] };\n\n\tconst finalChildren: readonly ChildNode[] = resolveRepairedChildren(block, kept, registry);\n\treturn {\n\t\tnode: createBlockNode(block.type, finalChildren, block.id, block.attrs, block.htmlId),\n\t\thoisted,\n\t};\n}\n\n/**\n * Settles a repaired container's children: an emptied container gets a valid\n * placeholder, and a hybrid (leaf-capable) container reduced to a single plain\n * paragraph collapses back to the canonical leaf shape — mirroring how the\n * importers keep a lone single-paragraph item a leaf (#194).\n */\nfunction resolveRepairedChildren(\n\tblock: BlockNode,\n\tkept: readonly ChildNode[],\n\tregistry: SchemaRegistry,\n): readonly ChildNode[] {\n\tconst allow: readonly string[] | undefined = registry.getNodeSpec(block.type)?.content?.allow;\n\tconst leafCapable: boolean = allow?.includes('text') ?? false;\n\n\tif (kept.length === 0) {\n\t\treturn leafCapable\n\t\t\t? [createTextNode('')]\n\t\t\t: [createBlockNode(nodeType('paragraph'), [createTextNode('')])];\n\t}\n\n\tconst only: ChildNode | undefined = kept.length === 1 ? kept[0] : undefined;\n\tif (\n\t\tleafCapable &&\n\t\tonly &&\n\t\tisBlockNode(only) &&\n\t\tonly.type === 'paragraph' &&\n\t\t!only.attrs &&\n\t\t!only.htmlId\n\t) {\n\t\tconst inline = getInlineChildren(only);\n\t\treturn inline.length > 0 ? [...inline] : [createTextNode('')];\n\t}\n\treturn kept;\n}\n"],"mappings":"sHAoBA,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAa,EAAS,YAAY,GACxC,IAAK,GAAY,QAAS,OAAO,EAGjC,MAAM,EADY,EAAS,YAAY,IACT,MAE9B,IAAK,MAAM,KAAW,EAAW,QAAQ,MAAO,CAC/C,GAAI,IAAY,EAAW,OAAO,EAClC,GAAgB,SAAZ,GACA,GAAc,IAAY,EAAY,OAAO,CAClD,CAEA,OAAO,CACR,CAMA,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAa,EAAS,YAAY,GACxC,IAAK,GAAY,QAAS,OAAO,EAEjC,MAAM,IAAE,EAAM,EAAA,IAAG,EAAM,OAAO,mBAAsB,EAAW,QAGzD,EAAkB,EAAW,OAAQ,GAAY,SAAN,GACjD,GAAI,EAAgB,OAAS,GAAO,EAAgB,OAAS,EAAK,OAAO,EAGzE,IAAK,MAAM,KAAa,EACvB,IAAK,EAAW,EAAU,EAAY,GAAY,OAAO,EAG1D,OAAO,CACR,CAYA,SAAgB,EAAsB,EAAe,GACpD,MAAM,EAAwB,GAC9B,IAAI,GAAU,EACd,IAAK,MAAM,KAAS,EAAI,SAAU,CACjC,MAAM,KAAE,EAAA,QAAM,GAAY,EAAgB,EAAO,IAC7C,IAAS,GAAS,EAAQ,OAAS,KAAG,GAAU,GACpD,EAAS,KAAK,KAAS,EACxB,CACA,OAAO,EAAU,CAAE,YAAa,CACjC,CAMA,SAAS,EACR,EACA,GAEA,GAAI,EAAY,GAAQ,MAAO,CAAE,KAAM,EAAO,QAAS,IAEvD,MAAM,EAAoB,GACpB,EAAuB,GAC7B,IAAI,GAAU,EAEd,MAAM,EAAS,IACV,EAAW,EAAU,EAAM,KAAM,EAAU,MAC9C,EAAK,KAAK,IAEV,EAAQ,KAAK,GACb,GAAU,IAIZ,IAAK,MAAM,KAAS,EAAM,SAAU,CACnC,IAAK,EAAY,GAAQ,CACxB,EAAK,KAAK,GACV,QACD,CACA,MAAM,EAAW,EAAgB,EAAO,GACpC,EAAS,OAAS,IAAO,GAAU,GACvC,EAAM,EAAS,MACf,IAAK,MAAM,KAAW,EAAS,QAAS,EAAM,EAC/C,CAEA,IAAK,EAAS,MAAO,CAAE,KAAM,EAAO,QAAS,IAE7C,MAAM,EAaP,SACC,EACA,EACA,GAGA,MAAM,GADuC,EAAS,YAAY,EAAM,OAAO,SAAS,QACpD,SAAS,UAAW,EAExD,GAAoB,IAAhB,EAAK,OACR,OAAO,EACJ,CAAC,EAAe,KAChB,CAAC,EAAgB,EAAS,aAAc,CAAC,EAAe,OAG5D,MAAM,EAA8C,IAAhB,EAAK,OAAe,EAAK,QAAK,EAClE,GACC,GACA,GACA,EAAY,IACE,cAAd,EAAK,OACJ,EAAK,QACL,EAAK,OACL,CACD,MAAM,EAAS,EAAkB,GACjC,OAAO,EAAO,OAAS,EAAI,IAAI,GAAU,CAAC,EAAe,IAC1D,CACA,OAAO,CACR,CAxC6C,CAAwB,EAAO,EAAM,GACjF,MAAO,CACN,KAAM,EAAgB,EAAM,KAAM,EAAe,EAAM,GAAI,EAAM,MAAO,EAAM,QAC9E,UAEF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{A as t,D as e,N as o,T as n,_ as r,a as s,b as c,g as d,h as l,j as f,k as i,m as u,o as a,r as p,t as m,u as k,v as I,w as h}from"./Document-827l3P80.mjs";import{i as b}from"./Selection-HYoVFpAx.mjs";import{a as y}from"./TypeBrands-Ch9856Gb.mjs";import{n as g,o as x,s as B}from"./NodeResolver-Dleih-8R.mjs";var v={type:"identity"};function P(t){const e=/* @__PURE__ */new Set,o=t=>{e.add(t.id);for(const e of t.children)h(e)&&o(e)};return o(t),e}function w(t,e,o=-1){switch(e.type){case"identity":case"childIndexShift":case"moveNode":return{pos:t,deleted:!1};case"shift":return function(t,e,o){if(t.blockId!==e.blockId)return{pos:t,deleted:!1};const n=e.newLen-(e.to-e.from),r=t.offset;if(r<e.from)return{pos:t,deleted:!1};if(r===e.from){if(e.from===e.to){const n=1===o?e.from+e.newLen:e.from;return n===r?{pos:t,deleted:!1}:{pos:N(t,n),deleted:!1}}return{pos:t,deleted:!1}}if(r<e.to)return{pos:N(t,1===o?e.from+e.newLen:e.from),deleted:!0};const s=r+n;return s===r?{pos:t,deleted:!1}:{pos:N(t,s),deleted:!1}}(t,e,o);case"split":return function(t,e,o){return t.blockId!==e.blockId||t.offset<e.offset?{pos:t,deleted:!1}:t.offset>e.offset?{pos:b(e.newBlockId,t.offset-e.offset),deleted:!1}:1===o?{pos:b(e.newBlockId,0),deleted:!1}:{pos:t,deleted:!1}}(t,e,o);case"merge":return function(t,e){return t.blockId!==e.sourceBlockId?{pos:t,deleted:!1}:{pos:b(e.targetBlockId,t.offset+e.targetLengthBefore),deleted:!1}}(t,e);case"blockRemoval":return function(t,e){return e.removedBlockIds.has(t.blockId)?{pos:t,deleted:!0}:{pos:t,deleted:!1}}(t,e)}}function N(t,e){return b(t.blockId,e,t.path)}var M=class t{static empty=new t([]);maps;constructor(t){this.maps=t}static from(e){const o=[];for(const t of e)"identity"!==t.type&&o.push(t);return 0===o.length?t.empty:new t(o)}appendMap(e){return"identity"===e.type?this:new t([...this.maps,e])}appendMapping(e){return 0===e.maps.length?this:0===this.maps.length?e:new t([...this.maps,...e.maps])}get isEmpty(){return 0===this.maps.length}map(t,e=-1){return this.mapResult(t,e).pos}mapResult(t,e=-1){let o=t,n=!1,r=!1;for(const s of this.maps){const t=w(o,s,e);o=t.pos,t.deleted?"blockRemoval"===s.type?r=!0:n=!0:"childIndexShift"===s.type&&s.insertedBlockIds?.has(o.blockId)&&(r=!1)}return{pos:o,deleted:n||r}}mapRange(t,e=-1,o=1){const n=this.mapResult(t.from,e),r=this.mapResult(t.to,o);return n.deleted&&r.deleted&&n.pos.blockId===r.pos.blockId&&n.pos.offset>=r.pos.offset?null:{from:n.pos,to:r.pos}}};function T(t,e,o,n,r=1,s=-1){if(n.isEmpty)return{blockId:t,from:e,to:o};const c=b(t,e),d=b(t,o),l=n.mapResult(c,r),f=n.mapResult(d,s);return l.deleted&&f.deleted||l.pos.blockId!==f.pos.blockId||l.pos.offset>f.pos.offset?null:{blockId:l.pos.blockId,from:l.pos.offset,to:f.pos.offset}}function L(t,e,o,n=-1){if(o.isEmpty)return{blockId:t,from:e,to:e};const r=b(t,e),s=o.mapResult(r,n);return s.deleted?null:{blockId:s.pos.blockId,from:s.pos.offset,to:s.pos.offset}}function A(t,e,o){return S(t,e,o,"existing")}function R(t,e,o){return S(t,e,o,"insertion")}function S(t,e,o,n){if(o.isEmpty)return e;let r=e;for(const s of o.maps){const e=E(t,r,s,n);if(null===e)return null;r=e}return r}function E(t,e,o,n){switch(o.type){case"identity":case"shift":case"split":case"merge":return e;case"blockRemoval":return H(t,o.parentPath)?e===o.index?"existing"===n?null:e:e>o.index?e-1:e:e;case"childIndexShift":return H(t,o.parentPath)&&e>=o.fromIndex?e+o.delta:e;case"moveNode":return function(t,e,o,n){const r=H(o.fromParentPath,o.toParentPath);if(r&&o.fromIndex===o.destinationIndex)return e;if("existing"===n&&r&&H(t,o.fromParentPath)&&e===o.fromIndex)return o.destinationIndex;let s=e;if(H(t,o.fromParentPath))if(s===o.fromIndex){if("existing"===n)return null}else s>o.fromIndex&&s--;return H(t,o.toParentPath)&&s>=o.destinationIndex&&s++,s}(t,e,o,n)}}function H(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}function z(t){switch(t.type){case"identity":return v;case"shift":return{type:"shift",blockId:t.blockId,from:t.from,to:t.from+t.newLen,newLen:t.to-t.from};case"split":return{type:"merge",targetBlockId:t.blockId,sourceBlockId:t.newBlockId,targetLengthBefore:t.offset};case"merge":return{type:"split",blockId:t.targetBlockId,offset:t.targetLengthBefore,newBlockId:t.sourceBlockId};case"blockRemoval":return{type:"childIndexShift",parentPath:t.parentPath,fromIndex:t.index,delta:1,insertedBlockIds:t.removedBlockIds};case"childIndexShift":return 1===t.delta&&t.insertedBlockIds?{type:"blockRemoval",removedBlockIds:t.insertedBlockIds,parentPath:t.parentPath,index:t.fromIndex}:v;case"moveNode":return{type:"moveNode",movedNodeId:t.movedNodeId,fromParentPath:t.toParentPath,fromIndex:t.destinationIndex,toParentPath:t.fromParentPath,destinationIndex:t.fromIndex}}}function j(t,e){if(t.type!==e.type)return!1;switch(t.type){case"identity":return!0;case"shift":{const o=e;return t.blockId===o.blockId&&t.from===o.from&&t.to===o.to&&t.newLen===o.newLen}case"split":{const o=e;return t.blockId===o.blockId&&t.offset===o.offset&&t.newBlockId===o.newBlockId}case"merge":{const o=e;return t.targetBlockId===o.targetBlockId&&t.sourceBlockId===o.sourceBlockId&&t.targetLengthBefore===o.targetLengthBefore}case"blockRemoval":{const o=e;if(t.index!==o.index)return!1;if(!H(t.parentPath,o.parentPath))return!1;if(t.removedBlockIds.size!==o.removedBlockIds.size)return!1;for(const e of t.removedBlockIds)if(!o.removedBlockIds.has(e))return!1;return!0}case"childIndexShift":{const o=e;return t.fromIndex===o.fromIndex&&t.delta===o.delta&&H(t.parentPath,o.parentPath)&&function(t,e){if(t===e)return!0;if(!t||!e||t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}(t.insertedBlockIds,o.insertedBlockIds)}case"moveNode":return"moveNode"===e.type&&t.movedNodeId===e.movedNodeId&&t.fromIndex===e.fromIndex&&t.destinationIndex===e.destinationIndex&&H(t.fromParentPath,e.fromParentPath)&&H(t.toParentPath,e.toParentPath)}}function D(t,e,o){return{children:O(t.children,e,o)}}function O(t,e,o){let n=!1;const r=t.map(t=>{if(!h(t))return t;if(t.id===e)return n=!0,o(t);const r=O(t.children,e,o);return r===t.children?t:(n=!0,{...t,children:r})});return n?r:t}function _(t,e,o){if(0===e.length)return t;const n=e[0];return n?{children:t.children.map(t=>h(t)&&t.id===n?1===e.length?o(t):q(t,e,1,o):t)}:t}function q(t,e,o,n){const r=e[o];if(!r)return t;const s=t.children.map(t=>h(t)&&t.id===r?o===e.length-1?n(t):q(t,e,o+1,n):t);return{...t,children:s}}function C(t,e,o){if(e(t))return o(t);let n=!1;const r=t.map(t=>{if(!h(t))return t;const r=C(t.children,e,o);return r?(n=!0,{...t,children:r}):t});return n?r:null}function W(t,e,o){const r=[];let s=0,c=!1;for(const d of t){if(n(d)){c||e!==s||(r.push(...o()),c=!0),r.push(d),s+=1;continue}const t=s+d.text.length;if(!c&&e>=s&&e<=t){const t=e-s,n=d.text.slice(0,t),l=d.text.slice(t);n&&r.push(k(n,d.marks)),r.push(...o()),l&&r.push(k(l,d.marks)),c=!0}else r.push(d);s=t}return c||r.push(...o()),r}function F(t,e,o){const r=[];let s=0;for(const c of t){if(n(c)){const t=s+1;t>e&&s<o&&r.push(c),s=t;continue}const t=s+c.text.length;if(t<=e||s>=o);else{const t=Math.max(0,e-s),n=Math.min(c.text.length,o-s),d=c.text.slice(t,n);d.length>0&&r.push(k(d,c.marks))}s=t}return 0===r.length&&r.push(k("")),r}function G(t,e,o,r,s){const c=[];let d=0;for(const l of t){if(n(l)){c.push(l),d+=1;continue}const t=d+l.text.length;if(t<=e||d>=o)c.push(l);else if(d>=e&&t<=o){const t=s?m(l.marks,r):f(l.marks,r.type);c.push(k(l.text,t))}else{const t=Math.max(0,e-d),n=Math.min(l.text.length,o-d),i=l.text.slice(0,t),u=l.text.slice(t,n),a=l.text.slice(n);if(i&&c.push(k(i,l.marks)),u){const t=s?m(l.marks,r):f(l.marks,r.type);c.push(k(u,t))}a&&c.push(k(a,l.marks))}d=t}return c}function J(t,e,o,r){const s=[];if(e>=o)return s;let c=null,d=0;const l=()=>{c&&(s.push(c),c=null)};for(const f of t){const t=d+(n(f)?1:f.text.length);if(t<=e||d>=o){d=t;continue}const s=Math.max(d,e),i=Math.min(t,o);n(f)?c&&(c.to=i):f.marks.some(t=>t.type===r)?l():c?c.to=i:c={from:s,to:i},d=t}return l(),s}function K(t,e,o,r){const s=[];if(e>=o)return s;let c=null,d=0;const l=()=>{c&&(s.push(c),c=null)};for(const f of t){const t=d+(n(f)?1:f.text.length);if(t<=e||d>=o){d=t;continue}const s=Math.max(d,e),u=Math.min(t,o);if(n(f))c&&(c.to=u);else{const t=f.marks.find(t=>t.type===r);t?c&&i(c.mark,t)?c.to=u:(l(),c={from:s,to:u,mark:t}):l()}d=t}return l(),s}function Q(t,o){if(t.every(t=>e(t)||n(t)))return o;const r=t.filter(t=>!e(t)&&!n(t));return[...o,...r]}function U(t){return t.reduce((t,e)=>t+("inline"===e.kind?1:e.text.length),0)}function V(t){return{blocks:t.split(/\r?\n/).map(t=>({type:y("paragraph"),segments:[o(t)]}))}}function X(t){return $(t.fromParentPath,t.toParentPath)&&t.toIndex>t.fromIndex?t.toIndex-1:t.toIndex}function Y(t){return $(t.fromParentPath,t.toParentPath)&&X(t)===t.fromIndex}function Z(t,e){const o=x(t,e.fromParentPath,e.fromIndex);if(!o||o.id!==e.movedNode.id)return null;if(e.toParentPath.includes(o.id))return null;const n=0===e.toParentPath.length?t.children.length:B(t,e.toParentPath)?.children.length??null;if(null===n||!Number.isInteger(e.toIndex)||e.toIndex<0||e.toIndex>n)return null;const r=$(e.fromParentPath,e.toParentPath),s=X(e);return s<0||s>n-(r?1:0)?null:{movedNode:o,destinationIndex:s}}function $(t,e){return t.length===e.length&&t.every((t,o)=>t===e[o])}function tt(t){return t.segments?U(t.segments):t.text.length}function et(e,o,n,r=!0){return D(e,o,e=>{const o=n(c(e));return{...e,children:Q(e.children,r?t(o):o)}})}function ot(t,e){if(0===e.parentPath.length){const o=[...t.children];return o.splice(e.index,0,e.node),{children:o}}return _(t,e.parentPath,t=>{const o=[...t.children];return o.splice(e.index,0,e.node),{...t,children:o}})}function nt(t,e){if(0===e.parentPath.length){const o=[...t.children];return o.splice(e.index,1),{children:o}}return _(t,e.parentPath,t=>{const o=[...t.children];return o.splice(e.index,1),{...t,children:o}})}function rt(t){return t.path?{path:t.path}:{}}function st(t){for(const e of t.steps)if("setStoredMarks"===e.type)return e.previousMarks;return t.storedMarksAfter}function ct(t,e,o){return o?t!==e?{}:{path:o}:{}}function dt(t,e,o){if(0===t.length)return!0;for(const n of t){const t=e.mapResult({blockId:n,offset:0},-1);if(t.deleted)return!1;if(t.pos.blockId!==n)return!1}return void 0!==B(o,t)}function lt(t,e){return e.blockId===t.blockId&&e.from===t.from&&e.to===t.to}var ft={insertText:{apply:function(t,e){return et(t,e.blockId,t=>{return e.segments?(o=t,n=e.offset,r=e.segments,W(o,n,()=>r.map(s))):function(t,e,o,n){return W(t,e,()=>[k(o,n)])}(t,e.offset,e.text,e.marks);var o,n,r})},invert:function(t){return{type:"deleteText",blockId:t.blockId,from:t.offset,to:t.offset+tt(t),deletedText:t.text,deletedMarks:t.marks,deletedSegments:t.segments??[o(t.text,[...t.marks])],...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.offset,to:e.offset,newLen:tt(e)}},map:function(t,e,o){const n=L(t.blockId,t.offset,e,-1);return n?n.blockId===t.blockId&&n.from===t.offset?t:{type:"insertText",blockId:n.blockId,offset:n.from,text:t.text,marks:t.marks,...t.segments?{segments:t.segments}:{},...ct(t.blockId,n.blockId,t.path)}:null}},deleteText:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e,o){const r=[];let s=0;for(const c of t){if(n(c)){const t=s+1;(t<=e||s>=o)&&r.push(c),s=t;continue}const t=s+c.text.length;if(t<=e||s>=o)r.push(c);else{const t=Math.max(0,e-s),n=Math.min(c.text.length,o-s),d=c.text.slice(0,t)+c.text.slice(n);d.length>0&&r.push(k(d,c.marks))}s=t}return r}(t,e.from,e.to))},invert:function(t){return{type:"insertText",blockId:t.blockId,offset:t.from,text:t.deletedText,marks:t.deletedMarks,segments:t.deletedSegments,...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.from,to:e.to,newLen:0}},map:function(t,e,o){const n=T(t.blockId,t.from,t.to,e);if(!n)return null;if(lt({blockId:t.blockId,from:t.from,to:t.to},n))return t;const s=g(o,n.blockId);if(!s)return null;const c=r(s).slice(n.from,n.to),l=d(s,n.from),f=u(s,n.from,n.to);return{type:"deleteText",blockId:n.blockId,from:n.from,to:n.to,deletedText:c,deletedMarks:l,deletedSegments:f,...ct(t.blockId,n.blockId,t.path)}}},splitBlock:{apply:function(e,o){const n=C(e.children,t=>t.some(t=>h(t)&&t.id===o.blockId),e=>{const n=e.findIndex(t=>h(t)&&t.id===o.blockId);if(-1===n)return e;const r=e[n],s=c(r),d=l(r),f=F(s,0,o.offset),i=F(s,o.offset,d),u={...r,children:t(f)},p=void 0!==o.newBlockType,m=o.newBlockType??r.type,k=p?o.newBlockAttrs:r.attrs,I=a(m,t(i),o.newBlockId,k,o.newBlockHTMLId),b=[...e];return b.splice(n,1,u,I),b});return n?{children:n}:e},invert:function(t){return{type:"mergeBlocks",targetBlockId:t.blockId,sourceBlockId:t.newBlockId,targetLengthBefore:t.offset,...void 0!==t.newBlockType?{sourceType:t.newBlockType}:{},...t.newBlockAttrs?{sourceAttrs:t.newBlockAttrs}:{},...void 0!==t.newBlockHTMLId?{sourceHTMLId:t.newBlockHTMLId}:{},...rt(t)}},getMap:function(t,e){return{type:"split",blockId:e.blockId,offset:e.offset,newBlockId:e.newBlockId}},map:function(t,e,o){const n=L(t.blockId,t.offset,e,-1);return n?n.blockId===t.blockId&&n.from===t.offset?t:{type:"splitBlock",blockId:n.blockId,offset:n.from,newBlockId:t.newBlockId,...void 0!==t.newBlockType?{newBlockType:t.newBlockType}:{},...t.newBlockAttrs?{newBlockAttrs:t.newBlockAttrs}:{},...void 0!==t.newBlockHTMLId?{newBlockHTMLId:t.newBlockHTMLId}:{},...ct(t.blockId,n.blockId,t.path)}:null}},mergeBlocks:{apply:function(e,o){const n=C(e.children,t=>t.some(t=>h(t)&&t.id===o.targetBlockId)&&t.some(t=>h(t)&&t.id===o.sourceBlockId),e=>{const n=e.findIndex(t=>h(t)&&t.id===o.targetBlockId),r=e.findIndex(t=>h(t)&&t.id===o.sourceBlockId);if(-1===n||-1===r)return e;const s=e[n],d=e[r],l=c(s),f=c(d),i=t([...l,...f]),u={...s,children:i};return e.filter(t=>!h(t)||t.id!==o.sourceBlockId).map(t=>h(t)&&t.id===o.targetBlockId?u:t)});return n?{children:n}:e},invert:function(t){return{type:"splitBlock",blockId:t.targetBlockId,offset:t.targetLengthBefore,newBlockId:t.sourceBlockId,...void 0!==t.sourceType?{newBlockType:t.sourceType}:{},...t.sourceAttrs?{newBlockAttrs:t.sourceAttrs}:{},...void 0!==t.sourceHTMLId?{newBlockHTMLId:t.sourceHTMLId}:{},...rt(t)}},getMap:function(t,e){return{type:"merge",targetBlockId:e.targetBlockId,sourceBlockId:e.sourceBlockId,targetLengthBefore:e.targetLengthBefore}},map:function(t,e,o){if(e.isEmpty)return t;const n=e.mapResult({blockId:t.targetBlockId,offset:0},-1),r=e.mapResult({blockId:t.sourceBlockId,offset:0},-1);if(n.deleted||r.deleted)return null;const s=n.pos.blockId,c=r.pos.blockId;if(s===c)return null;const d=g(o,s);if(!d)return null;const f=l(d);return s===t.targetBlockId&&c===t.sourceBlockId&&f===t.targetLengthBefore?t:{type:"mergeBlocks",targetBlockId:s,sourceBlockId:c,targetLengthBefore:f,...void 0!==t.sourceType?{sourceType:t.sourceType}:{},...t.sourceAttrs?{sourceAttrs:t.sourceAttrs}:{},...void 0!==t.sourceHTMLId?{sourceHTMLId:t.sourceHTMLId}:{},...ct(t.targetBlockId,s,t.path)}}},addMark:{apply:function(t,e){return et(t,e.blockId,t=>G(t,e.from,e.to,e.mark,!0))},invert:function(t){return{type:"removeMark",blockId:t.blockId,from:t.from,to:t.to,mark:t.mark,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){const n=T(t.blockId,t.from,t.to,e);return n?lt({blockId:t.blockId,from:t.from,to:t.to},n)?t:{type:"addMark",blockId:n.blockId,from:n.from,to:n.to,mark:t.mark,...ct(t.blockId,n.blockId,t.path)}:null}},removeMark:{apply:function(t,e){return et(t,e.blockId,t=>G(t,e.from,e.to,e.mark,!1))},invert:function(t){return{type:"addMark",blockId:t.blockId,from:t.from,to:t.to,mark:t.mark,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){const n=T(t.blockId,t.from,t.to,e);return n?lt({blockId:t.blockId,from:t.from,to:t.to},n)?t:{type:"removeMark",blockId:n.blockId,from:n.from,to:n.to,mark:t.mark,...ct(t.blockId,n.blockId,t.path)}:null}},setStoredMarks:{apply:function(t){return t},invert:function(t){return{type:"setStoredMarks",marks:t.previousMarks,previousMarks:t.marks}},getMap:function(t,e){return v},map:function(t,e,o){return t}},setBlockType:{apply:function(t,e){return D(t,e.blockId,t=>{const{attrs:o,...n}=t;return{...n,type:e.nodeType,...e.attrs?{attrs:e.attrs}:{}}})},invert:function(t){return{type:"setBlockType",blockId:t.blockId,nodeType:t.previousNodeType,attrs:t.previousAttrs,previousNodeType:t.nodeType,previousAttrs:t.attrs,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){if(e.isEmpty)return t;const n=e.mapResult({blockId:t.blockId,offset:0},-1);if(n.deleted)return null;const r=n.pos.blockId,s=g(o,r);return s?r===t.blockId&&s.type===t.previousNodeType&&p(s.attrs,t.previousAttrs)?t:{type:"setBlockType",blockId:r,nodeType:t.nodeType,...t.attrs?{attrs:t.attrs}:{},previousNodeType:s.type,...s.attrs?{previousAttrs:s.attrs}:{},...ct(t.blockId,r,t.path)}:null}},insertNode:{apply:ot,invert:function(t){return{type:"removeNode",parentPath:t.parentPath,index:t.index,removedNode:t.node}},getMap:function(t,e){return{type:"childIndexShift",parentPath:e.parentPath,fromIndex:e.index,delta:1,insertedBlockIds:P(e.node)}},map:function(t,e,o){if(!dt(t.parentPath,e,o))return null;const n=R(t.parentPath,t.index,e);return n===t.index?t:{type:"insertNode",parentPath:t.parentPath,index:n,node:t.node}}},removeNode:{apply:nt,invert:function(t){return{type:"insertNode",parentPath:t.parentPath,index:t.index,node:t.removedNode}},getMap:function(t,e){return{type:"blockRemoval",removedBlockIds:P(e.removedNode),parentPath:e.parentPath,index:e.index}},map:function(t,e,o){if(!dt(t.parentPath,e,o))return null;const n=e.mapResult({blockId:t.removedNode.id,offset:0},-1);if(n.deleted)return null;if(n.pos.blockId!==t.removedNode.id)return null;const r=A(t.parentPath,t.index,e);if(null===r)return null;const s=x(o,t.parentPath,r);return s?s.id!==t.removedNode.id?null:r===t.index&&s===t.removedNode?t:{type:"removeNode",parentPath:t.parentPath,index:r,removedNode:s}:null}},moveNode:{apply:function(t,e){const o=Z(t,e);return!o||Y(e)?t:ot(nt(t,{type:"removeNode",parentPath:e.fromParentPath,index:e.fromIndex,removedNode:o.movedNode}),{type:"insertNode",parentPath:e.toParentPath,index:o.destinationIndex,node:o.movedNode})},invert:function(t){const e=X(t),o=t.fromParentPath.length===t.toParentPath.length&&t.fromParentPath.every((e,o)=>e===t.toParentPath[o])&&t.fromIndex>e?t.fromIndex+1:t.fromIndex;return{type:"moveNode",fromParentPath:t.toParentPath,fromIndex:e,toParentPath:t.fromParentPath,toIndex:o,movedNode:t.movedNode}},getMap:function(t,e){const o=Z(t,e);return!o||Y(e)?v:{type:"moveNode",movedNodeId:e.movedNode.id,fromParentPath:e.fromParentPath,fromIndex:e.fromIndex,toParentPath:e.toParentPath,destinationIndex:o.destinationIndex}},map:function(t,e,o){if(!dt(t.fromParentPath,e,o))return null;if(!dt(t.toParentPath,e,o))return null;const n=e.mapResult({blockId:t.movedNode.id,offset:0},-1);if(n.deleted||n.pos.blockId!==t.movedNode.id)return null;const r=A(t.fromParentPath,t.fromIndex,e);if(null===r)return null;const s=R(t.toParentPath,t.toIndex,e),c=x(o,t.fromParentPath,r);if(!c||c.id!==t.movedNode.id)return null;const d={type:"moveNode",fromParentPath:t.fromParentPath,fromIndex:r,toParentPath:t.toParentPath,toIndex:s,movedNode:c};return Z(o,d)?r===t.fromIndex&&s===t.toIndex&&c===t.movedNode?t:d:null}},setNodeAttr:{apply:function(t,e){const o=e.path[e.path.length-1];return o?D(t,o,t=>({...t,attrs:e.attrs})):t},invert:function(t){return{type:"setNodeAttr",path:t.path,attrs:t.previousAttrs,previousAttrs:t.attrs}},getMap:function(t,e){return v},map:function(t,e,o){if(e.isEmpty)return t;if(!dt(t.path,e,o))return null;const n=B(o,t.path);return n?{type:"setNodeAttr",path:t.path,attrs:t.attrs,...n.attrs?{previousAttrs:n.attrs}:{}}:null}},insertInlineNode:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e,o){const r=[];let s=0,c=!1;for(const d of t){if(n(d)){c||e!==s||(r.push(o),c=!0),r.push(d),s+=1;continue}const t=s+d.text.length;if(!c&&e>=s&&e<=t){const t=e-s,n=d.text.slice(0,t),l=d.text.slice(t);n&&r.push(k(n,d.marks)),r.push(o),l&&r.push(k(l,d.marks)),c=!0}else r.push(d);s=t}return c||r.push(o),r}(t,e.offset,e.node))},invert:function(t){return{type:"removeInlineNode",blockId:t.blockId,offset:t.offset,removedNode:t.node,...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.offset,to:e.offset,newLen:1}},map:function(t,e,o){const n=L(t.blockId,t.offset,e,-1);return n?n.blockId===t.blockId&&n.from===t.offset?t:{type:"insertInlineNode",blockId:n.blockId,offset:n.from,node:t.node,...ct(t.blockId,n.blockId,t.path)}:null}},removeInlineNode:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e){const o=[];let r=0;for(const s of t)n(s)?(r!==e&&o.push(s),r+=1):(o.push(s),r+=s.text.length);return o}(t,e.offset))},invert:function(t){return{type:"insertInlineNode",blockId:t.blockId,offset:t.offset,node:t.removedNode,...rt(t)}},getMap:function(t,e){return{type:"shift",blockId:e.blockId,from:e.offset,to:e.offset+1,newLen:0}},map:function(t,e,o){const r=T(t.blockId,t.offset,t.offset+1,e,1,1);if(!r)return null;if(r.to-r.from!==1)return null;const s=g(o,r.blockId);if(!s)return null;const c=I(s,r.from);return c&&"inline"===c.kind&&n(c.node)?(d=t.removedNode)===(l=c.node)||d.inlineType===l.inlineType&&p(d.attrs,l.attrs)?r.blockId===t.blockId&&r.from===t.offset?t:{type:"removeInlineNode",blockId:r.blockId,offset:r.from,removedNode:c.node,...ct(t.blockId,r.blockId,t.path)}:null:null;var d,l}},setInlineNodeAttr:{apply:function(t,e){return et(t,e.blockId,t=>function(t,e,o){const r=[];let s=0;for(const c of t)n(c)?(s===e?r.push({...c,attrs:o}):r.push(c),s+=1):(r.push(c),s+=c.text.length);return r}(t,e.offset,e.attrs),!1)},invert:function(t){return{type:"setInlineNodeAttr",blockId:t.blockId,offset:t.offset,attrs:t.previousAttrs,previousAttrs:t.attrs,...rt(t)}},getMap:function(t,e){return v},map:function(t,e,o){const r=T(t.blockId,t.offset,t.offset+1,e,1,1);if(!r)return null;if(r.to-r.from!==1)return null;if(r.blockId===t.blockId&&r.from===t.offset)return t;const s=g(o,r.blockId);if(!s)return null;const c=I(s,r.from);return c&&"inline"===c.kind&&n(c.node)?{type:"setInlineNodeAttr",blockId:r.blockId,offset:r.from,attrs:t.attrs,previousAttrs:c.node.attrs,...ct(t.blockId,r.blockId,t.path)}:null}}};function it(t){return ft[t.type]}function ut(t,e){return it(e).apply(t,e)}function at(t){return it(t).invert(t)}function pt(t,e){return it(e).getMap(t,e)}function mt(t,e,o){return e.isEmpty?t:it(t).map(t,e,o)}function kt(t){const e=t.steps.map(at).reverse();return{steps:e,selectionBefore:t.selectionAfter,selectionAfter:t.selectionBefore,storedMarksAfter:st(t),mapping:M.empty,forwardStepMaps:e.map(()=>v),metadata:{origin:"history",timestamp:Date.now()}}}function It(t,e){switch(t.type){case"inline":return function(t,e){switch(e.type){case"identity":case"childIndexShift":case"moveNode":return t;case"shift":return function(t,e){if(t.blockId!==e.blockId)return t;const o=w(b(t.blockId,t.from),e,-1).pos,n=w(b(t.blockId,t.to),e,1).pos;return o.offset>=n.offset?null:o.offset===t.from&&n.offset===t.to?t:{...t,from:o.offset,to:n.offset}}(t,e);case"split":return function(t,e){return t.blockId!==e.blockId||t.to<=e.offset?t:t.from>=e.offset?{...t,blockId:e.newBlockId,from:t.from-e.offset,to:t.to-e.offset}:[{...t,to:e.offset},{...t,blockId:e.newBlockId,from:0,to:t.to-e.offset}]}(t,e);case"merge":return function(t,e){return t.blockId!==e.sourceBlockId?t:{...t,blockId:e.targetBlockId,from:t.from+e.targetLengthBefore,to:t.to+e.targetLengthBefore}}(t,e);case"blockRemoval":return e.removedBlockIds.has(t.blockId)?null:t}}(t,e);case"widget":return function(t,e){switch(e.type){case"identity":case"childIndexShift":case"moveNode":return t;case"shift":return function(t,e){if(t.blockId!==e.blockId)return t;const o=w(b(t.blockId,t.offset),e,t.side);return o.deleted?null:o.pos.offset===t.offset?t:{...t,offset:o.pos.offset}}(t,e);case"split":return function(t,e){if(t.blockId!==e.blockId)return t;const o=w(b(t.blockId,t.offset),e,t.side);return o.pos.blockId===t.blockId&&o.pos.offset===t.offset?t:{...t,blockId:o.pos.blockId,offset:o.pos.offset}}(t,e);case"merge":return function(t,e){return t.blockId!==e.sourceBlockId?t:{...t,blockId:e.targetBlockId,offset:t.offset+e.targetLengthBefore}}(t,e);case"blockRemoval":return e.removedBlockIds.has(t.blockId)?null:t}}(t,e);case"node":return function(t,e){switch(e.type){case"identity":case"shift":case"split":case"childIndexShift":case"moveNode":return t;case"merge":return t.blockId===e.sourceBlockId?null:t;case"blockRemoval":return e.removedBlockIds.has(t.blockId)?null:t}}(t,e)}}function ht(t,e,o,n){return{type:"inline",blockId:t,from:e,to:o,attrs:n}}function bt(t,e){return{type:"node",blockId:t,attrs:e}}function yt(t,e,o,n){return{type:"widget",blockId:t,offset:e,toDOM:o,side:n?.side??-1,key:n?.key}}var gt=class t{byBlock;static empty=new t(/* @__PURE__ */new Map);constructor(t){this.byBlock=t}static create(e){if(0===e.length)return t.empty;const o=/* @__PURE__ */new Map;for(const t of e){const e=o.get(t.blockId);e?e.push(t):o.set(t.blockId,[t])}return new t(o)}find(t){return this.byBlock.get(t)??[]}findInline(t){const e=this.byBlock.get(t);return e?e.filter(t=>"inline"===t.type):[]}findNode(t){const e=this.byBlock.get(t);return e?e.filter(t=>"node"===t.type):[]}findWidget(t){const e=this.byBlock.get(t);return e?e.filter(t=>"widget"===t.type):[]}add(e){if(0===e.length)return this;if(this.isEmpty)return t.create(e);const o=/* @__PURE__ */new Map;for(const[t,n]of this.byBlock)o.set(t,[...n]);for(const t of e){const e=o.get(t.blockId);e?e.push(t):o.set(t.blockId,[t])}return new t(o)}remove(e){const o=/* @__PURE__ */new Map;let n=!1;for(const[t,r]of this.byBlock){const s=r.filter(t=>!e(t));s.length!==r.length&&(n=!0),s.length>0&&o.set(t,s)}return n?0===o.size?t.empty:new t(o):this}merge(e){if(e.isEmpty)return this;if(this.isEmpty)return e;const o=/* @__PURE__ */new Map;for(const[t,n]of this.byBlock)o.set(t,[...n]);for(const[t,n]of e.byBlock){const e=o.get(t);e?e.push(...n):o.set(t,[...n])}return new t(o)}equals(t){if(this===t)return!0;if(this.byBlock.size!==t.byBlock.size)return!1;for(const[e,o]of this.byBlock){const n=t.byBlock.get(e);if(!n)return!1;if(!xt(o,n))return!1}return!0}get isEmpty(){return 0===this.byBlock.size}map(e){if(this.isEmpty||e.mapping.isEmpty)return this;let o=[];for(const t of this.byBlock.values())for(const e of t)o.push(e);for(const t of e.mapping.maps){const e=[];for(const n of o){const o=It(n,t);if(null!==o)if(Array.isArray(o))for(const t of o)e.push(t);else e.push(o)}o=e}return 0===o.length?t.empty:t.create(o)}};function xt(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++){const n=t[o],r=e[o];if(!n||!r||!Bt(n,r))return!1}return!0}function Bt(t,e){if(t.type!==e.type)return!1;if(t.blockId!==e.blockId)return!1;switch(t.type){case"inline":{const o=e;return t.from===o.from&&t.to===o.to&&vt(t.attrs,o.attrs)}case"node":{const o=e;return vt(t.attrs,o.attrs)}case"widget":{const o=e;return t.offset===o.offset&&t.side===o.side&&t.key===o.key&&t.toDOM===o.toDOM}}}function vt(t,e){if(t===e)return!0;const o=Object.keys(t),n=Object.keys(e);if(o.length!==n.length)return!1;for(const r of o)if(t[r]!==e[r])return!1;return!0}export{w as C,R as S,v as _,yt as a,z as b,at as c,st as d,Y as f,K as g,J as h,bt as i,kt as l,U as m,xt as n,ut as o,V as p,ht as r,pt as s,gt as t,mt as u,M as v,j as w,A as x,P as y};
|
|
2
|
+
//# sourceMappingURL=Decoration-BpoEOANl.mjs.map
|