@notectl/core 2.3.1 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD-PARTY-NOTICES.md +129 -0
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +1 -0
- package/dist/chunks/{AttrRegistry-B3zB02z9.mjs → AttrRegistry-CtNhf2EF.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-B3zB02z9.mjs.map → AttrRegistry-CtNhf2EF.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs +2 -0
- package/dist/chunks/AttributedMarkCommands-B3MQdob_.mjs.map +1 -0
- package/dist/chunks/{BidiIsolationPlugin-DBXyXpgm.mjs → BidiIsolationPlugin-cOLlL3Y9.mjs} +2 -2
- package/dist/chunks/{BidiIsolationPlugin-DBXyXpgm.mjs.map → BidiIsolationPlugin-cOLlL3Y9.mjs.map} +1 -1
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs +2 -0
- package/dist/chunks/{BlockInsertion-CJusvrDL.mjs.map → BlockInsertion-O5pAFKid.mjs.map} +1 -1
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +2 -0
- package/dist/chunks/{BlockquotePlugin-Bz2glHwX.mjs.map → BlockquotePlugin-D-jRWLQB.mjs.map} +1 -1
- package/dist/chunks/CaretNavigationPlugin-Clv8dzR5.mjs +2 -0
- package/dist/chunks/CaretNavigationPlugin-Clv8dzR5.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +2 -0
- package/dist/chunks/{CodeBlockPlugin-C1hrdbSZ.mjs.map → CodeBlockPlugin-BandNM3t.mjs.map} +1 -1
- package/dist/chunks/ColorGrid-D0vLHsG6.mjs +2 -0
- package/dist/chunks/{ColorGrid-C9RQoEWF.mjs.map → ColorGrid-D0vLHsG6.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-_C5JZhki.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-DiA68Pzz.mjs.map → ColorPickerPopup-_C5JZhki.mjs.map} +1 -1
- package/dist/chunks/ColorValidation-B9d_umnf.mjs +2 -0
- package/dist/chunks/{ColorValidation-DAijTjG9.mjs.map → ColorValidation-B9d_umnf.mjs.map} +1 -1
- package/dist/chunks/Commands-D-0UXYvo.mjs +2 -0
- package/dist/chunks/Commands-D-0UXYvo.mjs.map +1 -0
- package/dist/chunks/ContentModel-Bzmzeqwg.mjs +2 -0
- package/dist/chunks/{ContentModel-NpAj7vGW.mjs.map → ContentModel-Bzmzeqwg.mjs.map} +1 -1
- package/dist/chunks/CursorMarks-dx51OGBf.mjs +2 -0
- package/dist/chunks/CursorMarks-dx51OGBf.mjs.map +1 -0
- package/dist/chunks/Decoration-BwhoA4MU.mjs +3 -0
- package/dist/chunks/Decoration-BwhoA4MU.mjs.map +1 -0
- package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs → DirectionDetection-ZrkMhyaL.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-CDVSEWQ6.mjs.map → DirectionDetection-ZrkMhyaL.mjs.map} +1 -1
- package/dist/chunks/Document-D_2cIBJG.mjs +2 -0
- package/dist/chunks/Document-D_2cIBJG.mjs.map +1 -0
- package/dist/chunks/DocumentParser-i-CreJ48.mjs +2 -0
- package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +1 -0
- package/dist/chunks/{FontPlugin-By-TGrQo.mjs → FontPlugin-B4Ouhmpe.mjs} +2 -2
- package/dist/chunks/{FontPlugin-By-TGrQo.mjs.map → FontPlugin-B4Ouhmpe.mjs.map} +1 -1
- package/dist/chunks/FontSizePlugin-CZB-AwZQ.mjs +2 -0
- package/dist/chunks/{FontSizePlugin-Dln-tYXV.mjs.map → FontSizePlugin-CZB-AwZQ.mjs.map} +1 -1
- package/dist/chunks/FormulaPlugin-C7N3QXDx.mjs +2 -0
- package/dist/chunks/FormulaPlugin-C7N3QXDx.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +1 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +2 -0
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +2 -0
- package/dist/chunks/{HTMLUtils-Bhg3_P8B.mjs.map → HTMLUtils-B0nGyFLb.mjs.map} +1 -1
- package/dist/chunks/HardBreakPlugin-CC4rntSX.mjs +2 -0
- package/dist/chunks/{HardBreakPlugin-DlbSlrdq.mjs.map → HardBreakPlugin-CC4rntSX.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-hubN_Ebt.mjs +2 -0
- package/dist/chunks/{HeadingPlugin-uMAjPOk5.mjs.map → HeadingPlugin-hubN_Ebt.mjs.map} +1 -1
- package/dist/chunks/{HighlightPlugin-Bj7FPkIQ.mjs → HighlightPlugin-CE_MgFNz.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-Bj7FPkIQ.mjs.map → HighlightPlugin-CE_MgFNz.mjs.map} +1 -1
- package/dist/chunks/{HorizontalRulePlugin-DUVmTQpX.mjs → HorizontalRulePlugin-CxmUMM34.mjs} +2 -2
- package/dist/chunks/{HorizontalRulePlugin-DUVmTQpX.mjs.map → HorizontalRulePlugin-CxmUMM34.mjs.map} +1 -1
- package/dist/chunks/{ImagePlugin-FToCOjd5.mjs → ImagePlugin-B_y4STEr.mjs} +2 -2
- package/dist/chunks/{ImagePlugin-FToCOjd5.mjs.map → ImagePlugin-B_y4STEr.mjs.map} +1 -1
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +2 -0
- package/dist/chunks/{InlineCodePlugin-pISIoGQE.mjs.map → InlineCodePlugin-C1SqGfv5.mjs.map} +1 -1
- package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs → InlineStyleMarkSpec-Cx3goc3W.mjs} +2 -2
- package/dist/chunks/{InlineStyleMarkSpec-CjSRj4f_.mjs.map → InlineStyleMarkSpec-Cx3goc3W.mjs.map} +1 -1
- package/dist/chunks/{LinkPlugin-Ct5Z180S.mjs → LinkPlugin-BwXDGHPe.mjs} +2 -2
- package/dist/chunks/{LinkPlugin-Ct5Z180S.mjs.map → LinkPlugin-BwXDGHPe.mjs.map} +1 -1
- package/dist/chunks/ListPlugin-DSFPSWQC.mjs +2 -0
- package/dist/chunks/ListPlugin-DSFPSWQC.mjs.map +1 -0
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs +2 -0
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +1 -0
- package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs → MarkInputRule-DNneF2gp.mjs} +2 -2
- package/dist/chunks/{MarkInputRule-Bdi8KPus.mjs.map → MarkInputRule-DNneF2gp.mjs.map} +1 -1
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +2 -0
- package/dist/chunks/{MarkdownHTMLRegistry-CKEx7LkR.mjs.map → MarkdownHTMLRegistry-CISsC0lH.mjs.map} +1 -1
- package/dist/chunks/MarkdownParser-D1d9zB0R.mjs +2 -0
- package/dist/chunks/{MarkdownParser-CWt3M6jR.mjs.map → MarkdownParser-D1d9zB0R.mjs.map} +1 -1
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +2 -0
- package/dist/chunks/{MarkdownSerializer-J-i28out.mjs.map → MarkdownSerializer-Oex2RzNw.mjs.map} +1 -1
- package/dist/chunks/MathFont-BS8IwYh2.mjs +2 -0
- package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -0
- package/dist/chunks/{NodeResolver-Dleih-8R.mjs → NodeResolver-BtIknXqD.mjs} +2 -2
- package/dist/chunks/{NodeResolver-Dleih-8R.mjs.map → NodeResolver-BtIknXqD.mjs.map} +1 -1
- package/dist/chunks/NodeSelectionCommands-DK3iEh18.mjs +2 -0
- package/dist/chunks/{NodeSelectionCommands-1PjwUDTJ.mjs.map → NodeSelectionCommands-DK3iEh18.mjs.map} +1 -1
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs +2 -0
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -0
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs +2 -0
- package/dist/chunks/{PluginHelpers-Dx_0hfDe.mjs.map → PluginHelpers-WG1Lzzh3.mjs.map} +1 -1
- package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs +2 -0
- package/dist/chunks/{PopupKeyboardPatterns-tUrT9TyV.mjs.map → PopupKeyboardPatterns-BcwdDxRq.mjs.map} +1 -1
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs +2 -0
- package/dist/chunks/{PopupManager-CT-fMZJn.mjs.map → PopupManager-Jz5JrUdC.mjs.map} +1 -1
- package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs → PopupPositioning-CIqgpqlW.mjs} +2 -2
- package/dist/chunks/{PopupPositioning-BFh6Ed1D.mjs.map → PopupPositioning-CIqgpqlW.mjs.map} +1 -1
- package/dist/chunks/PrintPlugin-1m54b2-Y.mjs +2 -0
- package/dist/chunks/PrintPlugin-1m54b2-Y.mjs.map +1 -0
- package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs → RangeIterator-DDOxTQIf.mjs} +2 -2
- package/dist/chunks/{RangeIterator-DP7Ud3Gp.mjs.map → RangeIterator-DDOxTQIf.mjs.map} +1 -1
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +2 -0
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +1 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs +2 -0
- package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -0
- package/dist/chunks/{SelectionSync-BSHIw1EE.mjs → SelectionSync-CcvoRrNd.mjs} +2 -2
- package/dist/chunks/{SelectionSync-BSHIw1EE.mjs.map → SelectionSync-CcvoRrNd.mjs.map} +1 -1
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs +2 -0
- package/dist/chunks/SelectionTransactions-DNCzsl_b.mjs.map +1 -0
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs +2 -0
- package/dist/chunks/{SimpleMark-7CQcA4RK.mjs.map → SimpleMark-CTDtEIMV.mjs.map} +1 -1
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs +2 -0
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs.map +1 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs +2 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -0
- package/dist/chunks/{StrikethroughPlugin-C2oWvGc3.mjs → StrikethroughPlugin-d-EW2YYx.mjs} +2 -2
- package/dist/chunks/{StrikethroughPlugin-C2oWvGc3.mjs.map → StrikethroughPlugin-d-EW2YYx.mjs.map} +1 -1
- package/dist/chunks/StyleRuntime-C0RSqKzG.mjs +2 -0
- package/dist/chunks/{StyleRuntime-DW6omotc.mjs.map → StyleRuntime-C0RSqKzG.mjs.map} +1 -1
- package/dist/chunks/SuperSubPlugin-C-kvFQyx.mjs +2 -0
- package/dist/chunks/{SuperSubPlugin-D1xaKrSu.mjs.map → SuperSubPlugin-C-kvFQyx.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BcARMxQB.mjs +2 -0
- package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +1 -0
- package/dist/chunks/TablePlugin-B894cIXW.mjs +2 -0
- package/dist/chunks/{TablePlugin-PJe3zwr-.mjs.map → TablePlugin-B894cIXW.mjs.map} +1 -1
- package/dist/chunks/{TextColorPlugin-CTd9tfeG.mjs → TextColorPlugin-B6YoN9mR.mjs} +2 -2
- package/dist/chunks/{TextColorPlugin-CTd9tfeG.mjs.map → TextColorPlugin-B6YoN9mR.mjs.map} +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-LVDkKdDX.mjs +2 -0
- package/dist/chunks/{TextDirectionAutoPlugin-CPnKVVuI.mjs.map → TextDirectionAutoPlugin-LVDkKdDX.mjs.map} +1 -1
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs +2 -0
- package/dist/chunks/TextDirectionPlugin-CtGwof7i.mjs.map +1 -0
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
- package/dist/chunks/{TextDirectionService-BcX07mw2.mjs.map → TextDirectionService-OFOU6r_s.mjs.map} +1 -1
- package/dist/chunks/TextFormattingPlugin-DlS0SeW7.mjs +2 -0
- package/dist/chunks/{TextFormattingPlugin-DBVlePqj.mjs.map → TextFormattingPlugin-DlS0SeW7.mjs.map} +1 -1
- package/dist/chunks/ThemeEngine-D4W6Y80e.mjs +3 -0
- package/dist/chunks/ThemeEngine-D4W6Y80e.mjs.map +1 -0
- package/dist/chunks/ToolbarPlugin-ClKY-LiT.mjs +2 -0
- package/dist/chunks/{ToolbarPlugin-DtfGTO_V.mjs.map → ToolbarPlugin-ClKY-LiT.mjs.map} +1 -1
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +2 -0
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +1 -0
- package/dist/chunks/XmlSupport-3Za6SIqF.mjs +2 -0
- package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -0
- package/dist/chunks/full-CNi2CaF3.mjs +2 -0
- package/dist/chunks/{full-DSWM4cKQ.mjs.map → full-CNi2CaF3.mjs.map} +1 -1
- package/dist/chunks/minimal-Bykbo9So.mjs +2 -0
- package/dist/chunks/{minimal-CFkkPXef.mjs.map → minimal-Bykbo9So.mjs.map} +1 -1
- package/dist/chunks/register-CF80zDgl.mjs +3 -0
- package/dist/chunks/register-CF80zDgl.mjs.map +1 -0
- package/dist/chunks/src-5GKFQ2mQ.mjs +2 -0
- package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -0
- package/dist/chunks/xml-BsV44TrJ.mjs +2 -0
- package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -0
- package/dist/decorations/Decoration.d.ts +9 -0
- package/dist/decorations/Decoration.d.ts.map +1 -1
- package/dist/editor/ContentSerializer.d.ts +2 -7
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorEventEmitter.d.ts +10 -2
- package/dist/editor/EditorEventEmitter.d.ts.map +1 -1
- package/dist/editor/EditorInitializer.d.ts +2 -4
- package/dist/editor/EditorInitializer.d.ts.map +1 -1
- package/dist/editor/EditorLifecycleCoordinator.d.ts +16 -1
- package/dist/editor/EditorLifecycleCoordinator.d.ts.map +1 -1
- package/dist/editor/EditorStyleCoordinator.d.ts +11 -3
- package/dist/editor/EditorStyleCoordinator.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +15 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/fonts/math.d.ts +3 -0
- package/dist/fonts/math.d.ts.map +1 -0
- package/dist/fonts/math.mjs +1 -0
- package/dist/fonts/starter.d.ts +3 -0
- package/dist/fonts/starter.d.ts.map +1 -0
- package/dist/fonts/starter.mjs +1 -0
- package/dist/fonts.d.ts +4 -4
- package/dist/fonts.mjs +1 -1
- package/dist/full.d.ts +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +4 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +5 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts +4 -0
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts +7 -4
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +33 -6
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +3 -2
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/Document.d.ts +42 -0
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/DocumentNormalization.d.ts +10 -0
- package/dist/model/DocumentNormalization.d.ts.map +1 -0
- package/dist/model/FileHandlerDispatcher.d.ts +27 -0
- package/dist/model/FileHandlerDispatcher.d.ts.map +1 -0
- package/dist/model/FileHandlerRegistry.d.ts +6 -1
- package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
- package/dist/model/InputRuleRegistry.d.ts +9 -1
- package/dist/model/InputRuleRegistry.d.ts.map +1 -1
- package/dist/model/KeymapRegistry.d.ts +14 -1
- package/dist/model/KeymapRegistry.d.ts.map +1 -1
- package/dist/model/MarkdownSyntaxRegistry.d.ts +2 -0
- package/dist/model/MarkdownSyntaxRegistry.d.ts.map +1 -1
- package/dist/model/PluginCallbackExecutor.d.ts +44 -0
- package/dist/model/PluginCallbackExecutor.d.ts.map +1 -0
- package/dist/model/SanitizeConfig.d.ts +8 -0
- package/dist/model/SanitizeConfig.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +24 -0
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/Selection.d.ts +4 -0
- package/dist/model/Selection.d.ts.map +1 -1
- 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/plugins/Plugin.d.ts +3 -1
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +9 -2
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/PluginLifecycle.d.ts +6 -0
- package/dist/plugins/PluginLifecycle.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +9 -2
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/RegistrationTracker.d.ts +2 -0
- package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/bidi-isolation.mjs +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockHighlighting.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockSchema.d.ts +6 -2
- package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/FormulaPasteInterceptor.d.ts.map +1 -1
- package/dist/plugins/formula/FormulaTypes.d.ts +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.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/language.mjs +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListCommands.d.ts.map +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +9 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/NodeSpecPatching.d.ts +2 -2
- package/dist/plugins/shared/NodeSpecPatching.d.ts.map +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +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.mjs +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/plugins/video/VideoNodeSpec.d.ts.map +1 -1
- package/dist/plugins/video/VideoPlugin.d.ts.map +1 -1
- package/dist/plugins/video/VideoProviders.d.ts +3 -3
- package/dist/plugins/video/VideoSanitizeHook.d.ts +4 -20
- package/dist/plugins/video/VideoSanitizeHook.d.ts.map +1 -1
- package/dist/plugins/video.mjs +1 -1
- package/dist/presets/full.d.ts +1 -1
- package/dist/presets/full.mjs +1 -1
- package/dist/presets/minimal.d.ts +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.d.ts +3 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.mjs +1 -0
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/HTMLSanitization.d.ts +12 -0
- package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/Mapping.d.ts +2 -0
- package/dist/state/Mapping.d.ts.map +1 -1
- package/dist/state/StepHandlers.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +2 -0
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/state/TransactionFinalizer.d.ts +10 -0
- package/dist/state/TransactionFinalizer.d.ts.map +1 -0
- package/dist/state/TransactionSnapshot.d.ts +32 -0
- package/dist/state/TransactionSnapshot.d.ts.map +1 -0
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/BlockRendering.d.ts +13 -2
- package/dist/view/BlockRendering.d.ts.map +1 -1
- package/dist/view/DecorationRendering.d.ts +19 -8
- package/dist/view/DecorationRendering.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +4 -0
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts +8 -0
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/dist/view/NodeViewCallbackBoundary.d.ts +12 -0
- package/dist/view/NodeViewCallbackBoundary.d.ts.map +1 -0
- package/dist/view/NodeViewOwnership.d.ts +12 -0
- package/dist/view/NodeViewOwnership.d.ts.map +1 -0
- package/dist/view/NodeViewRegistry.d.ts +7 -1
- package/dist/view/NodeViewRegistry.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts +6 -0
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +29 -228
- package/dist/chunks/AlignmentPlugin--xAFlRqE.mjs +0 -2
- package/dist/chunks/AlignmentPlugin--xAFlRqE.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-bagbH8Qt.mjs +0 -2
- package/dist/chunks/AttributedMarkCommands-bagbH8Qt.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-CJusvrDL.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-Bz2glHwX.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-CNsT0eb4.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-CNsT0eb4.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-C1hrdbSZ.mjs +0 -2
- package/dist/chunks/ColorGrid-C9RQoEWF.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-DiA68Pzz.mjs +0 -2
- package/dist/chunks/ColorValidation-DAijTjG9.mjs +0 -2
- package/dist/chunks/Commands-1dFFldi7.mjs +0 -2
- package/dist/chunks/Commands-1dFFldi7.mjs.map +0 -1
- package/dist/chunks/ContentModel-NpAj7vGW.mjs +0 -2
- package/dist/chunks/Decoration-BpoEOANl.mjs +0 -2
- package/dist/chunks/Decoration-BpoEOANl.mjs.map +0 -1
- package/dist/chunks/Document-827l3P80.mjs +0 -2
- package/dist/chunks/Document-827l3P80.mjs.map +0 -1
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs +0 -2
- package/dist/chunks/DocumentParser-D2tr3ZKn.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-Dln-tYXV.mjs +0 -2
- package/dist/chunks/FormulaPlugin-By1befrR.mjs +0 -2
- package/dist/chunks/FormulaPlugin-By1befrR.mjs.map +0 -1
- package/dist/chunks/GapCursorNavigation-BuXngVu-.mjs +0 -2
- package/dist/chunks/GapCursorNavigation-BuXngVu-.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-DAxVzXRs.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-DAxVzXRs.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +0 -2
- package/dist/chunks/HardBreakPlugin-DlbSlrdq.mjs +0 -2
- package/dist/chunks/HeadingPlugin-uMAjPOk5.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-pISIoGQE.mjs +0 -2
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs +0 -2
- package/dist/chunks/ListPlugin-DAY5ezNs.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-CKEx7LkR.mjs +0 -2
- package/dist/chunks/MarkdownParser-CWt3M6jR.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-J-i28out.mjs +0 -2
- package/dist/chunks/NodeSelectionCommands-1PjwUDTJ.mjs +0 -2
- package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs +0 -2
- package/dist/chunks/NodeSpecPatching-B_yLknTl.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-Dx_0hfDe.mjs +0 -2
- package/dist/chunks/PopupKeyboardPatterns-tUrT9TyV.mjs +0 -2
- package/dist/chunks/PopupManager-CT-fMZJn.mjs +0 -2
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs +0 -2
- package/dist/chunks/PrintPlugin-7zz9mhhU.mjs.map +0 -1
- package/dist/chunks/PrintTypes-CxU69qu3.mjs +0 -3
- package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +0 -1
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs +0 -2
- package/dist/chunks/SchemaRegistry-CkBN-1yW.mjs.map +0 -1
- package/dist/chunks/Selection-HYoVFpAx.mjs +0 -2
- package/dist/chunks/Selection-HYoVFpAx.mjs.map +0 -1
- package/dist/chunks/SimpleMark-7CQcA4RK.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-CYa_nD9v.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-CYa_nD9v.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-DW6omotc.mjs +0 -2
- package/dist/chunks/SuperSubPlugin-D1xaKrSu.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +0 -1
- package/dist/chunks/TablePlugin-PJe3zwr-.mjs +0 -2
- package/dist/chunks/TextDirectionAutoPlugin-CPnKVVuI.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-Bns_03vL.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-Bns_03vL.mjs.map +0 -1
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
- package/dist/chunks/TextFormattingPlugin-DBVlePqj.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-DtfGTO_V.mjs +0 -2
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs +0 -2
- package/dist/chunks/VideoPlugin-BrR8g6Rz.mjs.map +0 -1
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs +0 -2
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs.map +0 -1
- package/dist/chunks/XmlDetector-D7TQpw-e.mjs +0 -2
- package/dist/chunks/XmlDetector-D7TQpw-e.mjs.map +0 -1
- package/dist/chunks/XmlSupport-BYiRwlkK.mjs +0 -2
- package/dist/chunks/XmlSupport-BYiRwlkK.mjs.map +0 -1
- package/dist/chunks/fonts-DQC6Uj4r.mjs +0 -2
- package/dist/chunks/fonts-DQC6Uj4r.mjs.map +0 -1
- package/dist/chunks/full-DSWM4cKQ.mjs +0 -2
- package/dist/chunks/minimal-CFkkPXef.mjs +0 -2
- package/dist/chunks/src-DiAOfuOT.mjs +0 -2
- package/dist/chunks/src-DiAOfuOT.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notectl/core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "A modern and accessible rich text editor shipped as a single Web Component. Immutable state, transaction-based architecture, and a plugin system that powers every feature.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"sideEffects": [
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"./dist/notectl-core.mjs",
|
|
9
|
+
"./dist/register.mjs",
|
|
10
|
+
"./dist/chunks/*register*.mjs",
|
|
11
|
+
"./dist/full.mjs",
|
|
12
|
+
"./dist/notectl-core.umd.js"
|
|
13
|
+
],
|
|
8
14
|
"main": "./dist/notectl-core.umd.js",
|
|
9
15
|
"module": "./dist/notectl-core.mjs",
|
|
10
16
|
"types": "./dist/index.d.ts",
|
|
@@ -13,6 +19,10 @@
|
|
|
13
19
|
"types": "./dist/index.d.ts",
|
|
14
20
|
"import": "./dist/notectl-core.mjs"
|
|
15
21
|
},
|
|
22
|
+
"./register": {
|
|
23
|
+
"types": "./dist/register.d.ts",
|
|
24
|
+
"import": "./dist/register.mjs"
|
|
25
|
+
},
|
|
16
26
|
"./full": {
|
|
17
27
|
"types": "./dist/full.d.ts",
|
|
18
28
|
"import": "./dist/full.mjs",
|
|
@@ -42,6 +52,14 @@
|
|
|
42
52
|
"types": "./dist/fonts.d.ts",
|
|
43
53
|
"import": "./dist/fonts.mjs"
|
|
44
54
|
},
|
|
55
|
+
"./fonts/starter": {
|
|
56
|
+
"types": "./dist/fonts/starter.d.ts",
|
|
57
|
+
"import": "./dist/fonts/starter.mjs"
|
|
58
|
+
},
|
|
59
|
+
"./fonts/math": {
|
|
60
|
+
"types": "./dist/fonts/math.d.ts",
|
|
61
|
+
"import": "./dist/fonts/math.mjs"
|
|
62
|
+
},
|
|
45
63
|
"./plugins/text-formatting": {
|
|
46
64
|
"types": "./dist/plugins/text-formatting/index.d.ts",
|
|
47
65
|
"import": "./dist/plugins/text-formatting.mjs"
|
|
@@ -164,7 +182,7 @@
|
|
|
164
182
|
}
|
|
165
183
|
},
|
|
166
184
|
"customElements": "custom-elements.json",
|
|
167
|
-
"files": ["dist", "README.md", "LICENSE", "custom-elements.json"],
|
|
185
|
+
"files": ["dist", "README.md", "LICENSE", "THIRD-PARTY-NOTICES.md", "custom-elements.json"],
|
|
168
186
|
"keywords": [
|
|
169
187
|
"rich-text-editor",
|
|
170
188
|
"web-component",
|
|
@@ -193,237 +211,20 @@
|
|
|
193
211
|
"test:watch": "vitest",
|
|
194
212
|
"typecheck": "tsc --noEmit",
|
|
195
213
|
"dev": "vite build --watch",
|
|
196
|
-
"size": "size
|
|
197
|
-
"size:check": "size
|
|
214
|
+
"size": "node scripts/check-bundle-size.mjs",
|
|
215
|
+
"size:check": "node scripts/check-bundle-size.mjs",
|
|
198
216
|
"build:analyze": "ANALYZE=true vite build"
|
|
199
217
|
},
|
|
200
|
-
"size-limit": [
|
|
201
|
-
{
|
|
202
|
-
"name": "Core (main entry)",
|
|
203
|
-
"path": "dist/notectl-core.mjs",
|
|
204
|
-
"limit": "76 KB",
|
|
205
|
-
"ignore": ["dompurify", "./MarkdownSerializer-*", "./MarkdownParser-*"],
|
|
206
|
-
"gzip": true
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"name": "Presets (minimal)",
|
|
210
|
-
"path": "dist/presets/minimal.mjs",
|
|
211
|
-
"limit": "8 KB",
|
|
212
|
-
"gzip": true
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"name": "Presets (full)",
|
|
216
|
-
"path": "dist/presets/full.mjs",
|
|
217
|
-
"limit": "92 KB",
|
|
218
|
-
"gzip": true
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
"name": "HTML (serializer/parser)",
|
|
222
|
-
"path": "dist/html.mjs",
|
|
223
|
-
"limit": "15 KB",
|
|
224
|
-
"ignore": ["dompurify"],
|
|
225
|
-
"gzip": true
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
"name": "Markdown (serializer/parser)",
|
|
229
|
-
"path": "dist/markdown.mjs",
|
|
230
|
-
"limit": "18 KB",
|
|
231
|
-
"ignore": ["dompurify"],
|
|
232
|
-
"gzip": true
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"name": "Fonts (standalone)",
|
|
236
|
-
"path": "dist/fonts.mjs",
|
|
237
|
-
"limit": "300 KB",
|
|
238
|
-
"gzip": true
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
"name": "Plugin: Table",
|
|
242
|
-
"path": "dist/plugins/table.mjs",
|
|
243
|
-
"limit": "22 KB",
|
|
244
|
-
"gzip": true
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
"name": "Plugin: Text Formatting",
|
|
248
|
-
"path": "dist/plugins/text-formatting.mjs",
|
|
249
|
-
"limit": "10 KB",
|
|
250
|
-
"gzip": true
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
"name": "Plugin: Heading",
|
|
254
|
-
"path": "dist/plugins/heading.mjs",
|
|
255
|
-
"limit": "10 KB",
|
|
256
|
-
"gzip": true
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"name": "Plugin: Toolbar",
|
|
260
|
-
"path": "dist/plugins/toolbar.mjs",
|
|
261
|
-
"limit": "15 KB",
|
|
262
|
-
"gzip": true
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
"name": "Plugin: Shared",
|
|
266
|
-
"path": "dist/plugins/shared.mjs",
|
|
267
|
-
"limit": "15 KB",
|
|
268
|
-
"gzip": true
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"name": "Plugin: Image",
|
|
272
|
-
"path": "dist/plugins/image.mjs",
|
|
273
|
-
"limit": "15 KB",
|
|
274
|
-
"gzip": true
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"name": "Plugin: Video",
|
|
278
|
-
"path": "dist/plugins/video.mjs",
|
|
279
|
-
"limit": "25 KB",
|
|
280
|
-
"ignore": ["dompurify"],
|
|
281
|
-
"gzip": true
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"name": "Plugin: Code Block",
|
|
285
|
-
"path": "dist/plugins/code-block.mjs",
|
|
286
|
-
"limit": "18 KB",
|
|
287
|
-
"gzip": true
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"name": "Plugin: Smart Paste",
|
|
291
|
-
"path": "dist/plugins/smart-paste.mjs",
|
|
292
|
-
"limit": "6 KB",
|
|
293
|
-
"gzip": true
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"name": "Plugin: Link",
|
|
297
|
-
"path": "dist/plugins/link.mjs",
|
|
298
|
-
"limit": "10 KB",
|
|
299
|
-
"gzip": true
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"name": "Plugin: List",
|
|
303
|
-
"path": "dist/plugins/list.mjs",
|
|
304
|
-
"limit": "10 KB",
|
|
305
|
-
"gzip": true
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"name": "Plugin: Blockquote",
|
|
309
|
-
"path": "dist/plugins/blockquote.mjs",
|
|
310
|
-
"limit": "5 KB",
|
|
311
|
-
"gzip": true
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"name": "Plugin: Strikethrough",
|
|
315
|
-
"path": "dist/plugins/strikethrough.mjs",
|
|
316
|
-
"limit": "5 KB",
|
|
317
|
-
"gzip": true
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
"name": "Plugin: Inline Code",
|
|
321
|
-
"path": "dist/plugins/inline-code.mjs",
|
|
322
|
-
"limit": "5 KB",
|
|
323
|
-
"gzip": true
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"name": "Plugin: Text Color",
|
|
327
|
-
"path": "dist/plugins/text-color.mjs",
|
|
328
|
-
"limit": "10 KB",
|
|
329
|
-
"gzip": true
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
"name": "Plugin: Horizontal Rule",
|
|
333
|
-
"path": "dist/plugins/horizontal-rule.mjs",
|
|
334
|
-
"limit": "5 KB",
|
|
335
|
-
"gzip": true
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
"name": "Plugin: Alignment",
|
|
339
|
-
"path": "dist/plugins/alignment.mjs",
|
|
340
|
-
"limit": "10 KB",
|
|
341
|
-
"gzip": true
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
"name": "Plugin: Font",
|
|
345
|
-
"path": "dist/plugins/font.mjs",
|
|
346
|
-
"limit": "10 KB",
|
|
347
|
-
"gzip": true
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
"name": "Plugin: Font Size",
|
|
351
|
-
"path": "dist/plugins/font-size.mjs",
|
|
352
|
-
"limit": "10 KB",
|
|
353
|
-
"gzip": true
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"name": "Plugin: Highlight",
|
|
357
|
-
"path": "dist/plugins/highlight.mjs",
|
|
358
|
-
"limit": "10 KB",
|
|
359
|
-
"gzip": true
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
"name": "Plugin: Super/Sub",
|
|
363
|
-
"path": "dist/plugins/super-sub.mjs",
|
|
364
|
-
"limit": "5 KB",
|
|
365
|
-
"gzip": true
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
"name": "Plugin: Print",
|
|
369
|
-
"path": "dist/plugins/print.mjs",
|
|
370
|
-
"limit": "16 KB",
|
|
371
|
-
"gzip": true
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
"name": "Plugin: Hard Break",
|
|
375
|
-
"path": "dist/plugins/hard-break.mjs",
|
|
376
|
-
"limit": "2 KB",
|
|
377
|
-
"gzip": true
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
"name": "Plugin: Gap Cursor",
|
|
381
|
-
"path": "dist/plugins/gap-cursor.mjs",
|
|
382
|
-
"limit": "3 KB",
|
|
383
|
-
"gzip": true
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
"name": "Plugin: Caret Navigation",
|
|
387
|
-
"path": "dist/plugins/caret-navigation.mjs",
|
|
388
|
-
"limit": "7 KB",
|
|
389
|
-
"gzip": true
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
"name": "Plugin: Text Direction",
|
|
393
|
-
"path": "dist/plugins/text-direction.mjs",
|
|
394
|
-
"limit": "5 KB",
|
|
395
|
-
"gzip": true
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
"name": "Plugin: Bidi Isolation",
|
|
399
|
-
"path": "dist/plugins/bidi-isolation.mjs",
|
|
400
|
-
"limit": "5 KB",
|
|
401
|
-
"gzip": true
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
"name": "Plugin: Text Direction Auto",
|
|
405
|
-
"path": "dist/plugins/text-direction-auto.mjs",
|
|
406
|
-
"limit": "4 KB",
|
|
407
|
-
"gzip": true
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
"name": "Full (kitchen sink)",
|
|
411
|
-
"path": "dist/full.mjs",
|
|
412
|
-
"limit": "390 KB",
|
|
413
|
-
"gzip": true
|
|
414
|
-
}
|
|
415
|
-
],
|
|
416
218
|
"dependencies": {
|
|
417
|
-
"dompurify": "^3.4.
|
|
219
|
+
"dompurify": "^3.4.13"
|
|
418
220
|
},
|
|
419
221
|
"devDependencies": {
|
|
420
|
-
"
|
|
421
|
-
"happy-dom": "^20.
|
|
222
|
+
"esbuild": "^0.28.1",
|
|
223
|
+
"happy-dom": "^20.11.1",
|
|
422
224
|
"rollup-plugin-visualizer": "^7.0.1",
|
|
423
|
-
"
|
|
424
|
-
"
|
|
425
|
-
"vite": "^8.0.16",
|
|
225
|
+
"terser": "^5.49.2",
|
|
226
|
+
"vite": "^8.2.0",
|
|
426
227
|
"vite-plugin-dts": "^4.5.4",
|
|
427
|
-
"vitest": "^4.1.
|
|
228
|
+
"vitest": "^4.1.10"
|
|
428
229
|
}
|
|
429
230
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as t}from"./StyleRuntime-DW6omotc.mjs";import{a as e,c as s,n as i,o as n,r as a,t as l}from"./PluginHelpers-Dx_0hfDe.mjs";import{t as o}from"./NodeSpecPatching-B_yLknTl.mjs";var r={alignStart:"Align Start",alignCenter:"Align Center",alignEnd:"Align End",justify:"Justify",toolbarLabel:"Alignment",toolbarTooltip:"Alignment"},g=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Bdmunk5h.mjs"),"./locales/de.ts":()=>import("./de-B8-w9gPi.mjs"),"./locales/es.ts":()=>import("./es-B8K3Yvf3.mjs"),"./locales/fr.ts":()=>import("./fr-BeRlON1t.mjs"),"./locales/hi.ts":()=>import("./hi-Bl-yeeOI.mjs"),"./locales/pt.ts":()=>import("./pt-5VeuNDd2.mjs"),"./locales/ru.ts":()=>import("./ru-Yngw7nFP.mjs"),"./locales/zh.ts":()=>import("./zh-BvuAbM2S.mjs")});async function m(t){return s(g,t,r)}var c={alignments:["start","center","end","justify"],alignableTypes:["paragraph","heading","title","subtitle","table_cell","image"],defaults:{image:"center"}},h={start:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"/></svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"/></svg>',end:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"/></svg>',justify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z"/></svg>'},p=class{id="alignment";name="Alignment";priority=90;config;locale;alignableTypes;constructor(t){this.config={...c,...t,defaults:{...c.defaults,...t?.defaults}}}async init(t){this.locale=await n(t,this.config.locale,r,m),this.alignableTypes=new Set(this.config.alignableTypes),this.patchNodeSpecs(t),this.registerCommands(t),this.registerKeymaps(t),this.registerToolbarItem(t),this.registerMiddleware(t)}patchNodeSpecs(t){o(t.getSchemaRegistry(),this.config.alignableTypes,{attrName:"align",getDefault:t=>this.config.defaults[t]??"start",applyToDOM:d})}registerCommands(t){for(const e of this.config.alignments)t.registerCommand(`align${l(e)}`,()=>this.setAlignment(t,e))}registerKeymaps(t){const e={};this.config.alignments.includes("start")&&(e["Mod-Shift-L"]=()=>t.executeCommand("alignStart")),this.config.alignments.includes("center")&&(e["Mod-Shift-E"]=()=>t.executeCommand("alignCenter")),this.config.alignments.includes("end")&&(e["Mod-Shift-R"]=()=>t.executeCommand("alignEnd")),this.config.alignments.includes("justify")&&(e["Mod-Shift-J"]=()=>t.executeCommand("alignJustify")),Object.keys(e).length>0&&t.registerKeymap(e)}registerToolbarItem(t){const e=this.config.alignments.map(t=>({label:this.getAlignmentLabel(t),command:`align${l(t)}`,icon:h[t]}));t.registerToolbarItem({id:"alignment",group:"block",icon:h.start,label:this.locale.toolbarLabel,tooltip:this.locale.toolbarTooltip,command:"alignStart",popupType:"dropdown",popupConfig:{items:e},isActive:t=>this.isNonDefaultAlignment(t),isEnabled:t=>this.isAlignable(t)})}getAlignmentLabel(t){return{start:this.locale.alignStart,center:this.locale.alignCenter,end:this.locale.alignEnd,justify:this.locale.justify}[t]}registerMiddleware(t){t.registerMiddleware((t,e,s)=>{let i=!1;const n=t.steps.map(t=>{if("setBlockType"!==t.type)return t;if(!this.alignableTypes.has(t.nodeType))return t;const e=t.previousAttrs?.align;return e&&"start"!==e?(i=!0,{...t,attrs:{...t.attrs,align:e}}):t});s(i?{...t,steps:n}:t)},{name:"alignment:preserve-align"})}setAlignment(t,s){const n=t.getState(),a=e(n);if(0===a.length)return!1;const l=n.transaction("command");let o=!1;for(const e of a){const t=n.getBlock(e);if(!t||!this.alignableTypes.has(t.type))continue;const i=n.getNodePath(e);i&&(l.setNodeAttr(i,{...t.attrs,align:s}),o=!0)}return!!o&&i(t,l.setSelection(n.selection).build())}isNonDefaultAlignment(t){const e=a(t);if(!e||!this.alignableTypes.has(e.type))return!1;const s=e.attrs?.align,i=this.config.defaults[e.type]??"start";return null!=s&&s!==i}isAlignable(t){const e=a(t);return null!=e&&this.alignableTypes.has(e.type)}};function d(e,s){const i=s.attrs?.align;"string"==typeof i&&"start"!==i&&t(e,"textAlign",i)}export{m as i,p as n,r,h as t};
|
|
2
|
-
//# sourceMappingURL=AlignmentPlugin--xAFlRqE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlignmentPlugin--xAFlRqE.mjs","names":[],"sources":["../../src/plugins/alignment/AlignmentLocale.ts","../../src/plugins/alignment/AlignmentPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the AlignmentPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\nexport interface AlignmentLocale {\n\treadonly alignStart: string;\n\treadonly alignCenter: string;\n\treadonly alignEnd: string;\n\treadonly justify: string;\n\treadonly toolbarLabel: string;\n\treadonly toolbarTooltip: string;\n}\n\n// --- Default English Locale ---\n\nexport const ALIGNMENT_LOCALE_EN: AlignmentLocale = {\n\talignStart: 'Align Start',\n\talignCenter: 'Align Center',\n\talignEnd: 'Align End',\n\tjustify: 'Justify',\n\ttoolbarLabel: 'Alignment',\n\ttoolbarTooltip: 'Alignment',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<AlignmentLocale> = import.meta.glob<{\n\tdefault: AlignmentLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadAlignmentLocale(lang: string): Promise<AlignmentLocale> {\n\treturn loadLocaleModule(localeModules, lang, ALIGNMENT_LOCALE_EN);\n}\n","/**\n * AlignmentPlugin: adds start/center/end/justify alignment as a block\n * attribute on paragraphs, headings, images, and other alignable types.\n * Uses logical values (`start`/`end`) instead of physical (`left`/`right`)\n * for correct behavior with RTL text direction. Patches NodeSpecs to render\n * the `align` attribute via inline `text-align` style and provides toggle\n * commands, keyboard shortcuts, and a toolbar dropdown.\n */\n\nimport type { BlockAlignment } from '../../model/BlockAlignment.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { patchNodeSpecAttr } from '../shared/NodeSpecPatching.js';\nimport {\n\tcapitalize,\n\tdispatchIfPresent,\n\tgetSelectedBlock,\n\tgetSelectedBlockIds,\n\tresolveLocale,\n} from '../shared/PluginHelpers.js';\nimport {\n\tALIGNMENT_LOCALE_EN,\n\ttype AlignmentLocale,\n\tloadAlignmentLocale,\n} from './AlignmentLocale.js';\n\n// --- Public Types ---\n\nexport interface AlignmentConfig {\n\t/** Which alignments to expose. Defaults to all four. */\n\treadonly alignments: readonly BlockAlignment[];\n\t/** Block types that support alignment. Defaults to paragraph + heading + title + subtitle + table_cell + image. */\n\treadonly alignableTypes: readonly string[];\n\t/** Per-type default alignment (e.g. `{ image: 'center' }`). Falls back to `'start'`. */\n\treadonly defaults: Readonly<Record<string, BlockAlignment>>;\n\treadonly locale?: AlignmentLocale;\n}\n\n// --- Constants ---\n\nconst DEFAULT_CONFIG: AlignmentConfig = {\n\talignments: ['start', 'center', 'end', 'justify'],\n\talignableTypes: ['paragraph', 'heading', 'title', 'subtitle', 'table_cell', 'image'],\n\tdefaults: { image: 'center' },\n};\n\nexport const ALIGNMENT_ICONS: Readonly<Record<BlockAlignment, string>> = {\n\tstart:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z\"/></svg>',\n\tcenter:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z\"/></svg>',\n\tend: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z\"/></svg>',\n\tjustify:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z\"/></svg>',\n};\n\n// --- Plugin ---\n\nexport class AlignmentPlugin implements Plugin {\n\treadonly id = 'alignment';\n\treadonly name = 'Alignment';\n\treadonly priority = 90;\n\n\tprivate readonly config: AlignmentConfig;\n\tprivate locale!: AlignmentLocale;\n\tprivate alignableTypes!: ReadonlySet<string>;\n\n\tconstructor(config?: Partial<AlignmentConfig>) {\n\t\tthis.config = {\n\t\t\t...DEFAULT_CONFIG,\n\t\t\t...config,\n\t\t\tdefaults: { ...DEFAULT_CONFIG.defaults, ...config?.defaults },\n\t\t};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tALIGNMENT_LOCALE_EN,\n\t\t\tloadAlignmentLocale,\n\t\t);\n\n\t\tthis.alignableTypes = new Set(this.config.alignableTypes);\n\t\tthis.patchNodeSpecs(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.registerMiddleware(context);\n\t}\n\n\t// --- NodeSpec Patching ---\n\n\t/**\n\t * Patches existing NodeSpecs for alignable block types to support the\n\t * `align` attribute and render it as an inline style. Skips types\n\t * that already define an `align` attribute in their spec.\n\t */\n\tprivate patchNodeSpecs(context: PluginContext): void {\n\t\tpatchNodeSpecAttr(context.getSchemaRegistry(), this.config.alignableTypes, {\n\t\t\tattrName: 'align',\n\t\t\tgetDefault: (type) => this.config.defaults[type] ?? 'start',\n\t\t\tapplyToDOM: applyAlignment,\n\t\t});\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tfor (const alignment of this.config.alignments) {\n\t\t\tcontext.registerCommand(`align${capitalize(alignment)}`, () => {\n\t\t\t\treturn this.setAlignment(context, alignment);\n\t\t\t});\n\t\t}\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tconst bindings: Record<string, () => boolean> = {};\n\n\t\tif (this.config.alignments.includes('start')) {\n\t\t\tbindings['Mod-Shift-L'] = () => context.executeCommand('alignStart');\n\t\t}\n\t\tif (this.config.alignments.includes('center')) {\n\t\t\tbindings['Mod-Shift-E'] = () => context.executeCommand('alignCenter');\n\t\t}\n\t\tif (this.config.alignments.includes('end')) {\n\t\t\tbindings['Mod-Shift-R'] = () => context.executeCommand('alignEnd');\n\t\t}\n\t\tif (this.config.alignments.includes('justify')) {\n\t\t\tbindings['Mod-Shift-J'] = () => context.executeCommand('alignJustify');\n\t\t}\n\n\t\tif (Object.keys(bindings).length > 0) {\n\t\t\tcontext.registerKeymap(bindings);\n\t\t}\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst dropdownItems = this.config.alignments.map((alignment) => ({\n\t\t\tlabel: this.getAlignmentLabel(alignment),\n\t\t\tcommand: `align${capitalize(alignment)}`,\n\t\t\ticon: ALIGNMENT_ICONS[alignment],\n\t\t}));\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'alignment',\n\t\t\tgroup: 'block',\n\t\t\ticon: ALIGNMENT_ICONS.start,\n\t\t\tlabel: this.locale.toolbarLabel,\n\t\t\ttooltip: this.locale.toolbarTooltip,\n\t\t\tcommand: 'alignStart',\n\t\t\tpopupType: 'dropdown',\n\t\t\tpopupConfig: { items: dropdownItems },\n\t\t\tisActive: (state) => this.isNonDefaultAlignment(state),\n\t\t\tisEnabled: (state) => this.isAlignable(state),\n\t\t});\n\t}\n\n\tprivate getAlignmentLabel(alignment: BlockAlignment): string {\n\t\tconst labels: Record<BlockAlignment, string> = {\n\t\t\tstart: this.locale.alignStart,\n\t\t\tcenter: this.locale.alignCenter,\n\t\t\tend: this.locale.alignEnd,\n\t\t\tjustify: this.locale.justify,\n\t\t};\n\t\treturn labels[alignment];\n\t}\n\n\t// --- Middleware ---\n\n\t/**\n\t * Preserves the `align` attribute when other plugins change the block\n\t * type (e.g. paragraph → heading) via `setBlockType`, which replaces attrs.\n\t */\n\tprivate registerMiddleware(context: PluginContext): void {\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, _state, next) => {\n\t\t\t\tlet patched = false;\n\n\t\t\t\tconst patchedSteps = tr.steps.map((step) => {\n\t\t\t\t\tif (step.type !== 'setBlockType') return step;\n\t\t\t\t\tif (!this.alignableTypes.has(step.nodeType)) return step;\n\n\t\t\t\t\tconst prevAlign = step.previousAttrs?.align;\n\t\t\t\t\tif (!prevAlign || prevAlign === 'start') return step;\n\n\t\t\t\t\t// Carry forward align into new attrs\n\t\t\t\t\tpatched = true;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...step,\n\t\t\t\t\t\tattrs: { ...step.attrs, align: prevAlign },\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps } : tr);\n\t\t\t},\n\t\t\t{ name: 'alignment:preserve-align' },\n\t\t);\n\t}\n\n\t// --- Alignment Logic ---\n\n\t/**\n\t * Applies `alignment` to every alignable block in the current selection in\n\t * a single transaction. A multi-block selection aligns all of its blocks,\n\t * not just the anchor; non-alignable blocks in the range are left untouched.\n\t */\n\tprivate setAlignment(context: PluginContext, alignment: BlockAlignment): boolean {\n\t\tconst state = context.getState();\n\t\tconst blockIds: BlockId[] = getSelectedBlockIds(state);\n\t\tif (blockIds.length === 0) return false;\n\n\t\tconst tb = state.transaction('command');\n\t\tlet changed = false;\n\n\t\tfor (const id of blockIds) {\n\t\t\tconst block = state.getBlock(id);\n\t\t\tif (!block || !this.alignableTypes.has(block.type)) continue;\n\n\t\t\tconst path = state.getNodePath(id);\n\t\t\tif (!path) continue;\n\n\t\t\ttb.setNodeAttr(path, { ...block.attrs, align: alignment });\n\t\t\tchanged = true;\n\t\t}\n\n\t\tif (!changed) return false;\n\n\t\treturn dispatchIfPresent(context, tb.setSelection(state.selection).build());\n\t}\n\n\tprivate isNonDefaultAlignment(state: EditorState): boolean {\n\t\tconst block = getSelectedBlock(state);\n\t\tif (!block || !this.alignableTypes.has(block.type)) return false;\n\t\tconst align = block.attrs?.align;\n\t\tconst defaultAlign: BlockAlignment = this.config.defaults[block.type] ?? 'start';\n\t\treturn align != null && align !== defaultAlign;\n\t}\n\n\tprivate isAlignable(state: EditorState): boolean {\n\t\tconst block = getSelectedBlock(state);\n\t\treturn block != null && this.alignableTypes.has(block.type);\n\t}\n}\n\n// --- Helpers ---\n\nfunction applyAlignment(el: HTMLElement, node: BlockNode): void {\n\tconst align = node.attrs?.align;\n\tif (typeof align === 'string' && align !== 'start') {\n\t\tsetStyleProperty(el, 'textAlign', align);\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{D as t,S as n,b as o,g as e,y as r}from"./Document-827l3P80.mjs";import{d as s,o as c,u as i}from"./Selection-HYoVFpAx.mjs";import{i as a}from"./TypeBrands-Ch9856Gb.mjs";import{n as l}from"./AttrRegistry-B3zB02z9.mjs";import{n as u}from"./RangeIterator-DP7Ud3Gp.mjs";function f(t,n){return!1!==t.getMarkSpec?.(n)?.inclusive}function m(t){if(t.storedMarks)return t.storedMarks;const n=t.selection;if(!i(n)||!c(n))return[];const o=t.getBlock(n.anchor.blockId);return o?r(o,n.anchor.offset,n=>f(t.schema,n)):[]}function d(t,n){const o=t.selection;if(!i(o))return null;const e=a(n.type);if(c(o)){if(!t.getBlock(o.anchor.blockId))return null;const r=[...m(t).filter(t=>t.type!==e),n];return t.transaction("command").setStoredMarks(r,t.storedMarks).setSelection(o).build()}const r=s(o,t.getBlockOrder()),l=t.transaction("command");return u(t,r,(o,r,s)=>{const c=t.getBlock(o);if(c){const t=M(c,e,r,s);t&&l.removeMark(o,r,s,t)}l.addMark(o,r,s,n)}),l.setSelection(o),l.build()}function k(t,o){const e=t.selection;if(!i(e))return null;if(c(e)){if(!t.getBlock(e.anchor.blockId))return null;const r=m(t);if(!n(r,o))return null;const s=r.filter(t=>t.type!==o);return t.transaction("command").setStoredMarks(s,t.storedMarks).setSelection(e).build()}const r=s(e,t.getBlockOrder()),a=t.transaction("command");return u(t,r,(n,e,r)=>{const s=t.getBlock(n),c=s?M(s,o,e,r):void 0;a.removeMark(n,e,r,c??{type:o})}),a.setSelection(e),a.build()}function p(t,n,o){const r=t.selection;if(!i(r))return null;let s;if(c(r))s=m(t);else{const n=t.getBlock(r.anchor.blockId);if(!n)return null;s=e(n,r.anchor.offset)}const a=s.find(t=>t.type===n);return a&&l(a,n)?o(a):null}function g(t,n){return null!==p(t,n,()=>!0)}function M(n,e,r,s){const c=o(n);let i=0;for(const o of c){if(!t(o)){i+=1;continue}const n=i+o.text.length;if(n>r&&i<s){const t=o.marks.find(t=>t.type===e);if(t)return t}i=n}}export{f as a,k as i,p as n,m as o,g as r,d as t};
|
|
2
|
-
//# sourceMappingURL=AttributedMarkCommands-bagbH8Qt.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AttributedMarkCommands-bagbH8Qt.mjs","names":[],"sources":["../../src/commands/CursorMarks.ts","../../src/commands/AttributedMarkCommands.ts"],"sourcesContent":["/**\n * Resolves the marks active at a collapsed cursor for insertion and toolbar\n * state. Centralizes the `storedMarks ?? derived-marks` lookup that several\n * command modules previously duplicated, and makes that derivation honor\n * mark inclusivity (see {@link MarkSpec.inclusive}) so non-inclusive marks\n * such as links do not bleed onto text typed at their right boundary.\n */\n\nimport type { Mark } from '../model/Document.js';\nimport { getCursorMarks } from '../model/Document.js';\nimport type { Schema } from '../model/Schema.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { MarkTypeName } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\n\n/** A mark extends onto adjacent typing unless its spec opts out via `inclusive: false`. */\nexport function isMarkInclusive(schema: Schema, type: MarkTypeName): boolean {\n\treturn schema.getMarkSpec?.(type)?.inclusive !== false;\n}\n\n/**\n * Returns the marks a collapsed cursor carries: stored marks when present,\n * otherwise the inclusivity-aware marks derived from the surrounding content.\n * Returns an empty set for non-text or non-collapsed selections.\n */\nexport function resolveCursorMarks(state: EditorState): readonly Mark[] {\n\tif (state.storedMarks) return state.storedMarks;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel) || !isCollapsed(sel)) return [];\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return [];\n\n\treturn getCursorMarks(block, sel.anchor.offset, (type) => isMarkInclusive(state.schema, type));\n}\n","/**\n * Generic helpers for attributed marks (marks with key/value attrs).\n *\n * Unlike boolean marks (`bold`, `italic`) that toggle on/off, attributed\n * marks (`font`, `fontSize`, `textColor`, `highlight`) carry data and use\n * **replace** semantics: applying a new value removes the old one first.\n *\n * These helpers extract the duplicated collapsed-vs-range branching that\n * was previously copy-pasted across ColorMarkOperations, FontSizeOperations,\n * and FontPlugin.\n */\n\nimport { isMarkOfType } from '../model/AttrRegistry.js';\nimport type { MarkAttrRegistry } from '../model/AttrRegistry.js';\nimport type { BlockNode, Mark, TextNode } from '../model/Document.js';\nimport {\n\tgetBlockMarksAtOffset,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport type { InlineNode } from '../model/Document.js';\nimport { isCollapsed, isTextSelection, selectionRange } from '../model/Selection.js';\nimport { markType } from '../model/TypeBrands.js';\nimport type { MarkTypeName } 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/**\n * Applies an attributed mark to the current selection.\n *\n * - **Collapsed cursor**: replaces stored marks (filters out old mark of the\n * same type, appends the new one).\n * - **Range selection**: removes then re-adds the mark in every block span.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported (node-selection / gap-cursor) or the anchor block is missing.\n */\nexport function applyAttributedMark(state: EditorState, mark: Mark): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst typeName: MarkTypeName = markType(mark.type as string);\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] = resolveCursorMarks(state);\n\t\tconst withoutMark: readonly Mark[] = currentMarks.filter((m) => m.type !== typeName);\n\t\tconst newMarks: readonly Mark[] = [...withoutMark, 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\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\t\tif (block) {\n\t\t\tconst existing: Mark | undefined = findMarkInRange(block, typeName, from, to);\n\t\t\tif (existing) {\n\t\t\t\tbuilder.removeMark(blockId, from, to, existing);\n\t\t\t}\n\t\t}\n\t\tbuilder.addMark(blockId, from, to, mark);\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Removes an attributed mark from the current selection.\n *\n * - **Collapsed cursor**: filters the mark out of stored marks.\n * Returns `null` when the mark was not present.\n * - **Range selection**: removes the mark across all block spans.\n *\n * Returns the built `Transaction`, or `null` when the selection is\n * unsupported or the mark is absent at a collapsed cursor.\n */\nexport function removeAttributedMark(\n\tstate: EditorState,\n\tmarkTypeName: MarkTypeName,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks: readonly Mark[] = resolveCursorMarks(state);\n\t\tif (!hasMark(currentMarks, markTypeName)) return null;\n\n\t\tconst newMarks: readonly Mark[] = currentMarks.filter((m) => m.type !== markTypeName);\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\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\t\tconst existing: Mark | undefined = block\n\t\t\t? findMarkInRange(block, markTypeName, from, to)\n\t\t\t: undefined;\n\t\tbuilder.removeMark(blockId, from, to, existing ?? { type: markTypeName });\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\n/**\n * Extracts a typed attribute value from the mark at the current selection.\n *\n * Looks at stored marks (collapsed w/ stored), block marks at cursor offset\n * (collapsed w/o stored), or anchor-block marks (range).\n *\n * @param extractFn — Narrows the found mark and returns the desired value,\n * or `null` when the mark's attrs don't match expectations.\n */\nexport function getMarkAttrAtSelection<K extends keyof MarkAttrRegistry, V>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n\textractFn: (mark: Mark & { readonly type: K; readonly attrs: MarkAttrRegistry[K] }) => V | null,\n): V | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\t// Collapsed cursor honors stored marks and right-boundary inclusivity; a\n\t// range reads the raw content marks at its anchor.\n\tlet marks: readonly Mark[];\n\tif (isCollapsed(sel)) {\n\t\tmarks = resolveCursorMarks(state);\n\t} else {\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return null;\n\t\tmarks = getBlockMarksAtOffset(block, sel.anchor.offset);\n\t}\n\n\tconst found = marks.find((m) => (m.type as string) === markTypeName);\n\treturn found && isMarkOfType(found, markTypeName) ? extractFn(found) : null;\n}\n\n/**\n * Returns `true` when the given attributed mark type is present at the\n * current selection (collapsed or range).\n */\nexport function isAttributedMarkActive<K extends keyof MarkAttrRegistry>(\n\tstate: EditorState,\n\tmarkTypeName: K,\n): boolean {\n\treturn getMarkAttrAtSelection(state, markTypeName, () => true as const) !== null;\n}\n\n/**\n * Finds the first mark of the given type within an offset range of a block.\n *\n * Returns the full mark (including attrs) so callers can pass it to\n * `removeMark` for correct undo inversion, or `undefined` when absent.\n */\nfunction findMarkInRange(\n\tblock: BlockNode,\n\ttypeName: MarkTypeName,\n\tfrom: number,\n\tto: number,\n): Mark | undefined {\n\tconst children: readonly (TextNode | InlineNode)[] = getInlineChildren(block);\n\tlet pos = 0;\n\n\tfor (const child of children) {\n\t\tif (!isTextNode(child)) {\n\t\t\tpos += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst nodeEnd: number = pos + child.text.length;\n\t\tif (nodeEnd > from && pos < to) {\n\t\t\tconst found: Mark | undefined = child.marks.find((m) => m.type === typeName);\n\t\t\tif (found) return found;\n\t\t}\n\t\tpos = nodeEnd;\n\t}\n\treturn undefined;\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as t}from"./HTMLUtils-Bhg3_P8B.mjs";import{C as n,E as e,M as r,N as o,_ as s,f as i,h as c,l as a,o as f,w as u}from"./Document-827l3P80.mjs";import{c as d,d as l,l as p,o as h,r as m,t as g}from"./Selection-HYoVFpAx.mjs";import{a as y,r as I}from"./TypeBrands-Ch9856Gb.mjs";import{r as b}from"./NodeResolver-Dleih-8R.mjs";import{t as k}from"./ContentModel-NpAj7vGW.mjs";import{i as v}from"./NavigationQueries-Bt4zZ17v.mjs";function x(t,n){if(0===n.length)return t.doc.children;const e=t.getBlock(n[n.length-1]);return e?e.children:[]}function N(t,n){if(h(t))return{blockId:t.anchor.blockId,offset:t.anchor.offset};const e=l(t,n);return{blockId:e.from.blockId,offset:e.from.offset}}function j(t){return t&&t.length>1?t.slice(0,-1):[]}function P(t,n){return t.findIndex(t=>u(t)&&t.id===n)}function A(t,n){const e=j(b(t.doc,n)),r=x(t,e);return{parentPath:e,siblings:r,index:P(r,n)}}function B(t){if(e(t))return t.id;for(const n of t.children)if(u(n))return B(n);return t.id}function T(t){if(e(t))return t.id;for(let n=t.children.length-1;n>=0;n--){const e=t.children[n];if(e&&u(e))return T(e)}return t.id}function E(t,n,e){const r=t.getBlock(n);if(!r)return null;if(v(t,n)){const e=t.getNodePath(n);return e?m(n,e):null}const o="start"===e?B(r):T(r),s=t.getBlock(o);return s?g(o,"start"===e?0:c(s)):null}function S(t,n,e){const r=t.doc.children,o="start"===n?r.map((t,n)=>n):r.map((t,n)=>r.length-1-n);for(const s of o){const o=r[s];if(!o||!u(o))continue;if(void 0!==e&&o.id===e)continue;const i=E(t,o.id,n);if(i)return i}return null}function _(t,n,e){const r=j(b(t.doc,n)),o=P(x(t,r),n);if(!(o<0))return{parentPath:r,anchorIndex:o,isAnchorEmpty:G(t,n,e)}}function w(t,n,e,r){const o=b(t.doc,e);if(!o)return;const s=t.getBlock(e);return s?{parentPath:o,anchorIndex:s.children.findIndex(t=>u(t)&&t.id===n),isAnchorEmpty:G(t,n,r)}:void 0}function C(t,n){if("table_cell"===t.getBlock(n)?.type)return n;const e=b(t.doc,n);if(e)for(const r of e)if("table_cell"===t.getBlock(r)?.type)return r}function M(t){return p(t)?t.nodeId:d(t)?t.blockId:t.anchor.blockId}function F(t,n,e,r,o,s){const i=C(t,e);if(i){const o=w(t,e,i,s);if(!o)return!1;const c=o.anchorIndex+1;n.insertNode(o.parentPath,c,r),o.isAnchorEmpty&&o.anchorIndex>=0&&n.removeNode(o.parentPath,o.anchorIndex)}else{const i=_(t,e,s);if(!i)return!1;const c=d(o)&&"before"===o.side?0:1;n.insertNode(i.parentPath,i.anchorIndex+c,r),i.isAnchorEmpty&&!d(o)&&n.removeNode(i.parentPath,i.anchorIndex)}return!0}function O(t,n){const e=b(t.doc,n),r=e&&e.length>0?e[0]:n;return t.doc.children.findIndex(t=>t.id===r)}function z(t,n,e){return!n||e.every(e=>k(t,n,e.type))}function D(t,n){const e=O(t,n);if(-1!==e)return{parentPath:[],anchorIndex:e,isAnchorEmpty:!1}}function H(t){return"paragraph"===t.type&&0===c(t)}function L(t,n,e,r){return Q(t,n,e,[r])}function Q(t,n,e,r){if(0===r.length)return;const o=O(t,e);if(-1===o)return;const s=t.doc.children[o],i=t.doc.children[o+1];let c=o+1;for(const f of r)n.insertNode([],c,f),c++;const a=s&&v(t,s.id)&&i&&H(i)?i:void 0;let u;return a?u=a:(u=f(y("paragraph")),n.insertNode([],c,u)),s&&H(s)&&n.removeNode([],o),u}function R(t,n){const e=t.children.map(t=>u(t)?R(t,i()):t);return f(t.type,e,n,t.attrs,t.htmlId)}function U(t,n){if(t.id===n)return t;for(const e of t.children){if(!u(e))continue;const t=U(e,n);if(t)return t}}function V(t,n,e=!1){if(!n)return;const r={};let o=!1;for(const s of Object.keys(n)){const i=n[s],c=t?.[s];"string"==typeof c||"number"==typeof c&&Number.isFinite(c)||"boolean"==typeof c?r[s]=c:e&&i.allowArray&&q(c)?r[s]=Object.freeze([...c]):void 0!==i.default&&(r[s]=i.default),s in r&&(o=!0)}return o?r:void 0}function q(t){return Array.isArray(t)&&t.every(t=>null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t&&Number.isFinite(t))}function G(t,n,e){const r=t.getBlock(n);return!!r&&!(e?.getNodeSpec(r.type))?.isVoid&&""===s(r)}function J(n,e){if(!n.type)return;if(!e)return n;const r=e.getNodeSpec(n.type);if(!r)return;const o=V(n.attrs,r.attrs,!0),s=t(n.htmlId),i=n.segments?function(t,n){const e=[];for(const r of t){if("inline"===r.kind){const t=n.getInlineNodeSpec(r.inlineType);if(!t)continue;const o=V(r.attrs,t.attrs);e.push({kind:"inline",inlineType:r.inlineType,...o?{attrs:o}:{}});continue}e.push(r)}return e}(n.segments,e):void 0,{htmlId:c,...a}=n;return{...a,...s?{htmlId:s}:{},...o?{attrs:o}:{},...i?{segments:i}:n.segments?{segments:[]}:{}}}function K(t){const n=i(),e=function(t){const n=Y(t);return 0===n.length?void 0:r(n)}(t),o=t.attrs?t.attrs:void 0;return f(y(t.type),e,n,o,t.htmlId)}function W(t,n){const e=[];for(const r of t){const t=J(r,n);t&&e.push(X(t))}return{blocks:e}}function X(t){const n=t.attrs?t.attrs:void 0;return{type:y(t.type),...n?{attrs:n}:{},segments:Y(t)}}function Y(t){if(t.segments&&t.segments.length>0)return function(t){const e=[];for(const r of t){if("inline"===r.kind){e.push(n(a(I(r.inlineType),r.attrs)));continue}if(0===r.text.length)continue;const t=r.marks.map(t=>({type:t.type,...t.attrs?{attrs:t.attrs}:{}}));e.push(o(r.text,t))}return e}(t.segments);const e=t.text??"";return e?[o(e)]:[]}export{x as C,P as S,A as T,E as _,C as a,B as b,Q as c,w as d,D as f,J as g,V as h,U as i,H as l,W as m,R as n,F as o,_ as p,K as r,L as s,z as t,M as u,S as v,N as w,T as x,j as y};
|
|
2
|
-
//# sourceMappingURL=BlockInsertion-CJusvrDL.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as t,f as e,h as o,o as n,p as r}from"./Document-827l3P80.mjs";import{d as i,o as c,t as s,u as l}from"./Selection-HYoVFpAx.mjs";import{a}from"./TypeBrands-Ch9856Gb.mjs";import{n as u}from"./DomUtils-Bf7JLFlx.mjs";import{a as d,c as h,t as m}from"./NodeResolver-Dleih-8R.mjs";import{c as p,o as g}from"./PluginHelpers-Dx_0hfDe.mjs";import{t as f}from"./ShortcutFormatting-TwiufqeV.mjs";function b(t,e){const o=t.getNodePath(e)?.[0];return o?t.doc.children.findIndex(t=>t.id===o):-1}function q(t,o,r,c){const s=i(r,t.getBlockOrder()),l=b(t,s.from.blockId),a=b(t,s.to.blockId);if(l<0||a<0)return null;const u=Math.min(l,a),d=Math.max(l,a),h=t.doc.children.slice(u,d+1),m=c??(()=>!0),p=[];let g=[],f=!1;const q=()=>{0!==g.length&&(p.push(n(o,g,e())),f=!0,g=[])};for(const e of h)m(e)?g.push(e):(q(),p.push(e));if(q(),!f)return null;const k=t.transaction("command");for(let e=d;e>=u;e--)k.removeNode([],e);return p.forEach((t,e)=>{k.insertNode([],u+e,t)}),k.setSelection(r),k.build()}function k(t,e){const o=t.getState();if(!l(o.selection))return!1;const n=o.selection;if(!c(n))return!1;const i=n.anchor.blockId,s=o.getParent(i);if(!s||"blockquote"!==s.type)return!1;const a=o.getBlock(i);if(!a)return!1;const u=o.getNodePath(s.id);if(!u)return!1;const d=h(o.doc,u);if(!d)return!1;const m=r(s),p=m.findIndex(t=>t.id===i);return!(p<0)&&e({state:o,quotePath:u,quoteParentPath:u.slice(0,-1),quoteIndex:d.index,child:a,childIndex:p,childCount:m.length,offset:n.anchor.offset})}var I={label:"Blockquote",tooltip:t=>`Blockquote (${t})`},x=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-sGZ-oZqB.mjs"),"./locales/de.ts":()=>import("./de-uKR7koQe.mjs"),"./locales/es.ts":()=>import("./es-DrJyl38L.mjs"),"./locales/fr.ts":()=>import("./fr-BRXUnq3R.mjs"),"./locales/hi.ts":()=>import("./hi-SECtQQzq.mjs"),"./locales/pt.ts":()=>import("./pt-Cv6q7x5x.mjs"),"./locales/ru.ts":()=>import("./ru-DSRv3_Rg.mjs"),"./locales/zh.ts":()=>import("./zh-DYD476c5.mjs")});async function N(t){return p(x,t,I)}var v={},P=class{id="blockquote";name="Blockquote";priority=35;config;locale;constructor(t){this.config={...v,...t}}async init(t){this.locale=await g(t,this.config.locale,I,N),t.registerStyleSheet("\n.notectl-content blockquote {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 16px;\n\tborder-inline-start: 3px solid var(--notectl-blockquote-border, var(--notectl-border));\n\tbackground: var(--notectl-blockquote-bg, transparent);\n\tcolor: var(--notectl-blockquote-fg, inherit);\n\tmin-height: 1.6em;\n}\n"),this.registerNodeSpec(t),this.registerCommands(t),this.registerKeymap(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerToolbarItem(t)}registerNodeSpec(t){t.registerNodeSpec({type:"blockquote",group:"block",content:{allow:["paragraph","heading","list_item","blockquote","horizontal_rule","code_block"],min:1},toDOM(t){const e=u("blockquote",t.id);return e.setAttribute("part","blockquote"),e},toHTML:(t,e)=>`<blockquote>${e||"<br>"}</blockquote>`,parseHTML:[{tag:"blockquote"}],sanitize:{tags:["blockquote"]}})}registerCommands(t){t.registerCommand("toggleBlockquote",()=>this.toggleBlockquote(t)),t.registerCommand("setBlockquote",()=>this.wrapInBlockquote(t))}registerKeymap(e){e.registerKeymap({"Mod-Shift->":()=>e.executeCommand("toggleBlockquote")}),function(e){e.registerKeymap({Enter:()=>function(e){return k(e,n=>{if("list_item"===n.child.type)return!1;if(n.childIndex!==n.childCount-1||o(n.child)>0)return!1;const r=t(),i=n.state.transaction("input");return 1===n.childCount?(i.removeNode(n.quoteParentPath,n.quoteIndex),i.insertNode(n.quoteParentPath,n.quoteIndex,r)):(i.removeNode(n.quotePath,n.childIndex),i.insertNode(n.quoteParentPath,n.quoteIndex+1,r)),i.setSelection(s(r.id,0)),e.dispatch(i.build()),!0})}(e),Backspace:()=>function(t){return k(t,e=>{if(0!==e.offset||0!==e.childIndex)return!1;if("list_item"===e.child.type)return!1;const o=e.state.transaction("input");return 1===e.childCount?(o.removeNode(e.quoteParentPath,e.quoteIndex),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)):(o.removeNode(e.quotePath,0),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)),o.setSelection(s(e.child.id,0)),t.dispatch(o.build()),!0})}(e)},{priority:"context"})}(e)}registerInputRule(t){t.registerInputRule({pattern:/^> $/,handler(t,o,r,i){const s=t.selection;if(!l(s))return null;if(!c(s))return null;const u=t.getBlock(s.anchor.blockId);if(!u||"paragraph"!==u.type)return null;const d=t.doc.children.findIndex(t=>t.id===u.id);if(d<0)return null;const h=n(a("blockquote"),[u],e());return t.transaction("input").removeNode([],d).insertNode([],d,h).deleteTextAt(s.anchor.blockId,r,r+2).setSelection(s).build()}})}registerToolbarItem(t){t.registerToolbarItem({id:"blockquote",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(f("Mod-Shift->")),command:"toggleBlockquote",isActive:t=>!!l(t.selection)&&d(t.doc,t.selection.anchor.blockId,"blockquote")})}toggleBlockquote(t){const e=t.getState(),o=e.selection;if(!l(o))return!1;const n=d(e.doc,o.anchor.blockId,"blockquote")?function(t,e,o){const n=m(t.doc,o.anchor.blockId,e);if(!n||1!==n.path.length)return null;const i=t.doc.children.findIndex(t=>t.id===n.node.id);if(i<0)return null;const c=r(n.node),s=t.transaction("command");return s.removeNode([],i),c.forEach((t,e)=>{s.insertNode([],i+e,t)}),s.setSelection(o),s.build()}(e,a("blockquote"),o):q(e,a("blockquote"),o,this.isQuoteChild(t));return!!n&&(t.dispatch(n),!0)}wrapInBlockquote(t){const e=t.getState(),o=e.selection;if(!l(o))return!1;const n=q(e,a("blockquote"),o,this.isQuoteChild(t));return!!n&&(t.dispatch(n),!0)}isQuoteChild(t){const e=t.getSchemaRegistry(),o=new Set(e.getNodeSpec(a("blockquote"))?.content?.allow??[]);return t=>{if(o.has(t.type))return!0;const n=e.getNodeSpec(t.type)?.group;return void 0!==n&&o.has(n)}}};export{I as n,N as r,P as t};
|
|
2
|
-
//# sourceMappingURL=BlockquotePlugin-Bz2glHwX.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as n,h as t,i as o,v as e}from"./Document-827l3P80.mjs";import{i as r,n as i,r as l,t as c}from"./WordBoundary-CFpIJDNP.mjs";import{o as a,u as s}from"./Selection-HYoVFpAx.mjs";import{r as u}from"./DomUtils-Bf7JLFlx.mjs";import{i as f,n as d,r as h}from"./GapCursorNavigation-BuXngVu-.mjs";import{a as m,i as w,t as g}from"./NavigationQueries-Bt4zZ17v.mjs";import{r as k,t as b}from"./Platform-ByobkiCc.mjs";import{a as I,i as p,n as v,t as y}from"./SelectionSync-BSHIw1EE.mjs";import{c as x,o as B}from"./PluginHelpers-Dx_0hfDe.mjs";function C(n){const t=n.selection;if(!s(t))return null;const o=a(t)?t.anchor.blockId:t.head.blockId;return 0===(a(t)?t.anchor.offset:t.head.offset)?null:h(n,o,0)}function M(n){const o=n.selection;if(!s(o))return null;const e=a(o)?o.anchor.blockId:o.head.blockId,r=n.getBlock(e);if(!r)return null;const i=t(r);return(a(o)?o.anchor.offset:o.head.offset)===i?null:h(n,e,i)}function A(n){const t=n.selection;return s(t)?{blockId:t.head.blockId,offset:t.head.offset}:null}function S(n,t,o){const e=n.getBlockOrder(),r=e.indexOf(t);if(r<0)return null;const i="forward"===o?r+1:r-1;return i<0||i>=e.length?null:e[i]??null}function V(r){const i=r.selection;if(!s(i))return null;if(!a(i))return h(r,i.head.blockId,i.head.offset);const c=i.anchor.blockId,u=r.getBlock(c);if(!u)return null;const d=i.anchor.offset;if(d<t(u))return"inline"===e(u,d)?.kind?h(r,c,d+1):h(r,c,d+(l(n(u),o(u,d))||1));const m=S(r,c,"forward");return m&&g(r,c,m)?w(r,m)?f(r,m):h(r,m,0):null}function E(i){const l=i.selection;if(!s(l))return null;if(!a(l))return h(i,l.head.blockId,l.head.offset);const c=l.anchor.blockId,u=i.getBlock(c);if(!u)return null;const d=l.anchor.offset;if(d>0)return"inline"===e(u,d-1)?.kind?h(i,c,d-1):h(i,c,d-(r(n(u),o(u,d))||1));const m=S(i,c,"backward");if(!m)return null;if(!g(i,c,m))return null;if(w(i,m))return f(i,m);const k=i.getBlock(m);return k?h(i,m,t(k)):null}function T(n){const t=n.selection;if(!s(t))return null;const o=n.getBlockOrder()[0];return o?w(n,o)?f(n,o):h(n,o,0):null}function R(n){const o=n.selection;if(!s(o))return null;const e=n.getBlockOrder(),r=e[e.length-1];if(!r)return null;if(w(n,r))return f(n,r);const i=n.getBlock(r);return i?h(n,r,t(i)):null}function N(r){const i=A(r);if(!i)return null;const c=r.selection;if(!s(c))return null;const a=r.getBlock(i.blockId);if(!a)return null;const u=t(a);if(i.offset<u){const t="inline"===e(a,i.offset)?.kind?1:l(n(a),o(a,i.offset))||1;return d(r,c.anchor.blockId,c.anchor.offset,i.blockId,i.offset+t)}const f=S(r,i.blockId,"forward");return f&&g(r,i.blockId,f)?d(r,c.anchor.blockId,c.anchor.offset,f,0):null}function j(i){const l=A(i);if(!l)return null;const c=i.selection;if(!s(c))return null;if(l.offset>0){const t=i.getBlock(l.blockId);if(!t)return null;const a="inline"===e(t,l.offset-1)?.kind?1:r(n(t),o(t,l.offset))||1;return d(i,c.anchor.blockId,c.anchor.offset,l.blockId,l.offset-a)}const a=S(i,l.blockId,"backward");if(!a)return null;if(!g(i,l.blockId,a))return null;const u=i.getBlock(a);return u?d(i,c.anchor.blockId,c.anchor.offset,a,t(u)):null}function H(n){const t=A(n);if(!t)return null;const o=n.selection;return s(o)?0===t.offset?null:d(n,o.anchor.blockId,o.anchor.offset,t.blockId,0):null}function O(n){const o=A(n);if(!o)return null;const e=n.selection;if(!s(e))return null;const r=n.getBlock(o.blockId);if(!r)return null;const i=t(r);return o.offset===i?null:d(n,e.anchor.blockId,e.anchor.offset,o.blockId,i)}function L(n){const t=n.selection;if(!s(t))return null;const o=n.getBlockOrder()[0];return o?t.head.blockId===o&&0===t.head.offset?null:d(n,t.anchor.blockId,t.anchor.offset,o,0):null}function D(n){const o=n.selection;if(!s(o))return null;const e=n.getBlockOrder(),r=e[e.length-1];if(!r)return null;const i=n.getBlock(r);if(!i)return null;const l=t(i);return o.head.blockId===r&&o.head.offset===l?null:d(n,o.anchor.blockId,o.anchor.offset,r,l)}function z(n,t,o){if("caretPositionFromPoint"in n){const e=n.caretPositionFromPoint(t,o);if(e)return{node:e.offsetNode,offset:e.offset}}if("caretRangeFromPoint"in n){const e=n.caretRangeFromPoint(t,o);if(e)return{node:e.startContainer,offset:e.startOffset}}return null}function P(n,t,o,e){return z(n,t,o)??(e&&n!==e?z(e,t,o):null)}function F(n,o,e,r){const i=o.selection;if(!s(i))return!1;if(!a(i))return!1;const l=o.getBlock(i.anchor.blockId);if(!l)return!1;const c=i.anchor.offset,f=t(l),d=n.querySelector(`[data-block-id="${i.anchor.blockId}"]`),h=d instanceof HTMLElement&&"rtl"===b(d);if("left"===e)return h?c===f:0===c;if("right"===e)return h?0===c:c===f;if("up"===e&&0===c)return!0;if("down"===e&&c===f)return!0;const m=v();return m&&m.modify?function(n,t,o,e){const r=p(n,t);if(!r)return!1;const i=e??_(t,n),l="up"===o?"backward":"forward";try{t.modify("move",l,"line");const o=p(n,t);if(!o)return!1;if(u(n,r.focusNode)!==u(n,o.focusNode))return!0;if(o.anchorNode===r.anchorNode&&o.anchorOffset===r.anchorOffset&&o.focusNode===r.focusNode&&o.focusOffset===r.focusOffset)return!0;if(i){const o=_(t,n);if(o&&Math.abs(o.top-i.top)<1)return!0}return!1}finally{try{t.setBaseAndExtent(r.anchorNode,r.anchorOffset,r.focusNode,r.focusOffset)}catch{}}}(n,m,e,r):"up"===e?0===c:c===f}function q(n,o){const e=Q(n,o);if(!e)return null;if(e.isVoid)return f(n,e.targetId);const r=n.getBlock(e.targetId);if(!r)return null;const i="right"===o||"down"===o?0:t(r);return h(n,e.targetId,i)}function $(n,o,e,r){const i=Q(o,e);if(!i)return null;if(i.isVoid)return f(o,i.targetId);const l=o.getBlock(i.targetId);if(!l)return null;const c=t(l);if(null!==r){const t=function(n,t,o,e){const r=n.querySelector(`[data-block-id="${t}"]`);if(!r)return null;const i=r.getBoundingClientRect(),l=function(n,t,o){if(!(n instanceof HTMLElement))return"down"===o?t.top+2:t.bottom-2;const e=getComputedStyle(n),r=Number.parseFloat(e.paddingTop)||0,i=Number.parseFloat(e.paddingBottom)||0;return"down"===o?t.top+r+2:t.bottom-i-2}(r,i,o),c=Math.min(Math.max(e,i.left),i.right-1),a=P(n.getRootNode(),c,l,n.ownerDocument);if(!a)return null;if(!r.contains(a.node))return null;const s=y(n,a.node,a.offset);return s?s.blockId!==t?null:s:null}(n,i.targetId,e,r);if(t)return h(o,t.blockId,t.offset)}if(s(o.selection)&&a(o.selection)){const n=o.selection.anchor.offset,t=Math.min(n,c);return h(o,i.targetId,t)}const u="down"===e?0:c;return h(o,i.targetId,u)}function U(n,t){if("up"===t||"down"===t)return null;const o=n.selection;if(!s(o))return null;if(!a(o))return null;const r=o.anchor.blockId,i=n.getBlock(r);if(!i)return null;const l=o.anchor.offset;return"right"===t?function(n,t,o,r){const i=e(o,r);return i&&"inline"===i.kind?h(n,t,r+1):null}(n,r,i,l):function(n,t,o,r){if(0===r)return null;const i=e(o,r-1);return i&&"inline"===i.kind?h(n,t,r-1):null}(n,r,i,l)}function _(n,t){if(n.rangeCount>0){const o=n.getRangeAt(0);if(!t||t.contains(o.startContainer)){const n=o.getClientRects();if(n.length>0)return n[0]??null;const t=o.getBoundingClientRect();if(t.height>0)return t}}if(t){const o=p(t,n);if(o)try{const n=document.createRange();n.setStart(o.anchorNode,o.anchorOffset),n.setEnd(o.focusNode,o.focusOffset);const t=n.getClientRects();return t.length>0?t[0]??null:n.getBoundingClientRect()}catch{}}return null}function Q(n,t){const o=n.selection;if(!s(o))return null;const e="right"===t||"down"===t;return m(n,o.anchor.blockId,e)}function W(n,t,o,e){return K(n,t,"move",o,e)}function G(n,t,o,e){return K(n,t,"extend",o,e)}function K(n,o,r,i,l){const c=o.selection;if(!s(c))return null;const a="move"===r?X:J,u=v();if(!u?.modify)return a(o,i,l);const m=p(n,u);if(!m)return a(o,i,l);try{u.modify(r,i,l);const a=I(n);if(!a)return null;const s="move"===r?c.anchor.blockId:c.head.blockId,m="move"===r?a.anchor:a.head,k=m.blockId;if(k!==s&&!g(o,s,k))return null;let b=m.offset;const p=o.getBlock(k);return p&&"inline"===e(p,b)?.kind&&"forward"===i&&(b=Math.min(b+1,t(p))),"move"===r?w(o,k)?f(o,k):h(o,k,b):d(o,c.anchor.blockId,c.anchor.offset,k,b)}finally{try{u.setBaseAndExtent(m.anchorNode,m.anchorOffset,m.focusNode,m.focusOffset)}catch{}}}function X(n,o,e){return"word"===e?function(n,o){const e=n.selection;if(!s(e))return null;const r=a(e)?e.anchor.blockId:e.head.blockId,l=a(e)?e.anchor.offset:e.head.offset,u=n.getBlock(r);if(!u)return null;const d="forward"===o?i(u,l):c(u,l);return d===l?function(n,o,e){const r=m(n,o,"forward"===e);if(!r)return null;if(r.isVoid)return f(n,r.targetId);const i=n.getBlock(r.targetId);if(!i)return null;const l="forward"===e?0:t(i);return h(n,r.targetId,l)}(n,r,o):h(n,r,d)}(n,o):"lineboundary"===e?"forward"===o?M(n):C(n):q(n,"forward"===o?"down":"up")}function J(n,o,e){const r=n.selection;if(!s(r))return null;const l=r.head,a=n.getBlock(l.blockId);if(!a)return null;let u=l.offset;if("word"===e)u="forward"===o?i(a,l.offset):c(a,l.offset);else{if("lineboundary"!==e){const e=m(n,l.blockId,"forward"===o);if(!e)return null;if(e.isVoid)return null;const i=n.getBlock(e.targetId);if(!i)return null;const c="forward"===o?0:t(i);return d(n,r.anchor.blockId,r.anchor.offset,e.targetId,c)}u="forward"===o?t(a):0}return d(n,r.anchor.blockId,r.anchor.offset,l.blockId,u)}function Y(n,t){return W(n,t,"forward","word")}function Z(n,t){return W(n,t,"backward","word")}function nn(n,t){return W(n,t,"backward","lineboundary")}function tn(n,t){return W(n,t,"forward","lineboundary")}function on(n,t){return W(n,t,"backward","line")}function en(n,t){return W(n,t,"forward","line")}function rn(n,t){return G(n,t,"forward","word")}function ln(n,t){return G(n,t,"backward","word")}function cn(n,t){return G(n,t,"backward","lineboundary")}function an(n,t){return G(n,t,"forward","lineboundary")}function sn(n,t){return G(n,t,"backward","line")}function un(n,t){return G(n,t,"forward","line")}var fn={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",codeBlock:"Code Block",blockquote:"Block Quote",listItem:"List Item",horizontalRule:"Horizontal Rule",image:"Image",table:"Table"},dn={paragraph:"paragraph",code_block:"codeBlock",blockquote:"blockquote",list_item:"listItem",horizontal_rule:"horizontalRule",image:"image",table:"table"},hn=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BRX5E_Pw.mjs"),"./locales/de.ts":()=>import("./de-B9zSHWqY.mjs"),"./locales/es.ts":()=>import("./es-CgMfhkJJ.mjs"),"./locales/fr.ts":()=>import("./fr-0qEo3bRP.mjs"),"./locales/hi.ts":()=>import("./hi-CoclKAUM.mjs"),"./locales/pt.ts":()=>import("./pt-CMx2wPPY.mjs"),"./locales/ru.ts":()=>import("./ru-QGX8lOTs.mjs"),"./locales/zh.ts":()=>import("./zh-YfuE_m2y.mjs")});async function mn(n){return x(hn,n,fn)}var wn={"word:forward":Y,"word:backward":Z,"lineboundary:forward":tn,"lineboundary:backward":nn,"line:forward":en,"line:backward":on},gn={"word:forward":rn,"word:backward":ln,"lineboundary:forward":an,"lineboundary:backward":cn,"line:forward":un,"line:backward":sn},kn=class{id="caret-navigation";name="Caret Navigation";priority=4;context=null;lastAnnouncedBlockId=null;announceTimer=null;announce=null;locale=fn;async init(n){this.locale=await B(n,void 0,fn,mn),this.context=n,this.announce=t=>n.announce(t);const t=k(),o={"Shift-ArrowRight":()=>this.extendCharacterVisual("right"),"Shift-ArrowLeft":()=>this.extendCharacterVisual("left"),"Shift-ArrowUp":()=>this.viewExtendCommand("backward","line"),"Shift-ArrowDown":()=>this.viewExtendCommand("forward","line"),...t?{"Alt-ArrowRight":()=>this.viewMoveVisual("right","word"),"Alt-ArrowLeft":()=>this.viewMoveVisual("left","word"),"Shift-Alt-ArrowRight":()=>this.viewExtendVisual("right","word"),"Shift-Alt-ArrowLeft":()=>this.viewExtendVisual("left","word")}:{"Mod-ArrowRight":()=>this.viewMoveVisual("right","word"),"Mod-ArrowLeft":()=>this.viewMoveVisual("left","word"),"Mod-Shift-ArrowRight":()=>this.viewExtendVisual("right","word"),"Mod-Shift-ArrowLeft":()=>this.viewExtendVisual("left","word")},...t?{"Mod-ArrowLeft":()=>this.viewMoveVisual("left","lineboundary"),"Mod-ArrowRight":()=>this.viewMoveVisual("right","lineboundary"),"Mod-Shift-ArrowLeft":()=>this.viewExtendVisual("left","lineboundary"),"Mod-Shift-ArrowRight":()=>this.viewExtendVisual("right","lineboundary")}:{Home:()=>this.viewMoveCommand("backward","lineboundary"),End:()=>this.viewMoveCommand("forward","lineboundary"),"Shift-Home":()=>this.viewExtendCommand("backward","lineboundary"),"Shift-End":()=>this.viewExtendCommand("forward","lineboundary")},...t?{"Mod-ArrowUp":()=>this.modelCommand(T),"Mod-ArrowDown":()=>this.modelCommand(R),"Mod-Shift-ArrowUp":()=>this.modelCommand(L),"Mod-Shift-ArrowDown":()=>this.modelCommand(D)}:{"Mod-Home":()=>this.modelCommand(T),"Mod-End":()=>this.modelCommand(R),"Mod-Shift-Home":()=>this.modelCommand(L),"Mod-Shift-End":()=>this.modelCommand(D)}};n.registerKeymap(o,{priority:"navigation"})}onStateChange(n,t,o){const e=t.selection;if(!a(e)||!s(e))return null!==this.announceTimer&&(clearTimeout(this.announceTimer),this.announceTimer=null),void(this.lastAnnouncedBlockId=null);const r=e.anchor.blockId;r!==this.lastAnnouncedBlockId&&(null!==this.lastAnnouncedBlockId?(this.lastAnnouncedBlockId=r,null!==this.announceTimer&&clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>{if(this.announceTimer=null,this.context?.hasAnnouncement())return;const n=t.getBlock(r);if(!n)return;const o=function(n,t,o){if("heading"===t&&o?.level){const t=`heading${o.level}`;if(t in n)return n[t]}const e=dn[t];return e?n[e]:t}(this.locale,n.type,n.attrs);this.announce?.(o)},150)):this.lastAnnouncedBlockId=r)}destroy(){null!==this.announceTimer&&clearTimeout(this.announceTimer),this.announceTimer=null,this.announce=null,this.context=null}modelCommand(n){if(!this.context)return!1;const t=n(this.context.getState());return!!t&&(this.context.dispatch(t),!0)}extendCharacterVisual(n){if(!this.context)return!1;const t=this.context.getState(),o="forward"===this.resolveLogicalHorizontalDirection(t,n)?N(t):j(t);return!!o&&(this.context.dispatch(o),!0)}viewMoveCommand(n,t){return this.dispatchViewCommand(wn,n,t)}viewMoveVisual(n,t){if(!this.context)return!1;const o=this.resolveLogicalHorizontalDirection(this.context.getState(),n);return this.viewMoveCommand(o,t)}viewExtendCommand(n,t){return this.dispatchViewCommand(gn,n,t)}dispatchViewCommand(n,t,o){if(!this.context)return!1;const e=n[`${o}:${t}`];if(!e)return!1;const r=e(this.context.getContainer(),this.context.getState());return!!r&&(this.context.dispatch(r),!0)}viewExtendVisual(n,t){if(!this.context)return!1;const o=this.resolveLogicalHorizontalDirection(this.context.getState(),n);return this.viewExtendCommand(o,t)}resolveLogicalHorizontalDirection(n,t){const o=n.selection;if(!s(o))return"left"===t?"backward":"forward";const e=this.context?.getContainer();if(!e)return"left"===t?"backward":"forward";const r=e.querySelector(`[data-block-id="${o.head.blockId}"]`);return r instanceof HTMLElement&&"rtl"===b(r)?"left"===t?"forward":"backward":"left"===t?"backward":"forward"}};export{E as A,P as C,H as D,O as E,C as F,R as M,T as N,D as O,M as P,U as S,N as T,W as _,sn as a,q as b,ln as c,on as d,tn as f,G as g,Y as h,un as i,V as j,L as k,rn as l,Z as m,fn as n,an as o,nn as p,mn as r,cn as s,kn as t,en as u,F as v,j as w,$ as x,_ as y};
|
|
2
|
-
//# sourceMappingURL=CaretNavigationPlugin-CNsT0eb4.mjs.map
|