@notectl/core 2.3.7 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +2 -0
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -0
- package/dist/chunks/{AttrRegistry-CtNhf2EF.mjs → AttrRegistry-Di936wMv.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-CtNhf2EF.mjs.map → AttrRegistry-Di936wMv.mjs.map} +1 -1
- package/dist/chunks/{AttributedMarkCommands-B3MQdob_.mjs → AttributedMarkCommands-DKHuhZA7.mjs} +2 -2
- package/dist/chunks/{AttributedMarkCommands-B3MQdob_.mjs.map → AttributedMarkCommands-DKHuhZA7.mjs.map} +1 -1
- package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +2 -0
- package/dist/chunks/{BidiIsolationPlugin-cOLlL3Y9.mjs.map → BidiIsolationPlugin-GWukKdgJ.mjs.map} +1 -1
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs +2 -0
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -0
- package/dist/chunks/{BlockInsertion-O5pAFKid.mjs → BlockInsertion-CxKdCKJd.mjs} +2 -2
- package/dist/chunks/{BlockInsertion-O5pAFKid.mjs.map → BlockInsertion-CxKdCKJd.mjs.map} +1 -1
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +2 -0
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs +2 -0
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -0
- package/dist/chunks/{CaretNavigationPlugin-DEZU09LJ.mjs → CaretNavigationPlugin-BxWjR7SN.mjs} +2 -2
- package/dist/chunks/{CaretNavigationPlugin-DEZU09LJ.mjs.map → CaretNavigationPlugin-BxWjR7SN.mjs.map} +1 -1
- package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +2 -0
- package/dist/chunks/{CodeBlockPlugin-BandNM3t.mjs.map → CodeBlockPlugin-BIrkK4ER.mjs.map} +1 -1
- package/dist/chunks/ColorPickerPopup-B6340f3p.mjs +2 -0
- package/dist/chunks/{ColorPickerPopup-CFYCCN7m.mjs.map → ColorPickerPopup-B6340f3p.mjs.map} +1 -1
- package/dist/chunks/{ColorValidation-B9d_umnf.mjs → ColorValidation-ZBKZ_gTr.mjs} +2 -2
- package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -0
- package/dist/chunks/Commands-DBBCAYBn.mjs +2 -0
- package/dist/chunks/Commands-DBBCAYBn.mjs.map +1 -0
- package/dist/chunks/{ContentModel-Bzmzeqwg.mjs → ContentModel-BLC3Tez8.mjs} +2 -2
- package/dist/chunks/{ContentModel-Bzmzeqwg.mjs.map → ContentModel-BLC3Tez8.mjs.map} +1 -1
- package/dist/chunks/{CursorMarks-dx51OGBf.mjs → CursorMarks-CqHLzGNI.mjs} +2 -2
- package/dist/chunks/{CursorMarks-dx51OGBf.mjs.map → CursorMarks-CqHLzGNI.mjs.map} +1 -1
- package/dist/chunks/{Decoration-BwhoA4MU.mjs → Decoration-BoFcdSXk.mjs} +2 -2
- package/dist/chunks/{Decoration-BwhoA4MU.mjs.map → Decoration-BoFcdSXk.mjs.map} +1 -1
- package/dist/chunks/{DirectionDetection-ZrkMhyaL.mjs → DirectionDetection-a-1iksmh.mjs} +2 -2
- package/dist/chunks/{DirectionDetection-ZrkMhyaL.mjs.map → DirectionDetection-a-1iksmh.mjs.map} +1 -1
- package/dist/chunks/{Document-D_2cIBJG.mjs → Document-ssR6hBzG.mjs} +2 -2
- package/dist/chunks/{Document-D_2cIBJG.mjs.map → Document-ssR6hBzG.mjs.map} +1 -1
- package/dist/chunks/DocumentParser-BKUrtgw1.mjs +2 -0
- package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +1 -0
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs +2 -0
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -0
- package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs +2 -0
- package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +2 -0
- package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +2 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -0
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs +2 -0
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -0
- package/dist/chunks/{HardBreakPlugin-CC4rntSX.mjs → HardBreakPlugin-svNnJ9Xj.mjs} +2 -2
- package/dist/chunks/{HardBreakPlugin-CC4rntSX.mjs.map → HardBreakPlugin-svNnJ9Xj.mjs.map} +1 -1
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +2 -0
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +2 -0
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -0
- package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs +2 -0
- package/dist/chunks/{HorizontalRulePlugin-CxmUMM34.mjs.map → HorizontalRulePlugin-CQ5NT2Mo.mjs.map} +1 -1
- package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +2 -0
- package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +1 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +2 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs +2 -0
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -0
- package/dist/chunks/{LinkPlugin-Bsmt97Kw.mjs → LinkPlugin-BuzrXo2c.mjs} +2 -2
- package/dist/chunks/{LinkPlugin-Bsmt97Kw.mjs.map → LinkPlugin-BuzrXo2c.mjs.map} +1 -1
- package/dist/chunks/{ListPlugin--dqEctgn.mjs → ListPlugin-DTgpvBEt.mjs} +2 -2
- package/dist/chunks/{ListPlugin--dqEctgn.mjs.map → ListPlugin-DTgpvBEt.mjs.map} +1 -1
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs +2 -0
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -0
- package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs +2 -0
- package/dist/chunks/{MarkdownHTMLRegistry-CISsC0lH.mjs.map → MarkdownHTMLRegistry-BunUDiza.mjs.map} +1 -1
- package/dist/chunks/{MarkdownParser-D1d9zB0R.mjs → MarkdownParser-CvYOvU3d.mjs} +2 -2
- package/dist/chunks/{MarkdownParser-D1d9zB0R.mjs.map → MarkdownParser-CvYOvU3d.mjs.map} +1 -1
- package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs +2 -0
- package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +1 -0
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs +2 -0
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs +2 -0
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -0
- package/dist/chunks/{NodeSelectionCommands-DK3iEh18.mjs → NodeSelectionCommands-B0Sb4ux4.mjs} +2 -2
- package/dist/chunks/{NodeSelectionCommands-DK3iEh18.mjs.map → NodeSelectionCommands-B0Sb4ux4.mjs.map} +1 -1
- package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +2 -0
- package/dist/chunks/{PluginHelpers-WG1Lzzh3.mjs.map → PluginHelpers-B3gk3VB3.mjs.map} +1 -1
- package/dist/chunks/{PrintPlugin-BQ7LWbEB.mjs → PrintPlugin-BxNlFk2c.mjs} +2 -2
- package/dist/chunks/{PrintPlugin-BQ7LWbEB.mjs.map → PrintPlugin-BxNlFk2c.mjs.map} +1 -1
- package/dist/chunks/{RangeIterator-DDOxTQIf.mjs → RangeIterator-sJ_c9MNr.mjs} +2 -2
- package/dist/chunks/{RangeIterator-DDOxTQIf.mjs.map → RangeIterator-sJ_c9MNr.mjs.map} +1 -1
- package/dist/chunks/Schema-BSM4YLNT.mjs +2 -0
- package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs +2 -0
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs +2 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -0
- package/dist/chunks/{SelectionTransactions-DNCzsl_b.mjs → SelectionTransactions-mQ1NfMEg.mjs} +2 -2
- package/dist/chunks/{SelectionTransactions-DNCzsl_b.mjs.map → SelectionTransactions-mQ1NfMEg.mjs.map} +1 -1
- package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +2 -0
- package/dist/chunks/{SimpleMark-CTDtEIMV.mjs.map → SimpleMark-D6vz3Nfd.mjs.map} +1 -1
- package/dist/chunks/{SmartPastePlugin-CjExbE9Q.mjs → SmartPastePlugin-C3SVKkWK.mjs} +2 -2
- package/dist/chunks/{SmartPastePlugin-CjExbE9Q.mjs.map → SmartPastePlugin-C3SVKkWK.mjs.map} +1 -1
- package/dist/chunks/{StrikethroughPlugin-d-EW2YYx.mjs → StrikethroughPlugin-v-VJZzUZ.mjs} +2 -2
- package/dist/chunks/{StrikethroughPlugin-d-EW2YYx.mjs.map → StrikethroughPlugin-v-VJZzUZ.mjs.map} +1 -1
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs +2 -0
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -0
- package/dist/chunks/{SuperSubPlugin-C-kvFQyx.mjs → SuperSubPlugin-x1iPnZyt.mjs} +2 -2
- package/dist/chunks/{SuperSubPlugin-C-kvFQyx.mjs.map → SuperSubPlugin-x1iPnZyt.mjs.map} +1 -1
- package/dist/chunks/TableDimensions-BSEOEox2.mjs +2 -0
- package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -0
- package/dist/chunks/TablePlugin-WPwp902E.mjs +2 -0
- package/dist/chunks/TablePlugin-WPwp902E.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +2 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -0
- package/dist/chunks/{TextDirectionAutoPlugin-LVDkKdDX.mjs → TextDirectionAutoPlugin-DOH5cfyy.mjs} +2 -2
- package/dist/chunks/{TextDirectionAutoPlugin-LVDkKdDX.mjs.map → TextDirectionAutoPlugin-DOH5cfyy.mjs.map} +1 -1
- package/dist/chunks/{TextDirectionPlugin-CtGwof7i.mjs → TextDirectionPlugin-JwlR-R-b.mjs} +2 -2
- package/dist/chunks/{TextDirectionPlugin-CtGwof7i.mjs.map → TextDirectionPlugin-JwlR-R-b.mjs.map} +1 -1
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs +2 -0
- package/dist/chunks/{TextDirectionService-OFOU6r_s.mjs.map → TextDirectionService-BcX07mw2.mjs.map} +1 -1
- package/dist/chunks/{TextFormattingPlugin-DlS0SeW7.mjs → TextFormattingPlugin-Kc_UNoOz.mjs} +2 -2
- package/dist/chunks/{TextFormattingPlugin-DlS0SeW7.mjs.map → TextFormattingPlugin-Kc_UNoOz.mjs.map} +1 -1
- package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs +2 -0
- package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +1 -0
- package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs +2 -0
- package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +1 -0
- package/dist/chunks/color-picker-D6HrTsDM.mjs +2 -0
- package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -0
- package/dist/chunks/full-BiQ93ERr.mjs +2 -0
- package/dist/chunks/{full-9sO5JbWG.mjs.map → full-BiQ93ERr.mjs.map} +1 -1
- package/dist/chunks/minimal-DO7LiFTa.mjs +2 -0
- package/dist/chunks/{minimal-C07d5reO.mjs.map → minimal-DO7LiFTa.mjs.map} +1 -1
- package/dist/chunks/register-Cb1YTAN4.mjs +3 -0
- package/dist/chunks/register-Cb1YTAN4.mjs.map +1 -0
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/CompositionCommands.d.ts +47 -0
- package/dist/commands/CompositionCommands.d.ts.map +1 -0
- package/dist/commands/CompositionRebase.d.ts +24 -0
- package/dist/commands/CompositionRebase.d.ts.map +1 -0
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +15 -5
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/fonts/math.mjs +1 -1
- package/dist/fonts.mjs +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/input/CompositionController.d.ts +78 -0
- package/dist/input/CompositionController.d.ts.map +1 -0
- package/dist/input/HTMLParser.d.ts +15 -2
- package/dist/input/HTMLParser.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +34 -1
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputManager.d.ts +3 -0
- package/dist/input/InputManager.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/BlockAlignment.d.ts +6 -0
- package/dist/model/BlockAlignment.d.ts.map +1 -1
- package/dist/model/BlockOffsetText.d.ts +11 -0
- package/dist/model/BlockOffsetText.d.ts.map +1 -0
- package/dist/model/CompositionState.d.ts +14 -0
- package/dist/model/CompositionState.d.ts.map +1 -1
- package/dist/model/HTMLUtils.d.ts +16 -3
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +5 -3
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/model/NodeResolver.d.ts +2 -0
- package/dist/model/NodeResolver.d.ts.map +1 -1
- package/dist/model/NodeSpec.d.ts +2 -1
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/model/Schema.d.ts +2 -0
- package/dist/model/Schema.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +26 -1
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/StyleClass.d.ts +45 -0
- package/dist/model/StyleClass.d.ts.map +1 -0
- package/dist/model/StyleClassRegistry.d.ts +28 -0
- package/dist/model/StyleClassRegistry.d.ts.map +1 -0
- package/dist/model/TextChange.d.ts +40 -0
- package/dist/model/TextChange.d.ts.map +1 -0
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +11 -0
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginContextFactory.d.ts +2 -0
- package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
- package/dist/plugins/RegistrationTracker.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +17 -0
- package/dist/plugins/alignment/AlignmentPlugin.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.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +13 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts +2 -0
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts +11 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/formula/FormulaPlugin.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexParser.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LatexSymbols.d.ts.map +1 -1
- package/dist/plugins/formula/latex/LookupOwn.d.ts +6 -0
- package/dist/plugins/formula/latex/LookupOwn.d.ts.map +1 -0
- package/dist/plugins/formula/latex/handlers/Accents.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Delimiters.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Environments.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Fonts.d.ts.map +1 -1
- package/dist/plugins/formula/latex/handlers/Spacing.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +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/HighlightPlugin.d.ts +11 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +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/InlineCodePlugin.d.ts.map +1 -1
- package/dist/plugins/inline-code.mjs +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print.mjs +1 -1
- package/dist/plugins/shared/ColorValidation.d.ts +12 -4
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts +10 -0
- package/dist/plugins/shared/InlineStyleMarkSpec.d.ts.map +1 -1
- package/dist/plugins/shared/StyleClassNames.d.ts +10 -0
- package/dist/plugins/shared/StyleClassNames.d.ts.map +1 -0
- 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/TextColorPlugin.d.ts +11 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +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.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/AlignmentHTML.d.ts +43 -0
- package/dist/serialization/AlignmentHTML.d.ts.map +1 -0
- package/dist/serialization/CSSClassCollector.d.ts +20 -17
- package/dist/serialization/CSSClassCollector.d.ts.map +1 -1
- package/dist/serialization/CSSValueEquivalence.d.ts +24 -0
- package/dist/serialization/CSSValueEquivalence.d.ts.map +1 -0
- package/dist/serialization/DocumentParser.d.ts +2 -1
- package/dist/serialization/DocumentParser.d.ts.map +1 -1
- package/dist/serialization/DocumentSerializer.d.ts +0 -4
- package/dist/serialization/DocumentSerializer.d.ts.map +1 -1
- package/dist/serialization/FirstTagAttributes.d.ts +16 -0
- package/dist/serialization/FirstTagAttributes.d.ts.map +1 -0
- package/dist/serialization/HTMLParseRules.d.ts +32 -0
- package/dist/serialization/HTMLParseRules.d.ts.map +1 -0
- package/dist/serialization/HTMLParseSession.d.ts +21 -0
- package/dist/serialization/HTMLParseSession.d.ts.map +1 -0
- package/dist/serialization/MarkSerializer.d.ts.map +1 -1
- package/dist/serialization/StyleClassHTML.d.ts +37 -0
- package/dist/serialization/StyleClassHTML.d.ts.map +1 -0
- package/dist/serialization/StyleRehydration.d.ts +16 -0
- package/dist/serialization/StyleRehydration.d.ts.map +1 -0
- package/dist/serialization/TableDimensions.d.ts.map +1 -1
- package/dist/serialization/index.d.ts +2 -1
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/markdown/InlineSerializers.d.ts.map +1 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts +2 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/NavigationQueries.d.ts.map +1 -1
- package/dist/state/SelectionValidation.d.ts +12 -0
- package/dist/state/SelectionValidation.d.ts.map +1 -0
- package/dist/state/StepMapping.d.ts.map +1 -1
- package/dist/state/TransactionBuilder.d.ts +7 -1
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/CursorWrapper.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +25 -1
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/InlineContentDOM.d.ts +44 -0
- package/dist/view/InlineContentDOM.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts +20 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/dist/view/RenderedBlockText.d.ts +27 -0
- package/dist/view/RenderedBlockText.d.ts.map +1 -0
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs +0 -2
- package/dist/chunks/AlignmentPlugin-DIwrRsHd.mjs.map +0 -1
- package/dist/chunks/BidiIsolationPlugin-cOLlL3Y9.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs +0 -2
- package/dist/chunks/BlockquotePlugin-D-jRWLQB.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-BandNM3t.mjs +0 -2
- package/dist/chunks/ColorPickerPopup-CFYCCN7m.mjs +0 -2
- package/dist/chunks/ColorValidation-B9d_umnf.mjs.map +0 -1
- package/dist/chunks/Commands-D-0UXYvo.mjs +0 -2
- package/dist/chunks/Commands-D-0UXYvo.mjs.map +0 -1
- package/dist/chunks/DocumentParser-i-CreJ48.mjs +0 -2
- package/dist/chunks/DocumentParser-i-CreJ48.mjs.map +0 -1
- package/dist/chunks/FontPlugin-BySgRcF3.mjs +0 -2
- package/dist/chunks/FontPlugin-BySgRcF3.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-zJDiyhUv.mjs +0 -2
- package/dist/chunks/FontSizePlugin-zJDiyhUv.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs +0 -2
- package/dist/chunks/FormulaPlugin-CI0r4X1o.mjs.map +0 -1
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs +0 -2
- package/dist/chunks/GapCursorPlugin-NozsEK9J.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs +0 -2
- package/dist/chunks/HTMLUtils-B0nGyFLb.mjs.map +0 -1
- package/dist/chunks/HeadingPlugin-BCh12hFT.mjs +0 -2
- package/dist/chunks/HeadingPlugin-BCh12hFT.mjs.map +0 -1
- package/dist/chunks/HighlightPlugin-By7CWUss.mjs +0 -2
- package/dist/chunks/HighlightPlugin-By7CWUss.mjs.map +0 -1
- package/dist/chunks/HorizontalRulePlugin-CxmUMM34.mjs +0 -2
- package/dist/chunks/ImagePlugin-C_MuvfYo.mjs +0 -2
- package/dist/chunks/ImagePlugin-C_MuvfYo.mjs.map +0 -1
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs +0 -2
- package/dist/chunks/InlineCodePlugin-C1SqGfv5.mjs.map +0 -1
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs +0 -2
- package/dist/chunks/InlineStyleMarkSpec-Cx3goc3W.mjs.map +0 -1
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs +0 -2
- package/dist/chunks/MarkCommands-CJvLGL5G.mjs.map +0 -1
- package/dist/chunks/MarkdownHTMLRegistry-CISsC0lH.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs +0 -2
- package/dist/chunks/MarkdownSerializer-Oex2RzNw.mjs.map +0 -1
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs +0 -2
- package/dist/chunks/NavigationQueries-Bt4zZ17v.mjs.map +0 -1
- package/dist/chunks/NodeResolver-BtIknXqD.mjs +0 -2
- package/dist/chunks/NodeResolver-BtIknXqD.mjs.map +0 -1
- package/dist/chunks/PluginHelpers-WG1Lzzh3.mjs +0 -2
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs +0 -2
- package/dist/chunks/SchemaRegistry-acc6q_5x.mjs.map +0 -1
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs +0 -2
- package/dist/chunks/SelectionSync-CwOHMMfI.mjs.map +0 -1
- package/dist/chunks/SimpleMark-CTDtEIMV.mjs +0 -2
- package/dist/chunks/TableDimensions-BcARMxQB.mjs +0 -2
- package/dist/chunks/TableDimensions-BcARMxQB.mjs.map +0 -1
- package/dist/chunks/TablePlugin-CdXY0Px5.mjs +0 -2
- package/dist/chunks/TablePlugin-CdXY0Px5.mjs.map +0 -1
- package/dist/chunks/TextColorPlugin-BLTKft_Z.mjs +0 -2
- package/dist/chunks/TextColorPlugin-BLTKft_Z.mjs.map +0 -1
- package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-CMHJCdYY.mjs +0 -2
- package/dist/chunks/ToolbarPlugin-CMHJCdYY.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs +0 -2
- package/dist/chunks/VideoPlugin-C9z4JfP_.mjs.map +0 -1
- package/dist/chunks/color-picker-DJ05ey9o.mjs +0 -2
- package/dist/chunks/color-picker-DJ05ey9o.mjs.map +0 -1
- package/dist/chunks/full-9sO5JbWG.mjs +0 -2
- package/dist/chunks/minimal-C07d5reO.mjs +0 -2
- package/dist/chunks/register-DMdtiQ_Z.mjs +0 -3
- package/dist/chunks/register-DMdtiQ_Z.mjs.map +0 -1
- package/dist/editor/styles/base.d.ts +0 -3
- package/dist/editor/styles/base.d.ts.map +0 -1
- package/dist/editor/styles/color-picker.d.ts +0 -3
- package/dist/editor/styles/color-picker.d.ts.map +0 -1
- package/dist/editor/styles/font-select.d.ts +0 -3
- package/dist/editor/styles/font-select.d.ts.map +0 -1
- package/dist/editor/styles/font-size-select.d.ts +0 -3
- package/dist/editor/styles/font-size-select.d.ts.map +0 -1
- package/dist/editor/styles/heading-select.d.ts +0 -3
- package/dist/editor/styles/heading-select.d.ts.map +0 -1
- package/dist/editor/styles/image.d.ts +0 -3
- package/dist/editor/styles/image.d.ts.map +0 -1
- package/dist/editor/styles/reduced-motion.d.ts +0 -3
- package/dist/editor/styles/reduced-motion.d.ts.map +0 -1
- package/dist/editor/styles/table.d.ts +0 -3
- package/dist/editor/styles/table.d.ts.map +0 -1
- package/dist/editor/styles/toolbar.d.ts +0 -3
- package/dist/editor/styles/toolbar.d.ts.map +0 -1
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts +0 -3
- package/dist/plugins/blockquote/BlockquoteStyles.d.ts.map +0 -1
- package/dist/plugins/formula/FormulaStyles.d.ts +0 -12
- package/dist/plugins/formula/FormulaStyles.d.ts.map +0 -1
- package/dist/plugins/image/ImagePopupStyles.d.ts +0 -3
- package/dist/plugins/image/ImagePopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoPopupStyles.d.ts +0 -3
- package/dist/plugins/video/VideoPopupStyles.d.ts.map +0 -1
- package/dist/plugins/video/VideoStyles.d.ts +0 -3
- package/dist/plugins/video/VideoStyles.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestUtils.d.ts","sourceRoot":"","sources":["../../src/test/TestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAU,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACN,KAAK,SAAS,EACd,KAAK,IAAI,EAGT,KAAK,gBAAgB,EACrB,cAAc,EACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EA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AAC,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAsCnF;AAMD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAI9F;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,WAAW,GAAG,IAAI,GAC7C,WAAW,CAMb;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAQxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorWrapper.d.ts","sourceRoot":"","sources":["../../src/view/CursorWrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"CursorWrapper.d.ts","sourceRoot":"","sources":["../../src/view/CursorWrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAK3D,qBAAa,aAAa;IACzB,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;gBAE1C,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,cAAc;IAK7D,wDAAwD;IACxD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;;OAIG;IACH,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAkD5C,gDAAgD;IAChD,OAAO,IAAI,IAAI;CAKf"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DecorationSet } from '../decorations/Decoration.js';
|
|
2
|
-
import { CompositionState } from '../model/CompositionState.js';
|
|
2
|
+
import { CompositionSnapshot, CompositionState } from '../model/CompositionState.js';
|
|
3
3
|
import { FileHandlerRegistry } from '../model/FileHandlerRegistry.js';
|
|
4
4
|
import { KeymapRegistry } from '../model/KeymapRegistry.js';
|
|
5
5
|
import { PluginCallbackExecutor } from '../model/PluginCallbackExecutor.js';
|
|
6
6
|
import { SchemaRegistry } from '../model/SchemaRegistry.js';
|
|
7
7
|
import { Selection as ModelSelection } from '../model/Selection.js';
|
|
8
|
+
import { BlockId } from '../model/TypeBrands.js';
|
|
8
9
|
import { EditorState } from '../state/EditorState.js';
|
|
9
10
|
import { HistoryManager } from '../state/History.js';
|
|
10
11
|
import { Transaction } from '../state/Transaction.js';
|
|
@@ -41,6 +42,13 @@ export declare class EditorView {
|
|
|
41
42
|
private readonly callbackExecutor;
|
|
42
43
|
private readonly nodeViews;
|
|
43
44
|
private decorations;
|
|
45
|
+
/** Inline node elements of the block captured when the last composition started. */
|
|
46
|
+
private compositionOrigins;
|
|
47
|
+
/**
|
|
48
|
+
* The top-level container holding the composing leaf, as rendered when the
|
|
49
|
+
* composition started. Reconciliation skips it while composing.
|
|
50
|
+
*/
|
|
51
|
+
private compositionContainer;
|
|
44
52
|
private readonly getDecorations?;
|
|
45
53
|
private readonly isReadOnly;
|
|
46
54
|
private readonly isReadonlyBypassed;
|
|
@@ -84,6 +92,22 @@ export declare class EditorView {
|
|
|
84
92
|
* selection, or `null` when the range lies outside this view's content.
|
|
85
93
|
*/
|
|
86
94
|
resolveDOMRange(range: AbstractRange): ModelSelection | null;
|
|
95
|
+
/**
|
|
96
|
+
* Records which inline node elements block `blockId` renders when a
|
|
97
|
+
* composition starts, so the commit can tell them apart (#261), and the
|
|
98
|
+
* container reconciliation skips while the block is composing (#264).
|
|
99
|
+
*/
|
|
100
|
+
captureCompositionBlock(blockId: BlockId): void;
|
|
101
|
+
/** Reads browser-owned composition text and caret without updating the model. */
|
|
102
|
+
readCompositionSnapshot(blockId: BlockId): CompositionSnapshot | null;
|
|
103
|
+
/**
|
|
104
|
+
* Replaces block `blockId`'s inline DOM with a fresh rendering of the
|
|
105
|
+
* current state and writes the state selection back to the DOM. Used after
|
|
106
|
+
* an IME composition whose DOM edits the state did not adopt, so the view
|
|
107
|
+
* shows what the model holds. A container that changed while its
|
|
108
|
+
* reconciliation was skipped for the composition is rendered anew.
|
|
109
|
+
*/
|
|
110
|
+
restoreBlock(blockId: BlockId): void;
|
|
87
111
|
/**
|
|
88
112
|
* Reconciles DOM and syncs selection, updating decoration state.
|
|
89
113
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorView.d.ts","sourceRoot":"","sources":["../../src/view/EditorView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorView.d.ts","sourceRoot":"","sources":["../../src/view/EditorView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM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a,GAAG,cAAc,GAAG,IAAI;IAI5D;;;;OAIG;IACH,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAO/C,iFAAiF;IACjF,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI;IAIrE;;;;;;OAMG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAepC;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAsBxB,OAAO,CAAC,gBAAgB;IAoBxB,kDAAkD;IAClD,OAAO,IAAI,IAAI;CAMf"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classification of the DOM that renders a block's inline content.
|
|
3
|
+
*
|
|
4
|
+
* Shared by selection mapping and rendered-text reading so both agree on
|
|
5
|
+
* which DOM nodes are document content: text nodes count their length, inline
|
|
6
|
+
* node elements count one position, and view chrome counts nothing.
|
|
7
|
+
*/
|
|
8
|
+
/** Attribute marking the temporary IME cursor wrapper (see `CursorWrapper`). */
|
|
9
|
+
export declare const CURSOR_WRAPPER_ATTR = "data-cursor-wrapper";
|
|
10
|
+
/** Zero-width space the cursor wrapper holds so the browser can compose into it. */
|
|
11
|
+
export declare const ZERO_WIDTH_SPACE = "\u200B";
|
|
12
|
+
/**
|
|
13
|
+
* True when `node` is an InlineNode element — rendered `contenteditable="false"`
|
|
14
|
+
* and counted as width 1 in state offset space.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isInlineNodeEl(node: Node | null | undefined): node is HTMLElement;
|
|
17
|
+
/**
|
|
18
|
+
* True when `node` is a view-chrome widget (`data-widget`), such as the checklist
|
|
19
|
+
* checkbox marker. Widgets are rendered into the editable DOM for accessibility
|
|
20
|
+
* but are not document content, so they count as zero width in offset space.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isWidgetEl(node: Node | null | undefined): node is HTMLElement;
|
|
23
|
+
/** True when `node` is the temporary IME cursor wrapper element. */
|
|
24
|
+
export declare function isCursorWrapperEl(node: Node | null | undefined): node is HTMLElement;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the content root for inline content walking.
|
|
27
|
+
* If the block element has a contentDOM (marked with data-content-dom),
|
|
28
|
+
* returns it so the walker skips NodeView structural elements (headers, etc.).
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveContentRoot(blockEl: Element): Element;
|
|
31
|
+
export interface InlineContentWalkerOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Descend into the IME cursor wrapper instead of skipping it. Selection
|
|
34
|
+
* mapping skips it because its zero-width space is not content; reading
|
|
35
|
+
* composed text needs it because the browser composes inside it.
|
|
36
|
+
*/
|
|
37
|
+
readonly includeCursorWrapper?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates a TreeWalker that visits text nodes and contentEditable="false"
|
|
41
|
+
* inline elements within a block, skipping mark wrappers and nested blocks.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createInlineContentWalker(blockEl: Element, options?: InlineContentWalkerOptions): TreeWalker;
|
|
44
|
+
//# sourceMappingURL=InlineContentDOM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineContentDOM.d.ts","sourceRoot":"","sources":["../../src/view/InlineContentDOM.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,oFAAoF;AACpF,eAAO,MAAM,gBAAgB,WAAM,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,WAAW,CAEjF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,WAAW,CAE7E;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,WAAW,CAEpF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAG5D;AAED,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,0BAA+B,GACtC,UAAU,CA4BZ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DecorationSet } from '../decorations/Decoration.js';
|
|
2
|
+
import { BlockNode } from '../model/Document.js';
|
|
2
3
|
import { PluginCallbackExecutor } from '../model/PluginCallbackExecutor.js';
|
|
3
4
|
import { SchemaRegistry } from '../model/SchemaRegistry.js';
|
|
4
5
|
import { BlockId } from '../model/TypeBrands.js';
|
|
@@ -19,11 +20,29 @@ export interface ReconcileOptions {
|
|
|
19
20
|
oldDecorations?: DecorationSet;
|
|
20
21
|
selectedNodeId?: BlockId;
|
|
21
22
|
previousSelectedNodeId?: BlockId;
|
|
22
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* When set, the top-level block that holds this leaf is skipped during
|
|
25
|
+
* reconciliation to preserve the IME composition inside it.
|
|
26
|
+
*/
|
|
23
27
|
compositionBlockId?: BlockId;
|
|
24
28
|
/** Reconciliation-scoped keyed widget DOM available while block elements are replaced. @internal */
|
|
25
29
|
widgetDOMPool?: WidgetDOMPool;
|
|
26
30
|
}
|
|
27
31
|
/** Reconciles the DOM container to match the new state. */
|
|
28
32
|
export declare function reconcile(container: HTMLElement, oldState: EditorState | null, newState: EditorState, options?: ReconcileOptions): void;
|
|
33
|
+
/**
|
|
34
|
+
* Re-renders top-level block `previous.id` from `state`. Used after an IME
|
|
35
|
+
* composition for a container whose reconciliation was skipped while it held
|
|
36
|
+
* the composing leaf, so edits it received meanwhile reach the DOM.
|
|
37
|
+
*
|
|
38
|
+
* @param previous - The block as it was last rendered, whose NodeViews are released.
|
|
39
|
+
*/
|
|
40
|
+
export declare function rerenderBlock(container: HTMLElement, previous: BlockNode, state: EditorState, options: ReconcileOptions): void;
|
|
41
|
+
/**
|
|
42
|
+
* Re-renders the inline content of leaf block `blockId` from `state`,
|
|
43
|
+
* discarding whatever the browser left in that DOM, such as edits made while
|
|
44
|
+
* the block was skipped during an IME composition. Does nothing when the block
|
|
45
|
+
* is missing, not a leaf, or owns no inline content DOM.
|
|
46
|
+
*/
|
|
47
|
+
export declare function rerenderLeafContent(container: HTMLElement, state: EditorState, blockId: BlockId, options: ReconcileOptions): void;
|
|
29
48
|
//# sourceMappingURL=Reconciler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reconciler.d.ts","sourceRoot":"","sources":["../../src/view/Reconciler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"Reconciler.d.ts","sourceRoot":"","sources":["../../src/view/Reconciler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAQjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAgB3D,OAAO,EACN,KAAK,aAAa,EAIlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,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
import { CompositionSnapshot } from '../model/CompositionState.js';
|
|
2
|
+
import { BlockId } from '../model/TypeBrands.js';
|
|
3
|
+
/** Model offset each inline node element rendered at when its block was captured. */
|
|
4
|
+
export type InlineNodeOrigins = WeakMap<Element, number>;
|
|
5
|
+
/**
|
|
6
|
+
* Records the model offset of every inline node element block `blockId`
|
|
7
|
+
* renders. Capture it when a composition starts, while the DOM still mirrors
|
|
8
|
+
* the model, so {@link readCompositionSnapshot} can later tell which inline
|
|
9
|
+
* nodes survived: to the text diff they are otherwise identical placeholders.
|
|
10
|
+
*/
|
|
11
|
+
export declare function captureInlineNodeOrigins(container: HTMLElement, blockId: BlockId): InlineNodeOrigins;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the rendered inline content of block `blockId`: text nodes verbatim,
|
|
14
|
+
* one {@link INLINE_NODE_PLACEHOLDER} per inline node element, nothing for view
|
|
15
|
+
* chrome (widgets, placeholder `<br>`s, nested blocks). Text inside the IME
|
|
16
|
+
* cursor wrapper is included without the wrapper's zero-width space, because
|
|
17
|
+
* the browser composes into the wrapper.
|
|
18
|
+
*
|
|
19
|
+
* Indices into the result are model offsets as long as the DOM still mirrors
|
|
20
|
+
* the model. After a composition they are offsets of the edited text.
|
|
21
|
+
*
|
|
22
|
+
* @param origins - Inline node offsets captured when the composition started;
|
|
23
|
+
* when given, the snapshot reports where each surviving inline node came from.
|
|
24
|
+
* @returns The rendered text and collapsed caret, or `null` when no element renders the block.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readCompositionSnapshot(container: HTMLElement, blockId: BlockId, origins?: InlineNodeOrigins): CompositionSnapshot | null;
|
|
27
|
+
//# sourceMappingURL=RenderedBlockText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderedBlockText.d.ts","sourceRoot":"","sources":["../../src/view/RenderedBlockText.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAStD,qFAAqF;AACrF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAWzD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,OAAO,GACd,iBAAiB,CAUnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACtC,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,iBAAiB,GACzB,mBAAmB,GAAG,IAAI,CAI5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionSync.d.ts","sourceRoot":"","sources":["../../src/view/SelectionSync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectionSync.d.ts","sourceRoot":"","sources":["../../src/view/SelectionSync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAuClF,0EAA0E;AAC1E,wBAAgB,YAAY,IAAI,UAAU,CAAC,SAAS,GAAG,IAAI,CAE1D;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,IAAI,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,EAAE,WAAW,EACtB,GAAG,EAAE,UAAU,CAAC,SAAS,GACvB,kBAAkB,GAAG,IAAI,CAsC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACxC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,UAAU,CAAC,SAAS,GAC1B,kBAAkB,GAAG,IAAI,CAe3B;AAED,mDAAmD;AACnD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,GAAG,IAAI,CAmC3F;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAiB7E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAU9F;AAsED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,WAAW,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,GACf,QAAQ,GAAG,IAAI,CA+DjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notectl/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A modern and accessible rich text editor shipped as a single Web Component. Immutable state, transaction-based architecture, and a plugin system that powers every feature.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -221,6 +221,7 @@
|
|
|
221
221
|
"devDependencies": {
|
|
222
222
|
"esbuild": "^0.28.1",
|
|
223
223
|
"happy-dom": "^20.11.1",
|
|
224
|
+
"lightningcss": "^1.33.0",
|
|
224
225
|
"rollup-plugin-visualizer": "^7.0.1",
|
|
225
226
|
"terser": "^5.49.2",
|
|
226
227
|
"vite": "^8.2.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as t,c as e,n as s,o as i,r as n,t as a}from"./PluginHelpers-WG1Lzzh3.mjs";import{c as l}from"./StyleRuntime-C0RSqKzG.mjs";import{t as o}from"./NodeSpecPatching-BrjPAbqe.mjs";var r={alignStart:"Align Start",alignCenter:"Align Center",alignEnd:"Align End",justify:"Justify",toolbarLabel:"Alignment",toolbarTooltip:"Alignment"},g=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Bdmunk5h.mjs"),"./locales/de.ts":()=>import("./de-B8-w9gPi.mjs"),"./locales/es.ts":()=>import("./es-B8K3Yvf3.mjs"),"./locales/fr.ts":()=>import("./fr-BeRlON1t.mjs"),"./locales/hi.ts":()=>import("./hi-Bl-yeeOI.mjs"),"./locales/pt.ts":()=>import("./pt-5VeuNDd2.mjs"),"./locales/ru.ts":()=>import("./ru-Yngw7nFP.mjs"),"./locales/zh.ts":()=>import("./zh-BvuAbM2S.mjs")});async function m(t){return e(g,t,r)}var c={alignments:["start","center","end","justify"],alignableTypes:["paragraph","heading","title","subtitle","table_cell","image"],defaults:{image:"center"}},h={start:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"/></svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"/></svg>',end:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"/></svg>',justify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z"/></svg>'},p=class{id="alignment";name="Alignment";priority=90;config;locale;alignableTypes;constructor(t){this.config={...c,...t,defaults:{...c.defaults,...t?.defaults}}}async init(t){this.locale=await i(t,this.config.locale,r,m),this.alignableTypes=new Set(this.config.alignableTypes),this.patchNodeSpecs(t),this.registerCommands(t),this.registerKeymaps(t),this.registerToolbarItem(t),this.registerMiddleware(t)}patchNodeSpecs(t){o(t,this.config.alignableTypes,{attrName:"align",getDefault:t=>this.config.defaults[t]??"start",applyToDOM:d})}registerCommands(t){for(const e of this.config.alignments)t.registerCommand(`align${a(e)}`,()=>this.setAlignment(t,e))}registerKeymaps(t){const e={};this.config.alignments.includes("start")&&(e["Mod-Shift-L"]=()=>t.executeCommand("alignStart")),this.config.alignments.includes("center")&&(e["Mod-Shift-E"]=()=>t.executeCommand("alignCenter")),this.config.alignments.includes("end")&&(e["Mod-Shift-R"]=()=>t.executeCommand("alignEnd")),this.config.alignments.includes("justify")&&(e["Mod-Shift-J"]=()=>t.executeCommand("alignJustify")),Object.keys(e).length>0&&t.registerKeymap(e)}registerToolbarItem(t){const e=this.config.alignments.map(t=>({label:this.getAlignmentLabel(t),command:`align${a(t)}`,icon:h[t]}));t.registerToolbarItem({id:"alignment",group:"block",icon:h.start,label:this.locale.toolbarLabel,tooltip:this.locale.toolbarTooltip,command:"alignStart",popupType:"dropdown",popupConfig:{items:e},isActive:t=>this.isNonDefaultAlignment(t),isEnabled:t=>this.isAlignable(t)})}getAlignmentLabel(t){return{start:this.locale.alignStart,center:this.locale.alignCenter,end:this.locale.alignEnd,justify:this.locale.justify}[t]}registerMiddleware(t){t.registerMiddleware((t,e,s)=>{let i=!1;const n=t.steps.map(t=>{if("setBlockType"!==t.type)return t;if(!this.alignableTypes.has(t.nodeType))return t;const e=t.previousAttrs?.align;return e&&"start"!==e?(i=!0,{...t,attrs:{...t.attrs,align:e}}):t});s(i?{...t,steps:n}:t)},{name:"alignment:preserve-align"})}setAlignment(e,i){const n=e.getState(),a=t(n);if(0===a.length)return!1;const l=n.transaction("command");let o=!1;for(const t of a){const e=n.getBlock(t);if(!e||!this.alignableTypes.has(e.type))continue;const s=n.getNodePath(t);s&&(l.setNodeAttr(s,{...e.attrs,align:i}),o=!0)}return!!o&&s(e,l.setSelection(n.selection).build())}isNonDefaultAlignment(t){const e=n(t);if(!e||!this.alignableTypes.has(e.type))return!1;const s=e.attrs?.align,i=this.config.defaults[e.type]??"start";return null!=s&&s!==i}isAlignable(t){const e=n(t);return null!=e&&this.alignableTypes.has(e.type)}};function d(t,e){const s=e.attrs?.align;"string"==typeof s&&"start"!==s&&l(t,"textAlign",s)}export{m as i,p as n,r,h as t};
|
|
2
|
-
//# sourceMappingURL=AlignmentPlugin-DIwrRsHd.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlignmentPlugin-DIwrRsHd.mjs","names":[],"sources":["../../src/plugins/alignment/AlignmentLocale.ts","../../src/plugins/alignment/AlignmentPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the AlignmentPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\nexport interface AlignmentLocale {\n\treadonly alignStart: string;\n\treadonly alignCenter: string;\n\treadonly alignEnd: string;\n\treadonly justify: string;\n\treadonly toolbarLabel: string;\n\treadonly toolbarTooltip: string;\n}\n\n// --- Default English Locale ---\n\nexport const ALIGNMENT_LOCALE_EN: AlignmentLocale = {\n\talignStart: 'Align Start',\n\talignCenter: 'Align Center',\n\talignEnd: 'Align End',\n\tjustify: 'Justify',\n\ttoolbarLabel: 'Alignment',\n\ttoolbarTooltip: 'Alignment',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<AlignmentLocale> = import.meta.glob<{\n\tdefault: AlignmentLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadAlignmentLocale(lang: string): Promise<AlignmentLocale> {\n\treturn loadLocaleModule(localeModules, lang, ALIGNMENT_LOCALE_EN);\n}\n","/**\n * AlignmentPlugin: adds start/center/end/justify alignment as a block\n * attribute on paragraphs, headings, images, and other alignable types.\n * Uses logical values (`start`/`end`) instead of physical (`left`/`right`)\n * for correct behavior with RTL text direction. Patches NodeSpecs to render\n * the `align` attribute via inline `text-align` style and provides toggle\n * commands, keyboard shortcuts, and a toolbar dropdown.\n */\n\nimport type { BlockAlignment } from '../../model/BlockAlignment.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { patchNodeSpecAttr } from '../shared/NodeSpecPatching.js';\nimport {\n\tcapitalize,\n\tdispatchIfPresent,\n\tgetSelectedBlock,\n\tgetSelectedBlockIds,\n\tresolveLocale,\n} from '../shared/PluginHelpers.js';\nimport {\n\tALIGNMENT_LOCALE_EN,\n\ttype AlignmentLocale,\n\tloadAlignmentLocale,\n} from './AlignmentLocale.js';\n\n// --- Public Types ---\n\nexport interface AlignmentConfig {\n\t/** Which alignments to expose. Defaults to all four. */\n\treadonly alignments: readonly BlockAlignment[];\n\t/** Block types that support alignment. Defaults to paragraph + heading + title + subtitle + table_cell + image. */\n\treadonly alignableTypes: readonly string[];\n\t/** Per-type default alignment (e.g. `{ image: 'center' }`). Falls back to `'start'`. */\n\treadonly defaults: Readonly<Record<string, BlockAlignment>>;\n\treadonly locale?: AlignmentLocale;\n}\n\n// --- Constants ---\n\nconst DEFAULT_CONFIG: AlignmentConfig = {\n\talignments: ['start', 'center', 'end', 'justify'],\n\talignableTypes: ['paragraph', 'heading', 'title', 'subtitle', 'table_cell', 'image'],\n\tdefaults: { image: 'center' },\n};\n\nexport const ALIGNMENT_ICONS: Readonly<Record<BlockAlignment, string>> = {\n\tstart:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z\"/></svg>',\n\tcenter:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z\"/></svg>',\n\tend: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z\"/></svg>',\n\tjustify:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z\"/></svg>',\n};\n\n// --- Plugin ---\n\nexport class AlignmentPlugin implements Plugin {\n\treadonly id = 'alignment';\n\treadonly name = 'Alignment';\n\treadonly priority = 90;\n\n\tprivate readonly config: AlignmentConfig;\n\tprivate locale!: AlignmentLocale;\n\tprivate alignableTypes!: ReadonlySet<string>;\n\n\tconstructor(config?: Partial<AlignmentConfig>) {\n\t\tthis.config = {\n\t\t\t...DEFAULT_CONFIG,\n\t\t\t...config,\n\t\t\tdefaults: { ...DEFAULT_CONFIG.defaults, ...config?.defaults },\n\t\t};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tALIGNMENT_LOCALE_EN,\n\t\t\tloadAlignmentLocale,\n\t\t);\n\n\t\tthis.alignableTypes = new Set(this.config.alignableTypes);\n\t\tthis.patchNodeSpecs(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.registerMiddleware(context);\n\t}\n\n\t// --- NodeSpec Patching ---\n\n\t/**\n\t * Patches existing NodeSpecs for alignable block types to support the\n\t * `align` attribute and render it as an inline style. Skips types\n\t * that already define an `align` attribute in their spec.\n\t */\n\tprivate patchNodeSpecs(context: PluginContext): void {\n\t\tpatchNodeSpecAttr(context, this.config.alignableTypes, {\n\t\t\tattrName: 'align',\n\t\t\tgetDefault: (type) => this.config.defaults[type] ?? 'start',\n\t\t\tapplyToDOM: applyAlignment,\n\t\t});\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tfor (const alignment of this.config.alignments) {\n\t\t\tcontext.registerCommand(`align${capitalize(alignment)}`, () => {\n\t\t\t\treturn this.setAlignment(context, alignment);\n\t\t\t});\n\t\t}\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tconst bindings: Record<string, () => boolean> = {};\n\n\t\tif (this.config.alignments.includes('start')) {\n\t\t\tbindings['Mod-Shift-L'] = () => context.executeCommand('alignStart');\n\t\t}\n\t\tif (this.config.alignments.includes('center')) {\n\t\t\tbindings['Mod-Shift-E'] = () => context.executeCommand('alignCenter');\n\t\t}\n\t\tif (this.config.alignments.includes('end')) {\n\t\t\tbindings['Mod-Shift-R'] = () => context.executeCommand('alignEnd');\n\t\t}\n\t\tif (this.config.alignments.includes('justify')) {\n\t\t\tbindings['Mod-Shift-J'] = () => context.executeCommand('alignJustify');\n\t\t}\n\n\t\tif (Object.keys(bindings).length > 0) {\n\t\t\tcontext.registerKeymap(bindings);\n\t\t}\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst dropdownItems = this.config.alignments.map((alignment) => ({\n\t\t\tlabel: this.getAlignmentLabel(alignment),\n\t\t\tcommand: `align${capitalize(alignment)}`,\n\t\t\ticon: ALIGNMENT_ICONS[alignment],\n\t\t}));\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'alignment',\n\t\t\tgroup: 'block',\n\t\t\ticon: ALIGNMENT_ICONS.start,\n\t\t\tlabel: this.locale.toolbarLabel,\n\t\t\ttooltip: this.locale.toolbarTooltip,\n\t\t\tcommand: 'alignStart',\n\t\t\tpopupType: 'dropdown',\n\t\t\tpopupConfig: { items: dropdownItems },\n\t\t\tisActive: (state) => this.isNonDefaultAlignment(state),\n\t\t\tisEnabled: (state) => this.isAlignable(state),\n\t\t});\n\t}\n\n\tprivate getAlignmentLabel(alignment: BlockAlignment): string {\n\t\tconst labels: Record<BlockAlignment, string> = {\n\t\t\tstart: this.locale.alignStart,\n\t\t\tcenter: this.locale.alignCenter,\n\t\t\tend: this.locale.alignEnd,\n\t\t\tjustify: this.locale.justify,\n\t\t};\n\t\treturn labels[alignment];\n\t}\n\n\t// --- Middleware ---\n\n\t/**\n\t * Preserves the `align` attribute when other plugins change the block\n\t * type (e.g. paragraph → heading) via `setBlockType`, which replaces attrs.\n\t */\n\tprivate registerMiddleware(context: PluginContext): void {\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, _state, next) => {\n\t\t\t\tlet patched = false;\n\n\t\t\t\tconst patchedSteps = tr.steps.map((step) => {\n\t\t\t\t\tif (step.type !== 'setBlockType') return step;\n\t\t\t\t\tif (!this.alignableTypes.has(step.nodeType)) return step;\n\n\t\t\t\t\tconst prevAlign = step.previousAttrs?.align;\n\t\t\t\t\tif (!prevAlign || prevAlign === 'start') return step;\n\n\t\t\t\t\t// Carry forward align into new attrs\n\t\t\t\t\tpatched = true;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...step,\n\t\t\t\t\t\tattrs: { ...step.attrs, align: prevAlign },\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps } : tr);\n\t\t\t},\n\t\t\t{ name: 'alignment:preserve-align' },\n\t\t);\n\t}\n\n\t// --- Alignment Logic ---\n\n\t/**\n\t * Applies `alignment` to every alignable block in the current selection in\n\t * a single transaction. A multi-block selection aligns all of its blocks,\n\t * not just the anchor; non-alignable blocks in the range are left untouched.\n\t */\n\tprivate setAlignment(context: PluginContext, alignment: BlockAlignment): boolean {\n\t\tconst state = context.getState();\n\t\tconst blockIds: BlockId[] = getSelectedBlockIds(state);\n\t\tif (blockIds.length === 0) return false;\n\n\t\tconst tb = state.transaction('command');\n\t\tlet changed = false;\n\n\t\tfor (const id of blockIds) {\n\t\t\tconst block = state.getBlock(id);\n\t\t\tif (!block || !this.alignableTypes.has(block.type)) continue;\n\n\t\t\tconst path = state.getNodePath(id);\n\t\t\tif (!path) continue;\n\n\t\t\ttb.setNodeAttr(path, { ...block.attrs, align: alignment });\n\t\t\tchanged = true;\n\t\t}\n\n\t\tif (!changed) return false;\n\n\t\treturn dispatchIfPresent(context, tb.setSelection(state.selection).build());\n\t}\n\n\tprivate isNonDefaultAlignment(state: EditorState): boolean {\n\t\tconst block = getSelectedBlock(state);\n\t\tif (!block || !this.alignableTypes.has(block.type)) return false;\n\t\tconst align = block.attrs?.align;\n\t\tconst defaultAlign: BlockAlignment = this.config.defaults[block.type] ?? 'start';\n\t\treturn align != null && align !== defaultAlign;\n\t}\n\n\tprivate isAlignable(state: EditorState): boolean {\n\t\tconst block = getSelectedBlock(state);\n\t\treturn block != null && this.alignableTypes.has(block.type);\n\t}\n}\n\n// --- Helpers ---\n\nfunction applyAlignment(el: HTMLElement, node: BlockNode): void {\n\tconst align = node.attrs?.align;\n\tif (typeof align === 'string' && align !== 'start') {\n\t\tsetStyleProperty(el, 'textAlign', align);\n\t}\n}\n"],"mappings":"wLAeA,IAAa,EAAuC,CACnD,WAAY,cACZ,YAAa,eACb,SAAU,YACV,QAAS,UACT,aAAc,YACd,eAAgB,aAKX,iBAAkD,OAAA,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,uBAIxD,eAAsB,EAAoB,GACzC,OAAO,EAAiB,EAAe,EAAM,EAC9C,CCWA,IAAM,EAAkC,CACvC,WAAY,CAAC,QAAS,SAAU,MAAO,WACvC,eAAgB,CAAC,YAAa,UAAW,QAAS,WAAY,aAAc,SAC5E,SA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M,EAAQ,EAAiB,GAC/B,IAAK,IAAU,KAAK,eAAe,IAAI,EAAM,MAAO,OAAO,EAC3D,MAAM,EAAQ,EAAM,OAAO,MACrB,EAA+B,KAAK,OAAO,SAAS,EAAM,OAAS,QACzE,OAAgB,MAAT,GAAiB,IAAU,CACnC,CAEA,WAAA,CAAoB,GACnB,MAAM,EAAQ,EAAiB,GAC/B,OAAgB,MAAT,GAAiB,KAAK,eAAe,IAAI,EAAM,KACvD,GAKD,SAAS,EAAe,EAAiB,GACxC,MAAM,EAAQ,EAAK,OAAO,MACL,iBAAV,GAAgC,UAAV,GAChC,EAAiB,EAAI,YAAa,EAEpC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as i}from"./HTMLUtils-B0nGyFLb.mjs";import{c as t,f as e}from"./Selection-DC6AOGgF.mjs";import{i as o}from"./TypeBrands-Ch9856Gb.mjs";import{i as n,r,t as s}from"./AttributedMarkCommands-B3MQdob_.mjs";import{c as l,n as a,o as m,r as c}from"./PluginHelpers-WG1Lzzh3.mjs";import{t as d}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as g}from"./DirectionIcons-Bbawl9ei.mjs";import{t as p}from"./TextDirectionService-OFOU6r_s.mjs";var u={inlineLTR:"Inline LTR",inlineRTL:"Inline RTL",inlineAuto:"Inline Auto",inlineLabel:"Inline Direction",inlineTooltip:"Inline Direction",announceRemoveBidi:"Inline direction isolation removed"},h=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-B03uY4xr.mjs"),"./locales/de.ts":()=>import("./de-XCCpWyg0.mjs"),"./locales/es.ts":()=>import("./es-B0Za939C.mjs"),"./locales/fr.ts":()=>import("./fr-DciSEykY.mjs"),"./locales/hi.ts":()=>import("./hi-j3TDLMYd.mjs"),"./locales/pt.ts":()=>import("./pt-CEUgbrii.mjs"),"./locales/ru.ts":()=>import("./ru-BNPUT-3S.mjs"),"./locales/zh.ts":()=>import("./zh-Oj-qSUEp.mjs")});async function B(i){return l(h,i,u)}var b=class{id="bidi-isolation";name="Bidi Isolation";priority=92;config;locale;constructor(i){this.config={...i}}async init(i){this.locale=await m(i,this.config.locale,u,B),this.registerBdiMark(i),this.registerCommands(i),this.registerKeymaps(i),this.registerInlineToolbarItem(i)}registerBdiMark(t){t.registerMarkSpec({type:"bdi",rank:10,attrs:{dir:{default:"auto"}},toDOM(i){const t=document.createElement("bdi"),e=String(i.attrs?.dir??"auto");return t.setAttribute("dir",e),t},toHTMLString:(t,e)=>`<bdi dir="${i(String(t.attrs?.dir??"auto"))}">${e}</bdi>`,parseHTML:[{tag:"bdi",getAttrs:i=>{const t=i.getAttribute("dir");return"ltr"===t||"rtl"===t?{dir:t}:{dir:"auto"}}}],sanitize:{tags:["bdi"],attrs:["dir"]}})}registerCommands(i){i.registerCommand("toggleBidiLTR",()=>{const t=this.applyBdi(i,"ltr");return t&&i.announce(this.locale.inlineLTR),t}),i.registerCommand("toggleBidiRTL",()=>{const t=this.applyBdi(i,"rtl");return t&&i.announce(this.locale.inlineRTL),t}),i.registerCommand("toggleBidiAuto",()=>{const t=this.applyBdi(i,"auto");return t&&i.announce(this.locale.inlineAuto),t}),i.registerCommand("removeBidi",()=>{const t=this.removeBdi(i);return t&&i.announce(this.locale.announceRemoveBidi),t}),i.registerCommand("toggleBidiIsolation",()=>this.toggleBidiIsolation(i))}registerKeymaps(i){i.registerKeymap({"Mod-Shift-B":()=>i.executeCommand("toggleBidiIsolation")})}registerInlineToolbarItem(i){const o=[{label:this.locale.inlineLTR,command:"toggleBidiLTR",icon:g.ltr},{label:this.locale.inlineRTL,command:"toggleBidiRTL",icon:g.rtl},{label:this.locale.inlineAuto,command:"toggleBidiAuto",icon:g.auto},{label:this.locale.announceRemoveBidi,command:"removeBidi"}];i.registerToolbarItem({id:"inline-direction",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 4v7h2V4h2v7h2V4h1V2H10a3 3 0 1 0 0 6zm-3.5 9.5L3 17l3.5 3.5V18h3v-2h-3v-2.5zm14 0L17 17l3.5 3.5V18h-3v-2h3v-2.5zM11 16h2v6h-2z"/></svg>',label:this.locale.inlineLabel,tooltip:`${this.locale.inlineTooltip} (${d("Mod-Shift-B")})`,command:"toggleBidiIsolation",popupType:"dropdown",popupConfig:{items:o},isActive:i=>r(i,"bdi"),isEnabled:i=>{const o=i.selection;return e(o)&&!t(o)}})}toggleBidiIsolation(i){const t=i.getState();if(r(t,"bdi")){const t=this.removeBdi(i);return t&&i.announce(this.locale.announceRemoveBidi),t}const e=c(t),o=i.getService(p),n="rtl"===(e&&o?o.getBlockDir(e):"auto")?"ltr":"rtl",s=this.applyBdi(i,n);if(s){const t="ltr"===n?this.locale.inlineLTR:this.locale.inlineRTL;i.announce(t)}return s}applyBdi(i,t){const e=i.getState(),n={type:o("bdi"),attrs:{dir:t}};return a(i,s(e,n))}removeBdi(i){const t=i.getState();return a(i,n(t,o("bdi")))}};export{u as n,B as r,b as t};
|
|
2
|
-
//# sourceMappingURL=BidiIsolationPlugin-cOLlL3Y9.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{D as t,E as e,h as o,k as n,p as r}from"./Document-D_2cIBJG.mjs";import{a as i,c,t as s}from"./NodeResolver-BtIknXqD.mjs";import{c as l,f as a,n as u,p as d}from"./Selection-DC6AOGgF.mjs";import{a as h}from"./TypeBrands-Ch9856Gb.mjs";import{c as m,o as p}from"./PluginHelpers-WG1Lzzh3.mjs";import{n as g}from"./DomUtils-Bf7JLFlx.mjs";import{t as f}from"./ShortcutFormatting-TwiufqeV.mjs";function b(t,e){const o=t.getNodePath(e)?.[0];return o?t.doc.children.findIndex(t=>t.id===o):-1}function k(t,o,n,i){const c=d(n,t.getBlockOrder()),s=b(t,c.from.blockId),l=b(t,c.to.blockId);if(s<0||l<0)return null;const a=Math.min(s,l),u=Math.max(s,l),h=t.doc.children.slice(a,u+1),m=i??(()=>!0),p=[];let g=[],f=!1;const k=()=>{0!==g.length&&(p.push(r(o,g,e())),f=!0,g=[])};for(const e of h)m(e)?g.push(e):(k(),p.push(e));if(k(),!f)return null;const q=t.transaction("command");for(let e=u;e>=a;e--)q.removeNode([],e);return p.forEach((t,e)=>{q.insertNode([],a+e,t)}),q.setSelection(n),q.build()}function q(e,o){const n=e.getState();if(!a(n.selection))return!1;const r=n.selection;if(!l(r))return!1;const i=r.anchor.blockId,s=n.getParent(i);if(!s||"blockquote"!==s.type)return!1;const u=n.getBlock(i);if(!u)return!1;const d=n.getNodePath(s.id);if(!d)return!1;const h=c(n.doc,d);if(!h)return!1;const m=t(s),p=m.findIndex(t=>t.id===i);return!(p<0)&&o({state:n,quotePath:d,quoteParentPath:d.slice(0,-1),quoteIndex:h.index,child:u,childIndex:p,childCount:m.length,offset:r.anchor.offset})}var I={label:"Blockquote",tooltip:t=>`Blockquote (${t})`},x=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-sGZ-oZqB.mjs"),"./locales/de.ts":()=>import("./de-uKR7koQe.mjs"),"./locales/es.ts":()=>import("./es-DrJyl38L.mjs"),"./locales/fr.ts":()=>import("./fr-BRXUnq3R.mjs"),"./locales/hi.ts":()=>import("./hi-SECtQQzq.mjs"),"./locales/pt.ts":()=>import("./pt-Cv6q7x5x.mjs"),"./locales/ru.ts":()=>import("./ru-DSRv3_Rg.mjs"),"./locales/zh.ts":()=>import("./zh-DYD476c5.mjs")});async function N(t){return m(x,t,I)}var v={},P=class{id="blockquote";name="Blockquote";priority=35;config;locale;constructor(t){this.config={...v,...t}}async init(t){this.locale=await p(t,this.config.locale,I,N),t.registerStyleSheet("\n.notectl-content blockquote {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 16px;\n\tborder-inline-start: 3px solid var(--notectl-blockquote-border, var(--notectl-border));\n\tbackground: var(--notectl-blockquote-bg, transparent);\n\tcolor: var(--notectl-blockquote-fg, inherit);\n\tmin-height: 1.6em;\n}\n"),this.registerNodeSpec(t),this.registerCommands(t),this.registerKeymap(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerToolbarItem(t)}registerNodeSpec(t){t.registerNodeSpec({type:"blockquote",group:"block",content:{allow:["paragraph","heading","list_item","blockquote","horizontal_rule","code_block"],min:1},toDOM(t){const e=g("blockquote",t.id);return e.setAttribute("part","blockquote"),e},toHTML:(t,e)=>`<blockquote>${e||"<br>"}</blockquote>`,parseHTML:[{tag:"blockquote"}],sanitize:{tags:["blockquote"]}})}registerCommands(t){t.registerCommand("toggleBlockquote",()=>this.toggleBlockquote(t)),t.registerCommand("setBlockquote",()=>this.wrapInBlockquote(t))}registerKeymap(t){t.registerKeymap({"Mod-Shift->":()=>t.executeCommand("toggleBlockquote")}),function(t){t.registerKeymap({Enter:()=>function(t){return q(t,e=>{if("list_item"===e.child.type)return!1;if(e.childIndex!==e.childCount-1||n(e.child)>0)return!1;const r=o(),i=e.state.transaction("input");return 1===e.childCount?(i.removeNode(e.quoteParentPath,e.quoteIndex),i.insertNode(e.quoteParentPath,e.quoteIndex,r)):(i.removeNode(e.quotePath,e.childIndex),i.insertNode(e.quoteParentPath,e.quoteIndex+1,r)),i.setSelection(u(r.id,0)),t.dispatch(i.build()),!0})}(t),Backspace:()=>function(t){return q(t,e=>{if(0!==e.offset||0!==e.childIndex)return!1;if("list_item"===e.child.type)return!1;const o=e.state.transaction("input");return 1===e.childCount?(o.removeNode(e.quoteParentPath,e.quoteIndex),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)):(o.removeNode(e.quotePath,0),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)),o.setSelection(u(e.child.id,0)),t.dispatch(o.build()),!0})}(t)},{priority:"context"})}(t)}registerInputRule(t){t.registerInputRule({pattern:/^> $/,handler(t,o,n,i){const c=t.selection;if(!a(c))return null;if(!l(c))return null;const s=t.getBlock(c.anchor.blockId);if(!s||"paragraph"!==s.type)return null;const u=t.doc.children.findIndex(t=>t.id===s.id);if(u<0)return null;const d=r(h("blockquote"),[s],e());return t.transaction("input").removeNode([],u).insertNode([],u,d).deleteTextAt(c.anchor.blockId,n,n+2).setSelection(c).build()}})}registerToolbarItem(t){t.registerToolbarItem({id:"blockquote",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(f("Mod-Shift->")),command:"toggleBlockquote",isActive:t=>!!a(t.selection)&&i(t.doc,t.selection.anchor.blockId,"blockquote")})}toggleBlockquote(e){const o=e.getState(),n=o.selection;if(!a(n))return!1;const r=i(o.doc,n.anchor.blockId,"blockquote")?function(e,o,n){const r=s(e.doc,n.anchor.blockId,o);if(!r||1!==r.path.length)return null;const i=e.doc.children.findIndex(t=>t.id===r.node.id);if(i<0)return null;const c=t(r.node),l=e.transaction("command");return l.removeNode([],i),c.forEach((t,e)=>{l.insertNode([],i+e,t)}),l.setSelection(n),l.build()}(o,h("blockquote"),n):k(o,h("blockquote"),n,this.isQuoteChild(e));return!!r&&(e.dispatch(r),!0)}wrapInBlockquote(t){const e=t.getState(),o=e.selection;if(!a(o))return!1;const n=k(e,h("blockquote"),o,this.isQuoteChild(t));return!!n&&(t.dispatch(n),!0)}isQuoteChild(t){const e=t.getSchemaRegistry(),o=new Set(e.getNodeSpec(h("blockquote"))?.content?.allow??[]);return t=>{if(o.has(t.type))return!0;const n=e.getNodeSpec(t.type)?.group;return void 0!==n&&o.has(n)}}};export{I as n,N as r,P as t};
|
|
2
|
-
//# sourceMappingURL=BlockquotePlugin-D-jRWLQB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockquotePlugin-D-jRWLQB.mjs","names":[],"sources":["../../src/commands/ContainerCommands.ts","../../src/plugins/blockquote/BlockquoteKeyboardHandlers.ts","../../src/plugins/blockquote/BlockquoteLocale.ts","../../src/plugins/blockquote/BlockquoteStyles.ts","../../src/plugins/blockquote/BlockquotePlugin.ts"],"sourcesContent":["/**\n * Generic wrap/lift commands for container blocks (issue #136).\n *\n * A container block (e.g. `blockquote`) holds other blocks as children, mirroring\n * HTML flow-content semantics. Wrapping moves the selected top-level blocks into a\n * new container; lifting dissolves a container and returns its children to the\n * parent. Block identity (IDs) is preserved across both operations so the active\n * selection survives the structural change.\n *\n * Scope: operations act on top-level containers. Nested containers (quote-in-quote,\n * quote-in-cell) are intentionally out of scope here and return `null`.\n */\n\nimport type { BlockNode } from '../model/Document.js';\nimport { createBlockNode, generateBlockId, getBlockChildren } from '../model/Document.js';\nimport { findAncestorOfType } from '../model/NodeResolver.js';\nimport type { Selection } from '../model/Selection.js';\nimport { selectionRange } from '../model/Selection.js';\nimport type { BlockId, NodeTypeName } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\n\n/** Returns the index in `doc.children` of the top-level ancestor of the given block. */\nfunction topLevelIndexOf(state: EditorState, blockId: BlockId): number {\n\tconst topId: BlockId | undefined = state.getNodePath(blockId)?.[0];\n\tif (!topId) return -1;\n\treturn state.doc.children.findIndex((b) => b.id === topId);\n}\n\n/**\n * Wraps the top-level blocks spanned by `selection` into new container blocks of\n * `containerType`. Returns `null` when the range cannot be resolved.\n *\n * `isAllowedChild` guards the container's schema (`content.allow`): blocks the\n * container cannot legally hold (e.g. a `table` inside a `blockquote`) are left at\n * the top level instead of being nested into an invalid document. Disallowed blocks\n * therefore split the range into separate contiguous runs, each wrapped in its own\n * container, mirroring `wrapIn`. Defaults to wrapping everything when omitted.\n * Returns `null` when no block in the range is wrappable.\n */\nexport function wrapSelectionInContainer(\n\tstate: EditorState,\n\tcontainerType: NodeTypeName,\n\tselection: Selection,\n\tisAllowedChild?: (block: BlockNode) => boolean,\n): Transaction | null {\n\tconst range = selectionRange(selection, state.getBlockOrder());\n\tconst fromIdx: number = topLevelIndexOf(state, range.from.blockId);\n\tconst toIdx: number = topLevelIndexOf(state, range.to.blockId);\n\tif (fromIdx < 0 || toIdx < 0) return null;\n\n\tconst lo: number = Math.min(fromIdx, toIdx);\n\tconst hi: number = Math.max(fromIdx, toIdx);\n\n\tconst blocks: readonly BlockNode[] = state.doc.children.slice(lo, hi + 1);\n\tconst allowed: (block: BlockNode) => boolean = isAllowedChild ?? (() => true);\n\n\t// Group the range into maximal runs of wrappable blocks; each run becomes one\n\t// container, disallowed blocks pass through unchanged and break the run.\n\tconst sequence: BlockNode[] = [];\n\tlet run: BlockNode[] = [];\n\tlet wrappedAny = false;\n\tconst flushRun = (): void => {\n\t\tif (run.length === 0) return;\n\t\tsequence.push(createBlockNode(containerType, run, generateBlockId()));\n\t\twrappedAny = true;\n\t\trun = [];\n\t};\n\tfor (const block of blocks) {\n\t\tif (allowed(block)) {\n\t\t\trun.push(block);\n\t\t} else {\n\t\t\tflushRun();\n\t\t\tsequence.push(block);\n\t\t}\n\t}\n\tflushRun();\n\n\tif (!wrappedAny) return null;\n\n\tconst builder = state.transaction('command');\n\tfor (let i: number = hi; i >= lo; i--) {\n\t\tbuilder.removeNode([], i);\n\t}\n\tsequence.forEach((node, i) => {\n\t\tbuilder.insertNode([], lo + i, node);\n\t});\n\tbuilder.setSelection(selection);\n\treturn builder.build();\n}\n\n/**\n * Lifts the children of the nearest top-level `containerType` ancestor of the\n * selection anchor back out to the top level, dissolving the container. Returns\n * `null` when no such top-level container surrounds the selection.\n */\nexport function liftSelectionFromContainer(\n\tstate: EditorState,\n\tcontainerType: NodeTypeName,\n\tselection: Selection,\n): Transaction | null {\n\tconst ancestor = findAncestorOfType(state.doc, selection.anchor.blockId, containerType);\n\t// Only top-level containers are dissolved (path === [containerId]).\n\tif (!ancestor || ancestor.path.length !== 1) return null;\n\n\tconst containerIdx: number = state.doc.children.findIndex((b) => b.id === ancestor.node.id);\n\tif (containerIdx < 0) return null;\n\n\tconst children: readonly BlockNode[] = getBlockChildren(ancestor.node);\n\n\tconst builder = state.transaction('command');\n\tbuilder.removeNode([], containerIdx);\n\tchildren.forEach((child, i) => {\n\t\tbuilder.insertNode([], containerIdx + i, child);\n\t});\n\tbuilder.setSelection(selection);\n\treturn builder.build();\n}\n","/**\n * Keyboard handlers for the blockquote container (issue #136, B2 model).\n *\n * Under the container model the caret lives in a child block of the blockquote,\n * not in the blockquote itself. These handlers manage the two container\n * boundaries; everything in between (splitting, merging, arrow navigation) is\n * left to the default commands, which already operate correctly on the nested\n * child blocks:\n *\n * - Enter in an empty last child → exit the blockquote (paragraph after it).\n * - Backspace at start of the first child → lift that child out of the quote.\n *\n * List items are deferred to the list plugin's own handlers.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { createEmptyParagraph, getBlockChildren, getBlockLength } from '../../model/Document.js';\nimport { resolveParentByPath } from '../../model/NodeResolver.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\n\n// --- Context Guard ---\n\ninterface QuoteChildContext {\n\treadonly state: EditorState;\n\treadonly quotePath: readonly BlockId[];\n\treadonly quoteParentPath: readonly BlockId[];\n\treadonly quoteIndex: number;\n\treadonly child: BlockNode;\n\treadonly childIndex: number;\n\treadonly childCount: number;\n\treadonly offset: number;\n}\n\n/**\n * Resolves the caret context when the cursor sits in a direct child of a\n * blockquote. Returns false (not handled) otherwise, so the default keymap and\n * other plugins keep their behavior.\n */\nfunction withBlockquoteChildContext(\n\tcontext: PluginContext,\n\thandler: (ctx: QuoteChildContext) => boolean,\n): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst childId: BlockId = sel.anchor.blockId;\n\tconst quote: BlockNode | undefined = state.getParent(childId);\n\tif (!quote || quote.type !== 'blockquote') return false;\n\n\tconst child: BlockNode | undefined = state.getBlock(childId);\n\tif (!child) return false;\n\n\tconst quotePath: BlockId[] | undefined = state.getNodePath(quote.id);\n\tif (!quotePath) return false;\n\tconst parentRef = resolveParentByPath(state.doc, quotePath);\n\tif (!parentRef) return false;\n\n\tconst children: readonly BlockNode[] = getBlockChildren(quote);\n\tconst childIndex: number = children.findIndex((b) => b.id === childId);\n\tif (childIndex < 0) return false;\n\n\treturn handler({\n\t\tstate,\n\t\tquotePath,\n\t\tquoteParentPath: quotePath.slice(0, -1),\n\t\tquoteIndex: parentRef.index,\n\t\tchild,\n\t\tchildIndex,\n\t\tchildCount: children.length,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers the blockquote container keyboard handlers at context priority. */\nexport function registerBlockquoteKeymaps(context: PluginContext): void {\n\tcontext.registerKeymap(\n\t\t{\n\t\t\tEnter: () => handleEnterExit(context),\n\t\t\tBackspace: () => handleBackspaceLift(context),\n\t\t},\n\t\t{ priority: 'context' },\n\t);\n}\n\n// --- Handlers ---\n\n/**\n * Enter in an empty last child of the blockquote exits the container: a fresh\n * paragraph is created after the quote (or, when that child is the quote's only\n * child, the quote dissolves into that paragraph). Any other case returns false\n * so the default splitBlock creates a new line inside the quote.\n */\nfunction handleEnterExit(context: PluginContext): boolean {\n\treturn withBlockquoteChildContext(context, (ctx) => {\n\t\tif (ctx.child.type === 'list_item') return false;\n\t\tconst isLast: boolean = ctx.childIndex === ctx.childCount - 1;\n\t\tif (!isLast || getBlockLength(ctx.child) > 0) return false;\n\n\t\tconst paragraph: BlockNode = createEmptyParagraph();\n\t\tconst builder = ctx.state.transaction('input');\n\n\t\tif (ctx.childCount === 1) {\n\t\t\t// Sole child: dissolve the quote, replacing it with the paragraph.\n\t\t\tbuilder.removeNode(ctx.quoteParentPath, ctx.quoteIndex);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex, paragraph);\n\t\t} else {\n\t\t\t// Drop the empty trailing child and continue after the quote.\n\t\t\tbuilder.removeNode(ctx.quotePath, ctx.childIndex);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex + 1, paragraph);\n\t\t}\n\n\t\tbuilder.setSelection(createCollapsedSelection(paragraph.id, 0));\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t});\n}\n\n/**\n * Backspace at the start of the blockquote's first child lifts that child out of\n * the quote (placing it directly before the quote, or dissolving the quote when\n * it was the only child). Inner children at offset 0 fall through to the default\n * merge, which joins adjacent siblings within the quote.\n */\nfunction handleBackspaceLift(context: PluginContext): boolean {\n\treturn withBlockquoteChildContext(context, (ctx) => {\n\t\tif (ctx.offset !== 0 || ctx.childIndex !== 0) return false;\n\t\tif (ctx.child.type === 'list_item') return false;\n\n\t\tconst builder = ctx.state.transaction('input');\n\n\t\tif (ctx.childCount === 1) {\n\t\t\t// Sole child: dissolve the quote, the child takes its place.\n\t\t\tbuilder.removeNode(ctx.quoteParentPath, ctx.quoteIndex);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex, ctx.child);\n\t\t} else {\n\t\t\t// Lift the first child out, immediately before the quote.\n\t\t\tbuilder.removeNode(ctx.quotePath, 0);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex, ctx.child);\n\t\t}\n\n\t\tbuilder.setSelection(createCollapsedSelection(ctx.child.id, 0));\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t});\n}\n","/**\n * Locale interface and default English locale for the BlockquotePlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface BlockquoteLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const BLOCKQUOTE_LOCALE_EN: BlockquoteLocale = {\n\tlabel: 'Blockquote',\n\ttooltip: (shortcut: string) => `Blockquote (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<BlockquoteLocale> = import.meta.glob<{\n\tdefault: BlockquoteLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadBlockquoteLocale(lang: string): Promise<BlockquoteLocale> {\n\treturn loadLocaleModule(localeModules, lang, BLOCKQUOTE_LOCALE_EN);\n}\n","/** Blockquote styles using CSS logical properties for RTL support. */\nexport const BLOCKQUOTE_CSS = `\n.notectl-content blockquote {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 16px;\n\tborder-inline-start: 3px solid var(--notectl-blockquote-border, var(--notectl-border));\n\tbackground: var(--notectl-blockquote-bg, transparent);\n\tcolor: var(--notectl-blockquote-fg, inherit);\n\tmin-height: 1.6em;\n}\n`;\n","/**\n * BlockquotePlugin: registers a blockquote block type with NodeSpec,\n * toggle command, keyboard shortcut, input rule, and a toolbar button.\n */\n\nimport {\n\tliftSelectionFromContainer,\n\twrapSelectionInContainer,\n} from '../../commands/ContainerCommands.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { createBlockNode, generateBlockId } from '../../model/Document.js';\nimport { hasAncestorOfType } from '../../model/NodeResolver.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { registerBlockquoteKeymaps } from './BlockquoteKeyboardHandlers.js';\nimport {\n\tBLOCKQUOTE_LOCALE_EN,\n\ttype BlockquoteLocale,\n\tloadBlockquoteLocale,\n} from './BlockquoteLocale.js';\nimport { BLOCKQUOTE_CSS } from './BlockquoteStyles.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tblockquote: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface BlockquoteConfig {\n\t/** Live Markdown shortcut: `> ` to start a blockquote. Default true. */\n\treadonly inputRule?: boolean;\n\treadonly locale?: BlockquoteLocale;\n}\n\nconst DEFAULT_CONFIG: BlockquoteConfig = {};\n\n// --- Plugin ---\n\nexport class BlockquotePlugin implements Plugin {\n\treadonly id = 'blockquote';\n\treadonly name = 'Blockquote';\n\treadonly priority = 35;\n\n\tprivate readonly config: BlockquoteConfig;\n\tprivate locale!: BlockquoteLocale;\n\n\tconstructor(config?: Partial<BlockquoteConfig>) {\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\tBLOCKQUOTE_LOCALE_EN,\n\t\t\tloadBlockquoteLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(BLOCKQUOTE_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tif (this.config.inputRule !== false) this.registerInputRule(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\t// Container block (issue #136): a blockquote wraps other blocks, mirroring\n\t\t\t// HTML flow-content semantics. `isolating` is intentionally NOT set so the\n\t\t\t// caret can flow across the container boundary (unlike table_cell).\n\t\t\tcontent: {\n\t\t\t\tallow: ['paragraph', 'heading', 'list_item', 'blockquote', 'horizontal_rule', 'code_block'],\n\t\t\t\tmin: 1,\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst el = createBlockElement('blockquote', node.id);\n\t\t\t\tel.setAttribute('part', 'blockquote');\n\t\t\t\treturn el;\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<blockquote>${content || '<br>'}</blockquote>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'blockquote' }],\n\t\t\tsanitize: { tags: ['blockquote'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleBlockquote', () => {\n\t\t\treturn this.toggleBlockquote(context);\n\t\t});\n\n\t\tcontext.registerCommand('setBlockquote', () => {\n\t\t\treturn this.wrapInBlockquote(context);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift->': () => context.executeCommand('toggleBlockquote'),\n\t\t});\n\t\tregisterBlockquoteKeymaps(context);\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\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\tconst index: number = state.doc.children.findIndex((b) => b.id === block.id);\n\t\t\t\tif (index < 0) return null;\n\n\t\t\t\t// B2: wrap the paragraph into a blockquote container, then strip the\n\t\t\t\t// \"> \" marker from the (now nested) paragraph in the same transaction.\n\t\t\t\tconst container = createBlockNode(nodeType('blockquote'), [block], generateBlockId());\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.removeNode([], index)\n\t\t\t\t\t.insertNode([], index, container)\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + 2)\n\t\t\t\t\t.setSelection(sel)\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift->')),\n\t\t\tcommand: 'toggleBlockquote',\n\t\t\tisActive: (state) => {\n\t\t\t\tif (!isTextSelection(state.selection)) return false;\n\t\t\t\treturn hasAncestorOfType(state.doc, state.selection.anchor.blockId, 'blockquote');\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Toggles the blockquote container around the selection.\n\t * If the selection already lives inside a blockquote, its blocks are lifted\n\t * back out; otherwise the selected blocks are wrapped into one blockquote.\n\t */\n\tprivate toggleBlockquote(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst tr = hasAncestorOfType(state.doc, sel.anchor.blockId, 'blockquote')\n\t\t\t? liftSelectionFromContainer(state, nodeType('blockquote'), sel)\n\t\t\t: wrapSelectionInContainer(state, nodeType('blockquote'), sel, this.isQuoteChild(context));\n\n\t\tif (!tr) return false;\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/** Wraps the selected blocks into a blockquote container (no toggle-off). */\n\tprivate wrapInBlockquote(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst tr = wrapSelectionInContainer(\n\t\t\tstate,\n\t\t\tnodeType('blockquote'),\n\t\t\tsel,\n\t\t\tthis.isQuoteChild(context),\n\t\t);\n\t\tif (!tr) return false;\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Builds a predicate that reports whether a block may legally become a direct\n\t * child of the blockquote container, derived from the registered NodeSpec's\n\t * `content.allow` (single source of truth). Matches both concrete child types\n\t * and group names (e.g. `block`), so blocks the quote cannot hold (e.g. a\n\t * `table`) are excluded rather than nested into an invalid document.\n\t */\n\tprivate isQuoteChild(context: PluginContext): (block: BlockNode) => boolean {\n\t\tconst registry = context.getSchemaRegistry();\n\t\tconst allow: ReadonlySet<string> = new Set(\n\t\t\tregistry.getNodeSpec(nodeType('blockquote'))?.content?.allow ?? [],\n\t\t);\n\t\treturn (block: BlockNode): boolean => {\n\t\t\tif (allow.has(block.type)) return true;\n\t\t\tconst group: string | undefined = registry.getNodeSpec(block.type)?.group;\n\t\t\treturn group !== undefined && allow.has(group);\n\t\t};\n\t}\n}\n"],"mappings":"2YAuBA,SAAS,EAAgB,EAAoB,GAC5C,MAAM,EAA6B,EAAM,YAAY,KAAW,GAChE,OAAK,EACE,EAAM,IAAI,SAAS,UAAW,GAAM,EAAE,KAAO,IADjC,CAEpB,CAaA,SAAgB,EACf,EACA,EACA,EACA,GAEA,MAAM,EAAQ,EAAe,EAAW,EAAM,iBACxC,EAAkB,EAAgB,EAAO,EAAM,KAAK,SACpD,EAAgB,EAAgB,EAAO,EAAM,GAAG,SACtD,GAAI,EAAU,GAAK,EAAQ,EAAG,OAAO,KAErC,MAAM,EAAa,KAAK,IAAI,EAAS,GAC/B,EAAa,KAAK,IAAI,EAAS,GAE/B,EAA+B,EAAM,IAAI,SAAS,MAAM,EAAI,EAAK,GACjE,EAAyC,GAAA,MAAyB,GAIlE,EAAwB,GAC9B,IAAI,EAAmB,GACnB,GAAa,EACjB,MAAM,EAAA,KACc,IAAf,EAAI,SACR,EAAS,KAAK,EAAgB,EAAe,EAAK,MAClD,GAAa,EACb,EAAM,KAEP,IAAK,MAAM,KAAS,EACf,EAAQ,GACX,EAAI,KAAK,IAET,IACA,EAAS,KAAK,IAKhB,GAFA,KAEK,EAAY,OAAO,KAExB,MAAM,EAAU,EAAM,YAAY,WAClC,IAAK,IAAI,EAAY,EAAI,GAAK,EAAI,IACjC,EAAQ,WAAW,GAAI,GAMxB,OAJA,EAAS,QAAA,CAAS,EAAM,KACvB,EAAQ,WAAW,GAAI,EAAK,EAAG,KAEhC,EAAQ,aAAa,GACd,EAAQ,OAChB,CChDA,SAAS,EACR,EACA,GAEA,MAAM,EAAqB,EAAQ,WACnC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.mjs";import{E as e,P as n,R as o,V as r,h as c,j as s,k as i}from"./Document-D_2cIBJG.mjs";import{r as a}from"./NodeResolver-BtIknXqD.mjs";import{a as l,c as d,f as u,l as g,n as p,o as f,p as h}from"./Selection-DC6AOGgF.mjs";import{a as k}from"./TypeBrands-Ch9856Gb.mjs";import{C as b,S as m,_ as v,v as x,y}from"./BlockInsertion-O5pAFKid.mjs";import{t as C}from"./Commands-D-0UXYvo.mjs";import{a as S,i as w,t as I}from"./Decoration-BwhoA4MU.mjs";import{t as _}from"./SyntaxTokenTypes-BUCOMtL8.mjs";import{n as B}from"./TypedKeys-CA4bfw9O.mjs";import{c as A,o as T}from"./PluginHelpers-WG1Lzzh3.mjs";import{c as L}from"./StyleRuntime-C0RSqKzG.mjs";import{n as M}from"./DomUtils-Bf7JLFlx.mjs";import{t as O}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as P}from"./PopupManager-Jz5JrUdC.mjs";import{a as N,i as E,n as j,o as z,r as $,t as q}from"./xml-BsV44TrJ.mjs";import{n as D}from"./PopupKeyboardPatterns-BcwdDxRq.mjs";var H=`\n/* Code Block — uses theme custom properties */\n.notectl-code-block {\n\tposition: relative;\n\tmargin: 8px 0;\n\tborder-radius: 6px;\n\tbackground: var(--notectl-code-block-bg);\n\tcolor: var(--notectl-code-block-color);\n\tfont-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;\n\tfont-size: 14px;\n\tline-height: 1.5;\n\toverflow: hidden;\n}\n\n.notectl-code-block__header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 6px 12px;\n\tbackground: var(--notectl-code-block-header-bg);\n\tborder-bottom: 1px solid var(--notectl-code-block-header-border);\n\tfont-size: 12px;\n\tcolor: var(--notectl-code-block-header-color);\n\tuser-select: none;\n}\n\n.notectl-code-block__language-btn {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 4px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 2px 6px;\n\tfont-size: inherit;\n\tfont-family: inherit;\n\ttransition: background 0.15s;\n}\n\n.notectl-code-block__language-btn:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-code-block__language-btn:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-code-block__language {\n\tfont-weight: 500;\n\tletter-spacing: 0.02em;\n}\n\n.notectl-code-block__chevron {\n\tdisplay: inline-flex;\n\talign-items: center;\n\topacity: 0.6;\n}\n\n.notectl-code-block__actions {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n}\n\n.notectl-code-block__copy,\n.notectl-code-block__delete {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 24px;\n\theight: 24px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: var(--notectl-code-block-header-color);\n\tcursor: pointer;\n\tpadding: 0;\n\ttransition: background 0.15s, color 0.15s;\n}\n\n.notectl-code-block__copy:hover,\n.notectl-code-block__delete:hover {\n\tbackground: rgba(128, 128, 128, 0.15);\n\tcolor: var(--notectl-code-block-color);\n}\n\n.notectl-code-block__copy svg,\n.notectl-code-block__delete svg {\n\tfill: currentColor;\n}\n\n.notectl-code-block__content {\n\tdisplay: block;\n\tpadding: 12px 16px;\n\twhite-space: pre-wrap;\n\tword-wrap: break-word;\n\ttab-size: 4;\n\t-moz-tab-size: 4;\n\toutline: none;\n\tmin-height: 1.5em;\n}\n\n.notectl-code-block--selected {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n.notectl-code-block__esc-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: 4px;\n\tinset-inline-end: 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-code-block-header-color);\n\topacity: 0.5;\n\tpointer-events: none;\n\tuser-select: none;\n\tfont-family: system-ui, sans-serif;\n}\n\n.notectl-code-block--focused .notectl-code-block__esc-hint {\n\tdisplay: block;\n}\n\n/* Language picker popup */\n.notectl-language-picker {\n\tmin-width: 120px;\n\tmax-height: 200px;\n\toverflow-y: auto;\n\tpadding: 4px;\n\tbackground: var(--notectl-surface-raised, #fff);\n\tborder: 1px solid var(--notectl-border, #e0e0e0);\n\tborder-radius: 6px;\n\tbox-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n}\n\n.notectl-language-picker__option {\n\tpadding: 6px 10px;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg, #333);\n\twhite-space: nowrap;\n}\n\n.notectl-language-picker__option:hover {\n\tbackground: rgba(128, 128, 128, 0.1);\n}\n\n.notectl-language-picker__option:focus {\n\toutline: none;\n\tbackground: rgba(128, 128, 128, 0.15);\n}\n\n.notectl-language-picker__option[aria-selected="true"] {\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary, #2563eb);\n}\n\n/* Syntax highlighting token classes — generated from canonical token type list */\n${_.map(t=>`.notectl-token--${t} {\n\tcolor: var(--notectl-code-token-${t});\n\tfont-style: var(--notectl-code-token-${t}-font-style, inherit);\n\tfont-weight: var(--notectl-code-token-${t}-font-weight, inherit);\n}`).join("\n")}\n`,R=[{open:"(",close:")",kind:"bracket"},{open:"[",close:"]",kind:"bracket"},{open:"{",close:"}",kind:"bracket"},{open:'"',close:'"',kind:"quote"},{open:"'",close:"'",kind:"quote"},{open:"`",close:"`",kind:"quote"}],V=new Map(R.map(t=>[t.open,t])),F=new Map(R.filter(t=>"bracket"===t.kind).map(t=>[t.close,t]));var K=/* @__PURE__ */new Set(["{","[","("]),W={"}":"{","]":"[",")":"("};function U(t,e){const n=t.lastIndexOf("\n",e-1)+1,o=t.indexOf("\n",e);return{start:n,end:-1===o?t.length:o}}function J(t,e){const{start:n,end:o}=U(t,e);let r=n;for(;r<o;){const e=t[r];if(" "!==e&&"\t"!==e)break;r++}return t.slice(n,r)}function X(t,e){return t?" ".repeat(e):"\t"}function Z(t,e,n){if(0===t.length)return{removed:"",rest:t};if(!e&&"\t"===t[0])return{removed:"\t",rest:t.slice(1)};let o=0;for(;o<n&&" "===t[o];)o++;return{removed:t.slice(0,o),rest:t.slice(o)}}var G=class{buckets=/* @__PURE__ */new Map;push(t,e){const n=this.buckets.get(t.blockId)??[];n.push({pos:t,char:e}),this.buckets.set(t.blockId,n)}take(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const r=n[o];if(r&&r.pos.offset===e)return n.splice(o,1),0===n.length&&this.buckets.delete(t),r}}peek(t,e){const n=this.buckets.get(t);if(n)for(let o=n.length-1;o>=0;o--){const t=n[o];if(t&&t.pos.offset===e)return t}}clearBlock(t){this.buckets.delete(t)}clear(){this.buckets.clear()}sizeForBlock(t){return this.buckets.get(t)?.length??0}get size(){let t=0;for(const e of this.buckets.values())t+=e.length;return t}migrate(t){if(t.isEmpty)return;const e=/* @__PURE__ */new Map;for(const n of this.buckets.values())for(const o of n){const n=t.mapResult(o.pos,1);if(n.deleted)continue;const r={pos:n.pos,char:o.char},c=n.pos.blockId,s=e.get(c)??[];s.push(r),e.set(c,s)}this.buckets.clear();for(const[n,o]of e)this.buckets.set(n,o)}static makePos(t,e){return l(t,e)}},Q=class{resolvedIndent;resolvedPairing;getTokenAt;getCompositionState;pairs=new G;pendingPairOps=[];constructor(t){this.resolvedIndent=t.resolvedIndent,this.resolvedPairing=t.resolvedPairing,this.getTokenAt=t.getTokenAt,this.getCompositionState=t.getCompositionState}get pairStack(){return this.pairs}clear(){this.pairs.clear(),this.pendingPairOps.length=0}syncOnStateChange(t,e){this.pairs.size>0&&!e.mapping.isEmpty&&this.pairs.migrate(e.mapping);for(const n of this.pendingPairOps)"push"===n.kind?this.pairs.push(l(n.blockId,n.offset),n.char):this.pairs.take(n.blockId,n.offset);this.pendingPairOps.length=0;for(const n of e.steps){if("setBlockType"!==n.type)continue;const e=t.getBlock(n.blockId);e&&"code_block"===e.type||this.pairs.clearBlock(n.blockId)}}handleTextInput=(t,e)=>{this.pendingPairOps.length=0;const n=this.getCompositionState();if(!n)return null;if(n.isComposing)return null;if(!u(e.selection))return null;if(1!==t.length)return null;const o=e.selection,r=e.getBlock(o.anchor.blockId);if(!r||"code_block"!==r.type)return null;const c=this.tryDedentOnCloseBracket(e,r,t);if(c)return c;const i=function(t){const{state:e,char:n,config:o}=t;if(!u(e.selection))return{kind:"passthrough"};const r=e.selection,c=V.get(n);if(c&&!d(r)&&function(t,e){switch(e.surround){case"never":return!1;case"brackets":return"bracket"===t.kind;case"quotes":return"quote"===t.kind;case"languageDefined":return!0}}(c,o)){const e=function(t,e,n){const{state:o}=n,r=o.getBlockOrder(),c=h(e,r);return c.from.blockId!==c.to.blockId||c.from.blockId!==n.blockId?null:{kind:"wrap",open:t.open,close:t.close}}(c,r,t);if(e)return e}return d(r)?o.overtype&&function(t,e){if(!function(t){const e=V.get(t);return"quote"===e?.kind?e:F.get(t)}(e))return!1;const n=t.state.selection;if(!u(n))return!1;const o=s(t.block),r=n.anchor.offset;if(o[r]!==e)return!1;const c=t.pairStack.peek(t.blockId,r);return Boolean(c&&c.char===e)}(t,n)?{kind:"overtype"}:c&&function(t,e){const n="quote"===t.kind?e.config.quotes:e.config.brackets;if("never"===n)return!1;const o=e.state.selection;if(!u(o))return!0;const r=s(e.block),c=o.anchor.offset;if("quote"===t.kind&&"'"===t.open&&function(t,e){if(e<=0)return!1;const n=t[e-1];return!!n&&/[A-Za-z0-9_]/.test(n)}(r,c))return!1;if("always"===n)return!0;if("beforeWhitespace"===n)return function(t,e){if(e>=t.length)return!0;const n=t[e];return!n||!!/\s/.test(n)||!!F.has(n)}(r,c);if("quote"===t.kind){const t=e.getTokenAt(e.blockId,c);return!t||"string"!==t.type&&"comment"!==t.type}return!0}(c,t)?{kind:"pair",close:c.close}:{kind:"passthrough"}:{kind:"passthrough"}}({state:e,block:r,blockId:o.anchor.blockId,char:t,config:this.resolvedPairing,pairStack:this.pairs,getTokenAt:this.getTokenAt});switch(i.kind){case"pair":return this.buildAutoPairTransaction(e,o.anchor.blockId,i.close,t);case"overtype":return this.buildOvertypeTransaction(e,o.anchor.blockId);case"wrap":return this.buildWrapTransaction(e,o.anchor.blockId,i.open,i.close);case"passthrough":return null}};tryDedentOnCloseBracket(t,e,n){if("brackets"!==this.resolvedIndent.mode)return null;if("}"!==n&&"]"!==n&&")"!==n)return null;const o=t.selection;if(!u(o)||!d(o))return null;const r=s(e),c=o.anchor.offset;if(!function(t,e){const{start:n}=U(t,e);for(let o=n;o<e;o++){const e=t[o];if(" "!==e&&"\t"!==e)return!1}return!0}(r,c))return null;const{start:i}=U(r,c);if(i===c)return null;const a=o.anchor.blockId,l=this.findTrackedCloseAfter(r,c,n,a);if(null!==l)return t.transaction("input").deleteTextAt(a,i,l).setSelection(p(a,i+1)).build();const g=Z(r.slice(i,c),this.resolvedIndent.useSpaces,this.resolvedIndent.spaceCount);if(0===g.removed.length)return null;const f=c-g.removed.length;return t.transaction("input").deleteTextAt(a,f,c).insertText(a,f,n,[]).setSelection(p(a,f+1)).build()}findTrackedCloseAfter(t,e,n,o){for(let r=e;r<t.length;r++){const e=t[r];if(" "!==e&&"\t"!==e&&"\n"!==e){if(e===n){const t=this.pairs.peek(o,r);if(t&&t.char===n)return r}return null}}return null}buildAutoPairTransaction(t,e,n,o){const r=t.selection;if(!u(r))throw new Error("buildAutoPairTransaction requires a text selection");const c=r.anchor.offset,s=`${o}${n}`,i=t.transaction("input").insertText(e,c,s,[]).setSelection(p(e,c+1)).build();return this.pendingPairOps.push({kind:"push",blockId:e,offset:c+1,char:n}),i}buildOvertypeTransaction(t,e){const n=t.selection;if(!u(n))throw new Error("buildOvertypeTransaction requires a text selection");const o=n.anchor.offset;return this.pendingPairOps.push({kind:"take",blockId:e,offset:o}),t.transaction("input").setSelection(p(e,o+1)).build()}buildWrapTransaction(t,e,n,o){const r=t.selection;if(!u(r))throw new Error("buildWrapTransaction requires a text selection");const c=function(t,e){const n=h(t,e);return{fromOffset:n.from.offset,toOffset:n.to.offset}}(r,t.getBlockOrder()),s=h(r,t.getBlockOrder()).from===r.anchor,i=c.fromOffset+1,a=c.toOffset+1,l=s?i:a,d=s?a:i;return t.transaction("input").insertText(e,c.toOffset,o,[]).insertText(e,c.fromOffset,n,[]).setSelection({anchor:{blockId:e,offset:l},head:{blockId:e,offset:d}}).build()}};function Y(t,e){const n=t.getState();if(!u(n.selection))return!1;const o=n.selection,r=n.getBlock(o.anchor.blockId);return!(!r||"code_block"!==r.type)&&e({state:n,sel:o,block:r,blockId:o.anchor.blockId,offset:o.anchor.offset})}function tt(t,n,o,r){const c={Enter:()=>function(t,n){return Y(t,({state:o,block:r,blockId:c,offset:i})=>{if(!d(o.selection))return!1;const a=s(r);if(a.endsWith("\n")&&i===a.length)return function(t,n,o){const r=t.getState(),c=o.length-1,s=e(),i=r.transaction("input").deleteTextAt(n,c,o.length).splitBlock(n,c,s).setBlockType(s,k("paragraph")).setSelection(p(s,0)).build();return t.dispatch(i),!0}(t,c,a);const l=X(n.indent.useSpaces,n.indent.spaceCount);if("brackets"===n.indent.mode&&function(t,e){return function(t,e){if(e<=0||e>=t.length)return!1;const n=t[e-1],o=t[e];return!(!n||!o)&&W[o]===n}(t,e)}(a,i)){const e=J(a,i),n=`\n${e}${l}\n${e}`,r=i+1+e.length+l.length,s=o.transaction("input").insertText(c,i,n,[]).setSelection(p(c,r)).build();return t.dispatch(s),!0}const u=`\n${function(t,e,n,o){if("none"===n)return"";const r=J(t,e);return"keep"===n?r:function(t,e){const n=function(t,e){const{start:n}=U(t,e);for(let o=e-1;o>=n;o--){const e=t[o];if(e&&" "!==e&&"\t"!==e)return e}return""}(t,e);return K.has(n)}(t,e)?r+o:r}(a,i,n.indent.mode,l)}`,g=o.transaction("input").insertText(c,i,u,[]).setSelection(p(c,i+u.length)).build();return t.dispatch(g),!0})}(t,r),Backspace:()=>function(t,e){return Y(t,({state:n,block:o,blockId:r,offset:c})=>{if(!d(n.selection))return!1;if(e.pairing.deletePair&&c>0){const i=s(o),a=i[c-1],l=i[c];if(a&&l&&function(t,e){switch(t){case"(":return")"===e;case"[":return"]"===e;case"{":return"}"===e;case'"':case"'":case"`":return e===t;default:return!1}}(a,l)){const o=e.pairStack.peek(r,c);if(o&&o.char===l){const e=n.transaction("input").deleteTextAt(r,c-1,c+1).setSelection(p(r,c-1)).build();return t.dispatch(e),!0}}}if(0!==c)return!1;const i=n.transaction("input").setBlockType(r,k("paragraph")).setSelection(n.selection).build();return t.dispatch(i),!0})}(t,r),Tab:()=>function(t,e){return Y(t,({state:n,sel:o,block:r,blockId:c,offset:i})=>{const a=X(e.indent.useSpaces,e.indent.spaceCount);if(d(o)){const e=n.transaction("input").insertText(c,i,a,[]).setSelection(p(c,i+a.length)).build();return t.dispatch(e),!0}if(o.anchor.blockId!==c||o.head.blockId!==c)return!1;const l=s(r),u=h(o,n.getBlockOrder()),k=u.from.offset,b=u.to.offset;if(!l.slice(k,b).includes("\n")){const e=n.transaction("input").deleteTextAt(c,k,b).insertText(c,k,a,[]).setSelection(p(c,k+a.length)).build();return t.dispatch(e),!0}const m=function(t,e,n,o){const r=t.lastIndexOf("\n",e-1)+1,c=[];let s=0,i=r;for(;i<n;){c.push({offset:i,text:o}),s++;const e=t.indexOf("\n",i);if(-1===e||e>=n)break;i=e+1}return{inserts:c,totalInserted:s*o.length,lineCount:s,lineStart:r}}(l,k,b,a),v=n.transaction("input");for(let t=m.inserts.length-1;t>=0;t--){const e=m.inserts[t];e&&v.insertText(c,e.offset,e.text,[])}const x=g(o,n.getBlockOrder()),y=m.lineStart,C=b+m.totalInserted,S=x?y:C,w=x?C:y;return v.setSelection(f({blockId:c,offset:S},{blockId:c,offset:w})),t.dispatch(v.build()),m.lineCount>=2&&t.announce(e.locale().indentedNLines(m.lineCount)),!0})}(t,r),"Shift-Tab":()=>function(t,e){return Y(t,({state:n,sel:o,block:r,blockId:c,offset:i})=>{const a=s(r);if(d(o))return et(t,n,c,i,a,e);if(o.anchor.blockId!==c||o.head.blockId!==c)return!1;const l=h(o,n.getBlockOrder()),u=l.from.offset,p=l.to.offset;if(!a.slice(u,p).includes("\n"))return et(t,n,c,i,a,e);const k=function(t,e,n,o,r){const c=t.lastIndexOf("\n",e-1)+1,s=[];let i=0,a=0,l=c;for(;l<n;){a++;const e=Z(t.slice(l),o,r);e.removed.length>0&&(s.push({from:l,to:l+e.removed.length}),i+=e.removed.length);const c=t.indexOf("\n",l);if(-1===c||c>=n)break;l=c+1}return{deletes:s,totalRemoved:i,lineCount:a,lineStart:c}}(a,u,p,e.indent.useSpaces,e.indent.spaceCount);if(0===k.totalRemoved)return!0;const b=n.transaction("input");for(let t=k.deletes.length-1;t>=0;t--){const e=k.deletes[t];e&&b.deleteTextAt(c,e.from,e.to)}const m=g(o,n.getBlockOrder()),v=k.lineStart,x=p-k.totalRemoved,y=m?v:Math.max(v,x),C=m?Math.max(v,x):v;return b.setSelection(f({blockId:c,offset:y},{blockId:c,offset:C})),t.dispatch(b.build()),k.lineCount>=2&&t.announce(e.locale().dedentedNLines(k.lineCount)),!0})}(t,r),Escape:()=>nt(t),ArrowDown:()=>function(t){return Y(t,({state:e,block:n,blockId:o,offset:r})=>!!d(e.selection)&&-1===s(n).indexOf("\n",r)&&(rt(t,e,o),!0))}(t),ArrowUp:()=>function(t){return Y(t,({state:e,block:n,blockId:o,offset:r})=>{if(!d(e.selection))return!1;const c=s(n).indexOf("\n");return!(-1!==c&&r>c)&&ct(t,e,o)})}(t),ArrowRight:()=>function(t){return Y(t,({state:e,block:n,blockId:o,offset:r})=>!!d(e.selection)&&r===s(n).length&&(rt(t,e,o),!0))}(t),ArrowLeft:()=>function(t){return Y(t,({state:e,blockId:n,offset:o})=>!!d(e.selection)&&0===o&&ct(t,e,n))}(t)},{insertAfter:i,toggle:a}=o;i&&(c[i]=()=>function(t){return Y(t,({blockId:e})=>(ot(t,e),!0))}(t)),a&&(c[a]=()=>t.executeCommand("toggleCodeBlock")),t.registerKeymap(c,{priority:"context"})}function et(t,e,n,o,r,c){const{start:s}=U(r,o),i=Z(r.slice(s),c.indent.useSpaces,c.indent.spaceCount);if(0===i.removed.length)return!0;const a=e.transaction("input").deleteTextAt(n,s,s+i.removed.length).setSelection(p(n,Math.max(s,o-i.removed.length))).build();return t.dispatch(a),!0}function nt(t){return Y(t,({state:e,blockId:n})=>(rt(t,e,n),!0))}function ot(t,n){const o=t.getState(),r=o.getBlock(n);if(!r)return;const c=i(r),s=e(),a=o.transaction("command").splitBlock(n,c,s).setBlockType(s,k("paragraph")).setSelection(p(s,0)).build();t.dispatch(a)}function rt(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<o.length-1){const n=o[r+1],c=e.transaction("command").setSelection(p(n,0)).build();return void t.dispatch(c)}ot(t,n)}function ct(t,e,n){const o=e.getBlockOrder(),r=o.indexOf(n);if(r<=0)return!1;const c=o[r-1],s=e.getBlock(c),a=s?i(s):0,l=e.transaction("command").setSelection(p(c,a)).build();return t.dispatch(l),!0}function st(t,e){const o=t.getState(),c=o.selection;if(!u(c))return!1;const s=o.getBlock(c.anchor.blockId);if(!s||"code_block"===s.type)return!1;const a={language:e.defaultLanguage??"",backgroundColor:""},l=o.transaction("command");return function(t,e){if(0===i(e))return;const o=n(e);let c=0;for(const n of o)if(r(n)){if(n.text.length>0)for(const o of n.marks)t.removeMark(e.id,c,c+n.text.length,o);c+=n.text.length}else c+=1}(l,s),l.setBlockType(c.anchor.blockId,k("code_block"),a).setSelection(p(c.anchor.blockId,0)),t.dispatch(l.build()),!0}function it(t,n){const r=a(t.doc,n);if(!r)return null;const s=y(r),i=b(t,s),l=m(i,n);if(l<0)return null;const d=t.transaction("command");if(1===i.length){const t=e();return d.insertNode(s,0,c(t)),d.removeNode(s,1),d.setSelection(p(t,0)),d.build()}d.removeNode(s,l);const u=function(t,n,r,s){const i=r[s-1];if(i&&o(i)){const e=v(t,i.id,"end");if(e)return e}const a=r[s+1];if(a&&o(a)){const e=v(t,a.id,"start");if(e)return e}const l=r[s],d=l&&o(l)?l.id:void 0,u=x(t,"start",d);if(u)return u;const g=e();return n.insertNode([],0,c(g)),p(g,0)}(t,d,i,l);return d.setSelection(u),d.build()}var at=class{bundles=/* @__PURE__ */new Map;listeners=[];register(t){this.bundles.set(t.id,t);for(const e of this.listeners)e(t)}onRegister(t){this.listeners.push(t);for(const e of this.bundles.values())t(e)}get(t){return this.bundles.get(t)}getAll(){return[...this.bundles.values()]}},lt={insertAfter:"Mod-Enter",toggle:"Mod-Shift-M"},dt={defaultLanguage:"",useSpaces:!1,spaceCount:2,showCopyButton:!0},ut=new B("codeBlock"),gt=new B("syntaxHighlighter"),pt=class{languageMap=/* @__PURE__ */new Map;constructor(t){if(t)for(const e of t)this.registerLanguageInternal(e)}registerLanguage(t){this.registerLanguageInternal(t)}tokenize(t,e){const n=this.languageMap.get(e.toLowerCase());if(!n)return[];const o=[];for(const r of N(t,n))o.push({from:r.from,to:r.to,type:r.type});return o}getSupportedLanguages(){const t=/* @__PURE__ */new Set;for(const e of this.languageMap.values()){t.add(e.name);for(const n of e.aliases)t.add(n)}return[...t]}registerLanguageInternal(t){this.languageMap.set(t.name.toLowerCase(),t);for(const e of t.aliases)this.languageMap.set(e.toLowerCase(),t)}},ft=[{id:E.name,displayName:"Java",aliases:E.aliases,highlighting:E},{id:$.name,displayName:"JSON",aliases:$.aliases,highlighting:$},{id:j.name,displayName:"TypeScript",aliases:j.aliases,highlighting:j},{id:q.name,displayName:"XML",aliases:q.aliases,highlighting:q}],ht={label:"Code Block",tooltip:t=>t?`Code Block (${t})`:"Code Block",enteredCodeBlock:"Entered code block. Press Escape to exit.",leftCodeBlock:"Left code block.",copyCodeAria:"Copy code",escToExit:"Esc to exit",codeBlockAriaLabel:t=>`${t} code block. Press Escape to exit.`,copiedToClipboard:"Copied to clipboard",copyFailed:"Failed to copy code",deleteCodeBlockAria:"Delete code block",deletedCodeBlock:"Code block deleted",selectLanguageAria:"Select language",languageChanged:t=>`Language changed to ${t}`,plainText:"plain",indentedNLines:t=>1===t?"1 line indented":`${t} lines indented`,dedentedNLines:t=>1===t?"1 line dedented":`${t} lines dedented`},kt=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--Isa9OHJ.mjs"),"./locales/de.ts":()=>import("./de-Dl4QFHMa.mjs"),"./locales/es.ts":()=>import("./es-DD01rZ6N.mjs"),"./locales/fr.ts":()=>import("./fr-CfhyYN-t.mjs"),"./locales/hi.ts":()=>import("./hi-B2YB3Bo4.mjs"),"./locales/pt.ts":()=>import("./pt-DYMyMgKQ.mjs"),"./locales/ru.ts":()=>import("./ru-l73diFXn.mjs"),"./locales/zh.ts":()=>import("./zh-Baxh6v0j.mjs")});async function bt(t){return A(kt,t,ht)}var mt='[role="option"]';function vt(t,e,n,o){const r=document.createElement("div");r.className="notectl-language-picker__option",r.setAttribute("role","option"),r.setAttribute("data-language",n),r.setAttribute("aria-selected",String(o)),r.setAttribute("tabindex",o?"0":"-1"),r.textContent=e,t.appendChild(r)}function xt(t,e,n,o){const r=t.getState(),c=r.getBlock(e);if(!c||"code_block"!==c.type)return;const s=r.getNodePath(e);if(!s)return;const i={...c.attrs,[n]:o},a=r.transaction("command").setNodeAttr(s,i).build();t.dispatch(a)}var yt=class{entries=/* @__PURE__ */new Map;getTokens(t,e,n,o){const r=this.entries.get(t);if(r&&r.text===e&&r.language===n)return r.tokens;const c=o?.tokenize(e,n)??[];return this.entries.set(t,{text:e,language:n,tokens:c}),c}findTokenAt(t,e){const n=this.entries.get(t);if(!n)return;const o=n.tokens;let r=0,c=o.length-1;for(;r<=c;){const t=r+c>>>1,n=o[t];if(!n)return;if(e<n.from)c=t-1;else{if(!(e>=n.to))return n;r=t+1}}}retain(t){for(const e of this.entries.keys())t.has(e)||this.entries.delete(e)}clear(){this.entries.clear()}},Ct=class{id="code-block";name="Code Block";priority=36;config;resolvedIndent;resolvedPairing;resolvedKeymap;context=null;locale;highlighter=null;tokenCache=new yt;autoPair;constructor(t){this.config={...dt,...t},this.resolvedIndent=function(t){const e=t.indent?.useSpaces??t.useSpaces??false,n=t.indent?.spaceCount??t.spaceCount??2,o=Math.max(1,Math.min(16,Math.trunc(n)));return{mode:t.indent?.mode??"brackets",useSpaces:e,spaceCount:o}}(this.config),this.resolvedPairing=function(t){const e=t.pairing;return{brackets:e?.brackets??"languageDefined",quotes:e?.quotes??"languageDefined",overtype:e?.overtype??true,deletePair:e?.deletePair??true,surround:e?.surround??"languageDefined"}}(this.config),this.resolvedKeymap={...lt,...t?.keymap},this.autoPair=new Q({resolvedIndent:this.resolvedIndent,resolvedPairing:this.resolvedPairing,getTokenAt:(t,e)=>this.tokenCache.findTokenAt(t,e),getCompositionState:()=>this.context?.getCompositionState()??null})}async init(e){this.locale=await T(e,this.config.locale,ht,bt),e.registerStyleSheet(H),this.context=e,this.highlighter=function(t,e,n){const o=e.highlighter??new pt,r=/* @__PURE__ */new Map,c=new at;c.onRegister(t=>{const e=t.highlighting;e&&o.registerLanguage&&r.get(t.id)!==e&&(o.registerLanguage(e),r.set(t.id,e),n.clear())}),t.registerService(z,c);for(const s of ft)c.register(s);return t.registerService(gt,{registerLanguage:t=>{o.registerLanguage?.(t),n.clear()},getSupportedLanguages:()=>o.getSupportedLanguages(),tokenize:(t,e)=>o.tokenize(t,e),getTokenAt:(t,e)=>n.findTokenAt(t,e)}),o}(e,this.config,this.tokenCache),function(e){e.registerNodeSpec({type:"code_block",group:"block",content:{allow:["text"]},selectable:!0,attrs:{language:{default:""},backgroundColor:{default:""}},toDOM(t){const e=M("pre",t.id);e.className="notectl-code-block",e.setAttribute("dir","ltr"),e.setAttribute("part","code-block");const n=document.createElement("code");return n.className="notectl-code-block__content",n.setAttribute("part","code-block-content"),e.appendChild(n),e},toHTML(e,n,o){const r=t(e.attrs?.language??""),c=t(e.attrs?.backgroundColor??""),s=r?` class="language-${r}"`:"";return`<pre dir="ltr"${c?o?.styleAttr(`background-color: ${c}`)??` style="background-color: ${c}"`:""}><code${s}>${n||""}</code></pre>`},parseHTML:[{tag:"pre",getAttrs(t){const e=t.querySelector("code"),n=e?.className.match(/language-(\S+)/)?.[1]??"";return{language:(e?.getAttribute("data-language")??"")||n}}}],sanitize:{tags:["pre","code"],attrs:["data-language","class","style"]}})}(e),this.registerNodeView(e),function(t,e){t.registerCommand("toggleCodeBlock",()=>function(t,e){const n=t.getState();if(!u(n.selection))return!1;const o=n.getBlock(n.selection.anchor.blockId);if(!o)return!1;if("code_block"===o.type){const e=n.transaction("command").setBlockType(n.selection.anchor.blockId,k("paragraph")).setSelection(n.selection).build();return t.dispatch(e),!0}return st(t,e)}(t,e)),t.registerCommand("insertCodeBlock",()=>st(t,e)),t.registerCommand("setCodeBlockLanguage",()=>!1),t.registerCommand("setCodeBlockBackground",()=>!1),t.registerCommand("exitCodeBlock",()=>nt(t)),t.registerCommand("deleteCodeBlock",()=>function(t){const e=t.getState();if(!u(e.selection))return!1;const n=e.getBlock(e.selection.anchor.blockId);if(!n||"code_block"!==n.type)return!1;const o=it(e,n.id);return!!o&&(t.dispatch(o),!0)}(t))}(e,this.config),tt(e,this.config,this.resolvedKeymap,{indent:this.resolvedIndent,pairing:this.resolvedPairing,pairStack:this.autoPair.pairStack,locale:()=>this.locale}),!1!==this.config.inputRule&&function(t){t.registerInputRule({pattern:/^```(\w*) $/,handler:(t,e,n,o)=>{const r=t.selection;if(!u(r))return null;if(!d(r))return null;const c=t.getBlock(r.anchor.blockId);if(!c||"paragraph"!==c.type)return null;const s={language:e[1]??"",backgroundColor:""};return t.transaction("input").deleteTextAt(r.anchor.blockId,n,n+e[0].length).setBlockType(r.anchor.blockId,k("code_block"),s).setSelection(p(r.anchor.blockId,0)).build()}})}(e),function(t,e,n){t.registerToolbarItem({id:"code_block",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"/><path d="M11 14.17L8.83 12 11 9.83 9.59 8.41 6 12l3.59 3.59L11 14.17zm3.41 1.42L18 12l-3.59-3.59L13 9.83 15.17 12 13 14.17l1.41 1.42z"/></svg>',label:e.label,tooltip:e.tooltip(n?O(n):void 0),command:"toggleCodeBlock",isActive:t=>!!u(t.selection)&&"code_block"===t.getBlock(t.selection.anchor.blockId)?.type})}(e,this.locale,this.resolvedKeymap.toggle),function(t){t.registerMiddleware((t,e,n)=>{if(!t.steps.some(t=>"addMark"===t.type&&"code_block"===e.getBlock(t.blockId)?.type))return void n(t);const o=t.steps.filter(t=>"addMark"!==t.type||"code_block"!==e.getBlock(t.blockId)?.type);n({...t,steps:o})},{name:"code-block:mark-guard",priority:50})}(e),function(t,e,n){t.registerService(ut,{setLanguage(e,n){xt(t,e,"language",n)},getLanguage(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.language??"":""},setBackground(e,n){xt(t,e,"backgroundColor",n)},getBackground(t){const e=n();if(!e)return"";const o=e.getState().getBlock(t);return o&&"code_block"===o.type?o.attrs?.backgroundColor??"":""},isCodeBlock(t){const e=n();return!!e&&"code_block"===e.getState().getBlock(t)?.type},getSupportedLanguages(){const t=e();return t?t.getSupportedLanguages():[]}})}(e,()=>this.highlighter,()=>this.context),function(t){t.registerPasteInterceptor((t,e,n)=>{if(!t)return null;if(!u(n.selection))return null;const o=n.getBlock(n.selection.anchor.blockId);if(!o||"code_block"!==o.type)return null;const r=n.transaction("paste");let c=n.selection.anchor.blockId,s=n.selection.anchor.offset;if(!d(n.selection)){const t=C(n,r);t&&(c=t,s=0)}return r.insertText(c,s,t,[]),r.setSelection(p(c,s+t.length)),r.build()},{name:"code-block:paste",priority:10})}(e),e.registerTextInputInterceptor(this.autoPair.handleTextInput,{name:"code-block:auto-pair",priority:10}),function(t){t.registerNodeSpecExtension("table_cell",t=>!t.content||t.content.allow.includes("code_block")?t:{...t,content:{...t.content,allow:[...t.content.allow,"code_block"]}})}(e)}destroy(){this.context=null,this.highlighter=null,this.tokenCache.clear(),this.autoPair.clear()}onStateChange(t,e,n){if(this.autoPair.syncOnStateChange(e,n),!this.context)return;const o=u(t.selection)?t.selection.anchor.blockId:null,r=u(e.selection)?e.selection.anchor.blockId:null,c=o?t.getBlock(o):void 0,s=r?e.getBlock(r):void 0,i="code_block"===c?.type,a="code_block"===s?.type;!i&&a?this.context.announce(this.locale.enteredCodeBlock):i&&!a&&this.context.announce(this.locale.leftCodeBlock)}decorations(t){return function(t,e){const n=[],o=function(t){if(!u(t.selection))return null;const e=t.selection.anchor.blockId;return"code_block"===t.getBlock(e)?.type?e:null}(t);if(o&&n.push(S(o,{class:"notectl-code-block--focused"})),e.highlighter){const o=/* @__PURE__ */new Set;for(const r of t.getBlockOrder()){const c=t.getBlock(r);if(!c||"code_block"!==c.type)continue;const i=c.attrs?.language??"";if(!i)continue;const a=s(c);if(!a)continue;o.add(r);const l=e.tokenCache.getTokens(r,a,i,e.highlighter);for(const t of l)n.push(w(r,t.from,t.to,{class:`notectl-token--${t.type}`}))}e.tokenCache.retain(o)}return 0===n.length?I.empty:I.create(n)}(t,{highlighter:this.highlighter,tokenCache:this.tokenCache})}registerNodeView(t){const e=new P(t.getContainer()),n=this.highlighter,o={popupManager:e,getSupportedLanguages:()=>n?.getSupportedLanguages()??[]};t.registerNodeView("code_block",function(t,e=ht,n){return(o,r,c)=>{const i=document.createElement("pre");i.className="notectl-code-block",i.setAttribute("data-block-id",o.id),i.setAttribute("dir","ltr"),i.setAttribute("role","group"),i.setAttribute("aria-roledescription","code block"),i.setAttribute("part","code-block");const a=document.createElement("div");a.className="notectl-code-block__header",a.setAttribute("contenteditable","false"),a.setAttribute("part","code-block-header");const l=document.createElement("button");l.className="notectl-code-block__language-btn",l.type="button",l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-expanded","false"),l.setAttribute("aria-label",e.selectLanguageAria);let d=null;!1!==t.showCopyButton&&(d=document.createElement("button"),d.className="notectl-code-block__copy",d.setAttribute("aria-label",e.copyCodeAria),d.setAttribute("data-notectl-no-print",""),d.type="button",d.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>');const u=document.createElement("button");u.className="notectl-code-block__delete",u.setAttribute("aria-label",e.deleteCodeBlockAria),u.title=e.deleteCodeBlockAria,u.setAttribute("data-notectl-no-print",""),u.type="button",u.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="14" height="14"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>';const g=document.createElement("span");g.className="notectl-sr-only",g.setAttribute("aria-live","assertive"),g.setAttribute("aria-atomic","true");const p=document.createElement("div");p.className="notectl-code-block__actions",d&&p.appendChild(d),p.appendChild(u),a.appendChild(l),a.appendChild(p),a.appendChild(g);const f=document.createElement("code");f.className="notectl-code-block__content",f.setAttribute("part","code-block-content");const h=document.createElement("div");h.className="notectl-code-block__esc-hint",h.setAttribute("contenteditable","false"),h.setAttribute("aria-hidden","true"),h.setAttribute("data-notectl-no-print",""),h.textContent=e.escToExit,i.appendChild(a),i.appendChild(f),i.appendChild(h),t.background&&L(i,"--notectl-code-block-bg",t.background),t.headerBackground&&L(i,"--notectl-code-block-header-bg",t.headerBackground),t.textColor&&L(i,"--notectl-code-block-color",t.textColor),t.headerColor&&L(i,"--notectl-code-block-header-color",t.headerColor);let k=o.id;function b(t){const o=t.attrs?.language??"",r=o||e.plainText;l.innerHTML="";const c=document.createElement("span");if(c.className="notectl-code-block__language",c.textContent=r,l.appendChild(c),n){const t=document.createElement("span");t.className="notectl-code-block__chevron",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="10" height="10"><path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',l.appendChild(t)}i.setAttribute("aria-label",e.codeBlockAriaLabel(r)),o?f.setAttribute("data-language",o):f.removeAttribute("data-language");const s=t.attrs?.backgroundColor??"";L(i,"backgroundColor",s||"")}function m(t){g.textContent=t,setTimeout(()=>{g.textContent=""},1e3)}return b(o),d&&d.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=r().getBlock(k);n&&function(t){const e=globalThis.navigator?.clipboard;return e&&"function"==typeof e.writeText?e.writeText(t):Promise.reject(/* @__PURE__ */new Error("Clipboard API unavailable"))}(s(n)).then(()=>m(e.copiedToClipboard),()=>m(e.copyFailed))}),u.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=it(r(),k);n&&(g.textContent=e.deletedCodeBlock,c(n))}),n&&l.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const o=r().getBlock(k);if(!o)return;const s=o.attrs?.language??"";!function(t){const{anchor:e,languages:n,currentLanguage:o,onSelect:r,popupManager:c,locale:s}=t;c.open({anchor:e,ariaRole:"listbox",ariaLabel:s.selectLanguageAria,className:"notectl-language-picker",position:"below-start",restoreFocusTo:e,content(t,e){const c=o.toLowerCase();vt(t,s.plainText,"",""===c);const i=[...n].sort((t,e)=>t.localeCompare(e));for(const n of i)vt(t,n,n,c===n.toLowerCase());D({container:t,itemSelector:mt,onSelect(t){const n=t.getAttribute("data-language")??"";r(n),e()},onClose(){e()}}),t.addEventListener("click",t=>{const n=t.target.closest(mt);if(!n)return;const o=n.getAttribute("data-language")??"";r(o),e()})},onClose(){e.setAttribute("aria-expanded","false")}}),e.setAttribute("aria-expanded","true")}({anchor:l,languages:n.getSupportedLanguages(),currentLanguage:s,locale:e,popupManager:n.popupManager,onSelect(t){if(t===s)return;const n=r(),o=n.getBlock(k);if(!o)return;const i=n.getNodePath(k);if(!i)return;const a={...o.attrs,language:t};c(n.transaction("command").setNodeAttr(i,a).build());const l=t||e.plainText;m(e.languageChanged(l))}})}),{dom:i,contentDOM:f,update:t=>"code_block"===t.type&&(k=t.id,i.setAttribute("data-block-id",t.id),b(t),!0),selectNode(){i.classList.add("notectl-code-block--selected")},deselectNode(){i.classList.remove("notectl-code-block--selected")},destroy(){}}}}(this.config,this.locale,o))}};export{ut as a,pt as i,ht as n,gt as o,bt as r,Ct as t};
|
|
2
|
-
//# sourceMappingURL=CodeBlockPlugin-BandNM3t.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./TypeBrands-Ch9856Gb.mjs";import{i as t,n as o,t as r}from"./AttributedMarkCommands-B3MQdob_.mjs";import{t as a}from"./ColorValidation-B9d_umnf.mjs";import{t as n}from"./ColorGrid-DAs0--ty.mjs";function s(e,t){return o(e,t,e=>e.attrs.color??null)}function i(e,t){return null!==s(e,t)}function l(t,o,n,s){if(!a(s))return!1;const i={type:e(n),attrs:{color:s}},l=r(o,i);return!!l&&(t.dispatch(l),!0)}function c(o,r,a){const n=t(r,e(a));return!!n&&(o.dispatch(n),!0)}function m(e,t,o){e.classList.add("notectl-color-picker");const r=s(t.getState(),o.markType),a=o.columns||10,i=t.getContainer(),c=document.createElement("button");c.type="button",c.className="notectl-color-picker__default",c.textContent=o.resetLabel,c.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),c.addEventListener("click",()=>{t.executeCommand(o.resetCommand),o.onClose({restoreFocusTo:i})}),c.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),o.onClose())}),e.appendChild(c),n(e,{colors:o.colors,columns:a,ariaLabel:`${o.ariaLabelPrefix} color picker`,ariaLabelPrefix:o.ariaLabelPrefix,activeColor:r,onSelect:e=>{l(t,t.getState(),o.markType,e),o.onClose({restoreFocusTo:i})},onClose:o.onClose})}export{c as a,i,l as n,s as r,m as t};
|
|
2
|
-
//# sourceMappingURL=ColorPickerPopup-CFYCCN7m.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorValidation-B9d_umnf.mjs","names":[],"sources":["../../src/plugins/shared/ColorValidation.ts"],"sourcesContent":["/**\n * Shared CSS validation and normalization utilities\n * for style-based mark plugins (TextColor, Highlight, Font, FontSize).\n */\n\nconst HEX_COLOR_PATTERN: RegExp = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/** Returns `true` when the value is a valid `#RGB` or `#RRGGBB` hex color. */\nexport function isValidHexColor(value: string): boolean {\n\treturn HEX_COLOR_PATTERN.test(value);\n}\n\n// --- CSS Color Validation (broad format support for paste / API input) ---\n\n/** Matches `rgb(r, g, b)` and `rgba(r, g, b, a)` with integer or percentage values. */\nconst RGB_PATTERN: RegExp =\n\t/^rgba?\\(\\s*(\\d{1,3}%?\\s*,\\s*){2}\\d{1,3}%?(\\s*,\\s*(0|1|0?\\.\\d+))?\\s*\\)$/;\n\n/** Matches `hsl(h, s%, l%)` and `hsla(h, s%, l%, a)`. */\nconst HSL_PATTERN: RegExp =\n\t/^hsla?\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}%\\s*,\\s*\\d{1,3}%(\\s*,\\s*(0|1|0?\\.\\d+))?\\s*\\)$/;\n\n/**\n * Complete set of CSS Level 4 named colors (including `transparent`).\n * Used as an allowlist — unknown names are rejected.\n */\nconst CSS_NAMED_COLORS: ReadonlySet<string> = new Set([\n\t'aliceblue',\n\t'antiquewhite',\n\t'aqua',\n\t'aquamarine',\n\t'azure',\n\t'beige',\n\t'bisque',\n\t'black',\n\t'blanchedalmond',\n\t'blue',\n\t'blueviolet',\n\t'brown',\n\t'burlywood',\n\t'cadetblue',\n\t'chartreuse',\n\t'chocolate',\n\t'coral',\n\t'cornflowerblue',\n\t'cornsilk',\n\t'crimson',\n\t'cyan',\n\t'darkblue',\n\t'darkcyan',\n\t'darkgoldenrod',\n\t'darkgray',\n\t'darkgreen',\n\t'darkgrey',\n\t'darkkhaki',\n\t'darkmagenta',\n\t'darkolivegreen',\n\t'darkorange',\n\t'darkorchid',\n\t'darkred',\n\t'darksalmon',\n\t'darkseagreen',\n\t'darkslateblue',\n\t'darkslategray',\n\t'darkslategrey',\n\t'darkturquoise',\n\t'darkviolet',\n\t'deeppink',\n\t'deepskyblue',\n\t'dimgray',\n\t'dimgrey',\n\t'dodgerblue',\n\t'firebrick',\n\t'floralwhite',\n\t'forestgreen',\n\t'fuchsia',\n\t'gainsboro',\n\t'ghostwhite',\n\t'gold',\n\t'goldenrod',\n\t'gray',\n\t'green',\n\t'greenyellow',\n\t'grey',\n\t'honeydew',\n\t'hotpink',\n\t'indianred',\n\t'indigo',\n\t'ivory',\n\t'khaki',\n\t'lavender',\n\t'lavenderblush',\n\t'lawngreen',\n\t'lemonchiffon',\n\t'lightblue',\n\t'lightcoral',\n\t'lightcyan',\n\t'lightgoldenrodyellow',\n\t'lightgray',\n\t'lightgreen',\n\t'lightgrey',\n\t'lightpink',\n\t'lightsalmon',\n\t'lightseagreen',\n\t'lightskyblue',\n\t'lightslategray',\n\t'lightslategrey',\n\t'lightsteelblue',\n\t'lightyellow',\n\t'lime',\n\t'limegreen',\n\t'linen',\n\t'magenta',\n\t'maroon',\n\t'mediumaquamarine',\n\t'mediumblue',\n\t'mediumorchid',\n\t'mediumpurple',\n\t'mediumseagreen',\n\t'mediumslateblue',\n\t'mediumspringgreen',\n\t'mediumturquoise',\n\t'mediumvioletred',\n\t'midnightblue',\n\t'mintcream',\n\t'mistyrose',\n\t'moccasin',\n\t'navajowhite',\n\t'navy',\n\t'oldlace',\n\t'olive',\n\t'olivedrab',\n\t'orange',\n\t'orangered',\n\t'orchid',\n\t'palegoldenrod',\n\t'palegreen',\n\t'paleturquoise',\n\t'palevioletred',\n\t'papayawhip',\n\t'peachpuff',\n\t'peru',\n\t'pink',\n\t'plum',\n\t'powderblue',\n\t'purple',\n\t'rebeccapurple',\n\t'red',\n\t'rosybrown',\n\t'royalblue',\n\t'saddlebrown',\n\t'salmon',\n\t'sandybrown',\n\t'seagreen',\n\t'seashell',\n\t'sienna',\n\t'silver',\n\t'skyblue',\n\t'slateblue',\n\t'slategray',\n\t'slategrey',\n\t'snow',\n\t'springgreen',\n\t'steelblue',\n\t'tan',\n\t'teal',\n\t'thistle',\n\t'tomato',\n\t'transparent',\n\t'turquoise',\n\t'violet',\n\t'wheat',\n\t'white',\n\t'whitesmoke',\n\t'yellow',\n\t'yellowgreen',\n]);\n\n/**\n * Returns `true` when `value` is a safe CSS color value.\n * Accepts hex (`#RGB`, `#RRGGBB`), `rgb()`, `rgba()`, `hsl()`, `hsla()`,\n * and CSS named colors. Rejects anything else — defense against CSS injection\n * via manipulated color values in `style` attributes.\n */\nexport function isValidCSSColor(value: string): boolean {\n\tif (!value) return false;\n\tconst trimmed: string = value.trim().toLowerCase();\n\tif (!trimmed) return false;\n\n\treturn (\n\t\tHEX_COLOR_PATTERN.test(trimmed) ||\n\t\tRGB_PATTERN.test(trimmed) ||\n\t\tHSL_PATTERN.test(trimmed) ||\n\t\tCSS_NAMED_COLORS.has(trimmed)\n\t);\n}\n\n/**\n * Validates, deduplicates, and normalizes a user-supplied color list.\n * Returns `fallbackPalette` when no custom colors are provided.\n *\n * @throws {Error} if any value is not a valid hex color code.\n */\nexport function resolveColors(\n\tcolors: readonly string[] | undefined,\n\tfallbackPalette: readonly string[],\n\tpluginName: string,\n): readonly string[] {\n\tif (!colors || colors.length === 0) return fallbackPalette;\n\n\tconst invalid: string[] = colors.filter((c) => !isValidHexColor(c));\n\tif (invalid.length > 0) {\n\t\tthrow new Error(\n\t\t\t`${pluginName}: invalid hex color(s): ${invalid.join(', ')}. Expected format: #RGB or #RRGGBB.`,\n\t\t);\n\t}\n\n\tconst seen: Set<string> = new Set();\n\tconst unique: string[] = [];\n\tfor (const color of colors) {\n\t\tconst normalized: string = color.toLowerCase();\n\t\tif (!seen.has(normalized)) {\n\t\t\tseen.add(normalized);\n\t\t\tunique.push(normalized);\n\t\t}\n\t}\n\treturn unique;\n}\n\n// --- Font Family Validation ---\n\n/** Characters that are never valid in a CSS font-family value. */\nconst FONT_FAMILY_FORBIDDEN: RegExp = /[{}<>;]|url\\(|expression\\(/i;\n\n/**\n * Returns `true` when `value` is a safe CSS `font-family` value.\n * Rejects values containing `{`, `}`, `;`, `<`, `>`, `url(`, or `expression(`\n * to defend against CSS injection.\n */\nexport function isValidCSSFontFamily(value: string): boolean {\n\tif (!value) return false;\n\tconst trimmed: string = value.trim();\n\tif (!trimmed) return false;\n\treturn !FONT_FAMILY_FORBIDDEN.test(trimmed);\n}\n\n// --- Font Size Validation ---\n\n/** Matches valid CSS font-size values: number with unit (px, pt, em, rem, %). */\nconst FONT_SIZE_PATTERN: RegExp = /^\\d+(\\.\\d+)?(px|pt|em|rem|%)$/i;\n\n/**\n * Returns `true` when `value` is a safe CSS `font-size` value.\n * Accepts values like `16px`, `1.5em`, `12pt`, `100%`, `0.875rem`.\n */\nexport function isValidCSSFontSize(value: string): boolean {\n\tif (!value) return false;\n\treturn FONT_SIZE_PATTERN.test(value.trim());\n}\n"],"mappings":"AAKA,IAAM,EAA4B,gCAGlC,SAAgB,EAAgB,GAC/B,OAAO,EAAkB,KAAK,EAC/B,CAKA,IAAM,EACL,yEAGK,EACL,gFAMK,iBAAwC,IAAI,IAAI,CACrD,YACA,eACA,OACA,aACA,QACA,QACA,SACA,QACA,iBACA,OACA,aACA,QACA,YACA,YACA,aACA,YACA,QACA,iBACA,WACA,UACA,OACA,WACA,WACA,gBACA,WACA,YACA,WACA,YACA,cACA,iBACA,aACA,aACA,UACA,aACA,eACA,gBACA,gBACA,gBACA,gBACA,aACA,WACA,cACA,UACA,UACA,aACA,YACA,cACA,cACA,UACA,YACA,aACA,OACA,YACA,OACA,QACA,cACA,OACA,WACA,UACA,YACA,SACA,QACA,QACA,WACA,gBACA,YACA,eACA,YACA,aACA,YACA,uBACA,YACA,aACA,YACA,YACA,cACA,gBACA,eACA,iBACA,iBACA,iBACA,cACA,OACA,YACA,QACA,UACA,SACA,mBACA,aACA,eACA,eACA,iBACA,kBACA,oBACA,kBACA,kBACA,eACA,YACA,YACA,WACA,cACA,OACA,UACA,QACA,YACA,SACA,YACA,SACA,gBACA,YACA,gBACA,gBACA,aACA,YACA,OACA,OACA,OACA,aACA,SACA,gBACA,MACA,YACA,YACA,cACA,SACA,aACA,WACA,WACA,SACA,SACA,UACA,YACA,YACA,YACA,OACA,cACA,YACA,MACA,OACA,UACA,SACA,cACA,YACA,SACA,QACA,QACA,aACA,SACA,gBASD,SAAgB,EAAgB,GAC/B,IAAK,EAAO,OAAO,EACnB,MAAM,EAAkB,EAAM,OAAO,cACrC,QAAK,IAGJ,EAAkB,KAAK,IACvB,EAAY,KAAK,IACjB,EAAY,KAAK,IACjB,EAAiB,IAAI,GAEvB,CAQA,SAAgB,EACf,EACA,EACA,GAEA,IAAK,GAA4B,IAAlB,EAAO,OAAc,OAAO,EAE3C,MAAM,EAAoB,EAAO,OAAQ,IAAO,EAAgB,IAChE,GAAI,EAAQ,OAAS,EACpB,MAAM,IAAI,MACT,GAAG,4BAAqC,EAAQ,KAAK,4CAIvD,MAAM,iBAAoB,IAAI,IACxB,EAAmB,GACzB,IAAK,MAAM,KAAS,EAAQ,CAC3B,MAAM,EAAqB,EAAM,cAC5B,EAAK,IAAI,KACb,EAAK,IAAI,GACT,EAAO,KAAK,GAEd,CACA,OAAO,CACR,CAKA,IAAM,EAAgC,8BAOtC,SAAgB,EAAqB,GACpC,IAAK,EAAO,OAAO,EACnB,MAAM,EAAkB,EAAM,OAC9B,QAAK,IACG,EAAsB,KAAK,EACpC,CAKA,IAAM,EAA4B,iCAMlC,SAAgB,EAAmB,GAClC,QAAK,GACE,EAAkB,KAAK,EAAM,OACrC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{A as t,B as o,D as e,E as n,N as r,g as c,h as i,k as s}from"./Document-D_2cIBJG.mjs";import{r as l}from"./NodeResolver-BtIknXqD.mjs";import{c as f,d,f as u,i as a,n as k,o as b,p as m,u as I}from"./Selection-DC6AOGgF.mjs";import{r as h}from"./TypeBrands-Ch9856Gb.mjs";import{i as g,n as p,o as x,r as B}from"./NavigationQueries-Bt4zZ17v.mjs";import{T as S,b as O,w as A,x as N}from"./BlockInsertion-O5pAFKid.mjs";import{t as T}from"./CursorMarks-dx51OGBf.mjs";import{n as v,r as j,t as w}from"./NodeSelectionCommands-DK3iEh18.mjs";function M(t,o){if("after"===o.side)return _(t,o);const e=t.getBlockOrder(),n=e.indexOf(o.blockId);if(n<=0)return null;const r=e[n-1];if(!r)return null;if(g(t,r)){const o=l(t.doc,r)??[];return t.transaction("input").setSelection(a(r,o)).build()}const c=t.getBlock(r);if(!c)return null;const i=s(c);return t.transaction("input").setSelection(k(r,i)).build()}function y(t,o){if("before"===o.side)return _(t,o);const e=t.getBlockOrder(),n=e.indexOf(o.blockId);if(n>=e.length-1)return null;const r=e[n+1];if(!r)return null;if(g(t,r)){const o=l(t.doc,r)??[];return t.transaction("input").setSelection(a(r,o)).build()}return t.transaction("input").setSelection(k(r,0)).build()}function _(t,o){const e=l(t.doc,o.blockId)??[],n=a(o.blockId,e);return w(t,n)}var C=/* @__PURE__ */new Set(["blockquote","list_item"]);function D(t,o){const e=l(t.doc,o);if(!e||0===e.length)return-1;const n=e[0];return t.doc.children.findIndex(t=>t.id===n)}function P(t,e,r,c,f){const d=t.doc.children[c],u=t.doc.children[f];if(!d||!u)return;const a=t.getBlock(r.to.blockId);if(!a)return;const k=o(d),b=o(u),m=0===r.from.offset&&q(d)===r.from.blockId,I=r.to.offset===s(a)&&E(u)===r.to.blockId,h=!k&&(!C.has(d.type)||m),g=!b&&(!C.has(u.type)||I);if(k){const t=s(d);r.from.offset<t&&e.deleteTextAt(r.from.blockId,r.from.offset,t)}else h||Q(e,[d.id],d,l(t.doc,r.from.blockId)??[],r.from.blockId,r.from.offset);let p;b?r.to.offset>0&&e.deleteTextAt(r.to.blockId,0,r.to.offset):g||R(e,[u.id],u,l(t.doc,r.to.blockId)??[],r.to.blockId,r.to.offset);let x=0;h&&(p=n(),e.insertNode([],c,i(p)),x=1);const B=[];h&&B.push(c);for(let o=c+1;o<f;o++)B.push(o);g&&B.push(f);for(let o=B.length-1;o>=0;o--)e.removeNode([],B[o]+x);return k&&b&&e.mergeBlocksAt(r.from.blockId,r.to.blockId),p}function q(t){if(o(t))return t.id;const n=e(t)[0];return n?q(n):t.id}function E(t){if(o(t))return t.id;const n=e(t),r=n[n.length-1];return r?E(r):t.id}function Q(t,o,n,r,c,i){const l=e(n),f=r.indexOf(n.id),d=f>=0?r[f+1]:void 0,u=l.findIndex(t=>t.id===d);if(u<0)return;for(let e=l.length-1;e>u;e--)t.removeNode(o,e);const a=l[u];if(a.id===c){const o=s(a);return void(i<o&&t.deleteTextAt(c,i,o))}Q(t,[...o,a.id],a,r,c,i)}function R(t,o,n,r,c,i){const s=e(n),l=r.indexOf(n.id),f=l>=0?r[l+1]:void 0,d=s.findIndex(t=>t.id===f);if(d<0)return;for(let e=d-1;e>=0;e--)t.removeNode(o,e);const u=s[d];u.id!==c?R(t,[...o,u.id],u,r,c,i):i>0&&t.deleteTextAt(c,0,i)}function z(o,e,c="input"){const s=o.selection;if(d(s))return j(o,s,e,c);if(I(s))return function(t,o,e,r){const{parentPath:c,siblings:s,index:l}=S(t,o.blockId),f="before"===o.side?Math.max(l,0):l>=0?l+1:s.length,d=n(),u=t.transaction(r);return u.insertNode(c,f,i(d)),u.insertText(d,0,e,[]),u.setSelection(k(d,e.length)),u.build()}(o,s,e,c);const l=o.transaction(c),a=function(o){if(o.storedMarks)return o.storedMarks;const e=o.selection;if(!u(e))return[];const n=o.getBlock(e.anchor.blockId);return n?f(e)?r(n,e.anchor.offset,t=>T(o.schema,t)):t(n,e.anchor.offset):[]}(o);let b;f(s)||(b=W(o,l));const m=A(s,o.getBlockOrder()),h=b??m.blockId,g=b?0:m.offset;return l.insertText(h,g,e,a),l.setSelection(k(h,g+e.length)),l.build()}function F(t){if(d(t.selection))return w(t,t.selection);if(I(t.selection))return null;if(f(t.selection))return null;if(function(t){if(!u(t.selection))return!1;const o=V(t);if(!o)return!1;const e=m(t.selection,t.getBlockOrder());return e.from.blockId===o.from.blockId&&e.from.offset===o.from.offset&&e.to.blockId===o.to.blockId&&e.to.offset===o.to.offset}(t))return function(t){const o=n(),e=t.transaction("input"),r=t.doc.children.length;e.insertNode([],0,i(o));for(let n=r;n>=1;n--)e.removeNode([],n);return e.setSelection(k(o,0)),e.build()}(t);const o=t.transaction("input"),e=W(t,o),r=m(t.selection,t.getBlockOrder()),c=e??r.from.blockId,s=e?0:r.from.offset;return o.setSelection(k(c,s)),o.build()}function G(t){const o=t.selection;if(d(o))return v(t,o);if(I(o))return function(t,o){const{parentPath:e,index:r}=S(t,o.blockId);if(r<0)return null;const c="before"===o.side?r:r+1,s=n(),l=t.transaction("input");return l.insertNode(e,c,i(s)),l.setSelection(k(s,0)),l.build()}(t,o);const e=t.transaction("input");let r;f(o)||(r=W(t,e));const c=A(o,t.getBlockOrder()),s=r??c.blockId,l=r?0:c.offset,u=n();return e.splitBlock(s,l,u),e.setSelection(k(u,0)),e.build()}function H(t){const o=t.selection;if(!u(o))return null;const e=t.transaction("input");let n;if(f(o)||(n=W(t,e)),n)e.insertInlineNode(n,0,c(h("hard_break"))),e.setSelection(k(n,1));else{const{blockId:n,offset:r}=A(o,t.getBlockOrder());e.insertInlineNode(n,r,c(h("hard_break"))),e.setSelection(k(n,r+1))}return e.build()}function J(t){return L(t,"backward")}function K(t){return L(t,"forward")}function L(t,o){const e=t.selection;if(!u(e))return null;const n=t.getBlockOrder(),r=n.indexOf(e.anchor.blockId),c="backward"===o?r-1:r+1;if(c<0||c>=n.length)return null;const i=n[c];if(!i)return null;if(B(t,e.anchor.blockId)||B(t,i))return null;if(!x(t,e.anchor.blockId,i)&&p(t,e.anchor.blockId))return null;if(g(t,i)){const o=l(t.doc,i)??[];return t.transaction("input").setSelection(a(i,o)).build()}if("backward"===o){const o=t.getBlock(i);if(!o)return null;const n=s(o);return t.transaction("input").mergeBlocksAt(i,e.anchor.blockId).setSelection(k(i,n)).build()}return t.transaction("input").mergeBlocksAt(e.anchor.blockId,i).setSelection(k(e.anchor.blockId,e.anchor.offset)).build()}function U(t){const o=V(t);return o?t.transaction("command").setSelection(b(o.from,o.to)).build():t.transaction("command").setSelection(t.selection).build()}function V(t){const o=t.doc.children,e=o[0],n=o[o.length-1];if(!e||!n)return null;const r=O(e),c=N(n),i=t.getBlock(c);return{from:{blockId:r,offset:0},to:{blockId:c,offset:i?s(i):0}}}function W(t,o){if(!u(t.selection))return;const e=t.getBlockOrder(),n=m(t.selection,e),r=e.indexOf(n.from.blockId),c=e.indexOf(n.to.blockId);if(r===c)return void o.deleteTextAt(n.from.blockId,n.from.offset,n.to.offset);const i=D(t,n.from.blockId),l=D(t,n.to.blockId);if(!(i===l||i<0||l<0))return P(t,o,n,i,l);!function(t,o,e,n,r,c){const i=t.getBlock(n.from.blockId);if(!i)return;const l=s(i);n.from.offset<l&&o.deleteTextAt(n.from.blockId,n.from.offset,l),n.to.offset>0&&o.deleteTextAt(n.to.blockId,0,n.to.offset);for(let f=r+1;f<c;f++){const r=e[f];if(!r)continue;const c=t.getBlock(r);if(!c)continue;const i=s(c);i>0&&o.deleteTextAt(r,0,i),o.mergeBlocksAt(n.from.blockId,r)}o.mergeBlocksAt(n.from.blockId,n.to.blockId)}(t,o,e,n,r,c)}export{J as a,G as c,z as i,M as l,F as n,K as o,H as r,U as s,W as t,y as u};
|
|
2
|
-
//# sourceMappingURL=Commands-D-0UXYvo.mjs.map
|