@notectl/core 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -1
- package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -1
- package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -1
- package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +1 -1
- package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -1
- package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
- package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
- package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
- package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -1
- package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -1
- package/dist/chunks/{CaretNavigationPlugin-BxWjR7SN.mjs → CaretNavigationPlugin-BQPqqK4n.mjs} +2 -2
- package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs.map +1 -0
- package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +2 -0
- package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs.map +1 -0
- package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
- package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -1
- package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -1
- package/dist/chunks/Commands-Bk7Cl1nH.mjs +2 -0
- package/dist/chunks/Commands-Bk7Cl1nH.mjs.map +1 -0
- package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
- package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
- package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -1
- package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -1
- package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -1
- package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
- package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -1
- package/dist/chunks/{DocumentParser-BKUrtgw1.mjs → DocumentParser-C99N0MWF.mjs} +2 -2
- package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +1 -0
- package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
- package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
- package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -1
- package/dist/chunks/{FontSizePlugin-BQ9Aj8cT.mjs → FontSizePlugin-Dswra3oU.mjs} +2 -2
- package/dist/chunks/FontSizePlugin-Dswra3oU.mjs.map +1 -0
- package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +2 -0
- package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs.map +1 -0
- package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -1
- package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -1
- package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -1
- package/dist/chunks/{HardBreakPlugin-svNnJ9Xj.mjs → HardBreakPlugin-gjCq8prD.mjs} +2 -2
- package/dist/chunks/HardBreakPlugin-gjCq8prD.mjs.map +1 -0
- package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -1
- package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -1
- package/dist/chunks/{HorizontalRulePlugin-CQ5NT2Mo.mjs → HorizontalRulePlugin-YywXVZYr.mjs} +2 -2
- package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs.map +1 -0
- package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +2 -0
- package/dist/chunks/ImagePlugin-BAhZuVdE.mjs.map +1 -0
- package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -1
- package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -1
- package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
- package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +2 -0
- package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +1 -0
- package/dist/chunks/{ListPlugin-DTgpvBEt.mjs → ListPlugin-U1r4p_fE.mjs} +2 -2
- package/dist/chunks/ListPlugin-U1r4p_fE.mjs.map +1 -0
- package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -1
- package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
- package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +1 -1
- package/dist/chunks/{MarkdownParser-CvYOvU3d.mjs → MarkdownParser-uX1p_GQk.mjs} +2 -2
- package/dist/chunks/MarkdownParser-uX1p_GQk.mjs.map +1 -0
- package/dist/chunks/{MarkdownSerializer-CdUBWWGI.mjs → MarkdownSerializer--MrgJTdJ.mjs} +2 -2
- package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs.map +1 -0
- package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
- package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -1
- package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -1
- package/dist/chunks/{NodeSelectionCommands-B0Sb4ux4.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
- package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
- package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
- package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
- package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +1 -1
- package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
- package/dist/chunks/PopupManager-Dxv0OVMo.mjs +2 -0
- package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +1 -0
- package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
- package/dist/chunks/{PrintPlugin-BxNlFk2c.mjs → PrintPlugin-DAEiEyKQ.mjs} +2 -2
- package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs.map +1 -0
- package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -1
- package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -1
- package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -1
- package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
- package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs +2 -0
- package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs.map +1 -0
- package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -1
- package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -1
- package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
- package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +1 -1
- package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +2 -0
- package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs.map +1 -0
- package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
- package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +1 -1
- package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -1
- package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
- package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +1 -1
- package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
- package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -1
- package/dist/chunks/{TablePlugin-WPwp902E.mjs → TablePlugin-CjKThPug.mjs} +2 -2
- package/dist/chunks/TablePlugin-CjKThPug.mjs.map +1 -0
- package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -1
- package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +1 -1
- package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +1 -1
- package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +1 -1
- package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +1 -1
- package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
- package/dist/chunks/{ToolbarPlugin-DmVI7MN9.mjs → ToolbarPlugin-CgZA2hz8.mjs} +2 -2
- package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +1 -0
- package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
- package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
- package/dist/chunks/{VideoPlugin-D3zGQ6QV.mjs → VideoPlugin-DJXfuNA9.mjs} +2 -2
- package/dist/chunks/VideoPlugin-DJXfuNA9.mjs.map +1 -0
- package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
- package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
- package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
- package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
- package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
- package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
- package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
- package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
- package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
- package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
- package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
- package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
- package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
- package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
- package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
- package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
- package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
- package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
- package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
- package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
- package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
- package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
- package/dist/chunks/ar-DhwCFHql.mjs +2 -0
- package/dist/chunks/ar-DhwCFHql.mjs.map +1 -0
- package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
- package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
- package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
- package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
- package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
- package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
- package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -1
- package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
- package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
- package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
- package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
- package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
- package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
- package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
- package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
- package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
- package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
- package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
- package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
- package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
- package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
- package/dist/chunks/de-CjLUbQmg.mjs +2 -0
- package/dist/chunks/de-CjLUbQmg.mjs.map +1 -0
- package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
- package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
- package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
- package/dist/chunks/de-DViI26lG.mjs.map +1 -1
- package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
- package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
- package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
- package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
- package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
- package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
- package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
- package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
- package/dist/chunks/es-B0Za939C.mjs.map +1 -1
- package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
- package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
- package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
- package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
- package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
- package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
- package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
- package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
- package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
- package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
- package/dist/chunks/es-CMSzvjOT.mjs +2 -0
- package/dist/chunks/es-CMSzvjOT.mjs.map +1 -0
- package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
- package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
- package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
- package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
- package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
- package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
- package/dist/chunks/es-DFokqQst.mjs.map +1 -1
- package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
- package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
- package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
- package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
- package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
- package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
- package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
- package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
- package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
- package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
- package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
- package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
- package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
- package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
- package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
- package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
- package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
- package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
- package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
- package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
- package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
- package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
- package/dist/chunks/fr-DB_OvHWH.mjs +2 -0
- package/dist/chunks/fr-DB_OvHWH.mjs.map +1 -0
- package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
- package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
- package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
- package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
- package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
- package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
- package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
- package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
- package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
- package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
- package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
- package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
- package/dist/chunks/full-BsWAZr1w.mjs +2 -0
- package/dist/chunks/full-BsWAZr1w.mjs.map +1 -0
- package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
- package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
- package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
- package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
- package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
- package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
- package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
- package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
- package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
- package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
- package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
- package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
- package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
- package/dist/chunks/hi-ChNQZZ1z.mjs +2 -0
- package/dist/chunks/hi-ChNQZZ1z.mjs.map +1 -0
- package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
- package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
- package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
- package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
- package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
- package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
- package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
- package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
- package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
- package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
- package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
- package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
- package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
- package/dist/chunks/minimal-DO7LiFTa.mjs.map +1 -1
- package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
- package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
- package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
- package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
- package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
- package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
- package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
- package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
- package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
- package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
- package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
- package/dist/chunks/pt-CI8t6oul.mjs +2 -0
- package/dist/chunks/pt-CI8t6oul.mjs.map +1 -0
- package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
- package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
- package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
- package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
- package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
- package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
- package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
- package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
- package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
- package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
- package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
- package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
- package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
- package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
- package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
- package/dist/chunks/register-DXLu8Njp.mjs +3 -0
- package/dist/chunks/register-DXLu8Njp.mjs.map +1 -0
- package/dist/chunks/ru-9WtNGZtl.mjs +2 -0
- package/dist/chunks/ru-9WtNGZtl.mjs.map +1 -0
- package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
- package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
- package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
- package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
- package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
- package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
- package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
- package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
- package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
- package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
- package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
- package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
- package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
- package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
- package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
- package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
- package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
- package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
- package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
- package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
- package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
- package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
- package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
- package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
- package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
- package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
- package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -1
- package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
- package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
- package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
- package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
- package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
- package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
- package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
- package/dist/chunks/zh-BrqJ4ywP.mjs +2 -0
- package/dist/chunks/zh-BrqJ4ywP.mjs.map +1 -0
- package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
- package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
- package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
- package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
- package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
- package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
- package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
- package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
- package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
- package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
- package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
- package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
- package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
- package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
- package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
- package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
- package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
- package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
- package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
- package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
- package/dist/commands/BlockInsertion.d.ts +15 -19
- package/dist/commands/BlockInsertion.d.ts.map +1 -1
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/commands/SelectionDeletion.d.ts +7 -5
- package/dist/commands/SelectionDeletion.d.ts.map +1 -1
- package/dist/commands/SelectionReplacement.d.ts +42 -0
- package/dist/commands/SelectionReplacement.d.ts.map +1 -0
- package/dist/editor/BlockIdentity.d.ts +16 -0
- package/dist/editor/BlockIdentity.d.ts.map +1 -0
- package/dist/editor/ContentSerializer.d.ts +13 -11
- package/dist/editor/ContentSerializer.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +6 -5
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/styles/link.d.ts +3 -0
- package/dist/editor/styles/link.d.ts.map +1 -0
- package/dist/fonts/math.mjs +1 -1
- package/dist/full.mjs +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/input/PasteRichBlockHandler.d.ts +10 -17
- package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/model/ContentModel.d.ts +6 -1
- package/dist/model/ContentModel.d.ts.map +1 -1
- package/dist/model/FileHandlerDispatcher.d.ts +3 -1
- package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
- package/dist/model/FileHandlerRegistry.d.ts +11 -2
- package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
- package/dist/notectl-core.mjs +1 -1
- package/dist/notectl-core.umd.js +1 -1
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
- package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
- package/dist/plugins/formula.mjs +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImageCommands.d.ts +15 -3
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/link/LinkInteractionController.d.ts +26 -0
- package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
- package/dist/plugins/link/LinkLocale.d.ts +7 -1
- package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
- package/dist/plugins/link/LinkNavigation.d.ts +12 -0
- package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
- package/dist/plugins/link/LinkPlugin.d.ts +4 -4
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link/LinkPreview.d.ts +28 -0
- package/dist/plugins/link/LinkPreview.d.ts.map +1 -0
- package/dist/plugins/link/locales/ar.d.ts.map +1 -1
- package/dist/plugins/link/locales/de.d.ts.map +1 -1
- package/dist/plugins/link/locales/es.d.ts.map +1 -1
- package/dist/plugins/link/locales/fr.d.ts.map +1 -1
- package/dist/plugins/link/locales/hi.d.ts.map +1 -1
- package/dist/plugins/link/locales/pt.d.ts.map +1 -1
- package/dist/plugins/link/locales/ru.d.ts.map +1 -1
- package/dist/plugins/link/locales/zh.d.ts.map +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/PopupManager.d.ts +5 -0
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
- package/dist/plugins/shared.mjs +1 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
- package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
- package/dist/plugins/smart-paste.mjs +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-direction.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.mjs +1 -1
- package/dist/register.mjs +1 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/StepApplication.d.ts.map +1 -1
- package/dist/state/Steps.d.ts +3 -0
- package/dist/state/Steps.d.ts.map +1 -1
- package/dist/state/StructuralPositions.d.ts +15 -0
- package/dist/state/StructuralPositions.d.ts.map +1 -0
- package/dist/state/TransactionBuilder.d.ts +6 -14
- package/dist/state/TransactionBuilder.d.ts.map +1 -1
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/EditorViewEvents.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunks/BlockInsertion-CxKdCKJd.mjs +0 -2
- package/dist/chunks/BlockInsertion-CxKdCKJd.mjs.map +0 -1
- package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs.map +0 -1
- package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +0 -2
- package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs.map +0 -1
- package/dist/chunks/Commands-DBBCAYBn.mjs +0 -2
- package/dist/chunks/Commands-DBBCAYBn.mjs.map +0 -1
- package/dist/chunks/ContentModel-BLC3Tez8.mjs +0 -2
- package/dist/chunks/ContentModel-BLC3Tez8.mjs.map +0 -1
- package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +0 -1
- package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +0 -1
- package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +0 -2
- package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +0 -1
- package/dist/chunks/HardBreakPlugin-svNnJ9Xj.mjs.map +0 -1
- package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs.map +0 -1
- package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +0 -2
- package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +0 -1
- package/dist/chunks/LinkPlugin-BuzrXo2c.mjs +0 -2
- package/dist/chunks/LinkPlugin-BuzrXo2c.mjs.map +0 -1
- package/dist/chunks/ListPlugin-DTgpvBEt.mjs.map +0 -1
- package/dist/chunks/MarkdownParser-CvYOvU3d.mjs.map +0 -1
- package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +0 -1
- package/dist/chunks/NodeSelectionCommands-B0Sb4ux4.mjs.map +0 -1
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
- package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
- package/dist/chunks/PrintPlugin-BxNlFk2c.mjs.map +0 -1
- package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs +0 -2
- package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs.map +0 -1
- package/dist/chunks/TablePlugin-WPwp902E.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +0 -1
- package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +0 -1
- package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
- package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
- package/dist/chunks/de-JhGflzS5.mjs +0 -2
- package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
- package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
- package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
- package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
- package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
- package/dist/chunks/full-BiQ93ERr.mjs +0 -2
- package/dist/chunks/full-BiQ93ERr.mjs.map +0 -1
- package/dist/chunks/hi-Bu799xIO.mjs +0 -2
- package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
- package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
- package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
- package/dist/chunks/register-Cb1YTAN4.mjs +0 -3
- package/dist/chunks/register-Cb1YTAN4.mjs.map +0 -1
- package/dist/chunks/ru-BxySx7an.mjs +0 -2
- package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
- package/dist/chunks/zh-DuucmOns.mjs +0 -2
- package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as t,D as e,E as n,_ as i,j as s,p as c}from"./Document-ssR6hBzG.mjs";import{c as o,f as r,n as l,p as a}from"./Selection-DC6AOGgF.mjs";import{a as d,t as h}from"./TypeBrands-Ch9856Gb.mjs";import{l as u}from"./BlockInsertion-CxKdCKJd.mjs";import{t as m}from"./RangeIterator-sJ_c9MNr.mjs";import{r as p}from"./AttrRegistry-Di936wMv.mjs";import{o as k,t as f}from"./Decoration-BoFcdSXk.mjs";import{c as b,o as g}from"./PluginHelpers-B3gk3VB3.mjs";import{c as y}from"./StyleRuntime-C0RSqKzG.mjs";import{n as x}from"./DomUtils-Bf7JLFlx.mjs";function v(t,e,n){return"checklist"===t?{listType:t,indent:e,checked:n??!1}:{listType:t,indent:e}}function I(t,e){const n=t.getBlock(e);if("list_item"===n?.type)return n;const i=t.getNodePath(e);if(i)for(let s=i.length-2;s>=0;s--){const e=i[s],n=e?t.getBlock(e):void 0;if("list_item"===n?.type)return n}}function T(t,n){const i=t.getBlock(n);if(!i||"list_item"!==i.type)return;const s=t.getNodePath(n);if(!s)return;const c=s.slice(0,-1),o=c[c.length-1],r=(o?e(t.getBlock(o)):t.doc.children).findIndex(t=>t.id===n);return r<0?void 0:{item:i,parentPath:c,index:r}}function w(t,n){t.removeNode(n.parentPath,n.index),e(n.item).forEach((e,i)=>{t.insertNode(n.parentPath,n.index+i,e)})}function B(e,n){const i=e.getState(),s=i.selection;return!!r(s)&&(s.anchor.blockId!==s.head.blockId?function(e,n,i){const s=n.selection;if(!r(s))return!1;const c=a(s,n.getBlockOrder()),o=C(n,c,i),l=n.transaction("command"),h=function(t,e){const n=[],i=/* @__PURE__ */new Set;return m(t,e,e=>{const s=t.getBlock(e);if(!s)return;const c=I(t,e)??s;i.has(c.id)||(i.add(c.id),n.push(c))}),n}(n,c);for(let r=h.length-1;r>=0;r--){const e=h[r];if(e)if(o)if(t(e))l.setBlockType(e.id,d("paragraph"));else{const t=T(n,e.id);t&&w(l,t)}else{const t=p(e,"list_item")?e.attrs.indent:0,n=p(e,"list_item")&&"checklist"===e.attrs.listType&&e.attrs.checked;l.setBlockType(e.id,d("list_item"),v(i,t,n))}}return l.setSelection(s),e.dispatch(l.build()),!0}(e,i,n):function(e,n,i){const s=n.selection;if(!r(s))return!1;const c=n.getBlock(s.anchor.blockId);if(!c)return!1;const o=I(n,s.anchor.blockId),l=o??c;if(o&&o.attrs?.listType===i){const i=n.transaction("command");if(t(o))i.setBlockType(o.id,d("paragraph"));else{const t=T(n,o.id);if(!t)return!1;w(i,t)}return i.setSelection(s),e.dispatch(i.build()),!0}const a=v(i,p(l,"list_item")?l.attrs.indent:0),h=n.transaction("command").setBlockType(l.id,d("list_item"),a).setSelection(s).build();return e.dispatch(h),!0}(e,i,n))}function L(t,e,n){const i=t.getState();if(!r(i.selection))return!1;if(i.selection.anchor.blockId!==i.selection.head.blockId)return function(t,e,n,i){const s=e.selection;if(!r(s))return!1;const c=a(s,e.getBlockOrder()),o=e.transaction("command");let l=!1;const h=/* @__PURE__ */new Set;return m(e,c,t=>{const s=I(e,t);if(!s||!p(s,"list_item"))return;if(h.has(s.id))return;h.add(s.id);const c=s.attrs.indent+n;c<0||c>i||(o.setBlockType(s.id,d("list_item"),v(s.attrs.listType,c,s.attrs.checked)),l=!0)}),!!l&&(o.setSelection(s),t.dispatch(o.build()),!0)}(t,i,e,n);const s=i.selection,c=I(i,s.anchor.blockId);if(!c||!p(c,"list_item"))return!1;const o=c.attrs.indent+e;if(o<0||o>n)return!1;const l=v(c.attrs.listType,o,c.attrs.checked),h=i.transaction("command").setBlockType(c.id,d("list_item"),l).setSelection(s).build();return t.dispatch(h),!0}function S(t,e){const{interactiveCheckboxes:n,targetId:i,locale:s}=e;if(t.isReadOnly()&&!n)return!1;const c=t.getState(),o=i??(r(c.selection)?c.selection.anchor.blockId:null);if(!o)return!1;const l=I(c,o);if(!l||!p(l,"list_item")||"checklist"!==l.attrs.listType)return!1;const a=!l.attrs.checked,h=v(l.attrs.listType,l.attrs.indent,a),u=c.transaction("command").setBlockType(l.id,d("list_item"),h).setSelection(c.selection);t.isReadOnly()&&n&&u.readonlyAllowed(),t.dispatch(u.build());const m=t.getState().getBlock(l.id);return!(!m||!p(m,"list_item")||"checklist"!==m.attrs.listType||m.attrs.checked!==a||(t.announce(a?s.checkedAnnouncement:s.uncheckedAnnouncement),0))}function C(t,e,n){let i=!0;return m(t,e,e=>{const s=I(t,e);s&&"list_item"===s.type&&s.attrs?.listType===n||(i=!1)}),i}var _=[{type:"bullet",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',inputPattern:/^[-*] $/,inputPrefix:"- "},{type:"ordered",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',inputPattern:/^\d+\. $/,inputPrefix:"1. "},{type:"checklist",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>',inputPattern:/^\[[ x]] $/,inputPrefix:"[ ] "}];function H(t,n){const i=t.getState();if(!r(i.selection))return!1;const s=i.selection;if(!o(s))return!1;const c=i.getBlock(s.anchor.blockId);if(!c)return!1;if("list_item"===c.type)return n({state:i,item:c,child:void 0,childIndex:-1,childCount:0,blockId:s.anchor.blockId,offset:s.anchor.offset});const l=i.getParent(s.anchor.blockId);if(!l||"list_item"!==l.type)return!1;const a=e(l),d=a.findIndex(t=>t.id===c.id);return!(d<0)&&n({state:i,item:l,child:c,childIndex:d,childCount:a.length,blockId:s.anchor.blockId,offset:s.anchor.offset})}var z={bulletList:"Bullet List",numberedList:"Numbered List",checklist:"Checklist",checkboxLabel:"To-do item",checkedAnnouncement:"Checked",uncheckedAnnouncement:"Unchecked"},A=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Cy_77yRf.mjs"),"./locales/de.ts":()=>import("./de-CaeEIyzV.mjs"),"./locales/es.ts":()=>import("./es-DFokqQst.mjs"),"./locales/fr.ts":()=>import("./fr-5HkMazAf.mjs"),"./locales/hi.ts":()=>import("./hi-BzbMD_cP.mjs"),"./locales/pt.ts":()=>import("./pt-CR4j8gtE.mjs"),"./locales/ru.ts":()=>import("./ru-DiwQV30V.mjs"),"./locales/zh.ts":()=>import("./zh-BQqf3wJZ.mjs")});async function j(t){return b(A,t,z)}var M="notectl-checklist-marker";function P(t,e){const n=document.createElement("span");return n.className=M,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",String(t)),n.setAttribute("aria-label",e),n.setAttribute("contenteditable","false"),n.setAttribute("data-widget","true"),n}function $(t,e){return{bullet:e.bulletList,ordered:e.numberedList,checklist:e.checklist}[t]}function D(t,e){if(!r(t.selection))return!1;if(t.selection.anchor.blockId!==t.selection.head.blockId){const n=a(t.selection,t.getBlockOrder());return C(t,n,e)}const n=I(t,t.selection.anchor.blockId);return"list_item"===n?.type&&n.attrs?.listType===e}var N={types:["bullet","ordered","checklist"],maxIndent:4},E=class{id="list";name="List";priority=35;config;locale;context=null;checkboxMouseDownHandler=null;checkboxClickHandler=null;constructor(t){this.config={...N,...t}}async init(t){this.context=t,this.locale=await g(t,this.config.locale,z,j);const e=this.getEnabledTypes();t.registerStyleSheet("\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n"),this.registerNodeSpec(t),function(t,e,n,i){for(const s of n)t.registerCommand(`toggleList:${s.type}`,()=>B(t,s.type));if(t.registerCommand("indentListItem",()=>L(t,1,e.maxIndent)),t.registerCommand("outdentListItem",()=>L(t,-1,e.maxIndent)),e.types.includes("checklist")){const n=()=>S(t,{interactiveCheckboxes:e.interactiveCheckboxes,locale:i});t.registerCommand("toggleChecklistItem",n,{readonlyAllowed:e.interactiveCheckboxes}),t.registerKeymap({"Mod-Enter":n},{priority:"navigation"})}t.registerKeymap({Tab:()=>L(t,1,e.maxIndent),"Shift-Tab":()=>L(t,-1,e.maxIndent)})}(t,this.config,e,this.locale),function(t){t.registerKeymap({Enter:()=>function(t){return H(t,e=>{if(e.child)return function(t,e,s){if(!u(s))return!1;if(e.childIndex!==e.childCount-1)return!1;const o=T(e.state,e.item.id);if(!o)return!1;const r=e.state.transaction("input");if(1===e.childCount)return w(r,o),r.setSelection(e.state.selection),t.dispatch(r.build()),!0;const a=p(e.item,"list_item")?e.item.attrs.listType:"bullet",h=p(e.item,"list_item")?e.item.attrs.indent:0,m=n(),k=c(d("list_item"),[i("")],m,v(a,h));return r.removeNode([...o.parentPath,e.item.id],e.childIndex).insertNode(o.parentPath,o.index+1,k).setSelection(l(m,0)),t.dispatch(r.build()),!0}(t,e,e.child);if(""===s(e.item)){const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0}const o=n(),r=v(p(e.item,"list_item")?e.item.attrs.listType:"bullet",p(e.item,"list_item")?e.item.attrs.indent:0),a=e.state.transaction("input").splitBlock(e.blockId,e.offset,o).setBlockType(o,d("list_item"),r).setSelection(l(o,0)).build();return t.dispatch(a),!0})}(t),Backspace:()=>function(t){return H(t,e=>{if(0!==e.offset)return!1;if(e.child){if(0!==e.childIndex)return!1;const n=T(e.state,e.item.id);if(!n)return!1;const i=e.state.transaction("input");return w(i,n),i.setSelection(e.state.selection),t.dispatch(i.build()),!0}const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0})}(t)})}(t),!1!==this.config.inputRule&&function(t,e){for(const n of e)t.registerInputRule({pattern:n.inputPattern,handler:(t,e,i,s)=>{const c=t.selection;if(!r(c))return null;if(!o(c))return null;const a=t.getBlock(c.anchor.blockId);if(!a||"paragraph"!==a.type)return null;if("list_item"===t.getParent(c.anchor.blockId)?.type)return null;const h=e[0]??"",u=h.length,m=v(n.type,0,h.includes("[x]"));return t.transaction("input").deleteTextAt(c.anchor.blockId,i,i+u).setBlockType(c.anchor.blockId,d("list_item"),m).setSelection(l(c.anchor.blockId,0)).build()}})}(t,e),function(t,e,n){for(const i of e)t.registerToolbarItem({id:`list-${i.type}`,group:"block",icon:i.icon,label:$(i.type,n),command:`toggleList:${i.type}`,isActive:t=>D(t,i.type)})}(t,e,this.locale),this.registerCheckboxHandlers(t)}decorations(t){const e=[];for(const n of t.getBlockOrder()){const i=t.getBlock(n);if(!i||!p(i,"list_item")||"checklist"!==i.attrs.listType)continue;const s=i.attrs.checked;e.push(k(n,0,()=>P(s,this.locale.checkboxLabel),{key:`checklist-marker:${s}`}))}return f.create(e)}destroy(){if(this.context){const t=this.context.getContainer();this.checkboxMouseDownHandler&&t.removeEventListener("mousedown",this.checkboxMouseDownHandler),this.checkboxClickHandler&&t.removeEventListener("click",this.checkboxClickHandler)}this.checkboxMouseDownHandler=null,this.checkboxClickHandler=null,this.context=null}registerNodeSpec(t){const e=this.locale.checkboxLabel;t.registerNodeSpec({type:"list_item",group:"block",content:{allow:["text","paragraph","heading","code_block","blockquote","horizontal_rule"]},attrs:{listType:{default:"bullet"},indent:{default:0},checked:{default:!1}},toDOM(t){const n=t.attrs?.listType??"bullet",i=t.attrs?.indent??0,s=t.attrs?.checked??!1,c=x("li",t.id);return c.setAttribute("role","listitem"),c.setAttribute("data-list-type",n),c.setAttribute("data-indent",String(i)),c.className=`notectl-list-item notectl-list-item--${n}`,i>0&&y(c,"marginLeft",24*i+"px"),"checklist"===n&&(c.setAttribute("data-checked",String(s)),c.appendChild(P(s,e))),c.setAttribute("aria-level",String(i+1)),c},wrapper(t){const e=t.attrs?.listType??"bullet";return{tag:"ordered"===e?"ol":"ul",key:`list-${e}`,className:`notectl-list notectl-list--${e}`,attrs:{role:"list"}}},toHTML(t,e){const n=t.attrs?.listType??"bullet",i=t.attrs?.checked??!1;return"checklist"===n?`<li role="checkbox" aria-checked="${String(i)}"><input type="checkbox" disabled${i?" checked":""}>${e||"<br>"}</li>`:`<li>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}})}registerCheckboxHandlers(t){if(!this.config.types.includes("checklist"))return;const e=t=>{if(!(t instanceof HTMLElement))return null;const e=t.closest(`.${M}`);return e?e.closest(".notectl-list-item--checklist"):null};this.checkboxMouseDownHandler=n=>{t.isReadOnly()&&!this.config.interactiveCheckboxes||e(n.target)&&n.preventDefault()},this.checkboxClickHandler=n=>{if(t.isReadOnly()&&!this.config.interactiveCheckboxes)return;const i=e(n.target);if(!i)return;n.preventDefault();const s=i.getAttribute("data-block-id");s&&S(t,{interactiveCheckboxes:this.config.interactiveCheckboxes,targetId:h(s),locale:this.locale})};const n=t.getContainer();n.addEventListener("mousedown",this.checkboxMouseDownHandler),n.addEventListener("click",this.checkboxClickHandler)}getEnabledTypes(){return _.filter(t=>this.config.types.includes(t.type))}};export{z as n,j as r,E as t};
|
|
2
|
-
//# sourceMappingURL=ListPlugin-
|
|
1
|
+
import{B as t,D as e,E as n,_ as i,j as s,p as c}from"./Document-ssR6hBzG.mjs";import{c as o,f as r,n as l,p as a}from"./Selection-DC6AOGgF.mjs";import{a as d,t as h}from"./TypeBrands-Ch9856Gb.mjs";import{c as u}from"./BlockInsertion-CXfXqUZl.mjs";import{t as m}from"./RangeIterator-sJ_c9MNr.mjs";import{r as p}from"./AttrRegistry-Di936wMv.mjs";import{o as k,t as f}from"./Decoration-BoFcdSXk.mjs";import{c as b,o as g}from"./PluginHelpers-B3gk3VB3.mjs";import{c as y}from"./StyleRuntime-C0RSqKzG.mjs";import{n as v}from"./DomUtils-Bf7JLFlx.mjs";function x(t,e,n){return"checklist"===t?{listType:t,indent:e,checked:n??!1}:{listType:t,indent:e}}function I(t,e){const n=t.getBlock(e);if("list_item"===n?.type)return n;const i=t.getNodePath(e);if(i)for(let s=i.length-2;s>=0;s--){const e=i[s],n=e?t.getBlock(e):void 0;if("list_item"===n?.type)return n}}function T(t,n){const i=t.getBlock(n);if(!i||"list_item"!==i.type)return;const s=t.getNodePath(n);if(!s)return;const c=s.slice(0,-1),o=c[c.length-1],r=(o?e(t.getBlock(o)):t.doc.children).findIndex(t=>t.id===n);return r<0?void 0:{item:i,parentPath:c,index:r}}function w(t,n){t.removeNode(n.parentPath,n.index),e(n.item).forEach((e,i)=>{t.insertNode(n.parentPath,n.index+i,e)})}function B(e,n){const i=e.getState(),s=i.selection;return!!r(s)&&(s.anchor.blockId!==s.head.blockId?function(e,n,i){const s=n.selection;if(!r(s))return!1;const c=a(s,n.getBlockOrder()),o=C(n,c,i),l=n.transaction("command"),h=function(t,e){const n=[],i=/* @__PURE__ */new Set;return m(t,e,e=>{const s=t.getBlock(e);if(!s)return;const c=I(t,e)??s;i.has(c.id)||(i.add(c.id),n.push(c))}),n}(n,c);for(let r=h.length-1;r>=0;r--){const e=h[r];if(e)if(o)if(t(e))l.setBlockType(e.id,d("paragraph"));else{const t=T(n,e.id);t&&w(l,t)}else{const t=p(e,"list_item")?e.attrs.indent:0,n=p(e,"list_item")&&"checklist"===e.attrs.listType&&e.attrs.checked;l.setBlockType(e.id,d("list_item"),x(i,t,n))}}return l.setSelection(s),e.dispatch(l.build()),!0}(e,i,n):function(e,n,i){const s=n.selection;if(!r(s))return!1;const c=n.getBlock(s.anchor.blockId);if(!c)return!1;const o=I(n,s.anchor.blockId),l=o??c;if(o&&o.attrs?.listType===i){const i=n.transaction("command");if(t(o))i.setBlockType(o.id,d("paragraph"));else{const t=T(n,o.id);if(!t)return!1;w(i,t)}return i.setSelection(s),e.dispatch(i.build()),!0}const a=x(i,p(l,"list_item")?l.attrs.indent:0),h=n.transaction("command").setBlockType(l.id,d("list_item"),a).setSelection(s).build();return e.dispatch(h),!0}(e,i,n))}function L(t,e,n){const i=t.getState();if(!r(i.selection))return!1;if(i.selection.anchor.blockId!==i.selection.head.blockId)return function(t,e,n,i){const s=e.selection;if(!r(s))return!1;const c=a(s,e.getBlockOrder()),o=e.transaction("command");let l=!1;const h=/* @__PURE__ */new Set;return m(e,c,t=>{const s=I(e,t);if(!s||!p(s,"list_item"))return;if(h.has(s.id))return;h.add(s.id);const c=s.attrs.indent+n;c<0||c>i||(o.setBlockType(s.id,d("list_item"),x(s.attrs.listType,c,s.attrs.checked)),l=!0)}),!!l&&(o.setSelection(s),t.dispatch(o.build()),!0)}(t,i,e,n);const s=i.selection,c=I(i,s.anchor.blockId);if(!c||!p(c,"list_item"))return!1;const o=c.attrs.indent+e;if(o<0||o>n)return!1;const l=x(c.attrs.listType,o,c.attrs.checked),h=i.transaction("command").setBlockType(c.id,d("list_item"),l).setSelection(s).build();return t.dispatch(h),!0}function S(t,e){const{interactiveCheckboxes:n,targetId:i,locale:s}=e;if(t.isReadOnly()&&!n)return!1;const c=t.getState(),o=i??(r(c.selection)?c.selection.anchor.blockId:null);if(!o)return!1;const l=I(c,o);if(!l||!p(l,"list_item")||"checklist"!==l.attrs.listType)return!1;const a=!l.attrs.checked,h=x(l.attrs.listType,l.attrs.indent,a),u=c.transaction("command").setBlockType(l.id,d("list_item"),h).setSelection(c.selection);t.isReadOnly()&&n&&u.readonlyAllowed(),t.dispatch(u.build());const m=t.getState().getBlock(l.id);return!(!m||!p(m,"list_item")||"checklist"!==m.attrs.listType||m.attrs.checked!==a||(t.announce(a?s.checkedAnnouncement:s.uncheckedAnnouncement),0))}function C(t,e,n){let i=!0;return m(t,e,e=>{const s=I(t,e);s&&"list_item"===s.type&&s.attrs?.listType===n||(i=!1)}),i}var _=[{type:"bullet",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',inputPattern:/^[-*] $/,inputPrefix:"- "},{type:"ordered",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',inputPattern:/^\d+\. $/,inputPrefix:"1. "},{type:"checklist",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>',inputPattern:/^\[[ x]] $/,inputPrefix:"[ ] "}];function H(t,n){const i=t.getState();if(!r(i.selection))return!1;const s=i.selection;if(!o(s))return!1;const c=i.getBlock(s.anchor.blockId);if(!c)return!1;if("list_item"===c.type)return n({state:i,item:c,child:void 0,childIndex:-1,childCount:0,blockId:s.anchor.blockId,offset:s.anchor.offset});const l=i.getParent(s.anchor.blockId);if(!l||"list_item"!==l.type)return!1;const a=e(l),d=a.findIndex(t=>t.id===c.id);return!(d<0)&&n({state:i,item:l,child:c,childIndex:d,childCount:a.length,blockId:s.anchor.blockId,offset:s.anchor.offset})}var z={bulletList:"Bullet List",numberedList:"Numbered List",checklist:"Checklist",checkboxLabel:"To-do item",checkedAnnouncement:"Checked",uncheckedAnnouncement:"Unchecked"},A=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Cy_77yRf.mjs"),"./locales/de.ts":()=>import("./de-CaeEIyzV.mjs"),"./locales/es.ts":()=>import("./es-DFokqQst.mjs"),"./locales/fr.ts":()=>import("./fr-5HkMazAf.mjs"),"./locales/hi.ts":()=>import("./hi-BzbMD_cP.mjs"),"./locales/pt.ts":()=>import("./pt-CR4j8gtE.mjs"),"./locales/ru.ts":()=>import("./ru-DiwQV30V.mjs"),"./locales/zh.ts":()=>import("./zh-BQqf3wJZ.mjs")});async function j(t){return b(A,t,z)}var M="notectl-checklist-marker";function P(t,e){const n=document.createElement("span");return n.className=M,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",String(t)),n.setAttribute("aria-label",e),n.setAttribute("contenteditable","false"),n.setAttribute("data-widget","true"),n}function $(t,e){return{bullet:e.bulletList,ordered:e.numberedList,checklist:e.checklist}[t]}function D(t,e){if(!r(t.selection))return!1;if(t.selection.anchor.blockId!==t.selection.head.blockId){const n=a(t.selection,t.getBlockOrder());return C(t,n,e)}const n=I(t,t.selection.anchor.blockId);return"list_item"===n?.type&&n.attrs?.listType===e}var N={types:["bullet","ordered","checklist"],maxIndent:4},E=class{id="list";name="List";priority=35;config;locale;context=null;checkboxMouseDownHandler=null;checkboxClickHandler=null;constructor(t){this.config={...N,...t}}async init(t){this.context=t,this.locale=await g(t,this.config.locale,z,j);const e=this.getEnabledTypes();t.registerStyleSheet("\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n"),this.registerNodeSpec(t),function(t,e,n,i){for(const s of n)t.registerCommand(`toggleList:${s.type}`,()=>B(t,s.type));if(t.registerCommand("indentListItem",()=>L(t,1,e.maxIndent)),t.registerCommand("outdentListItem",()=>L(t,-1,e.maxIndent)),e.types.includes("checklist")){const n=()=>S(t,{interactiveCheckboxes:e.interactiveCheckboxes,locale:i});t.registerCommand("toggleChecklistItem",n,{readonlyAllowed:e.interactiveCheckboxes}),t.registerKeymap({"Mod-Enter":n},{priority:"navigation"})}t.registerKeymap({Tab:()=>L(t,1,e.maxIndent),"Shift-Tab":()=>L(t,-1,e.maxIndent)})}(t,this.config,e,this.locale),function(t){t.registerKeymap({Enter:()=>function(t){return H(t,e=>{if(e.child)return function(t,e,s){if(!u(s))return!1;if(e.childIndex!==e.childCount-1)return!1;const o=T(e.state,e.item.id);if(!o)return!1;const r=e.state.transaction("input");if(1===e.childCount)return w(r,o),r.setSelection(e.state.selection),t.dispatch(r.build()),!0;const a=p(e.item,"list_item")?e.item.attrs.listType:"bullet",h=p(e.item,"list_item")?e.item.attrs.indent:0,m=n(),k=c(d("list_item"),[i("")],m,x(a,h));return r.removeNode([...o.parentPath,e.item.id],e.childIndex).insertNode(o.parentPath,o.index+1,k).setSelection(l(m,0)),t.dispatch(r.build()),!0}(t,e,e.child);if(""===s(e.item)){const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0}const o=n(),r=x(p(e.item,"list_item")?e.item.attrs.listType:"bullet",p(e.item,"list_item")?e.item.attrs.indent:0),a=e.state.transaction("input").splitBlock(e.blockId,e.offset,o).setBlockType(o,d("list_item"),r).setSelection(l(o,0)).build();return t.dispatch(a),!0})}(t),Backspace:()=>function(t){return H(t,e=>{if(0!==e.offset)return!1;if(e.child){if(0!==e.childIndex)return!1;const n=T(e.state,e.item.id);if(!n)return!1;const i=e.state.transaction("input");return w(i,n),i.setSelection(e.state.selection),t.dispatch(i.build()),!0}const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0})}(t)})}(t),!1!==this.config.inputRule&&function(t,e){for(const n of e)t.registerInputRule({pattern:n.inputPattern,handler:(t,e,i,s)=>{const c=t.selection;if(!r(c))return null;if(!o(c))return null;const a=t.getBlock(c.anchor.blockId);if(!a||"paragraph"!==a.type)return null;if("list_item"===t.getParent(c.anchor.blockId)?.type)return null;const h=e[0]??"",u=h.length,m=x(n.type,0,h.includes("[x]"));return t.transaction("input").deleteTextAt(c.anchor.blockId,i,i+u).setBlockType(c.anchor.blockId,d("list_item"),m).setSelection(l(c.anchor.blockId,0)).build()}})}(t,e),function(t,e,n){for(const i of e)t.registerToolbarItem({id:`list-${i.type}`,group:"block",icon:i.icon,label:$(i.type,n),command:`toggleList:${i.type}`,isActive:t=>D(t,i.type)})}(t,e,this.locale),this.registerCheckboxHandlers(t)}decorations(t){const e=[];for(const n of t.getBlockOrder()){const i=t.getBlock(n);if(!i||!p(i,"list_item")||"checklist"!==i.attrs.listType)continue;const s=i.attrs.checked;e.push(k(n,0,()=>P(s,this.locale.checkboxLabel),{key:`checklist-marker:${s}`}))}return f.create(e)}destroy(){if(this.context){const t=this.context.getContainer();this.checkboxMouseDownHandler&&t.removeEventListener("mousedown",this.checkboxMouseDownHandler),this.checkboxClickHandler&&t.removeEventListener("click",this.checkboxClickHandler)}this.checkboxMouseDownHandler=null,this.checkboxClickHandler=null,this.context=null}registerNodeSpec(t){const e=this.locale.checkboxLabel;t.registerNodeSpec({type:"list_item",group:"block",content:{allow:["text","paragraph","heading","code_block","blockquote","horizontal_rule"]},attrs:{listType:{default:"bullet"},indent:{default:0},checked:{default:!1}},toDOM(t){const n=t.attrs?.listType??"bullet",i=t.attrs?.indent??0,s=t.attrs?.checked??!1,c=v("li",t.id);return c.setAttribute("role","listitem"),c.setAttribute("data-list-type",n),c.setAttribute("data-indent",String(i)),c.className=`notectl-list-item notectl-list-item--${n}`,i>0&&y(c,"marginLeft",24*i+"px"),"checklist"===n&&(c.setAttribute("data-checked",String(s)),c.appendChild(P(s,e))),c.setAttribute("aria-level",String(i+1)),c},wrapper(t){const e=t.attrs?.listType??"bullet";return{tag:"ordered"===e?"ol":"ul",key:`list-${e}`,className:`notectl-list notectl-list--${e}`,attrs:{role:"list"}}},toHTML(t,e){const n=t.attrs?.listType??"bullet",i=t.attrs?.checked??!1;return"checklist"===n?`<li role="checkbox" aria-checked="${String(i)}"><input type="checkbox" disabled${i?" checked":""}>${e||"<br>"}</li>`:`<li>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}})}registerCheckboxHandlers(t){if(!this.config.types.includes("checklist"))return;const e=t=>{if(!(t instanceof HTMLElement))return null;const e=t.closest(`.${M}`);return e?e.closest(".notectl-list-item--checklist"):null};this.checkboxMouseDownHandler=n=>{t.isReadOnly()&&!this.config.interactiveCheckboxes||e(n.target)&&n.preventDefault()},this.checkboxClickHandler=n=>{if(t.isReadOnly()&&!this.config.interactiveCheckboxes)return;const i=e(n.target);if(!i)return;n.preventDefault();const s=i.getAttribute("data-block-id");s&&S(t,{interactiveCheckboxes:this.config.interactiveCheckboxes,targetId:h(s),locale:this.locale})};const n=t.getContainer();n.addEventListener("mousedown",this.checkboxMouseDownHandler),n.addEventListener("click",this.checkboxClickHandler)}getEnabledTypes(){return _.filter(t=>this.config.types.includes(t.type))}};export{z as n,j as r,E as t};
|
|
2
|
+
//# sourceMappingURL=ListPlugin-U1r4p_fE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListPlugin-U1r4p_fE.mjs","names":["isLeafBlock","getBlockChildren","generateBlockId","createTextNode","getBlockText","createBlockNode","isCollapsed","isTextSelection","createCollapsedSelection","selectionRange","nodeType","blockId","isEmptyParagraph","forEachBlockIdInRange","isNodeOfType","widget","DecorationSet","loadLocaleModule","resolveLocale","setStyleProperty","createBlockElement","buildListItemAttrs","listType","indent","checked","resolveListItem","state","id","block","getBlock","type","path","getNodePath","i","length","ancestorId","ancestor","locateListItem","itemId","item","parentPath","slice","parentId","index","doc","children","findIndex","sibling","dissolveListItem","builder","location","removeNode","forEach","child","offset","insertNode","toggleList","context","getState","sel","selection","anchor","head","range","getBlockOrder","toggleOff","allBlocksMatchListType","transaction","targets","seen","Set","bid","target","has","add","push","collectToggleTargets","setBlockType","existingIndent","attrs","existingChecked","setSelection","dispatch","build","toggleListRange","tr","toggleListSingleBlock","changeIndent","delta","maxIndent","changed","newIndent","changeIndentRange","toggleChecked","options","interactiveCheckboxes","targetId","locale","isReadOnly","nextChecked","readonlyAllowed","applied","announce","checkedAnnouncement","uncheckedAnnouncement","allMatch","LIST_TYPE_DEFINITIONS","icon","inputPattern","inputPrefix","withListContext","handler","childIndex","childCount","parent","getParent","c","LIST_LOCALE_EN","bulletList","numberedList","checklist","checkboxLabel","localeModules","Object","assign","async","loadListLocale","lang","CHECKLIST_MARKER_CLASS","createChecklistMarker","label","marker","document","createElement","className","setAttribute","String","getListLabel","bullet","ordered","isListActive","DEFAULT_CONFIG","types","ListPlugin","name","priority","config","checkboxMouseDownHandler","checkboxClickHandler","constructor","this","init","enabledTypes","getEnabledTypes","registerStyleSheet","registerNodeSpec","def","registerCommand","includes","toggleChecklistItem","registerKeymap","Tab","registerListCommands","Enter","ctx","newItemId","newItem","handleEnterInContainerChild","newBlockId","splitBlock","handleEnter","Backspace","handleBackspace","registerListKeymaps","inputRule","registerInputRule","pattern","match","start","_end","matchStr","matchLen","deleteTextAt","registerListInputRules","registerToolbarItem","group","command","isActive","registerListToolbarItems","registerCheckboxHandlers","decorations","markers","key","create","destroy","container","getContainer","removeEventListener","content","allow","default","toDOM","node","li","appendChild","wrapper","tag","role","toHTML","parseHTML","sanitize","tags","findChecklistItem","HTMLElement","closest","e","preventDefault","getAttribute","addEventListener","filter"],"sources":["../../src/editor/styles/list.ts","../../src/plugins/list/ListAttrsFactory.ts","../../src/plugins/list/ListItemContext.ts","../../src/plugins/list/ListCommands.ts","../../src/plugins/list/ListDefinitions.ts","../../src/plugins/list/ListInputRules.ts","../../src/plugins/list/ListKeyboardHandlers.ts","../../src/plugins/list/ListLocale.ts","../../src/plugins/list/ListMarker.ts","../../src/plugins/list/ListToolbarItems.ts","../../src/plugins/list/ListPlugin.ts"],"sourcesContent":["/** Width of the list marker / checkbox area in pixels. */\nexport const LIST_MARKER_WIDTH = 24;\n\n/** List styles — bullet, ordered, checklist items. */\nexport const LIST_CSS = `\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: ${LIST_MARKER_WIDTH}px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n`;\n","/**\n * Factory for building list item block attributes.\n * Centralizes attribute construction to avoid repetitive inline object literals.\n */\n\nimport type { BlockAttrs } from '../../model/Document.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Builds a `BlockAttrs` object for a list_item block. */\nexport function buildListItemAttrs(\n\tlistType: ListType,\n\tindent: number,\n\tchecked?: boolean,\n): BlockAttrs {\n\tif (listType === 'checklist') {\n\t\treturn { listType, indent, checked: checked ?? false };\n\t}\n\treturn { listType, indent };\n}\n","/**\n * Shared resolution helpers for container list items (#194).\n *\n * With `list_item` a hybrid leaf/container block, the caret may sit inside a\n * block child of an item. Commands and keyboard handlers resolve the owning\n * item through the ancestor chain and address structural edits through the\n * item's location (parent path + child index), mirroring the blockquote\n * container conventions.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { getBlockChildren } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TransactionBuilder } from '../../state/TransactionBuilder.js';\n\n/** A list item's structural address: its parent path and child index. */\nexport interface ListItemLocation {\n\treadonly item: BlockNode;\n\t/** Path from the document root to the item's parent ([] = root). */\n\treadonly parentPath: readonly BlockId[];\n\t/** The item's index among its parent's block children. */\n\treadonly index: number;\n}\n\n/**\n * Resolves the list item owning a block: the block itself when it is a\n * `list_item`, otherwise its nearest `list_item` ancestor.\n */\nexport function resolveListItem(state: EditorState, id: BlockId): BlockNode | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(id);\n\tif (block?.type === 'list_item') return block;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(id);\n\tif (!path) return undefined;\n\tfor (let i = path.length - 2; i >= 0; i--) {\n\t\tconst ancestorId: BlockId | undefined = path[i];\n\t\tconst ancestor: BlockNode | undefined = ancestorId ? state.getBlock(ancestorId) : undefined;\n\t\tif (ancestor?.type === 'list_item') return ancestor;\n\t}\n\treturn undefined;\n}\n\n/** Locates a list item's structural address, or undefined if it is not found. */\nexport function locateListItem(state: EditorState, itemId: BlockId): ListItemLocation | undefined {\n\tconst item: BlockNode | undefined = state.getBlock(itemId);\n\tif (!item || item.type !== 'list_item') return undefined;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(itemId);\n\tif (!path) return undefined;\n\n\tconst parentPath: readonly BlockId[] = path.slice(0, -1);\n\tconst parentId: BlockId | undefined = parentPath[parentPath.length - 1];\n\tconst siblings: readonly BlockNode[] = parentId\n\t\t? getBlockChildren(state.getBlock(parentId) as BlockNode)\n\t\t: state.doc.children;\n\tconst index: number = siblings.findIndex((sibling) => sibling.id === itemId);\n\tif (index < 0) return undefined;\n\treturn { item, parentPath, index };\n}\n\n/**\n * Replaces a container list item with its block children in place. The\n * children keep their IDs, so a selection inside them survives the lift.\n * Leaf items must not be dissolved (their inline content is not a block);\n * convert those via `setBlockType` instead.\n */\nexport function dissolveListItem(builder: TransactionBuilder, location: ListItemLocation): void {\n\tbuilder.removeNode(location.parentPath, location.index);\n\tconst children: readonly BlockNode[] = getBlockChildren(location.item);\n\tchildren.forEach((child, offset) => {\n\t\tbuilder.insertNode(location.parentPath, location.index + offset, child);\n\t});\n}\n","/**\n * Command registration and implementations for list block types.\n * Handles toggle between list types and paragraph, indent/outdent,\n * and checklist toggle.\n */\n\nimport { forEachBlockIdInRange } from '../../commands/RangeIterator.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { isLeafBlock } from '../../model/Document.js';\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport { type BlockId, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { dissolveListItem, locateListItem, resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListConfig, ListType } from './ListPlugin.js';\n\n/** Registers all list commands (toggleList:*, indent, outdent, toggleChecklistItem). */\nexport function registerListCommands(\n\tcontext: PluginContext,\n\tconfig: ListConfig,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerCommand(`toggleList:${def.type}`, () => {\n\t\t\treturn toggleList(context, def.type);\n\t\t});\n\t}\n\n\tcontext.registerCommand('indentListItem', () => changeIndent(context, 1, config.maxIndent));\n\n\tcontext.registerCommand('outdentListItem', () => changeIndent(context, -1, config.maxIndent));\n\n\tif (config.types.includes('checklist')) {\n\t\tconst toggleChecklistItem = (): boolean =>\n\t\t\ttoggleChecked(context, { interactiveCheckboxes: config.interactiveCheckboxes, locale });\n\n\t\tcontext.registerCommand('toggleChecklistItem', toggleChecklistItem, {\n\t\t\treadonlyAllowed: config.interactiveCheckboxes,\n\t\t});\n\n\t\t// Mod-Enter gives keyboard-only users a way to toggle a checklist item\n\t\t// (WCAG 2.1.1). The handler declines on non-checklist blocks, so it falls\n\t\t// through to other Mod-Enter bindings (e.g. code-block insert-after).\n\t\t// Registered at navigation priority so it stays reachable in read-only mode\n\t\t// when interactiveCheckboxes is enabled, matching the mouse handler.\n\t\tcontext.registerKeymap({ 'Mod-Enter': toggleChecklistItem }, { priority: 'navigation' });\n\t}\n\n\tcontext.registerKeymap({\n\t\tTab: () => changeIndent(context, 1, config.maxIndent),\n\t\t'Shift-Tab': () => changeIndent(context, -1, config.maxIndent),\n\t});\n}\n\n// --- Command Implementations ---\n\nfunction toggleList(context: PluginContext, listType: ListType): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (sel.anchor.blockId !== sel.head.blockId) {\n\t\treturn toggleListRange(context, state, listType);\n\t}\n\treturn toggleListSingleBlock(context, state, listType);\n}\n\nfunction toggleListSingleBlock(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tlistType: ListType,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\t// The caret may sit inside a block child of a container item (#194):\n\t// toggling always targets the owning item, never the child.\n\tconst item: BlockNode | undefined = resolveListItem(state, sel.anchor.blockId);\n\tconst target: BlockNode = item ?? block;\n\n\tif (item && item.attrs?.listType === listType) {\n\t\tconst builder = state.transaction('command');\n\t\tif (isLeafBlock(item)) {\n\t\t\tbuilder.setBlockType(item.id, nodeType('paragraph'));\n\t\t} else {\n\t\t\t// A container item cannot become a paragraph (its children are\n\t\t\t// blocks) — dissolve it into those children instead.\n\t\t\tconst location = locateListItem(state, item.id);\n\t\t\tif (!location) return false;\n\t\t\tdissolveListItem(builder, location);\n\t\t}\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\tconst attrs = buildListItemAttrs(listType, existingIndent);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(target.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction toggleListRange(context: PluginContext, state: EditorState, listType: ListType): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst toggleOff: boolean = allBlocksMatchListType(state, range, listType);\n\tconst builder = state.transaction('command');\n\n\t// Children of a container item resolve to their owning item (#194), so a\n\t// range over its paragraphs toggles the item once, not each child.\n\tconst targets: BlockNode[] = collectToggleTargets(state, range);\n\n\t// Dissolving replaces one node with several, shifting later sibling\n\t// indices — process targets back-to-front so earlier addresses stay valid.\n\tfor (let i = targets.length - 1; i >= 0; i--) {\n\t\tconst target: BlockNode | undefined = targets[i];\n\t\tif (!target) continue;\n\n\t\tif (toggleOff) {\n\t\t\tif (isLeafBlock(target)) {\n\t\t\t\tbuilder.setBlockType(target.id, nodeType('paragraph'));\n\t\t\t} else {\n\t\t\t\tconst location = locateListItem(state, target.id);\n\t\t\t\tif (location) dissolveListItem(builder, location);\n\t\t\t}\n\t\t} else {\n\t\t\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\t\t\tconst existingChecked: boolean =\n\t\t\t\tisNodeOfType(target, 'list_item') &&\n\t\t\t\ttarget.attrs.listType === 'checklist' &&\n\t\t\t\ttarget.attrs.checked;\n\t\t\tbuilder.setBlockType(\n\t\t\t\ttarget.id,\n\t\t\t\tnodeType('list_item'),\n\t\t\t\tbuildListItemAttrs(listType, existingIndent, existingChecked),\n\t\t\t);\n\t\t}\n\t}\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Collects unique toggle targets: each leaf block or its owning list item. */\nfunction collectToggleTargets(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n): BlockNode[] {\n\tconst targets: BlockNode[] = [];\n\tconst seen = new Set<BlockId>();\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block) return;\n\t\tconst target: BlockNode = resolveListItem(state, bid) ?? block;\n\t\tif (seen.has(target.id)) return;\n\t\tseen.add(target.id);\n\t\ttargets.push(target);\n\t});\n\treturn targets;\n}\n\n// --- Indent / Outdent ---\n\nfunction changeIndent(context: PluginContext, delta: 1 | -1, maxIndent: number): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\treturn changeIndentRange(context, state, delta, maxIndent);\n\t}\n\n\tconst sel = state.selection;\n\tconst block = resolveListItem(state, sel.anchor.blockId);\n\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\tconst newIndent: number = block.attrs.indent + delta;\n\tif (newIndent < 0 || newIndent > maxIndent) return false;\n\n\tconst attrs = buildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked);\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction changeIndentRange(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdelta: 1 | -1,\n\tmaxIndent: number,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\tlet changed = false;\n\tconst seen = new Set<BlockId>();\n\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return;\n\t\tif (seen.has(block.id)) return;\n\t\tseen.add(block.id);\n\n\t\tconst newIndent: number = block.attrs.indent + delta;\n\t\tif (newIndent < 0 || newIndent > maxIndent) return;\n\n\t\tbuilder.setBlockType(\n\t\t\tblock.id,\n\t\t\tnodeType('list_item'),\n\t\t\tbuildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked),\n\t\t);\n\t\tchanged = true;\n\t});\n\n\tif (!changed) return false;\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Checklist Toggle ---\n\n/** Options for {@link toggleChecked}. */\nexport interface ToggleCheckedOptions {\n\t/** When true, the toggle is allowed even in read-only mode. */\n\treadonly interactiveCheckboxes?: boolean;\n\t/** Specific checklist item to toggle. Defaults to the selection's block. */\n\treadonly targetId?: BlockId;\n\t/** Locale used for the screen-reader announcement of the new state. */\n\treadonly locale: ListLocale;\n}\n\n/**\n * Toggles the checked state of a checklist item and announces the new state to\n * screen readers. Exported for use in the checkbox click handler.\n */\nexport function toggleChecked(context: PluginContext, options: ToggleCheckedOptions): boolean {\n\tconst { interactiveCheckboxes, targetId, locale } = options;\n\tif (context.isReadOnly() && !interactiveCheckboxes) return false;\n\n\tconst state: EditorState = context.getState();\n\tconst bid: BlockId | null =\n\t\ttargetId ?? (!isTextSelection(state.selection) ? null : state.selection.anchor.blockId);\n\tif (!bid) return false;\n\n\tconst block = resolveListItem(state, bid);\n\tif (!block || !isNodeOfType(block, 'list_item') || block.attrs.listType !== 'checklist') {\n\t\treturn false;\n\t}\n\n\tconst nextChecked: boolean = !block.attrs.checked;\n\tconst attrs = buildListItemAttrs(block.attrs.listType, block.attrs.indent, nextChecked);\n\n\tconst builder = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(state.selection);\n\tif (context.isReadOnly() && interactiveCheckboxes) builder.readonlyAllowed();\n\tcontext.dispatch(builder.build());\n\n\t// Dispatch is synchronous, but the production EditorView may reject a\n\t// transaction (read-only guard or re-entrant update). Only report/announce a\n\t// state transition that actually reached the authoritative editor state.\n\tconst applied = context.getState().getBlock(block.id);\n\tif (\n\t\t!applied ||\n\t\t!isNodeOfType(applied, 'list_item') ||\n\t\tapplied.attrs.listType !== 'checklist' ||\n\t\tapplied.attrs.checked !== nextChecked\n\t) {\n\t\treturn false;\n\t}\n\n\t// The marker is not focused while editing, so the aria-checked change alone is\n\t// not spoken — announce the new state explicitly (WCAG 4.1.3).\n\tcontext.announce(nextChecked ? locale.checkedAnnouncement : locale.uncheckedAnnouncement);\n\treturn true;\n}\n\n// --- Helpers ---\n\n/**\n * Checks whether all blocks in a range belong to list items of the given type\n * (children of container items resolve to their owning item, #194). Exported\n * for toolbar active-state detection.\n */\nexport function allBlocksMatchListType(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n\tlistType: ListType,\n): boolean {\n\tlet allMatch = true;\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || block.type !== 'list_item' || block.attrs?.listType !== listType) {\n\t\t\tallMatch = false;\n\t\t}\n\t});\n\treturn allMatch;\n}\n","/**\n * List type metadata: icons, patterns, and type definitions.\n * Pure data constants shared across list plugin modules.\n */\n\nimport type { ListType } from './ListPlugin.js';\n\n// --- List Type Metadata ---\n\nexport interface ListTypeDefinition {\n\treadonly type: ListType;\n\treadonly icon: string;\n\treadonly inputPattern: RegExp;\n\treadonly inputPrefix: string;\n}\n\nconst BULLET_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z\"/></svg>';\nconst NUMBERED_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z\"/></svg>';\nconst CHECKLIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z\"/></svg>';\n\nexport const LIST_TYPE_DEFINITIONS: readonly ListTypeDefinition[] = [\n\t{\n\t\ttype: 'bullet',\n\t\ticon: BULLET_LIST_ICON,\n\t\tinputPattern: /^[-*] $/,\n\t\tinputPrefix: '- ',\n\t},\n\t{\n\t\ttype: 'ordered',\n\t\ticon: NUMBERED_LIST_ICON,\n\t\tinputPattern: /^\\d+\\. $/,\n\t\tinputPrefix: '1. ',\n\t},\n\t{\n\t\ttype: 'checklist',\n\t\ticon: CHECKLIST_ICON,\n\t\tinputPattern: /^\\[[ x]] $/,\n\t\tinputPrefix: '[ ] ',\n\t},\n];\n","/**\n * Input rule registration for list block types.\n * Converts `- `, `* `, `1. `, `[ ] `, `[x] ` at the start of a paragraph into list items.\n */\n\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\n\n/** Registers markdown-style input rules for configured list types. */\nexport function registerListInputRules(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: def.inputPattern,\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\t// Inside a container list item (#194) the rule must not fire: it\n\t\t\t\t// would nest a list_item into a list_item, which the schema forbids.\n\t\t\t\tconst parent = state.getParent(sel.anchor.blockId);\n\t\t\t\tif (parent?.type === 'list_item') return null;\n\n\t\t\t\tconst matchStr = match[0] ?? '';\n\t\t\t\tconst matchLen = matchStr.length;\n\t\t\t\tconst attrs = buildListItemAttrs(def.type, 0, matchStr.includes('[x]'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + matchLen)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Keyboard handlers for list block types.\n *\n * Leaf items: Enter splits into a new item (or exits an empty item),\n * Backspace at the start converts back to a paragraph.\n *\n * Container items (#194): the caret sits inside a block child. Enter on an\n * empty trailing child exits into a new sibling item (Enter-Enter continues\n * the list); Backspace at the start of the first child dissolves the item\n * into its children — both mirroring the blockquote container conventions.\n * Everything else falls through to the default split/merge behavior.\n */\n\nimport { isEmptyParagraph } from '../../commands/BlockInsertion.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockChildren, getBlockText } from '../../model/Document.js';\nimport { createBlockNode, createTextNode } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport { type ListItemLocation, dissolveListItem, locateListItem } from './ListItemContext.js';\n\n// --- Context Guard ---\n\ninterface ListContext {\n\treadonly state: EditorState;\n\t/** The list item owning the caret (the caret block itself for leaf items). */\n\treadonly item: BlockNode;\n\t/** The caret's block child of a container item; undefined for leaf items. */\n\treadonly child: BlockNode | undefined;\n\treadonly childIndex: number;\n\treadonly childCount: number;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection, non-collapsed selections, and carets outside\n * list items. Resolves both leaf items (caret directly inside the item) and\n * container items (caret inside a direct block child of the item).\n */\nfunction withListContext(context: PluginContext, handler: (ctx: ListContext) => boolean): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'list_item') {\n\t\treturn handler({\n\t\t\tstate,\n\t\t\titem: block,\n\t\t\tchild: undefined,\n\t\t\tchildIndex: -1,\n\t\t\tchildCount: 0,\n\t\t\tblockId: sel.anchor.blockId,\n\t\t\toffset: sel.anchor.offset,\n\t\t});\n\t}\n\n\tconst parent: BlockNode | undefined = state.getParent(sel.anchor.blockId);\n\tif (!parent || parent.type !== 'list_item') return false;\n\tconst children: readonly BlockNode[] = getBlockChildren(parent);\n\tconst childIndex: number = children.findIndex((c) => c.id === block.id);\n\tif (childIndex < 0) return false;\n\n\treturn handler({\n\t\tstate,\n\t\titem: parent,\n\t\tchild: block,\n\t\tchildIndex,\n\t\tchildCount: children.length,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers Enter and Backspace keymaps for list items. */\nexport function registerListKeymaps(context: PluginContext): void {\n\tcontext.registerKeymap({\n\t\tEnter: () => handleEnter(context),\n\t\tBackspace: () => handleBackspace(context),\n\t});\n}\n\n// --- Enter Handler ---\n\n/**\n * Handles Enter inside a list item.\n * Leaf items: empty → exit list (convert to paragraph); non-empty → split\n * into a new item of the same type.\n * Container items: an empty trailing child exits into a new sibling item;\n * a lone empty child dissolves the item. Everything else falls through to\n * the default split (which grows the item's children).\n */\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.child) return handleEnterInContainerChild(context, ctx, ctx.child);\n\n\t\tconst text: string = getBlockText(ctx.item);\n\n\t\tif (text === '') {\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(ctx.state.selection)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst newBlockId = generateBlockId();\n\t\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\t\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\t\tconst attrs = buildListItemAttrs(listType, indent);\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.splitBlock(ctx.blockId, ctx.offset, newBlockId)\n\t\t\t.setBlockType(newBlockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\n/** Enter inside a container item's child: exit on an empty trailing child. */\nfunction handleEnterInContainerChild(\n\tcontext: PluginContext,\n\tctx: ListContext,\n\tchild: BlockNode,\n): boolean {\n\tif (!isEmptyParagraph(child)) return false;\n\tif (ctx.childIndex !== ctx.childCount - 1) return false;\n\n\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\tif (!location) return false;\n\n\tconst builder = ctx.state.transaction('input');\n\n\tif (ctx.childCount === 1) {\n\t\t// A lone empty child: the item has no content left — dissolve it and\n\t\t// keep the paragraph (same ID, so the caret stays put).\n\t\tdissolveListItem(builder, location);\n\t\tbuilder.setSelection(ctx.state.selection);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\t// Drop the empty trailing child and continue the list with a fresh item.\n\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\tconst newItemId = generateBlockId();\n\tconst newItem: BlockNode = createBlockNode(\n\t\tnodeType('list_item'),\n\t\t[createTextNode('')],\n\t\tnewItemId,\n\t\tbuildListItemAttrs(listType, indent),\n\t);\n\n\tbuilder\n\t\t.removeNode([...location.parentPath, ctx.item.id], ctx.childIndex)\n\t\t.insertNode(location.parentPath, location.index + 1, newItem)\n\t\t.setSelection(createCollapsedSelection(newItemId, 0));\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Backspace Handler ---\n\n/**\n * Handles Backspace at the start of a list item.\n * Leaf items convert back to a paragraph. Container items dissolve into\n * their block children when the caret sits at the very start of the first\n * child (the un-list gesture); later children fall through to the default\n * sibling merge.\n */\nfunction handleBackspace(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.offset !== 0) return false;\n\n\t\tif (ctx.child) {\n\t\t\tif (ctx.childIndex !== 0) return false;\n\t\t\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\t\t\tif (!location) return false;\n\t\t\tconst builder = ctx.state.transaction('input');\n\t\t\tdissolveListItem(builder, location);\n\t\t\tbuilder.setSelection(ctx.state.selection);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(ctx.state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n","/**\n * Locale interface and default English locale for the ListPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ListLocale {\n\treadonly bulletList: string;\n\treadonly numberedList: string;\n\treadonly checklist: string;\n\t/** Accessible name for the checklist item's checkbox marker (screen readers). */\n\treadonly checkboxLabel: string;\n\t/** Announced when a checklist item is toggled on. */\n\treadonly checkedAnnouncement: string;\n\t/** Announced when a checklist item is toggled off. */\n\treadonly uncheckedAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const LIST_LOCALE_EN: ListLocale = {\n\tbulletList: 'Bullet List',\n\tnumberedList: 'Numbered List',\n\tchecklist: 'Checklist',\n\tcheckboxLabel: 'To-do item',\n\tcheckedAnnouncement: 'Checked',\n\tuncheckedAnnouncement: 'Unchecked',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ListLocale> = import.meta.glob<{\n\tdefault: ListLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadListLocale(lang: string): Promise<ListLocale> {\n\treturn loadLocaleModule(localeModules, lang, LIST_LOCALE_EN);\n}\n","/**\n * Accessible checkbox marker for checklist items.\n *\n * The marker is a real `role=\"checkbox\"` element so assistive technology can\n * announce the item's checked state (WCAG 4.1.2 Name, Role, Value). It is\n * rendered `contenteditable=\"false\"` and flagged `data-widget` so the selection\n * layer treats it as zero-width view chrome, never as document content or a caret\n * position. The visible checkbox glyph is drawn in CSS.\n */\n\n/** CSS class identifying the checklist checkbox marker element. */\nexport const CHECKLIST_MARKER_CLASS = 'notectl-checklist-marker';\n\n/** Creates the accessible checkbox marker for a checklist item. */\nexport function createChecklistMarker(checked: boolean, label: string): HTMLElement {\n\tconst marker: HTMLElement = document.createElement('span');\n\tmarker.className = CHECKLIST_MARKER_CLASS;\n\tmarker.setAttribute('role', 'checkbox');\n\tmarker.setAttribute('aria-checked', String(checked));\n\tmarker.setAttribute('aria-label', label);\n\tmarker.setAttribute('contenteditable', 'false');\n\tmarker.setAttribute('data-widget', 'true');\n\treturn marker;\n}\n","/**\n * Toolbar item registration for list block types.\n * Registers bullet, ordered, and checklist toolbar buttons with active-state detection.\n */\n\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { allBlocksMatchListType } from './ListCommands.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Registers toolbar items for each enabled list type. */\nexport function registerListToolbarItems(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: `list-${def.type}`,\n\t\t\tgroup: 'block',\n\t\t\ticon: def.icon,\n\t\t\tlabel: getListLabel(def.type, locale),\n\t\t\tcommand: `toggleList:${def.type}`,\n\t\t\tisActive: (state) => isListActive(state, def.type),\n\t\t});\n\t}\n}\n\n// --- Helpers ---\n\nfunction getListLabel(type: ListType, locale: ListLocale): string {\n\tconst labels: Record<ListType, string> = {\n\t\tbullet: locale.bulletList,\n\t\tordered: locale.numberedList,\n\t\tchecklist: locale.checklist,\n\t};\n\treturn labels[type];\n}\n\nfunction isListActive(state: EditorState, listType: ListType): boolean {\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\t\treturn allBlocksMatchListType(state, range, listType);\n\t}\n\n\t// Children of container items resolve to their owning item (#194).\n\tconst block = resolveListItem(state, state.selection.anchor.blockId);\n\treturn block?.type === 'list_item' && block.attrs?.listType === listType;\n}\n","/**\n * ListPlugin: registers ordered, unordered, and checklist block types\n * with NodeSpecs, toggle commands, indent/outdent (Tab/Shift-Tab),\n * input rules, and toolbar buttons.\n *\n * This file is a thin orchestrator — command logic, input rules, keyboard\n * handlers, and toolbar rendering are delegated to dedicated modules.\n *\n * Sibling structure is modeled flat: every item carries a `listType` and an\n * `indent` attribute, so nesting between items needs no deep tree. Item\n * content is hybrid (#194): a single-paragraph item is a leaf with inline\n * children, while a multi-block item (second paragraph, code block, quote,\n * heading) is a container whose children are blocks.\n */\n\nimport { DecorationSet, type WidgetDecoration, widget } from '../../decorations/Decoration.js';\nimport { LIST_CSS, LIST_MARKER_WIDTH } from '../../editor/styles/list.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport { blockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { registerListCommands, toggleChecked } from './ListCommands.js';\nimport { LIST_TYPE_DEFINITIONS, type ListTypeDefinition } from './ListDefinitions.js';\nimport { registerListInputRules } from './ListInputRules.js';\nimport { registerListKeymaps } from './ListKeyboardHandlers.js';\nimport { LIST_LOCALE_EN, type ListLocale, loadListLocale } from './ListLocale.js';\nimport { CHECKLIST_MARKER_CLASS, createChecklistMarker } from './ListMarker.js';\nimport { registerListToolbarItems } from './ListToolbarItems.js';\n\n// --- Attribute Registry Augmentation ---\n\nexport type ListType = 'bullet' | 'ordered' | 'checklist';\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tlist_item: { listType: ListType; indent: number; checked: boolean };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface ListConfig {\n\t/** Which list types to enable. Defaults to all. */\n\treadonly types: readonly ListType[];\n\t/** Maximum indent depth. Defaults to 4. */\n\treadonly maxIndent: number;\n\t/** Live Markdown shortcuts: `- `/`* ` (bullet), `1. ` (ordered), `[ ] ` (checklist). Default true. */\n\treadonly inputRule?: boolean;\n\t/**\n\t * When true, checklist checkboxes remain interactive even in read-only mode.\n\t * Defaults to false (checkboxes are fully read-only).\n\t */\n\treadonly interactiveCheckboxes?: boolean;\n\treadonly locale?: ListLocale;\n}\n\nconst DEFAULT_CONFIG: ListConfig = {\n\ttypes: ['bullet', 'ordered', 'checklist'],\n\tmaxIndent: 4,\n};\n\n// --- Plugin ---\n\nexport class ListPlugin implements Plugin {\n\treadonly id = 'list';\n\treadonly name = 'List';\n\treadonly priority = 35;\n\n\tprivate readonly config: ListConfig;\n\tprivate locale!: ListLocale;\n\tprivate context: PluginContext | null = null;\n\tprivate checkboxMouseDownHandler: ((e: MouseEvent) => void) | null = null;\n\tprivate checkboxClickHandler: ((e: MouseEvent) => void) | null = null;\n\n\tconstructor(config?: Partial<ListConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LIST_LOCALE_EN, loadListLocale);\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tcontext.registerStyleSheet(LIST_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tregisterListCommands(context, this.config, enabledTypes, this.locale);\n\t\tregisterListKeymaps(context);\n\t\tif (this.config.inputRule !== false) registerListInputRules(context, enabledTypes);\n\t\tregisterListToolbarItems(context, enabledTypes, this.locale);\n\t\tthis.registerCheckboxHandlers(context);\n\t}\n\n\t/**\n\t * Leaf content rendering replaces a NodeSpec element's children, so the\n\t * checklist marker is declared as zero-width view chrome at offset zero.\n\t * Container list items retain the marker created by `toDOM`; only leaf IDs\n\t * occur in `getBlockOrder()` and therefore receive this decoration.\n\t */\n\tdecorations(state: EditorState): DecorationSet {\n\t\tconst markers: WidgetDecoration[] = [];\n\t\tfor (const id of state.getBlockOrder()) {\n\t\t\tconst block = state.getBlock(id);\n\t\t\tif (!block || !isNodeOfType(block, 'list_item') || block.attrs.listType !== 'checklist') {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst checked = block.attrs.checked;\n\t\t\tmarkers.push(\n\t\t\t\twidget(id, 0, () => createChecklistMarker(checked, this.locale.checkboxLabel), {\n\t\t\t\t\tkey: `checklist-marker:${checked}`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn DecorationSet.create(markers);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.context) {\n\t\t\tconst container: HTMLElement = this.context.getContainer();\n\t\t\tif (this.checkboxMouseDownHandler) {\n\t\t\t\tcontainer.removeEventListener('mousedown', this.checkboxMouseDownHandler);\n\t\t\t}\n\t\t\tif (this.checkboxClickHandler) {\n\t\t\t\tcontainer.removeEventListener('click', this.checkboxClickHandler);\n\t\t\t}\n\t\t}\n\t\tthis.checkboxMouseDownHandler = null;\n\t\tthis.checkboxClickHandler = null;\n\t\tthis.context = null;\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tconst checkboxLabel: string = this.locale.checkboxLabel;\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'list_item',\n\t\t\tgroup: 'block',\n\t\t\t// Hybrid content model (#194): the common single-paragraph item is a\n\t\t\t// leaf (inline text children); multi-block items are containers with\n\t\t\t// block children. Sibling nesting stays flat-with-indent, so list_item\n\t\t\t// itself is deliberately not an allowed child.\n\t\t\tcontent: {\n\t\t\t\tallow: ['text', 'paragraph', 'heading', 'code_block', 'blockquote', 'horizontal_rule'],\n\t\t\t},\n\t\t\tattrs: {\n\t\t\t\tlistType: { default: 'bullet' },\n\t\t\t\tindent: { default: 0 },\n\t\t\t\tchecked: { default: false },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst indent = node.attrs?.indent ?? 0;\n\t\t\t\tconst checked = node.attrs?.checked ?? false;\n\n\t\t\t\tconst li = createBlockElement('li', node.id);\n\t\t\t\tli.setAttribute('role', 'listitem');\n\t\t\t\tli.setAttribute('data-list-type', listType);\n\t\t\t\tli.setAttribute('data-indent', String(indent));\n\t\t\t\tli.className = `notectl-list-item notectl-list-item--${listType}`;\n\n\t\t\t\tif (indent > 0) {\n\t\t\t\t\tsetStyleProperty(li, 'marginLeft', `${indent * LIST_MARKER_WIDTH}px`);\n\t\t\t\t}\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\t// `data-checked` drives the CSS glyph; the checked state is exposed to\n\t\t\t\t\t// assistive technology via the marker's own role=\"checkbox\", not via an\n\t\t\t\t\t// (invalid) aria-checked on the listitem. The marker is the first child\n\t\t\t\t\t// so reconciled inline content is appended after it.\n\t\t\t\t\tli.setAttribute('data-checked', String(checked));\n\t\t\t\t\tli.appendChild(createChecklistMarker(checked, checkboxLabel));\n\t\t\t\t}\n\t\t\t\tli.setAttribute('aria-level', String(indent + 1));\n\n\t\t\t\treturn li;\n\t\t\t},\n\t\t\twrapper(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst tag = listType === 'ordered' ? 'ol' : 'ul';\n\t\t\t\treturn {\n\t\t\t\t\ttag,\n\t\t\t\t\tkey: `list-${listType}`,\n\t\t\t\t\tclassName: `notectl-list notectl-list--${listType}`,\n\t\t\t\t\tattrs: { role: 'list' },\n\t\t\t\t};\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst listType: string = (node.attrs?.listType as string) ?? 'bullet';\n\t\t\t\tconst checked: boolean = (node.attrs?.checked as boolean) ?? false;\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tconst checkedAttr: string = checked ? ' checked' : '';\n\t\t\t\t\tconst ariaChecked: string = String(checked);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t`<li role=\"checkbox\" aria-checked=\"${ariaChecked}\">` +\n\t\t\t\t\t\t`<input type=\"checkbox\" disabled${checkedAttr}>` +\n\t\t\t\t\t\t`${content || '<br>'}</li>`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn `<li>${content || '<br>'}</li>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'li' }],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['ul', 'ol', 'li', 'input'],\n\t\t\t\tattrs: ['type', 'disabled', 'checked', 'role', 'aria-checked'],\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerCheckboxHandlers(context: PluginContext): void {\n\t\tif (!this.config.types.includes('checklist')) return;\n\n\t\tconst findChecklistItem = (target: EventTarget | null): Element | null => {\n\t\t\tif (!(target instanceof HTMLElement)) return null;\n\t\t\tconst marker: Element | null = target.closest(`.${CHECKLIST_MARKER_CLASS}`);\n\t\t\tif (!marker) return null;\n\t\t\treturn marker.closest('.notectl-list-item--checklist');\n\t\t};\n\n\t\tthis.checkboxMouseDownHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\t\t\tif (!findChecklistItem(e.target)) return;\n\t\t\te.preventDefault();\n\t\t};\n\n\t\tthis.checkboxClickHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\t\t\tconst li: Element | null = findChecklistItem(e.target);\n\t\t\tif (!li) return;\n\n\t\t\te.preventDefault();\n\n\t\t\tconst bid: string | null = li.getAttribute('data-block-id');\n\t\t\tif (!bid) return;\n\n\t\t\ttoggleChecked(context, {\n\t\t\t\tinteractiveCheckboxes: this.config.interactiveCheckboxes,\n\t\t\t\ttargetId: blockId(bid),\n\t\t\t\tlocale: this.locale,\n\t\t\t});\n\t\t};\n\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.addEventListener('mousedown', this.checkboxMouseDownHandler);\n\t\tcontainer.addEventListener('click', this.checkboxClickHandler);\n\t}\n\n\tprivate getEnabledTypes(): readonly ListTypeDefinition[] {\n\t\treturn LIST_TYPE_DEFINITIONS.filter((def) => this.config.types.includes(def.type));\n\t}\n}\n"],"mappings":"Y,shBCSA,SAAgBqB,EACfC,EACAC,EACAC,GAEA,MAAiB,cAAbF,EACI,CAAEA,WAAUC,SAAQC,QAASA,IAAW,GAEzC,CAAEF,WAAUC,SACpB,CCWA,SAAgBE,EAAgBC,EAAoBC,GACnD,MAAMC,EAA+BF,EAAMG,SAASF,GACpD,GAAoB,cAAhBC,GAAOE,KAAsB,OAAOF,EACxC,MAAMG,EAAuCL,EAAMM,YAAYL,GAC/D,GAAKI,EACL,IAAK,IAAIE,EAAIF,EAAKG,OAAS,EAAGD,GAAK,EAAGA,IAAK,CAC1C,MAAME,EAAkCJ,EAAKE,GACvCG,EAAkCD,EAAaT,EAAMG,SAASM,QAAc,EAClF,GAAuB,cAAnBC,GAAUN,KAAsB,OAAOM,CAC5C,CAED,CAGA,SAAgBC,EAAeX,EAAoBY,GAClD,MAAMC,EAA8Bb,EAAMG,SAASS,GACnD,IAAKC,GAAsB,cAAdA,EAAKT,KAAsB,OACxC,MAAMC,EAAuCL,EAAMM,YAAYM,GAC/D,IAAKP,EAAM,OAEX,MAAMS,EAAiCT,EAAKU,MAAM,GAAG,GAC/CC,EAAgCF,EAAWA,EAAWN,OAAS,GAI/DS,GAHiCD,EACpCzC,EAAiByB,EAAMG,SAASa,IAChChB,EAAMkB,IAAIC,UACkBC,UAAWC,GAAYA,EAAQpB,KAAOW,GACrE,OAAIK,EAAQ,OAAZ,EACO,CAAEJ,OAAMC,aAAYG,QAC5B,CAQA,SAAgBK,EAAiBC,EAA6BC,GAC7DD,EAAQE,WAAWD,EAASV,WAAYU,EAASP,OAE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aAC1B,EACAW,UAAW,CAAC,CAAEH,IAAK,OACnBI,SAAU,CACTC,KAAM,CAAC,KAAM,KAAM,KAAM,SACzBpI,MAAO,CAAC,OAAQ,WAAY,UAAW,OAAQ,kBAGlD,CAEA,wBAAA8G,CAAiCpI,GAChC,IAAK6F,KAAKJ,OAAOJ,MAAMgB,SAAS,aAAc,OAE9C,MAAMsD,EAAqB5I,IAC1B,KAAMA,aAAkB6I,aAAc,OAAO,KAC7C,MAAMlF,EAAyB3D,EAAO8I,QAAQ,IAAItF,KAClD,OAAKG,EACEA,EAAOmF,QAAQ,iCADF,MAIrBhE,KAAKH,yBAA4BoE,IAC5B9J,EAAQyC,eAAiBoD,KAAKJ,OAAOnD,uBACpCqH,EAAkBG,EAAE/I,SACzB+I,EAAEC,kBAGHlE,KAAKF,qBAAwBmE,IAC5B,GAAI9J,EAAQyC,eAAiBoD,KAAKJ,OAAOnD,sBAAuB,OAChE,MAAM4G,EAAqBS,EAAkBG,EAAE/I,QAC/C,IAAKmI,EAAI,OAETY,EAAEC,iBAEF,MAAMjJ,EAAqBoI,EAAGc,aAAa,iBACtClJ,GAELsB,EAAcpC,EAAS,CACtBsC,sBAAuBuD,KAAKJ,OAAOnD,sBACnCC,SAAUrF,EAAQ4D,GAClB0B,OAAQqD,KAAKrD,UAIf,MAAMkG,EAAyB1I,EAAQ2I,eACvCD,EAAUuB,iBAAiB,YAAapE,KAAKH,0BAC7CgD,EAAUuB,iBAAiB,QAASpE,KAAKF,qBAC1C,CAEA,eAAAK,GACC,OAAO/C,EAAsBiH,OAAQ/D,GAAQN,KAAKJ,OAAOJ,MAAMgB,SAASF,EAAI9H,MAC7E,U"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkCommands-C0ps9h0z.mjs","names":[],"sources":["../../src/commands/MarkCommands.ts"],"sourcesContent":["/**\n * Mark-related commands: toggling bold/italic/underline and checking\n * whether a mark is active.\n */\n\nimport {\n\ttype BlockNode,\n\ttype Mark,\n\tgetBlockLength,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport { isMarkAllowed } from '../model/Schema.js';\nimport { isCollapsed, isTextSelection, selectionRange } from '../model/Selection.js';\nimport type { MarkTypeName } from '../model/TypeBrands.js';\nimport { markType as mkType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { resolveCursorMarks } from './CursorMarks.js';\nimport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Feature Configuration ---\n\nexport interface FeatureConfig {\n\treadonly bold: boolean;\n\treadonly italic: boolean;\n\treadonly underline: boolean;\n}\n\nconst defaultFeatures: FeatureConfig = { bold: true, italic: true, underline: true };\n\n/**\n * Toggles a mark on the current selection.\n * If collapsed, toggles stored marks. If range, applies/removes from text.\n */\nexport function toggleMark(\n\tstate: EditorState,\n\tmarkType: MarkTypeName,\n\tfeatures: FeatureConfig = defaultFeatures,\n): Transaction | null {\n\tif (isFeatureGated(markType, features)) return null;\n\tif (!isMarkAllowed(state.schema, markType)) return null;\n\tif (!isTextSelection(state.selection)) return null;\n\n\tconst mark: Mark = { type: markType };\n\tconst sel = state.selection;\n\n\tif (isCollapsed(sel)) {\n\t\t// Toggle stored marks\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks = resolveCursorMarks(state);\n\t\tconst hasIt = hasMark(currentMarks, markType);\n\t\tconst newMarks = hasIt\n\t\t\t? currentMarks.filter((m) => m.type !== markType)\n\t\t\t: [...currentMarks, mark];\n\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\t// Range selection — apply/remove mark to all blocks in range\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\t// Determine if we should add or remove\n\tconst shouldRemove = isMarkActiveInRange(state, markType);\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tif (shouldRemove) {\n\t\t\tbuilder.removeMark(blockId, from, to, mark);\n\t\t} else {\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t}\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\nexport function toggleBold(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('bold'), features);\n}\n\nexport function toggleItalic(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('italic'), features);\n}\n\nexport function toggleUnderline(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('underline'), features);\n}\n\n/** Checks if a mark is active at the current selection. */\nexport function isMarkActive(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\treturn hasMark(resolveCursorMarks(state), markType);\n\t}\n\n\treturn isMarkActiveInRange(state, markType);\n}\n\n/** Per-slice result of scanning a block for a mark. */\ntype SliceMarkStatus = 'present' | 'missing' | 'empty';\n\n/** Checks if a mark is active across the entire selection range. */\nfunction isMarkActiveInRange(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tlet sawMarkedText = false;\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst blockLen = getBlockLength(block);\n\t\tconst from = i === fromIdx ? range.from.offset : 0;\n\t\tconst to = i === toIdx ? range.to.offset : blockLen;\n\n\t\tconst status = markStatusInBlock(block, from, to, markType);\n\t\tif (status === 'missing') return false;\n\t\tif (status === 'present') sawMarkedText = true;\n\t}\n\n\t// Active only when the range actually contains text that carries the mark.\n\t// A range with no markable text (only empty blocks, or a void block such as a\n\t// lone display formula on Ctrl+A) is NOT active — returning true there would\n\t// light up every toolbar format button.\n\treturn sawMarkedText;\n}\n\n/**\n * Scans a block's `[from, to)` slice for `markType`. Returns:\n * - `missing` when some text character in the slice lacks the mark,\n * - `present` when the slice has text and all of it carries the mark,\n * - `empty` when the slice has no markable text (empty slice or only InlineNodes).\n *\n * An `empty` slice is neutral: it neither activates nor inverts the range check,\n * so an empty paragraph in the middle of a multi-block selection does not flip\n * the result (regression #130).\n */\nfunction markStatusInBlock(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tmarkType: MarkTypeName,\n): SliceMarkStatus {\n\tlet pos = 0;\n\tlet sawText = false;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst childEnd = pos + child.text.length;\n\t\t\tif (childEnd > from && pos < to) {\n\t\t\t\tsawText = true;\n\t\t\t\tif (!hasMark(child.marks, markType)) return 'missing';\n\t\t\t}\n\t\t\tpos = childEnd;\n\t\t} else {\n\t\t\t// InlineNode: atomic, width 1, carries no marks.\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn sawText ? 'present' : 'empty';\n}\n\nfunction isFeatureGated(type: MarkTypeName, features: FeatureConfig): boolean {\n\tconst key = type as string;\n\tif (key === 'bold') return !features.bold;\n\tif (key === 'italic') return !features.italic;\n\tif (key === 'underline') return !features.underline;\n\treturn false;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MarkCommands-C0ps9h0z.mjs","names":["mkType","hasMark","getInlineChildren","isTextNode","getBlockLength","isCollapsed","isTextSelection","selectionRange","markType","isMarkAllowed","resolveCursorMarks","forEachBlockInRange","defaultFeatures","bold","italic","underline","toggleMark","state","features","type","key","isFeatureGated","schema","selection","mark","sel","getBlock","anchor","blockId","currentMarks","newMarks","filter","m","transaction","setStoredMarks","storedMarks","setSelection","build","range","getBlockOrder","builder","shouldRemove","isMarkActiveInRange","from","to","removeMark","addMark","toggleBold","toggleItalic","toggleUnderline","isMarkActive","blockOrder","fromIdx","indexOf","toIdx","sawMarkedText","i","block","blockLen","status","markStatusInBlock","offset","pos","sawText","child","childEnd","text","length","marks"],"sources":["../../src/commands/MarkCommands.ts"],"sourcesContent":["/**\n * Mark-related commands: toggling bold/italic/underline and checking\n * whether a mark is active.\n */\n\nimport {\n\ttype BlockNode,\n\ttype Mark,\n\tgetBlockLength,\n\tgetInlineChildren,\n\thasMark,\n\tisTextNode,\n} from '../model/Document.js';\nimport { isMarkAllowed } from '../model/Schema.js';\nimport { isCollapsed, isTextSelection, selectionRange } from '../model/Selection.js';\nimport type { MarkTypeName } from '../model/TypeBrands.js';\nimport { markType as mkType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { resolveCursorMarks } from './CursorMarks.js';\nimport { forEachBlockInRange } from './RangeIterator.js';\n\n// --- Feature Configuration ---\n\nexport interface FeatureConfig {\n\treadonly bold: boolean;\n\treadonly italic: boolean;\n\treadonly underline: boolean;\n}\n\nconst defaultFeatures: FeatureConfig = { bold: true, italic: true, underline: true };\n\n/**\n * Toggles a mark on the current selection.\n * If collapsed, toggles stored marks. If range, applies/removes from text.\n */\nexport function toggleMark(\n\tstate: EditorState,\n\tmarkType: MarkTypeName,\n\tfeatures: FeatureConfig = defaultFeatures,\n): Transaction | null {\n\tif (isFeatureGated(markType, features)) return null;\n\tif (!isMarkAllowed(state.schema, markType)) return null;\n\tif (!isTextSelection(state.selection)) return null;\n\n\tconst mark: Mark = { type: markType };\n\tconst sel = state.selection;\n\n\tif (isCollapsed(sel)) {\n\t\t// Toggle stored marks\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return null;\n\t\tconst currentMarks = resolveCursorMarks(state);\n\t\tconst hasIt = hasMark(currentMarks, markType);\n\t\tconst newMarks = hasIt\n\t\t\t? currentMarks.filter((m) => m.type !== markType)\n\t\t\t: [...currentMarks, mark];\n\n\t\treturn state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t}\n\n\t// Range selection — apply/remove mark to all blocks in range\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\t// Determine if we should add or remove\n\tconst shouldRemove = isMarkActiveInRange(state, markType);\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tif (shouldRemove) {\n\t\t\tbuilder.removeMark(blockId, from, to, mark);\n\t\t} else {\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t}\n\t});\n\n\tbuilder.setSelection(sel);\n\treturn builder.build();\n}\n\nexport function toggleBold(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('bold'), features);\n}\n\nexport function toggleItalic(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('italic'), features);\n}\n\nexport function toggleUnderline(state: EditorState, features?: FeatureConfig): Transaction | null {\n\treturn toggleMark(state, mkType('underline'), features);\n}\n\n/** Checks if a mark is active at the current selection. */\nexport function isMarkActive(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\treturn hasMark(resolveCursorMarks(state), markType);\n\t}\n\n\treturn isMarkActiveInRange(state, markType);\n}\n\n/** Per-slice result of scanning a block for a mark. */\ntype SliceMarkStatus = 'present' | 'missing' | 'empty';\n\n/** Checks if a mark is active across the entire selection range. */\nfunction isMarkActiveInRange(state: EditorState, markType: MarkTypeName): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst blockOrder = state.getBlockOrder();\n\tconst range = selectionRange(sel, blockOrder);\n\n\tconst fromIdx = blockOrder.indexOf(range.from.blockId);\n\tconst toIdx = blockOrder.indexOf(range.to.blockId);\n\n\tlet sawMarkedText = false;\n\tfor (let i = fromIdx; i <= toIdx; i++) {\n\t\tconst blockId = blockOrder[i];\n\t\tif (!blockId) continue;\n\t\tconst block = state.getBlock(blockId);\n\t\tif (!block) continue;\n\t\tconst blockLen = getBlockLength(block);\n\t\tconst from = i === fromIdx ? range.from.offset : 0;\n\t\tconst to = i === toIdx ? range.to.offset : blockLen;\n\n\t\tconst status = markStatusInBlock(block, from, to, markType);\n\t\tif (status === 'missing') return false;\n\t\tif (status === 'present') sawMarkedText = true;\n\t}\n\n\t// Active only when the range actually contains text that carries the mark.\n\t// A range with no markable text (only empty blocks, or a void block such as a\n\t// lone display formula on Ctrl+A) is NOT active — returning true there would\n\t// light up every toolbar format button.\n\treturn sawMarkedText;\n}\n\n/**\n * Scans a block's `[from, to)` slice for `markType`. Returns:\n * - `missing` when some text character in the slice lacks the mark,\n * - `present` when the slice has text and all of it carries the mark,\n * - `empty` when the slice has no markable text (empty slice or only InlineNodes).\n *\n * An `empty` slice is neutral: it neither activates nor inverts the range check,\n * so an empty paragraph in the middle of a multi-block selection does not flip\n * the result (regression #130).\n */\nfunction markStatusInBlock(\n\tblock: BlockNode,\n\tfrom: number,\n\tto: number,\n\tmarkType: MarkTypeName,\n): SliceMarkStatus {\n\tlet pos = 0;\n\tlet sawText = false;\n\tfor (const child of getInlineChildren(block)) {\n\t\tif (isTextNode(child)) {\n\t\t\tconst childEnd = pos + child.text.length;\n\t\t\tif (childEnd > from && pos < to) {\n\t\t\t\tsawText = true;\n\t\t\t\tif (!hasMark(child.marks, markType)) return 'missing';\n\t\t\t}\n\t\t\tpos = childEnd;\n\t\t} else {\n\t\t\t// InlineNode: atomic, width 1, carries no marks.\n\t\t\tpos += 1;\n\t\t}\n\t}\n\treturn sawText ? 'present' : 'empty';\n}\n\nfunction isFeatureGated(type: MarkTypeName, features: FeatureConfig): boolean {\n\tconst key = type as string;\n\tif (key === 'bold') return !features.bold;\n\tif (key === 'italic') return !features.italic;\n\tif (key === 'underline') return !features.underline;\n\treturn false;\n}\n"],"mappings":"Y,wSA8BA,IAAMY,EAAiC,CAAEC,MAAM,EAAMC,QAAQ,EAAMC,WAAW,GAM9E,SAAgBC,EACfC,EACAT,EACAU,EAA0BN,GAE1B,GAwID,SAAwBO,EAAoBD,GAC3C,MAAME,EAAMD,EACZ,MAAY,SAARC,GAAwBF,EAASL,KACzB,WAARO,GAA0BF,EAASJ,OAC3B,cAARM,IAA6BF,EAASH,SAE3C,CA9IKM,CAAeb,EAAUU,GAAW,OAAO,KAC/C,IAAKT,EAAcQ,EAAMK,OAAQd,GAAW,OAAO,KACnD,IAAKF,EAAgBW,EAAMM,WAAY,OAAO,KAE9C,MAAMC,EAAa,CAAEL,KAAMX,GACrBiB,EAAMR,EAAMM,UAElB,GAAIlB,EAAYoB,GAAM,CAGrB,IADoBR,EAAMS,SAASD,EAAIE,OAAOC,SAC5B,OAAO,KACzB,MAAMC,EAAenB,EAAmBO,GAElCa,EADQ7B,EAAQ4B,EAAcrB,GAEjCqB,EAAaE,OAAQC,GAAMA,EAAEb,OAASX,GACtC,IAAIqB,EAAcL,GAErB,OAAOP,EACLgB,YAAY,WACZC,eAAeJ,EAAUb,EAAMkB,aAC/BC,aAAaX,GACbY,OACH,CAGA,MAAMC,EAAQ/B,EAAekB,EAAKR,EAAMsB,iBAClCC,EAAUvB,EAAMgB,YAAY,WAG5BQ,EAAeC,EAAoBzB,EAAOT,GAWhD,OATAG,EAAoBM,EAAOqB,EAAA,CAAQV,EAASe,EAAMC,KAC7CH,EACHD,EAAQK,WAAWjB,EAASe,EAAMC,EAAIpB,GAEtCgB,EAAQM,QAAQlB,EAASe,EAAMC,EAAIpB,KAIrCgB,EAAQJ,aAAaX,GACde,EAAQH,OAChB,CAEA,SAAgBU,EAAW9B,EAAoBC,GAC9C,OAAOF,EAAWC,EAAOjB,EAAO,QAASkB,EAC1C,CAEA,SAAgB8B,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+D,EAAMI,MAAO5D,IAAW,MAAO,UAE7CsD,EAAMG,CACP,MAECH,GAAO,EAGT,OAAOC,EAAU,UAAY,OAC9B,Q"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkInputRule-DNneF2gp.mjs","names":[],"sources":["../../src/plugins/shared/MarkInputRule.ts"],"sourcesContent":["/**\n * Shared factory for live Markdown \"wrapping mark\" input rules (D6).\n *\n * Covers the three wrapping marks that share the `inline-code` rule's shape:\n * bold (`**x**`), italic (`*x*`), and strikethrough (`~~x~~`). The link rule is\n * structurally different (two capture groups, an `href`/`title` attr) and stays\n * bespoke in the link plugin. These live rules are intentionally simpler than\n * the full parser and may diverge in edge cases; the conformance bar applies to\n * full-document import/export, not live typing.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { INLINE_NODE_PLACEHOLDER, type InputRule } from '../../model/InputRule.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\n\n/** Escapes a string for safe use inside a RegExp character class / literal. */\nfunction escapeRegExp(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Builds a live input rule that wraps `delimiter…delimiter` text in `markTypeName`.\n * The opening delimiter must not be preceded by its own first character (so `*`\n * does not fire inside `**`), and the wrapped text may not contain that\n * character or a newline (a bounded, backtracking-free pattern).\n */\nexport function createMarkInputRule(markTypeName: string, delimiter: string): InputRule {\n\tconst delim: string = escapeRegExp(delimiter);\n\tconst guard: string = escapeRegExp(delimiter[0] ?? '');\n\t// The inner run excludes the inline-node placeholder so the rule never wraps\n\t// across an inline node nor re-inserts the sentinel as literal text.\n\tconst ph: string = INLINE_NODE_PLACEHOLDER;\n\tconst pattern = new RegExp(`(?:^|[^${guard}])(${delim}([^${guard}\\\\n${ph}]+)${delim})$`);\n\n\treturn {\n\t\tpattern,\n\t\thandler(state, match, _start, end) {\n\t\t\tconst sel = state.selection;\n\t\t\tif (!isTextSelection(sel) || !isCollapsed(sel)) return null;\n\n\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\tconst inner: string | undefined = match[2];\n\t\t\tconst expr: string | undefined = match[1];\n\t\t\tif (!inner || !expr) return null;\n\n\t\t\tconst exprStart: number = end - expr.length;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.deleteTextAt(sel.anchor.blockId, exprStart, end)\n\t\t\t\t.insertText(sel.anchor.blockId, exprStart, inner, [{ type: markType(markTypeName) }])\n\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, exprStart + inner.length))\n\t\t\t\t.build();\n\t\t},\n\t};\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MarkInputRule-DNneF2gp.mjs","names":["isCollapsed","isTextSelection","createCollapsedSelection","markType","escapeRegExp","value","replace","createMarkInputRule","markTypeName","delimiter","delim","guard","pattern","RegExp","handler","state","match","_start","end","sel","selection","block","getBlock","anchor","blockId","type","inner","expr","exprStart","length","transaction","deleteTextAt","insertText","setSelection","build"],"sources":["../../src/plugins/shared/MarkInputRule.ts"],"sourcesContent":["/**\n * Shared factory for live Markdown \"wrapping mark\" input rules (D6).\n *\n * Covers the three wrapping marks that share the `inline-code` rule's shape:\n * bold (`**x**`), italic (`*x*`), and strikethrough (`~~x~~`). The link rule is\n * structurally different (two capture groups, an `href`/`title` attr) and stays\n * bespoke in the link plugin. These live rules are intentionally simpler than\n * the full parser and may diverge in edge cases; the conformance bar applies to\n * full-document import/export, not live typing.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { INLINE_NODE_PLACEHOLDER, type InputRule } from '../../model/InputRule.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\n\n/** Escapes a string for safe use inside a RegExp character class / literal. */\nfunction escapeRegExp(value: string): string {\n\treturn value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Builds a live input rule that wraps `delimiter…delimiter` text in `markTypeName`.\n * The opening delimiter must not be preceded by its own first character (so `*`\n * does not fire inside `**`), and the wrapped text may not contain that\n * character or a newline (a bounded, backtracking-free pattern).\n */\nexport function createMarkInputRule(markTypeName: string, delimiter: string): InputRule {\n\tconst delim: string = escapeRegExp(delimiter);\n\tconst guard: string = escapeRegExp(delimiter[0] ?? '');\n\t// The inner run excludes the inline-node placeholder so the rule never wraps\n\t// across an inline node nor re-inserts the sentinel as literal text.\n\tconst ph: string = INLINE_NODE_PLACEHOLDER;\n\tconst pattern = new RegExp(`(?:^|[^${guard}])(${delim}([^${guard}\\\\n${ph}]+)${delim})$`);\n\n\treturn {\n\t\tpattern,\n\t\thandler(state, match, _start, end) {\n\t\t\tconst sel = state.selection;\n\t\t\tif (!isTextSelection(sel) || !isCollapsed(sel)) return null;\n\n\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\tconst inner: string | undefined = match[2];\n\t\t\tconst expr: string | undefined = match[1];\n\t\t\tif (!inner || !expr) return null;\n\n\t\t\tconst exprStart: number = end - expr.length;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.deleteTextAt(sel.anchor.blockId, exprStart, end)\n\t\t\t\t.insertText(sel.anchor.blockId, exprStart, inner, [{ type: markType(markTypeName) }])\n\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, exprStart + inner.length))\n\t\t\t\t.build();\n\t\t},\n\t};\n}\n"],"mappings":"Y,6FAiBA,SAASI,EAAaC,GACrB,OAAOA,EAAMC,QAAQ,sBAAuB,OAC7C,CAQA,SAAgBC,EAAoBC,EAAsBC,GACzD,MAAMC,EAAgBN,EAAaK,GAC7BE,EAAgBP,EAAaK,EAAU,IAAM,IAMnD,MAAO,CACNG,QAAA,IAHmBC,OAAO,UAAUF,OAAWD,OAAWC,WAAmBD,OAI7E,OAAAI,CAAQC,EAAOC,EAAOC,EAAQC,GAC7B,MAAMC,EAAMJ,EAAMK,UAClB,IAAKnB,EAAgBkB,KAASnB,EAAYmB,GAAM,OAAO,KAEvD,MAAME,EAA+BN,EAAMO,SAASH,EAAII,OAAOC,SAC/D,IAAKH,GAAwB,eAAfA,EAAMI,KAAuB,OAAO,KAElD,MAAMC,EAA4BV,EAAM,GAClCW,EAA2BX,EAAM,GACvC,IAAKU,IAAUC,EAAM,OAAO,KAE5B,MAAMC,EAAoBV,EAAMS,EAAKE,OACrC,OAAOd,EACLe,YAAY,SACZC,aAAaZ,EAAII,OAAOC,QAASI,EAAWV,GAC5Cc,WAAWb,EAAII,OAAOC,QAASI,EAAWF,EAAO,CAAC,CAAED,KAAMtB,EAASK,MACnEyB,aAAa/B,EAAyBiB,EAAII,OAAOC,QAASI,EAAYF,EAAMG,SAC5EK,OACH,EAEF,Q"}
|