@notectl/core 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (757) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs +2 -0
  3. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs.map +1 -0
  4. package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -1
  5. package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -1
  6. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs +2 -0
  7. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs.map +1 -0
  8. package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -1
  9. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
  10. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
  11. package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
  12. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs +2 -0
  13. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs.map +1 -0
  14. package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -1
  15. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs +2 -0
  16. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs.map +1 -0
  17. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs +2 -0
  18. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs.map +1 -0
  19. package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
  20. package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -1
  21. package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -1
  22. package/dist/chunks/Commands-vqbwh6Ic.mjs +2 -0
  23. package/dist/chunks/Commands-vqbwh6Ic.mjs.map +1 -0
  24. package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
  25. package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
  26. package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -1
  27. package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -1
  28. package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -1
  29. package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
  30. package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -1
  31. package/dist/chunks/DocumentParser-D4g5npEi.mjs +2 -0
  32. package/dist/chunks/DocumentParser-D4g5npEi.mjs.map +1 -0
  33. package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
  34. package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
  35. package/dist/chunks/EditorUI-DrQI95FW.mjs +2 -0
  36. package/dist/chunks/EditorUI-DrQI95FW.mjs.map +1 -0
  37. package/dist/chunks/FontPlugin-Bzlluh1_.mjs +2 -0
  38. package/dist/chunks/FontPlugin-Bzlluh1_.mjs.map +1 -0
  39. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs +2 -0
  40. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs.map +1 -0
  41. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs +2 -0
  42. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs.map +1 -0
  43. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs +2 -0
  44. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs.map +1 -0
  45. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs +2 -0
  46. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs.map +1 -0
  47. package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -1
  48. package/dist/chunks/{HardBreakPlugin-svNnJ9Xj.mjs → HardBreakPlugin-lo8Mcg9G.mjs} +2 -2
  49. package/dist/chunks/HardBreakPlugin-lo8Mcg9G.mjs.map +1 -0
  50. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs +2 -0
  51. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs.map +1 -0
  52. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs +2 -0
  53. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs.map +1 -0
  54. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs +2 -0
  55. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs.map +1 -0
  56. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs +2 -0
  57. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs.map +1 -0
  58. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs +2 -0
  59. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs.map +1 -0
  60. package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -1
  61. package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
  62. package/dist/chunks/LinkPlugin-CFw22a9X.mjs +2 -0
  63. package/dist/chunks/LinkPlugin-CFw22a9X.mjs.map +1 -0
  64. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs +2 -0
  65. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs.map +1 -0
  66. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs +2 -0
  67. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs.map +1 -0
  68. package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -1
  69. package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
  70. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs → MarkdownHTMLRegistry-Cj7N2wqs.mjs} +2 -2
  71. package/dist/chunks/MarkdownHTMLRegistry-Cj7N2wqs.mjs.map +1 -0
  72. package/dist/chunks/{MarkdownParser-CvYOvU3d.mjs → MarkdownParser-JOfPSvGv.mjs} +2 -2
  73. package/dist/chunks/MarkdownParser-JOfPSvGv.mjs.map +1 -0
  74. package/dist/chunks/{MarkdownSerializer-CdUBWWGI.mjs → MarkdownSerializer-Y6saYClE.mjs} +2 -2
  75. package/dist/chunks/MarkdownSerializer-Y6saYClE.mjs.map +1 -0
  76. package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
  77. package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -1
  78. package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -1
  79. package/dist/chunks/{NodeSelectionCommands-B0Sb4ux4.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
  80. package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
  81. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
  82. package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
  83. package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
  84. package/dist/chunks/PopupManager-DpxoBl54.mjs +2 -0
  85. package/dist/chunks/PopupManager-DpxoBl54.mjs.map +1 -0
  86. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  87. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs +2 -0
  88. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs.map +1 -0
  89. package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -1
  90. package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -1
  91. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs → SchemaRegistry-CT3T7S1i.mjs} +2 -2
  92. package/dist/chunks/SchemaRegistry-CT3T7S1i.mjs.map +1 -0
  93. package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
  94. package/dist/chunks/SelectionReplacement-Cj4FLlPz.mjs +2 -0
  95. package/dist/chunks/SelectionReplacement-Cj4FLlPz.mjs.map +1 -0
  96. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs → SelectionSync-8y0nbBHZ.mjs} +2 -2
  97. package/dist/chunks/SelectionSync-8y0nbBHZ.mjs.map +1 -0
  98. package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -1
  99. package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
  100. package/dist/chunks/SimpleMark-DPTsIl9w.mjs +2 -0
  101. package/dist/chunks/SimpleMark-DPTsIl9w.mjs.map +1 -0
  102. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs +2 -0
  103. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs.map +1 -0
  104. package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
  105. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs +2 -0
  106. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs.map +1 -0
  107. package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -1
  108. package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
  109. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs +2 -0
  110. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs.map +1 -0
  111. package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
  112. package/dist/chunks/{TableDimensions-BSEOEox2.mjs → TableDimensions-B-OWjTuW.mjs} +2 -2
  113. package/dist/chunks/TableDimensions-B-OWjTuW.mjs.map +1 -0
  114. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs +2 -0
  115. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs.map +1 -0
  116. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs +2 -0
  117. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs.map +1 -0
  118. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs +2 -0
  119. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs.map +1 -0
  120. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs → TextDirectionAutoPlugin-CkIETM5n.mjs} +2 -2
  121. package/dist/chunks/TextDirectionAutoPlugin-CkIETM5n.mjs.map +1 -0
  122. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs +2 -0
  123. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs.map +1 -0
  124. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
  125. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs.map +1 -0
  126. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs +2 -0
  127. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs.map +1 -0
  128. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
  129. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs +2 -0
  130. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs.map +1 -0
  131. package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
  132. package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
  133. package/dist/chunks/VideoPlugin-lZCBlIon.mjs +2 -0
  134. package/dist/chunks/VideoPlugin-lZCBlIon.mjs.map +1 -0
  135. package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
  136. package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
  137. package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
  138. package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
  139. package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
  140. package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
  141. package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
  142. package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
  143. package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
  144. package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
  145. package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
  146. package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
  147. package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
  148. package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
  149. package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
  150. package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
  151. package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
  152. package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
  153. package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
  154. package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
  155. package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
  156. package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
  157. package/dist/chunks/ar-Dp1oBWyG.mjs +2 -0
  158. package/dist/chunks/ar-Dp1oBWyG.mjs.map +1 -0
  159. package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
  160. package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
  161. package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
  162. package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
  163. package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
  164. package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
  165. package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -1
  166. package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
  167. package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
  168. package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
  169. package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
  170. package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
  171. package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
  172. package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
  173. package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
  174. package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
  175. package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
  176. package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
  177. package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
  178. package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
  179. package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
  180. package/dist/chunks/de-D3J8XPCR.mjs +2 -0
  181. package/dist/chunks/de-D3J8XPCR.mjs.map +1 -0
  182. package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
  183. package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
  184. package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
  185. package/dist/chunks/de-DViI26lG.mjs.map +1 -1
  186. package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
  187. package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
  188. package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
  189. package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
  190. package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
  191. package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
  192. package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
  193. package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
  194. package/dist/chunks/es-B0Za939C.mjs.map +1 -1
  195. package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
  196. package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
  197. package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
  198. package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
  199. package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
  200. package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
  201. package/dist/chunks/es-Bbz885DZ.mjs +2 -0
  202. package/dist/chunks/es-Bbz885DZ.mjs.map +1 -0
  203. package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
  204. package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
  205. package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
  206. package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
  207. package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
  208. package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
  209. package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
  210. package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
  211. package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
  212. package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
  213. package/dist/chunks/es-DFokqQst.mjs.map +1 -1
  214. package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
  215. package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
  216. package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
  217. package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
  218. package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
  219. package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
  220. package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
  221. package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
  222. package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
  223. package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
  224. package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
  225. package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
  226. package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
  227. package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
  228. package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
  229. package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
  230. package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
  231. package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
  232. package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
  233. package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
  234. package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
  235. package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
  236. package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
  237. package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
  238. package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
  239. package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
  240. package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
  241. package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
  242. package/dist/chunks/fr-GEgM1j3w.mjs +2 -0
  243. package/dist/chunks/fr-GEgM1j3w.mjs.map +1 -0
  244. package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
  245. package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
  246. package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
  247. package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
  248. package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
  249. package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
  250. package/dist/chunks/full-wDTdOuGt.mjs +2 -0
  251. package/dist/chunks/full-wDTdOuGt.mjs.map +1 -0
  252. package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
  253. package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
  254. package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
  255. package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
  256. package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
  257. package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
  258. package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
  259. package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
  260. package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
  261. package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
  262. package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
  263. package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
  264. package/dist/chunks/hi-CKg8i4Mm.mjs +2 -0
  265. package/dist/chunks/hi-CKg8i4Mm.mjs.map +1 -0
  266. package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
  267. package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
  268. package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
  269. package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
  270. package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
  271. package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
  272. package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
  273. package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
  274. package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
  275. package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
  276. package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
  277. package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
  278. package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
  279. package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
  280. package/dist/chunks/minimal-FfmHwMGU.mjs +2 -0
  281. package/dist/chunks/minimal-FfmHwMGU.mjs.map +1 -0
  282. package/dist/chunks/nl-2IdjTNeJ.mjs +2 -0
  283. package/dist/chunks/nl-2IdjTNeJ.mjs.map +1 -0
  284. package/dist/chunks/nl-B1i04NvZ.mjs +2 -0
  285. package/dist/chunks/nl-B1i04NvZ.mjs.map +1 -0
  286. package/dist/chunks/nl-BEmzpzKO.mjs +2 -0
  287. package/dist/chunks/nl-BEmzpzKO.mjs.map +1 -0
  288. package/dist/chunks/nl-B_U0D3Qq.mjs +2 -0
  289. package/dist/chunks/nl-B_U0D3Qq.mjs.map +1 -0
  290. package/dist/chunks/nl-C437Xz6z.mjs +2 -0
  291. package/dist/chunks/nl-C437Xz6z.mjs.map +1 -0
  292. package/dist/chunks/nl-C5P8Fogm.mjs +2 -0
  293. package/dist/chunks/nl-C5P8Fogm.mjs.map +1 -0
  294. package/dist/chunks/nl-CST62bzx.mjs +2 -0
  295. package/dist/chunks/nl-CST62bzx.mjs.map +1 -0
  296. package/dist/chunks/nl-CWQT-W-6.mjs +2 -0
  297. package/dist/chunks/nl-CWQT-W-6.mjs.map +1 -0
  298. package/dist/chunks/nl-CdpcDkbM.mjs +2 -0
  299. package/dist/chunks/nl-CdpcDkbM.mjs.map +1 -0
  300. package/dist/chunks/nl-CgYWZnga.mjs +2 -0
  301. package/dist/chunks/nl-CgYWZnga.mjs.map +1 -0
  302. package/dist/chunks/nl-Cr--x8bX.mjs +2 -0
  303. package/dist/chunks/nl-Cr--x8bX.mjs.map +1 -0
  304. package/dist/chunks/nl-Cwl5dxFZ.mjs +2 -0
  305. package/dist/chunks/nl-Cwl5dxFZ.mjs.map +1 -0
  306. package/dist/chunks/nl-Czjd9Bw9.mjs +2 -0
  307. package/dist/chunks/nl-Czjd9Bw9.mjs.map +1 -0
  308. package/dist/chunks/nl-DUOT2ZMQ.mjs +2 -0
  309. package/dist/chunks/nl-DUOT2ZMQ.mjs.map +1 -0
  310. package/dist/chunks/nl-DYnRYvZ5.mjs +2 -0
  311. package/dist/chunks/nl-DYnRYvZ5.mjs.map +1 -0
  312. package/dist/chunks/nl-DaNJ-ffX.mjs +2 -0
  313. package/dist/chunks/nl-DaNJ-ffX.mjs.map +1 -0
  314. package/dist/chunks/nl-DeOJ64xy.mjs +2 -0
  315. package/dist/chunks/nl-DeOJ64xy.mjs.map +1 -0
  316. package/dist/chunks/nl-DwZajfpP.mjs +2 -0
  317. package/dist/chunks/nl-DwZajfpP.mjs.map +1 -0
  318. package/dist/chunks/nl-Dyjc9M7o.mjs +2 -0
  319. package/dist/chunks/nl-Dyjc9M7o.mjs.map +1 -0
  320. package/dist/chunks/nl-GBpv7W4L.mjs +2 -0
  321. package/dist/chunks/nl-GBpv7W4L.mjs.map +1 -0
  322. package/dist/chunks/nl-HFfWJOEo.mjs +2 -0
  323. package/dist/chunks/nl-HFfWJOEo.mjs.map +1 -0
  324. package/dist/chunks/nl-KqmiCeD7.mjs +2 -0
  325. package/dist/chunks/nl-KqmiCeD7.mjs.map +1 -0
  326. package/dist/chunks/nl-_QT7e2Qt.mjs +2 -0
  327. package/dist/chunks/nl-_QT7e2Qt.mjs.map +1 -0
  328. package/dist/chunks/nl-i79IajbC.mjs +2 -0
  329. package/dist/chunks/nl-i79IajbC.mjs.map +1 -0
  330. package/dist/chunks/nl-lcZvrAz6.mjs +2 -0
  331. package/dist/chunks/nl-lcZvrAz6.mjs.map +1 -0
  332. package/dist/chunks/nl-tWJ2imhe.mjs +2 -0
  333. package/dist/chunks/nl-tWJ2imhe.mjs.map +1 -0
  334. package/dist/chunks/nl-xfiNOCgg.mjs +2 -0
  335. package/dist/chunks/nl-xfiNOCgg.mjs.map +1 -0
  336. package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
  337. package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
  338. package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
  339. package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
  340. package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
  341. package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
  342. package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
  343. package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
  344. package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
  345. package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
  346. package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
  347. package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
  348. package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
  349. package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
  350. package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
  351. package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
  352. package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
  353. package/dist/chunks/pt-DP5c76Vo.mjs +2 -0
  354. package/dist/chunks/pt-DP5c76Vo.mjs.map +1 -0
  355. package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
  356. package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
  357. package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
  358. package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
  359. package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
  360. package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
  361. package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
  362. package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
  363. package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
  364. package/dist/chunks/register-DSRtHVkk.mjs +3 -0
  365. package/dist/chunks/register-DSRtHVkk.mjs.map +1 -0
  366. package/dist/chunks/ru--iYEtsT5.mjs +2 -0
  367. package/dist/chunks/ru--iYEtsT5.mjs.map +1 -0
  368. package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
  369. package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
  370. package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
  371. package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
  372. package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
  373. package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
  374. package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
  375. package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
  376. package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
  377. package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
  378. package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
  379. package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
  380. package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
  381. package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
  382. package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
  383. package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
  384. package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
  385. package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
  386. package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
  387. package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
  388. package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
  389. package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
  390. package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
  391. package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
  392. package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
  393. package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
  394. package/dist/chunks/src-DDkRstYh.mjs +2 -0
  395. package/dist/chunks/src-DDkRstYh.mjs.map +1 -0
  396. package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
  397. package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
  398. package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
  399. package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
  400. package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
  401. package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
  402. package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
  403. package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
  404. package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
  405. package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
  406. package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
  407. package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
  408. package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
  409. package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
  410. package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
  411. package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
  412. package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
  413. package/dist/chunks/zh-DUS7JduA.mjs +2 -0
  414. package/dist/chunks/zh-DUS7JduA.mjs.map +1 -0
  415. package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
  416. package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
  417. package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
  418. package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
  419. package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
  420. package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
  421. package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
  422. package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
  423. package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
  424. package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
  425. package/dist/commands/BlockInsertion.d.ts +15 -19
  426. package/dist/commands/BlockInsertion.d.ts.map +1 -1
  427. package/dist/commands/Commands.d.ts +3 -0
  428. package/dist/commands/Commands.d.ts.map +1 -1
  429. package/dist/commands/CompositionCommands.d.ts +14 -8
  430. package/dist/commands/CompositionCommands.d.ts.map +1 -1
  431. package/dist/commands/CompositionFallback.d.ts +13 -0
  432. package/dist/commands/CompositionFallback.d.ts.map +1 -0
  433. package/dist/commands/CompositionRebase.d.ts +17 -10
  434. package/dist/commands/CompositionRebase.d.ts.map +1 -1
  435. package/dist/commands/PasteCommand.d.ts.map +1 -1
  436. package/dist/commands/SelectionDeletion.d.ts +7 -5
  437. package/dist/commands/SelectionDeletion.d.ts.map +1 -1
  438. package/dist/commands/SelectionReplacement.d.ts +42 -0
  439. package/dist/commands/SelectionReplacement.d.ts.map +1 -0
  440. package/dist/editor/BlockIdentity.d.ts +16 -0
  441. package/dist/editor/BlockIdentity.d.ts.map +1 -0
  442. package/dist/editor/ContentSerializer.d.ts +13 -11
  443. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  444. package/dist/editor/NotectlEditor.d.ts +6 -5
  445. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  446. package/dist/editor/locales/nl.d.ts +4 -0
  447. package/dist/editor/locales/nl.d.ts.map +1 -0
  448. package/dist/editor/styles/link.d.ts +3 -0
  449. package/dist/editor/styles/link.d.ts.map +1 -0
  450. package/dist/fonts/math.mjs +1 -1
  451. package/dist/fonts.mjs +1 -1
  452. package/dist/full.mjs +1 -1
  453. package/dist/html.mjs +1 -1
  454. package/dist/i18n/Locale.d.ts +1 -0
  455. package/dist/i18n/Locale.d.ts.map +1 -1
  456. package/dist/index.d.ts +1 -1
  457. package/dist/index.d.ts.map +1 -1
  458. package/dist/input/CompositionController.d.ts.map +1 -1
  459. package/dist/input/HTMLLineBreaks.d.ts +14 -0
  460. package/dist/input/HTMLLineBreaks.d.ts.map +1 -0
  461. package/dist/input/HTMLParser.d.ts +1 -7
  462. package/dist/input/HTMLParser.d.ts.map +1 -1
  463. package/dist/input/PasteHTMLHandler.d.ts +0 -1
  464. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  465. package/dist/input/PasteHandler.d.ts.map +1 -1
  466. package/dist/input/PasteRichBlockHandler.d.ts +10 -17
  467. package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
  468. package/dist/markdown.mjs +1 -1
  469. package/dist/model/ContentModel.d.ts +6 -1
  470. package/dist/model/ContentModel.d.ts.map +1 -1
  471. package/dist/model/FileHandlerDispatcher.d.ts +3 -1
  472. package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
  473. package/dist/model/FileHandlerRegistry.d.ts +11 -2
  474. package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
  475. package/dist/notectl-core.mjs +1 -1
  476. package/dist/notectl-core.umd.js +1 -1
  477. package/dist/notectl-core.umd.js.map +1 -1
  478. package/dist/plugins/PluginContextFactory.d.ts +1 -0
  479. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  480. package/dist/plugins/PluginManager.d.ts +5 -0
  481. package/dist/plugins/PluginManager.d.ts.map +1 -1
  482. package/dist/plugins/alignment/locales/nl.d.ts +4 -0
  483. package/dist/plugins/alignment/locales/nl.d.ts.map +1 -0
  484. package/dist/plugins/alignment.mjs +1 -1
  485. package/dist/plugins/bidi-isolation/locales/nl.d.ts +4 -0
  486. package/dist/plugins/bidi-isolation/locales/nl.d.ts.map +1 -0
  487. package/dist/plugins/bidi-isolation.mjs +1 -1
  488. package/dist/plugins/blockquote/locales/nl.d.ts +4 -0
  489. package/dist/plugins/blockquote/locales/nl.d.ts.map +1 -0
  490. package/dist/plugins/blockquote.mjs +1 -1
  491. package/dist/plugins/caret-navigation/locales/nl.d.ts +4 -0
  492. package/dist/plugins/caret-navigation/locales/nl.d.ts.map +1 -0
  493. package/dist/plugins/caret-navigation.mjs +1 -1
  494. package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
  495. package/dist/plugins/code-block/locales/nl.d.ts +4 -0
  496. package/dist/plugins/code-block/locales/nl.d.ts.map +1 -0
  497. package/dist/plugins/code-block.mjs +1 -1
  498. package/dist/plugins/editor-ui/EditorUI.d.ts +50 -0
  499. package/dist/plugins/editor-ui/EditorUI.d.ts.map +1 -0
  500. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts +44 -0
  501. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts.map +1 -0
  502. package/dist/plugins/editor-ui/index.d.ts +6 -0
  503. package/dist/plugins/editor-ui/index.d.ts.map +1 -0
  504. package/dist/plugins/font/locales/nl.d.ts +4 -0
  505. package/dist/plugins/font/locales/nl.d.ts.map +1 -0
  506. package/dist/plugins/font-size/locales/nl.d.ts +4 -0
  507. package/dist/plugins/font-size/locales/nl.d.ts.map +1 -0
  508. package/dist/plugins/font-size.mjs +1 -1
  509. package/dist/plugins/font.mjs +1 -1
  510. package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
  511. package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
  512. package/dist/plugins/formula/locales/nl.d.ts +4 -0
  513. package/dist/plugins/formula/locales/nl.d.ts.map +1 -0
  514. package/dist/plugins/formula.mjs +1 -1
  515. package/dist/plugins/gap-cursor/locales/nl.d.ts +4 -0
  516. package/dist/plugins/gap-cursor/locales/nl.d.ts.map +1 -0
  517. package/dist/plugins/gap-cursor.mjs +1 -1
  518. package/dist/plugins/hard-break.mjs +1 -1
  519. package/dist/plugins/heading/locales/nl.d.ts +4 -0
  520. package/dist/plugins/heading/locales/nl.d.ts.map +1 -0
  521. package/dist/plugins/heading.mjs +1 -1
  522. package/dist/plugins/highlight/locales/nl.d.ts +4 -0
  523. package/dist/plugins/highlight/locales/nl.d.ts.map +1 -0
  524. package/dist/plugins/highlight.mjs +1 -1
  525. package/dist/plugins/horizontal-rule/locales/nl.d.ts +4 -0
  526. package/dist/plugins/horizontal-rule/locales/nl.d.ts.map +1 -0
  527. package/dist/plugins/horizontal-rule.mjs +1 -1
  528. package/dist/plugins/image/ImageCommands.d.ts +15 -3
  529. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  530. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  531. package/dist/plugins/image/locales/nl.d.ts +4 -0
  532. package/dist/plugins/image/locales/nl.d.ts.map +1 -0
  533. package/dist/plugins/image.mjs +1 -1
  534. package/dist/plugins/inline-code/locales/nl.d.ts +4 -0
  535. package/dist/plugins/inline-code/locales/nl.d.ts.map +1 -0
  536. package/dist/plugins/inline-code.mjs +1 -1
  537. package/dist/plugins/link/LinkBubble.d.ts +31 -0
  538. package/dist/plugins/link/LinkBubble.d.ts.map +1 -0
  539. package/dist/plugins/link/LinkBubbleContent.d.ts +4 -0
  540. package/dist/plugins/link/LinkBubbleContent.d.ts.map +1 -0
  541. package/dist/plugins/link/LinkInteractionController.d.ts +40 -0
  542. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
  543. package/dist/plugins/link/LinkLocale.d.ts +10 -1
  544. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  545. package/dist/plugins/link/LinkNavigation.d.ts +12 -0
  546. package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
  547. package/dist/plugins/link/LinkPlugin.d.ts +4 -5
  548. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  549. package/dist/plugins/link/LinkRange.d.ts +12 -0
  550. package/dist/plugins/link/LinkRange.d.ts.map +1 -0
  551. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  552. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  553. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  554. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  555. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  556. package/dist/plugins/link/locales/nl.d.ts +4 -0
  557. package/dist/plugins/link/locales/nl.d.ts.map +1 -0
  558. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  559. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  560. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  561. package/dist/plugins/link.mjs +1 -1
  562. package/dist/plugins/list/locales/nl.d.ts +4 -0
  563. package/dist/plugins/list/locales/nl.d.ts.map +1 -0
  564. package/dist/plugins/list.mjs +1 -1
  565. package/dist/plugins/print/locales/nl.d.ts +4 -0
  566. package/dist/plugins/print/locales/nl.d.ts.map +1 -0
  567. package/dist/plugins/print.mjs +1 -1
  568. package/dist/plugins/shared/PopupManager.d.ts +20 -2
  569. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  570. package/dist/plugins/shared/PopupPositioning.d.ts +2 -6
  571. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  572. package/dist/plugins/shared/index.d.ts +1 -1
  573. package/dist/plugins/shared/index.d.ts.map +1 -1
  574. package/dist/plugins/shared.mjs +1 -1
  575. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
  576. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
  577. package/dist/plugins/smart-paste/locales/nl.d.ts +4 -0
  578. package/dist/plugins/smart-paste/locales/nl.d.ts.map +1 -0
  579. package/dist/plugins/smart-paste.mjs +1 -1
  580. package/dist/plugins/strikethrough/locales/nl.d.ts +4 -0
  581. package/dist/plugins/strikethrough/locales/nl.d.ts.map +1 -0
  582. package/dist/plugins/strikethrough.mjs +1 -1
  583. package/dist/plugins/super-sub/locales/nl.d.ts +4 -0
  584. package/dist/plugins/super-sub/locales/nl.d.ts.map +1 -0
  585. package/dist/plugins/super-sub.mjs +1 -1
  586. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  587. package/dist/plugins/table/TableSelection.d.ts +4 -20
  588. package/dist/plugins/table/TableSelection.d.ts.map +1 -1
  589. package/dist/plugins/table/TableSelectionTypes.d.ts +21 -0
  590. package/dist/plugins/table/TableSelectionTypes.d.ts.map +1 -0
  591. package/dist/plugins/table/locales/nl.d.ts +4 -0
  592. package/dist/plugins/table/locales/nl.d.ts.map +1 -0
  593. package/dist/plugins/table.mjs +1 -1
  594. package/dist/plugins/text-color/locales/nl.d.ts +4 -0
  595. package/dist/plugins/text-color/locales/nl.d.ts.map +1 -0
  596. package/dist/plugins/text-color.mjs +1 -1
  597. package/dist/plugins/text-direction/locales/nl.d.ts +4 -0
  598. package/dist/plugins/text-direction/locales/nl.d.ts.map +1 -0
  599. package/dist/plugins/text-direction-auto.mjs +1 -1
  600. package/dist/plugins/text-direction.mjs +1 -1
  601. package/dist/plugins/text-formatting/locales/nl.d.ts +4 -0
  602. package/dist/plugins/text-formatting/locales/nl.d.ts.map +1 -0
  603. package/dist/plugins/text-formatting.mjs +1 -1
  604. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +2 -2
  605. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  606. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -1
  607. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  608. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +8 -3
  609. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  610. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +4 -0
  611. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -1
  612. package/dist/plugins/toolbar/locales/nl.d.ts +4 -0
  613. package/dist/plugins/toolbar/locales/nl.d.ts.map +1 -0
  614. package/dist/plugins/toolbar.mjs +1 -1
  615. package/dist/plugins/video/locales/nl.d.ts +4 -0
  616. package/dist/plugins/video/locales/nl.d.ts.map +1 -0
  617. package/dist/plugins/video.mjs +1 -1
  618. package/dist/presets/full.mjs +1 -1
  619. package/dist/presets/minimal.mjs +1 -1
  620. package/dist/presets.mjs +1 -1
  621. package/dist/register.mjs +1 -1
  622. package/dist/serialization/DocumentParser.d.ts +2 -2
  623. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  624. package/dist/serialization/HTMLParseRules.d.ts.map +1 -1
  625. package/dist/serialization/HTMLSanitization.d.ts +6 -0
  626. package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
  627. package/dist/serialization/PreformattedText.d.ts +3 -0
  628. package/dist/serialization/PreformattedText.d.ts.map +1 -0
  629. package/dist/state/History.d.ts.map +1 -1
  630. package/dist/state/RangeMapping.d.ts +10 -0
  631. package/dist/state/RangeMapping.d.ts.map +1 -0
  632. package/dist/state/StepApplication.d.ts.map +1 -1
  633. package/dist/state/Steps.d.ts +3 -0
  634. package/dist/state/Steps.d.ts.map +1 -1
  635. package/dist/state/StructuralPositions.d.ts +15 -0
  636. package/dist/state/StructuralPositions.d.ts.map +1 -0
  637. package/dist/state/TransactionBuilder.d.ts +6 -14
  638. package/dist/state/TransactionBuilder.d.ts.map +1 -1
  639. package/dist/test/TestUtils.d.ts.map +1 -1
  640. package/dist/ui.d.ts +3 -0
  641. package/dist/ui.d.ts.map +1 -0
  642. package/dist/ui.mjs +1 -0
  643. package/dist/view/EditorInteraction.d.ts +23 -0
  644. package/dist/view/EditorInteraction.d.ts.map +1 -0
  645. package/dist/view/EditorView.d.ts +2 -0
  646. package/dist/view/EditorView.d.ts.map +1 -1
  647. package/dist/view/EditorViewEvents.d.ts.map +1 -1
  648. package/dist/view/SelectionGeometry.d.ts +29 -0
  649. package/dist/view/SelectionGeometry.d.ts.map +1 -0
  650. package/dist/view/SelectionObserver.d.ts +19 -0
  651. package/dist/view/SelectionObserver.d.ts.map +1 -0
  652. package/dist/view/SelectionSync.d.ts +7 -0
  653. package/dist/view/SelectionSync.d.ts.map +1 -1
  654. package/package.json +12 -8
  655. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +0 -2
  656. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +0 -1
  657. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +0 -2
  658. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +0 -1
  659. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs +0 -2
  660. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs.map +0 -1
  661. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +0 -2
  662. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +0 -1
  663. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs +0 -2
  664. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs.map +0 -1
  665. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +0 -2
  666. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs.map +0 -1
  667. package/dist/chunks/Commands-DBBCAYBn.mjs +0 -2
  668. package/dist/chunks/Commands-DBBCAYBn.mjs.map +0 -1
  669. package/dist/chunks/ContentModel-BLC3Tez8.mjs +0 -2
  670. package/dist/chunks/ContentModel-BLC3Tez8.mjs.map +0 -1
  671. package/dist/chunks/DocumentParser-BKUrtgw1.mjs +0 -2
  672. package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +0 -1
  673. package/dist/chunks/FontPlugin-BcXNFqqO.mjs +0 -2
  674. package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +0 -1
  675. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs +0 -2
  676. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +0 -1
  677. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +0 -2
  678. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +0 -1
  679. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +0 -2
  680. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +0 -1
  681. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +0 -2
  682. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +0 -1
  683. package/dist/chunks/HardBreakPlugin-svNnJ9Xj.mjs.map +0 -1
  684. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +0 -2
  685. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +0 -1
  686. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +0 -2
  687. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +0 -1
  688. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs +0 -2
  689. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs.map +0 -1
  690. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +0 -2
  691. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +0 -1
  692. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +0 -2
  693. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +0 -1
  694. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs +0 -2
  695. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs.map +0 -1
  696. package/dist/chunks/ListPlugin-DTgpvBEt.mjs +0 -2
  697. package/dist/chunks/ListPlugin-DTgpvBEt.mjs.map +0 -1
  698. package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +0 -1
  699. package/dist/chunks/MarkdownParser-CvYOvU3d.mjs.map +0 -1
  700. package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +0 -1
  701. package/dist/chunks/NodeSelectionCommands-B0Sb4ux4.mjs.map +0 -1
  702. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +0 -2
  703. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +0 -1
  704. package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
  705. package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
  706. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs +0 -2
  707. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs.map +0 -1
  708. package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +0 -1
  709. package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +0 -1
  710. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +0 -2
  711. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +0 -1
  712. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs +0 -2
  713. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs.map +0 -1
  714. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs +0 -2
  715. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +0 -1
  716. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs +0 -2
  717. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +0 -1
  718. package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +0 -1
  719. package/dist/chunks/TablePlugin-WPwp902E.mjs +0 -2
  720. package/dist/chunks/TablePlugin-WPwp902E.mjs.map +0 -1
  721. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +0 -2
  722. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +0 -1
  723. package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +0 -1
  724. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs +0 -2
  725. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +0 -1
  726. package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
  727. package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +0 -1
  728. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs +0 -2
  729. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +0 -1
  730. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs +0 -2
  731. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +0 -1
  732. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs +0 -2
  733. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +0 -1
  734. package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
  735. package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
  736. package/dist/chunks/de-JhGflzS5.mjs +0 -2
  737. package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
  738. package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
  739. package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
  740. package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
  741. package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
  742. package/dist/chunks/full-BiQ93ERr.mjs +0 -2
  743. package/dist/chunks/full-BiQ93ERr.mjs.map +0 -1
  744. package/dist/chunks/hi-Bu799xIO.mjs +0 -2
  745. package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
  746. package/dist/chunks/minimal-DO7LiFTa.mjs +0 -2
  747. package/dist/chunks/minimal-DO7LiFTa.mjs.map +0 -1
  748. package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
  749. package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
  750. package/dist/chunks/register-Cb1YTAN4.mjs +0 -3
  751. package/dist/chunks/register-Cb1YTAN4.mjs.map +0 -1
  752. package/dist/chunks/ru-BxySx7an.mjs +0 -2
  753. package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
  754. package/dist/chunks/src-5GKFQ2mQ.mjs +0 -2
  755. package/dist/chunks/src-5GKFQ2mQ.mjs.map +0 -1
  756. package/dist/chunks/zh-DuucmOns.mjs +0 -2
  757. package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
@@ -1,2 +0,0 @@
1
- import{n as t,r as e,t as s}from"./BlockAlignment-BqyBQ4uV.mjs";import{a as i,c as n,n as a,o as l,r as o,t as r}from"./PluginHelpers-B3gk3VB3.mjs";import{c as g}from"./StyleRuntime-C0RSqKzG.mjs";import{t as m}from"./StyleClassNames-BsAx7k5T.mjs";import{t as c}from"./NodeSpecPatching-BrjPAbqe.mjs";var h={alignStart:"Align Start",alignCenter:"Align Center",alignEnd:"Align End",justify:"Justify",toolbarLabel:"Alignment",toolbarTooltip:"Alignment"},p=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Bdmunk5h.mjs"),"./locales/de.ts":()=>import("./de-B8-w9gPi.mjs"),"./locales/es.ts":()=>import("./es-B8K3Yvf3.mjs"),"./locales/fr.ts":()=>import("./fr-BeRlON1t.mjs"),"./locales/hi.ts":()=>import("./hi-Bl-yeeOI.mjs"),"./locales/pt.ts":()=>import("./pt-5VeuNDd2.mjs"),"./locales/ru.ts":()=>import("./ru-Yngw7nFP.mjs"),"./locales/zh.ts":()=>import("./zh-BvuAbM2S.mjs")});async function f(t){return n(p,t,h)}var d={alignments:["start","center","end","justify"],alignableTypes:["paragraph","heading","title","subtitle","table_cell","image"],defaults:{image:"center"}},u={start:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"/></svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"/></svg>',end:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"/></svg>',justify:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z"/></svg>'},v=class{id="alignment";name="Alignment";priority=90;config;locale;alignableTypes;constructor(t){this.config={...d,...t,defaults:{...d.defaults,...t?.defaults}}}async init(t){this.locale=await l(t,this.config.locale,h,f),this.alignableTypes=new Set(this.config.alignableTypes),this.patchNodeSpecs(t),this.registerStyleClasses(t),this.registerCommands(t),this.registerKeymaps(t),this.registerToolbarItem(t),this.registerMiddleware(t)}patchNodeSpecs(t){c(t,this.config.alignableTypes,{attrName:"align",getDefault:t=>this.config.defaults[t]??"start",applyToDOM:y})}registerStyleClasses(i){m(i,"AlignmentPlugin",this.config.styleClasses,i=>t(function(t){if(e(t))return t;const i=b.get(t),n=i?` Alignment is logical: "${i}" is ${t} in left-to-right text.`:"";throw new TypeError(`Unknown alignment "${t}"; use ${s.join(", ")}.${n}`)}(i)))}registerCommands(t){for(const e of this.config.alignments)t.registerCommand(`align${r(e)}`,()=>this.setAlignment(t,e))}registerKeymaps(t){const e={};this.config.alignments.includes("start")&&(e["Mod-Shift-L"]=()=>t.executeCommand("alignStart")),this.config.alignments.includes("center")&&(e["Mod-Shift-E"]=()=>t.executeCommand("alignCenter")),this.config.alignments.includes("end")&&(e["Mod-Shift-R"]=()=>t.executeCommand("alignEnd")),this.config.alignments.includes("justify")&&(e["Mod-Shift-J"]=()=>t.executeCommand("alignJustify")),Object.keys(e).length>0&&t.registerKeymap(e)}registerToolbarItem(t){const e=this.config.alignments.map(t=>({label:this.getAlignmentLabel(t),command:`align${r(t)}`,icon:u[t]}));t.registerToolbarItem({id:"alignment",group:"block",icon:u.start,label:this.locale.toolbarLabel,tooltip:this.locale.toolbarTooltip,command:"alignStart",popupType:"dropdown",popupConfig:{items:e},isActive:t=>this.isNonDefaultAlignment(t),isEnabled:t=>this.isAlignable(t)})}getAlignmentLabel(t){return{start:this.locale.alignStart,center:this.locale.alignCenter,end:this.locale.alignEnd,justify:this.locale.justify}[t]}registerMiddleware(t){t.registerMiddleware((t,e,s)=>{let i=!1;const n=t.steps.map(t=>{if("setBlockType"!==t.type)return t;if(!this.alignableTypes.has(t.nodeType))return t;if(void 0!==t.attrs?.align)return t;const e=t.previousAttrs?.align;return e?(i=!0,{...t,attrs:{...t.attrs,align:e}}):t});s(i?{...t,steps:n}:t)},{name:"alignment:preserve-align"})}setAlignment(t,e){const s=t.getState(),n=i(s);if(0===n.length)return!1;const l=s.transaction("command");let o=!1;for(const i of n){const t=s.getBlock(i);if(!t||!this.alignableTypes.has(t.type))continue;const n=s.getNodePath(i);n&&(l.setNodeAttr(n,{...t.attrs,align:e}),o=!0)}return!!o&&a(t,l.setSelection(s.selection).build())}isNonDefaultAlignment(t){const e=o(t);if(!e||!this.alignableTypes.has(e.type))return!1;const s=e.attrs?.align,i=this.config.defaults[e.type]??"start";return null!=s&&s!==i}isAlignable(t){const e=o(t);return null!=e&&this.alignableTypes.has(e.type)}};function y(t,e){const s=e.attrs?.align;"string"==typeof s&&g(t,"textAlign",s)}var b=/* @__PURE__ */new Map([["left","start"],["right","end"]]);export{f as i,v as n,h as r,u as t};
2
- //# sourceMappingURL=AlignmentPlugin-Cp7HYGaH.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AlignmentPlugin-Cp7HYGaH.mjs","names":[],"sources":["../../src/plugins/alignment/AlignmentLocale.ts","../../src/plugins/alignment/AlignmentPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the AlignmentPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\nexport interface AlignmentLocale {\n\treadonly alignStart: string;\n\treadonly alignCenter: string;\n\treadonly alignEnd: string;\n\treadonly justify: string;\n\treadonly toolbarLabel: string;\n\treadonly toolbarTooltip: string;\n}\n\n// --- Default English Locale ---\n\nexport const ALIGNMENT_LOCALE_EN: AlignmentLocale = {\n\talignStart: 'Align Start',\n\talignCenter: 'Align Center',\n\talignEnd: 'Align End',\n\tjustify: 'Justify',\n\ttoolbarLabel: 'Alignment',\n\ttoolbarTooltip: 'Alignment',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<AlignmentLocale> = import.meta.glob<{\n\tdefault: AlignmentLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadAlignmentLocale(lang: string): Promise<AlignmentLocale> {\n\treturn loadLocaleModule(localeModules, lang, ALIGNMENT_LOCALE_EN);\n}\n","/**\n * AlignmentPlugin: adds start/center/end/justify alignment as a block\n * attribute on paragraphs, headings, images, and other alignable types.\n * Uses logical values (`start`/`end`) instead of physical (`left`/`right`)\n * for correct behavior with RTL text direction. Patches NodeSpecs to render\n * the `align` attribute via inline `text-align` style and provides toggle\n * commands, keyboard shortcuts, and a toolbar dropdown. Optional application\n * CSS classes carry the alignment in class-based HTML export and import.\n */\n\nimport {\n\tBLOCK_ALIGNMENTS,\n\ttype BlockAlignment,\n\talignmentDeclaration,\n\tisBlockAlignment,\n} from '../../model/BlockAlignment.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport type { StyleClassNames } from '../../model/StyleClass.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { patchNodeSpecAttr } from '../shared/NodeSpecPatching.js';\nimport {\n\tcapitalize,\n\tdispatchIfPresent,\n\tgetSelectedBlock,\n\tgetSelectedBlockIds,\n\tresolveLocale,\n} from '../shared/PluginHelpers.js';\nimport { registerStyleClassNames } from '../shared/StyleClassNames.js';\nimport {\n\tALIGNMENT_LOCALE_EN,\n\ttype AlignmentLocale,\n\tloadAlignmentLocale,\n} from './AlignmentLocale.js';\n\n// --- Public Types ---\n\nexport interface AlignmentConfig {\n\t/** Which alignments to expose. Defaults to all four. */\n\treadonly alignments: readonly BlockAlignment[];\n\t/** Block types that support alignment. Defaults to paragraph + heading + title + subtitle + table_cell + image. */\n\treadonly alignableTypes: readonly string[];\n\t/** Per-type default alignment (e.g. `{ image: 'center' }`). Falls back to `'start'`. */\n\treadonly defaults: Readonly<Record<string, BlockAlignment>>;\n\t/**\n\t * Your own CSS class per alignment in HTML content, e.g. `{ center: 'align-center' }`.\n\t * Class-based export (`getContentHTML({ cssMode: 'classes' })`) writes these classes\n\t * and HTML import and paste recognize them, so content round-trips with your\n\t * stylesheet. Alignments without a class keep `notectl-align-*`; mapping `start`\n\t * gives start-aligned blocks its class. Blocks without their own alignment inherit an\n\t * aligned container; an explicit `start` overrides it. Inline-style export and the\n\t * editor's own rendering are unaffected. Invalid names make editor initialization\n\t * fail with a `TypeError` that explains the fix.\n\t */\n\treadonly styleClasses?: StyleClassNames<BlockAlignment>;\n\treadonly locale?: AlignmentLocale;\n}\n\n// --- Constants ---\n\nconst DEFAULT_CONFIG: AlignmentConfig = {\n\talignments: ['start', 'center', 'end', 'justify'],\n\talignableTypes: ['paragraph', 'heading', 'title', 'subtitle', 'table_cell', 'image'],\n\tdefaults: { image: 'center' },\n};\n\nexport const ALIGNMENT_ICONS: Readonly<Record<BlockAlignment, string>> = {\n\tstart:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z\"/></svg>',\n\tcenter:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z\"/></svg>',\n\tend: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z\"/></svg>',\n\tjustify:\n\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z\"/></svg>',\n};\n\n// --- Plugin ---\n\nexport class AlignmentPlugin implements Plugin {\n\treadonly id = 'alignment';\n\treadonly name = 'Alignment';\n\treadonly priority = 90;\n\n\tprivate readonly config: AlignmentConfig;\n\tprivate locale!: AlignmentLocale;\n\tprivate alignableTypes!: ReadonlySet<string>;\n\n\tconstructor(config?: Partial<AlignmentConfig>) {\n\t\tthis.config = {\n\t\t\t...DEFAULT_CONFIG,\n\t\t\t...config,\n\t\t\tdefaults: { ...DEFAULT_CONFIG.defaults, ...config?.defaults },\n\t\t};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tALIGNMENT_LOCALE_EN,\n\t\t\tloadAlignmentLocale,\n\t\t);\n\n\t\tthis.alignableTypes = new Set(this.config.alignableTypes);\n\t\tthis.patchNodeSpecs(context);\n\t\tthis.registerStyleClasses(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.registerMiddleware(context);\n\t}\n\n\t// --- NodeSpec Patching ---\n\n\t/**\n\t * Patches existing NodeSpecs for alignable block types to support the\n\t * `align` attribute and render it as an inline style. Skips types\n\t * that already define an `align` attribute in their spec.\n\t */\n\tprivate patchNodeSpecs(context: PluginContext): void {\n\t\tpatchNodeSpecAttr(context, this.config.alignableTypes, {\n\t\t\tattrName: 'align',\n\t\t\tgetDefault: (type) => this.config.defaults[type] ?? 'start',\n\t\t\tapplyToDOM: applyAlignment,\n\t\t});\n\t}\n\n\t/**\n\t * Registers the configured classes as style classes of the alignment\n\t * declarations. A misconfiguration fails `init()` with an explanation.\n\t */\n\tprivate registerStyleClasses(context: PluginContext): void {\n\t\tregisterStyleClassNames(context, 'AlignmentPlugin', this.config.styleClasses, (key) =>\n\t\t\talignmentDeclaration(toAlignment(key)),\n\t\t);\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tfor (const alignment of this.config.alignments) {\n\t\t\tcontext.registerCommand(`align${capitalize(alignment)}`, () => {\n\t\t\t\treturn this.setAlignment(context, alignment);\n\t\t\t});\n\t\t}\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tconst bindings: Record<string, () => boolean> = {};\n\n\t\tif (this.config.alignments.includes('start')) {\n\t\t\tbindings['Mod-Shift-L'] = () => context.executeCommand('alignStart');\n\t\t}\n\t\tif (this.config.alignments.includes('center')) {\n\t\t\tbindings['Mod-Shift-E'] = () => context.executeCommand('alignCenter');\n\t\t}\n\t\tif (this.config.alignments.includes('end')) {\n\t\t\tbindings['Mod-Shift-R'] = () => context.executeCommand('alignEnd');\n\t\t}\n\t\tif (this.config.alignments.includes('justify')) {\n\t\t\tbindings['Mod-Shift-J'] = () => context.executeCommand('alignJustify');\n\t\t}\n\n\t\tif (Object.keys(bindings).length > 0) {\n\t\t\tcontext.registerKeymap(bindings);\n\t\t}\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst dropdownItems = this.config.alignments.map((alignment) => ({\n\t\t\tlabel: this.getAlignmentLabel(alignment),\n\t\t\tcommand: `align${capitalize(alignment)}`,\n\t\t\ticon: ALIGNMENT_ICONS[alignment],\n\t\t}));\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'alignment',\n\t\t\tgroup: 'block',\n\t\t\ticon: ALIGNMENT_ICONS.start,\n\t\t\tlabel: this.locale.toolbarLabel,\n\t\t\ttooltip: this.locale.toolbarTooltip,\n\t\t\tcommand: 'alignStart',\n\t\t\tpopupType: 'dropdown',\n\t\t\tpopupConfig: { items: dropdownItems },\n\t\t\tisActive: (state) => this.isNonDefaultAlignment(state),\n\t\t\tisEnabled: (state) => this.isAlignable(state),\n\t\t});\n\t}\n\n\tprivate getAlignmentLabel(alignment: BlockAlignment): string {\n\t\tconst labels: Record<BlockAlignment, string> = {\n\t\t\tstart: this.locale.alignStart,\n\t\t\tcenter: this.locale.alignCenter,\n\t\t\tend: this.locale.alignEnd,\n\t\t\tjustify: this.locale.justify,\n\t\t};\n\t\treturn labels[alignment];\n\t}\n\n\t// --- Middleware ---\n\n\t/**\n\t * Preserves the `align` attribute when other plugins change the block\n\t * type (e.g. paragraph → heading) via `setBlockType`, which replaces attrs.\n\t */\n\tprivate registerMiddleware(context: PluginContext): void {\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, _state, next) => {\n\t\t\t\tlet patched = false;\n\n\t\t\t\tconst patchedSteps = tr.steps.map((step) => {\n\t\t\t\t\tif (step.type !== 'setBlockType') return step;\n\t\t\t\t\tif (!this.alignableTypes.has(step.nodeType)) return step;\n\t\t\t\t\tif (step.attrs?.align !== undefined) return step;\n\n\t\t\t\t\tconst prevAlign = step.previousAttrs?.align;\n\t\t\t\t\tif (!prevAlign) return step;\n\n\t\t\t\t\t// Carry forward align into new attrs\n\t\t\t\t\tpatched = true;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...step,\n\t\t\t\t\t\tattrs: { ...step.attrs, align: prevAlign },\n\t\t\t\t\t};\n\t\t\t\t});\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps } : tr);\n\t\t\t},\n\t\t\t{ name: 'alignment:preserve-align' },\n\t\t);\n\t}\n\n\t// --- Alignment Logic ---\n\n\t/**\n\t * Applies `alignment` to every alignable block in the current selection in\n\t * a single transaction. A multi-block selection aligns all of its blocks,\n\t * not just the anchor; non-alignable blocks in the range are left untouched.\n\t */\n\tprivate setAlignment(context: PluginContext, alignment: BlockAlignment): boolean {\n\t\tconst state = context.getState();\n\t\tconst blockIds: BlockId[] = getSelectedBlockIds(state);\n\t\tif (blockIds.length === 0) return false;\n\n\t\tconst tb = state.transaction('command');\n\t\tlet changed = false;\n\n\t\tfor (const id of blockIds) {\n\t\t\tconst block = state.getBlock(id);\n\t\t\tif (!block || !this.alignableTypes.has(block.type)) continue;\n\n\t\t\tconst path = state.getNodePath(id);\n\t\t\tif (!path) continue;\n\n\t\t\ttb.setNodeAttr(path, { ...block.attrs, align: alignment });\n\t\t\tchanged = true;\n\t\t}\n\n\t\tif (!changed) return false;\n\n\t\treturn dispatchIfPresent(context, tb.setSelection(state.selection).build());\n\t}\n\n\tprivate isNonDefaultAlignment(state: EditorState): boolean {\n\t\tconst block = getSelectedBlock(state);\n\t\tif (!block || !this.alignableTypes.has(block.type)) return false;\n\t\tconst align = block.attrs?.align;\n\t\tconst defaultAlign: BlockAlignment = this.config.defaults[block.type] ?? 'start';\n\t\treturn align != null && align !== defaultAlign;\n\t}\n\n\tprivate isAlignable(state: EditorState): boolean {\n\t\tconst block = getSelectedBlock(state);\n\t\treturn block != null && this.alignableTypes.has(block.type);\n\t}\n}\n\n// --- Helpers ---\n\nfunction applyAlignment(el: HTMLElement, node: BlockNode): void {\n\tconst align = node.attrs?.align;\n\tif (typeof align === 'string') {\n\t\tsetStyleProperty(el, 'textAlign', align);\n\t}\n}\n\n/** Physical alignments people coming from other editors tend to reach for. */\nconst PHYSICAL_ALIGNMENTS: ReadonlyMap<string, BlockAlignment> = new Map([\n\t['left', 'start'],\n\t['right', 'end'],\n]);\n\n/** Reads a `styleClasses` key as an alignment, explaining logical values for `left`/`right`. */\nfunction toAlignment(key: string): BlockAlignment {\n\tif (isBlockAlignment(key)) return key;\n\tconst logical: BlockAlignment | undefined = PHYSICAL_ALIGNMENTS.get(key);\n\tconst hint: string = logical\n\t\t? ` Alignment is logical: \"${logical}\" is ${key} in left-to-right text.`\n\t\t: '';\n\tthrow new TypeError(`Unknown alignment \"${key}\"; use ${BLOCK_ALIGNMENTS.join(', ')}.${hint}`);\n}\n"],"mappings":"2SAeA,IAAa,EAAuC,CACnD,WAAY,cACZ,YAAa,eACb,SAAU,YACV,QAAS,UACT,aA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c as t,f as e}from"./Selection-DC6AOGgF.mjs";import{i as o}from"./TypeBrands-Ch9856Gb.mjs";import{i as n,r,t as s}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as l,n as a,o as m,r as c}from"./PluginHelpers-B3gk3VB3.mjs";import{t as d}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as g}from"./DirectionIcons-Bbawl9ei.mjs";import{t as p}from"./TextDirectionService-BcX07mw2.mjs";var u={inlineLTR:"Inline LTR",inlineRTL:"Inline RTL",inlineAuto:"Inline Auto",inlineLabel:"Inline Direction",inlineTooltip:"Inline Direction",announceRemoveBidi:"Inline direction isolation removed"},h=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-B03uY4xr.mjs"),"./locales/de.ts":()=>import("./de-XCCpWyg0.mjs"),"./locales/es.ts":()=>import("./es-B0Za939C.mjs"),"./locales/fr.ts":()=>import("./fr-DciSEykY.mjs"),"./locales/hi.ts":()=>import("./hi-j3TDLMYd.mjs"),"./locales/pt.ts":()=>import("./pt-CEUgbrii.mjs"),"./locales/ru.ts":()=>import("./ru-BNPUT-3S.mjs"),"./locales/zh.ts":()=>import("./zh-Oj-qSUEp.mjs")});async function B(i){return l(h,i,u)}var b=class{id="bidi-isolation";name="Bidi Isolation";priority=92;config;locale;constructor(i){this.config={...i}}async init(i){this.locale=await m(i,this.config.locale,u,B),this.registerBdiMark(i),this.registerCommands(i),this.registerKeymaps(i),this.registerInlineToolbarItem(i)}registerBdiMark(t){t.registerMarkSpec({type:"bdi",rank:10,attrs:{dir:{default:"auto"}},toDOM(i){const t=document.createElement("bdi"),e=String(i.attrs?.dir??"auto");return t.setAttribute("dir",e),t},toHTMLString:(t,e)=>`<bdi dir="${i(String(t.attrs?.dir??"auto"))}">${e}</bdi>`,parseHTML:[{tag:"bdi",getAttrs:i=>{const t=i.getAttribute("dir");return"ltr"===t||"rtl"===t?{dir:t}:{dir:"auto"}}}],sanitize:{tags:["bdi"],attrs:["dir"]}})}registerCommands(i){i.registerCommand("toggleBidiLTR",()=>{const t=this.applyBdi(i,"ltr");return t&&i.announce(this.locale.inlineLTR),t}),i.registerCommand("toggleBidiRTL",()=>{const t=this.applyBdi(i,"rtl");return t&&i.announce(this.locale.inlineRTL),t}),i.registerCommand("toggleBidiAuto",()=>{const t=this.applyBdi(i,"auto");return t&&i.announce(this.locale.inlineAuto),t}),i.registerCommand("removeBidi",()=>{const t=this.removeBdi(i);return t&&i.announce(this.locale.announceRemoveBidi),t}),i.registerCommand("toggleBidiIsolation",()=>this.toggleBidiIsolation(i))}registerKeymaps(i){i.registerKeymap({"Mod-Shift-B":()=>i.executeCommand("toggleBidiIsolation")})}registerInlineToolbarItem(i){const o=[{label:this.locale.inlineLTR,command:"toggleBidiLTR",icon:g.ltr},{label:this.locale.inlineRTL,command:"toggleBidiRTL",icon:g.rtl},{label:this.locale.inlineAuto,command:"toggleBidiAuto",icon:g.auto},{label:this.locale.announceRemoveBidi,command:"removeBidi"}];i.registerToolbarItem({id:"inline-direction",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 4v7h2V4h2v7h2V4h1V2H10a3 3 0 1 0 0 6zm-3.5 9.5L3 17l3.5 3.5V18h3v-2h-3v-2.5zm14 0L17 17l3.5 3.5V18h-3v-2h3v-2.5zM11 16h2v6h-2z"/></svg>',label:this.locale.inlineLabel,tooltip:`${this.locale.inlineTooltip} (${d("Mod-Shift-B")})`,command:"toggleBidiIsolation",popupType:"dropdown",popupConfig:{items:o},isActive:i=>r(i,"bdi"),isEnabled:i=>{const o=i.selection;return e(o)&&!t(o)}})}toggleBidiIsolation(i){const t=i.getState();if(r(t,"bdi")){const t=this.removeBdi(i);return t&&i.announce(this.locale.announceRemoveBidi),t}const e=c(t),o=i.getService(p),n="rtl"===(e&&o?o.getBlockDir(e):"auto")?"ltr":"rtl",s=this.applyBdi(i,n);if(s){const t="ltr"===n?this.locale.inlineLTR:this.locale.inlineRTL;i.announce(t)}return s}applyBdi(i,t){const e=i.getState(),n={type:o("bdi"),attrs:{dir:t}};return a(i,s(e,n))}removeBdi(i){const t=i.getState();return a(i,n(t,o("bdi")))}};export{u as n,B as r,b as t};
2
- //# sourceMappingURL=BidiIsolationPlugin-GWukKdgJ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BidiIsolationPlugin-GWukKdgJ.mjs","names":[],"sources":["../../src/plugins/bidi-isolation/BidiIsolationLocale.ts","../../src/plugins/bidi-isolation/BidiIsolationPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the BidiIsolationPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\nexport interface BidiIsolationLocale {\n\treadonly inlineLTR: string;\n\treadonly inlineRTL: string;\n\treadonly inlineAuto: string;\n\treadonly inlineLabel: string;\n\treadonly inlineTooltip: string;\n\treadonly announceRemoveBidi: string;\n}\n\nexport const BIDI_ISOLATION_LOCALE_EN: BidiIsolationLocale = {\n\tinlineLTR: 'Inline LTR',\n\tinlineRTL: 'Inline RTL',\n\tinlineAuto: 'Inline Auto',\n\tinlineLabel: 'Inline Direction',\n\tinlineTooltip: 'Inline Direction',\n\tannounceRemoveBidi: 'Inline direction isolation removed',\n};\n\nconst localeModules: LocaleModuleMap<BidiIsolationLocale> = import.meta.glob<{\n\tdefault: BidiIsolationLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadBidiIsolationLocale(lang: string): Promise<BidiIsolationLocale> {\n\treturn loadLocaleModule(localeModules, lang, BIDI_ISOLATION_LOCALE_EN);\n}\n","/**\n * Inline bidi isolation plugin: registers a `<bdi>` mark and the inline\n * commands / toolbar / keymap that wrap selected text in a `<bdi>` element\n * with an explicit `dir` attribute.\n *\n * Use alongside {@link TextDirectionPlugin} for the full RTL story:\n * block-level direction lives there, the optional `TextDirectionService`\n * lets this plugin pick the inline direction opposite to the block direction\n * in `toggleBidiIsolation`. Without `TextDirectionPlugin`, this plugin\n * still works — `toggleBidiIsolation` falls back to applying `'rtl'`.\n */\n\nimport {\n\tapplyAttributedMark,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent, getSelectedBlock, resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { DIRECTION_ICONS } from '../text-direction/DirectionIcons.js';\nimport {\n\tTEXT_DIRECTION_SERVICE_KEY,\n\ttype TextDirection,\n\ttype TextDirectionService,\n} from '../text-direction/TextDirectionService.js';\nimport {\n\tBIDI_ISOLATION_LOCALE_EN,\n\ttype BidiIsolationLocale,\n\tloadBidiIsolationLocale,\n} from './BidiIsolationLocale.js';\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tbdi: { dir: 'ltr' | 'rtl' | 'auto' };\n\t}\n}\n\nexport interface BidiIsolationConfig {\n\treadonly locale?: BidiIsolationLocale;\n}\n\nconst INLINE_BDI_ICON: string =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M10 4v7h2V4h2v7h2V4h1V2H10a3 3 0 1 0 0 6zm-3.5 9.5L3 17l3.5 3.5V18h3v-2h-3v-2.5zm14 0L17 17l3.5 3.5V18h-3v-2h3v-2.5zM11 16h2v6h-2z\"/></svg>';\n\nexport class BidiIsolationPlugin implements Plugin {\n\treadonly id = 'bidi-isolation';\n\treadonly name = 'Bidi Isolation';\n\treadonly priority = 92;\n\n\tprivate readonly config: BidiIsolationConfig;\n\tprivate locale!: BidiIsolationLocale;\n\n\tconstructor(config?: Partial<BidiIsolationConfig>) {\n\t\tthis.config = { ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tBIDI_ISOLATION_LOCALE_EN,\n\t\t\tloadBidiIsolationLocale,\n\t\t);\n\n\t\tthis.registerBdiMark(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerInlineToolbarItem(context);\n\t}\n\n\tprivate registerBdiMark(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'bdi',\n\t\t\trank: 10,\n\t\t\tattrs: {\n\t\t\t\tdir: { default: 'auto' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst el: HTMLElement = document.createElement('bdi');\n\t\t\t\tconst dir: string = String(mark.attrs?.dir ?? 'auto');\n\t\t\t\tel.setAttribute('dir', dir);\n\t\t\t\treturn el;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst dir: string = escapeHTML(String(mark.attrs?.dir ?? 'auto'));\n\t\t\t\treturn `<bdi dir=\"${dir}\">${content}</bdi>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'bdi',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\tconst dir: string | null = el.getAttribute('dir');\n\t\t\t\t\t\tif (dir === 'ltr' || dir === 'rtl') return { dir };\n\t\t\t\t\t\treturn { dir: 'auto' };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['bdi'], attrs: ['dir'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleBidiLTR', () => {\n\t\t\tconst result: boolean = this.applyBdi(context, 'ltr');\n\t\t\tif (result) context.announce(this.locale.inlineLTR);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('toggleBidiRTL', () => {\n\t\t\tconst result: boolean = this.applyBdi(context, 'rtl');\n\t\t\tif (result) context.announce(this.locale.inlineRTL);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('toggleBidiAuto', () => {\n\t\t\tconst result: boolean = this.applyBdi(context, 'auto');\n\t\t\tif (result) context.announce(this.locale.inlineAuto);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('removeBidi', () => {\n\t\t\tconst result: boolean = this.removeBdi(context);\n\t\t\tif (result) context.announce(this.locale.announceRemoveBidi);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('toggleBidiIsolation', () => {\n\t\t\treturn this.toggleBidiIsolation(context);\n\t\t});\n\t}\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-B': () => context.executeCommand('toggleBidiIsolation'),\n\t\t});\n\t}\n\n\tprivate registerInlineToolbarItem(context: PluginContext): void {\n\t\tconst inlineItems = [\n\t\t\t{ label: this.locale.inlineLTR, command: 'toggleBidiLTR', icon: DIRECTION_ICONS.ltr },\n\t\t\t{ label: this.locale.inlineRTL, command: 'toggleBidiRTL', icon: DIRECTION_ICONS.rtl },\n\t\t\t{ label: this.locale.inlineAuto, command: 'toggleBidiAuto', icon: DIRECTION_ICONS.auto },\n\t\t\t{ label: this.locale.announceRemoveBidi, command: 'removeBidi' },\n\t\t];\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'inline-direction',\n\t\t\tgroup: 'format',\n\t\t\ticon: INLINE_BDI_ICON,\n\t\t\tlabel: this.locale.inlineLabel,\n\t\t\ttooltip: `${this.locale.inlineTooltip} (${formatShortcut('Mod-Shift-B')})`,\n\t\t\tcommand: 'toggleBidiIsolation',\n\t\t\tpopupType: 'dropdown',\n\t\t\tpopupConfig: { items: inlineItems },\n\t\t\tisActive: (state) => isAttributedMarkActive(state, 'bdi'),\n\t\t\tisEnabled: (state) => {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\treturn isTextSelection(sel) && !isCollapsed(sel);\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Cycles inline bidi isolation: no-bdi → bdi (opposite of block dir) →\n\t * remove. When the {@link TextDirectionService} is registered, picks the\n\t * direction opposite to the current block; otherwise defaults to `'rtl'`.\n\t */\n\tprivate toggleBidiIsolation(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isAttributedMarkActive(state, 'bdi')) {\n\t\t\tconst result: boolean = this.removeBdi(context);\n\t\t\tif (result) context.announce(this.locale.announceRemoveBidi);\n\t\t\treturn result;\n\t\t}\n\n\t\tconst block = getSelectedBlock(state);\n\t\tconst directionService: TextDirectionService | undefined = context.getService(\n\t\t\tTEXT_DIRECTION_SERVICE_KEY,\n\t\t);\n\t\tconst blockDir: TextDirection =\n\t\t\tblock && directionService ? directionService.getBlockDir(block) : 'auto';\n\t\tconst bdiDir: TextDirection = blockDir === 'rtl' ? 'ltr' : 'rtl';\n\n\t\tconst result: boolean = this.applyBdi(context, bdiDir);\n\t\tif (result) {\n\t\t\tconst announcement: string = bdiDir === 'ltr' ? this.locale.inlineLTR : this.locale.inlineRTL;\n\t\t\tcontext.announce(announcement);\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate applyBdi(context: PluginContext, dir: TextDirection): boolean {\n\t\tconst state = context.getState();\n\t\tconst mark = { type: markType('bdi'), attrs: { dir } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\n\tprivate removeBdi(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('bdi')));\n\t}\n}\n"],"mappings":"mbAaA,IAAa,EAAgD,CAC5D,UAAW,aACX,UAAW,aACX,WAAY,cACZ,YAAa,mBACb,cAAe,mBACf,mBAAoB,sCAGf,iBAAsD,OAAA,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,uB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xC,MAAM,EAAQ,EAAQ,WAChB,EAAO,CAAE,KAAM,EAAS,OAAQ,MAAO,CAAE,QAC/C,OAAO,EAAkB,EAAS,EAAoB,EAAO,GAC9D,CAEA,SAAA,CAAkB,GACjB,MAAM,EAAQ,EAAQ,WACtB,OAAO,EAAkB,EAAS,EAAqB,EAAO,EAAS,QACxE"}
@@ -1,2 +0,0 @@
1
- import{c as t}from"./HTMLUtils-DTpsjZyK.mjs";import{B as n,E as e,K as r,L as o,R as s,g as i,j as c,k as a,p as f,q as u}from"./Document-ssR6hBzG.mjs";import{r as d}from"./NodeResolver-F4RtpoEd.mjs";import{c as l,d as p,i as h,n as m,p as g,u as y}from"./Selection-DC6AOGgF.mjs";import{a as I,r as b}from"./TypeBrands-Ch9856Gb.mjs";import{i as k}from"./NavigationQueries-CaKfccu7.mjs";import{t as v}from"./ContentModel-BLC3Tez8.mjs";function x(t,n){if(0===n.length)return t.doc.children;const e=t.getBlock(n[n.length-1]);return e?e.children:[]}function N(t,n){if(l(t))return{blockId:t.anchor.blockId,offset:t.anchor.offset};const e=g(t,n);return{blockId:e.from.blockId,offset:e.from.offset}}function j(t){return t&&t.length>1?t.slice(0,-1):[]}function B(t,n){return t.findIndex(t=>s(t)&&t.id===n)}function P(t,n){const e=j(d(t.doc,n)),r=x(t,e);return{parentPath:e,siblings:r,index:B(r,n)}}function A(t){if(n(t))return t.id;for(const n of t.children)if(s(n))return A(n);return t.id}function T(t){if(n(t))return t.id;for(let n=t.children.length-1;n>=0;n--){const e=t.children[n];if(e&&s(e))return T(e)}return t.id}function E(t,n,e){const r=t.getBlock(n);if(!r)return null;if(k(t,n)){const e=t.getNodePath(n);return e?h(n,e):null}const o="start"===e?A(r):T(r),s=t.getBlock(o);if(!s)return null;const i="start"===e?0:a(s);return m(o,i)}function S(t,n,e){const r=t.doc.children,o="start"===n?r.map((t,n)=>n):r.map((t,n)=>r.length-1-n);for(const i of o){const o=r[i];if(!o||!s(o))continue;if(void 0!==e&&o.id===e)continue;const c=E(t,o.id,n);if(c)return c}return null}function _(t,n,e){const r=j(d(t.doc,n)),o=B(x(t,r),n);if(!(o<0))return{parentPath:r,anchorIndex:o,isAnchorEmpty:V(t,n,e)}}function w(t,n,e,r){const o=d(t.doc,e);if(!o)return;const i=t.getBlock(e);return i?{parentPath:o,anchorIndex:i.children.findIndex(t=>s(t)&&t.id===n),isAnchorEmpty:V(t,n,r)}:void 0}function C(t,n){if("table_cell"===t.getBlock(n)?.type)return n;const e=d(t.doc,n);if(e)for(const r of e)if("table_cell"===t.getBlock(r)?.type)return r}function F(t){return p(t)?t.nodeId:y(t)?t.blockId:t.anchor.blockId}function L(t,n,e,r,o,s){const i=C(t,e);if(i){const o=w(t,e,i,s);if(!o)return!1;const c=o.anchorIndex+1;n.insertNode(o.parentPath,c,r),o.isAnchorEmpty&&o.anchorIndex>=0&&n.removeNode(o.parentPath,o.anchorIndex)}else{const i=_(t,e,s);if(!i)return!1;const c=y(o)&&"before"===o.side?0:1;n.insertNode(i.parentPath,i.anchorIndex+c,r),i.isAnchorEmpty&&!y(o)&&n.removeNode(i.parentPath,i.anchorIndex)}return!0}function M(t,n){const e=d(t.doc,n),r=e&&e.length>0?e[0]:n;return t.doc.children.findIndex(t=>t.id===r)}function O(t,n,e){return!n||e.every(e=>v(t,n,e.type))}function R(t,n){const e=M(t,n);if(-1!==e)return{parentPath:[],anchorIndex:e,isAnchorEmpty:!1}}function q(t){return"paragraph"===t.type&&0===a(t)}function z(t,n,e,r){return D(t,n,e,[r])}function D(t,n,e,r){if(0===r.length)return;const o=M(t,e);if(-1===o)return;const s=t.doc.children[o],i=t.doc.children[o+1];let c=o+1;for(const f of r)n.insertNode([],c,f),c++;const a=s&&k(t,s.id)&&i&&q(i)?i:void 0;let u;return a?u=a:(u=f(I("paragraph")),n.insertNode([],c,u)),s&&q(s)&&n.removeNode([],o),u}function H(t,n){const r=t.children.map(t=>s(t)?H(t,e()):t);return f(t.type,r,n,t.attrs,t.htmlId)}function K(t,n){if(t.id===n)return t;for(const e of t.children){if(!s(e))continue;const t=K(e,n);if(t)return t}}function Q(t,n,e=!1){if(!n)return;const r={};let o=!1;for(const s of Object.keys(n)){const i=n[s],c=t?.[s];"string"==typeof c||"number"==typeof c&&Number.isFinite(c)||"boolean"==typeof c?r[s]=c:e&&i.allowArray&&U(c)?r[s]=Object.freeze([...c]):void 0!==i.default&&(r[s]=i.default),s in r&&(o=!0)}return o?r:void 0}function U(t){return Array.isArray(t)&&t.every(t=>null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t&&Number.isFinite(t))}function V(t,n,e){const r=t.getBlock(n);return!!r&&!(e?.getNodeSpec(r.type))?.isVoid&&""===c(r)}function G(n,e){if(!n.type)return;if(!e)return n;const r=e.getNodeSpec(n.type);if(!r)return;const o=Q(n.attrs,r.attrs,!0),s=t(n.htmlId),i=n.segments?function(t,n){const e=[];for(const r of t){if("inline"===r.kind){const t=n.getInlineNodeSpec(r.inlineType);if(!t)continue;const o=Q(r.attrs,t.attrs);e.push({kind:"inline",inlineType:r.inlineType,...o?{attrs:o}:{}});continue}e.push(r)}return e}(n.segments,e):void 0,{htmlId:c,...a}=n;return{...a,...s?{htmlId:s}:{},...o?{attrs:o}:{},...i?{segments:i}:n.segments?{segments:[]}:{}}}function J(t){const n=e(),o=function(t){const n=Y(t);return 0===n.length?void 0:r(n)}(t),s=t.attrs?t.attrs:void 0;return f(I(t.type),o,n,s,t.htmlId)}function W(t,n){const e=[];for(const r of t){const t=G(r,n);t&&e.push(X(t))}return{blocks:e}}function X(t){const n=t.attrs?t.attrs:void 0;return{type:I(t.type),...n?{attrs:n}:{},segments:Y(t)}}function Y(t){if(t.segments&&t.segments.length>0)return function(t){const n=[];for(const e of t){if("inline"===e.kind){n.push(o(i(b(e.inlineType),e.attrs)));continue}if(0===e.text.length)continue;const t=e.marks.map(t=>({type:t.type,...t.attrs?{attrs:t.attrs}:{}}));n.push(u(e.text,t))}return n}(t.segments);const n=t.text??"";return n?[u(n)]:[]}export{x as C,B as S,P as T,E as _,C as a,A as b,D as c,w as d,R as f,G as g,Q as h,K as i,q as l,W as m,H as n,L as o,_ as p,J as r,z as s,O as t,F as u,S as v,N as w,T as x,j as y};
2
- //# sourceMappingURL=BlockInsertion-CxKdCKJd.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockInsertion-CxKdCKJd.mjs","names":[],"sources":["../../src/commands/CommandHelpers.ts","../../src/commands/BlockInsertion.ts"],"sourcesContent":["/**\n * Shared helpers used across multiple command modules.\n *\n * - {@link getSiblings} — resolves a parent path to its child list\n * - {@link resolveInsertPoint} — normalizes a text selection to a single insert position\n */\n\nimport type { BlockNode, ChildNode, Document } from '../model/Document.js';\nimport { getBlockLength, isBlockNode, isLeafBlock } from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateNodeSelection,\n\tisCollapsed,\n\tselectionRange,\n} from '../model/Selection.js';\nimport type { EditorSelection, Selection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\n\n/** The resolved insert position within a single block. */\nexport interface InsertPoint {\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/** Resolves the children of a parent path: doc root or a nested block. */\nexport function getSiblings(\n\tstate: EditorState,\n\tparentPath: readonly BlockId[],\n): readonly ChildNode[] {\n\tif (parentPath.length === 0) return state.doc.children;\n\tconst parent: BlockNode | undefined = state.getBlock(\n\t\tparentPath[parentPath.length - 1] as BlockId,\n\t);\n\treturn parent ? parent.children : [];\n}\n\n/**\n * Normalizes a text selection to a single insert point.\n *\n * - Collapsed selection → anchor position.\n * - Range selection → normalized `from` position (document-order start).\n */\nexport function resolveInsertPoint(sel: Selection, blockOrder: readonly BlockId[]): InsertPoint {\n\tif (isCollapsed(sel)) {\n\t\treturn { blockId: sel.anchor.blockId, offset: sel.anchor.offset };\n\t}\n\tconst range = selectionRange(sel, blockOrder);\n\treturn { blockId: range.from.blockId, offset: range.from.offset };\n}\n\n/** Extracts the parent path from a full node path (all elements except the last). */\nexport function extractParentPath(path: readonly string[] | undefined): BlockId[] {\n\treturn path && path.length > 1 ? (path.slice(0, -1) as BlockId[]) : [];\n}\n\n/** Finds the index of a block by ID within a sibling list. */\nexport function findSiblingIndex(siblings: readonly ChildNode[], targetId: BlockId): number {\n\treturn siblings.findIndex((c) => isBlockNode(c) && c.id === targetId);\n}\n\n/** A block's parent path, its sibling list, and its index within that list. */\nexport interface SiblingContext {\n\treadonly parentPath: BlockId[];\n\treadonly siblings: readonly ChildNode[];\n\treadonly index: number;\n}\n\n/**\n * Resolves a node's parent path, sibling list, and index among its siblings.\n * `index` is `-1` when the node is not found; callers that require the node to\n * exist should guard on `index < 0`.\n */\nexport function resolveSiblingContext(state: EditorState, nodeId: BlockId): SiblingContext {\n\tconst parentPath: BlockId[] = extractParentPath(findNodePath(state.doc, nodeId));\n\tconst siblings: readonly ChildNode[] = getSiblings(state, parentPath);\n\tconst index: number = findSiblingIndex(siblings, nodeId);\n\treturn { parentPath, siblings, index };\n}\n\n/** Finds the first leaf block ID in a subtree. */\nexport function findFirstLeafBlockId(node: BlockNode): BlockId {\n\tif (isLeafBlock(node)) return node.id;\n\n\tfor (const child of node.children) {\n\t\tif (!isBlockNode(child)) continue;\n\t\treturn findFirstLeafBlockId(child);\n\t}\n\n\treturn node.id;\n}\n\n/** Finds the last leaf block ID in a subtree. */\nexport function findLastLeafBlockId(node: BlockNode): BlockId {\n\tif (isLeafBlock(node)) return node.id;\n\n\tfor (let i = node.children.length - 1; i >= 0; i--) {\n\t\tconst child = node.children[i];\n\t\tif (child && isBlockNode(child)) {\n\t\t\treturn findLastLeafBlockId(child);\n\t\t}\n\t}\n\n\treturn node.id;\n}\n\n/**\n * Resolves a valid editor selection at the start or end of a block subtree.\n * Void blocks become NodeSelections; text-capable blocks resolve to leaf cursors.\n */\nexport function createSelectionForBlockBoundary(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tboundary: 'start' | 'end',\n): EditorSelection | null {\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tif (isVoidBlock(state, blockId)) {\n\t\tconst path = state.getNodePath(blockId);\n\t\treturn path ? createNodeSelection(blockId, path) : null;\n\t}\n\n\tconst leafId: BlockId =\n\t\tboundary === 'start' ? findFirstLeafBlockId(block) : findLastLeafBlockId(block);\n\tconst leaf = state.getBlock(leafId);\n\tif (!leaf) return null;\n\n\tconst offset = boundary === 'start' ? 0 : getBlockLength(leaf);\n\treturn createCollapsedSelection(leafId, offset);\n}\n\n/**\n * Resolves a valid editor selection anywhere in the document, starting from\n * the first (or last) top-level block and deferring per-block resolution to\n * {@link createSelectionForBlockBoundary}. Useful as a last-resort fallback\n * after deletions when neighbouring siblings cannot provide a selection.\n *\n * @param state The editor state to query.\n * @param boundary `'start'` walks document order; `'end'` walks reverse.\n * @param excludeBlockId Optional block id to skip (e.g. the block about to\n * be removed by the caller's transaction).\n * @returns A valid selection, or `null` if no selectable block exists.\n */\nexport function createSelectionForDocumentBoundary(\n\tstate: EditorState,\n\tboundary: 'start' | 'end',\n\texcludeBlockId?: BlockId,\n): EditorSelection | null {\n\tconst children: readonly ChildNode[] = state.doc.children;\n\tconst indices: readonly number[] =\n\t\tboundary === 'start'\n\t\t\t? children.map((_, i) => i)\n\t\t\t: children.map((_, i) => children.length - 1 - i);\n\n\tfor (const i of indices) {\n\t\tconst child = children[i];\n\t\tif (!child || !isBlockNode(child)) continue;\n\t\tif (excludeBlockId !== undefined && child.id === excludeBlockId) continue;\n\n\t\tconst sel = createSelectionForBlockBoundary(state, child.id, boundary);\n\t\tif (sel) return sel;\n\t}\n\n\treturn null;\n}\n\n/** Returns the root-level block IDs in document order. */\nexport function getRootBlockIds(doc: Document): readonly BlockId[] {\n\treturn doc.children.map((child) => child.id);\n}\n","/**\n * Block insertion utilities for paste/clipboard operations and block-object\n * commands (table, image, horizontal rule, display formula).\n *\n * Provides context resolution (parent path, anchor index, empty detection)\n * for inserting blocks into the document tree — both at root level and\n * inside table cells — plus the shared primitive that drops a block-level\n * object onto its own line. Also contains pure helpers for block cloning,\n * recursive lookup, and attribute sanitization against a NodeSpec.\n */\n\nimport { canContain } from '../model/ContentModel.js';\nimport type { ContentSlice, SliceBlock } from '../model/ContentSlice.js';\nimport {\n\ttype BlockAttrArrayValue,\n\ttype BlockAttrValue,\n\ttype BlockAttrs,\n\ttype BlockNode,\n\ttype ChildNode,\n\ttype ContentSegment,\n\ttype InlineNode,\n\ttype Mark,\n\ttype TextNode,\n\tcreateBlockNode,\n\tcreateInlineNode,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tgetBlockText,\n\tinlineSegment,\n\tisBlockNode,\n\tsegmentsToInlineChildren,\n\ttextSegment,\n} from '../model/Document.js';\nimport { normalizeHTMLId } from '../model/HTMLUtils.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { AttrSpec } from '../model/NodeSpec.js';\nimport type { RichBlockData, RichSegment } from '../model/RichBlockData.js';\nimport type { SchemaRegistry } from '../model/SchemaRegistry.js';\nimport type { EditorSelection } from '../model/Selection.js';\nimport { isGapCursor, isNodeSelection } from '../model/Selection.js';\nimport type { BlockId, NodeTypeName } from '../model/TypeBrands.js';\nimport { inlineType, nodeType } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\nimport type { TransactionBuilder } from '../state/Transaction.js';\nimport { extractParentPath, findSiblingIndex, getSiblings } from './CommandHelpers.js';\n\n/**\n * Resolved insertion target within the document tree.\n * Contains everything needed to insert blocks at a specific anchor position.\n */\nexport interface InsertionContext {\n\treadonly parentPath: readonly BlockId[];\n\treadonly anchorIndex: number;\n\treadonly isAnchorEmpty: boolean;\n}\n\n/**\n * Resolves an insertion context for root-level (or nested-parent-level) insertion.\n * Computes the parent path, anchor index among siblings, and whether the anchor is empty.\n */\nexport function resolveRootInsertionContext(\n\tstate: EditorState,\n\tanchorBlockId: BlockId,\n\tschemaRegistry?: SchemaRegistry,\n): InsertionContext | undefined {\n\tconst path: readonly string[] | undefined = findNodePath(state.doc, anchorBlockId);\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\n\tconst siblings: readonly ChildNode[] = getSiblings(state, parentPath);\n\tconst anchorIndex: number = findSiblingIndex(siblings, anchorBlockId);\n\tif (anchorIndex < 0) return undefined;\n\n\tconst isAnchorEmpty: boolean = isBlockEmpty(state, anchorBlockId, schemaRegistry);\n\treturn { parentPath, anchorIndex, isAnchorEmpty };\n}\n\n/**\n * Resolves an insertion context within a table cell.\n * The parent path points to the cell itself; siblings are the cell's children.\n */\nexport function resolveCellInsertionContext(\n\tstate: EditorState,\n\tanchorBlockId: BlockId,\n\tcellId: BlockId,\n\tschemaRegistry?: SchemaRegistry,\n): InsertionContext | undefined {\n\tconst cellPath: BlockId[] | undefined = findNodePath(state.doc, cellId) as BlockId[] | undefined;\n\tif (!cellPath) return undefined;\n\n\tconst cell: BlockNode | undefined = state.getBlock(cellId);\n\tif (!cell) return undefined;\n\n\tconst anchorIndex: number = cell.children.findIndex(\n\t\t(c) => isBlockNode(c) && c.id === anchorBlockId,\n\t);\n\n\tconst isAnchorEmpty: boolean = isBlockEmpty(state, anchorBlockId, schemaRegistry);\n\treturn { parentPath: cellPath, anchorIndex, isAnchorEmpty };\n}\n\n/**\n * Finds a table_cell ancestor for the given block.\n * Walks the node path upward, returning the first table_cell BlockId found.\n */\nexport function findTableCellAncestor(state: EditorState, blockId: BlockId): BlockId | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\tif (block?.type === 'table_cell') return blockId;\n\n\tconst path: BlockId[] | undefined = findNodePath(state.doc, blockId) as BlockId[] | undefined;\n\tif (!path) return undefined;\n\n\tfor (const id of path) {\n\t\tconst node: BlockNode | undefined = state.getBlock(id as BlockId);\n\t\tif (node?.type === 'table_cell') return id as BlockId;\n\t}\n\treturn undefined;\n}\n\n/**\n * Resolves the anchor block ID from the current editor selection.\n * Handles text selection, node selection, and gap cursor uniformly.\n */\nexport function resolveAnchorBlockId(selection: EditorSelection): BlockId {\n\tif (isNodeSelection(selection)) return selection.nodeId;\n\tif (isGapCursor(selection)) return selection.blockId;\n\treturn selection.anchor.blockId;\n}\n\n/**\n * Inserts a block node after the anchor position, resolving cell vs root context.\n * Removes the anchor block if it is empty (matching standard paste behavior).\n * Returns true on success, false if context resolution fails.\n */\nexport function insertBlockAfterAnchor(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\tblock: BlockNode,\n\tselection: EditorSelection,\n\tschemaRegistry?: SchemaRegistry,\n): boolean {\n\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\n\tif (cellId) {\n\t\tconst ctx: InsertionContext | undefined = resolveCellInsertionContext(\n\t\t\tstate,\n\t\t\tanchorBlockId,\n\t\t\tcellId,\n\t\t\tschemaRegistry,\n\t\t);\n\t\tif (!ctx) return false;\n\n\t\tconst insertIndex: number = ctx.anchorIndex + 1;\n\t\tbuilder.insertNode(ctx.parentPath, insertIndex, block);\n\n\t\tif (ctx.isAnchorEmpty && ctx.anchorIndex >= 0) {\n\t\t\tbuilder.removeNode(ctx.parentPath, ctx.anchorIndex);\n\t\t}\n\t} else {\n\t\tconst ctx: InsertionContext | undefined = resolveRootInsertionContext(\n\t\t\tstate,\n\t\t\tanchorBlockId,\n\t\t\tschemaRegistry,\n\t\t);\n\t\tif (!ctx) return false;\n\n\t\tconst insertOffset: number = isGapCursor(selection) && selection.side === 'before' ? 0 : 1;\n\t\tbuilder.insertNode(ctx.parentPath, ctx.anchorIndex + insertOffset, block);\n\n\t\tif (ctx.isAnchorEmpty && !isGapCursor(selection)) {\n\t\t\tbuilder.removeNode(ctx.parentPath, ctx.anchorIndex);\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Document-root index of the top-level block that contains `blockId` — the block\n * itself when it already lives at the document root. Returns -1 when the block is\n * not part of the document. Block-level objects always live at the root, so an\n * insertion triggered from inside a container (e.g. a table cell) escapes to the\n * top level via this lookup.\n */\nexport function topLevelBlockIndex(state: EditorState, blockId: BlockId): number {\n\tconst path: readonly string[] | undefined = findNodePath(state.doc, blockId);\n\tconst topId: BlockId = path && path.length > 0 ? (path[0] as BlockId) : blockId;\n\treturn state.doc.children.findIndex((b) => b.id === topId);\n}\n\n/**\n * True when a container of `containerType` may hold every block in `blocks`,\n * per its {@link import('../model/NodeSpec.js').NodeSpec} content rule. An\n * undefined `containerType` denotes the document root, which imposes no\n * restriction. Used to keep paste from creating schema-invalid nesting, such as\n * a `table` dropped into a `table_cell` (#166).\n */\nexport function canContainerHoldBlocks(\n\tregistry: SchemaRegistry,\n\tcontainerType: string | undefined,\n\tblocks: readonly BlockNode[],\n): boolean {\n\tif (!containerType) return true;\n\treturn blocks.every((block) => canContain(registry, containerType, block.type));\n}\n\n/**\n * Insertion context that escapes to the document root: blocks are placed after\n * the top-level ancestor of `anchorBlockId` (e.g. the outer table when the caret\n * sits inside a cell). The anchor is never treated as empty, so the originating\n * container keeps its own content. Returns undefined when the anchor is not part\n * of the document.\n */\nexport function resolveRootEscapeContext(\n\tstate: EditorState,\n\tanchorBlockId: BlockId,\n): InsertionContext | undefined {\n\tconst topIndex: number = topLevelBlockIndex(state, anchorBlockId);\n\tif (topIndex === -1) return undefined;\n\treturn { parentPath: [], anchorIndex: topIndex, isAnchorEmpty: false };\n}\n\n/**\n * True when the block is a blank-line paragraph. Inline-aware: a paragraph that\n * holds only an atomic inline node (e.g. an inline formula) has width > 0 and is\n * therefore never treated as blank, so it is never silently removed.\n */\nexport function isEmptyParagraph(block: BlockNode): boolean {\n\treturn block.type === 'paragraph' && getBlockLength(block) === 0;\n}\n\n/**\n * Places a block-level object on its own line at the document root: the object\n * followed by a trailing empty paragraph, so a void/atomic object always has an\n * editable line after it. The object is inserted after the top-level ancestor of\n * the current selection; when that ancestor is a blank-line paragraph it is\n * consumed, so the object is never preceded by a stray empty paragraph (#152).\n *\n * Only an empty *paragraph* is consumed — an empty heading or list item is\n * deliberate structure — and the emptiness test is inline-aware (see\n * {@link isEmptyParagraph}). This is intentionally stricter than\n * {@link insertBlockAfterAnchor}, which the paste pipeline uses with a text-only\n * emptiness notion.\n *\n * A void anchor (image, display formula) already owns a trailing empty paragraph\n * as its escape line. In that case the object is placed before that paragraph and\n * the paragraph is reused as the object's trailing line, so a second blank line\n * never stacks up (#158).\n *\n * Selection is the caller's concern, since objects differ (a cursor inside a new\n * table vs. a node selection on an image or display formula). Returns the\n * trailing paragraph after the object, or undefined when the selection has no\n * resolvable anchor.\n */\nexport function insertBlockObjectOnOwnLine(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\tobject: BlockNode,\n): BlockNode | undefined {\n\treturn insertBlockObjectsOnOwnLines(state, builder, anchorBlockId, [object]);\n}\n\n/**\n * Places a sequence of block-level objects on their own lines at the document\n * root, sharing a single trailing empty paragraph. Generalizes\n * {@link insertBlockObjectOnOwnLine} for inserting several objects at once (e.g.\n * pasting two or more standalone formulas, #159); for a single object the two\n * behave identically. The anchor-consumption (#152) and void-anchor trailing\n * reuse (#158) rules apply once, around the whole run.\n *\n * Returns the trailing paragraph after the last object, or undefined when the\n * anchor or object list is empty.\n */\nexport function insertBlockObjectsOnOwnLines(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\tobjects: readonly BlockNode[],\n): BlockNode | undefined {\n\tif (objects.length === 0) return undefined;\n\n\tconst topIndex: number = topLevelBlockIndex(state, anchorBlockId);\n\tif (topIndex === -1) return undefined;\n\n\tconst anchor: BlockNode | undefined = state.doc.children[topIndex];\n\tconst following: BlockNode | undefined = state.doc.children[topIndex + 1];\n\n\tlet insertAt: number = topIndex + 1;\n\tfor (const object of objects) {\n\t\tbuilder.insertNode([], insertAt, object);\n\t\tinsertAt++;\n\t}\n\n\t// A void anchor already owns a trailing empty paragraph as its escape line;\n\t// reuse it so a second blank line never stacks up (#158). Otherwise add one.\n\tconst reusableTrailing: BlockNode | undefined =\n\t\tanchor && isVoidBlock(state, anchor.id) && following && isEmptyParagraph(following)\n\t\t\t? following\n\t\t\t: undefined;\n\tlet trailing: BlockNode;\n\tif (reusableTrailing) {\n\t\ttrailing = reusableTrailing;\n\t} else {\n\t\ttrailing = createBlockNode(nodeType('paragraph'));\n\t\tbuilder.insertNode([], insertAt, trailing);\n\t}\n\n\t// Drop a blank-line paragraph anchor so the objects are not preceded by a\n\t// stray empty paragraph (#152).\n\tif (anchor && isEmptyParagraph(anchor)) {\n\t\tbuilder.removeNode([], topIndex);\n\t}\n\n\treturn trailing;\n}\n\n/** Recursively clones a block tree, assigning new IDs to all block nodes. */\nexport function cloneBlockWithNewIds(block: BlockNode, newId: BlockId): BlockNode {\n\tconst children = block.children.map((child) => {\n\t\tif (isBlockNode(child)) {\n\t\t\treturn cloneBlockWithNewIds(child, generateBlockId());\n\t\t}\n\t\treturn child;\n\t});\n\treturn createBlockNode(block.type, children, newId, block.attrs, block.htmlId);\n}\n\n/** Recursively searches a block tree for a block with the given ID (DFS). */\nexport function findBlockRecursive(block: BlockNode, blockId: BlockId): BlockNode | undefined {\n\tif (block.id === blockId) return block;\n\tfor (const child of block.children) {\n\t\tif (!isBlockNode(child)) continue;\n\t\tconst found: BlockNode | undefined = findBlockRecursive(child, blockId);\n\t\tif (found) return found;\n\t}\n\treturn undefined;\n}\n\n/**\n * Validates incoming attributes against the declared AttrSpec.\n * Only declared keys are kept. Block callers may opt into immutable flat arrays\n * for specs that explicitly set `allowArray`; all other structured values fall\n * back to defaults or are removed.\n */\nexport function sanitizeAttrs(\n\tincoming: Record<string, unknown> | undefined,\n\tspecAttrs: Readonly<Record<string, AttrSpec>> | undefined,\n\tallowStructured = false,\n): BlockAttrs | undefined {\n\tif (!specAttrs) return undefined;\n\n\tconst result: Record<string, BlockAttrValue> = {};\n\tlet hasKeys = false;\n\n\tfor (const key of Object.keys(specAttrs)) {\n\t\tconst spec: AttrSpec = specAttrs[key] as AttrSpec;\n\t\tconst raw: unknown = incoming?.[key];\n\n\t\tif (\n\t\t\ttypeof raw === 'string' ||\n\t\t\t(typeof raw === 'number' && Number.isFinite(raw)) ||\n\t\t\ttypeof raw === 'boolean'\n\t\t) {\n\t\t\tresult[key] = raw;\n\t\t} else if (allowStructured && spec.allowArray && isBlockAttrArray(raw)) {\n\t\t\tresult[key] = Object.freeze([...raw]);\n\t\t} else if (spec.default !== undefined) {\n\t\t\tresult[key] = spec.default;\n\t\t}\n\t\tif (key in result) hasKeys = true;\n\t}\n\n\treturn hasKeys ? result : undefined;\n}\n\nfunction isBlockAttrArray(value: unknown): value is readonly BlockAttrArrayValue[] {\n\treturn (\n\t\tArray.isArray(value) &&\n\t\tvalue.every(\n\t\t\t(item: unknown): boolean =>\n\t\t\t\titem === null ||\n\t\t\t\ttypeof item === 'string' ||\n\t\t\t\ttypeof item === 'boolean' ||\n\t\t\t\t(typeof item === 'number' && Number.isFinite(item)),\n\t\t)\n\t);\n}\n\n/** Checks whether a block is empty (has no text and is not a void block). */\nfunction isBlockEmpty(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tschemaRegistry?: SchemaRegistry,\n): boolean {\n\tconst block: BlockNode | undefined = state.getBlock(blockId);\n\tif (!block) return false;\n\n\tconst spec = schemaRegistry?.getNodeSpec(block.type);\n\treturn !spec?.isVoid && getBlockText(block) === '';\n}\n\n// --- Rich block creation ---\n\n/**\n * Validates a rich block against the schema registry.\n * Returns undefined for blocks with unknown types; sanitizes attributes\n * against the declared spec.\n */\nexport function validateRichBlockData(\n\traw: RichBlockData,\n\tschemaRegistry?: SchemaRegistry,\n): RichBlockData | undefined {\n\tif (!raw.type) return undefined;\n\tif (!schemaRegistry) return raw;\n\n\tconst spec = schemaRegistry.getNodeSpec(raw.type);\n\tif (!spec) return undefined;\n\n\tconst attrs: BlockAttrs | undefined = sanitizeAttrs(raw.attrs, spec.attrs, true);\n\tconst htmlId: string | undefined = normalizeHTMLId(raw.htmlId);\n\tconst segments: RichSegment[] | undefined = raw.segments\n\t\t? sanitizeRichSegments(raw.segments, schemaRegistry)\n\t\t: undefined;\n\tconst { htmlId: _rawHTMLId, ...rest } = raw;\n\treturn {\n\t\t...rest,\n\t\t...(htmlId ? { htmlId } : {}),\n\t\t...(attrs ? { attrs } : {}),\n\t\t...(segments ? { segments } : raw.segments ? { segments: [] } : {}),\n\t};\n}\n\n/**\n * Creates a BlockNode from validated rich block data.\n * Converts segments or plain text into inline children.\n */\nexport function createBlockFromRichData(blockData: RichBlockData): BlockNode {\n\tconst newId: BlockId = generateBlockId();\n\tconst children: readonly (TextNode | InlineNode)[] | undefined =\n\t\tcreateChildrenFromRichBlock(blockData);\n\tconst attrs: BlockAttrs | undefined = blockData.attrs\n\t\t? (blockData.attrs as BlockAttrs)\n\t\t: undefined;\n\n\treturn createBlockNode(\n\t\tnodeType(blockData.type) as NodeTypeName,\n\t\tchildren,\n\t\tnewId,\n\t\tattrs,\n\t\tblockData.htmlId,\n\t);\n}\n\n/**\n * Creates inline children from rich block data.\n * Uses mark-preserving segments when available, falls back to plain text.\n * Returns undefined for content-free blocks (e.g. void blocks).\n */\nfunction createChildrenFromRichBlock(\n\tblockData: RichBlockData,\n): readonly (TextNode | InlineNode)[] | undefined {\n\tconst segments: readonly ContentSegment[] = richBlockToContentSegments(blockData);\n\tif (segments.length === 0) return undefined;\n\treturn segmentsToInlineChildren(segments);\n}\n\n/**\n * Converts rich block data into a paste {@link ContentSlice}. Blocks that fail\n * schema validation (unknown type or filtered attributes) are dropped, so the\n * resulting slice can be fed straight into the canonical paste strategy\n * ({@link import('./PasteCommand.js').pasteSlice}).\n */\nexport function richBlocksToSlice(\n\tblocks: readonly RichBlockData[],\n\tschemaRegistry?: SchemaRegistry,\n): ContentSlice {\n\tconst sliceBlocks: SliceBlock[] = [];\n\tfor (const raw of blocks) {\n\t\tconst blockData: RichBlockData | undefined = validateRichBlockData(raw, schemaRegistry);\n\t\tif (!blockData) continue;\n\t\tsliceBlocks.push(richBlockToSliceBlock(blockData));\n\t}\n\treturn { blocks: sliceBlocks };\n}\n\n/** Converts a single validated rich block into a {@link SliceBlock}. */\nfunction richBlockToSliceBlock(blockData: RichBlockData): SliceBlock {\n\tconst attrs: BlockAttrs | undefined = blockData.attrs\n\t\t? (blockData.attrs as BlockAttrs)\n\t\t: undefined;\n\treturn {\n\t\ttype: nodeType(blockData.type) as NodeTypeName,\n\t\t...(attrs ? { attrs } : {}),\n\t\tsegments: richBlockToContentSegments(blockData),\n\t};\n}\n\n/** Builds content segments from a rich block, falling back to plain text. */\nfunction richBlockToContentSegments(blockData: RichBlockData): readonly ContentSegment[] {\n\tif (blockData.segments && blockData.segments.length > 0) {\n\t\treturn richSegmentsToContentSegments(blockData.segments);\n\t}\n\tconst text: string = blockData.text ?? '';\n\treturn text ? [textSegment(text)] : [];\n}\n\n/** Converts rich segments into content segments (marked text and inline nodes). */\nfunction richSegmentsToContentSegments(\n\tsegments: readonly RichSegment[],\n): readonly ContentSegment[] {\n\tconst result: ContentSegment[] = [];\n\tfor (const seg of segments) {\n\t\tif (seg.kind === 'inline') {\n\t\t\tresult.push(\n\t\t\t\tinlineSegment(\n\t\t\t\t\tcreateInlineNode(\n\t\t\t\t\t\tinlineType(seg.inlineType),\n\t\t\t\t\t\tseg.attrs as Readonly<Record<string, string | number | boolean>> | undefined,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tif (seg.text.length === 0) continue;\n\t\tconst marks: readonly Mark[] = seg.marks.map((m) => ({\n\t\t\ttype: m.type as Mark['type'],\n\t\t\t...(m.attrs ? { attrs: m.attrs as Mark['attrs'] } : {}),\n\t\t}));\n\t\tresult.push(textSegment(seg.text, marks));\n\t}\n\treturn result;\n}\n\nfunction sanitizeRichSegments(\n\tsegments: readonly RichSegment[],\n\tschemaRegistry: SchemaRegistry,\n): RichSegment[] {\n\tconst sanitized: RichSegment[] = [];\n\tfor (const segment of segments) {\n\t\tif (segment.kind === 'inline') {\n\t\t\tconst spec = schemaRegistry.getInlineNodeSpec(segment.inlineType);\n\t\t\tif (!spec) continue;\n\t\t\tconst attrs = sanitizeAttrs(segment.attrs, spec.attrs);\n\t\t\tsanitized.push({\n\t\t\t\tkind: 'inline',\n\t\t\t\tinlineType: segment.inlineType,\n\t\t\t\t...(attrs ? { attrs } : {}),\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tsanitized.push(segment);\n\t}\n\treturn sanitized;\n}\n"],"mappings":"kbA4BA,SAAgB,EACf,EACA,GAEA,GAA0B,IAAtB,EAAW,OAAc,OAAO,EAAM,IAAI,SAC9C,MAAM,EAAgC,EAAM,SAC3C,EAAW,EAAW,OAAS,IAEhC,OAAO,EAAS,EAAO,SAAW,EACnC,CAQA,SAAgB,EAAmB,EAAgB,GAClD,GAAI,EAAY,GACf,MAAO,CAAE,QAAS,EAAI,OAAO,QAAS,OAAQ,EAAI,OAAO,QAE1D,MAAM,EAAQ,EAAe,EAAK,GAClC,MAAO,CAAE,QAAS,EAAM,KAAK,QAAS,OAAQ,EAAM,KAAK,OAC1D,CAGA,SAAgB,EAAkB,GACjC,OAAO,GAAQ,EAAK,OAAS,EAAK,EAAK,MAAM,GAAG,GAAoB,EACrE,CAGA,SAAgB,EAAiB,EAAgC,GAChE,OAAO,EAAS,UAAW,GAAM,EAAY,IAAM,EAAE,KAAO,EAC7D,CAcA,SAAgB,EAAsB,EAAoB,GACzD,MAAM,EAAwB,EAAkB,EAAa,EAAM,IAAK,IAClE,EAAiC,EAAY,EAAO,GAE1D,MAAO,CAAE,aAAY,WAAU,MADT,EAAiB,EAAU,GAElD,CAGA,SAAgB,EAAqB,GACpC,GAAI,EAAY,GAAO,OAAO,EAAK,GAEnC,IAAK,MAAM,KAAS,EAAK,SACxB,GAAK,EAAY,GACjB,OAAO,EAAqB,GAG7B,OAAO,EAAK,EACb,CAGA,SAAgB,EAAoB,GAC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C,CACA,OAAO,CACR,CA/BS,CAA8B,EAAU,UAEhD,MAAM,EAAe,EAAU,MAAQ,GACvC,OAAO,EAAO,CAAC,EAAY,IAAS,EACrC"}
@@ -1,2 +0,0 @@
1
- import{D as t,E as e,h as o,k as r,p as n}from"./Document-ssR6hBzG.mjs";import{a as i,l as c,t as s}from"./NodeResolver-F4RtpoEd.mjs";import{c as l,f as a,n as u,p as d}from"./Selection-DC6AOGgF.mjs";import{a as h}from"./TypeBrands-Ch9856Gb.mjs";import{c as m,o as p}from"./PluginHelpers-B3gk3VB3.mjs";import{n as g}from"./DomUtils-Bf7JLFlx.mjs";import{t as f}from"./ShortcutFormatting-TwiufqeV.mjs";function b(t,e){const o=t.getNodePath(e)?.[0];return o?t.doc.children.findIndex(t=>t.id===o):-1}function k(t,o,r,i){const c=d(r,t.getBlockOrder()),s=b(t,c.from.blockId),l=b(t,c.to.blockId);if(s<0||l<0)return null;const a=Math.min(s,l),u=Math.max(s,l),h=t.doc.children.slice(a,u+1),m=i??(()=>!0),p=[];let g=[],f=!1;const k=()=>{0!==g.length&&(p.push(n(o,g,e())),f=!0,g=[])};for(const e of h)m(e)?g.push(e):(k(),p.push(e));if(k(),!f)return null;const q=t.transaction("command");for(let e=u;e>=a;e--)q.removeNode([],e);return p.forEach((t,e)=>{q.insertNode([],a+e,t)}),q.setSelection(r),q.build()}function q(e,o){const r=e.getState();if(!a(r.selection))return!1;const n=r.selection;if(!l(n))return!1;const i=n.anchor.blockId,s=r.getParent(i);if(!s||"blockquote"!==s.type)return!1;const u=r.getBlock(i);if(!u)return!1;const d=r.getNodePath(s.id);if(!d)return!1;const h=c(r.doc,d);if(!h)return!1;const m=t(s),p=m.findIndex(t=>t.id===i);return!(p<0)&&o({state:r,quotePath:d,quoteParentPath:d.slice(0,-1),quoteIndex:h.index,child:u,childIndex:p,childCount:m.length,offset:n.anchor.offset})}var I={label:"Blockquote",tooltip:t=>`Blockquote (${t})`},x=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-sGZ-oZqB.mjs"),"./locales/de.ts":()=>import("./de-uKR7koQe.mjs"),"./locales/es.ts":()=>import("./es-DrJyl38L.mjs"),"./locales/fr.ts":()=>import("./fr-BRXUnq3R.mjs"),"./locales/hi.ts":()=>import("./hi-SECtQQzq.mjs"),"./locales/pt.ts":()=>import("./pt-Cv6q7x5x.mjs"),"./locales/ru.ts":()=>import("./ru-DSRv3_Rg.mjs"),"./locales/zh.ts":()=>import("./zh-DYD476c5.mjs")});async function v(t){return m(x,t,I)}var N={},S=class{id="blockquote";name="Blockquote";priority=35;config;locale;constructor(t){this.config={...N,...t}}async init(t){this.locale=await p(t,this.config.locale,I,v),t.registerStyleSheet(".notectl-content blockquote{padding:2px 0;border-inline-start:3px solid var(--notectl-blockquote-border,var(--notectl-border));background:var(--notectl-blockquote-bg,transparent);color:var(--notectl-blockquote-fg,inherit);min-height:1.6em;margin:0;padding-inline-start:16px}"),this.registerNodeSpec(t),this.registerCommands(t),this.registerKeymap(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerToolbarItem(t)}registerNodeSpec(t){t.registerNodeSpec({type:"blockquote",group:"block",content:{allow:["paragraph","heading","list_item","blockquote","horizontal_rule","code_block"],min:1},toDOM(t){const e=g("blockquote",t.id);return e.setAttribute("part","blockquote"),e},toHTML:(t,e)=>`<blockquote>${e||"<br>"}</blockquote>`,parseHTML:[{tag:"blockquote"}],sanitize:{tags:["blockquote"]}})}registerCommands(t){t.registerCommand("toggleBlockquote",()=>this.toggleBlockquote(t)),t.registerCommand("setBlockquote",()=>this.wrapInBlockquote(t))}registerKeymap(t){t.registerKeymap({"Mod-Shift->":()=>t.executeCommand("toggleBlockquote")}),function(t){t.registerKeymap({Enter:()=>function(t){return q(t,e=>{if("list_item"===e.child.type)return!1;if(e.childIndex!==e.childCount-1||r(e.child)>0)return!1;const n=o(),i=e.state.transaction("input");return 1===e.childCount?(i.removeNode(e.quoteParentPath,e.quoteIndex),i.insertNode(e.quoteParentPath,e.quoteIndex,n)):(i.removeNode(e.quotePath,e.childIndex),i.insertNode(e.quoteParentPath,e.quoteIndex+1,n)),i.setSelection(u(n.id,0)),t.dispatch(i.build()),!0})}(t),Backspace:()=>function(t){return q(t,e=>{if(0!==e.offset||0!==e.childIndex)return!1;if("list_item"===e.child.type)return!1;const o=e.state.transaction("input");return 1===e.childCount?(o.removeNode(e.quoteParentPath,e.quoteIndex),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)):(o.removeNode(e.quotePath,0),o.insertNode(e.quoteParentPath,e.quoteIndex,e.child)),o.setSelection(u(e.child.id,0)),t.dispatch(o.build()),!0})}(t)},{priority:"context"})}(t)}registerInputRule(t){t.registerInputRule({pattern:/^> $/,handler(t,o,r,i){const c=t.selection;if(!a(c))return null;if(!l(c))return null;const s=t.getBlock(c.anchor.blockId);if(!s||"paragraph"!==s.type)return null;const u=t.doc.children.findIndex(t=>t.id===s.id);if(u<0)return null;const d=n(h("blockquote"),[s],e());return t.transaction("input").removeNode([],u).insertNode([],u,d).deleteTextAt(c.anchor.blockId,r,r+2).setSelection(c).build()}})}registerToolbarItem(t){t.registerToolbarItem({id:"blockquote",group:"block",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(f("Mod-Shift->")),command:"toggleBlockquote",isActive:t=>!!a(t.selection)&&i(t.doc,t.selection.anchor.blockId,"blockquote")})}toggleBlockquote(e){const o=e.getState(),r=o.selection;if(!a(r))return!1;const n=i(o.doc,r.anchor.blockId,"blockquote")?function(e,o,r){const n=s(e.doc,r.anchor.blockId,o);if(!n||1!==n.path.length)return null;const i=e.doc.children.findIndex(t=>t.id===n.node.id);if(i<0)return null;const c=t(n.node),l=e.transaction("command");return l.removeNode([],i),c.forEach((t,e)=>{l.insertNode([],i+e,t)}),l.setSelection(r),l.build()}(o,h("blockquote"),r):k(o,h("blockquote"),r,this.isQuoteChild(e));return!!n&&(e.dispatch(n),!0)}wrapInBlockquote(t){const e=t.getState(),o=e.selection;if(!a(o))return!1;const r=k(e,h("blockquote"),o,this.isQuoteChild(t));return!!r&&(t.dispatch(r),!0)}isQuoteChild(t){const e=t.getSchemaRegistry(),o=new Set(e.getNodeSpec(h("blockquote"))?.content?.allow??[]);return t=>{if(o.has(t.type))return!0;const r=e.getNodeSpec(t.type)?.group;return void 0!==r&&o.has(r)}}};export{I as n,v as r,S as t};
2
- //# sourceMappingURL=BlockquotePlugin-CSL_7Yit.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockquotePlugin-CSL_7Yit.mjs","names":[],"sources":["../../src/commands/ContainerCommands.ts","../../src/plugins/blockquote/BlockquoteKeyboardHandlers.ts","../../src/plugins/blockquote/BlockquoteLocale.ts","../../src/plugins/blockquote/BlockquoteStyles.css?inline","../../src/plugins/blockquote/BlockquotePlugin.ts"],"sourcesContent":["/**\n * Generic wrap/lift commands for container blocks (issue #136).\n *\n * A container block (e.g. `blockquote`) holds other blocks as children, mirroring\n * HTML flow-content semantics. Wrapping moves the selected top-level blocks into a\n * new container; lifting dissolves a container and returns its children to the\n * parent. Block identity (IDs) is preserved across both operations so the active\n * selection survives the structural change.\n *\n * Scope: operations act on top-level containers. Nested containers (quote-in-quote,\n * quote-in-cell) are intentionally out of scope here and return `null`.\n */\n\nimport type { BlockNode } from '../model/Document.js';\nimport { createBlockNode, generateBlockId, getBlockChildren } from '../model/Document.js';\nimport { findAncestorOfType } from '../model/NodeResolver.js';\nimport type { Selection } from '../model/Selection.js';\nimport { selectionRange } from '../model/Selection.js';\nimport type { BlockId, NodeTypeName } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport type { Transaction } from '../state/Transaction.js';\n\n/** Returns the index in `doc.children` of the top-level ancestor of the given block. */\nfunction topLevelIndexOf(state: EditorState, blockId: BlockId): number {\n\tconst topId: BlockId | undefined = state.getNodePath(blockId)?.[0];\n\tif (!topId) return -1;\n\treturn state.doc.children.findIndex((b) => b.id === topId);\n}\n\n/**\n * Wraps the top-level blocks spanned by `selection` into new container blocks of\n * `containerType`. Returns `null` when the range cannot be resolved.\n *\n * `isAllowedChild` guards the container's schema (`content.allow`): blocks the\n * container cannot legally hold (e.g. a `table` inside a `blockquote`) are left at\n * the top level instead of being nested into an invalid document. Disallowed blocks\n * therefore split the range into separate contiguous runs, each wrapped in its own\n * container, mirroring `wrapIn`. Defaults to wrapping everything when omitted.\n * Returns `null` when no block in the range is wrappable.\n */\nexport function wrapSelectionInContainer(\n\tstate: EditorState,\n\tcontainerType: NodeTypeName,\n\tselection: Selection,\n\tisAllowedChild?: (block: BlockNode) => boolean,\n): Transaction | null {\n\tconst range = selectionRange(selection, state.getBlockOrder());\n\tconst fromIdx: number = topLevelIndexOf(state, range.from.blockId);\n\tconst toIdx: number = topLevelIndexOf(state, range.to.blockId);\n\tif (fromIdx < 0 || toIdx < 0) return null;\n\n\tconst lo: number = Math.min(fromIdx, toIdx);\n\tconst hi: number = Math.max(fromIdx, toIdx);\n\n\tconst blocks: readonly BlockNode[] = state.doc.children.slice(lo, hi + 1);\n\tconst allowed: (block: BlockNode) => boolean = isAllowedChild ?? (() => true);\n\n\t// Group the range into maximal runs of wrappable blocks; each run becomes one\n\t// container, disallowed blocks pass through unchanged and break the run.\n\tconst sequence: BlockNode[] = [];\n\tlet run: BlockNode[] = [];\n\tlet wrappedAny = false;\n\tconst flushRun = (): void => {\n\t\tif (run.length === 0) return;\n\t\tsequence.push(createBlockNode(containerType, run, generateBlockId()));\n\t\twrappedAny = true;\n\t\trun = [];\n\t};\n\tfor (const block of blocks) {\n\t\tif (allowed(block)) {\n\t\t\trun.push(block);\n\t\t} else {\n\t\t\tflushRun();\n\t\t\tsequence.push(block);\n\t\t}\n\t}\n\tflushRun();\n\n\tif (!wrappedAny) return null;\n\n\tconst builder = state.transaction('command');\n\tfor (let i: number = hi; i >= lo; i--) {\n\t\tbuilder.removeNode([], i);\n\t}\n\tsequence.forEach((node, i) => {\n\t\tbuilder.insertNode([], lo + i, node);\n\t});\n\tbuilder.setSelection(selection);\n\treturn builder.build();\n}\n\n/**\n * Lifts the children of the nearest top-level `containerType` ancestor of the\n * selection anchor back out to the top level, dissolving the container. Returns\n * `null` when no such top-level container surrounds the selection.\n */\nexport function liftSelectionFromContainer(\n\tstate: EditorState,\n\tcontainerType: NodeTypeName,\n\tselection: Selection,\n): Transaction | null {\n\tconst ancestor = findAncestorOfType(state.doc, selection.anchor.blockId, containerType);\n\t// Only top-level containers are dissolved (path === [containerId]).\n\tif (!ancestor || ancestor.path.length !== 1) return null;\n\n\tconst containerIdx: number = state.doc.children.findIndex((b) => b.id === ancestor.node.id);\n\tif (containerIdx < 0) return null;\n\n\tconst children: readonly BlockNode[] = getBlockChildren(ancestor.node);\n\n\tconst builder = state.transaction('command');\n\tbuilder.removeNode([], containerIdx);\n\tchildren.forEach((child, i) => {\n\t\tbuilder.insertNode([], containerIdx + i, child);\n\t});\n\tbuilder.setSelection(selection);\n\treturn builder.build();\n}\n","/**\n * Keyboard handlers for the blockquote container (issue #136, B2 model).\n *\n * Under the container model the caret lives in a child block of the blockquote,\n * not in the blockquote itself. These handlers manage the two container\n * boundaries; everything in between (splitting, merging, arrow navigation) is\n * left to the default commands, which already operate correctly on the nested\n * child blocks:\n *\n * - Enter in an empty last child → exit the blockquote (paragraph after it).\n * - Backspace at start of the first child → lift that child out of the quote.\n *\n * List items are deferred to the list plugin's own handlers.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { createEmptyParagraph, getBlockChildren, getBlockLength } from '../../model/Document.js';\nimport { resolveParentByPath } from '../../model/NodeResolver.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\n\n// --- Context Guard ---\n\ninterface QuoteChildContext {\n\treadonly state: EditorState;\n\treadonly quotePath: readonly BlockId[];\n\treadonly quoteParentPath: readonly BlockId[];\n\treadonly quoteIndex: number;\n\treadonly child: BlockNode;\n\treadonly childIndex: number;\n\treadonly childCount: number;\n\treadonly offset: number;\n}\n\n/**\n * Resolves the caret context when the cursor sits in a direct child of a\n * blockquote. Returns false (not handled) otherwise, so the default keymap and\n * other plugins keep their behavior.\n */\nfunction withBlockquoteChildContext(\n\tcontext: PluginContext,\n\thandler: (ctx: QuoteChildContext) => boolean,\n): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst childId: BlockId = sel.anchor.blockId;\n\tconst quote: BlockNode | undefined = state.getParent(childId);\n\tif (!quote || quote.type !== 'blockquote') return false;\n\n\tconst child: BlockNode | undefined = state.getBlock(childId);\n\tif (!child) return false;\n\n\tconst quotePath: BlockId[] | undefined = state.getNodePath(quote.id);\n\tif (!quotePath) return false;\n\tconst parentRef = resolveParentByPath(state.doc, quotePath);\n\tif (!parentRef) return false;\n\n\tconst children: readonly BlockNode[] = getBlockChildren(quote);\n\tconst childIndex: number = children.findIndex((b) => b.id === childId);\n\tif (childIndex < 0) return false;\n\n\treturn handler({\n\t\tstate,\n\t\tquotePath,\n\t\tquoteParentPath: quotePath.slice(0, -1),\n\t\tquoteIndex: parentRef.index,\n\t\tchild,\n\t\tchildIndex,\n\t\tchildCount: children.length,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers the blockquote container keyboard handlers at context priority. */\nexport function registerBlockquoteKeymaps(context: PluginContext): void {\n\tcontext.registerKeymap(\n\t\t{\n\t\t\tEnter: () => handleEnterExit(context),\n\t\t\tBackspace: () => handleBackspaceLift(context),\n\t\t},\n\t\t{ priority: 'context' },\n\t);\n}\n\n// --- Handlers ---\n\n/**\n * Enter in an empty last child of the blockquote exits the container: a fresh\n * paragraph is created after the quote (or, when that child is the quote's only\n * child, the quote dissolves into that paragraph). Any other case returns false\n * so the default splitBlock creates a new line inside the quote.\n */\nfunction handleEnterExit(context: PluginContext): boolean {\n\treturn withBlockquoteChildContext(context, (ctx) => {\n\t\tif (ctx.child.type === 'list_item') return false;\n\t\tconst isLast: boolean = ctx.childIndex === ctx.childCount - 1;\n\t\tif (!isLast || getBlockLength(ctx.child) > 0) return false;\n\n\t\tconst paragraph: BlockNode = createEmptyParagraph();\n\t\tconst builder = ctx.state.transaction('input');\n\n\t\tif (ctx.childCount === 1) {\n\t\t\t// Sole child: dissolve the quote, replacing it with the paragraph.\n\t\t\tbuilder.removeNode(ctx.quoteParentPath, ctx.quoteIndex);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex, paragraph);\n\t\t} else {\n\t\t\t// Drop the empty trailing child and continue after the quote.\n\t\t\tbuilder.removeNode(ctx.quotePath, ctx.childIndex);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex + 1, paragraph);\n\t\t}\n\n\t\tbuilder.setSelection(createCollapsedSelection(paragraph.id, 0));\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t});\n}\n\n/**\n * Backspace at the start of the blockquote's first child lifts that child out of\n * the quote (placing it directly before the quote, or dissolving the quote when\n * it was the only child). Inner children at offset 0 fall through to the default\n * merge, which joins adjacent siblings within the quote.\n */\nfunction handleBackspaceLift(context: PluginContext): boolean {\n\treturn withBlockquoteChildContext(context, (ctx) => {\n\t\tif (ctx.offset !== 0 || ctx.childIndex !== 0) return false;\n\t\tif (ctx.child.type === 'list_item') return false;\n\n\t\tconst builder = ctx.state.transaction('input');\n\n\t\tif (ctx.childCount === 1) {\n\t\t\t// Sole child: dissolve the quote, the child takes its place.\n\t\t\tbuilder.removeNode(ctx.quoteParentPath, ctx.quoteIndex);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex, ctx.child);\n\t\t} else {\n\t\t\t// Lift the first child out, immediately before the quote.\n\t\t\tbuilder.removeNode(ctx.quotePath, 0);\n\t\t\tbuilder.insertNode(ctx.quoteParentPath, ctx.quoteIndex, ctx.child);\n\t\t}\n\n\t\tbuilder.setSelection(createCollapsedSelection(ctx.child.id, 0));\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t});\n}\n","/**\n * Locale interface and default English locale for the BlockquotePlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface BlockquoteLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const BLOCKQUOTE_LOCALE_EN: BlockquoteLocale = {\n\tlabel: 'Blockquote',\n\ttooltip: (shortcut: string) => `Blockquote (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<BlockquoteLocale> = import.meta.glob<{\n\tdefault: BlockquoteLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadBlockquoteLocale(lang: string): Promise<BlockquoteLocale> {\n\treturn loadLocaleModule(localeModules, lang, BLOCKQUOTE_LOCALE_EN);\n}\n","/** Blockquote styles using CSS logical properties for RTL support. */\n.notectl-content blockquote {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 16px;\n\tborder-inline-start: 3px solid var(--notectl-blockquote-border, var(--notectl-border));\n\tbackground: var(--notectl-blockquote-bg, transparent);\n\tcolor: var(--notectl-blockquote-fg, inherit);\n\tmin-height: 1.6em;\n}\n","/**\n * BlockquotePlugin: registers a blockquote block type with NodeSpec,\n * toggle command, keyboard shortcut, input rule, and a toolbar button.\n */\n\nimport {\n\tliftSelectionFromContainer,\n\twrapSelectionInContainer,\n} from '../../commands/ContainerCommands.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { createBlockNode, generateBlockId } from '../../model/Document.js';\nimport { hasAncestorOfType } from '../../model/NodeResolver.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { registerBlockquoteKeymaps } from './BlockquoteKeyboardHandlers.js';\nimport {\n\tBLOCKQUOTE_LOCALE_EN,\n\ttype BlockquoteLocale,\n\tloadBlockquoteLocale,\n} from './BlockquoteLocale.js';\nimport BLOCKQUOTE_CSS from './BlockquoteStyles.css?inline';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tblockquote: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface BlockquoteConfig {\n\t/** Live Markdown shortcut: `> ` to start a blockquote. Default true. */\n\treadonly inputRule?: boolean;\n\treadonly locale?: BlockquoteLocale;\n}\n\nconst DEFAULT_CONFIG: BlockquoteConfig = {};\n\n// --- Plugin ---\n\nexport class BlockquotePlugin implements Plugin {\n\treadonly id = 'blockquote';\n\treadonly name = 'Blockquote';\n\treadonly priority = 35;\n\n\tprivate readonly config: BlockquoteConfig;\n\tprivate locale!: BlockquoteLocale;\n\n\tconstructor(config?: Partial<BlockquoteConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tBLOCKQUOTE_LOCALE_EN,\n\t\t\tloadBlockquoteLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(BLOCKQUOTE_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tif (this.config.inputRule !== false) this.registerInputRule(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\t// Container block (issue #136): a blockquote wraps other blocks, mirroring\n\t\t\t// HTML flow-content semantics. `isolating` is intentionally NOT set so the\n\t\t\t// caret can flow across the container boundary (unlike table_cell).\n\t\t\tcontent: {\n\t\t\t\tallow: ['paragraph', 'heading', 'list_item', 'blockquote', 'horizontal_rule', 'code_block'],\n\t\t\t\tmin: 1,\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst el = createBlockElement('blockquote', node.id);\n\t\t\t\tel.setAttribute('part', 'blockquote');\n\t\t\t\treturn el;\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<blockquote>${content || '<br>'}</blockquote>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'blockquote' }],\n\t\t\tsanitize: { tags: ['blockquote'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleBlockquote', () => {\n\t\t\treturn this.toggleBlockquote(context);\n\t\t});\n\n\t\tcontext.registerCommand('setBlockquote', () => {\n\t\t\treturn this.wrapInBlockquote(context);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift->': () => context.executeCommand('toggleBlockquote'),\n\t\t});\n\t\tregisterBlockquoteKeymaps(context);\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: /^> $/,\n\t\t\thandler(state, _match, start, _end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\tconst index: number = state.doc.children.findIndex((b) => b.id === block.id);\n\t\t\t\tif (index < 0) return null;\n\n\t\t\t\t// B2: wrap the paragraph into a blockquote container, then strip the\n\t\t\t\t// \"> \" marker from the (now nested) paragraph in the same transaction.\n\t\t\t\tconst container = createBlockNode(nodeType('blockquote'), [block], generateBlockId());\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.removeNode([], index)\n\t\t\t\t\t.insertNode([], index, container)\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + 2)\n\t\t\t\t\t.setSelection(sel)\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'blockquote',\n\t\t\tgroup: 'block',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift->')),\n\t\t\tcommand: 'toggleBlockquote',\n\t\t\tisActive: (state) => {\n\t\t\t\tif (!isTextSelection(state.selection)) return false;\n\t\t\t\treturn hasAncestorOfType(state.doc, state.selection.anchor.blockId, 'blockquote');\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Toggles the blockquote container around the selection.\n\t * If the selection already lives inside a blockquote, its blocks are lifted\n\t * back out; otherwise the selected blocks are wrapped into one blockquote.\n\t */\n\tprivate toggleBlockquote(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst tr = hasAncestorOfType(state.doc, sel.anchor.blockId, 'blockquote')\n\t\t\t? liftSelectionFromContainer(state, nodeType('blockquote'), sel)\n\t\t\t: wrapSelectionInContainer(state, nodeType('blockquote'), sel, this.isQuoteChild(context));\n\n\t\tif (!tr) return false;\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/** Wraps the selected blocks into a blockquote container (no toggle-off). */\n\tprivate wrapInBlockquote(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst tr = wrapSelectionInContainer(\n\t\t\tstate,\n\t\t\tnodeType('blockquote'),\n\t\t\tsel,\n\t\t\tthis.isQuoteChild(context),\n\t\t);\n\t\tif (!tr) return false;\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Builds a predicate that reports whether a block may legally become a direct\n\t * child of the blockquote container, derived from the registered NodeSpec's\n\t * `content.allow` (single source of truth). Matches both concrete child types\n\t * and group names (e.g. `block`), so blocks the quote cannot hold (e.g. a\n\t * `table`) are excluded rather than nested into an invalid document.\n\t */\n\tprivate isQuoteChild(context: PluginContext): (block: BlockNode) => boolean {\n\t\tconst registry = context.getSchemaRegistry();\n\t\tconst allow: ReadonlySet<string> = new Set(\n\t\t\tregistry.getNodeSpec(nodeType('blockquote'))?.content?.allow ?? [],\n\t\t);\n\t\treturn (block: BlockNode): boolean => {\n\t\t\tif (allow.has(block.type)) return true;\n\t\t\tconst group: string | undefined = registry.getNodeSpec(block.type)?.group;\n\t\t\treturn group !== undefined && allow.has(group);\n\t\t};\n\t}\n}\n"],"mappings":"gZAuBA,SAAS,EAAgB,EAAoB,GAC5C,MAAM,EAA6B,EAAM,YAAY,KAAW,GAChE,OAAK,EACE,EAAM,IAAI,SAAS,UAAW,GAAM,EAAE,KAAO,IADjC,CAEpB,CAaA,SAAgB,EACf,EACA,EACA,EACA,GAEA,MAAM,EAAQ,EAAe,EAAW,EAAM,iBACxC,EAAkB,EAAgB,EAAO,EAAM,KAAK,SACpD,EAAgB,EAAgB,EAAO,EAAM,GAAG,SACtD,GAAI,EAAU,GAAK,EAAQ,EAAG,OAAO,KAErC,MAAM,EAAa,KAAK,IAAI,EAAS,GAC/B,EAAa,KAAK,IAAI,EAAS,GAE/B,EAA+B,EAAM,IAA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L,EAAQ,SAAS,IACV,EACR,CAGA,gBAAA,CAAyB,GACxB,MAAM,EAAQ,EAAQ,WAChB,EAAM,EAAM,UAClB,IAAK,EAAgB,GAAM,OAAO,EAElC,MAAM,EAAK,EACV,EACA,EAAS,cACT,EACA,KAAK,aAAa,IAEnB,QAAK,IACL,EAAQ,SAAS,IACV,EACR,CASA,YAAA,CAAqB,GACpB,MAAM,EAAW,EAAQ,oBACnB,EAA6B,IAAI,IACtC,EAAS,YAAY,EAAS,gBAAgB,SAAS,OAAS,IAEjE,OAAQ,IACP,GAAI,EAAM,IAAI,EAAM,MAAO,OAAO,EAClC,MAAM,EAA4B,EAAS,YAAY,EAAM,OAAO,MACpE,YAAiB,IAAV,GAAuB,EAAM,IAAI,GAE1C"}
@@ -1,2 +0,0 @@
1
- import{M as n,i as t,j as o,k as e}from"./Document-ssR6hBzG.mjs";import{c as r,f as i}from"./Selection-DC6AOGgF.mjs";import{a as l,i as c,t as s}from"./NavigationQueries-CaKfccu7.mjs";import{c as a,o as u}from"./PluginHelpers-B3gk3VB3.mjs";import{r as f,t as d}from"./Platform-ByobkiCc.mjs";import{n as h,r as m,t as g}from"./SelectionTransactions-mQ1NfMEg.mjs";import{r as k}from"./DomUtils-Bf7JLFlx.mjs";import{a as w,o as b,r as I,t as v}from"./SelectionSync-BkjCwGp-.mjs";var p="undefined"!=typeof Intl&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null;function x(n,t){if(t>=n.length||0===n.length)return 0;if(p){for(const o of p.segment(n)){const n=o.index+o.segment.length;if(n>t)return n-t}return 0}return 1}function y(n,t){if(t<=0||0===n.length)return 0;if(p){let o=1;for(const e of p.segment(n)){if(e.index+e.segment.length>=t){o=e.segment.length;break}o=e.segment.length}return o}return 1}function B(t,o){let e=o-1;for(;e>=0;){const o=n(t,e);if(!o||"inline"===o.kind)break;if(!/\s/.test(o.char))break;e--}if(e>=0&&"inline"===n(t,e)?.kind)return e;for(;e>=0;){const o=n(t,e);if(!o||"inline"===o.kind)break;if(/\s/.test(o.char))break;e--}return e+1}function C(t,o){const r=e(t);let i=o;for(;i<r;){const o=n(t,i);if(!o||"inline"===o.kind)break;if(/\s/.test(o.char))break;i++}if(i===o&&i<r&&"inline"===n(t,i)?.kind)return i+1;for(;i<r;){const o=n(t,i);if(!o||"inline"===o.kind)break;if(!/\s/.test(o.char))break;i++}return i}function M(n,t,o){if("caretPositionFromPoint"in n){const e=n.caretPositionFromPoint(t,o);if(e)return{node:e.offsetNode,offset:e.offset}}if("caretRangeFromPoint"in n){const e=n.caretRangeFromPoint(t,o);if(e)return{node:e.startContainer,offset:e.startOffset}}return null}function A(n,t,o,e){return M(n,t,o)??(e&&n!==e?M(e,t,o):null)}function S(n,t,o,l){const c=t.selection;if(!i(c))return!1;if(!r(c))return!1;const s=t.getBlock(c.anchor.blockId);if(!s)return!1;const a=c.anchor.offset,u=e(s),f=n.querySelector(`[data-block-id="${c.anchor.blockId}"]`),h=f instanceof HTMLElement&&"rtl"===d(f);if("left"===o)return h?a===u:0===a;if("right"===o)return h?0===a:a===u;if("up"===o&&0===a)return!0;if("down"===o&&a===u)return!0;const m=I();return m&&m.modify?function(n,t,o,e){const r=w(n,t);if(!r)return!1;const i=e??R(t,n),l="up"===o?"backward":"forward";try{t.modify("move",l,"line");const o=w(n,t);if(!o)return!1;if(k(n,r.focusNode)!==k(n,o.focusNode))return!0;if(o.anchorNode===r.anchorNode&&o.anchorOffset===r.anchorOffset&&o.focusNode===r.focusNode&&o.focusOffset===r.focusOffset)return!0;if(i){const o=R(t,n);if(o&&Math.abs(o.top-i.top)<1)return!0}return!1}finally{try{t.setBaseAndExtent(r.anchorNode,r.anchorOffset,r.focusNode,r.focusOffset)}catch{}}}(n,m,o,l):"up"===o?0===a:a===u}function E(n,t){const o=j(n,t);if(!o)return null;if(o.isVoid)return m(n,o.targetId);const r=n.getBlock(o.targetId);if(!r)return null;const i="right"===t||"down"===t?0:e(r);return h(n,o.targetId,i)}function V(n,t,o,l){const c=j(t,o);if(!c)return null;if(c.isVoid)return m(t,c.targetId);const s=t.getBlock(c.targetId);if(!s)return null;const a=e(s);if(null!==l){const e=function(n,t,o,e){const r=n.querySelector(`[data-block-id="${t}"]`);if(!r)return null;const i=r.getBoundingClientRect(),l=function(n,t,o){if(!(n instanceof HTMLElement))return"down"===o?t.top+2:t.bottom-2;const e=getComputedStyle(n),r=Number.parseFloat(e.paddingTop)||0,i=Number.parseFloat(e.paddingBottom)||0;return"down"===o?t.top+r+2:t.bottom-i-2}(r,i,o),c=Math.min(Math.max(e,i.left),i.right-1),s=A(n.getRootNode(),c,l,n.ownerDocument);if(!s)return null;if(!r.contains(s.node))return null;const a=v(n,s.node,s.offset);return a?a.blockId!==t?null:a:null}(n,c.targetId,o,l);if(e)return h(t,e.blockId,e.offset)}if(i(t.selection)&&r(t.selection)){const n=t.selection.anchor.offset,o=Math.min(n,a);return h(t,c.targetId,o)}const u="down"===o?0:a;return h(t,c.targetId,u)}function T(t,o){if("up"===o||"down"===o)return null;const e=t.selection;if(!i(e))return null;if(!r(e))return null;const l=e.anchor.blockId,c=t.getBlock(l);if(!c)return null;const s=e.anchor.offset;return"right"===o?function(t,o,e,r){const i=n(e,r);return i&&"inline"===i.kind?h(t,o,r+1):null}(t,l,c,s):function(t,o,e,r){if(0===r)return null;const i=n(e,r-1);return i&&"inline"===i.kind?h(t,o,r-1):null}(t,l,c,s)}function R(n,t){if(n.rangeCount>0){const o=n.getRangeAt(0);if(!t||t.contains(o.startContainer)){const n=o.getClientRects();if(n.length>0)return n[0]??null;const t=o.getBoundingClientRect();if(t.height>0)return t}}if(t){const o=w(t,n);if(o)try{const n=document.createRange();n.setStart(o.anchorNode,o.anchorOffset),n.setEnd(o.focusNode,o.focusOffset);const t=n.getClientRects();return t.length>0?t[0]??null:n.getBoundingClientRect()}catch{}}return null}function j(n,t){const o=n.selection;if(!i(o))return null;const e="right"===t||"down"===t;return l(n,o.anchor.blockId,e)}function H(n){const t=n.selection;if(!i(t))return null;const o=r(t)?t.anchor.blockId:t.head.blockId;return 0===(r(t)?t.anchor.offset:t.head.offset)?null:h(n,o,0)}function N(n){const t=n.selection;if(!i(t))return null;const o=r(t)?t.anchor.blockId:t.head.blockId,l=n.getBlock(o);if(!l)return null;const c=e(l);return(r(t)?t.anchor.offset:t.head.offset)===c?null:h(n,o,c)}function O(n){const t=n.selection;return i(t)?{blockId:t.head.blockId,offset:t.head.offset}:null}function L(n,t,o){const e=n.getBlockOrder(),r=e.indexOf(t);if(r<0)return null;const i="forward"===o?r+1:r-1;return i<0||i>=e.length?null:e[i]??null}function z(l){const a=l.selection;if(!i(a))return null;if(!r(a))return h(l,a.head.blockId,a.head.offset);const u=a.anchor.blockId,f=l.getBlock(u);if(!f)return null;const d=a.anchor.offset;if(d<e(f)){if("inline"===n(f,d)?.kind)return h(l,u,d+1);const e=x(o(f),t(f,d))||1;return h(l,u,d+e)}const g=L(l,u,"forward");return g&&s(l,u,g)?c(l,g)?m(l,g):h(l,g,0):null}function D(l){const a=l.selection;if(!i(a))return null;if(!r(a))return h(l,a.head.blockId,a.head.offset);const u=a.anchor.blockId,f=l.getBlock(u);if(!f)return null;const d=a.anchor.offset;if(d>0){if("inline"===n(f,d-1)?.kind)return h(l,u,d-1);const e=y(o(f),t(f,d))||1;return h(l,u,d-e)}const g=L(l,u,"backward");if(!g)return null;if(!s(l,u,g))return null;if(c(l,g))return m(l,g);const k=l.getBlock(g);return k?h(l,g,e(k)):null}function P(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder()[0];return o?c(n,o)?m(n,o):h(n,o,0):null}function F(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder(),r=o[o.length-1];if(!r)return null;if(c(n,r))return m(n,r);const l=n.getBlock(r);return l?h(n,r,e(l)):null}function $(r){const l=O(r);if(!l)return null;const c=r.selection;if(!i(c))return null;const a=r.getBlock(l.blockId);if(!a)return null;const u=e(a);if(l.offset<u){const e="inline"===n(a,l.offset)?.kind?1:x(o(a),t(a,l.offset))||1;return g(r,c.anchor.blockId,c.anchor.offset,l.blockId,l.offset+e)}const f=L(r,l.blockId,"forward");return f&&s(r,l.blockId,f)?g(r,c.anchor.blockId,c.anchor.offset,f,0):null}function q(r){const l=O(r);if(!l)return null;const c=r.selection;if(!i(c))return null;if(l.offset>0){const e=r.getBlock(l.blockId);if(!e)return null;const i="inline"===n(e,l.offset-1)?.kind?1:y(o(e),t(e,l.offset))||1;return g(r,c.anchor.blockId,c.anchor.offset,l.blockId,l.offset-i)}const a=L(r,l.blockId,"backward");if(!a)return null;if(!s(r,l.blockId,a))return null;const u=r.getBlock(a);return u?g(r,c.anchor.blockId,c.anchor.offset,a,e(u)):null}function _(n){const t=O(n);if(!t)return null;const o=n.selection;return i(o)?0===t.offset?null:g(n,o.anchor.blockId,o.anchor.offset,t.blockId,0):null}function U(n){const t=O(n);if(!t)return null;const o=n.selection;if(!i(o))return null;const r=n.getBlock(t.blockId);if(!r)return null;const l=e(r);return t.offset===l?null:g(n,o.anchor.blockId,o.anchor.offset,t.blockId,l)}function Q(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder()[0];return o?t.head.blockId===o&&0===t.head.offset?null:g(n,t.anchor.blockId,t.anchor.offset,o,0):null}function K(n){const t=n.selection;if(!i(t))return null;const o=n.getBlockOrder(),r=o[o.length-1];if(!r)return null;const l=n.getBlock(r);if(!l)return null;const c=e(l);return t.head.blockId===r&&t.head.offset===c?null:g(n,t.anchor.blockId,t.anchor.offset,r,c)}function Y(n,t,o,e){return G(n,t,"move",o,e)}function Z(n,t,o,e){return G(n,t,"extend",o,e)}function G(t,o,r,l,a){const u=o.selection;if(!i(u))return null;const f="move"===r?J:W,d=I();if(!d?.modify)return f(o,l,a);const k=w(t,d);if(!k)return f(o,l,a);try{d.modify(r,l,a);const i=b(t);if(!i)return null;const f="move"===r?u.anchor.blockId:u.head.blockId,k="move"===r?i.anchor:i.head,w=k.blockId;if(w!==f&&!s(o,f,w))return null;let I=k.offset;const v=o.getBlock(w);return v&&"inline"===n(v,I)?.kind&&"forward"===l&&(I=Math.min(I+1,e(v))),"move"===r?c(o,w)?m(o,w):h(o,w,I):g(o,u.anchor.blockId,u.anchor.offset,w,I)}finally{try{d.setBaseAndExtent(k.anchorNode,k.anchorOffset,k.focusNode,k.focusOffset)}catch{}}}function J(n,t,o){return"word"===o?function(n,t){const o=n.selection;if(!i(o))return null;const c=r(o)?o.anchor.blockId:o.head.blockId,s=r(o)?o.anchor.offset:o.head.offset,a=n.getBlock(c);if(!a)return null;const u="forward"===t?C(a,s):B(a,s);return u===s?function(n,t,o){const r=l(n,t,"forward"===o);if(!r)return null;if(r.isVoid)return m(n,r.targetId);const i=n.getBlock(r.targetId);if(!i)return null;const c="forward"===o?0:e(i);return h(n,r.targetId,c)}(n,c,t):h(n,c,u)}(n,t):"lineboundary"===o?"forward"===t?N(n):H(n):E(n,"forward"===t?"down":"up")}function W(n,t,o){const r=n.selection;if(!i(r))return null;const c=r.head,s=n.getBlock(c.blockId);if(!s)return null;let a=c.offset;if("word"===o)a="forward"===t?C(s,c.offset):B(s,c.offset);else{if("lineboundary"!==o){const o=l(n,c.blockId,"forward"===t);if(!o)return null;if(o.isVoid)return null;const i=n.getBlock(o.targetId);if(!i)return null;const s="forward"===t?0:e(i);return g(n,r.anchor.blockId,r.anchor.offset,o.targetId,s)}a="forward"===t?e(s):0}return g(n,r.anchor.blockId,r.anchor.offset,c.blockId,a)}function X(n,t){return Y(n,t,"forward","word")}function nn(n,t){return Y(n,t,"backward","word")}function tn(n,t){return Y(n,t,"backward","lineboundary")}function on(n,t){return Y(n,t,"forward","lineboundary")}function en(n,t){return Y(n,t,"backward","line")}function rn(n,t){return Y(n,t,"forward","line")}function ln(n,t){return Z(n,t,"forward","word")}function cn(n,t){return Z(n,t,"backward","word")}function sn(n,t){return Z(n,t,"backward","lineboundary")}function an(n,t){return Z(n,t,"forward","lineboundary")}function un(n,t){return Z(n,t,"backward","line")}function fn(n,t){return Z(n,t,"forward","line")}var dn={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",codeBlock:"Code Block",blockquote:"Block Quote",listItem:"List Item",horizontalRule:"Horizontal Rule",image:"Image",table:"Table"},hn={paragraph:"paragraph",code_block:"codeBlock",blockquote:"blockquote",list_item:"listItem",horizontal_rule:"horizontalRule",image:"image",table:"table"},mn=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BRX5E_Pw.mjs"),"./locales/de.ts":()=>import("./de-B9zSHWqY.mjs"),"./locales/es.ts":()=>import("./es-CgMfhkJJ.mjs"),"./locales/fr.ts":()=>import("./fr-0qEo3bRP.mjs"),"./locales/hi.ts":()=>import("./hi-CoclKAUM.mjs"),"./locales/pt.ts":()=>import("./pt-CMx2wPPY.mjs"),"./locales/ru.ts":()=>import("./ru-QGX8lOTs.mjs"),"./locales/zh.ts":()=>import("./zh-YfuE_m2y.mjs")});async function gn(n){return a(mn,n,dn)}var kn={"word:forward":X,"word:backward":nn,"lineboundary:forward":on,"lineboundary:backward":tn,"line:forward":rn,"line:backward":en},wn={"word:forward":ln,"word:backward":cn,"lineboundary:forward":an,"lineboundary:backward":sn,"line:forward":fn,"line:backward":un},bn=class{id="caret-navigation";name="Caret Navigation";priority=4;context=null;lastAnnouncedBlockId=null;announceTimer=null;announce=null;locale=dn;async init(n){this.locale=await u(n,void 0,dn,gn),this.context=n,this.announce=t=>n.announce(t);const t=f(),o={"Shift-ArrowRight":()=>this.extendCharacterVisual("right"),"Shift-ArrowLeft":()=>this.extendCharacterVisual("left"),"Shift-ArrowUp":()=>this.viewExtendCommand("backward","line"),"Shift-ArrowDown":()=>this.viewExtendCommand("forward","line"),...t?{"Alt-ArrowRight":()=>this.viewMoveVisual("right","word"),"Alt-ArrowLeft":()=>this.viewMoveVisual("left","word"),"Shift-Alt-ArrowRight":()=>this.viewExtendVisual("right","word"),"Shift-Alt-ArrowLeft":()=>this.viewExtendVisual("left","word")}:{"Mod-ArrowRight":()=>this.viewMoveVisual("right","word"),"Mod-ArrowLeft":()=>this.viewMoveVisual("left","word"),"Mod-Shift-ArrowRight":()=>this.viewExtendVisual("right","word"),"Mod-Shift-ArrowLeft":()=>this.viewExtendVisual("left","word")},...t?{"Mod-ArrowLeft":()=>this.viewMoveVisual("left","lineboundary"),"Mod-ArrowRight":()=>this.viewMoveVisual("right","lineboundary"),"Mod-Shift-ArrowLeft":()=>this.viewExtendVisual("left","lineboundary"),"Mod-Shift-ArrowRight":()=>this.viewExtendVisual("right","lineboundary")}:{Home:()=>this.viewMoveCommand("backward","lineboundary"),End:()=>this.viewMoveCommand("forward","lineboundary"),"Shift-Home":()=>this.viewExtendCommand("backward","lineboundary"),"Shift-End":()=>this.viewExtendCommand("forward","lineboundary")},...t?{"Mod-ArrowUp":()=>this.modelCommand(P),"Mod-ArrowDown":()=>this.modelCommand(F),"Mod-Shift-ArrowUp":()=>this.modelCommand(Q),"Mod-Shift-ArrowDown":()=>this.modelCommand(K)}:{"Mod-Home":()=>this.modelCommand(P),"Mod-End":()=>this.modelCommand(F),"Mod-Shift-Home":()=>this.modelCommand(Q),"Mod-Shift-End":()=>this.modelCommand(K)}};n.registerKeymap(o,{priority:"navigation"})}onStateChange(n,t,o){const e=t.selection;if(!r(e)||!i(e))return null!==this.announceTimer&&(clearTimeout(this.announceTimer),this.announceTimer=null),void(this.lastAnnouncedBlockId=null);const l=e.anchor.blockId;l!==this.lastAnnouncedBlockId&&(null!==this.lastAnnouncedBlockId?(this.lastAnnouncedBlockId=l,null!==this.announceTimer&&clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>{if(this.announceTimer=null,this.context?.hasAnnouncement())return;const n=t.getBlock(l);if(!n)return;const o=function(n,t,o){if("heading"===t&&o?.level){const t=`heading${o.level}`;if(t in n)return n[t]}const e=hn[t];return e?n[e]:t}(this.locale,n.type,n.attrs);this.announce?.(o)},150)):this.lastAnnouncedBlockId=l)}destroy(){null!==this.announceTimer&&clearTimeout(this.announceTimer),this.announceTimer=null,this.announce=null,this.context=null}modelCommand(n){if(!this.context)return!1;const t=n(this.context.getState());return!!t&&(this.context.dispatch(t),!0)}extendCharacterVisual(n){if(!this.context)return!1;const t=this.context.getState(),o="forward"===this.resolveLogicalHorizontalDirection(t,n)?$(t):q(t);return!!o&&(this.context.dispatch(o),!0)}viewMoveCommand(n,t){return this.dispatchViewCommand(kn,n,t)}viewMoveVisual(n,t){if(!this.context)return!1;const o=this.resolveLogicalHorizontalDirection(this.context.getState(),n);return this.viewMoveCommand(o,t)}viewExtendCommand(n,t){return this.dispatchViewCommand(wn,n,t)}dispatchViewCommand(n,t,o){if(!this.context)return!1;const e=n[`${o}:${t}`];if(!e)return!1;const r=e(this.context.getContainer(),this.context.getState());return!!r&&(this.context.dispatch(r),!0)}viewExtendVisual(n,t){if(!this.context)return!1;const o=this.resolveLogicalHorizontalDirection(this.context.getState(),n);return this.viewExtendCommand(o,t)}resolveLogicalHorizontalDirection(n,t){const o=n.selection;if(!i(o))return"left"===t?"backward":"forward";const e=this.context?.getContainer();if(!e)return"left"===t?"backward":"forward";const r=e.querySelector(`[data-block-id="${o.head.blockId}"]`);return r instanceof HTMLElement&&"rtl"===d(r)?"left"===t?"forward":"backward":"left"===t?"backward":"forward"}};export{S as A,Q as C,P as D,F as E,A as F,B as I,C as L,E as M,V as N,N as O,T as P,x as R,K as S,z as T,Y as _,un as a,U as b,cn as c,en as d,on as f,Z as g,X as h,fn as i,R as j,H as k,ln as l,nn as m,dn as n,an as o,tn as p,gn as r,sn as s,bn as t,rn as u,q as v,D as w,_ as x,$ as y,y as z};
2
- //# sourceMappingURL=CaretNavigationPlugin-BxWjR7SN.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CaretNavigationPlugin-BxWjR7SN.mjs","names":[],"sources":["../../src/model/GraphemeUtils.ts","../../src/model/WordBoundary.ts","../../src/view/DomPointUtils.ts","../../src/view/CaretNavigation.ts","../../src/state/BlockBoundaryMovement.ts","../../src/commands/MovementCommands.ts","../../src/view/ViewMovementCommands.ts","../../src/plugins/caret-navigation/CaretNavigationLocale.ts","../../src/plugins/caret-navigation/CaretNavigationPlugin.ts"],"sourcesContent":["/**\n * Grapheme-cluster utilities for correct character navigation.\n *\n * Uses `Intl.Segmenter` (with `granularity: 'grapheme'`) to correctly\n * handle multi-code-unit characters such as emoji, ZWJ sequences, and\n * combining characters. Falls back to +1/-1 when `Intl.Segmenter` is\n * not available.\n */\n\nconst SEGMENTER_SUPPORTED: boolean = typeof Intl !== 'undefined' && 'Segmenter' in Intl;\nconst SEGMENTER: Intl.Segmenter | null = SEGMENTER_SUPPORTED\n\t? new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n\t: null;\n\n/**\n * Returns the number of UTF-16 code units to advance from `offset` to the next\n * grapheme-cluster boundary. Returns 0 if `offset` is at or past the end.\n *\n * Callers normally pass an offset that already sits on a cluster boundary, in\n * which case this is the full width of the cluster starting at `offset`. When\n * `offset` lands inside a cluster, the remaining units up to that cluster's end\n * are returned so navigation snaps forward to the next boundary (rather than\n * skipping the rest of the current cluster).\n */\nexport function nextGraphemeSize(text: string, offset: number): number {\n\tif (offset >= text.length || text.length === 0) return 0;\n\n\tif (SEGMENTER) {\n\t\tfor (const segment of SEGMENTER.segment(text)) {\n\t\t\tconst end: number = segment.index + segment.segment.length;\n\t\t\tif (end > offset) {\n\t\t\t\treturn end - offset;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\treturn 1;\n}\n\n/**\n * Returns the number of UTF-16 code units in the grapheme cluster\n * immediately before `offset`. Returns 0 if `offset` is 0 or the\n * string is empty.\n */\nexport function prevGraphemeSize(text: string, offset: number): number {\n\tif (offset <= 0 || text.length === 0) return 0;\n\n\tif (SEGMENTER) {\n\t\tlet lastSize = 1;\n\t\tfor (const segment of SEGMENTER.segment(text)) {\n\t\t\tif (segment.index + segment.segment.length >= offset) {\n\t\t\t\tlastSize = segment.segment.length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlastSize = segment.segment.length;\n\t\t}\n\t\treturn lastSize;\n\t}\n\n\treturn 1;\n}\n","/**\n * Word boundary detection for delete-word and word-movement commands.\n * InlineNodes act as word boundaries.\n */\n\nimport { type BlockNode, getBlockLength, getContentAtOffset } from './Document.js';\n\n/**\n * Finds the word boundary backward from the given offset.\n * InlineNodes act as word boundaries.\n */\nexport function findWordBoundaryBackward(block: BlockNode, offset: number): number {\n\tlet pos = offset - 1;\n\t// Skip trailing whitespace\n\twhile (pos >= 0) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (!/\\s/.test(content.char)) break;\n\t\tpos--;\n\t}\n\t// If at InlineNode, delete just it (treat as word boundary)\n\tif (pos >= 0) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (content?.kind === 'inline') return pos;\n\t}\n\t// Skip word characters until whitespace or InlineNode\n\twhile (pos >= 0) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (/\\s/.test(content.char)) break;\n\t\tpos--;\n\t}\n\treturn pos + 1;\n}\n\n/**\n * Finds the word boundary forward from the given offset.\n * InlineNodes act as word boundaries.\n */\nexport function findWordBoundaryForward(block: BlockNode, offset: number): number {\n\tconst len = getBlockLength(block);\n\tlet pos = offset;\n\t// Skip word characters first\n\twhile (pos < len) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (/\\s/.test(content.char)) break;\n\t\tpos++;\n\t}\n\t// If at InlineNode and haven't moved, delete just the InlineNode\n\tif (pos === offset && pos < len) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (content?.kind === 'inline') return pos + 1;\n\t}\n\t// Skip trailing whitespace\n\twhile (pos < len) {\n\t\tconst content = getContentAtOffset(block, pos);\n\t\tif (!content || content.kind === 'inline') break;\n\t\tif (!/\\s/.test(content.char)) break;\n\t\tpos++;\n\t}\n\treturn pos;\n}\n","/**\n * Utilities for resolving a DOM position from screen coordinates.\n *\n * Provides a fallback chain: `caretPositionFromPoint` → `caretRangeFromPoint`\n * → document fallback (when root is a ShadowRoot).\n */\n\n/** Result of resolving a DOM position from screen coordinates. */\nexport interface DomPoint {\n\treadonly node: Node;\n\treadonly offset: number;\n}\n\n/**\n * Tries `caretPositionFromPoint` (standard) then `caretRangeFromPoint`\n * (WebKit fallback) on a single target to resolve a DOM position.\n */\nfunction tryCaretFromPoint(target: Document | ShadowRoot, x: number, y: number): DomPoint | null {\n\tif ('caretPositionFromPoint' in target) {\n\t\tconst cp = (target as Document).caretPositionFromPoint(x, y);\n\t\tif (cp) {\n\t\t\treturn { node: cp.offsetNode, offset: cp.offset };\n\t\t}\n\t}\n\n\tif ('caretRangeFromPoint' in target) {\n\t\tconst range = (target as Document).caretRangeFromPoint(x, y);\n\t\tif (range) {\n\t\t\treturn { node: range.startContainer, offset: range.startOffset };\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * Resolves a DOM position from screen coordinates using the best available API.\n *\n * Tries the given root first, then falls back to the ownerDocument when the\n * root is a ShadowRoot and the first attempt returned nothing.\n */\nexport function domPositionFromPoint(\n\troot: Document | ShadowRoot,\n\tx: number,\n\ty: number,\n\townerDoc?: Document,\n): DomPoint | null {\n\treturn (\n\t\ttryCaretFromPoint(root, x, y) ??\n\t\t(ownerDoc && root !== ownerDoc ? tryCaretFromPoint(ownerDoc, x, y) : null)\n\t);\n}\n","/**\n * Caret navigation utilities for layout-aware cursor movement.\n *\n * Provides `endOfTextblock()` for detecting visual block boundaries,\n * `navigateAcrossBlocks()` for cross-block cursor transitions, and\n * `navigateVerticalWithGoalColumn()` for column-preserving vertical nav.\n */\n\nimport { type BlockNode, getBlockLength, getContentAtOffset } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { getTextDirection } from '../platform/Platform.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { type AdjacentBlock, resolveAdjacentBlock } from '../state/NavigationQueries.js';\nimport { moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { domPositionFromPoint } from './DomPointUtils.js';\nimport { findBlockAncestor } from './DomUtils.js';\nimport type { SelectionEndpoints } from './SelectionSync.js';\nimport { domPositionToState, getSelection, readDOMSelectionEndpoints } from './SelectionSync.js';\n\nexport { navigateFromGapCursor } from './GapCursorNavigation.js';\n\n/** Inset in pixels from block edge for vertical goal-column probing. */\nconst BLOCK_EDGE_INSET_PX = 2;\n\n/** Minimum vertical movement (pixels) for a Selection.modify probe to be considered a real move. */\nconst VERTICAL_MOVEMENT_THRESHOLD_PX = 1;\n\nexport type CaretDirection = 'left' | 'right' | 'up' | 'down';\n\n/**\n * Checks whether the cursor is at the visual edge of its text block.\n *\n * For horizontal directions (left/right), uses a pure offset check.\n * For vertical directions (up/down), tries `Selection.modify` probing\n * to detect visual line boundaries, falling back to offset heuristic.\n *\n * An optional `caretRect` parameter avoids redundant `getBoundingClientRect`\n * calls when the caller already measured the caret position.\n */\nexport function endOfTextblock(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: CaretDirection,\n\tcaretRect?: DOMRect | null,\n): boolean {\n\tconst sel = state.selection;\n\n\tif (!isTextSelection(sel)) return false;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tconst offset: number = sel.anchor.offset;\n\tconst blockLength: number = getBlockLength(block);\n\n\t// Horizontal: direction-aware offset check\n\tconst blockEl: Element | null = container.querySelector(\n\t\t`[data-block-id=\"${sel.anchor.blockId}\"]`,\n\t);\n\tconst isRtl: boolean = blockEl instanceof HTMLElement && getTextDirection(blockEl) === 'rtl';\n\n\tif (direction === 'left') return isRtl ? offset === blockLength : offset === 0;\n\tif (direction === 'right') return isRtl ? offset === 0 : offset === blockLength;\n\n\t// Vertical: quick offset check first\n\tif (direction === 'up' && offset === 0) return true;\n\tif (direction === 'down' && offset === blockLength) return true;\n\n\t// Vertical: try Selection.modify probing for multi-line blocks\n\tconst domSel: globalThis.Selection | null = getSelection();\n\tif (!domSel || !domSel.modify) {\n\t\t// Fallback: offset heuristic (no Selection.modify in test environments)\n\t\treturn direction === 'up' ? offset === 0 : offset === blockLength;\n\t}\n\n\treturn probeVerticalBoundary(container, domSel, direction, caretRect);\n}\n\n/**\n * Creates a transaction to move the cursor to an adjacent block.\n *\n * Returns `null` if navigation is not possible (document boundary,\n * isolating boundary, or no adjacent block).\n */\nexport function navigateAcrossBlocks(\n\tstate: EditorState,\n\tdirection: CaretDirection,\n): Transaction | null {\n\tconst target: AdjacentBlock | null = resolveNavigationTarget(state, direction);\n\tif (!target) return null;\n\n\tif (target.isVoid) return nodeSelTx(state, target.targetId);\n\n\t// Target is text → collapsed selection at start or end\n\tconst targetBlock = state.getBlock(target.targetId);\n\tif (!targetBlock) return null;\n\n\tconst targetOffset: number =\n\t\tdirection === 'right' || direction === 'down' ? 0 : getBlockLength(targetBlock);\n\n\treturn moveTx(state, target.targetId, targetOffset);\n}\n\n/**\n * Navigates vertically using a goal column for visual column preservation.\n *\n * Uses `caretPositionFromPoint` / `caretRangeFromPoint` to find the offset\n * in the target block that is closest to the given goalColumn X coordinate.\n * Falls back to start/end offset when goal column positioning is unavailable.\n */\nexport function navigateVerticalWithGoalColumn(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: 'up' | 'down',\n\tgoalColumn: number | null,\n): Transaction | null {\n\tconst target: AdjacentBlock | null = resolveNavigationTarget(state, direction);\n\tif (!target) return null;\n\n\t// Void → NodeSelection (goalColumn irrelevant)\n\tif (target.isVoid) return nodeSelTx(state, target.targetId);\n\n\tconst targetBlock = state.getBlock(target.targetId);\n\tif (!targetBlock) return null;\n\tconst blockLen: number = getBlockLength(targetBlock);\n\n\t// Try to resolve position using goalColumn\n\tif (goalColumn !== null) {\n\t\tconst position = resolveGoalColumnPosition(container, target.targetId, direction, goalColumn);\n\t\tif (position) return moveTx(state, position.blockId, position.offset);\n\t}\n\n\t// Offset-clamp fallback: preserve the absolute character offset, clamped to\n\t// the target block length. This handles cases where DOM-based goal column\n\t// resolution fails (e.g. Shadow DOM <li> elements) by keeping the cursor\n\t// at the same character column when possible.\n\tif (isTextSelection(state.selection) && isCollapsed(state.selection)) {\n\t\tconst sourceOffset: number = state.selection.anchor.offset;\n\t\tconst clampedOffset: number = Math.min(sourceOffset, blockLen);\n\t\treturn moveTx(state, target.targetId, clampedOffset);\n\t}\n\n\t// Final fallback: start (down) or end (up)\n\tconst fallbackOffset: number = direction === 'down' ? 0 : blockLen;\n\treturn moveTx(state, target.targetId, fallbackOffset);\n}\n\n/**\n * Skips over an InlineNode atomically when arrowing left/right.\n *\n * Returns a transaction moving the cursor past the InlineNode,\n * or `null` if the adjacent content is not an InlineNode (or\n * the direction is vertical).\n */\nexport function skipInlineNode(state: EditorState, direction: CaretDirection): Transaction | null {\n\tif (direction === 'up' || direction === 'down') return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\tif (!isCollapsed(sel)) return null;\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\n\treturn direction === 'right'\n\t\t? skipInlineNodeRight(state, blockId, block, offset)\n\t\t: skipInlineNodeLeft(state, blockId, block, offset);\n}\n\nfunction skipInlineNodeRight(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tblock: BlockNode,\n\toffset: number,\n): Transaction | null {\n\tconst content = getContentAtOffset(block, offset);\n\tif (!content || content.kind !== 'inline') return null;\n\treturn moveTx(state, blockId, offset + 1);\n}\n\nfunction skipInlineNodeLeft(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tblock: BlockNode,\n\toffset: number,\n): Transaction | null {\n\tif (offset === 0) return null;\n\tconst content = getContentAtOffset(block, offset - 1);\n\tif (!content || content.kind !== 'inline') return null;\n\treturn moveTx(state, blockId, offset - 1);\n}\n\n/**\n * Returns the bounding rect of the current caret position, or null.\n *\n * When `container` is provided, validates that `getRangeAt(0)` is inside\n * the container before using its rects. In Shadow DOM, `getRangeAt(0)` may\n * return a cross-boundary range whose rects reflect the shadow host position\n * rather than the actual caret position (e.g. inside `<li>` elements).\n * Falls back to composed selection endpoints via `readDOMSelectionEndpoints()`.\n */\nexport function getCaretRectFromSelection(\n\tdomSel: globalThis.Selection,\n\tcontainer?: HTMLElement,\n): DOMRect | null {\n\t// Standard path: use getRangeAt(0) directly, but only if the range\n\t// is inside the container (avoids cross-boundary rects in Shadow DOM)\n\tif (domSel.rangeCount > 0) {\n\t\tconst range: Range = domSel.getRangeAt(0);\n\t\tconst rangeInContainer: boolean = !container || container.contains(range.startContainer);\n\n\t\tif (rangeInContainer) {\n\t\t\tconst rects: DOMRectList = range.getClientRects();\n\t\t\tif (rects.length > 0) return rects[0] ?? null;\n\t\t\tconst rect: DOMRect = range.getBoundingClientRect();\n\t\t\tif (rect.height > 0) return rect;\n\t\t}\n\t}\n\n\t// Composed endpoint path: handles Shadow DOM cases where getRangeAt(0)\n\t// crosses the shadow boundary (e.g. <li> elements in wrapper <ul>/<ol>)\n\tif (container) {\n\t\tconst endpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\t\tif (endpoints) {\n\t\t\ttry {\n\t\t\t\tconst range: Range = document.createRange();\n\t\t\t\trange.setStart(endpoints.anchorNode, endpoints.anchorOffset);\n\t\t\t\trange.setEnd(endpoints.focusNode, endpoints.focusOffset);\n\t\t\t\tconst rects: DOMRectList = range.getClientRects();\n\t\t\t\tif (rects.length > 0) return rects[0] ?? null;\n\t\t\t\treturn range.getBoundingClientRect();\n\t\t\t} catch {\n\t\t\t\t// Unable to create range from endpoints\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Resolves the adjacent block in the given direction for cross-block navigation.\n * Performs boundary checks, isolating checks, and void detection.\n */\nfunction resolveNavigationTarget(\n\tstate: EditorState,\n\tdirection: CaretDirection,\n): AdjacentBlock | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\tconst forward: boolean = direction === 'right' || direction === 'down';\n\treturn resolveAdjacentBlock(state, sel.anchor.blockId, forward);\n}\n\n/**\n * Computes the Y coordinate for vertical goal-column probing.\n *\n * Uses the block element's computed padding to ensure the probe point\n * lands inside the text content area, not in the padding zone.\n * Firefox's `caretPositionFromPoint` returns the end-of-text position\n * when probing in the padding area below the content, which breaks\n * ArrowUp column preservation.\n */\nfunction computeProbeY(blockEl: Element, rect: DOMRect, direction: 'up' | 'down'): number {\n\tif (!(blockEl instanceof HTMLElement)) {\n\t\treturn direction === 'down'\n\t\t\t? rect.top + BLOCK_EDGE_INSET_PX\n\t\t\t: rect.bottom - BLOCK_EDGE_INSET_PX;\n\t}\n\n\tconst style: CSSStyleDeclaration = getComputedStyle(blockEl);\n\tconst paddingTop: number = Number.parseFloat(style.paddingTop) || 0;\n\tconst paddingBottom: number = Number.parseFloat(style.paddingBottom) || 0;\n\n\treturn direction === 'down'\n\t\t? rect.top + paddingTop + BLOCK_EDGE_INSET_PX\n\t\t: rect.bottom - paddingBottom - BLOCK_EDGE_INSET_PX;\n}\n\n/**\n * Resolves an editor position in the target block by using the goalColumn\n * X coordinate and `caretPositionFromPoint` / `caretRangeFromPoint`.\n *\n * Returns `null` when the point-to-caret API is unavailable, when the\n * resolved DOM node falls outside the target block, or when the resulting\n * position doesn't belong to the target block — triggering the fallback\n * (block-end for up, block-start for down) in `navigateVerticalWithGoalColumn`.\n */\nfunction resolveGoalColumnPosition(\n\tcontainer: HTMLElement,\n\ttargetId: BlockId,\n\tdirection: 'up' | 'down',\n\tgoalColumn: number,\n): { blockId: BlockId; offset: number } | null {\n\tconst blockEl: Element | null = container.querySelector(`[data-block-id=\"${targetId}\"]`);\n\tif (!blockEl) return null;\n\n\tconst rect: DOMRect = blockEl.getBoundingClientRect();\n\tconst y: number = computeProbeY(blockEl, rect, direction);\n\t// Clamp goalColumn within the block's horizontal bounds to avoid\n\t// caretPositionFromPoint returning unexpected results for out-of-bounds X.\n\tconst clampedX: number = Math.min(Math.max(goalColumn, rect.left), rect.right - 1);\n\n\tconst root: Document | ShadowRoot = container.getRootNode() as Document | ShadowRoot;\n\tconst domPoint = domPositionFromPoint(root, clampedX, y, container.ownerDocument);\n\tif (!domPoint) return null;\n\n\t// Verify the DOM node is inside the target block\n\tif (!blockEl.contains(domPoint.node)) return null;\n\n\tconst position = domPositionToState(container, domPoint.node, domPoint.offset);\n\tif (!position) return null;\n\n\t// Ensure the resolved position is in the target block\n\tif (position.blockId !== targetId) return null;\n\n\treturn position;\n}\n\n/**\n * Probes whether the cursor is at the top/bottom visual line of a block.\n *\n * Strategy:\n * 1. `Selection.modify('move', direction, 'line')` — moves one visual line.\n * 2. If the cursor left the block or didn't move, it's at the boundary.\n * 3. Cross-check with `getBoundingClientRect`: compare the caret rect before\n * and after the probe. If the vertical position didn't change, the probe\n * hit the block edge even though `Selection.modify` reported movement\n * (can happen with certain inline element layouts).\n *\n * Original DOM selection is always restored before returning.\n */\nfunction probeVerticalBoundary(\n\tcontainer: HTMLElement,\n\tdomSel: globalThis.Selection,\n\tdirection: 'up' | 'down',\n\tpreReadRect?: DOMRect | null,\n): boolean {\n\t// Save original DOM selection (using composed ranges for Shadow DOM)\n\tconst origEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\n\t// Cannot determine position → safe default: not at boundary (let browser handle)\n\tif (!origEndpoints) return false;\n\n\tconst origRect: DOMRect | null = preReadRect ?? getCaretRectFromSelection(domSel, container);\n\tconst dirStr: string = direction === 'up' ? 'backward' : 'forward';\n\n\ttry {\n\t\tdomSel.modify('move', dirStr, 'line');\n\n\t\t// Read post-modify endpoints via composed ranges\n\t\tconst postEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\t\tif (!postEndpoints) return false;\n\n\t\t// Check if the new position is still within the same block\n\t\tconst origBlock: HTMLElement | null = findBlockAncestor(container, origEndpoints.focusNode);\n\t\tconst newBlock: HTMLElement | null = findBlockAncestor(container, postEndpoints.focusNode);\n\n\t\t// Moved to a different block → definitely at boundary\n\t\tif (origBlock !== newBlock) return true;\n\n\t\t// Selection didn't move at all → at boundary\n\t\tconst didNotMove: boolean =\n\t\t\tpostEndpoints.anchorNode === origEndpoints.anchorNode &&\n\t\t\tpostEndpoints.anchorOffset === origEndpoints.anchorOffset &&\n\t\t\tpostEndpoints.focusNode === origEndpoints.focusNode &&\n\t\t\tpostEndpoints.focusOffset === origEndpoints.focusOffset;\n\t\tif (didNotMove) return true;\n\n\t\t// Cross-check with getBoundingClientRect: if vertical position unchanged,\n\t\t// the probe was a no-op visually (edge case with inline elements)\n\t\tif (origRect) {\n\t\t\tconst newRect: DOMRect | null = getCaretRectFromSelection(domSel, container);\n\t\t\tif (newRect) {\n\t\t\t\tconst verticalDelta: number = Math.abs(newRect.top - origRect.top);\n\t\t\t\tif (verticalDelta < VERTICAL_MOVEMENT_THRESHOLD_PX) return true;\n\t\t\t}\n\t\t}\n\n\t\t// Stayed in same block and moved vertically → not at boundary\n\t\treturn false;\n\t} finally {\n\t\t// Restore original selection\n\t\ttry {\n\t\t\tdomSel.setBaseAndExtent(\n\t\t\t\torigEndpoints.anchorNode,\n\t\t\t\torigEndpoints.anchorOffset,\n\t\t\t\torigEndpoints.focusNode,\n\t\t\t\torigEndpoints.focusOffset,\n\t\t\t);\n\t\t} catch {\n\t\t\t// Selection restore may fail if DOM changed\n\t\t}\n\t}\n}\n","/**\n * Block boundary movement: pure state-level functions for moving\n * the cursor to the start or end of the current block.\n *\n * These only depend on model/ and state/ types, so they belong\n * at the state layer rather than in commands/.\n */\n\nimport { getBlockLength } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from './EditorState.js';\nimport { moveTx } from './SelectionTransactions.js';\nimport type { Transaction } from './Transaction.js';\n\n/** Moves the cursor to the start of the current block. */\nexport function moveToBlockStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\n\tif (offset === 0) return null;\n\treturn moveTx(state, blockId, 0);\n}\n\n/** Moves the cursor to the end of the current block. */\nexport function moveToBlockEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\n\tif (offset === blockLen) return null;\n\treturn moveTx(state, blockId, blockLen);\n}\n","/**\n * Model-based movement commands for programmatic cursor navigation.\n *\n * All functions are pure: they take an EditorState and return a Transaction\n * or `null` (when the movement is not applicable). None touch the DOM.\n *\n * Move commands produce a collapsed cursor. Extend commands keep the anchor\n * and move the head, producing a range selection. All clear storedMarks.\n */\n\nimport {\n\tblockOffsetToTextOffset,\n\tgetBlockLength,\n\tgetBlockText,\n\tgetContentAtOffset,\n} from '../model/Document.js';\nimport { nextGraphemeSize, prevGraphemeSize } from '../model/GraphemeUtils.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { canCrossBlockBoundary, isVoidBlock } from '../state/NavigationQueries.js';\nimport { extendTx, moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\n\n// Re-export block boundary movement from state layer\nexport { moveToBlockEnd, moveToBlockStart } from '../state/BlockBoundaryMovement.js';\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Resolves the effective head position from any text selection. */\nfunction resolveHead(state: EditorState): { blockId: BlockId; offset: number } | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\treturn { blockId: sel.head.blockId, offset: sel.head.offset };\n}\n\n/** Returns the adjacent block ID in the given direction, or `null`. */\nfunction adjacentBlockId(\n\tstate: EditorState,\n\tcurrentBlockId: BlockId,\n\tdirection: 'forward' | 'backward',\n): BlockId | null {\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst idx: number = blockOrder.indexOf(currentBlockId);\n\tif (idx < 0) return null;\n\tconst targetIdx: number = direction === 'forward' ? idx + 1 : idx - 1;\n\tif (targetIdx < 0 || targetIdx >= blockOrder.length) return null;\n\treturn blockOrder[targetIdx] ?? null;\n}\n\n// ---------------------------------------------------------------------------\n// Character Movement\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor one character forward, skipping InlineNodes atomically. */\nexport function moveCharacterForward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\t// If range selection, collapse to head\n\tif (!isCollapsed(sel)) {\n\t\treturn moveTx(state, sel.head.blockId, sel.head.offset);\n\t}\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\tconst blockLen: number = getBlockLength(block);\n\n\tif (offset < blockLen) {\n\t\t// InlineNode: skip atomically (+1)\n\t\tconst content = getContentAtOffset(block, offset);\n\t\tif (content?.kind === 'inline') {\n\t\t\treturn moveTx(state, blockId, offset + 1);\n\t\t}\n\t\t// Text: advance by one grapheme cluster\n\t\tconst text: string = getBlockText(block);\n\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\tconst step: number = nextGraphemeSize(text, textOffset) || 1;\n\t\treturn moveTx(state, blockId, offset + step);\n\t}\n\n\t// At block end → cross-block\n\tconst nextId: BlockId | null = adjacentBlockId(state, blockId, 'forward');\n\tif (!nextId) return null;\n\tif (!canCrossBlockBoundary(state, blockId, nextId)) return null;\n\n\tif (isVoidBlock(state, nextId)) return nodeSelTx(state, nextId);\n\n\treturn moveTx(state, nextId, 0);\n}\n\n/** Moves the cursor one character backward, skipping InlineNodes atomically. */\nexport function moveCharacterBackward(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\t// If range selection, collapse to head\n\tif (!isCollapsed(sel)) {\n\t\treturn moveTx(state, sel.head.blockId, sel.head.offset);\n\t}\n\n\tconst blockId: BlockId = sel.anchor.blockId;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst offset: number = sel.anchor.offset;\n\n\tif (offset > 0) {\n\t\t// InlineNode: skip atomically (-1)\n\t\tconst content = getContentAtOffset(block, offset - 1);\n\t\tif (content?.kind === 'inline') {\n\t\t\treturn moveTx(state, blockId, offset - 1);\n\t\t}\n\t\t// Text: retreat by one grapheme cluster\n\t\tconst text: string = getBlockText(block);\n\t\tconst textOffset: number = blockOffsetToTextOffset(block, offset);\n\t\tconst step: number = prevGraphemeSize(text, textOffset) || 1;\n\t\treturn moveTx(state, blockId, offset - step);\n\t}\n\n\t// At block start → cross-block\n\tconst prevId: BlockId | null = adjacentBlockId(state, blockId, 'backward');\n\tif (!prevId) return null;\n\tif (!canCrossBlockBoundary(state, blockId, prevId)) return null;\n\n\tif (isVoidBlock(state, prevId)) return nodeSelTx(state, prevId);\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\treturn moveTx(state, prevId, getBlockLength(prevBlock));\n}\n\n// ---------------------------------------------------------------------------\n// Document Boundary Movement\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor to the beginning of the document. */\nexport function moveToDocumentStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst firstId: BlockId | undefined = blockOrder[0];\n\tif (!firstId) return null;\n\n\tif (isVoidBlock(state, firstId)) return nodeSelTx(state, firstId);\n\n\treturn moveTx(state, firstId, 0);\n}\n\n/** Moves the cursor to the end of the document. */\nexport function moveToDocumentEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst lastId: BlockId | undefined = blockOrder[blockOrder.length - 1];\n\tif (!lastId) return null;\n\n\tif (isVoidBlock(state, lastId)) return nodeSelTx(state, lastId);\n\n\tconst lastBlock = state.getBlock(lastId);\n\tif (!lastBlock) return null;\n\treturn moveTx(state, lastId, getBlockLength(lastBlock));\n}\n\n// ---------------------------------------------------------------------------\n// Extend (Selection Extension) Commands\n// ---------------------------------------------------------------------------\n\n/** Extends the selection one character forward. */\nexport function extendCharacterForward(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\n\tif (head.offset < blockLen) {\n\t\tconst content = getContentAtOffset(block, head.offset);\n\t\tconst step: number =\n\t\t\tcontent?.kind === 'inline'\n\t\t\t\t? 1\n\t\t\t\t: nextGraphemeSize(getBlockText(block), blockOffsetToTextOffset(block, head.offset)) || 1;\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, head.offset + step);\n\t}\n\n\t// Cross-block\n\tconst nextId: BlockId | null = adjacentBlockId(state, head.blockId, 'forward');\n\tif (!nextId) return null;\n\tif (!canCrossBlockBoundary(state, head.blockId, nextId)) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, nextId, 0);\n}\n\n/** Extends the selection one character backward. */\nexport function extendCharacterBackward(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tif (head.offset > 0) {\n\t\tconst block = state.getBlock(head.blockId);\n\t\tif (!block) return null;\n\t\tconst content = getContentAtOffset(block, head.offset - 1);\n\t\tconst step: number =\n\t\t\tcontent?.kind === 'inline'\n\t\t\t\t? 1\n\t\t\t\t: prevGraphemeSize(getBlockText(block), blockOffsetToTextOffset(block, head.offset)) || 1;\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, head.offset - step);\n\t}\n\n\t// Cross-block\n\tconst prevId: BlockId | null = adjacentBlockId(state, head.blockId, 'backward');\n\tif (!prevId) return null;\n\tif (!canCrossBlockBoundary(state, head.blockId, prevId)) return null;\n\n\tconst prevBlock = state.getBlock(prevId);\n\tif (!prevBlock) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, prevId, getBlockLength(prevBlock));\n}\n\n/** Extends the selection to the start of the current block. */\nexport function extendToBlockStart(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tif (head.offset === 0) return null;\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, 0);\n}\n\n/** Extends the selection to the end of the current block. */\nexport function extendToBlockEnd(state: EditorState): Transaction | null {\n\tconst head = resolveHead(state);\n\tif (!head) return null;\n\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tconst blockLen: number = getBlockLength(block);\n\tif (head.offset === blockLen) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, blockLen);\n}\n\n/** Extends the selection to the start of the document. */\nexport function extendToDocumentStart(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst firstId: BlockId | undefined = blockOrder[0];\n\tif (!firstId) return null;\n\n\t// No-op if head is already at document start\n\tif (sel.head.blockId === firstId && sel.head.offset === 0) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, firstId, 0);\n}\n\n/** Extends the selection to the end of the document. */\nexport function extendToDocumentEnd(state: EditorState): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockOrder: readonly BlockId[] = state.getBlockOrder();\n\tconst lastId: BlockId | undefined = blockOrder[blockOrder.length - 1];\n\tif (!lastId) return null;\n\n\tconst lastBlock = state.getBlock(lastId);\n\tif (!lastBlock) return null;\n\n\tconst lastBlockLen: number = getBlockLength(lastBlock);\n\n\t// No-op if head is already at document end\n\tif (sel.head.blockId === lastId && sel.head.offset === lastBlockLen) return null;\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, lastId, lastBlockLen);\n}\n","/**\n * View-based movement commands that use the browser's `Selection.modify()` API\n * for word, line-boundary, and line granularity movement.\n *\n * Falls back to model-based commands when `Selection.modify` is unavailable\n * (e.g. in happy-dom test environments).\n */\n\nimport { getBlockLength, getContentAtOffset } from '../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport { findWordBoundaryBackward, findWordBoundaryForward } from '../model/WordBoundary.js';\nimport { moveToBlockEnd, moveToBlockStart } from '../state/BlockBoundaryMovement.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport {\n\tcanCrossBlockBoundary,\n\tisVoidBlock,\n\tresolveAdjacentBlock,\n} from '../state/NavigationQueries.js';\nimport { extendTx, moveTx, nodeSelTx } from '../state/SelectionTransactions.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport { navigateAcrossBlocks } from './CaretNavigation.js';\nimport type { SelectionEndpoints } from './SelectionSync.js';\nimport { getSelection, readDOMSelectionEndpoints, readSelectionFromDOM } from './SelectionSync.js';\n\ntype Direction = 'forward' | 'backward';\ntype Granularity = 'word' | 'lineboundary' | 'line';\n\n// ---------------------------------------------------------------------------\n// Core view movement\n// ---------------------------------------------------------------------------\n\n/**\n * Moves the cursor using `Selection.modify('move', direction, granularity)`.\n * Falls back to model-based movement when the API is unavailable.\n */\nexport function viewMove(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\treturn viewModifySelection(container, state, 'move', direction, granularity);\n}\n\n/**\n * Extends the selection using `Selection.modify('extend', direction, granularity)`.\n * Falls back to model-based extension when the API is unavailable.\n */\nexport function viewExtend(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\treturn viewModifySelection(container, state, 'extend', direction, granularity);\n}\n\n/**\n * Shared implementation for viewMove and viewExtend.\n * Uses Selection.modify() with save/restore of DOM selection,\n * with fallback to model-based movement.\n */\nfunction viewModifySelection(\n\tcontainer: HTMLElement,\n\tstate: EditorState,\n\tmode: 'move' | 'extend',\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst fallback = mode === 'move' ? fallbackMove : fallbackExtend;\n\n\tconst domSel: globalThis.Selection | null = getSelection();\n\tif (!domSel?.modify) {\n\t\treturn fallback(state, direction, granularity);\n\t}\n\n\tconst origEndpoints: SelectionEndpoints | null = readDOMSelectionEndpoints(container, domSel);\n\tif (!origEndpoints) return fallback(state, direction, granularity);\n\n\ttry {\n\t\tdomSel.modify(mode, direction, granularity);\n\n\t\tconst newSel = readSelectionFromDOM(container);\n\t\tif (!newSel) return null;\n\n\t\t// For move: check anchor; for extend: check head\n\t\tconst oldBlockId: BlockId = mode === 'move' ? sel.anchor.blockId : sel.head.blockId;\n\t\tconst newPosition = mode === 'move' ? newSel.anchor : newSel.head;\n\t\tconst newBlockId: BlockId = newPosition.blockId;\n\n\t\tif (newBlockId !== oldBlockId && !canCrossBlockBoundary(state, oldBlockId, newBlockId)) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet newOffset: number = newPosition.offset;\n\n\t\t// InlineNode boundary correction\n\t\tconst block = state.getBlock(newBlockId);\n\t\tif (block) {\n\t\t\tconst content = getContentAtOffset(block, newOffset);\n\t\t\tif (content?.kind === 'inline' && direction === 'forward') {\n\t\t\t\tnewOffset = Math.min(newOffset + 1, getBlockLength(block));\n\t\t\t}\n\t\t}\n\n\t\tif (mode === 'move') {\n\t\t\tif (isVoidBlock(state, newBlockId)) return nodeSelTx(state, newBlockId);\n\t\t\treturn moveTx(state, newBlockId, newOffset);\n\t\t}\n\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, newBlockId, newOffset);\n\t} finally {\n\t\ttry {\n\t\t\tdomSel.setBaseAndExtent(\n\t\t\t\torigEndpoints.anchorNode,\n\t\t\t\torigEndpoints.anchorOffset,\n\t\t\t\torigEndpoints.focusNode,\n\t\t\t\torigEndpoints.focusOffset,\n\t\t\t);\n\t\t} catch {\n\t\t\t// Restore may fail if DOM changed\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Fallback (model-based) when Selection.modify is unavailable\n// ---------------------------------------------------------------------------\n\nfunction fallbackMove(\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tif (granularity === 'word') {\n\t\treturn fallbackWordMove(state, direction);\n\t}\n\tif (granularity === 'lineboundary') {\n\t\treturn direction === 'forward' ? moveToBlockEnd(state) : moveToBlockStart(state);\n\t}\n\t// granularity === 'line' → cross-block\n\tconst caretDir = direction === 'forward' ? 'down' : 'up';\n\treturn navigateAcrossBlocks(state, caretDir);\n}\n\nfunction fallbackExtend(\n\tstate: EditorState,\n\tdirection: Direction,\n\tgranularity: Granularity,\n): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst head = sel.head;\n\tconst block = state.getBlock(head.blockId);\n\tif (!block) return null;\n\n\tlet newOffset: number = head.offset;\n\n\tif (granularity === 'word') {\n\t\tnewOffset =\n\t\t\tdirection === 'forward'\n\t\t\t\t? findWordBoundaryForward(block, head.offset)\n\t\t\t\t: findWordBoundaryBackward(block, head.offset);\n\t} else if (granularity === 'lineboundary') {\n\t\tnewOffset = direction === 'forward' ? getBlockLength(block) : 0;\n\t} else {\n\t\t// line: extend to next block boundary\n\t\tconst adj = resolveAdjacentBlock(state, head.blockId, direction === 'forward');\n\t\tif (!adj) return null;\n\t\t// Cannot extend a text selection into a void block\n\t\tif (adj.isVoid) return null;\n\n\t\tconst targetBlock = state.getBlock(adj.targetId);\n\t\tif (!targetBlock) return null;\n\n\t\tconst targetOffset: number = direction === 'forward' ? 0 : getBlockLength(targetBlock);\n\t\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, adj.targetId, targetOffset);\n\t}\n\n\treturn extendTx(state, sel.anchor.blockId, sel.anchor.offset, head.blockId, newOffset);\n}\n\nfunction fallbackWordMove(state: EditorState, direction: Direction): Transaction | null {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return null;\n\n\tconst blockId: BlockId = isCollapsed(sel) ? sel.anchor.blockId : sel.head.blockId;\n\tconst offset: number = isCollapsed(sel) ? sel.anchor.offset : sel.head.offset;\n\tconst block = state.getBlock(blockId);\n\tif (!block) return null;\n\n\tconst newOffset: number =\n\t\tdirection === 'forward'\n\t\t\t? findWordBoundaryForward(block, offset)\n\t\t\t: findWordBoundaryBackward(block, offset);\n\n\tif (newOffset === offset) {\n\t\t// At block boundary — try crossing blocks\n\t\treturn fallbackCrossBlock(state, blockId, direction);\n\t}\n\n\treturn moveTx(state, blockId, newOffset);\n}\n\n/**\n * Crosses a block boundary from `blockId` in the given direction.\n * Checks `canCrossBlockBoundary` and handles void blocks (→ NodeSelection).\n */\nfunction fallbackCrossBlock(\n\tstate: EditorState,\n\tblockId: BlockId,\n\tdirection: Direction,\n): Transaction | null {\n\tconst adj = resolveAdjacentBlock(state, blockId, direction === 'forward');\n\tif (!adj) return null;\n\n\tif (adj.isVoid) return nodeSelTx(state, adj.targetId);\n\n\tconst targetBlock = state.getBlock(adj.targetId);\n\tif (!targetBlock) return null;\n\n\tconst targetOffset: number = direction === 'forward' ? 0 : getBlockLength(targetBlock);\n\treturn moveTx(state, adj.targetId, targetOffset);\n}\n\n// ---------------------------------------------------------------------------\n// Convenience wrappers\n// ---------------------------------------------------------------------------\n\n/** Moves the cursor one word forward. */\nexport function moveWordForward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'word');\n}\n\n/** Moves the cursor one word backward. */\nexport function moveWordBackward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'word');\n}\n\n/** Moves the cursor to the start of the line (visual). */\nexport function moveToLineStart(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'lineboundary');\n}\n\n/** Moves the cursor to the end of the line (visual). */\nexport function moveToLineEnd(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'lineboundary');\n}\n\n/** Moves the cursor one visual line up. */\nexport function moveLineUp(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'backward', 'line');\n}\n\n/** Moves the cursor one visual line down. */\nexport function moveLineDown(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewMove(container, state, 'forward', 'line');\n}\n\n/** Extends the selection one word forward. */\nexport function extendWordForward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'word');\n}\n\n/** Extends the selection one word backward. */\nexport function extendWordBackward(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'word');\n}\n\n/** Extends the selection to the start of the line. */\nexport function extendToLineStart(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'lineboundary');\n}\n\n/** Extends the selection to the end of the line. */\nexport function extendToLineEnd(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'lineboundary');\n}\n\n/** Extends the selection one visual line up. */\nexport function extendLineUp(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'backward', 'line');\n}\n\n/** Extends the selection one visual line down. */\nexport function extendLineDown(container: HTMLElement, state: EditorState): Transaction | null {\n\treturn viewExtend(container, state, 'forward', 'line');\n}\n","/** Locale interface and default English locale for the CaretNavigationPlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface CaretNavigationLocale {\n\treadonly paragraph: string;\n\treadonly heading1: string;\n\treadonly heading2: string;\n\treadonly heading3: string;\n\treadonly heading4: string;\n\treadonly heading5: string;\n\treadonly heading6: string;\n\treadonly codeBlock: string;\n\treadonly blockquote: string;\n\treadonly listItem: string;\n\treadonly horizontalRule: string;\n\treadonly image: string;\n\treadonly table: string;\n}\n\n// --- Default English Locale ---\n\nexport const CARET_NAVIGATION_LOCALE_EN: CaretNavigationLocale = {\n\tparagraph: 'Paragraph',\n\theading1: 'Heading 1',\n\theading2: 'Heading 2',\n\theading3: 'Heading 3',\n\theading4: 'Heading 4',\n\theading5: 'Heading 5',\n\theading6: 'Heading 6',\n\tcodeBlock: 'Code Block',\n\tblockquote: 'Block Quote',\n\tlistItem: 'List Item',\n\thorizontalRule: 'Horizontal Rule',\n\timage: 'Image',\n\ttable: 'Table',\n};\n\n// --- Block Type → Locale Key Mapping ---\n\nconst BLOCK_TYPE_KEY_MAP: Readonly<Record<string, keyof CaretNavigationLocale>> = {\n\tparagraph: 'paragraph',\n\tcode_block: 'codeBlock',\n\tblockquote: 'blockquote',\n\tlist_item: 'listItem',\n\thorizontal_rule: 'horizontalRule',\n\timage: 'image',\n\ttable: 'table',\n};\n\n/** Resolves a block type + attrs to a localized label string. */\nexport function resolveBlockLabel(\n\tlocale: CaretNavigationLocale,\n\ttypeName: string,\n\tattrs?: Record<string, unknown>,\n): string {\n\tif (typeName === 'heading' && attrs?.level) {\n\t\tconst key = `heading${attrs.level}` as keyof CaretNavigationLocale;\n\t\tif (key in locale) return locale[key];\n\t}\n\tconst key: keyof CaretNavigationLocale | undefined = BLOCK_TYPE_KEY_MAP[typeName];\n\treturn key ? locale[key] : typeName;\n}\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<CaretNavigationLocale> = import.meta.glob<{\n\tdefault: CaretNavigationLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadCaretNavigationLocale(lang: string): Promise<CaretNavigationLocale> {\n\treturn loadLocaleModule(localeModules, lang, CARET_NAVIGATION_LOCALE_EN);\n}\n","/**\n * CaretNavigationPlugin: registers platform-aware keymaps for all\n * programmatic movement commands (character, word, line, document).\n *\n * Movement priorities use 'navigation' to match GapCursorPlugin.\n * Also announces block-type changes to screen readers on cross-block navigation.\n */\n\nimport {\n\textendCharacterBackward,\n\textendCharacterForward,\n\textendToDocumentEnd,\n\textendToDocumentStart,\n\tmoveToDocumentEnd,\n\tmoveToDocumentStart,\n} from '../../commands/MovementCommands.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { getTextDirection, isMac } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport {\n\textendLineDown,\n\textendLineUp,\n\textendToLineEnd,\n\textendToLineStart,\n\textendWordBackward,\n\textendWordForward,\n\tmoveLineDown,\n\tmoveLineUp,\n\tmoveToLineEnd,\n\tmoveToLineStart,\n\tmoveWordBackward,\n\tmoveWordForward,\n} from '../../view/ViewMovementCommands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport {\n\tCARET_NAVIGATION_LOCALE_EN,\n\ttype CaretNavigationLocale,\n\tloadCaretNavigationLocale,\n\tresolveBlockLabel,\n} from './CaretNavigationLocale.js';\n\ntype ViewCommandFn = (container: HTMLElement, state: EditorState) => Transaction | null;\ntype ViewCommandKey = `${'word' | 'lineboundary' | 'line'}:${'forward' | 'backward'}`;\ntype ViewCommandLookup = Readonly<Record<ViewCommandKey, ViewCommandFn>>;\n\nconst VIEW_MOVE_FNS: ViewCommandLookup = {\n\t'word:forward': moveWordForward,\n\t'word:backward': moveWordBackward,\n\t'lineboundary:forward': moveToLineEnd,\n\t'lineboundary:backward': moveToLineStart,\n\t'line:forward': moveLineDown,\n\t'line:backward': moveLineUp,\n};\n\nconst VIEW_EXTEND_FNS: ViewCommandLookup = {\n\t'word:forward': extendWordForward,\n\t'word:backward': extendWordBackward,\n\t'lineboundary:forward': extendToLineEnd,\n\t'lineboundary:backward': extendToLineStart,\n\t'line:forward': extendLineDown,\n\t'line:backward': extendLineUp,\n};\n\n/** Debounce delay for block-type announcements (ms). */\nconst ANNOUNCE_DEBOUNCE_MS = 150;\n\nexport class CaretNavigationPlugin implements Plugin {\n\treadonly id = 'caret-navigation';\n\treadonly name = 'Caret Navigation';\n\treadonly priority = 4;\n\n\tprivate context: PluginContext | null = null;\n\tprivate lastAnnouncedBlockId: BlockId | null = null;\n\tprivate announceTimer: ReturnType<typeof setTimeout> | null = null;\n\tprivate announce: ((text: string) => void) | null = null;\n\tprivate locale: CaretNavigationLocale = CARET_NAVIGATION_LOCALE_EN;\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tundefined,\n\t\t\tCARET_NAVIGATION_LOCALE_EN,\n\t\t\tloadCaretNavigationLocale,\n\t\t);\n\n\t\tthis.context = context;\n\t\tthis.announce = (text: string) => context.announce(text);\n\t\tconst mac: boolean = isMac();\n\n\t\tconst keymap: Record<string, () => boolean> = {\n\t\t\t// --- Character movement (no modifier) ---\n\t\t\t// Handled natively by browser for basic cases, but Shift+Arrow\n\t\t\t// needs programmatic extend to correctly clear storedMarks.\n\n\t\t\t// --- Character extend ---\n\t\t\t'Shift-ArrowRight': () => this.extendCharacterVisual('right'),\n\t\t\t'Shift-ArrowLeft': () => this.extendCharacterVisual('left'),\n\n\t\t\t// --- Line extend ---\n\t\t\t'Shift-ArrowUp': () => this.viewExtendCommand('backward', 'line'),\n\t\t\t'Shift-ArrowDown': () => this.viewExtendCommand('forward', 'line'),\n\n\t\t\t// --- Word movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Alt-ArrowRight': () => this.viewMoveVisual('right', 'word'),\n\t\t\t\t\t\t'Alt-ArrowLeft': () => this.viewMoveVisual('left', 'word'),\n\t\t\t\t\t\t'Shift-Alt-ArrowRight': () => this.viewExtendVisual('right', 'word'),\n\t\t\t\t\t\t'Shift-Alt-ArrowLeft': () => this.viewExtendVisual('left', 'word'),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t'Mod-ArrowRight': () => this.viewMoveVisual('right', 'word'),\n\t\t\t\t\t\t'Mod-ArrowLeft': () => this.viewMoveVisual('left', 'word'),\n\t\t\t\t\t\t'Mod-Shift-ArrowRight': () => this.viewExtendVisual('right', 'word'),\n\t\t\t\t\t\t'Mod-Shift-ArrowLeft': () => this.viewExtendVisual('left', 'word'),\n\t\t\t\t\t}),\n\n\t\t\t// --- Line boundary movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Mod-ArrowLeft': () => this.viewMoveVisual('left', 'lineboundary'),\n\t\t\t\t\t\t'Mod-ArrowRight': () => this.viewMoveVisual('right', 'lineboundary'),\n\t\t\t\t\t\t'Mod-Shift-ArrowLeft': () => this.viewExtendVisual('left', 'lineboundary'),\n\t\t\t\t\t\t'Mod-Shift-ArrowRight': () => this.viewExtendVisual('right', 'lineboundary'),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tHome: () => this.viewMoveCommand('backward', 'lineboundary'),\n\t\t\t\t\t\tEnd: () => this.viewMoveCommand('forward', 'lineboundary'),\n\t\t\t\t\t\t'Shift-Home': () => this.viewExtendCommand('backward', 'lineboundary'),\n\t\t\t\t\t\t'Shift-End': () => this.viewExtendCommand('forward', 'lineboundary'),\n\t\t\t\t\t}),\n\n\t\t\t// --- Document boundary movement (platform-aware) ---\n\t\t\t...(mac\n\t\t\t\t? {\n\t\t\t\t\t\t'Mod-ArrowUp': () => this.modelCommand(moveToDocumentStart),\n\t\t\t\t\t\t'Mod-ArrowDown': () => this.modelCommand(moveToDocumentEnd),\n\t\t\t\t\t\t'Mod-Shift-ArrowUp': () => this.modelCommand(extendToDocumentStart),\n\t\t\t\t\t\t'Mod-Shift-ArrowDown': () => this.modelCommand(extendToDocumentEnd),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t'Mod-Home': () => this.modelCommand(moveToDocumentStart),\n\t\t\t\t\t\t'Mod-End': () => this.modelCommand(moveToDocumentEnd),\n\t\t\t\t\t\t'Mod-Shift-Home': () => this.modelCommand(extendToDocumentStart),\n\t\t\t\t\t\t'Mod-Shift-End': () => this.modelCommand(extendToDocumentEnd),\n\t\t\t\t\t}),\n\t\t};\n\n\t\tcontext.registerKeymap(keymap, { priority: 'navigation' });\n\t}\n\n\t/** Announces block-type on cross-block cursor movement (debounced). */\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tconst newSel = newState.selection;\n\n\t\t// Only announce for collapsed text selections\n\t\tif (!isCollapsed(newSel) || !isTextSelection(newSel)) {\n\t\t\tif (this.announceTimer !== null) {\n\t\t\t\tclearTimeout(this.announceTimer);\n\t\t\t\tthis.announceTimer = null;\n\t\t\t}\n\t\t\tthis.lastAnnouncedBlockId = null;\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlockId: BlockId = newSel.anchor.blockId;\n\t\tif (newBlockId === this.lastAnnouncedBlockId) return;\n\n\t\t// First observed block (initial focus) — remember but don't announce\n\t\tif (this.lastAnnouncedBlockId === null) {\n\t\t\tthis.lastAnnouncedBlockId = newBlockId;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lastAnnouncedBlockId = newBlockId;\n\n\t\t// Debounce rapid navigation\n\t\tif (this.announceTimer !== null) clearTimeout(this.announceTimer);\n\t\tthis.announceTimer = setTimeout(() => {\n\t\t\tthis.announceTimer = null;\n\t\t\t// Skip if another plugin already announced (e.g. CodeBlockPlugin's \"Left code block\")\n\t\t\tif (this.context?.hasAnnouncement()) return;\n\t\t\tconst block = newState.getBlock(newBlockId);\n\t\t\tif (!block) return;\n\t\t\tconst label: string = resolveBlockLabel(\n\t\t\t\tthis.locale,\n\t\t\t\tblock.type,\n\t\t\t\tblock.attrs as Record<string, unknown> | undefined,\n\t\t\t);\n\t\t\tthis.announce?.(label);\n\t\t}, ANNOUNCE_DEBOUNCE_MS);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.announceTimer !== null) clearTimeout(this.announceTimer);\n\t\tthis.announceTimer = null;\n\t\tthis.announce = null;\n\t\tthis.context = null;\n\t}\n\n\t/** Dispatches a model-based movement command (no DOM needed). */\n\tprivate modelCommand(fn: (state: EditorState) => Transaction | null): boolean {\n\t\tif (!this.context) return false;\n\t\tconst tr: Transaction | null = fn(this.context.getState());\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Extends selection by one character based on visual left/right intent. */\n\tprivate extendCharacterVisual(visual: 'left' | 'right'): boolean {\n\t\tif (!this.context) return false;\n\t\tconst state: EditorState = this.context.getState();\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(state, visual);\n\t\tconst tr: Transaction | null =\n\t\t\tdir === 'forward' ? extendCharacterForward(state) : extendCharacterBackward(state);\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Dispatches a view-based movement command (uses container + Selection.modify). */\n\tprivate viewMoveCommand(\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\treturn this.dispatchViewCommand(VIEW_MOVE_FNS, direction, granularity);\n\t}\n\n\t/** Dispatches a view-based move command with visual direction mapping for RTL. */\n\tprivate viewMoveVisual(visual: 'left' | 'right', granularity: 'word' | 'lineboundary'): boolean {\n\t\tif (!this.context) return false;\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(\n\t\t\tthis.context.getState(),\n\t\t\tvisual,\n\t\t);\n\t\treturn this.viewMoveCommand(dir, granularity);\n\t}\n\n\t/** Dispatches a view-based extend command. */\n\tprivate viewExtendCommand(\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\treturn this.dispatchViewCommand(VIEW_EXTEND_FNS, direction, granularity);\n\t}\n\n\tprivate dispatchViewCommand(\n\t\tlookup: ViewCommandLookup,\n\t\tdirection: 'forward' | 'backward',\n\t\tgranularity: 'word' | 'lineboundary' | 'line',\n\t): boolean {\n\t\tif (!this.context) return false;\n\t\tconst fn: ViewCommandFn | undefined = lookup[`${granularity}:${direction}`];\n\t\tif (!fn) return false;\n\t\tconst tr: Transaction | null = fn(this.context.getContainer(), this.context.getState());\n\t\tif (tr) {\n\t\t\tthis.context.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Dispatches a view-based extend command with visual direction mapping for RTL. */\n\tprivate viewExtendVisual(\n\t\tvisual: 'left' | 'right',\n\t\tgranularity: 'word' | 'lineboundary',\n\t): boolean {\n\t\tif (!this.context) return false;\n\t\tconst dir: 'forward' | 'backward' = this.resolveLogicalHorizontalDirection(\n\t\t\tthis.context.getState(),\n\t\t\tvisual,\n\t\t);\n\t\treturn this.viewExtendCommand(dir, granularity);\n\t}\n\n\t/**\n\t * Resolves logical movement direction from visual left/right intent.\n\t * In RTL blocks, visual directions are mirrored in offset space.\n\t */\n\tprivate resolveLogicalHorizontalDirection(\n\t\tstate: EditorState,\n\t\tvisual: 'left' | 'right',\n\t): 'forward' | 'backward' {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) {\n\t\t\treturn visual === 'left' ? 'backward' : 'forward';\n\t\t}\n\t\tconst container: HTMLElement | undefined = this.context?.getContainer();\n\t\tif (!container) return visual === 'left' ? 'backward' : 'forward';\n\t\tconst blockEl: Element | null = container.querySelector(\n\t\t\t`[data-block-id=\"${sel.head.blockId}\"]`,\n\t\t);\n\t\tconst isRtl: boolean = blockEl instanceof HTMLElement && getTextDirection(blockEl) === 'rtl';\n\t\tif (!isRtl) return visual === 'left' ? 'backward' : 'forward';\n\t\treturn visual === 'left' ? 'forward' : 'backward';\n\t}\n}\n"],"mappings":"4dAUA,IAAM,EAD+C,oBAAT,MAAwB,cAAe,KAEhF,IAAI,KAAK,eAAU,EAAW,CAAE,YAAa,aAC7C,KAYH,SAAgB,EAAiB,EAAc,GAC9C,GAAI,GAAU,EAAK,QAA0B,IAAhB,EAAK,OAAc,OAAO,EAEvD,GAAI,EAAW,CACd,IAAK,MAAM,KAAW,EAAU,QAAQ,GAAO,CAC9C,MAAM,EAAc,EAAQ,MAAQ,EAAQ,QAAQ,OACpD,GAAI,EAAM,EACT,OAAO,EAAM,CAEf,CACA,OAAO,CACR,CAEA,OAAO,CACR,CAOA,SAAgB,EAAiB,EAAc,GAC9C,GAAI,GAAU,GAAqB,IAAhB,EAAK,OAAc,OAAO,EAE7C,GAAI,EAAW,CACd,IAAI,EAAW,EACf,IAAK,MAAM,KAAW,EAAU,QAAQ,GAAO,CAC9C,GAAI,EAAQ,MAAQ,EAAQ,QAAQ,QAAU,EAAQ,CACrD,EAAW,EAAQ,QAAQ,OAC3B,KACD,CACA,EAAW,EAAQ,QAAQ,MAC5B,CACA,OAAO,CACR,CAEA,OAAO,CACR,CClDA,SAAgB,EAAyB,EAAkB,GAC1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