@notectl/core 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +4 -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-Cw2KMk-H.mjs → BidiIsolationPlugin-cOLlL3Y9.mjs} +2 -2
- package/dist/chunks/{BidiIsolationPlugin-Cw2KMk-H.mjs.map → BidiIsolationPlugin-cOLlL3Y9.mjs.map} +1 -1
- package/dist/chunks/BlockInsertion-O5pAFKid.mjs +2 -0
- package/dist/chunks/{BlockInsertion-CYH2gRkY.mjs.map → BlockInsertion-O5pAFKid.mjs.map} +1 -1
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +2 -0
- package/dist/chunks/{BlockquotePlugin-0bZSbkyo.mjs.map → BlockquotePlugin-D-jRWLQB.mjs.map} +1 -1
- package/dist/chunks/CaretNavigationPlugin-DEZU09LJ.mjs +2 -0
- package/dist/chunks/CaretNavigationPlugin-DEZU09LJ.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +2 -0
- package/dist/chunks/{CodeBlockPlugin-BCJ3faXx.mjs.map → CodeBlockPlugin-BandNM3t.mjs.map} +1 -1
- package/dist/chunks/ColorGrid-D0vLHsG6.mjs +2 -0
- package/dist/chunks/{ColorGrid-DQEkJ-0y.mjs.map → ColorGrid-D0vLHsG6.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-_C5JZhki.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-CyF26zIU.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-C_ScWZ0P.mjs +2 -0
- package/dist/chunks/FontPlugin-C_ScWZ0P.mjs.map +1 -0
- package/dist/chunks/FontSizePlugin-DB_0njtC.mjs +2 -0
- package/dist/chunks/FontSizePlugin-DB_0njtC.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs +2 -0
- package/dist/chunks/{FormulaPlugin-DJ39BtqV.mjs.map → FormulaPlugin-CI0r4X1o.mjs.map} +1 -1
- 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-vniSvTgq.mjs.map → HardBreakPlugin-CC4rntSX.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-LK8Pg4h0.mjs +2 -0
- package/dist/chunks/HeadingPlugin-LK8Pg4h0.mjs.map +1 -0
- package/dist/chunks/{HighlightPlugin-DRTAE1N5.mjs → HighlightPlugin-B4WlZawl.mjs} +2 -2
- package/dist/chunks/{HighlightPlugin-DRTAE1N5.mjs.map → HighlightPlugin-B4WlZawl.mjs.map} +1 -1
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs +2 -0
- package/dist/chunks/{HorizontalRulePlugin-B9OvwrKB.mjs.map → HorizontalRulePlugin-CxmUMM34.mjs.map} +1 -1
- package/dist/chunks/ImagePlugin-C5ESNNsA.mjs +2 -0
- package/dist/chunks/ImagePlugin-C5ESNNsA.mjs.map +1 -0
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +2 -0
- package/dist/chunks/{InlineCodePlugin-uxgMUX_E.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-CvWHbSkb.mjs → LinkPlugin-BwXDGHPe.mjs} +2 -2
- package/dist/chunks/{LinkPlugin-CvWHbSkb.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-Q7l0d6Ma.mjs.map → MarkdownHTMLRegistry-CISsC0lH.mjs.map} +1 -1
- package/dist/chunks/MarkdownParser-D1d9zB0R.mjs +2 -0
- package/dist/chunks/{MarkdownParser-Dp62mfUq.mjs.map → MarkdownParser-D1d9zB0R.mjs.map} +1 -1
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +2 -0
- package/dist/chunks/{MarkdownSerializer-DBELFAeo.mjs.map → MarkdownSerializer-Oex2RzNw.mjs.map} +1 -1
- 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-WH5snxr_.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-KDuTlmXm.mjs → PluginHelpers-WG1Lzzh3.mjs} +2 -2
- package/dist/chunks/{PluginHelpers-KDuTlmXm.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-Cj86uDEB.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-BQ7LWbEB.mjs +2 -0
- package/dist/chunks/PrintPlugin-BQ7LWbEB.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-CwOHMMfI.mjs +2 -0
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs.map +1 -0
- 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-gTQaSJcO.mjs.map → SimpleMark-CTDtEIMV.mjs.map} +1 -1
- package/dist/chunks/SmartPastePlugin-CjExbE9Q.mjs +2 -0
- package/dist/chunks/{SmartPastePlugin-BvJQ-fOz.mjs.map → SmartPastePlugin-CjExbE9Q.mjs.map} +1 -1
- package/dist/chunks/{StrikethroughPlugin-BdrG1TTY.mjs → StrikethroughPlugin-d-EW2YYx.mjs} +2 -2
- package/dist/chunks/{StrikethroughPlugin-BdrG1TTY.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-DTZB0Y3D.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-C4WMYGWN.mjs +2 -0
- package/dist/chunks/TablePlugin-C4WMYGWN.mjs.map +1 -0
- package/dist/chunks/{TextColorPlugin-Ckg3KWvb.mjs → TextColorPlugin-D_MhNJT6.mjs} +2 -2
- package/dist/chunks/{TextColorPlugin-Ckg3KWvb.mjs.map → TextColorPlugin-D_MhNJT6.mjs.map} +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-LVDkKdDX.mjs +2 -0
- package/dist/chunks/{TextDirectionAutoPlugin-DRGbgTlx.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/TextFormattingPlugin-DlS0SeW7.mjs +2 -0
- package/dist/chunks/{TextFormattingPlugin-BhRxSC8q.mjs.map → TextFormattingPlugin-DlS0SeW7.mjs.map} +1 -1
- package/dist/chunks/ThemeEngine-kIXtSRkI.mjs +3 -0
- package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -0
- package/dist/chunks/{ToolbarPlugin-dmTj1jIz.mjs → ToolbarPlugin-DdrLarMD.mjs} +2 -2
- package/dist/chunks/ToolbarPlugin-DdrLarMD.mjs.map +1 -0
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +2 -0
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +1 -0
- package/dist/chunks/{XmlSupport-DIXH5on9.mjs → XmlSupport-3Za6SIqF.mjs} +2 -2
- package/dist/chunks/{XmlSupport-DIXH5on9.mjs.map → XmlSupport-3Za6SIqF.mjs.map} +1 -1
- package/dist/chunks/{color-picker-C9B2rYw-.mjs → color-picker-DJ05ey9o.mjs} +2 -2
- package/dist/chunks/{color-picker-C9B2rYw-.mjs.map → color-picker-DJ05ey9o.mjs.map} +1 -1
- package/dist/chunks/full-Cshz7aTP.mjs +2 -0
- package/dist/chunks/{full-JM0-SwWy.mjs.map → full-Cshz7aTP.mjs.map} +1 -1
- package/dist/chunks/minimal-7XqMY9kC.mjs +2 -0
- package/dist/chunks/{minimal-DSlR2A27.mjs.map → minimal-7XqMY9kC.mjs.map} +1 -1
- package/dist/chunks/register-ArnJV5vu.mjs +3 -0
- package/dist/chunks/register-ArnJV5vu.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/editor/styles/base.d.ts +1 -1
- package/dist/editor/styles/base.d.ts.map +1 -1
- package/dist/editor/styles/color-picker.d.ts +1 -1
- package/dist/editor/styles/color-picker.d.ts.map +1 -1
- package/dist/editor/styles/font-select.d.ts +1 -1
- package/dist/editor/styles/font-select.d.ts.map +1 -1
- package/dist/editor/styles/font-size-select.d.ts +1 -1
- package/dist/editor/styles/font-size-select.d.ts.map +1 -1
- package/dist/editor/styles/heading-select.d.ts +1 -1
- package/dist/editor/styles/heading-select.d.ts.map +1 -1
- package/dist/editor/styles/image.d.ts +1 -1
- package/dist/editor/styles/image.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/editor/styles/toolbar.d.ts +1 -1
- package/dist/editor/styles/toolbar.d.ts.map +1 -1
- package/dist/editor/theme/ThemeEngine.d.ts.map +1 -1
- package/dist/editor/theme/ThemeTokens.d.ts +7 -0
- package/dist/editor/theme/ThemeTokens.d.ts.map +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +12 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +11 -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 +18 -7
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts +41 -6
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +4 -3
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/ContentSlice.d.ts +10 -0
- package/dist/model/ContentSlice.d.ts.map +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/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.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.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.mjs +1 -1
- package/dist/presets/minimal.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/register.mjs +1 -1
- 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 +2 -0
- 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 +10 -0
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts +27 -2
- 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/dist/view/SelectionSync.d.ts +6 -0
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/chunks/AlignmentPlugin-C9Rr_R-g.mjs +0 -2
- package/dist/chunks/AlignmentPlugin-C9Rr_R-g.mjs.map +0 -1
- package/dist/chunks/AttributedMarkCommands-BCvmqeFZ.mjs +0 -2
- package/dist/chunks/AttributedMarkCommands-BCvmqeFZ.mjs.map +0 -1
- package/dist/chunks/BlockInsertion-CYH2gRkY.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-0bZSbkyo.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs +0 -2
- package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-BCJ3faXx.mjs +0 -2
- package/dist/chunks/ColorGrid-DQEkJ-0y.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-CyF26zIU.mjs +0 -2
- package/dist/chunks/ColorValidation-DAijTjG9.mjs +0 -2
- package/dist/chunks/Commands-D5ND50PQ.mjs +0 -2
- package/dist/chunks/Commands-D5ND50PQ.mjs.map +0 -1
- package/dist/chunks/ContentModel-NpAj7vGW.mjs +0 -2
- package/dist/chunks/Decoration-BOP1TAUd.mjs +0 -2
- package/dist/chunks/Decoration-BOP1TAUd.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/FontPlugin-D041tiLe.mjs +0 -2
- package/dist/chunks/FontPlugin-D041tiLe.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-8CAvj1RD.mjs +0 -2
- package/dist/chunks/FontSizePlugin-8CAvj1RD.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-DJ39BtqV.mjs +0 -2
- package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs +0 -2
- package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-2iR6506y.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-2iR6506y.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-Bhg3_P8B.mjs +0 -2
- package/dist/chunks/HardBreakPlugin-vniSvTgq.mjs +0 -2
- package/dist/chunks/HeadingPlugin-DUKsLuMd.mjs +0 -2
- package/dist/chunks/HeadingPlugin-DUKsLuMd.mjs.map +0 -1
- package/dist/chunks/HorizontalRulePlugin-B9OvwrKB.mjs +0 -2
- package/dist/chunks/ImagePlugin-CwxTRr6d.mjs +0 -2
- package/dist/chunks/ImagePlugin-CwxTRr6d.mjs.map +0 -1
- package/dist/chunks/InlineCodePlugin-uxgMUX_E.mjs +0 -2
- package/dist/chunks/ListPlugin-BchSFWVn.mjs +0 -2
- package/dist/chunks/ListPlugin-BchSFWVn.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-Q7l0d6Ma.mjs +0 -2
- package/dist/chunks/MarkdownParser-Dp62mfUq.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-DBELFAeo.mjs +0 -2
- package/dist/chunks/NodeSelectionCommands-WH5snxr_.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/PopupKeyboardPatterns-tUrT9TyV.mjs +0 -2
- package/dist/chunks/PopupManager-Cj86uDEB.mjs +0 -2
- package/dist/chunks/PrintPlugin-D2javl_d.mjs +0 -2
- package/dist/chunks/PrintPlugin-D2javl_d.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/SelectionSync-BSHIw1EE.mjs +0 -2
- package/dist/chunks/SelectionSync-BSHIw1EE.mjs.map +0 -1
- package/dist/chunks/SimpleMark-gTQaSJcO.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-BvJQ-fOz.mjs +0 -2
- package/dist/chunks/StyleRuntime-DW6omotc.mjs +0 -2
- package/dist/chunks/SuperSubPlugin-DTZB0Y3D.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs +0 -2
- package/dist/chunks/TableDimensions-BBhjHNjQ.mjs.map +0 -1
- package/dist/chunks/TablePlugin-CPvg9YZS.mjs +0 -2
- package/dist/chunks/TablePlugin-CPvg9YZS.mjs.map +0 -1
- package/dist/chunks/TextDirectionAutoPlugin-DRGbgTlx.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs +0 -2
- package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs.map +0 -1
- package/dist/chunks/TextFormattingPlugin-BhRxSC8q.mjs +0 -2
- package/dist/chunks/ThemeEngine-BUVo_zaT.mjs +0 -3
- package/dist/chunks/ThemeEngine-BUVo_zaT.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-dmTj1jIz.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-BugkI7-m.mjs +0 -2
- package/dist/chunks/VideoPlugin-BugkI7-m.mjs.map +0 -1
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs +0 -2
- package/dist/chunks/WordBoundary-CFpIJDNP.mjs.map +0 -1
- package/dist/chunks/full-JM0-SwWy.mjs +0 -2
- package/dist/chunks/minimal-DSlR2A27.mjs +0 -2
- package/dist/chunks/register-BjsdJ3Aq.mjs +0 -2
- package/dist/chunks/register-BjsdJ3Aq.mjs.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{P as t,T as e,b as n,l as i,o as a}from"./Document-827l3P80.mjs";import{l as r,o,r as l,t as s,u as c}from"./Selection-HYoVFpAx.mjs";import{a as p,r as u}from"./TypeBrands-Ch9856Gb.mjs";import{c as d,w as m}from"./BlockInsertion-CYH2gRkY.mjs";import{t as h}from"./Commands-D5ND50PQ.mjs";import{c as f,i as b,o as g}from"./PluginHelpers-KDuTlmXm.mjs";import{n as v}from"./DomUtils-Bf7JLFlx.mjs";import{t as x}from"./SelectionSync-BSHIw1EE.mjs";import{a as y}from"./PopupPositioning-BFh6Ed1D.mjs";import{r as w}from"./ColorValidation-DAijTjG9.mjs";import L from"dompurify";var k={"&":"&","<":"<",">":">"},S={"&":"&","<":"<",">":">",'"':"""};function C(t){return t.replace(/[&<>]/g,t=>k[t]??t)}function $(t){return t.replace(/[&<>"]/g,t=>S[t]??t)}function A(t){if(!t)return"";let e="";for(const[n,i]of Object.entries(t))!1!==i&&null!=i&&(e+=!0!==i?` ${n}="${$(String(i))}"`:` ${n}="true"`);return e}function z(t,e,n){return`<${t}${A(n)}>${e}</${t}>`}function _(t,e){return z("mi",C(t),e)}function E(t,e){return z("mn",C(t),e)}function B(t,e){return z("mo",C(t),e)}function I(t,e){return z("mtext",C(t),e)}function P(t){return function(t,e){return`<${t}${A(e)}></${t}>`}("mspace",t)}function D(t,e){return z("mrow",t,e)}function N(t){return 0===t.length?"":1===t.length?t[0]??"":D(t.join(""))}function F(t,e,n){return z("mfrac",`${t}${e}`,n)}function q(t,e,n){return z("mover",`${t}${e}`,n)}function R(t,e,n){return z("munder",`${t}${e}`,n)}function O(t){return z("mtd",t)}function T(t){return z("mtr",t.map(O).join(""))}var M={"&":"&","<":"<",">":">",""":'"',"'":"'","'":"'"};function j(t){const e=t.display?"block":"inline",n=t.alt?` alttext="${$(t.alt)}"`:"",i=void 0!==t.latex&&""!==t.latex,a=`<annotation encoding="application/x-tex">${C(t.latex??"")}</annotation>`;return`<math display="${e}"${n}>${i?`<semantics>${t.presentation}${a}</semantics>`:t.presentation}</math>`}function H(t){const e=t.match(/<annotation\b[^>]*\bencoding=["']application\/x-tex["'][^>]*>([\s\S]*?)<\/annotation>/i);var n;if(e&&void 0!==e[1])return(n=e[1],n.replace(/&(?:amp|lt|gt|quot|apos|#39);/g,t=>M[t]??t)).trim()}function G(t){return t.replace(/^(<math\b[^>]*?)\s+mathsize=(?:"[^"]*"|'[^']*')/i,"$1")}var U=/<math[\s>]/i;function K(t){return U.test(t.mathml)?function(t,e){const n=t.replace(/^(<math\b[^>]*?)\s+alttext=["'][^"']*["']/i,"$1");return e?n.replace(/^<math\b/i,`<math alttext="${$(e)}"`):n}(t.mathml,t.alt):""}function W(t,e){const n=K(e);n?t.innerHTML=n:t.textContent=e.latex||e.alt||"⊡"}function V(t,e){const n="string"==typeof e?.fontSize?e.fontSize:"";t.style.fontSize=n}function Z(t){return{mathml:"string"==typeof t?.mathml?t.mathml:"",latex:"string"==typeof t?.latex?t.latex:"",alt:"string"==typeof t?.alt?t.alt:"",fontSize:"string"==typeof t?.fontSize?t.fontSize:""}}function X(t){const e=K(t);return e?function(t,e){const n=G(t);return e?n.replace(/^<math\b/i,`<math mathsize="${$(e)}"`):n}(e,w(t.fontSize)?t.fontSize:""):e}function Q(t){const e=t.getAttribute("mathsize")??"";return w(e)?e:""}function J(t,e){if("block"===t.getAttribute("display")!==e)return!1;const n=G(function(t){return t.replace(/^(<math\b[^>]*?)\s+data-block-id=(?:"[^"]*"|'[^']*')/i,"$1")}(t.outerHTML));return{mathml:n,latex:H(n)??"",alt:t.getAttribute("alttext")??"",fontSize:Q(t)}}var Y="math_inline",tt="math_display",et={insertInline:"Mod-Shift-E",insertDisplay:"Mod-Shift-M"},nt=[12,16,20,24,32,40,48,64,96],it={},at=["math","semantics","annotation","mrow","mi","mn","mo","mtext","ms","mspace","mfrac","msqrt","mroot","msup","msub","msubsup","mover","munder","munderover","mmultiscripts","mprescripts","none","mtable","mtr","mlabeledtr","mtd","mpadded","mphantom","mstyle","merror","menclose","mfenced","maction"],rt=["display","encoding","mathvariant","mathsize","mathcolor","mathbackground","displaystyle","scriptlevel","scriptminsize","scriptsizemultiplier","stretchy","symmetric","largeop","movablelimits","accent","accentunder","form","fence","separator","lspace","rspace","voffset","minsize","maxsize","linethickness","columnalign","rowalign","columnspacing","rowspacing","columnlines","rowlines","columnspan","rowspan","align","open","close","separators","notation","alttext","depth","width","height"];function ot(t){const e=t.selection;if(!r(e))return null;const n=t.getBlock(e.nodeId);return n&&"math_display"===n.type?e.nodeId:null}function lt(t){return{mathml:t.mathml,latex:t.latex,alt:t.alt,fontSize:t.fontSize}}function st(t,e){const n=t.selection;if(0===e.length||!c(n))return null;const a=t.transaction("command"),r=o(n)?void 0:h(t,a);let l,p;if(r)l=r,p=0;else{const e=m(n,t.getBlockOrder());l=e.blockId,p=e.offset}for(const o of e)a.insertInlineNode(l,p,i(u(Y),lt(o))),p+=1;return a.setSelection(s(l,p)),a.build()}function ct(t,e){const n=b(t);if(0===e.length||!n)return null;const i=e.map(t=>a(p(tt),[],void 0,lt(t))),r=t.transaction("command");if(!d(t,r,n,i))return null;const o=i[i.length-1];return o?(r.setSelection(l(o.id,[])),r.build()):null}function pt(t){return{mathml:t.mathml,latex:t.latex,alt:t.alt,fontSize:t.fontSize}}function ut(t,e,n){const i=pt(n);n.display?function(t,e){const n=function(t,e){return ct(t,[e])}(t.getState(),e);!!n&&t.dispatch(n)}(t,i):function(t,e){const n=function(t,e){return st(t,[e])}(t.getState(),e);!!n&&t.dispatch(n)}(t,i),t.announce(e.inserted)}function dt(t,e){return void 0===e?{node:t}:{node:t,kind:e}}function mt(t,e,n=!1){return{node:t,kind:e,bigOp:!0,intLike:n}}var ht=/* @__PURE__ */function(t){return t.Ordinary="ordinary",t.Binary="binary",t.Relation="relation",t.Arrow="arrow",t.Open="open",t.Close="close",t.Function="function",t.BigOp="bigop",t.Punct="punct",t}({});function ft(t,e){return{char:t,kind:e}}var bt="ordinary",gt="binary",vt="relation",xt="arrow",yt="function",wt="bigop",Lt="punct",kt={alpha:ft("α",bt),beta:ft("β",bt),gamma:ft("γ",bt),delta:ft("δ",bt),epsilon:ft("ϵ",bt),varepsilon:ft("ε",bt),zeta:ft("ζ",bt),eta:ft("η",bt),theta:ft("θ",bt),vartheta:ft("ϑ",bt),iota:ft("ι",bt),kappa:ft("κ",bt),lambda:ft("λ",bt),mu:ft("μ",bt),nu:ft("ν",bt),xi:ft("ξ",bt),omicron:ft("ο",bt),pi:ft("π",bt),varpi:ft("ϖ",bt),rho:ft("ρ",bt),varrho:ft("ϱ",bt),sigma:ft("σ",bt),varsigma:ft("ς",bt),tau:ft("τ",bt),upsilon:ft("υ",bt),phi:ft("ϕ",bt),varphi:ft("φ",bt),chi:ft("χ",bt),psi:ft("ψ",bt),omega:ft("ω",bt),Gamma:ft("Γ",bt),Delta:ft("Δ",bt),Theta:ft("Θ",bt),Lambda:ft("Λ",bt),Xi:ft("Ξ",bt),Pi:ft("Π",bt),Sigma:ft("Σ",bt),Upsilon:ft("Υ",bt),Phi:ft("Φ",bt),Psi:ft("Ψ",bt),Omega:ft("Ω",bt)},St={sin:ft("sin",yt),cos:ft("cos",yt),tan:ft("tan",yt),cot:ft("cot",yt),sec:ft("sec",yt),csc:ft("csc",yt),sinh:ft("sinh",yt),cosh:ft("cosh",yt),tanh:ft("tanh",yt),coth:ft("coth",yt),arcsin:ft("arcsin",yt),arccos:ft("arccos",yt),arctan:ft("arctan",yt),log:ft("log",yt),ln:ft("ln",yt),lg:ft("lg",yt),exp:ft("exp",yt),deg:ft("deg",yt),det:ft("det",yt),dim:ft("dim",yt),hom:ft("hom",yt),ker:ft("ker",yt),arg:ft("arg",yt),Pr:ft("Pr",yt)},Ct={sum:ft("∑",wt),prod:ft("∏",wt),coprod:ft("∐",wt),int:ft("∫",wt),iint:ft("∬",wt),iiint:ft("∭",wt),oint:ft("∮",wt),bigcup:ft("⋃",wt),bigcap:ft("⋂",wt),bigsqcup:ft("⨆",wt),bigvee:ft("⋁",wt),bigwedge:ft("⋀",wt),bigoplus:ft("⨁",wt),bigotimes:ft("⨂",wt),bigodot:ft("⨀",wt),biguplus:ft("⨄",wt),lim:ft("lim",wt),limsup:ft("lim sup",wt),liminf:ft("lim inf",wt),injlim:ft("inj lim",wt),projlim:ft("proj lim",wt),max:ft("max",wt),min:ft("min",wt),sup:ft("sup",wt),inf:ft("inf",wt),gcd:ft("gcd",wt)},$t={times:ft("×",gt),div:ft("÷",gt),pm:ft("±",gt),mp:ft("∓",gt),cdot:ft("⋅",gt),ast:ft("∗",gt),star:ft("⋆",gt),circ:ft("∘",gt),bullet:ft("∙",gt),oplus:ft("⊕",gt),ominus:ft("⊖",gt),otimes:ft("⊗",gt),oslash:ft("⊘",gt),odot:ft("⊙",gt),cap:ft("∩",gt),cup:ft("∪",gt),uplus:ft("⊎",gt),sqcap:ft("⊓",gt),sqcup:ft("⊔",gt),wedge:ft("∧",gt),land:ft("∧",gt),vee:ft("∨",gt),lor:ft("∨",gt),setminus:ft("∖",gt),wr:ft("≀",gt),diamond:ft("⋄",gt),bigtriangleup:ft("△",gt),bigtriangledown:ft("▽",gt),triangleleft:ft("◁",gt),triangleright:ft("▷",gt),amalg:ft("⨿",gt),dagger:ft("†",gt),ddagger:ft("‡",gt)},At={leq:ft("≤",vt),le:ft("≤",vt),geq:ft("≥",vt),ge:ft("≥",vt),neq:ft("≠",vt),ne:ft("≠",vt),equiv:ft("≡",vt),sim:ft("∼",vt),simeq:ft("≃",vt),cong:ft("≅",vt),approx:ft("≈",vt),propto:ft("∝",vt),prec:ft("≺",vt),succ:ft("≻",vt),preceq:ft("⪯",vt),succeq:ft("⪰",vt),ll:ft("≪",vt),gg:ft("≫",vt),lll:ft("⋘",vt),ggg:ft("⋙",vt),subset:ft("⊂",vt),supset:ft("⊃",vt),subseteq:ft("⊆",vt),supseteq:ft("⊇",vt),subsetneq:ft("⊊",vt),supsetneq:ft("⊋",vt),sqsubseteq:ft("⊑",vt),sqsupseteq:ft("⊒",vt),in:ft("∈",vt),ni:ft("∋",vt),notin:ft("∉",vt),mid:ft("∣",vt),parallel:ft("∥",vt),perp:ft("⊥",vt),models:ft("⊨",vt),vdash:ft("⊢",vt),dashv:ft("⊣",vt),doteq:ft("≐",vt),asymp:ft("≍",vt),bowtie:ft("⋈",vt),smile:ft("⌣",vt),frown:ft("⌢",vt)},zt={leftarrow:ft("←",xt),gets:ft("←",xt),rightarrow:ft("→",xt),to:ft("→",xt),leftrightarrow:ft("↔",xt),Leftarrow:ft("⇐",xt),Rightarrow:ft("⇒",xt),Leftrightarrow:ft("⇔",xt),mapsto:ft("↦",xt),longrightarrow:ft("⟶",xt),longleftarrow:ft("⟵",xt),longleftrightarrow:ft("⟷",xt),Longrightarrow:ft("⟹",xt),Longleftarrow:ft("⟸",xt),Longleftrightarrow:ft("⟺",xt),implies:ft("⟹",xt),iff:ft("⟺",xt),uparrow:ft("↑",xt),downarrow:ft("↓",xt),updownarrow:ft("↕",xt),nearrow:ft("↗",xt),searrow:ft("↘",xt),swarrow:ft("↙",xt),nwarrow:ft("↖",xt),hookleftarrow:ft("↩",xt),hookrightarrow:ft("↪",xt),rightharpoonup:ft("⇀",xt),rightharpoondown:ft("⇁",xt),leftharpoonup:ft("↼",xt),leftharpoondown:ft("↽",xt),nleftarrow:ft("↚",xt),nrightarrow:ft("↛",xt)},_t={langle:ft("⟨","open"),rangle:ft("⟩","close"),lceil:ft("⌈","open"),rceil:ft("⌉","close"),lfloor:ft("⌊","open"),rfloor:ft("⌋","close"),lbrace:ft("{","open"),rbrace:ft("}","close"),lbrack:ft("[","open"),rbrack:ft("]","close"),lvert:ft("|","open"),rvert:ft("|","close"),lVert:ft("‖","open"),rVert:ft("‖","close"),vert:ft("|","relation"),Vert:ft("‖","relation"),backslash:ft("\\",bt)},Et={infty:ft("∞",bt),partial:ft("∂",bt),nabla:ft("∇",bt),forall:ft("∀",bt),exists:ft("∃",bt),nexists:ft("∄",bt),emptyset:ft("∅",bt),varnothing:ft("∅",bt),aleph:ft("ℵ",bt),beth:ft("ℶ",bt),hbar:ft("ℏ",bt),ell:ft("ℓ",bt),Re:ft("ℜ",bt),Im:ft("ℑ",bt),wp:ft("℘",bt),prime:ft("′",bt),angle:ft("∠",bt),measuredangle:ft("∡",bt),triangle:ft("△",bt),neg:ft("¬",bt),lnot:ft("¬",bt),top:ft("⊤",bt),bot:ft("⊥",bt),flat:ft("♭",bt),natural:ft("♮",bt),sharp:ft("♯",bt),clubsuit:ft("♣",bt),diamondsuit:ft("♢",bt),heartsuit:ft("♡",bt),spadesuit:ft("♠",bt),surd:ft("√",bt),complement:ft("∁",bt),square:ft("□",bt),blacksquare:ft("■",bt),bigstar:ft("★",bt),checkmark:ft("✓",bt),degree:ft("°",bt),cdots:ft("⋯",bt),ldots:ft("…",bt),dots:ft("…",bt),dotsb:ft("⋯",bt),vdots:ft("⋮",bt),ddots:ft("⋱",bt)},Bt={colon:ft(":",Lt),cdotp:ft("·",Lt),ldotp:ft(".",Lt)},It={...kt,...St,...Ct,...$t,...At,...zt,..._t,...Et,...Bt},Pt={"(":ft("(","open"),")":ft(")","close"),"[":ft("[","open"),"]":ft("]","close"),"|":ft("|","relation"),"/":ft("/",bt)};function Dt(t){if("."===t)return ft("",bt);if(t.startsWith("\\")){const e=t.slice(1);return"{"===e?ft("{","open"):"}"===e?ft("}","close"):"|"===e?ft("‖","relation"):"\\"===e?ft("\\",bt):_t[e]}return Pt[t]}var Nt=/* @__PURE__ */function(t){return t.Command="command",t.GroupOpen="groupOpen",t.GroupClose="groupClose",t.Superscript="superscript",t.Subscript="subscript",t.Prime="prime",t.Ampersand="ampersand",t.RowBreak="rowBreak",t.NbSpace="nbSpace",t.Number="number",t.Char="char",t}({}),Ft=new Set(["{","}","%","$","#","&","_",",",":",";","!"," ","|","\\",".","/","'","~","^"]);function qt(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function Rt(t){return t>="0"&&t<="9"}function Ot(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function Tt(t,e,n){return{type:t,value:e,position:n}}function Mt(t,e){const n=t[e+1];if(void 0!==n&&!qt(n))return"\\"===n?Tt("rowBreak","\\",e):Tt("command",n,e);let i=e+1;for(;i<t.length;){const e=t[i];if(void 0===e||!qt(e))break;i+=1}return Tt("command",t.slice(e+1,i),e)}function jt(t,e){let n=e;for(;n<t.length;){const e=t[n];if(void 0===e||!Rt(e))break;n+=1}if("."===t[n]&&void 0!==t[n+1]&&Rt(t[n+1]??""))for(n+=1;n<t.length;){const e=t[n];if(void 0===e||!Rt(e))break;n+=1}return Tt("number",t.slice(e,n),e)}function Ht(t,e){switch(t){case"{":return Tt("groupOpen",t,e);case"}":return Tt("groupClose",t,e);case"^":return Tt("superscript",t,e);case"_":return Tt("subscript",t,e);case"'":return Tt("prime",t,e);case"&":return Tt("ampersand",t,e);case"~":return Tt("nbSpace",t,e);default:return Tt("char",t,e)}}function Gt(t,e){return{glyph:t,under:!1,stretchy:e}}function Ut(t,e){return{glyph:t,under:!0,stretchy:e}}var Kt={hat:Gt("^",!1),widehat:Gt("^",!0),check:Gt("ˇ",!1),tilde:Gt("~",!1),widetilde:Gt("~",!0),bar:Gt("‾",!1),overline:Gt("‾",!0),vec:Gt("→",!1),overrightarrow:Gt("→",!0),overleftarrow:Gt("←",!0),overleftrightarrow:Gt("↔",!0),dot:Gt("˙",!1),ddot:Gt("¨",!1),dddot:Gt("⃛",!1),acute:Gt("´",!1),grave:Gt("`",!1),breve:Gt("˘",!1),mathring:Gt("˚",!1),overbrace:Gt("⏞",!0),underline:Ut("_",!0),underbrace:Ut("⏟",!0),underrightarrow:Ut("→",!0),underleftarrow:Ut("←",!0)},Wt={matrix:{open:"",close:""},pmatrix:{open:"(",close:")"},bmatrix:{open:"[",close:"]"},Bmatrix:{open:"{",close:"}"},vmatrix:{open:"|",close:"|"},Vmatrix:{open:"‖",close:"‖"},cases:{open:"{",close:"",columnalign:"left"},aligned:{open:"",close:"",columnalign:"right left"},align:{open:"",close:"",columnalign:"right left"},gathered:{open:"",close:"",columnalign:"center"},smallmatrix:{open:"",close:""}};function Vt(t){return t.type===Nt.Command&&"end"===t.value}function Zt(t){return t.type===Nt.Ampersand||t.type===Nt.RowBreak||t.type===Nt.Command&&"end"===t.value}var Xt={",":"0.167em",":":"0.222em",";":"0.278em","!":"-0.167em"," ":"0.25em",quad:"1em",qquad:"2em",thinspace:"0.167em",medspace:"0.222em",thickspace:"0.278em",negthinspace:"-0.167em",negmedspace:"-0.222em",negthickspace:"-0.278em",enspace:"0.5em"};function Qt(t){return t in Xt}function Jt(t){const e=Xt[t];if(void 0!==e)return P({width:e})}function Yt(){return P({width:"0.25em"})}function te(t){const e=t.parseRawArgument();return(n=e)in Wt||"array"===n?function(t,e){"array"===t&&(e.parseOptionalArgument(),e.parseRawArgument());const n=function(t,e){const n=[];let i=[],a=[];const r=()=>{i.push(D(a.join(""))),a=[]},o=()=>{r(),n.push(i),i=[]};for(;;){const n=e.peek();if(void 0===n){e.error({message:`Unterminated environment \\begin{${t}}`});break}if(Vt(n)){e.next(),e.parseRawArgument();break}if(n.type===Nt.Ampersand){e.next(),r();continue}if(n.type===Nt.RowBreak){e.next(),o();continue}if(n.type===Nt.GroupClose){e.next(),e.error({message:"Unmatched brace",position:n.position});continue}const i=e.parseAtomsUntil(Zt);a.push(...i.map(t=>t.node))}return(a.length>0||i.length>0)&&o(),0===n.length&&n.push([""]),n}(t,e).map(t=>t.map(t=>t)),i=Wt[t]??{open:"",close:""},a=(r=n,o=i.columnalign?{columnalign:i.columnalign}:void 0,z("mtable",r.map(T).join(""),o));var r,o;return i.open||i.close?dt(D(`${i.open?B(i.open,{stretchy:!0,fence:!0}):""}${a}${i.close?B(i.close,{stretchy:!0,fence:!0}):""}`)):dt(a)}(e,t):(t.error({message:"Unknown environment",command:e}),dt(z("merror",I(e))));var n}function ee(t){return t.type===Nt.Command&&"right"===t.value}function ne(t){const e=t.next();return void 0===e?".":e.type===Nt.Command?`\\${e.value}`:e.value}function ie(t){return t&&""!==t.char?B(t.char,{fence:!0,stretchy:!0}):""}var ae={},re={"double-struck":{upperBase:120120,lowerBase:120146,digitBase:120792,holes:{C:8450,H:8461,N:8469,P:8473,Q:8474,R:8477,Z:8484}},script:{upperBase:119964,lowerBase:119990,holes:{B:8492,E:8496,F:8497,H:8459,I:8464,L:8466,M:8499,R:8475,e:8495,g:8458,o:8500}},fraktur:{upperBase:120068,lowerBase:120094,holes:{C:8493,H:8460,I:8465,R:8476,Z:8488}},bold:{upperBase:119808,lowerBase:119834,digitBase:120782,holes:ae},italic:{upperBase:119860,lowerBase:119886,holes:{h:8462}},"sans-serif":{upperBase:120224,lowerBase:120250,digitBase:120802,holes:ae},monospace:{upperBase:120432,lowerBase:120458,digitBase:120822,holes:ae}};function oe(t,e){if(1!==t.length)return null;const n=re[e],i=n.holes[t];return void 0!==i?String.fromCodePoint(i):function(t){return t>="A"&&t<="Z"}(t)?String.fromCodePoint(n.upperBase+(t.charCodeAt(0)-65)):function(t){return t>="a"&&t<="z"}(t)?String.fromCodePoint(n.lowerBase+(t.charCodeAt(0)-97)):function(t){return t>="0"&&t<="9"}(t)&&void 0!==n.digitBase?String.fromCodePoint(n.digitBase+(t.charCodeAt(0)-48)):null}var le=/<(mi|mn)>([^<]*)<\/\1>/g,se=/<mi>([^<]*)<\/mi>/g;var ce={mathbb:"double-struck",mathcal:"script",mathscr:"script",mathfrak:"fraktur",mathbf:"bold",mathit:"italic",mathsf:"sans-serif",mathtt:"monospace"},pe={boldsymbol:"bold-italic",bm:"bold-italic"},ue={text:void 0,textnormal:"normal",textrm:"normal",textbf:"bold",textit:"italic",textsf:"sans-serif",texttt:"monospace",mbox:void 0};function de(t,e){if("operatorname"===t)return dt(_(e.parseRawArgument(),{mathvariant:"normal"}));if(t in ue){const n=ue[t],i=e.parseRawArgument();return dt(n?I(i,{mathvariant:n}):I(i))}const n=ce[t];if(void 0!==n)return dt((i=e.parseArgument(),a=n,i.replace(le,(t,e,n)=>{const i=function(t,e){let n="";for(const i of t)n+=oe(i,e)??i;return n}(n,a);return"mn"===e?E(i):_(i)})));var i,a;if("mathrm"===t)return dt(e.parseArgument().replace(se,(t,e)=>_(e,{mathvariant:"normal"})));const r=pe[t],o=e.parseArgument();return dt(void 0===r?o:z("mstyle",o,{mathvariant:r}))}var me=new Set(["frac","dfrac","tfrac","cfrac"]),he=new Set(["binom","dbinom","tbinom","choose"]),fe=new Set(["overset","underset","stackrel"]);var be=new Set(["∫","∬","∭","∮"]);var ge=class{source;tokens;pos=0;depth=0;depthExceeded=!1;errors=[];display;constructor(t,e,n){this.source=t,this.tokens=e,this.display=n}get collectedErrors(){return this.errors}peek(){return this.tokens[this.pos]}next(){const t=this.tokens[this.pos];return void 0!==t&&(this.pos+=1),t}error(t){this.errors.push(t)}parseTopLevel(){const t=[];for(;;){const e=this.peek();if(void 0===e)break;if(e.type===Nt.GroupClose){this.next(),this.error({message:"Unmatched brace",position:e.position});continue}const n=this.parseAtomWithScripts();void 0!==n&&t.push(n)}return t}parseExpression(t){const e=[];for(;;){const n=this.peek();if(void 0===n||t(n))break;if(n.type===Nt.GroupClose)break;const i=this.parseAtomWithScripts();void 0!==i&&e.push(i)}return e}parseAtomsUntil(t){return this.parseExpression(t)}parseAtomWithScripts(){const t=this.parseBaseAtom();if(void 0!==t)return this.attachScripts(t)}attachScripts(t){let e,n,i,a="";for(;;){const t=this.peek();if(void 0===t)break;if(t.type!==Nt.Prime)if(t.type!==Nt.Command||"limits"!==t.value)if(t.type!==Nt.Command||"nolimits"!==t.value)if(t.type!==Nt.Superscript){if(t.type!==Nt.Subscript)break;this.next(),e=this.combineSub(e,this.parseArgument())}else this.next(),n=this.combineSup(n,this.parseArgument());else this.next(),i="nolimits";else this.next(),i="limits";else this.next(),a+="′"}return a&&(n=void 0===n?B(a):D(`${B(a)}${n}`)),void 0===e&&void 0===n?t:dt(this.buildScripts(t,e,n,i))}combineSup(t,e){return void 0===t?e:(this.error({message:"Double superscript"}),D(`${t}${e}`))}combineSub(t,e){return void 0===t?e:(this.error({message:"Double subscript"}),D(`${t}${e}`))}buildScripts(t,e,n,i){const a=!0===t.bigOp&&!0!==t.intLike&&this.display;if("limits"===i||"nolimits"!==i&&a){if(void 0!==e&&void 0!==n)return function(t,e,n){return z("munderover",`${t}${e}${n}`)}(t.node,e,n);if(void 0!==e)return R(t.node,e);if(void 0!==n)return q(t.node,n)}return void 0!==e&&void 0!==n?function(t,e,n){return z("msubsup",`${t}${e}${n}`)}(t.node,e,n):void 0!==e?function(t,e){return z("msub",`${t}${e}`)}(t.node,e):void 0!==n?function(t,e){return z("msup",`${t}${e}`)}(t.node,n):t.node}parseBaseAtom(){if(this.depth>=256)return this.bailDeepNesting();this.depth+=1;try{return this.parseBaseAtomInner()}finally{this.depth-=1}}bailDeepNesting(){const t=this.next();if(void 0!==t&&!this.depthExceeded)return this.depthExceeded=!0,this.error({message:"Maximum nesting depth exceeded",position:t.position}),dt(z("merror",I("⋯")))}parseBaseAtomInner(){const t=this.next();if(void 0!==t)switch(t.type){case Nt.Number:return dt(E(t.value));case Nt.Char:return this.parseChar(t.value);case Nt.GroupOpen:return this.parseGroup();case Nt.NbSpace:return dt(Yt());case Nt.Command:return this.parseCommand(t);case Nt.Superscript:case Nt.Subscript:case Nt.Prime:return this.pos-=1,this.attachScripts(dt(D("")));case Nt.Ampersand:case Nt.RowBreak:case Nt.GroupClose:default:return}}parseGroup(){const t=this.parseExpression(()=>!1);return this.expect(Nt.GroupClose),dt(N(t.map(t=>t.node)))}parseChar(t){const e=Dt(t);return!e||e.kind!==ht.Open&&e.kind!==ht.Close?dt("+"===t||"-"===t||"*"===t||"="===t||"/"===t||"|"===t||","===t||";"===t||"."===t||":"===t||"!"===t||"?"===t||"<"===t||">"===t?B(t):_(t)):dt(B(t,{fence:!0}),e.kind)}parseCommand(t){const e=t.value,n=function(t){return It[t]}(e);if(n)return this.symbolAtom(n);if(1===(i=e).length&&Ft.has(i))return this.controlSymbolAtom(e);var i;const a=this.dispatchStructural(e);if(void 0!==a)return a;const r=this.dispatchSpecial(e,t);return void 0!==r?r:(this.error({message:"Unknown command",command:`\\${e}`,position:t.position}),dt(z("merror",I(`\\${e}`))))}dispatchStructural(t){if(function(t){return me.has(t)}(t))return dt(F((e=this).parseArgument(),e.parseArgument()));var e;if(function(t){return he.has(t)}(t))return function(t){const e=F(t.parseArgument(),t.parseArgument(),{linethickness:0});return dt(D(`${B("(",{fence:!0})}${e}${B(")",{fence:!0})}`))}(this);if("sqrt"===t)return function(t){const e=t.parseOptionalArgument(),n=t.parseArgument();return dt(void 0===e||""===e?function(t){return z("msqrt",t)}(n):function(t,e){return z("mroot",`${t}${e}`)}(n,e))}(this);if(function(t){return fe.has(t)}(t))return function(t,e){const n=e.parseArgument(),i=e.parseArgument();return dt("underset"===t?R(i,n):q(i,n))}(t,this);if(function(t){return t in Kt}(t))return function(t,e){const n=Kt[t];if(!n)return dt("");const i=e.parseArgument(),a=B(n.glyph,{stretchy:n.stretchy}),r=n.under?{accentunder:!0}:{accent:!0};return dt(n.under?R(i,a,r):q(i,a,r))}(t,this);if(function(t){return t in ce||t in pe||t in ue||"mathrm"===t||"operatorname"===t}(t))return de(t,this);if(Qt(t)){const e=Jt(t);return void 0===e?void 0:dt(e)}}dispatchSpecial(t,e){return"left"===t?function(t){const e=Dt(ne(t)),n=t.parseAtomsUntil(ee),i=t.peek();let a=".";void 0!==i&&ee(i)?(t.next(),a=ne(t)):t.error({message:"Unmatched \\left"});const r=Dt(a),o=ie(e),l=ie(r);return dt(N([o,...n.map(t=>t.node),l]))}(this):"begin"===t?te(this):"pmod"===t?function(t){const e=t.parseArgument(),n=B("(",{fence:!0}),i=B(")",{fence:!0});return dt(D(`${n}${I("mod")}${Yt()}${e}${i}`))}(this):"bmod"===t||"mod"===t?dt(B("mod",{lspace:"0.222em",rspace:"0.222em"})):"substack"===t?function(t){!function(t){const e=t.peek();void 0!==e&&e.type===Nt.GroupOpen&&t.next()}(t);const e=[];let n=[];for(;;){const i=t.peek();if(void 0===i||i.type===Nt.GroupClose)break;if(i.type===Nt.RowBreak){t.next(),e.push(N(n)),n=[];continue}const a=t.parseAtomsUntil(t=>t.type===Nt.RowBreak);n.push(...a.map(t=>t.node))}return function(t){const e=t.peek();void 0!==e&&e.type===Nt.GroupClose&&t.next()}(t),e.push(N(n)),dt(z("mtable",e.map(t=>z("mtr",z("mtd",t))).join("")))}(this):"right"===t?(n=e.position,ne(this),this.error({message:"Unmatched \\right",position:n}),dt(N([]))):void 0;var n}symbolAtom(t){switch(t.kind){case ht.Ordinary:return dt(_(t.char),t.kind);case ht.Function:return dt(_(t.char,{mathvariant:"normal"}),t.kind);case ht.BigOp:return this.bigOperator(t);case ht.Open:case ht.Close:return dt(B(t.char,{fence:!0}),t.kind);default:return dt(B(t.char),t.kind)}}bigOperator(t){if(/[a-z]/i.test(t.char))return mt(B(t.char,{movablelimits:!0}),t.kind);const e=be.has(t.char);return mt(B(t.char,{movablelimits:!0,largeop:!0}),t.kind,e)}controlSymbolAtom(t){if(Qt(t)){const e=Jt(t);return void 0===e?void 0:dt(e)}return"{"===t?dt(B("{",{fence:!0}),ht.Open):"}"===t?dt(B("}",{fence:!0}),ht.Close):dt("|"===t?B("‖"):"\\"===t?B("\\"):"/"===t?B("/"):"'"===t?B("′"):"."===t?B("."):I(t))}parseArgument(){return""===(t=this.parseArgumentRaw())?D(""):t;var t}parseArgumentRaw(){const t=this.peek();if(void 0===t)return"";if(t.type===Nt.GroupOpen){this.next();const t=this.parseExpression(()=>!1);return this.expect(Nt.GroupClose),N(t.map(t=>t.node))}return this.parseBaseAtom()?.node??""}parseOptionalArgument(){const t=this.peek();if(void 0===t||t.type!==Nt.Char||"["!==t.value)return;this.next();const e=this.parseExpression(t=>t.type===Nt.Char&&"]"===t.value),n=this.peek();return void 0!==n&&n.type===Nt.Char&&"]"===n.value&&this.next(),N(e.map(t=>t.node))}parseRawArgument(){const t=this.peek();if(void 0===t)return"";if(t.type!==Nt.GroupOpen)return this.next(),t.value;const e=t.position;this.next();let n=1,i=this.source.length;for(;;){const t=this.next();if(void 0===t)break;if(t.type===Nt.GroupOpen)n+=1;else if(t.type===Nt.GroupClose&&(n-=1,0===n)){i=t.position;break}}return this.source.slice(e+1,i)}expect(t){const e=this.peek();void 0===e||e.type!==t?t===Nt.GroupClose&&this.error({message:"Unmatched brace"}):this.next()}},ve="<mrow></mrow>";function xe(t,e){const n=e?.display??!1;if(""===t.trim())return{presentation:ve,errors:[]};const{atoms:i,errors:a}=function(t,e){const n=new ge(t,function(t){const e=[];let n=0;for(;n<t.length;){const i=t[n]??"";if("\\"===i){const i=Mt(t,n);if(e.push(i),n+="rowBreak"===i.type?2:Math.max(1,i.value.length)+1,"command"===i.type&&qt(i.value[0]??""))for(;n<t.length&&Ot(t[n]??"");)n+=1;continue}if(Rt(i)){const i=jt(t,n);e.push(i),n+=i.value.length;continue}if(Ot(i)){n+=1;continue}const a=Ht(i,n);a&&e.push(a),n+=1}return e}(t),e);return{atoms:n.parseTopLevel(),errors:n.collectedErrors}}(t,n);return{presentation:ye(i),errors:a}}function ye(t){if(0===t.length)return ve;if(1===t.length){const e=t[0];return e?e.node:ve}return D(t.map(t=>t.node).join(""))}var we=/(?<!\$)\$([^$\n\uFFFC]+)\$$/,Le=/\$\$([^$\n\uFFFC]+)\$\$$/;function ke(t,e){const n=t.getBlock(e);return void 0!==n&&"code_block"!==n.type}function Se(t,e){const n=t-e;return n<0?null:{from:n,to:t}}var Ce={insertInline:"Insert formula",insertInlineTooltip:"Insert inline formula",editFormula:"Edit formula",latexLabel:"LaTeX",latexPlaceholder:"e.g. \\frac{a}{b} + \\sqrt{x}",previewLabel:"Preview",insertButton:"Insert",updateButton:"Update",cancelButton:"Cancel",displayToggle:"Display (block) equation",sizeLabel:"Size",sizeDefault:"Default",altLabel:"Description",altPlaceholder:"Spoken description (optional)",paletteLabel:"Symbols and structures",emptyPreview:"Nothing to preview yet.",inserted:"Formula inserted.",updated:"Formula updated.",editing:"Editing formula.",selected:"Formula selected. Press Enter to edit.",unknownCommand:t=>`Unknown LaTeX command: ${t}`,groupFractions:"Fractions",groupScripts:"Scripts",groupRoots:"Roots",groupAccents:"Accents",groupOperators:"Operators",groupFunctions:"Functions",groupGreek:"Greek letters",groupRelations:"Relations",groupSets:"Sets",groupLogic:"Logic",groupArrows:"Arrows",groupDelimiters:"Brackets",groupDots:"Dots",groupMatrices:"Matrices"},$e=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-D1jFXqLJ.mjs"),"./locales/de.ts":()=>import("./de-DY3obIAF.mjs"),"./locales/es.ts":()=>import("./es-CtOtKQCP.mjs"),"./locales/fr.ts":()=>import("./fr-DjMZ-3K5.mjs"),"./locales/hi.ts":()=>import("./hi-4CiAKVjT.mjs"),"./locales/pt.ts":()=>import("./pt-BkpVtod-.mjs"),"./locales/ru.ts":()=>import("./ru-BotG0MFT.mjs"),"./locales/zh.ts":()=>import("./zh-CWGAPVei.mjs")});async function Ae(t){return f($e,t,Ce)}var ze=/^\s*\$\$([^\n]+?)\$\$\s*$/;function _e(t,e){const{presentation:n}=xe(t,{display:e});return{mathml:j({presentation:n,latex:t,display:e}),latex:t,alt:"",fontSize:""}}var Ee=class{root;buttons=[];activeIndex=0;constructor(t,e,n){this.root=document.createElement("div"),this.root.className="notectl-math-palette",this.root.setAttribute("role","toolbar"),this.root.setAttribute("aria-label",e);for(const i of t)this.root.appendChild(this.buildGroup(i,n));this.root.addEventListener("keydown",t=>this.onKeydown(t)),this.setActive(0)}focus(){this.buttons[this.activeIndex]?.focus()}activeButton(){return this.buttons[this.activeIndex]}buildGroup(t,e){const n=document.createElement("div");n.className="notectl-math-palette__group",n.setAttribute("role","group"),n.setAttribute("aria-label",t.label);for(const i of t.items){const t=document.createElement("button");t.type="button",t.className="notectl-math-palette__btn",t.textContent=i.label,t.setAttribute("aria-label",i.ariaLabel),t.tabIndex=-1,t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",()=>e(i.snippet)),this.buttons.push(t),n.appendChild(t)}return n}onKeydown(t){if("Enter"===t.key||" "===t.key)return t.preventDefault(),t.stopPropagation(),void this.buttons[this.activeIndex]?.click();const e=this.buttons.length-1;let n=this.activeIndex;switch(t.key){case"ArrowRight":case"ArrowDown":n=this.activeIndex>=e?0:this.activeIndex+1;break;case"ArrowLeft":case"ArrowUp":n=this.activeIndex<=0?e:this.activeIndex-1;break;case"Home":n=0;break;case"End":n=e;break;default:return}t.preventDefault(),t.stopPropagation(),this.setActive(n),this.buttons[n]?.focus()}setActive(t){const e=this.buttons[this.activeIndex];e&&(e.tabIndex=-1);const n=this.buttons[t];n&&(n.tabIndex=0),this.activeIndex=t}},Be=0,Ie=class{root;options;textarea;preview;previewEmpty;errorsList;altInput;commitBtn;palette=null;displayCheckbox=null;cancelBtn=null;fontSizeSelect=null;display;lastErrorKey="";constructor(t){this.options=t,this.display=t.initialDisplay??!1;const e=++Be;this.root=document.createElement("div"),this.root.className="notectl-formula-editor",this.root.setAttribute("role","group"),this.root.setAttribute("aria-label",t.locale.latexLabel),t.palette&&t.palette.length>0&&(this.palette=new Ee(t.palette,t.locale.paletteLabel,t=>this.insertSnippet(t)),this.root.appendChild(this.palette.root)),this.textarea=this.buildLatexField(e),this.preview=document.createElement("div"),this.previewEmpty=document.createElement("div"),this.errorsList=document.createElement("ul"),this.altInput=this.buildAltField(e),this.commitBtn=document.createElement("button"),this.root.appendChild(this.buildPreview()),this.root.appendChild(this.errorsList),this.root.appendChild(this.altInput.parentElement),t.fontSizes&&t.fontSizes.length>0&&this.root.appendChild(this.buildSizeField(e)),"insert"===t.mode&&this.root.appendChild(this.buildDisplayToggle(e)),this.root.appendChild(this.buildActions()),this.errorsList.className="notectl-formula-editor__errors",this.errorsList.id=`notectl-formula-errors-${e}`,this.errorsList.setAttribute("aria-live","polite"),this.textarea.setAttribute("aria-describedby",this.errorsList.id),this.root.addEventListener("keydown",t=>this.onRootKeydown(t)),this.update()}focus(){this.textarea.focus(),this.textarea.setSelectionRange(this.textarea.value.length,this.textarea.value.length)}onRootKeydown(t){if("Escape"===t.key)return t.preventDefault(),t.stopPropagation(),void this.options.onCancel();"Tab"===t.key&&(t.preventDefault(),t.stopPropagation(),this.moveFocus(!t.shiftKey))}focusStops(){const t=[],e=this.palette?.activeButton();return e&&t.push(e),t.push(this.textarea,this.altInput),this.fontSizeSelect&&t.push(this.fontSizeSelect),this.displayCheckbox&&t.push(this.displayCheckbox),this.cancelBtn&&t.push(this.cancelBtn),t.push(this.commitBtn),t}moveFocus(t){const e=this.focusStops();if(0===e.length)return;const n=this.activeElement();let i=e.findIndex(t=>t===n);-1===i&&n&&this.palette?.root.contains(n)&&(i=0),-1===i&&(i=t?e.length-1:0),e[(i+(t?1:-1)+e.length)%e.length]?.focus()}activeElement(){let t=this.root.getRootNode().activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}getResult(){const t=this.textarea.value.trim(),e=this.altInput.value.trim(),{presentation:n}=xe(t,{display:this.display});return{latex:t,mathml:j({presentation:n,latex:t,display:this.display,alt:e||void 0}),alt:e,display:this.display,fontSize:this.fontSizeSelect?.value??""}}insertSnippet(t){const e=this.textarea.selectionStart??this.textarea.value.length,n=this.textarea.selectionEnd??e,i=t.indexOf("$0"),a=i>=0?t.replace("$0",""):t,r=i>=0?i:a.length,o=this.textarea.value;this.textarea.value=o.slice(0,e)+a+o.slice(n);const l=e+r;this.textarea.focus(),this.textarea.setSelectionRange(l,l),this.update()}buildLatexField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-latex-${t}`,n.textContent=this.options.locale.latexLabel;const i=document.createElement("textarea");return i.id=`notectl-formula-latex-${t}`,i.className="notectl-formula-editor__input",i.placeholder=this.options.locale.latexPlaceholder,i.rows=2,i.spellcheck=!1,i.value=this.options.initialLatex??"",i.addEventListener("input",()=>this.update()),i.addEventListener("keydown",t=>this.onTextareaKeydown(t)),e.appendChild(n),e.appendChild(i),this.root.appendChild(e),i}buildPreview(){const t=document.createElement("div");t.className="notectl-formula-editor__field";const e=document.createElement("span");return e.className="notectl-formula-editor__label",e.textContent=this.options.locale.previewLabel,this.preview.className="notectl-formula-editor__preview",this.previewEmpty.className="notectl-formula-editor__preview-empty",this.previewEmpty.textContent=this.options.locale.emptyPreview,t.appendChild(e),t.appendChild(this.previewEmpty),t.appendChild(this.preview),t}buildAltField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-alt-${t}`,n.textContent=this.options.locale.altLabel;const i=document.createElement("input");return i.id=`notectl-formula-alt-${t}`,i.type="text",i.className="notectl-formula-editor__alt",i.placeholder=this.options.locale.altPlaceholder,i.value=this.options.initialAlt??"",e.appendChild(n),e.appendChild(i),i}buildSizeField(t){const e=document.createElement("div");e.className="notectl-formula-editor__field";const n=document.createElement("label");n.className="notectl-formula-editor__label",n.htmlFor=`notectl-formula-size-${t}`,n.textContent=this.options.locale.sizeLabel;const i=document.createElement("select");i.id=`notectl-formula-size-${t}`,i.className="notectl-formula-editor__size";const a=this.options.initialFontSize??"";i.appendChild(this.buildSizeOption("",this.options.locale.sizeDefault));for(const r of this.options.fontSizes??[])i.appendChild(this.buildSizeOption(`${r}px`,String(r)));return a&&!Array.from(i.options).some(t=>t.value===a)&&i.appendChild(this.buildSizeOption(a,a.replace("px",""))),i.value=a,i.addEventListener("change",()=>this.applyPreviewFontSize()),this.fontSizeSelect=i,e.appendChild(n),e.appendChild(i),e}buildSizeOption(t,e){const n=document.createElement("option");return n.value=t,n.textContent=e,n}applyPreviewFontSize(){this.preview.style.fontSize=this.fontSizeSelect?.value||""}buildDisplayToggle(t){const e=document.createElement("label");e.className="notectl-formula-editor__toggle",e.htmlFor=`notectl-formula-display-${t}`;const n=document.createElement("input");n.id=`notectl-formula-display-${t}`,n.type="checkbox",n.checked=this.display,n.addEventListener("change",()=>{this.display=n.checked,this.update()}),this.displayCheckbox=n;const i=document.createElement("span");return i.textContent=this.options.locale.displayToggle,e.appendChild(n),e.appendChild(i),e}buildActions(){const t=document.createElement("div");t.className="notectl-formula-editor__actions";const e=document.createElement("button");return e.type="button",e.className="notectl-formula-editor__btn",e.textContent=this.options.locale.cancel,e.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),e.addEventListener("click",()=>this.options.onCancel()),this.cancelBtn=e,this.commitBtn.type="button",this.commitBtn.className="notectl-formula-editor__btn notectl-formula-editor__btn--primary",this.commitBtn.textContent="edit"===this.options.mode?this.options.locale.commitUpdate:this.options.locale.commitInsert,this.commitBtn.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),this.commitBtn.addEventListener("click",()=>this.commit()),t.appendChild(e),t.appendChild(this.commitBtn),t}onTextareaKeydown(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),this.commit())}commit(){const t=this.getResult();t.latex?this.options.onCommit(t):this.options.onCancel()}update(){this.applyPreviewFontSize();const t=this.textarea.value.trim();if(!t)return this.preview.innerHTML="",this.previewEmpty.hidden=!1,void this.renderErrors([]);this.previewEmpty.hidden=!0;const{presentation:e,errors:n}=xe(t,{display:this.display});this.preview.innerHTML=j({presentation:e,display:this.display}),this.renderErrors(n.map(t=>t.command??t.message))}renderErrors(t){const e=t.join("");if(e!==this.lastErrorKey){this.lastErrorKey=e,this.errorsList.replaceChildren();for(const e of t){const t=document.createElement("li");t.textContent=e.startsWith("\\")?this.options.locale.unknownCommand(e):e,this.errorsList.appendChild(t)}}}};function Pe(t){return[{id:"fractions",label:(e={fractions:t.groupFractions,scripts:t.groupScripts,roots:t.groupRoots,accents:t.groupAccents,operators:t.groupOperators,functions:t.groupFunctions,greek:t.groupGreek,relations:t.groupRelations,sets:t.groupSets,logic:t.groupLogic,arrows:t.groupArrows,delimiters:t.groupDelimiters,dots:t.groupDots,matrices:t.groupMatrices}).fractions,items:[{label:"a╱b",ariaLabel:"Fraction",snippet:"\\frac{$0}{}"},{label:"⒞",ariaLabel:"Binomial coefficient",snippet:"\\binom{$0}{}"}]},{id:"scripts",label:e.scripts,items:[{label:"xⁿ",ariaLabel:"Superscript",snippet:"^{$0}"},{label:"xₙ",ariaLabel:"Subscript",snippet:"_{$0}"},{label:"xⁿₘ",ariaLabel:"Subscript and superscript",snippet:"_{$0}^{}"}]},{id:"roots",label:e.roots,items:[{label:"√",ariaLabel:"Square root",snippet:"\\sqrt{$0}"},{label:"ⁿ√",ariaLabel:"N-th root",snippet:"\\sqrt[$0]{}"}]},{id:"accents",label:e.accents,items:[{label:"→",ariaLabel:"Vector",snippet:"\\vec{$0}"},{label:"â",ariaLabel:"Hat",snippet:"\\hat{$0}"},{label:"ā",ariaLabel:"Overline",snippet:"\\overline{$0}"},{label:"ȧ",ariaLabel:"Dot above",snippet:"\\dot{$0}"},{label:"ã",ariaLabel:"Tilde",snippet:"\\tilde{$0}"}]},{id:"operators",label:e.operators,items:[{label:"∑",ariaLabel:"Sum with limits",snippet:"\\sum_{$0}^{}"},{label:"∏",ariaLabel:"Product with limits",snippet:"\\prod_{$0}^{}"},{label:"∫",ariaLabel:"Integral with limits",snippet:"\\int_{$0}^{}"},{label:"∬",ariaLabel:"Double integral",snippet:"\\iint "},{label:"∮",ariaLabel:"Contour integral",snippet:"\\oint "},{label:"lim",ariaLabel:"Limit",snippet:"\\lim_{$0}"},{label:"∂",ariaLabel:"Partial derivative",snippet:"\\partial "},{label:"∇",ariaLabel:"Nabla (del)",snippet:"\\nabla "},{label:"×",ariaLabel:"Times",snippet:"\\times "},{label:"·",ariaLabel:"Dot product",snippet:"\\cdot "},{label:"±",ariaLabel:"Plus or minus",snippet:"\\pm "},{label:"÷",ariaLabel:"Division",snippet:"\\div "},{label:"∞",ariaLabel:"Infinity",snippet:"\\infty "}]},{id:"functions",label:e.functions,items:[{label:"sin",ariaLabel:"Sine",snippet:"\\sin "},{label:"cos",ariaLabel:"Cosine",snippet:"\\cos "},{label:"tan",ariaLabel:"Tangent",snippet:"\\tan "},{label:"log",ariaLabel:"Logarithm",snippet:"\\log "},{label:"ln",ariaLabel:"Natural logarithm",snippet:"\\ln "},{label:"exp",ariaLabel:"Exponential function",snippet:"\\exp "}]},{id:"greek",label:e.greek,items:[{label:"α",ariaLabel:"Alpha",snippet:"\\alpha "},{label:"β",ariaLabel:"Beta",snippet:"\\beta "},{label:"γ",ariaLabel:"Gamma",snippet:"\\gamma "},{label:"δ",ariaLabel:"Delta",snippet:"\\delta "},{label:"ε",ariaLabel:"Epsilon",snippet:"\\varepsilon "},{label:"ζ",ariaLabel:"Zeta",snippet:"\\zeta "},{label:"η",ariaLabel:"Eta",snippet:"\\eta "},{label:"θ",ariaLabel:"Theta",snippet:"\\theta "},{label:"κ",ariaLabel:"Kappa",snippet:"\\kappa "},{label:"λ",ariaLabel:"Lambda",snippet:"\\lambda "},{label:"μ",ariaLabel:"Mu",snippet:"\\mu "},{label:"ν",ariaLabel:"Nu",snippet:"\\nu "},{label:"ξ",ariaLabel:"Xi",snippet:"\\xi "},{label:"π",ariaLabel:"Pi",snippet:"\\pi "},{label:"ρ",ariaLabel:"Rho",snippet:"\\rho "},{label:"σ",ariaLabel:"Sigma",snippet:"\\sigma "},{label:"τ",ariaLabel:"Tau",snippet:"\\tau "},{label:"φ",ariaLabel:"Phi",snippet:"\\varphi "},{label:"χ",ariaLabel:"Chi",snippet:"\\chi "},{label:"ψ",ariaLabel:"Psi",snippet:"\\psi "},{label:"ω",ariaLabel:"Omega",snippet:"\\omega "},{label:"Γ",ariaLabel:"Capital gamma",snippet:"\\Gamma "},{label:"Δ",ariaLabel:"Capital delta",snippet:"\\Delta "},{label:"Θ",ariaLabel:"Capital theta",snippet:"\\Theta "},{label:"Λ",ariaLabel:"Capital lambda",snippet:"\\Lambda "},{label:"Π",ariaLabel:"Capital pi",snippet:"\\Pi "},{label:"Σ",ariaLabel:"Capital sigma",snippet:"\\Sigma "},{label:"Φ",ariaLabel:"Capital phi",snippet:"\\Phi "},{label:"Ψ",ariaLabel:"Capital psi",snippet:"\\Psi "},{label:"Ω",ariaLabel:"Capital omega",snippet:"\\Omega "}]},{id:"relations",label:e.relations,items:[{label:"≤",ariaLabel:"Less than or equal to",snippet:"\\leq "},{label:"≥",ariaLabel:"Greater than or equal to",snippet:"\\geq "},{label:"≠",ariaLabel:"Not equal to",snippet:"\\neq "},{label:"≈",ariaLabel:"Approximately equal to",snippet:"\\approx "},{label:"≡",ariaLabel:"Equivalent to",snippet:"\\equiv "},{label:"∼",ariaLabel:"Similar to",snippet:"\\sim "},{label:"≅",ariaLabel:"Congruent to",snippet:"\\cong "},{label:"∝",ariaLabel:"Proportional to",snippet:"\\propto "}]},{id:"sets",label:e.sets,items:[{label:"∈",ariaLabel:"Element of",snippet:"\\in "},{label:"∉",ariaLabel:"Not an element of",snippet:"\\notin "},{label:"⊂",ariaLabel:"Subset of",snippet:"\\subset "},{label:"⊆",ariaLabel:"Subset of or equal to",snippet:"\\subseteq "},{label:"∪",ariaLabel:"Union",snippet:"\\cup "},{label:"∩",ariaLabel:"Intersection",snippet:"\\cap "},{label:"∅",ariaLabel:"Empty set",snippet:"\\emptyset "},{label:"ℝ",ariaLabel:"Real numbers",snippet:"\\mathbb{R}"},{label:"ℕ",ariaLabel:"Natural numbers",snippet:"\\mathbb{N}"},{label:"ℤ",ariaLabel:"Integers",snippet:"\\mathbb{Z}"},{label:"ℚ",ariaLabel:"Rational numbers",snippet:"\\mathbb{Q}"},{label:"ℂ",ariaLabel:"Complex numbers",snippet:"\\mathbb{C}"}]},{id:"logic",label:e.logic,items:[{label:"∀",ariaLabel:"For all",snippet:"\\forall "},{label:"∃",ariaLabel:"There exists",snippet:"\\exists "},{label:"¬",ariaLabel:"Logical not",snippet:"\\neg "},{label:"∧",ariaLabel:"Logical and",snippet:"\\land "},{label:"∨",ariaLabel:"Logical or",snippet:"\\lor "},{label:"⟹",ariaLabel:"Implies",snippet:"\\implies "},{label:"⟺",ariaLabel:"If and only if",snippet:"\\iff "}]},{id:"arrows",label:e.arrows,items:[{label:"→",ariaLabel:"Right arrow",snippet:"\\to "},{label:"⇒",ariaLabel:"Rightwards double arrow",snippet:"\\Rightarrow "},{label:"↔",ariaLabel:"Left-right arrow",snippet:"\\leftrightarrow "},{label:"↦",ariaLabel:"Maps to",snippet:"\\mapsto "}]},{id:"delimiters",label:e.delimiters,items:[{label:"( )",ariaLabel:"Auto-sized parentheses",snippet:"\\left($0\\right)"},{label:"[ ]",ariaLabel:"Auto-sized brackets",snippet:"\\left[$0\\right]"},{label:"{ }",ariaLabel:"Auto-sized braces",snippet:"\\left\\{$0\\right\\}"},{label:"|x|",ariaLabel:"Absolute value",snippet:"\\left|$0\\right|"},{label:"‖x‖",ariaLabel:"Norm",snippet:"\\left\\|$0\\right\\|"},{label:"⌊x⌋",ariaLabel:"Floor",snippet:"\\left\\lfloor $0\\right\\rfloor"},{label:"⌈x⌉",ariaLabel:"Ceiling",snippet:"\\left\\lceil $0\\right\\rceil"}]},{id:"dots",label:e.dots,items:[{label:"⋯",ariaLabel:"Centred ellipsis",snippet:"\\cdots "},{label:"…",ariaLabel:"Baseline ellipsis",snippet:"\\ldots "},{label:"⋮",ariaLabel:"Vertical ellipsis",snippet:"\\vdots "},{label:"⋱",ariaLabel:"Diagonal ellipsis",snippet:"\\ddots "}]},{id:"matrices",label:e.matrices,items:[{label:"[ ]",ariaLabel:"Bracket matrix",snippet:"\\begin{bmatrix} $0 & \\\\ & \\end{bmatrix}"},{label:"( )",ariaLabel:"Parenthesis matrix",snippet:"\\begin{pmatrix} $0 & \\\\ & \\end{pmatrix}"},{label:"{",ariaLabel:"Cases",snippet:"\\begin{cases} $0 & \\\\ & \\end{cases}"}]}];var e}function De(t,e){const n=new Ie({locale:(i=e.locale,{latexLabel:i.latexLabel,latexPlaceholder:i.latexPlaceholder,previewLabel:i.previewLabel,emptyPreview:i.emptyPreview,altLabel:i.altLabel,altPlaceholder:i.altPlaceholder,displayToggle:i.displayToggle,sizeLabel:i.sizeLabel,sizeDefault:i.sizeDefault,commitInsert:i.insertButton,commitUpdate:i.updateButton,cancel:i.cancelButton,paletteLabel:i.paletteLabel,unknownCommand:i.unknownCommand}),mode:e.mode,initialLatex:e.initialLatex,initialAlt:e.initialAlt,initialDisplay:e.initialDisplay,initialFontSize:e.initialFontSize,fontSizes:e.fontSizes,palette:Pe(e.locale),onCommit:e.onCommit,onCancel:e.onClose});var i;return t.appendChild(n.root),requestAnimationFrame(()=>n.focus()),n}var Ne=class{context;locale;fontSizes;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.locale=e,this.fontSizes=n}isOpen(){return null!==this.panel}openInsert(t){if(this.context.isReadOnly())return;const e=Fe();this.open({rect:e,mode:"insert",initialDisplay:t,onCommit:t=>{ut(this.context,this.locale,t),this.close(!0)}})}openEdit(t){this.context.isReadOnly()||(this.context.announce(this.locale.editing),this.open({rect:t.rect??Fe(),mode:"edit",initialLatex:t.latex,initialAlt:t.alt,initialDisplay:"display"===t.kind,initialFontSize:t.fontSize,onCommit:e=>{this.commitEdit(t,e),this.context.announce(this.locale.updated),this.close(!0)}}))}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}commitEdit(t,e){const n=pt(e);"inline"===t.kind&&t.blockId&&void 0!==t.offset?function(t,e,n,i){const a=t.getState().transaction("command").setInlineNodeAttr(e,n,lt(i)).build();t.dispatch(a)}(this.context,t.blockId,t.offset,n):"display"===t.kind&&t.path&&function(t,e,n){const i=t.getState().transaction("command").setNodeAttr(e,lt(n)).build();t.dispatch(i)}(this.context,t.path,n)}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-formula-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-label","edit"===t.mode?this.locale.editFormula:this.locale.insertInline),this.panel=e,De(e,{context:this.context,locale:this.locale,mode:t.mode,initialLatex:t.initialLatex,initialAlt:t.initialAlt,initialDisplay:t.initialDisplay,initialFontSize:t.initialFontSize,fontSizes:this.fontSizes,onCommit:t.onCommit,onClose:()=>this.close(!0)}),this.context.getPluginContainer("top").appendChild(e),y(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,i=e?e.left:window.innerWidth/3,a=t.offsetWidth||360,r=window.innerWidth-a-8,o=Math.max(8,Math.min(i,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(o)}px`,t.style.top=`${Math.round(s)}px`}(e,t.rect),this.installOutsideHandler()}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function Fe(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}function qe(t){const e=document.createElement("template");return e.innerHTML=t,e.content}function Re(t){const e=function(t){const e=L.sanitize(t,{ALLOWED_TAGS:[...at],ALLOWED_ATTR:[...rt]});return/<math[\s>]/i.test(e)?e:null}(t.outerHTML);if(!e)return null;const n=G(e);return{mathml:n,latex:H(n)??"",alt:"",fontSize:Q(t)}}var Oe=class{id="formula";name="Formula";priority=46;config;resolvedKeymap;fontSizes;locale=Ce;overlay=null;context=null;clickHandler=null;constructor(t){this.config={...it,...t},this.resolvedKeymap={...et,...t?.keymap},this.fontSizes=this.config.fontSizes??nt}async init(t){var e;if(this.context=t,this.locale=await g(t,this.config.locale,Ce,Ae),t.registerStyleSheet("\n.notectl-math math {\n\tfont-family: 'Notectl Math', math;\n}\n\n.notectl-math--inline {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n\tpadding: 0 1px;\n\tborder-radius: 3px;\n\tcursor: pointer;\n}\n\n.notectl-math--inline:hover {\n\tbackground: var(--notectl-highlight, rgba(0, 0, 0, 0.06));\n}\n\n.notectl-math--inline:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-math--inline math {\n\tfont-size: 1.15em;\n}\n\n.notectl-math--display {\n\tdisplay: block;\n\tmargin: 12px 0;\n\ttext-align: center;\n\tcursor: pointer;\n\tuser-select: none;\n\t-webkit-user-select: none;\n}\n\n.notectl-math--display math {\n\tfont-size: 1.35em;\n\tdisplay: inline-block;\n}\n\n.notectl-math--display.notectl-math--selected {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 4px;\n\tborder-radius: 6px;\n}\n\n.notectl-math__error,\n.notectl-math merror {\n\tcolor: var(--notectl-danger, #c0392b);\n\tbackground: var(--notectl-danger-bg, rgba(192, 57, 43, 0.1));\n\tborder-radius: 3px;\n\tpadding: 0 2px;\n}\n"),t.registerStyleSheet("\n.notectl-formula-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tpadding: 10px;\n\tmin-width: 320px;\n\tmax-width: 460px;\n\tbox-sizing: border-box;\n}\n\n.notectl-formula-editor__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.notectl-formula-editor__label {\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted, #555);\n}\n\n.notectl-formula-editor__input {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 6px 8px;\n\tfont-family: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;\n\tfont-size: 13px;\n\tline-height: 1.5;\n\tresize: vertical;\n\tmin-height: 56px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-formula-editor__alt {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 5px 8px;\n\tfont-size: 13px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-formula-editor__size {\n\tbox-sizing: border-box;\n\tpadding: 5px 8px;\n\tfont-size: 13px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tcolor: var(--notectl-fg);\n\tcursor: pointer;\n}\n\n.notectl-formula-editor__size:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-formula-editor__preview {\n\tmin-height: 44px;\n\tpadding: 8px;\n\tborder: 1px dashed var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised, #fafafa);\n\ttext-align: center;\n\toverflow-x: auto;\n}\n\n.notectl-formula-editor__preview math {\n\tfont-family: 'Notectl Math', math;\n\tfont-size: 1.3em;\n}\n\n.notectl-formula-editor__preview-empty {\n\tcolor: var(--notectl-fg-muted, #888);\n\tfont-size: 13px;\n}\n\n.notectl-formula-editor__errors {\n\tcolor: var(--notectl-danger, #c0392b);\n\tfont-size: 12px;\n\tmargin: 0;\n\tpadding-inline-start: 16px;\n}\n\n.notectl-formula-editor__row {\n\tdisplay: flex;\n\tgap: 8px;\n\talign-items: center;\n}\n\n.notectl-formula-editor__toggle {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-formula-editor__actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tjustify-content: flex-end;\n\tmargin-top: 2px;\n}\n\n.notectl-formula-editor__btn {\n\tpadding: 6px 14px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tcursor: pointer;\n\tfont-size: 13px;\n}\n\n.notectl-formula-editor__btn--primary {\n\tbackground: var(--notectl-primary);\n\tborder-color: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg, #fff);\n}\n\n.notectl-formula-editor__btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n.notectl-formula-overlay {\n\tposition: fixed;\n\tz-index: 1000;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay, #fff);\n\tbox-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);\n}\n\n.notectl-math-palette {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tpadding: 2px 2px 8px;\n\tborder-bottom: 1px solid var(--notectl-border);\n\tmargin-bottom: 2px;\n\tmax-height: 216px;\n\toverflow-y: auto;\n}\n\n.notectl-math-palette__group {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 2px;\n}\n\n.notectl-math-palette__group + .notectl-math-palette__group {\n\tborder-inline-start: 1px solid var(--notectl-border);\n\tpadding-inline-start: 6px;\n}\n\n.notectl-math-palette__btn {\n\tmin-width: 30px;\n\theight: 30px;\n\tpadding: 0 6px;\n\tborder: 1px solid transparent;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-fg);\n\tcursor: pointer;\n\tfont-size: 15px;\n\tline-height: 1;\n}\n\n.notectl-math-palette__btn:hover {\n\tbackground: var(--notectl-surface-raised);\n}\n\n.notectl-math-palette__btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n"),this.config.mathFont&&t.registerStyleSheet(function(t){const e=(t.family.split(",")[0]??t.name).trim().replace(/['"]/g,"");return(t.fontFaces??[]).map(t=>{const n=[`font-family: '${e}'`,`src: ${t.src}`];return t.weight&&n.push(`font-weight: ${t.weight}`),t.style&&n.push(`font-style: ${t.style}`),n.push(`font-display: ${t.display??"swap"}`),`@font-face { ${n.join("; ")}; }`}).join("\n")}(this.config.mathFont)),t.registerInlineNodeSpec({type:Y,attrs:{mathml:{default:""},latex:{default:""},alt:{default:""},fontSize:{default:""}},toDOM(t){const e=document.createElement("span");return e.className="notectl-math notectl-math--inline",e.setAttribute("contenteditable","false"),e.setAttribute("data-inline-type",Y),W(e,Z(t.attrs)),V(e,t.attrs),e},toHTMLString:t=>X(Z(t.attrs)),toMarkdown:t=>`$${String(t.attrs.latex??"")}$`,parseHTML:[{tag:"math",getAttrs:t=>J(t,!1)}],sanitize:{tags:[...at],attrs:[...rt]}}),t.registerNodeSpec({type:tt,group:"block",isVoid:!0,selectable:!0,attrs:{mathml:{default:""},latex:{default:""},alt:{default:""},fontSize:{default:""}},toDOM(t){const e=v("div",t.id);return e.className="notectl-math notectl-math--display",e.setAttribute("data-void","true"),e.setAttribute("data-selectable","true"),W(e,Z(t.attrs)),V(e,t.attrs),e},toHTML:t=>X(Z(t.attrs)),toMarkdown:t=>`$$\n${String(t.attrs?.latex??"")}\n$$`,parseHTML:[{tag:"math",getAttrs:t=>J(t,!0)}],sanitize:{tags:[...at],attrs:[...rt]}}),this.overlay=new Ne(t,this.locale,this.fontSizes),t.registerNodeView(tt,(e={onEdit:(t,e)=>this.editDisplay(t,e),onSelect:()=>t.announce(this.locale.selected)},t=>{let n=t.id,i=!1;const a=v("div",t.id);return a.className="notectl-math notectl-math--display",a.setAttribute("data-void","true"),a.setAttribute("data-selectable","true"),W(a,Z(t.attrs)),V(a,t.attrs),a.addEventListener("dblclick",t=>{t.preventDefault(),e.onEdit(n,a.getBoundingClientRect())}),{dom:a,contentDOM:null,update:t=>"math_display"===t.type&&(n=t.id,a.setAttribute("data-block-id",t.id),W(a,Z(t.attrs)),V(a,t.attrs),!0),selectNode(){a.classList.add("notectl-math--selected"),i||(i=!0,e.onSelect())},deselectNode(){a.classList.remove("notectl-math--selected"),i=!1}}})),!1!==this.config.inputRule)for(const n of[{pattern:Le,handler(t,e){const n=t.selection;if(!c(n)||!o(n))return null;const i=(e[1]??"").trim();if(!i)return null;const r=n.anchor.blockId;if(!ke(t,r))return null;const s=Se(n.anchor.offset,e[0].length);if(!s)return null;const u=t.doc.children.findIndex(t=>t.id===r);if(-1===u)return null;const{presentation:d}=xe(i,{display:!0}),m=j({presentation:d,latex:i,display:!0}),h=t.transaction("input").deleteTextAt(r,s.from,s.to);return function(t,e,n){const i=a(p(tt),[],void 0,lt(n)),r=a(p("paragraph"));t.insertNode([],e,i).insertNode([],e+1,r).setSelection(l(i.id,[]))}(h,u+1,{mathml:m,latex:i,alt:"",fontSize:""}),h.build()}},{pattern:we,handler(t,e){const n=t.selection;if(!c(n)||!o(n))return null;const a=(e[1]??"").trim();if(!a)return null;const r=n.anchor.blockId;if(!ke(t,r))return null;const l=Se(n.anchor.offset,e[0].length);if(!l)return null;const{presentation:p}=xe(a,{display:!1}),d=j({presentation:p,latex:a,display:!1}),m=i(u(Y),{mathml:d,latex:a,alt:"",fontSize:""});return t.transaction("input").deleteTextAt(r,l.from,l.to).insertInlineNode(r,l.from,m).setSelection(s(r,l.from+1)).build()}}])t.registerInputRule(n);t.registerMarkdownSyntax({id:"formula",matchInline(t,e){if("$"!==t[e]||"$"===t[e+1])return null;const n=function(t,e){for(let n=e;n<t.length;n++){const e=t[n]??"";if("\n"===e)return-1;if("$"===e)return n}return-1}(t,e+1);if(-1===n)return null;const i=t.slice(e+1,n).trim();return""===i?null:{type:Y,attrs:{..._e(i,!1)},length:n-e+1}},matchBlock(t,e){const n=t[e]??"",i=n.match(ze);if(i?.[1]?.trim())return{type:tt,attrs:{..._e(i[1].trim(),!0)},linesConsumed:1};if("$$"!==n.trim())return null;const a=[];let r=e+1;for(;r<t.length&&"$$"!==(t[r]??"").trim();)a.push(t[r]??""),r++;return r>=t.length?null:{type:tt,attrs:{..._e(a.join("\n").trim(),!0)},linesConsumed:r-e+1}}}),t.registerPasteInterceptor((t,e,n)=>{if(!function(t){if(!t)return!1;const e=qe(t);if(!e.querySelector("math"))return!1;const n=e.cloneNode(!0);for(const i of Array.from(n.querySelectorAll('math, [aria-hidden="true"]')))i.remove();return""===(n.textContent??"").trim()}(e))return null;const i=function(t){if(!t)return[];const e=qe(t);for(const n of Array.from(e.querySelectorAll('[aria-hidden="true"]')))n.remove();return Array.from(e.querySelectorAll("math"))}(e).map(Re).filter(t=>null!==t);return 0===i.length?null:i.every(t=>{return e=t.mathml,!/<math\b[^>]*\bdisplay=["']block["']/i.test(e);var e})?st(n,i):ct(n,i)},{name:"formula",priority:40}),this.registerCommands(t),this.registerKeymap(t),function(t,e,n){t.registerToolbarItem({id:"formula",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round"><path d="M18 5 H6 L12 12 L6 19 H18"/></svg>',label:e.insertInline,tooltip:e.insertInlineTooltip,command:"insertInlineFormula",popupType:"custom",renderPopup:(t,i,a)=>{De(t,{context:i,locale:e,mode:"insert",fontSizes:n,onClose:a,onCommit:t=>{ut(i,e,t),a(),i.getContainer().focus()}})}})}(t,this.locale,this.fontSizes),this.installClickToEdit(t)}destroy(){this.clickHandler&&this.context&&this.context.getContainer().removeEventListener("click",this.clickHandler),this.clickHandler=null,this.overlay?.close(!1),this.overlay=null,this.context=null}registerCommands(i){i.registerCommand("insertInlineFormula",()=>{const a=function(i){const a=i.selection;if(!c(a)||!o(a))return null;const r=a.anchor.blockId,l=i.getBlock(r);if(!l)return null;const s=a.anchor.offset;for(const{child:o,from:c,to:p}of t(n(l)))if(e(o)&&"math_inline"===o.inlineType&&(p===s||c===s)){const t=Z(o.attrs);return{kind:"inline",blockId:r,offset:c,latex:t.latex,alt:t.alt,fontSize:t.fontSize,rect:null}}return null}(i.getState());return a?(this.overlay?.openEdit(a),!0):(this.overlay?.openInsert(!1),!0)}),i.registerCommand("insertDisplayFormula",()=>{const t=ot(i.getState());return t?(this.editDisplay(t,null),!0):(this.overlay?.openInsert(!0),!0)})}registerKeymap(t){const e={},n=this.resolvedKeymap.insertInline,i=this.resolvedKeymap.insertDisplay;n&&(e[n]=()=>t.executeCommand("insertInlineFormula")),i&&(e[i]=()=>t.executeCommand("insertDisplayFormula")),e.Enter=()=>{const e=ot(t.getState());return!!e&&(this.editDisplay(e,null),!0)},t.registerKeymap(e,{priority:"context"})}installClickToEdit(i){const a=i.getContainer(),r=r=>{if(i.isReadOnly())return;const o=r.target?.closest(".notectl-math--inline");if(!o)return;const l=function(i,a,r){const o=x(i,a,0);if(!o)return null;const l=function(i,a,r){const o=i.getBlock(a);if(!o)return null;for(const{child:l,from:s}of t(n(o)))if(s===r&&e(l)&&"math_inline"===l.inlineType)return Z(l.attrs);return null}(r,o.blockId,o.offset);return l?{kind:"inline",blockId:o.blockId,offset:o.offset,latex:l.latex,alt:l.alt,fontSize:l.fontSize,rect:a.getBoundingClientRect()}:null}(a,o,i.getState());l&&(r.preventDefault(),this.overlay?.openEdit(l))};this.clickHandler=r,a.addEventListener("click",r)}editDisplay(t,e){if(!this.overlay||!this.context)return;const n=function(t,e,n){const i=t.getBlock(e);if(!i||"math_display"!==i.type)return null;const a=Z(i.attrs);return{kind:"display",path:t.getNodePath(e)??[e],latex:a.latex,alt:a.alt,fontSize:a.fontSize,rect:n}}(this.context.getState(),t,e);n&&this.overlay.openEdit(n)}};export{rt as a,j as c,xe as i,Ce as n,at as o,Ae as r,et as s,Oe as t};
|
|
2
|
-
//# sourceMappingURL=FormulaPlugin-DJ39BtqV.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as t}from"./Document-827l3P80.mjs";import{r}from"./NodeResolver-Dleih-8R.mjs";import{a as e,c as n,r as o,t as s}from"./Selection-HYoVFpAx.mjs";import{i}from"./NavigationQueries-Bt4zZ17v.mjs";import{t as l}from"./Platform-ByobkiCc.mjs";function u(t,r,e){return t.transaction("input").setSelection(s(r,e)).setStoredMarks(null,t.storedMarks).build()}function c(t,e){const n=r(t.doc,e)??[];return t.transaction("input").setSelection(o(e,n)).setStoredMarks(null,t.storedMarks).build()}function f(t,r,n,o,s){return t.transaction("input").setSelection(e({blockId:r,offset:n},{blockId:o,offset:s})).setStoredMarks(null,t.storedMarks).build()}function a(r,e,o){const s=r.selection;if(!n(s))return null;const f=r.getBlockOrder(),a=f.indexOf(s.blockId);if(a<0)return null;const d=function(t,r,e){if(!e)return t;if("left"!==t&&"right"!==t)return t;const n=e.querySelector(`[data-block-id="${r}"]`);return n instanceof HTMLElement?"rtl"!==l(n)?t:"left"===t?"right":"left":t}(e,s.blockId,o);if("before"===s.side&&("right"===d||"down"===d)||"after"===s.side&&("left"===d||"up"===d))return c(r,s.blockId);const m="before"===s.side?a-1:a+1;if(m<0||m>=f.length)return null;const k=f[m];if(!k)return null;if(i(r,k))return c(r,k);const p=r.getBlock(k);return p?u(r,k,"left"===d||"up"===d?t(p):0):null}export{c as i,f as n,u as r,a as t};
|
|
2
|
-
//# sourceMappingURL=GapCursorNavigation-DCWOmopl.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GapCursorNavigation-DCWOmopl.mjs","names":[],"sources":["../../src/state/SelectionTransactions.ts","../../src/view/GapCursorNavigation.ts"],"sourcesContent":["/**\n * Shared transaction builders for cursor and selection movement.\n *\n * These helpers encapsulate the common pattern of building a transaction\n * that sets a new selection and clears storedMarks.\n */\n\nimport { findNodePath } from '../model/NodeResolver.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tcreateSelection,\n} from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from './EditorState.js';\nimport type { Transaction } from './Transaction.js';\n\n/** Builds a collapsed-cursor transaction that clears storedMarks. */\nexport function moveTx(state: EditorState, blockId: BlockId, offset: number): Transaction {\n\treturn state\n\t\t.transaction('input')\n\t\t.setSelection(createCollapsedSelection(blockId, offset))\n\t\t.setStoredMarks(null, state.storedMarks)\n\t\t.build();\n}\n\n/** Builds a NodeSelection transaction that clears storedMarks. */\nexport function nodeSelTx(state: EditorState, targetId: BlockId): Transaction {\n\tconst path: BlockId[] = (findNodePath(state.doc, targetId) ?? []) as BlockId[];\n\treturn state\n\t\t.transaction('input')\n\t\t.setSelection(createNodeSelection(targetId, path))\n\t\t.setStoredMarks(null, state.storedMarks)\n\t\t.build();\n}\n\n/** Builds a range-selection transaction that clears storedMarks. */\nexport function extendTx(\n\tstate: EditorState,\n\tanchorBlockId: BlockId,\n\tanchorOffset: number,\n\theadBlockId: BlockId,\n\theadOffset: number,\n): Transaction {\n\treturn state\n\t\t.transaction('input')\n\t\t.setSelection(\n\t\t\tcreateSelection(\n\t\t\t\t{ blockId: anchorBlockId, offset: anchorOffset },\n\t\t\t\t{ blockId: headBlockId, offset: headOffset },\n\t\t\t),\n\t\t)\n\t\t.setStoredMarks(null, state.storedMarks)\n\t\t.build();\n}\n","import { getBlockLength } from '../model/Document.js';\nimport { isGapCursor } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { getTextDirection } from '../platform/Platform.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\nimport { moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\n\nexport type GapCursorDirection = 'left' | 'right' | 'up' | 'down';\n\n/**\n * Navigates from a GapCursor position.\n *\n * - Arrow toward the adjacent void block -> NodeSelection of that block.\n * - Arrow away from the void block -> find next block: void -> NodeSelection,\n * text -> TextSelection, document boundary -> no-op.\n */\nexport function navigateFromGapCursor(\n\tstate: EditorState,\n\tdirection: GapCursorDirection,\n\tcontainer?: HTMLElement,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isGapCursor(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst blockIdx: number = blockOrder.indexOf(sel.blockId);\n\tif (blockIdx < 0) return null;\n\n\t// Resolve effective horizontal direction for RTL blocks\n\tconst effectiveDir: GapCursorDirection = resolveEffectiveDirection(\n\t\tdirection,\n\t\tsel.blockId,\n\t\tcontainer,\n\t);\n\n\tconst towardVoid: boolean =\n\t\t(sel.side === 'before' && (effectiveDir === 'right' || effectiveDir === 'down')) ||\n\t\t(sel.side === 'after' && (effectiveDir === 'left' || effectiveDir === 'up'));\n\n\tif (towardVoid) return nodeSelTx(state, sel.blockId);\n\n\t// Moving away from the void block - find the neighbor in the other direction\n\tconst awayIdx: number = sel.side === 'before' ? blockIdx - 1 : blockIdx + 1;\n\tif (awayIdx < 0 || awayIdx >= blockOrder.length) return null;\n\n\tconst targetId: BlockId | undefined = blockOrder[awayIdx];\n\tif (!targetId) return null;\n\n\tif (isVoidBlock(state, targetId)) return nodeSelTx(state, targetId);\n\n\t// Text block: place cursor at start or end\n\tconst targetBlock = state.getBlock(targetId);\n\tif (!targetBlock) return null;\n\n\tconst targetOffset: number =\n\t\teffectiveDir === 'left' || effectiveDir === 'up' ? getBlockLength(targetBlock) : 0;\n\treturn moveTx(state, targetId, targetOffset);\n}\n\n/**\n * Resolves the effective navigation direction by flipping left/right\n * when the block is RTL. Vertical directions are unaffected.\n */\nfunction resolveEffectiveDirection(\n\tdirection: GapCursorDirection,\n\tblockId: BlockId,\n\tcontainer?: HTMLElement,\n): GapCursorDirection {\n\tif (!container) return direction;\n\tif (direction !== 'left' && direction !== 'right') return direction;\n\n\tconst blockEl: Element | null = container.querySelector(`[data-block-id=\"${blockId}\"]`);\n\tif (!(blockEl instanceof HTMLElement)) return direction;\n\n\tconst isRtl: boolean = getTextDirection(blockEl) === 'rtl';\n\tif (!isRtl) return direction;\n\n\treturn direction === 'left' ? 'right' : 'left';\n}\n"],"mappings":"qPAkBA,SAAgB,EAAO,EAAoB,EAAkB,GAC5D,OAAO,EACL,YAAY,SACZ,aAAa,EAAyB,EAAS,IAC/C,eAAe,KAAM,EAAM,aAC3B,OACH,CAGA,SAAgB,EAAU,EAAoB,GAC7C,MAAM,EAAmB,EAAa,EAAM,IAAK,IAAa,GAC9D,OAAO,EACL,YAAY,SACZ,aAAa,EAAoB,EAAU,IAC3C,eAAe,KAAM,EAAM,aAC3B,OACH,CAGA,SAAgB,EACf,EACA,EACA,EACA,EACA,GAEA,OAAO,EACL,YAAY,SACZ,aACA,EACC,CAAE,QAAS,EAAe,OAAQ,GAClC,CAAE,QAAS,EAAa,OAAQ,KAGjC,eAAe,KAAM,EAAM,aAC3B,OACH,CCpCA,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAM,EAAM,UAClB,IAAK,EAAY,GAAM,OAAO,KAE9B,MAAM,EAAiC,EAAM,gBACvC,EAAmB,EAAW,QAAQ,EAAI,SAChD,GAAI,EAAW,EAAG,OAAO,KAGzB,MAAM,EAkCP,SACC,EACA,EACA,GAEA,IAAK,EAAW,OAAO,EACvB,GAAkB,SAAd,GAAsC,UAAd,EAAuB,OAAO,EAE1D,MAAM,EAA0B,EAAU,cAAc,mBAAmB,OAC3E,OAAM,aAAmB,YAE4B,QAA9B,EAAiB,GACrB,EAEE,SAAd,EAAuB,QAAU,OALM,CAM/C,CAjD0C,CACxC,EACA,EAAI,QACJ,GAOD,GAHe,WAAb,EAAI,OAAuC,UAAjB,GAA6C,SAAjB,IACzC,UAAb,EAAI,OAAsC,SAAjB,GAA4C,OAAjB,GAEtC,OAAO,EAAU,EAAO,EAAI,SAG5C,MAAM,EAA+B,WAAb,EAAI,KAAoB,EAAW,EAAI,EAAW,EAC1E,GAAI,EAAU,GAAK,GAAW,EAAW,OAAQ,OAAO,KAExD,MAAM,EAAgC,EAAW,GACjD,IAAK,EAAU,OAAO,KAEtB,GAAI,EAAY,EAAO,GAAW,OAAO,EAAU,EAAO,GAG1D,MAAM,EAAc,EAAM,SAAS,GACnC,OAAK,EAIE,EAAO,EAAO,EADH,SAAjB,GAA4C,OAAjB,EAAwB,EAAe,GAAe,GAHzD,IAK1B"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as t}from"./Selection-HYoVFpAx.mjs";import{c as e,o as n}from"./PluginHelpers-KDuTlmXm.mjs";import{t as o}from"./GapCursorNavigation-DCWOmopl.mjs";var r={gapCursorActive:"Gap cursor active. Type to insert new paragraph."},s=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CR6UdFL9.mjs"),"./locales/de.ts":()=>import("./de-CHcv_Vmf.mjs"),"./locales/es.ts":()=>import("./es-BIXm2Coj.mjs"),"./locales/fr.ts":()=>import("./fr-Bg937iAy.mjs"),"./locales/hi.ts":()=>import("./hi-B5cl8TWK.mjs"),"./locales/pt.ts":()=>import("./pt-UPF7DBlz.mjs"),"./locales/ru.ts":()=>import("./ru-CkG_bpfo.mjs"),"./locales/zh.ts":()=>import("./zh-CWIzJcXi.mjs")});async function i(t){return e(s,t,r)}var a=class{id="gap-cursor";name="Gap Cursor";priority=5;context=null;activeCursorBlockId=null;activeCursorSide=null;locale=r;async init(e){this.locale=await n(e,void 0,r,i),this.context=e,e.registerStyleSheet("\n.notectl-gap-cursor--before,\n.notectl-gap-cursor--after {\n\tposition: relative;\n}\n.notectl-gap-cursor--before::before {\n\tcontent: '';\n\tdisplay: block;\n\tposition: absolute;\n\ttop: 0;\n\tinset-inline-start: 0;\n\twidth: 100%;\n\theight: 1px;\n\tbackground: currentColor;\n\ttransform: translateY(-50%);\n\tpointer-events: none;\n\tz-index: 1;\n\tanimation: notectl-gap-blink 1.1s step-end infinite;\n}\n.notectl-gap-cursor--after::after {\n\tcontent: '';\n\tdisplay: block;\n\tposition: absolute;\n\tbottom: 0;\n\tinset-inline-start: 0;\n\twidth: 100%;\n\theight: 1px;\n\tbackground: currentColor;\n\ttransform: translateY(50%);\n\tpointer-events: none;\n\tz-index: 1;\n\tanimation: notectl-gap-blink 1.1s step-end infinite;\n}\n@media (prefers-reduced-motion: reduce) {\n\t.notectl-gap-cursor--before::before,\n\t.notectl-gap-cursor--after::after {\n\t\tanimation: none;\n\t}\n}\n@keyframes notectl-gap-blink {\n\t50% { opacity: 0; }\n}\n");const s={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"},a={};for(const[n,r]of Object.entries(s))a[n]=()=>{const n=e.getState();if(!t(n.selection))return!1;const s=o(n,r,e.getContainer());return!!s&&(e.dispatch(s),!0)};e.registerKeymap(a,{priority:"navigation"})}onReady(){this.context&&this.syncCursorClass(this.context.getState())}onStateChange(e,n,o){this.context&&(this.syncCursorClass(n),!t(e.selection)&&t(n.selection)&&this.context.announce(this.locale.gapCursorActive))}destroy(){this.clearCursorClass(),this.context=null}syncCursorClass(e){if(this.clearCursorClass(),!t(e.selection)||!this.context)return;const n="before"===e.selection.side?"notectl-gap-cursor--before":"notectl-gap-cursor--after",o=this.context.getContainer().querySelector(`[data-block-id="${e.selection.blockId}"]`);o instanceof HTMLElement&&(o.classList.add(n),this.activeCursorBlockId=e.selection.blockId,this.activeCursorSide=e.selection.side)}clearCursorClass(){if(!this.context||!this.activeCursorBlockId||!this.activeCursorSide)return;const t=this.context.getContainer().querySelector(`[data-block-id="${this.activeCursorBlockId}"]`);t instanceof HTMLElement&&t.classList.remove("notectl-gap-cursor--before","notectl-gap-cursor--after"),this.activeCursorBlockId=null,this.activeCursorSide=null}};export{a as t};
|
|
2
|
-
//# sourceMappingURL=GapCursorPlugin-2iR6506y.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GapCursorPlugin-2iR6506y.mjs","names":[],"sources":["../../src/plugins/gap-cursor/GapCursorLocale.ts","../../src/plugins/gap-cursor/GapCursorPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the GapCursorPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface GapCursorLocale {\n\treadonly gapCursorActive: string;\n}\n\n// --- Default English Locale ---\n\nexport const GAP_CURSOR_LOCALE_EN: GapCursorLocale = {\n\tgapCursorActive: 'Gap cursor active. Type to insert new paragraph.',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<GapCursorLocale> = import.meta.glob<{\n\tdefault: GapCursorLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadGapCursorLocale(lang: string): Promise<GapCursorLocale> {\n\treturn loadLocaleModule(localeModules, lang, GAP_CURSOR_LOCALE_EN);\n}\n","/**\n * GapCursorPlugin: renders a virtual cursor at boundaries of void blocks\n * where no native browser caret can exist (e.g. between two HRs or at\n * the document edge adjacent to a void block).\n */\n\nimport { isGapCursor } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { navigateFromGapCursor } from '../../view/GapCursorNavigation.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport {\n\tGAP_CURSOR_LOCALE_EN,\n\ttype GapCursorLocale,\n\tloadGapCursorLocale,\n} from './GapCursorLocale.js';\n\nconst GAP_CURSOR_CSS = `\n.notectl-gap-cursor--before,\n.notectl-gap-cursor--after {\n\tposition: relative;\n}\n.notectl-gap-cursor--before::before {\n\tcontent: '';\n\tdisplay: block;\n\tposition: absolute;\n\ttop: 0;\n\tinset-inline-start: 0;\n\twidth: 100%;\n\theight: 1px;\n\tbackground: currentColor;\n\ttransform: translateY(-50%);\n\tpointer-events: none;\n\tz-index: 1;\n\tanimation: notectl-gap-blink 1.1s step-end infinite;\n}\n.notectl-gap-cursor--after::after {\n\tcontent: '';\n\tdisplay: block;\n\tposition: absolute;\n\tbottom: 0;\n\tinset-inline-start: 0;\n\twidth: 100%;\n\theight: 1px;\n\tbackground: currentColor;\n\ttransform: translateY(50%);\n\tpointer-events: none;\n\tz-index: 1;\n\tanimation: notectl-gap-blink 1.1s step-end infinite;\n}\n@media (prefers-reduced-motion: reduce) {\n\t.notectl-gap-cursor--before::before,\n\t.notectl-gap-cursor--after::after {\n\t\tanimation: none;\n\t}\n}\n@keyframes notectl-gap-blink {\n\t50% { opacity: 0; }\n}\n`;\n\nexport class GapCursorPlugin implements Plugin {\n\treadonly id = 'gap-cursor';\n\treadonly name = 'Gap Cursor';\n\treadonly priority = 5;\n\n\tprivate context: PluginContext | null = null;\n\tprivate activeCursorBlockId: BlockId | null = null;\n\tprivate activeCursorSide: 'before' | 'after' | null = null;\n\tprivate locale: GapCursorLocale = GAP_CURSOR_LOCALE_EN;\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tundefined,\n\t\t\tGAP_CURSOR_LOCALE_EN,\n\t\t\tloadGapCursorLocale,\n\t\t);\n\n\t\tthis.context = context;\n\n\t\tcontext.registerStyleSheet(GAP_CURSOR_CSS);\n\n\t\tconst directions: Record<string, 'left' | 'right' | 'up' | 'down'> = {\n\t\t\tArrowLeft: 'left',\n\t\t\tArrowRight: 'right',\n\t\t\tArrowUp: 'up',\n\t\t\tArrowDown: 'down',\n\t\t};\n\n\t\tconst keymap: Record<string, () => boolean> = {};\n\t\tfor (const [key, dir] of Object.entries(directions)) {\n\t\t\tkeymap[key] = (): boolean => {\n\t\t\t\tconst state: EditorState = context.getState();\n\t\t\t\tif (!isGapCursor(state.selection)) return false;\n\n\t\t\t\tconst container: HTMLElement = context.getContainer();\n\t\t\t\tconst tr: Transaction | null = navigateFromGapCursor(state, dir, container);\n\t\t\t\tif (tr) {\n\t\t\t\t\tcontext.dispatch(tr);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}\n\n\t\tcontext.registerKeymap(keymap, { priority: 'navigation' });\n\t}\n\n\tonReady(): void {\n\t\tif (!this.context) return;\n\t\tthis.syncCursorClass(this.context.getState());\n\t}\n\n\tonStateChange(oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tif (!this.context) return;\n\n\t\tthis.syncCursorClass(newState);\n\n\t\tif (!isGapCursor(oldState.selection) && isGapCursor(newState.selection)) {\n\t\t\tthis.context.announce(this.locale.gapCursorActive);\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.clearCursorClass();\n\t\tthis.context = null;\n\t}\n\n\tprivate syncCursorClass(state: EditorState): void {\n\t\tthis.clearCursorClass();\n\t\tif (!isGapCursor(state.selection) || !this.context) return;\n\n\t\tconst className: string =\n\t\t\tstate.selection.side === 'before'\n\t\t\t\t? 'notectl-gap-cursor--before'\n\t\t\t\t: 'notectl-gap-cursor--after';\n\n\t\tconst blockEl: Element | null = this.context\n\t\t\t.getContainer()\n\t\t\t.querySelector(`[data-block-id=\"${state.selection.blockId}\"]`);\n\t\tif (!(blockEl instanceof HTMLElement)) return;\n\n\t\tblockEl.classList.add(className);\n\t\tthis.activeCursorBlockId = state.selection.blockId;\n\t\tthis.activeCursorSide = state.selection.side;\n\t}\n\n\tprivate clearCursorClass(): void {\n\t\tif (!this.context || !this.activeCursorBlockId || !this.activeCursorSide) return;\n\n\t\tconst blockEl: Element | null = this.context\n\t\t\t.getContainer()\n\t\t\t.querySelector(`[data-block-id=\"${this.activeCursorBlockId}\"]`);\n\t\tif (blockEl instanceof HTMLElement) {\n\t\t\tblockEl.classList.remove('notectl-gap-cursor--before', 'notectl-gap-cursor--after');\n\t\t}\n\n\t\tthis.activeCursorBlockId = null;\n\t\tthis.activeCursorSide = null;\n\t}\n}\n"],"mappings":"4JAYA,IAAa,EAAwC,CACpD,gBAAiB,oDAKZ,iBAAkD,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAIxD,eAAsB,EAAoB,GACzC,OAAO,EAAiB,EAAe,EAAM,EAC9C,CCLA,IA4Ca,EAAb,MACC,GAAc,aACd,KAAgB,aAChB,SAAoB,EAEpB,QAAwC,KACxC,oBAA8C,KAC9C,iBAAsD,KACtD,OAAkC,EAElC,UAAM,CAAK,GACV,KAAK,aAAe,EACnB,OACA,EACA,EACA,GAGD,KAAK,QAAU,EAEf,EAAQ,mBAhEa,07BAkErB,MAAM,EAA+D,CACpE,UAAW,OACX,WAAY,QACZ,QAAS,KACT,UAAW,QAGN,EAAwC,CAAC,EAC/C,IAAK,MAAO,EAAK,KAAQ,OAAO,QAAQ,GACvC,EAAO,GAAA,KACN,MAAM,EAAqB,EAAQ,WACnC,IAAK,EAAY,EAAM,WAAY,OAAO,EAG1C,MAAM,EAAyB,EAAsB,EAAO,EAD7B,EAAQ,gBAEvC,QAAI,IACH,EAAQ,SAAS,IACV,IAMV,EAAQ,eAAe,EAAQ,CAAE,SAAU,cAC5C,CAEA,OAAA,GACM,KAAK,SACV,KAAK,gBAAgB,KAAK,QAAQ,WACnC,CAEA,aAAA,CAAc,EAAuB,EAAuB,GACtD,KAAK,UAEV,KAAK,gBAAgB,IAEhB,EAAY,EAAS,YAAc,EAAY,EAAS,YAC5D,KAAK,QAAQ,SAAS,KAAK,OAAO,iBAEpC,CAEA,OAAA,GACC,KAAK,mBACL,KAAK,QAAU,IAChB,CAEA,eAAA,CAAwB,GAEvB,GADA,KAAK,oBACA,EAAY,EAAM,aAAe,KAAK,QAAS,OAEpD,MAAM,EACoB,WAAzB,EAAM,UAAU,KACb,6BACA,4BAEE,EAA0B,KAAK,QACnC,eACA,cAAc,mBAAmB,EAAM,UAAU,aAC7C,aAAmB,cAEzB,EAAQ,UAAU,IAAI,GACtB,KAAK,oBAAsB,EAAM,UAAU,QAC3C,KAAK,iBAAmB,EAAM,UAAU,KACzC,CAEA,gBAAA,GACC,IAAK,KAAK,UAAY,KAAK,sBAAwB,KAAK,iBAAkB,OAE1E,MAAM,EAA0B,KAAK,QACnC,eACA,cAAc,mBAAmB,KAAK,yBACpC,aAAmB,aACtB,EAAQ,UAAU,OAAO,6BAA8B,6BAGxD,KAAK,oBAAsB,KAC3B,KAAK,iBAAmB,IACzB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|blob|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i;function e(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var n=e,r=/[\t\n\f\r ]/;function o(t){return"string"==typeof t&&t.length>0&&!r.test(t)?t:void 0}function i(t){if(!t.startsWith("#")||1===t.length)return[];const e=new URL(t,"https://notectl.invalid/").hash.slice(1);if(""===e)return[];const n=function(t){const e=[],n=new TextEncoder;for(let r=0;r<t.length;){const o=t[r+1],i=t[r+2];if("%"===t[r]&&o&&i&&s(o)&&s(i)){e.push(Number.parseInt(`${o}${i}`,16)),r+=3;continue}const a=t.codePointAt(r);if(void 0===a)break;const c=String.fromCodePoint(a);e.push(...n.encode(c)),r+=c.length}return(new TextDecoder).decode(Uint8Array.from(e))}(e);return n===e?[e]:[e,n]}function s(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}var a=new Set(["http:","https:","mailto:","tel:"]),c=/[\u0000-\u001F\u007F]/g;function l(t){const e=t.replace(c,"").trim();if(""===e)return"";if(e.startsWith("#")||e.startsWith("/"))return e;try{const t=new URL(e,"http://_invalid_base_/");return a.has(t.protocol)?e:""}catch{return""}}var u=new Set(["p","div","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","table","colgroup","thead","tbody","tfoot","tr","td","th","pre","figure","figcaption","section","article","header","footer"]),h=new Set(["br","hr","img","input","col","area","meta","link"]);function f(t,e=" "){const n=function(t){const e=[];let n=0,r=0;for(;r<t.length;){if("<"!==t[r]){r+=1;continue}let o=r+1;o<t.length&&"/"===t[o]&&(o+=1);const i=t[o];if(o>=t.length||!i||!g(i)){r+=1;continue}const s=p(t,o+1);if(void 0===s)break;r>n&&e.push(t.slice(n,r)),e.push(t.slice(r,s+1)),r=s+1,n=r}return n<t.length&&e.push(t.slice(n)),e}(t),r=[];let o=0,i="";const s=()=>{const t=i.trim();t.length>0&&r.push(`${e.repeat(o)}${t}`),i=""};for(const a of n){const t=a.startsWith("<")?d(a):"",n=u.has(t),c=h.has(t);n||c?(s(),a.startsWith("</")?(o=Math.max(0,o-1),r.push(`${e.repeat(o)}${a}`)):(r.push(`${e.repeat(o)}${a}`),!n||c||a.endsWith("/>")||(o+=1))):i+=a}return s(),r.join("\n")}function p(t,e){let n;for(let r=e;r<t.length;r+=1){const e=t[r]??"";if(n)e===n&&(n=void 0);else if('"'!==e&&"'"!==e){if(">"===e)return r}else n=e}}function g(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function d(t){return t.match(/^<\/?([a-zA-Z][a-zA-Z0-9]*)/)?.[1]?.toLowerCase()??""}export{i as a,f as i,n,o,e as r,l as s,t};
|
|
2
|
-
//# sourceMappingURL=HTMLUtils-Bhg3_P8B.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./Commands-D5ND50PQ.mjs";var r=class{id="hard-break";name="Hard Break";priority=10;init(e){this.registerInlineNodeSpec(e),this.registerCommands(e),this.registerKeymap(e)}registerInlineNodeSpec(e){e.registerInlineNodeSpec({type:"hard_break",toDOM:()=>document.createElement("br"),toHTMLString:()=>"<br>",parseHTML:[{tag:"br"}],sanitize:{tags:["br"]}})}registerCommands(r){r.registerCommand("insertHardBreak",()=>{const t=e(r.getState());return!!t&&(r.dispatch(t),!0)})}registerKeymap(r){r.registerKeymap({"Shift-Enter":()=>{const t=e(r.getState());return!!t&&(r.dispatch(t),!0)}})}};export{r as t};
|
|
2
|
-
//# sourceMappingURL=HardBreakPlugin-vniSvTgq.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{D as t,_ as e,b as n,f as o,h as i}from"./Document-827l3P80.mjs";import{o as r,t as a,u as s}from"./Selection-HYoVFpAx.mjs";import{a as c}from"./TypeBrands-Ch9856Gb.mjs";import{c as l,o as g}from"./PluginHelpers-KDuTlmXm.mjs";import{s as p}from"./StyleRuntime-DW6omotc.mjs";import{n as d}from"./DomUtils-Bf7JLFlx.mjs";function h(t,e,n,o){const i=document.createElement("button");i.type="button",i.className="notectl-heading-picker__item",i.setAttribute("role","option"),i.setAttribute("aria-selected",String(e)),e&&i.classList.add("notectl-heading-picker__item--active");const r=document.createElement("span");r.className="notectl-heading-picker__check",r.textContent=e?"✓":"",i.appendChild(r);const a=document.createElement("span");return a.className="notectl-heading-picker__label",a.textContent=t,o&&p(a,{fontSize:o.fontSize,fontWeight:o.fontWeight}),i.appendChild(a),i.addEventListener("mousedown",n),i}function u(t,e){return t[`heading${e}`]}function f(t,e){const n=t.getState();if(!s(n.selection))return!1;const o=n.getBlock(n.selection.anchor.blockId);return!!o&&(o.type===e?k(t,c("paragraph")):k(t,c(e)))}function m(t,e){const n=t.getState(),o=n.selection;if(!s(o))return!1;const i=n.getBlock(o.anchor.blockId);return!!i&&("heading"===i.type&&i.attrs?.level===e?k(t,c("paragraph")):k(t,c("heading"),{level:e}))}function k(e,o,r){const a=e.getState(),c=a.selection;if(!s(c))return!1;const l=a.getBlock(c.anchor.blockId);if(!l)return!1;const g=a.transaction("command"),p=e.getSchemaRegistry().getNodeSpec(o);p?.excludeMarks&&p.excludeMarks.length>0&&(function(e,o,r){if(0===i(o))return;const a=new Set(r),s=n(o);let c=0;for(const n of s)if(t(n)){if(n.text.length>0)for(const t of n.marks)a.has(t.type)&&e.removeMark(o.id,c,c+n.text.length,t);c+=n.text.length}else c+=1}(g,l,p.excludeMarks),function(t,e,n){if(!e.storedMarks)return;const o=new Set(n),i=e.storedMarks.filter(t=>!o.has(t.type));i.length!==e.storedMarks.length&&t.setStoredMarks(i.length>0?i:null,e.storedMarks)}(g,a,p.excludeMarks));const d=g.setBlockType(c.anchor.blockId,o,r).setSelection(c).build();return e.dispatch(d),!0}var b=new Set(["heading","title","subtitle"]);var y={paragraph:"Paragraph",title:"Title",subtitle:"Subtitle",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",blockTypeLabel:"Block Type",blockTypesAria:"Block types"},v=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-0g2bmXTn.mjs"),"./locales/de.ts":()=>import("./de-Bwxlcuee.mjs"),"./locales/es.ts":()=>import("./es-C7uVqFYr.mjs"),"./locales/fr.ts":()=>import("./fr-D5ulA3Z6.mjs"),"./locales/hi.ts":()=>import("./hi-CrmakMVj.mjs"),"./locales/pt.ts":()=>import("./pt-_qxIe7zX.mjs"),"./locales/ru.ts":()=>import("./ru-Cs8KCNyq.mjs"),"./locales/zh.ts":()=>import("./zh-BQ73oqxc.mjs")});async function x(t){return l(v,t,y)}var S={levels:[1,2,3,4,5,6]},T={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"},B=class{id="heading";name="Heading";priority=30;config;locale;constructor(t){this.config={...S,...t}}async init(t){this.locale=await g(t,this.config.locale,y,x),t.registerStyleSheet("\n/* Heading Select — Width overrides for combobox button */\n.notectl-toolbar-btn--heading {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Heading Picker Popup */\n.notectl-heading-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-heading-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-heading-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-heading-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-heading-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-heading-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-heading-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-heading-picker__label {\n\tflex: 1;\n}\n"),this.registerNodeSpecs(t),function(t,e){t.registerCommand("setTitle",()=>f(t,"title")),t.registerCommand("setSubtitle",()=>f(t,"subtitle"));for(const n of e.levels)t.registerCommand(`setHeading${n}`,()=>m(t,n));t.registerCommand("toggleHeading",()=>m(t,1)),t.registerCommand("setParagraph",()=>k(t,c("paragraph")))}(t,this.config),function(t,n){const l={Enter:()=>function(t){return function(t,e){const n=t.getState();if(!s(n.selection))return!1;const o=n.selection;if(!r(o))return!1;const i=n.getBlock(o.anchor.blockId);return!(!i||!b.has(i.type))&&e({state:n,block:i,blockId:o.anchor.blockId,offset:o.anchor.offset})}(t,n=>{if(""===e(n.block)){const e=n.state.transaction("input").setBlockType(n.blockId,c("paragraph")).setSelection(n.state.selection).build();return t.dispatch(e),!0}const r=i(n.block);if(n.offset>=r){const e=o(),i=n.state.transaction("input").splitBlock(n.blockId,n.offset,e).setBlockType(e,c("paragraph")).setSelection(a(e,0)).build();return t.dispatch(i),!0}return!1})}(t)};for(const e of n.levels)e<=6&&(l[`Mod-Shift-${e}`]=()=>t.executeCommand(`setHeading${e}`));t.registerKeymap(l)}(t,this.config),!1!==this.config.inputRule&&function(t,e){for(const n of e.levels){const e="#".repeat(n),o=new RegExp(`^${e} $`);t.registerInputRule({pattern:o,handler(t,e,o,i){const l=t.selection;if(!s(l))return null;if(!r(l))return null;const g=t.getBlock(l.anchor.blockId);return g&&"paragraph"===g.type?t.transaction("input").deleteTextAt(l.anchor.blockId,o,o+n+1).setBlockType(l.anchor.blockId,c("heading"),{level:n}).setSelection(a(l.anchor.blockId,0)).build():null}})}}(t,this.config),function(t,e,n){t.registerBlockTypePickerEntry({id:"paragraph",label:n.paragraph,command:"setParagraph",priority:10,isActive:t=>!!s(t.selection)&&"paragraph"===t.getBlock(t.selection.anchor.blockId)?.type}),t.registerBlockTypePickerEntry({id:"title",label:n.title,command:"setTitle",priority:20,style:{fontSize:"1.6em",fontWeight:"700"},isActive:t=>!!s(t.selection)&&"title"===t.getBlock(t.selection.anchor.blockId)?.type}),t.registerBlockTypePickerEntry({id:"subtitle",label:n.subtitle,command:"setSubtitle",priority:30,style:{fontSize:"1.3em",fontWeight:"500"},isActive:t=>!!s(t.selection)&&"subtitle"===t.getBlock(t.selection.anchor.blockId)?.type});for(const o of e.levels)t.registerBlockTypePickerEntry({id:`heading-${o}`,label:u(n,o),command:`setHeading${o}`,priority:100+o,style:{fontSize:1.4-.1*o+"em",fontWeight:"600"},isActive:t=>{if(!s(t.selection))return!1;const e=t.getBlock(t.selection.anchor.blockId);return"heading"===e?.type&&e.attrs?.level===o}})}(t,this.config,this.locale),function(t,e){t.registerToolbarItem({id:"heading",group:"block",label:e.blockTypeLabel,tooltip:e.blockTypeLabel,command:"setParagraph",popupType:"combobox",getLabel:n=>function(t,e,n){if(!s(t.selection))return n.paragraph;const o=e.getBlockTypePickerRegistry().getBlockTypePickerEntries();for(const i of o)if(i.isActive(t))return i.label;return n.paragraph}(n,t,e),renderPopup:(t,n,o)=>{!function(t,e,n,o){t.classList.add("notectl-heading-picker");const i=e.getState();if(!s(i.selection))return;const r=e.getContainer(),a=document.createElement("div");a.className="notectl-heading-picker__list",a.setAttribute("role","listbox"),a.setAttribute("aria-label",n.blockTypesAria);const c=e.getBlockTypePickerRegistry().getBlockTypePickerEntries();for(const s of c){const t=s.isActive(i);a.appendChild(h(s.label,t,t=>{t.preventDefault(),t.stopPropagation(),e.executeCommand(s.command),o({restoreFocusTo:r})},s.style))}t.appendChild(a)}(t,n,e,o)},isActive:e=>t.getBlockTypePickerRegistry().getBlockTypePickerEntries().some(t=>"paragraph"!==t.id&&t.isActive(e))})}(t,this.locale)}registerNodeSpecs(t){t.registerNodeSpec({type:"title",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],toDOM(t){const e=d("h1",t.id);return e.classList.add("notectl-title"),e},toHTML:(t,e)=>`<h1 class="notectl-title">${e||"<br>"}</h1>`,parseHTML:[{tag:"h1",priority:60,getAttrs:t=>!!t.classList.contains("notectl-title")&&{}}],sanitize:{tags:["h1"],attrs:["class"]}}),t.registerNodeSpec({type:"subtitle",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],toDOM(t){const e=d("h2",t.id);return e.classList.add("notectl-subtitle"),e},toHTML:(t,e)=>`<h2 class="notectl-subtitle">${e||"<br>"}</h2>`,parseHTML:[{tag:"h2",priority:60,getAttrs:t=>!!t.classList.contains("notectl-subtitle")&&{}}],sanitize:{tags:["h2"],attrs:["class"]}}),t.registerNodeSpec({type:"heading",group:"block",content:{allow:["text"]},excludeMarks:["fontSize"],attrs:{level:{default:1}},toDOM:t=>d(T[t.attrs?.level??1]??"h1",t.id),toHTML(t,e){const n=T[t.attrs?.level??1]??"h1";return`<${n}>${e||"<br>"}</${n}>`},parseHTML:[{tag:"h1",getAttrs:()=>({level:1})},{tag:"h2",getAttrs:()=>({level:2})},{tag:"h3",getAttrs:()=>({level:3})},{tag:"h4",getAttrs:()=>({level:4})},{tag:"h5",getAttrs:()=>({level:5})},{tag:"h6",getAttrs:()=>({level:6})}],sanitize:{tags:["h1","h2","h3","h4","h5","h6"]}})}};export{y as n,x as r,B as t};
|
|
2
|
-
//# sourceMappingURL=HeadingPlugin-DUKsLuMd.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HeadingPlugin-DUKsLuMd.mjs","names":[],"sources":["../../src/editor/styles/heading-select.ts","../../src/plugins/heading/HeadingBlockTypePicker.ts","../../src/plugins/heading/HeadingCommands.ts","../../src/plugins/heading/HeadingInputRules.ts","../../src/plugins/heading/HeadingKeyboardHandlers.ts","../../src/plugins/heading/HeadingLocale.ts","../../src/plugins/heading/HeadingPlugin.ts"],"sourcesContent":["/** Heading picker toolbar combobox + popup styles. */\nexport const HEADING_SELECT_CSS = `\n/* Heading Select — Width overrides for combobox button */\n.notectl-toolbar-btn--heading {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Heading Picker Popup */\n.notectl-heading-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-heading-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-heading-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\ttext-align: start;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n@media (hover: hover) {\n\t.notectl-heading-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-heading-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-heading-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-heading-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-heading-picker__label {\n\tflex: 1;\n}\n`;\n","/**\n * Block type picker entries and toolbar dropdown for heading block types.\n * Registers picker entries for paragraph, title, subtitle, and all heading levels,\n * plus a combobox-style toolbar item with a custom popup.\n */\n\nimport { isTextSelection } from '../../model/Selection.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport type { PickerEntryStyle } from './BlockTypePickerEntry.js';\nimport type { HeadingLocale } from './HeadingLocale.js';\nimport type { HeadingConfig } from './HeadingPlugin.js';\nimport type { HeadingLevel } from './HeadingPlugin.js';\n\n// --- Picker Entry Registration ---\n\n/** Registers block type picker entries for paragraph, title, subtitle, and heading levels. */\nexport function registerHeadingPickerEntries(\n\tcontext: PluginContext,\n\tconfig: HeadingConfig,\n\tlocale: HeadingLocale,\n): void {\n\tcontext.registerBlockTypePickerEntry({\n\t\tid: 'paragraph',\n\t\tlabel: locale.paragraph,\n\t\tcommand: 'setParagraph',\n\t\tpriority: 10,\n\t\tisActive: (state) => {\n\t\t\tif (!isTextSelection(state.selection)) return false;\n\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\treturn block?.type === 'paragraph';\n\t\t},\n\t});\n\n\tcontext.registerBlockTypePickerEntry({\n\t\tid: 'title',\n\t\tlabel: locale.title,\n\t\tcommand: 'setTitle',\n\t\tpriority: 20,\n\t\tstyle: { fontSize: '1.6em', fontWeight: '700' },\n\t\tisActive: (state) => {\n\t\t\tif (!isTextSelection(state.selection)) return false;\n\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\treturn block?.type === 'title';\n\t\t},\n\t});\n\n\tcontext.registerBlockTypePickerEntry({\n\t\tid: 'subtitle',\n\t\tlabel: locale.subtitle,\n\t\tcommand: 'setSubtitle',\n\t\tpriority: 30,\n\t\tstyle: { fontSize: '1.3em', fontWeight: '500' },\n\t\tisActive: (state) => {\n\t\t\tif (!isTextSelection(state.selection)) return false;\n\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\treturn block?.type === 'subtitle';\n\t\t},\n\t});\n\n\tfor (const level of config.levels) {\n\t\tcontext.registerBlockTypePickerEntry({\n\t\t\tid: `heading-${level}`,\n\t\t\tlabel: getHeadingLabel(locale, level),\n\t\t\tcommand: `setHeading${level}`,\n\t\t\tpriority: 100 + level,\n\t\t\tstyle: { fontSize: `${1.4 - level * 0.1}em`, fontWeight: '600' },\n\t\t\tisActive: (state) => {\n\t\t\t\tif (!isTextSelection(state.selection)) return false;\n\t\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\t\treturn block?.type === 'heading' && block.attrs?.level === level;\n\t\t\t},\n\t\t});\n\t}\n}\n\n// --- Toolbar Item ---\n\n/** Registers the heading toolbar dropdown with a combobox picker popup. */\nexport function registerHeadingToolbarItem(context: PluginContext, locale: HeadingLocale): void {\n\tcontext.registerToolbarItem({\n\t\tid: 'heading',\n\t\tgroup: 'block',\n\t\tlabel: locale.blockTypeLabel,\n\t\ttooltip: locale.blockTypeLabel,\n\t\tcommand: 'setParagraph',\n\t\tpopupType: 'combobox',\n\t\tgetLabel: (state: EditorState): string => getActiveLabel(state, context, locale),\n\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\trenderHeadingPopup(container, ctx, locale, onClose);\n\t\t},\n\t\tisActive: (state) => {\n\t\t\tconst entries = context.getBlockTypePickerRegistry().getBlockTypePickerEntries();\n\t\t\treturn entries.some((entry) => entry.id !== 'paragraph' && entry.isActive(state));\n\t\t},\n\t});\n}\n\n// --- Popup Rendering ---\n\nfunction renderHeadingPopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tlocale: HeadingLocale,\n\tonClose: (options?: PopupCloseOptions) => void,\n): void {\n\tcontainer.classList.add('notectl-heading-picker');\n\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return;\n\n\tconst contentElement: HTMLElement = context.getContainer();\n\n\tconst list: HTMLDivElement = document.createElement('div');\n\tlist.className = 'notectl-heading-picker__list';\n\tlist.setAttribute('role', 'listbox');\n\tlist.setAttribute('aria-label', locale.blockTypesAria);\n\n\tconst entries = context.getBlockTypePickerRegistry().getBlockTypePickerEntries();\n\tfor (const entry of entries) {\n\t\tconst active: boolean = entry.isActive(state);\n\t\tlist.appendChild(\n\t\t\tcreatePickerItem(\n\t\t\t\tentry.label,\n\t\t\t\tactive,\n\t\t\t\t(e: MouseEvent) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tcontext.executeCommand(entry.command);\n\t\t\t\t\tonClose({ restoreFocusTo: contentElement });\n\t\t\t\t},\n\t\t\t\tentry.style,\n\t\t\t),\n\t\t);\n\t}\n\n\tcontainer.appendChild(list);\n}\n\nfunction createPickerItem(\n\tlabel: string,\n\tisActive: boolean,\n\thandler: (e: MouseEvent) => void,\n\tstyle?: PickerEntryStyle,\n): HTMLButtonElement {\n\tconst item: HTMLButtonElement = document.createElement('button');\n\titem.type = 'button';\n\titem.className = 'notectl-heading-picker__item';\n\titem.setAttribute('role', 'option');\n\titem.setAttribute('aria-selected', String(isActive));\n\n\tif (isActive) {\n\t\titem.classList.add('notectl-heading-picker__item--active');\n\t}\n\n\tconst check: HTMLSpanElement = document.createElement('span');\n\tcheck.className = 'notectl-heading-picker__check';\n\tcheck.textContent = isActive ? '\\u2713' : '';\n\titem.appendChild(check);\n\n\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\tlabelSpan.className = 'notectl-heading-picker__label';\n\tlabelSpan.textContent = label;\n\tif (style) {\n\t\tsetStyleProperties(labelSpan, {\n\t\t\tfontSize: style.fontSize,\n\t\t\tfontWeight: style.fontWeight,\n\t\t});\n\t}\n\titem.appendChild(labelSpan);\n\n\titem.addEventListener('mousedown', handler);\n\treturn item;\n}\n\n// --- Helpers ---\n\nfunction getHeadingLabel(locale: HeadingLocale, level: HeadingLevel): string {\n\tconst key = `heading${level}` as keyof HeadingLocale;\n\treturn locale[key] as string;\n}\n\nfunction getActiveLabel(state: EditorState, context: PluginContext, locale: HeadingLocale): string {\n\tif (!isTextSelection(state.selection)) return locale.paragraph;\n\tconst entries = context.getBlockTypePickerRegistry().getBlockTypePickerEntries();\n\tfor (const entry of entries) {\n\t\tif (entry.isActive(state)) return entry.label;\n\t}\n\treturn locale.paragraph;\n}\n","/**\n * Command registration and implementations for heading block types.\n * Handles toggle between heading/title/subtitle and paragraph,\n * plus excluded-mark stripping when switching block types.\n */\n\nimport type { BlockNode, Mark } from '../../model/Document.js';\nimport { getBlockLength, getInlineChildren, isTextNode } from '../../model/Document.js';\nimport { isTextSelection } from '../../model/Selection.js';\nimport { type NodeTypeName, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TransactionBuilder } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { HeadingConfig, HeadingLevel } from './HeadingPlugin.js';\n\n/** Registers all heading commands (setTitle, setSubtitle, setHeadingN, toggleHeading, setParagraph). */\nexport function registerHeadingCommands(context: PluginContext, config: HeadingConfig): void {\n\tcontext.registerCommand('setTitle', () => toggleSpecialBlock(context, 'title'));\n\n\tcontext.registerCommand('setSubtitle', () => toggleSpecialBlock(context, 'subtitle'));\n\n\tfor (const level of config.levels) {\n\t\tcontext.registerCommand(`setHeading${level}`, () => toggleHeading(context, level));\n\t}\n\n\tcontext.registerCommand('toggleHeading', () => toggleHeading(context, 1));\n\n\tcontext.registerCommand('setParagraph', () => setBlockType(context, nodeType('paragraph')));\n}\n\n// --- Command Implementations ---\n\n/**\n * Toggles between a special block type (title/subtitle) and paragraph.\n * If the block is already that type, resets to paragraph.\n */\nfunction toggleSpecialBlock(context: PluginContext, type: string): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(state.selection.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === type) {\n\t\treturn setBlockType(context, nodeType('paragraph'));\n\t}\n\n\treturn setBlockType(context, nodeType(type) as NodeTypeName);\n}\n\n/**\n * Toggles between heading (at given level) and paragraph.\n * If the block is already a heading at the same level, resets to paragraph.\n */\nfunction toggleHeading(context: PluginContext, level: HeadingLevel): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'heading' && block.attrs?.level === level) {\n\t\treturn setBlockType(context, nodeType('paragraph'));\n\t}\n\n\treturn setBlockType(context, nodeType('heading'), { level });\n}\n\nfunction setBlockType(\n\tcontext: PluginContext,\n\ttype: NodeTypeName,\n\tattrs?: Record<string, string | number | boolean>,\n): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tconst builder: TransactionBuilder = state.transaction('command');\n\n\tconst spec = context.getSchemaRegistry().getNodeSpec(type);\n\tif (spec?.excludeMarks && spec.excludeMarks.length > 0) {\n\t\tstripExcludedMarks(builder, block, spec.excludeMarks);\n\t\tclearExcludedStoredMarks(builder, state, spec.excludeMarks);\n\t}\n\n\tconst tr = builder.setBlockType(sel.anchor.blockId, type, attrs).setSelection(sel).build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n// --- Mark Stripping Helpers ---\n\n/**\n * Adds removeMark steps for each excluded mark type found\n * on the block's inline text content.\n */\nfunction stripExcludedMarks(\n\tbuilder: TransactionBuilder,\n\tblock: BlockNode,\n\texcludeMarks: readonly string[],\n): void {\n\tconst blockLength: number = getBlockLength(block);\n\tif (blockLength === 0) return;\n\n\tconst excludeSet: Set<string> = new Set(excludeMarks);\n\tconst inlineChildren = getInlineChildren(block);\n\tlet offset = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tif (isTextNode(child)) {\n\t\t\tif (child.text.length > 0) {\n\t\t\t\tfor (const mark of child.marks) {\n\t\t\t\t\tif (excludeSet.has(mark.type)) {\n\t\t\t\t\t\tbuilder.removeMark(block.id, offset, offset + child.text.length, mark);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\toffset += child.text.length;\n\t\t} else {\n\t\t\toffset += 1;\n\t\t}\n\t}\n}\n\n/**\n * Clears excluded mark types from stored marks so that\n * subsequent typing does not reintroduce them.\n */\nfunction clearExcludedStoredMarks(\n\tbuilder: TransactionBuilder,\n\tstate: EditorState,\n\texcludeMarks: readonly string[],\n): void {\n\tif (!state.storedMarks) return;\n\n\tconst excludeSet: Set<string> = new Set(excludeMarks);\n\tconst filtered: readonly Mark[] = state.storedMarks.filter((m: Mark) => !excludeSet.has(m.type));\n\n\tif (filtered.length !== state.storedMarks.length) {\n\t\tbuilder.setStoredMarks(filtered.length > 0 ? filtered : null, state.storedMarks);\n\t}\n}\n","/**\n * Input rule registration for heading block types.\n * Converts `# `, `## `, etc. at the start of a paragraph into headings.\n */\n\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { HeadingConfig } from './HeadingPlugin.js';\n\n/** Registers markdown-style input rules (e.g. `# ` → H1) for configured heading levels. */\nexport function registerHeadingInputRules(context: PluginContext, config: HeadingConfig): void {\n\tfor (const level of config.levels) {\n\t\tconst hashes: string = '#'.repeat(level);\n\t\tconst pattern: RegExp = new RegExp(`^${hashes} $`);\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern,\n\t\t\thandler(state, _match, start, _end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + level + 1)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('heading'), { level })\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Keyboard handlers for heading block types.\n * Handles Enter key behavior: empty heading → paragraph, cursor at end → split + paragraph.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockLength, getBlockText } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { HeadingConfig } from './HeadingPlugin.js';\n\n// --- Context Guard ---\n\nconst HEADING_TYPES: ReadonlySet<string> = new Set(['heading', 'title', 'subtitle']);\n\ninterface HeadingContext {\n\treadonly state: EditorState;\n\treadonly block: BlockNode;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection, non-collapsed selections, and non-heading blocks.\n * Returns false (not handled) if the cursor is not inside a heading-type block.\n */\nfunction withHeadingContext(\n\tcontext: PluginContext,\n\thandler: (ctx: HeadingContext) => boolean,\n): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block || !HEADING_TYPES.has(block.type)) return false;\n\n\treturn handler({\n\t\tstate,\n\t\tblock,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers all heading keyboard handlers (Enter, Mod-Shift-N shortcuts). */\nexport function registerHeadingKeymaps(context: PluginContext, config: HeadingConfig): void {\n\tconst keymap: Record<string, () => boolean> = {\n\t\tEnter: () => handleEnter(context),\n\t};\n\n\tfor (const level of config.levels) {\n\t\tif (level <= 6) {\n\t\t\tkeymap[`Mod-Shift-${level}`] = () => context.executeCommand(`setHeading${level}`);\n\t\t}\n\t}\n\n\tcontext.registerKeymap(keymap);\n}\n\n// --- Enter Handler ---\n\n/**\n * Handles Enter inside a heading block.\n * Empty heading → convert to paragraph.\n * Cursor at end → split and convert new block to paragraph.\n * Cursor in middle → normal split (both stay heading).\n */\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withHeadingContext(context, (ctx) => {\n\t\tconst text: string = getBlockText(ctx.block);\n\n\t\tif (text === '') {\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(ctx.state.selection)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst blockLength: number = getBlockLength(ctx.block);\n\n\t\tif (ctx.offset >= blockLength) {\n\t\t\tconst newBlockId = generateBlockId();\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.splitBlock(ctx.blockId, ctx.offset, newBlockId)\n\t\t\t\t.setBlockType(newBlockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t});\n}\n","/**\n * Locale interface and default English locale for the HeadingPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface HeadingLocale {\n\treadonly paragraph: string;\n\treadonly title: string;\n\treadonly subtitle: string;\n\treadonly heading1: string;\n\treadonly heading2: string;\n\treadonly heading3: string;\n\treadonly heading4: string;\n\treadonly heading5: string;\n\treadonly heading6: string;\n\treadonly blockTypeLabel: string;\n\treadonly blockTypesAria: string;\n}\n\n// --- Default English Locale ---\n\nexport const HEADING_LOCALE_EN: HeadingLocale = {\n\tparagraph: 'Paragraph',\n\ttitle: 'Title',\n\tsubtitle: 'Subtitle',\n\theading1: 'Heading 1',\n\theading2: 'Heading 2',\n\theading3: 'Heading 3',\n\theading4: 'Heading 4',\n\theading5: 'Heading 5',\n\theading6: 'Heading 6',\n\tblockTypeLabel: 'Block Type',\n\tblockTypesAria: 'Block types',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<HeadingLocale> = import.meta.glob<{\n\tdefault: HeadingLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadHeadingLocale(lang: string): Promise<HeadingLocale> {\n\treturn loadLocaleModule(localeModules, lang, HEADING_LOCALE_EN);\n}\n","/**\n * HeadingPlugin: registers Title, Subtitle, and H1–H6 heading block types\n * with NodeSpec, toggle commands, keyboard shortcuts, input rules, and a\n * combobox-style toolbar dropdown that reflects the current block type.\n *\n * This file is a thin orchestrator — command logic, input rules, keyboard\n * handlers, and picker/toolbar rendering are delegated to dedicated modules.\n */\n\nimport { HEADING_SELECT_CSS } from '../../editor/styles/heading-select.js';\nimport type { BlockAlignment } from '../../model/BlockAlignment.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport {\n\tregisterHeadingPickerEntries,\n\tregisterHeadingToolbarItem,\n} from './HeadingBlockTypePicker.js';\nimport { registerHeadingCommands } from './HeadingCommands.js';\nimport { registerHeadingInputRules } from './HeadingInputRules.js';\nimport { registerHeadingKeymaps } from './HeadingKeyboardHandlers.js';\nimport { HEADING_LOCALE_EN, type HeadingLocale, loadHeadingLocale } from './HeadingLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\theading: { level: HeadingLevel; align?: BlockAlignment };\n\t\ttitle: { align?: BlockAlignment };\n\t\tsubtitle: { align?: BlockAlignment };\n\t}\n}\n\n// --- Configuration ---\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingConfig {\n\t/** Which heading levels to enable. Defaults to [1, 2, 3, 4, 5, 6]. */\n\treadonly levels: readonly HeadingLevel[];\n\t/** Live Markdown shortcut: `# ` ... `###### ` to set a heading. Default true. */\n\treadonly inputRule?: boolean;\n\treadonly locale?: HeadingLocale;\n}\n\nconst DEFAULT_CONFIG: HeadingConfig = {\n\tlevels: [1, 2, 3, 4, 5, 6],\n};\n\n// --- Heading Tag Mapping ---\n\nconst HEADING_TAGS: Record<HeadingLevel, string> = {\n\t1: 'h1',\n\t2: 'h2',\n\t3: 'h3',\n\t4: 'h4',\n\t5: 'h5',\n\t6: 'h6',\n};\n\n// --- Plugin ---\n\nexport class HeadingPlugin implements Plugin {\n\treadonly id = 'heading';\n\treadonly name = 'Heading';\n\treadonly priority = 30;\n\n\tprivate readonly config: HeadingConfig;\n\tprivate locale!: HeadingLocale;\n\n\tconstructor(config?: Partial<HeadingConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\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\tHEADING_LOCALE_EN,\n\t\t\tloadHeadingLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(HEADING_SELECT_CSS);\n\n\t\tthis.registerNodeSpecs(context);\n\t\tregisterHeadingCommands(context, this.config);\n\t\tregisterHeadingKeymaps(context, this.config);\n\t\tif (this.config.inputRule !== false) registerHeadingInputRules(context, this.config);\n\t\tregisterHeadingPickerEntries(context, this.config, this.locale);\n\t\tregisterHeadingToolbarItem(context, this.locale);\n\t}\n\n\tprivate registerNodeSpecs(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'title',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\texcludeMarks: ['fontSize'],\n\t\t\ttoDOM(node) {\n\t\t\t\tconst el = createBlockElement('h1', node.id);\n\t\t\t\tel.classList.add('notectl-title');\n\t\t\t\treturn el;\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<h1 class=\"notectl-title\">${content || '<br>'}</h1>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'h1',\n\t\t\t\t\tpriority: 60,\n\t\t\t\t\tgetAttrs: (el) => (el.classList.contains('notectl-title') ? {} : false),\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['h1'], attrs: ['class'] },\n\t\t});\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'subtitle',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\texcludeMarks: ['fontSize'],\n\t\t\ttoDOM(node) {\n\t\t\t\tconst el = createBlockElement('h2', node.id);\n\t\t\t\tel.classList.add('notectl-subtitle');\n\t\t\t\treturn el;\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<h2 class=\"notectl-subtitle\">${content || '<br>'}</h2>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'h2',\n\t\t\t\t\tpriority: 60,\n\t\t\t\t\tgetAttrs: (el) => (el.classList.contains('notectl-subtitle') ? {} : false),\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['h2'], attrs: ['class'] },\n\t\t});\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'heading',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\texcludeMarks: ['fontSize'],\n\t\t\tattrs: {\n\t\t\t\tlevel: { default: 1 },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst level = node.attrs?.level ?? 1;\n\t\t\t\tconst tag = HEADING_TAGS[level] ?? 'h1';\n\t\t\t\treturn createBlockElement(tag, node.id);\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst level = (node.attrs?.level ?? 1) as HeadingLevel;\n\t\t\t\tconst tag: string = HEADING_TAGS[level] ?? 'h1';\n\t\t\t\treturn `<${tag}>${content || '<br>'}</${tag}>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{ tag: 'h1', getAttrs: () => ({ level: 1 }) },\n\t\t\t\t{ tag: 'h2', getAttrs: () => ({ level: 2 }) },\n\t\t\t\t{ tag: 'h3', getAttrs: () => ({ level: 3 }) },\n\t\t\t\t{ tag: 'h4', getAttrs: () => ({ level: 4 }) },\n\t\t\t\t{ tag: 'h5', getAttrs: () => ({ level: 5 }) },\n\t\t\t\t{ tag: 'h6', getAttrs: () => ({ level: 6 }) },\n\t\t\t],\n\t\t\tsanitize: { tags: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] },\n\t\t});\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as t}from"./Document-827l3P80.mjs";import{o,t as e,u as r}from"./Selection-HYoVFpAx.mjs";import{a as i}from"./TypeBrands-Ch9856Gb.mjs";import{s}from"./BlockInsertion-CYH2gRkY.mjs";import{c as l,i as n,o as a}from"./PluginHelpers-KDuTlmXm.mjs";import{n as c}from"./DomUtils-Bf7JLFlx.mjs";import{t as m}from"./ShortcutFormatting-TwiufqeV.mjs";var p={label:"Horizontal Rule",tooltip:t=>`Horizontal Rule (${t})`},u=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CrOb0jL2.mjs"),"./locales/de.ts":()=>import("./de-C7uehgMu.mjs"),"./locales/es.ts":()=>import("./es-xuahrvJN.mjs"),"./locales/fr.ts":()=>import("./fr-B9pBLaVx.mjs"),"./locales/hi.ts":()=>import("./hi-DWX6k5ZD.mjs"),"./locales/pt.ts":()=>import("./pt-DFKJVh7k.mjs"),"./locales/ru.ts":()=>import("./ru-q8kz-237.mjs"),"./locales/zh.ts":()=>import("./zh-BGYJXxVl.mjs")});async function h(t){return l(u,t,p)}var d={},g=class{id="horizontal-rule";name="Horizontal Rule";priority=40;config;locale;constructor(t){this.config={...d,...t}}async init(t){this.locale=await a(t,this.config.locale,p,h),this.registerNodeSpec(t),this.registerCommands(t),this.registerKeymap(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerToolbarItem(t)}registerNodeSpec(t){t.registerNodeSpec({type:"horizontal_rule",group:"block",isVoid:!0,toDOM:t=>c("hr",t.id),toHTML:()=>"<hr>",parseHTML:[{tag:"hr"}],sanitize:{tags:["hr"]}})}registerCommands(t){t.registerCommand("insertHorizontalRule",()=>this.insertHorizontalRule(t))}registerKeymap(t){t.registerKeymap({"Mod-Shift-H":()=>t.executeCommand("insertHorizontalRule")})}registerInputRule(s){s.registerInputRule({pattern:/^-{3,} $/,handler(s,l,n,a){const c=s.selection;if(!r(c))return null;if(!o(c))return null;const m=s.getBlock(c.anchor.blockId);if(!m||"paragraph"!==m.type)return null;const p=function(t){const o=t.selection;return r(o)?t.doc.children.findIndex(t=>t.id===o.anchor.blockId):-1}(s);if(-1===p)return null;const u=t(i("paragraph"));return s.transaction("input").deleteTextAt(c.anchor.blockId,0,a).setBlockType(c.anchor.blockId,i("horizontal_rule")).insertNode([],p+1,u).setSelection(e(u.id,0)).build()}})}registerToolbarItem(t){t.registerToolbarItem({id:"horizontal-rule",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11h16v2H4z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(m("Mod-Shift-H")),command:"insertHorizontalRule",isActive:()=>!1})}insertHorizontalRule(o){const r=o.getState(),l=n(r);if(!l)return!1;const a=r.transaction("command"),c=s(r,a,l,t(i("horizontal_rule")));return!!c&&(a.setSelection(e(c.id,0)),o.dispatch(a.build()),!0)}};export{p as n,h as r,g as t};
|
|
2
|
-
//# sourceMappingURL=HorizontalRulePlugin-B9OvwrKB.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t}from"./HTMLUtils-Bhg3_P8B.mjs";import{o as e,p as n,w as i}from"./Document-827l3P80.mjs";import{c as r,l as o,r as a}from"./Selection-HYoVFpAx.mjs";import{a as s}from"./TypeBrands-Ch9856Gb.mjs";import{s as l}from"./BlockInsertion-CYH2gRkY.mjs";import{t as c}from"./NodeSelectionCommands-WH5snxr_.mjs";import{n as d}from"./TypedKeys-CA4bfw9O.mjs";import{c as g,o as m}from"./PluginHelpers-KDuTlmXm.mjs";import{c as p,r as u,s as h}from"./StyleRuntime-DW6omotc.mjs";import{t as f}from"./Platform-ByobkiCc.mjs";import{n as b}from"./DomUtils-Bf7JLFlx.mjs";import{t as v}from"./ShortcutFormatting-TwiufqeV.mjs";function x(t,c){const d=t.getState(),g=d.selection,m={src:c.src,alt:c.alt??"",align:c.align??"center",...void 0!==c.width?{width:c.width}:{},...void 0!==c.height?{height:c.height}:{}};if(r(g))return!1;const p=o(g)?g.nodeId:g.anchor.blockId,u=function(t,e){if("table_cell"===t.getBlock(e)?.type)return e;const n=t.getNodePath(e);if(n)for(const i of n)if("table_cell"===t.getBlock(i)?.type)return i}(d,p);return u?function(t,r,o,l){const c=t.getNodePath(o);if(!c)return!1;const d=e(s("image"),[],void 0,l),g=t.getBlock(o);if(!g)return!1;const m=t.transaction("command"),p=n(g);for(let e=p.length-1;e>=0;e--){const t=g.children.findIndex(t=>i(t)&&t.id===p[e]?.id);-1!==t&&m.removeNode(c,t)}return m.insertNode(c,0,d),m.setSelection(a(d.id,[...c,d.id])),r.dispatch(m.build()),!0}(d,t,u,m):function(t,n,i,r){const o=e(s("image"),[],void 0,r),c=t.transaction("command");return!!l(t,c,i,o)&&(c.setSelection(a(o.id,[])),n.dispatch(c.build()),!0)}(d,t,p,m)}function _(t,e,n){const i=t.getState(),r=i.selection;if(!o(r))return!1;const a=i.getBlock(r.nodeId);if(!a||"image"!==a.type)return!1;const s=a.attrs?.width,l=a.attrs?.height;if(void 0===s||void 0===l)return!1;const c=l>0?s/l:1,d=Math.max(50,Math.min(n,s+e)),g=Math.round(d/c);return(d!==s||g!==l)&&function(t,e){const n=t.getState(),i=n.selection;if(!o(i))return!1;const r=n.getBlock(i.nodeId);if(!r||"image"!==r.type)return!1;const a=n.getNodePath(i.nodeId);if(!a)return!1;const s={...r.attrs??{},...e},l=n.transaction("command").setNodeAttr(a,s).build();return t.dispatch(l),!0}(t,{width:d,height:g})}var w={insertImage:"Insert Image",insertImageTooltip:"Insert Image",uploadFromComputer:"Upload from computer",uploadAria:"Upload image from computer",separator:"or",urlPlaceholder:"https://...",urlAria:"Image URL",insertButton:"Insert",insertAria:"Insert image",imageAria:(t,e,n)=>{const i=[t||"Image"];return void 0!==e&&void 0!==n&&i.push(`${e} by ${n} pixels`),i.join(", ")},resetToNaturalSize:"Image reset to natural size.",uploadFailed:"Upload failed.",uploading:"Uploading...",resizeHandleLabel:t=>`Resize ${t}`,imageSelected:"Image selected.",altTextPrefix:"Alt text: ",imageSizeAnnounce:(t,e)=>`Size: ${t} by ${e} pixels.`,resizeHint:(t,e)=>`${t} / ${e} to resize.`,imageResized:(t,e)=>`Image resized to ${t} by ${e} pixels.`,keyboardResizeHint:(t,e)=>`${t} / ${e} to resize`},z=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-4b8e2YSc.mjs"),"./locales/de.ts":()=>import("./de-i95F9SDy.mjs"),"./locales/es.ts":()=>import("./es-DehVGwQ8.mjs"),"./locales/fr.ts":()=>import("./fr-DEZ_oxzS.mjs"),"./locales/hi.ts":()=>import("./hi-J8ErB5nB.mjs"),"./locales/pt.ts":()=>import("./pt-BlFAJZo7.mjs"),"./locales/ru.ts":()=>import("./ru-D53d-_UB.mjs"),"./locales/zh.ts":()=>import("./zh-DdzgYD7k.mjs")});async function y(t){return g(z,t,w)}var S={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"},I={nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"},k={nw:-1,ne:1,sw:-1,se:1},A={nw:"nesw-resize",ne:"nwse-resize",sw:"nwse-resize",se:"nesw-resize"},L=null;function C(){L&&(L.remove(),L=null)}function N(t,e,n,i=w){return(r,o,a)=>{const s=document.createElement("figure");s.className="notectl-image",s.setAttribute("data-block-id",r.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const l=document.createElement("div");l.className="notectl-image__container";const c=document.createElement("img");c.className="notectl-image__img",c.draggable=!1;const d=document.createElement("div");d.className="notectl-image__overlay",l.appendChild(c),l.appendChild(d),s.appendChild(l);let g=r.id,m=null;function b(t){const n=t.attrs?.src??"",r=t.attrs?.alt??"",o=t.attrs?.width,a=t.attrs?.height,l=t.attrs?.align??"center";c.src!==n&&(c.src=n),c.alt=r,p(c,"width",void 0!==o?`${o}px`:""),p(c,"height",void 0!==a?`${a}px`:"");for(const e of Object.values(S))s.classList.remove(e);const g=S[l];g&&s.classList.add(g);const m=e.get(t.id)??"idle",u="uploading"===m;d.classList.toggle("notectl-image__overlay--uploading",u),d.classList.toggle("notectl-image__overlay--error","error"===m),d.textContent=u?i.uploading:"error"===m?i.uploadFailed:"",u?s.setAttribute("aria-busy","true"):s.removeAttribute("aria-busy"),function(t){const e=t.attrs?.alt??"",n=t.attrs?.width,r=t.attrs?.height;s.setAttribute("aria-label",i.imageAria(e,n,r))}(t)}b(r);let x=!1;function _(e,n,i,r){let l=0,d=0,g=1,m=k[n];const p=e=>{const n=e.clientX-l,i=(o=d+n*m,Math.max(50,Math.min(t.maxWidth,o)));var o;const a=Math.round(i/g);h(c,{width:`${i}px`,height:`${a}px`}),r.textContent=`${Math.round(i)} × ${a}`},b=t=>{document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",b),s.classList.remove("notectl-image--resizing"),r.classList.remove("notectl-image__size-indicator--visible"),C();const e=Math.round(c.getBoundingClientRect().width);!function(t,e,n){const i=o(),r=i.getBlock(t);if(!r)return;const s=r.attrs?.width,l=r.attrs?.height;if(s===e&&l===n)return;const c=i.getNodePath(t);if(!c)return;const d={...r.attrs??{},width:e,height:n};a(i.transaction("command").setNodeAttr(c,d).build())}(i,e,Math.round(e/g)),t.target?.releasePointerCapture?.(t.pointerId)};e.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation();const e="rtl"===f(s);m=function(t,e){const n=k[t];return e?-n:n}(n,e),l=t.clientX,d=c.getBoundingClientRect().width;const i=c.getBoundingClientRect().height;g=i>0?d/i:1,s.classList.add("notectl-image--resizing"),r.textContent=`${Math.round(d)} × ${Math.round(i)}`,r.classList.add("notectl-image__size-indicator--visible"),function(t,e){C(),L=document.createElement("style");const n=e?u(e):void 0;n&&L.setAttribute("nonce",n),L.textContent=`*{cursor:${t}!important;user-select:none!important}`,document.head.appendChild(L)}(e?A[n]:I[n],s),t.target.setPointerCapture(t.pointerId),document.addEventListener("pointermove",p),document.addEventListener("pointerup",b)})}function w(){C(),m&&(m.remove(),m=null)}return c.addEventListener("load",()=>{if(x)return;const e=o(),n=e.getBlock(g);if(!n||"image"!==n.type)return;const i=void 0!==n.attrs?.width,r=void 0!==n.attrs?.height;if(i&&r)return void(x=!0);const s=c.naturalWidth,l=c.naturalHeight;if(0===s||0===l)return;const d=Math.min(s,t.maxWidth),m=s>0?l/s:1,p=Math.round(d*m),u=e.getNodePath(g);if(!u)return;const h={...n.attrs??{},width:d,height:p};a(e.transaction("command").setNodeAttr(u,h).build()),x=!0}),{dom:s,contentDOM:null,update:t=>"image"===t.type&&(g=t.id,s.setAttribute("data-block-id",t.id),b(t),!0),selectNode(){s.classList.add("notectl-image--selected"),function(e){if(!t.resizable||m)return;m=document.createElement("div"),m.className="notectl-image__resize-overlay",m.setAttribute("data-notectl-no-print","");const r=document.createElement("div");r.className="notectl-image__size-indicator",m.appendChild(r);for(const t of["nw","ne","sw","se"]){const n=document.createElement("div");n.className=`notectl-image__resize-handle notectl-image__resize-handle--${t}`,n.setAttribute("aria-hidden","true"),_(n,t,e,r),m.appendChild(n)}if(n){const t=function(t,e){const n=t.shrinkWidth??null,i=t.growWidth??null;return n&&i?e.keyboardResizeHint(v(n),v(i)):""}(n,i);if(t){const e=document.createElement("div");e.className="notectl-image__keyboard-hint",e.setAttribute("aria-hidden","true"),e.textContent=t,m.appendChild(e)}}l.appendChild(m)}(g)},deselectNode(){s.classList.remove("notectl-image--selected"),w()},destroy(){w()}}}}var $=new d("image:upload"),j={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},E={maxWidth:800,maxFileSize:10485760,acceptedTypes:["image/png","image/jpeg","image/gif","image/webp","image/svg+xml"],resizable:!0,resizeStep:10,resizeStepLarge:50},M=class{id="image";name="Image";priority=45;config;resolvedKeymap;uploadStates=/* @__PURE__ */new Map;blobUrls=/* @__PURE__ */new Set;context=null;locale;constructor(t){this.config={...E,...t},this.resolvedKeymap={...j,...t?.keymap}}async init(t){this.locale=await m(t,this.config.locale,w,y),t.registerStyleSheet('\n/* Image */\n.notectl-image {\n\tmargin: 8px 0;\n\tuser-select: none;\n\tline-height: 0;\n}\n\n.notectl-image--center {\n\ttext-align: center;\n}\n\n.notectl-image--start {\n\ttext-align: start;\n}\n\n.notectl-image--end {\n\ttext-align: end;\n}\n\n.notectl-image__container {\n\tdisplay: inline-block;\n\tposition: relative;\n\tline-height: 0;\n}\n\n.notectl-image__img {\n\tdisplay: block;\n\tmax-width: 100%;\n\tborder-radius: 4px;\n}\n\n.notectl-image--selected .notectl-image__container {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n\tborder-radius: 6px;\n}\n\n/* Alignment toolbar (appears on image selection) */\n.notectl-image__align-toolbar {\n\tdisplay: flex;\n\tgap: 2px;\n\tposition: absolute;\n\ttop: -36px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tbackground: var(--notectl-surface-overlay);\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tpadding: 2px;\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-image__align-btn {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tbackground: transparent;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image__align-btn:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-image__align-btn--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-image__align-btn svg {\n\twidth: 16px;\n\theight: 16px;\n\tfill: currentColor;\n}\n\n/* Upload overlay */\n.notectl-image__overlay {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: none;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground: rgba(255, 255, 255, 0.8);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-image__overlay--uploading {\n\tdisplay: flex;\n}\n\n.notectl-image__overlay--error {\n\tdisplay: flex;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n}\n\n/* Resize overlay + handles */\n.notectl-image__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-image__resize-handle {\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tbackground: var(--notectl-surface-raised);\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 50%;\n\tpointer-events: all;\n\tz-index: 2;\n\ttransition: transform 0.1s, background 0.1s;\n}\n\n.notectl-image__resize-handle:hover {\n\tbackground: var(--notectl-primary);\n\ttransform: scale(1.3);\n}\n\n.notectl-image--resizing .notectl-image__resize-handle {\n\tbackground: var(--notectl-primary);\n}\n\n.notectl-image__resize-handle--nw {\n\ttop: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nwse-resize;\n}\n\n.notectl-image__resize-handle--ne {\n\ttop: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--sw {\n\tbottom: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--se {\n\tbottom: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nwse-resize;\n}\n\n/* RTL cursor overrides — flip diagonal cursors when in RTL context */\n[dir="rtl"] .notectl-image__resize-handle--nw {\n\tcursor: nesw-resize;\n}\n\n[dir="rtl"] .notectl-image__resize-handle--ne {\n\tcursor: nwse-resize;\n}\n\n[dir="rtl"] .notectl-image__resize-handle--sw {\n\tcursor: nwse-resize;\n}\n\n[dir="rtl"] .notectl-image__resize-handle--se {\n\tcursor: nesw-resize;\n}\n\n/* Size indicator tooltip */\n.notectl-image__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\tborder-radius: 4px;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-image__size-indicator--visible {\n\topacity: 1;\n}\n\n/* Keyboard resize hint (shown on selection, hidden during drag) */\n.notectl-image__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-image--selected .notectl-image__keyboard-hint {\n\tdisplay: block;\n}\n\n.notectl-image--resizing .notectl-image__keyboard-hint {\n\tdisplay: none;\n}\n\n/* Resizing feedback */\n.notectl-image--resizing .notectl-image__img {\n\topacity: 0.85;\n}\n'),t.registerStyleSheet("\n.notectl-image-popup {\n\tpadding: 8px;\n\tmin-width: 240px;\n}\n\n.notectl-image-popup__file-input {\n\tposition: absolute;\n\twidth: 0;\n\theight: 0;\n\toverflow: hidden;\n\topacity: 0;\n}\n\n.notectl-image-popup__upload-btn {\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tcursor: pointer;\n\ttext-align: center;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__separator {\n\tdisplay: flex;\n\talign-items: center;\n\tmargin: 8px 0;\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n}\n\n.notectl-image-popup__separator-line {\n\tflex: 1;\n\theight: 1px;\n\tbackground: var(--notectl-border);\n}\n\n.notectl-image-popup__separator-text {\n\tpadding: 0 8px;\n}\n\n.notectl-image-popup__url-input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__insert-btn {\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tmargin-top: 4px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n"),this.context=t,this.registerNodeSpec(t),this.registerInlineImageNodeSpec(t),this.registerNodeView(t),function(t){t.registerCommand("insertImage",()=>x(t,{src:""})),t.registerCommand("removeImage",()=>function(t){const e=t.getState(),n=e.selection;if(!o(n))return!1;const i=e.getBlock(n.nodeId);if(!i||"image"!==i.type)return!1;const r=e.getNodePath(n.nodeId);if(!r||0===r.length)return!1;const s=c(e,a(n.nodeId,r));return!!s&&(t.dispatch(s),!0)}(t))}(t),this.registerResizeCommands(t),this.registerResizeKeymaps(t),this.registerFileHandler(t),this.registerToolbarItem(t)}destroy(){for(const t of this.blobUrls)URL.revokeObjectURL(t);this.blobUrls.clear(),this.uploadStates.clear(),this.context=null}onStateChange(t,e,n){if(!this.context)return;for(const o of this.uploadStates.keys())e.getBlock(o)||this.uploadStates.delete(o);const i=this.isImageSelected(t),r=this.isImageSelected(e);!i&&r&&this.announceImageSelection(e)}registerNodeSpec(e){const n=this.locale;e.registerNodeSpec({type:"image",group:"block",isVoid:!0,selectable:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""},align:{default:"center"}},toDOM(t){const e=b("figure",t.id);e.className="notectl-image",e.setAttribute("data-void","true"),e.setAttribute("data-selectable","true");const i=document.createElement("div");i.className="notectl-image__container";const r=t.attrs?.alt??"",o=t.attrs?.width,a=t.attrs?.height,s=document.createElement("img");s.className="notectl-image__img",s.src=t.attrs?.src??"",s.alt=r;const l=t.attrs?.title??"";l&&(s.title=l),s.draggable=!1,void 0!==o&&p(s,"width",`${o}px`),void 0!==a&&p(s,"height",`${a}px`);const c={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"}[t.attrs?.align??"center"];return c&&e.classList.add(c),e.setAttribute("aria-label",n.imageAria(r,o,a)),i.appendChild(s),e.appendChild(i),e},toHTML(e){const n=t(e.attrs?.src??""),i=t(e.attrs?.alt??""),r=e.attrs?.width,o=e.attrs?.height,a=(void 0!==r?` width="${r}"`:"")+(void 0!==o?` height="${o}"`:""),s=e.attrs?.title??"";return`<figure><img src="${n}" alt="${i}"${s?` title="${t(s)}"`:""}${a}></figure>`},parseHTML:[{tag:"figure",getAttrs(t){const e=t.querySelector("img");if(!e)return!1;const n={src:e.getAttribute("src")??"",alt:e.getAttribute("alt")??"",align:"center"},i=e.getAttribute("width"),r=e.getAttribute("height");i&&(n.width=Number.parseInt(i,10)),r&&(n.height=Number.parseInt(r,10));const o=e.getAttribute("title");o&&(n.title=o);const a=t.style?.textAlign??"";return"start"===a||"end"===a||"center"===a?n.align=a:"left"===a?n.align="start":"right"===a?n.align="end":t.classList.contains("notectl-align-start")||t.classList.contains("notectl-align-left")||t.classList.contains("notectl-image--start")||t.classList.contains("notectl-image--left")?n.align="start":t.classList.contains("notectl-align-end")||t.classList.contains("notectl-align-right")||t.classList.contains("notectl-image--end")||t.classList.contains("notectl-image--right")?n.align="end":t.classList.contains("notectl-align-center")&&(n.align="center"),n}},{tag:"img",getAttrs(t){const e={src:t.getAttribute("src")??"",alt:t.getAttribute("alt")??"",align:"center"},n=t.getAttribute("width"),i=t.getAttribute("height");n&&(e.width=Number.parseInt(n,10)),i&&(e.height=Number.parseInt(i,10));const r=t.getAttribute("title");return r&&(e.title=r),e}}],sanitize:{tags:["figure","img"],attrs:["src","alt","title","width","height","class","style"]}})}registerInlineImageNodeSpec(e){e.registerInlineNodeSpec({type:"image_inline",group:"inline",attrs:{src:{default:""},alt:{default:""},title:{default:""}},toDOM(t){const e=document.createElement("img");e.className="notectl-image-inline",e.setAttribute("contenteditable","false"),e.src=String(t.attrs.src??""),e.alt=String(t.attrs.alt??"");const n=String(t.attrs.title??"");return n&&(e.title=n),e.draggable=!1,e},toHTMLString(e){const n=t(String(e.attrs.src??"")),i=t(String(e.attrs.alt??"")),r=String(e.attrs.title??"");return`<img src="${n}" alt="${i}"${r?` title="${t(r)}"`:""}>`},parseHTML:[{tag:"img",getAttrs:t=>{const e={src:t.getAttribute("src")??"",alt:t.getAttribute("alt")??""},n=t.getAttribute("title");return n&&(e.title=n),e}}],sanitize:{tags:["img"],attrs:["src","alt","title"]}})}registerNodeView(t){t.registerNodeView("image",N(this.config,this.uploadStates,this.resolvedKeymap,this.locale))}registerResizeCommands(t){const e=this.config.resizeStep??10,n=this.config.resizeStepLarge??50,i=this.config.maxWidth;t.registerCommand("resizeImageGrow",()=>{const n=_(t,e,i);return n&&this.announceCurrentSize(t),n}),t.registerCommand("resizeImageShrink",()=>{const n=_(t,-e,i);return n&&this.announceCurrentSize(t),n}),t.registerCommand("resizeImageGrowLarge",()=>{const e=_(t,n,i);return e&&this.announceCurrentSize(t),e}),t.registerCommand("resizeImageShrinkLarge",()=>{const e=_(t,-n,i);return e&&this.announceCurrentSize(t),e}),t.registerCommand("resetImageSize",()=>{const e=function(t){const e=t.getState(),n=e.selection;if(!o(n))return!1;const i=e.getBlock(n.nodeId);if(!i||"image"!==i.type)return!1;const r=e.getNodePath(n.nodeId);if(!r)return!1;const a={...i.attrs??{}},s=Object.fromEntries(Object.entries(a).filter(([t])=>"width"!==t&&"height"!==t)),l=e.transaction("command").setNodeAttr(r,s).build();return t.dispatch(l),!0}(t);return e&&t.announce(this.locale.resetToNaturalSize),e})}registerResizeKeymaps(t){const e={};for(const[n,i]of Object.entries({growWidth:"resizeImageGrow",shrinkWidth:"resizeImageShrink",growWidthLarge:"resizeImageGrowLarge",shrinkWidthLarge:"resizeImageShrinkLarge",resetSize:"resetImageSize"})){const r=this.resolvedKeymap[n]??null;r&&(e[r]=()=>t.executeCommand(i))}Object.keys(e).length>0&&t.registerKeymap(e)}registerFileHandler(t){t.registerFileHandler("image/*",async(e,n)=>!!this.isAcceptedType(e.type)&&(this.handleFileInsert(t,e),!0))}handleFileInsert(t,e){if(e.size>this.config.maxFileSize)return;const n=URL.createObjectURL(e);if(this.blobUrls.add(n),!x(t,{src:n}))return URL.revokeObjectURL(n),void this.blobUrls.delete(n);const i=t.getState().selection;if(!o(i))return;const r=i.nodeId;this.uploadStates.set(r,"uploading"),t.getService($)?this.uploadFile(t,e,r,n):this.uploadStates.set(r,"complete")}async uploadFile(t,e,n,i){const r=t.getService($);if(r)try{const o=await r.upload(e);this.uploadStates.set(n,"complete");const a=t.getState(),s=a.getBlock(n);if(!s)return;const l=a.getNodePath(n);if(!l)return;const c={...s.attrs??{},src:o.url,...void 0!==o.width?{width:o.width}:{},...void 0!==o.height?{height:o.height}:{}},d=a.transaction("command").setNodeAttr(l,c).build();t.dispatch(d),URL.revokeObjectURL(i),this.blobUrls.delete(i)}catch{this.uploadStates.set(n,"error"),t.announce(this.locale.uploadFailed)}}registerToolbarItem(t){t.registerToolbarItem({id:"image",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',label:this.locale.insertImage,tooltip:this.locale.insertImageTooltip,command:"insertImage",popupType:"custom",renderPopup:(t,e,n)=>{!function(t,e,n){t.classList.add("notectl-image-popup"),function(t,e,n){const i=document.createElement("input");i.type="file",i.accept=n.acceptedTypes.join(","),i.className="notectl-image-popup__file-input";const r=document.createElement("button");r.type="button",r.textContent=n.locale.uploadFromComputer,r.setAttribute("aria-label",n.locale.uploadAria),r.className="notectl-image-popup__upload-btn",r.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),i.click()}),i.addEventListener("change",()=>{const t=i.files?.[0];t&&(n.onFileInsert(e,t),n.onClose(),e.getContainer().focus())}),t.appendChild(i),t.appendChild(r)}(t,e,n),function(t,e){const n=document.createElement("div");n.className="notectl-image-popup__separator";const i=document.createElement("span");i.className="notectl-image-popup__separator-line";const r=document.createElement("span");r.textContent=e.separator,r.className="notectl-image-popup__separator-text";const o=document.createElement("span");o.className="notectl-image-popup__separator-line",n.appendChild(i),n.appendChild(r),n.appendChild(o),t.appendChild(n)}(t,n.locale),function(t,e,n){const i=document.createElement("input");i.type="url",i.placeholder=n.locale.urlPlaceholder,i.setAttribute("aria-label",n.locale.urlAria),i.className="notectl-image-popup__url-input";const r=document.createElement("button");r.type="button",r.textContent=n.locale.insertButton,r.setAttribute("aria-label",n.locale.insertAria),r.className="notectl-image-popup__insert-btn";const o=()=>{const t=i.value.trim();t&&(x(e,{src:t}),n.onClose(),e.getContainer().focus())};r.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),o()}),i.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),o())}),t.appendChild(i),t.appendChild(r),requestAnimationFrame(()=>i.focus())}(t,e,n)}(t,e,{acceptedTypes:this.config.acceptedTypes,locale:this.locale,onFileInsert:(t,e)=>this.handleFileInsert(t,e),onClose:n})}})}isAcceptedType(t){return this.config.acceptedTypes.some(e=>e===t||e.endsWith("/*")&&t.startsWith(e.slice(0,-1)))}isImageSelected(t){const e=t.selection;return!!o(e)&&"image"===t.getBlock(e.nodeId)?.type}announceImageSelection(t){if(!this.context)return;const e=t.selection;if(!o(e))return;const n=t.getBlock(e.nodeId);if(!n||"image"!==n.type)return;const i=n.attrs?.alt??"",r=n.attrs?.width,a=n.attrs?.height,s=[this.locale.imageSelected];i&&s.push(`${this.locale.altTextPrefix}${i}.`),void 0!==r&&void 0!==a&&s.push(this.locale.imageSizeAnnounce(r,a));const l=this.resolvedKeymap.shrinkWidth??null,c=this.resolvedKeymap.growWidth??null;l&&c&&s.push(this.locale.resizeHint(v(l),v(c))),this.context.announce(s.join(" "))}announceCurrentSize(t){const e=t.getState(),n=e.selection;if(!o(n))return;const i=e.getBlock(n.nodeId);if(!i||"image"!==i.type)return;const r=i.attrs?.width,a=i.attrs?.height;void 0!==r&&void 0!==a&&t.announce(this.locale.imageResized(r,a))}};export{y as a,w as i,j as n,$ as r,M as t};
|
|
2
|
-
//# sourceMappingURL=ImagePlugin-CwxTRr6d.mjs.map
|