@notectl/core 2.4.0 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +1 -1
  3. package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -1
  4. package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -1
  5. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +1 -1
  6. package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -1
  7. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
  8. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
  9. package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
  10. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +1 -1
  11. package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -1
  12. package/dist/chunks/{CaretNavigationPlugin-BxWjR7SN.mjs → CaretNavigationPlugin-BQPqqK4n.mjs} +2 -2
  13. package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs.map +1 -0
  14. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +2 -0
  15. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs.map +1 -0
  16. package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
  17. package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -1
  18. package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -1
  19. package/dist/chunks/Commands-Bk7Cl1nH.mjs +2 -0
  20. package/dist/chunks/Commands-Bk7Cl1nH.mjs.map +1 -0
  21. package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
  22. package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
  23. package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -1
  24. package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -1
  25. package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -1
  26. package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
  27. package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -1
  28. package/dist/chunks/{DocumentParser-BKUrtgw1.mjs → DocumentParser-C99N0MWF.mjs} +2 -2
  29. package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +1 -0
  30. package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
  31. package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
  32. package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +1 -1
  33. package/dist/chunks/{FontSizePlugin-BQ9Aj8cT.mjs → FontSizePlugin-Dswra3oU.mjs} +2 -2
  34. package/dist/chunks/FontSizePlugin-Dswra3oU.mjs.map +1 -0
  35. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +2 -0
  36. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs.map +1 -0
  37. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +1 -1
  38. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +1 -1
  39. package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -1
  40. package/dist/chunks/{HardBreakPlugin-svNnJ9Xj.mjs → HardBreakPlugin-gjCq8prD.mjs} +2 -2
  41. package/dist/chunks/HardBreakPlugin-gjCq8prD.mjs.map +1 -0
  42. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +1 -1
  43. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +1 -1
  44. package/dist/chunks/{HorizontalRulePlugin-CQ5NT2Mo.mjs → HorizontalRulePlugin-YywXVZYr.mjs} +2 -2
  45. package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs.map +1 -0
  46. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +2 -0
  47. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs.map +1 -0
  48. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +1 -1
  49. package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -1
  50. package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
  51. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +2 -0
  52. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +1 -0
  53. package/dist/chunks/{ListPlugin-DTgpvBEt.mjs → ListPlugin-U1r4p_fE.mjs} +2 -2
  54. package/dist/chunks/ListPlugin-U1r4p_fE.mjs.map +1 -0
  55. package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -1
  56. package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
  57. package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +1 -1
  58. package/dist/chunks/{MarkdownParser-CvYOvU3d.mjs → MarkdownParser-uX1p_GQk.mjs} +2 -2
  59. package/dist/chunks/MarkdownParser-uX1p_GQk.mjs.map +1 -0
  60. package/dist/chunks/{MarkdownSerializer-CdUBWWGI.mjs → MarkdownSerializer--MrgJTdJ.mjs} +2 -2
  61. package/dist/chunks/MarkdownSerializer--MrgJTdJ.mjs.map +1 -0
  62. package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
  63. package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -1
  64. package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -1
  65. package/dist/chunks/{NodeSelectionCommands-B0Sb4ux4.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
  66. package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
  67. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
  68. package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
  69. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +1 -1
  70. package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
  71. package/dist/chunks/PopupManager-Dxv0OVMo.mjs +2 -0
  72. package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +1 -0
  73. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  74. package/dist/chunks/{PrintPlugin-BxNlFk2c.mjs → PrintPlugin-DAEiEyKQ.mjs} +2 -2
  75. package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs.map +1 -0
  76. package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -1
  77. package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -1
  78. package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +1 -1
  79. package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
  80. package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs +2 -0
  81. package/dist/chunks/SelectionReplacement-vC1xhFS0.mjs.map +1 -0
  82. package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +1 -1
  83. package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -1
  84. package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
  85. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +1 -1
  86. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +2 -0
  87. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs.map +1 -0
  88. package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
  89. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +1 -1
  90. package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -1
  91. package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
  92. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +1 -1
  93. package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
  94. package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +1 -1
  95. package/dist/chunks/{TablePlugin-WPwp902E.mjs → TablePlugin-CjKThPug.mjs} +2 -2
  96. package/dist/chunks/TablePlugin-CjKThPug.mjs.map +1 -0
  97. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +1 -1
  98. package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +1 -1
  99. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +1 -1
  100. package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +1 -1
  101. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +1 -1
  102. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
  103. package/dist/chunks/{ToolbarPlugin-DmVI7MN9.mjs → ToolbarPlugin-CgZA2hz8.mjs} +2 -2
  104. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +1 -0
  105. package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
  106. package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
  107. package/dist/chunks/{VideoPlugin-D3zGQ6QV.mjs → VideoPlugin-DJXfuNA9.mjs} +2 -2
  108. package/dist/chunks/VideoPlugin-DJXfuNA9.mjs.map +1 -0
  109. package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
  110. package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
  111. package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
  112. package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
  113. package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
  114. package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
  115. package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
  116. package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
  117. package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
  118. package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
  119. package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
  120. package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
  121. package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
  122. package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
  123. package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
  124. package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
  125. package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
  126. package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
  127. package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
  128. package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
  129. package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
  130. package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
  131. package/dist/chunks/ar-DhwCFHql.mjs +2 -0
  132. package/dist/chunks/ar-DhwCFHql.mjs.map +1 -0
  133. package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
  134. package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
  135. package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
  136. package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
  137. package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
  138. package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
  139. package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -1
  140. package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
  141. package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
  142. package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
  143. package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
  144. package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
  145. package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
  146. package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
  147. package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
  148. package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
  149. package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
  150. package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
  151. package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
  152. package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
  153. package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
  154. package/dist/chunks/de-CjLUbQmg.mjs +2 -0
  155. package/dist/chunks/de-CjLUbQmg.mjs.map +1 -0
  156. package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
  157. package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
  158. package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
  159. package/dist/chunks/de-DViI26lG.mjs.map +1 -1
  160. package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
  161. package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
  162. package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
  163. package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
  164. package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
  165. package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
  166. package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
  167. package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
  168. package/dist/chunks/es-B0Za939C.mjs.map +1 -1
  169. package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
  170. package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
  171. package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
  172. package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
  173. package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
  174. package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
  175. package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
  176. package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
  177. package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
  178. package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
  179. package/dist/chunks/es-CMSzvjOT.mjs +2 -0
  180. package/dist/chunks/es-CMSzvjOT.mjs.map +1 -0
  181. package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
  182. package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
  183. package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
  184. package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
  185. package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
  186. package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
  187. package/dist/chunks/es-DFokqQst.mjs.map +1 -1
  188. package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
  189. package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
  190. package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
  191. package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
  192. package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
  193. package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
  194. package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
  195. package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
  196. package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
  197. package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
  198. package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
  199. package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
  200. package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
  201. package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
  202. package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
  203. package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
  204. package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
  205. package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
  206. package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
  207. package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
  208. package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
  209. package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
  210. package/dist/chunks/fr-DB_OvHWH.mjs +2 -0
  211. package/dist/chunks/fr-DB_OvHWH.mjs.map +1 -0
  212. package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
  213. package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
  214. package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
  215. package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
  216. package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
  217. package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
  218. package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
  219. package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
  220. package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
  221. package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
  222. package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
  223. package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
  224. package/dist/chunks/full-BsWAZr1w.mjs +2 -0
  225. package/dist/chunks/full-BsWAZr1w.mjs.map +1 -0
  226. package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
  227. package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
  228. package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
  229. package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
  230. package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
  231. package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
  232. package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
  233. package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
  234. package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
  235. package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
  236. package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
  237. package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
  238. package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
  239. package/dist/chunks/hi-ChNQZZ1z.mjs +2 -0
  240. package/dist/chunks/hi-ChNQZZ1z.mjs.map +1 -0
  241. package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
  242. package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
  243. package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
  244. package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
  245. package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
  246. package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
  247. package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
  248. package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
  249. package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
  250. package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
  251. package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
  252. package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
  253. package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
  254. package/dist/chunks/minimal-DO7LiFTa.mjs.map +1 -1
  255. package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
  256. package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
  257. package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
  258. package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
  259. package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
  260. package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
  261. package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
  262. package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
  263. package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
  264. package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
  265. package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
  266. package/dist/chunks/pt-CI8t6oul.mjs +2 -0
  267. package/dist/chunks/pt-CI8t6oul.mjs.map +1 -0
  268. package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
  269. package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
  270. package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
  271. package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
  272. package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
  273. package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
  274. package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
  275. package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
  276. package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
  277. package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
  278. package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
  279. package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
  280. package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
  281. package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
  282. package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
  283. package/dist/chunks/register-DXLu8Njp.mjs +3 -0
  284. package/dist/chunks/register-DXLu8Njp.mjs.map +1 -0
  285. package/dist/chunks/ru-9WtNGZtl.mjs +2 -0
  286. package/dist/chunks/ru-9WtNGZtl.mjs.map +1 -0
  287. package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
  288. package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
  289. package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
  290. package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
  291. package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
  292. package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
  293. package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
  294. package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
  295. package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
  296. package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
  297. package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
  298. package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
  299. package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
  300. package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
  301. package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
  302. package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
  303. package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
  304. package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
  305. package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
  306. package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
  307. package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
  308. package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
  309. package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
  310. package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
  311. package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
  312. package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
  313. package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -1
  314. package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
  315. package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
  316. package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
  317. package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
  318. package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
  319. package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
  320. package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
  321. package/dist/chunks/zh-BrqJ4ywP.mjs +2 -0
  322. package/dist/chunks/zh-BrqJ4ywP.mjs.map +1 -0
  323. package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
  324. package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
  325. package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
  326. package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
  327. package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
  328. package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
  329. package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
  330. package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
  331. package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
  332. package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
  333. package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
  334. package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
  335. package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
  336. package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
  337. package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
  338. package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
  339. package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
  340. package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
  341. package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
  342. package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
  343. package/dist/commands/BlockInsertion.d.ts +15 -19
  344. package/dist/commands/BlockInsertion.d.ts.map +1 -1
  345. package/dist/commands/PasteCommand.d.ts.map +1 -1
  346. package/dist/commands/SelectionDeletion.d.ts +7 -5
  347. package/dist/commands/SelectionDeletion.d.ts.map +1 -1
  348. package/dist/commands/SelectionReplacement.d.ts +42 -0
  349. package/dist/commands/SelectionReplacement.d.ts.map +1 -0
  350. package/dist/editor/BlockIdentity.d.ts +16 -0
  351. package/dist/editor/BlockIdentity.d.ts.map +1 -0
  352. package/dist/editor/ContentSerializer.d.ts +13 -11
  353. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  354. package/dist/editor/NotectlEditor.d.ts +6 -5
  355. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  356. package/dist/editor/styles/link.d.ts +3 -0
  357. package/dist/editor/styles/link.d.ts.map +1 -0
  358. package/dist/fonts/math.mjs +1 -1
  359. package/dist/full.mjs +1 -1
  360. package/dist/html.mjs +1 -1
  361. package/dist/index.d.ts +1 -1
  362. package/dist/index.d.ts.map +1 -1
  363. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  364. package/dist/input/PasteHandler.d.ts.map +1 -1
  365. package/dist/input/PasteRichBlockHandler.d.ts +10 -17
  366. package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
  367. package/dist/markdown.mjs +1 -1
  368. package/dist/model/ContentModel.d.ts +6 -1
  369. package/dist/model/ContentModel.d.ts.map +1 -1
  370. package/dist/model/FileHandlerDispatcher.d.ts +3 -1
  371. package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
  372. package/dist/model/FileHandlerRegistry.d.ts +11 -2
  373. package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
  374. package/dist/notectl-core.mjs +1 -1
  375. package/dist/notectl-core.umd.js +1 -1
  376. package/dist/notectl-core.umd.js.map +1 -1
  377. package/dist/plugins/caret-navigation.mjs +1 -1
  378. package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
  379. package/dist/plugins/code-block.mjs +1 -1
  380. package/dist/plugins/font-size.mjs +1 -1
  381. package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
  382. package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
  383. package/dist/plugins/formula.mjs +1 -1
  384. package/dist/plugins/hard-break.mjs +1 -1
  385. package/dist/plugins/horizontal-rule.mjs +1 -1
  386. package/dist/plugins/image/ImageCommands.d.ts +15 -3
  387. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  388. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  389. package/dist/plugins/image.mjs +1 -1
  390. package/dist/plugins/link/LinkInteractionController.d.ts +26 -0
  391. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
  392. package/dist/plugins/link/LinkLocale.d.ts +7 -1
  393. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  394. package/dist/plugins/link/LinkNavigation.d.ts +12 -0
  395. package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
  396. package/dist/plugins/link/LinkPlugin.d.ts +4 -4
  397. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  398. package/dist/plugins/link/LinkPreview.d.ts +28 -0
  399. package/dist/plugins/link/LinkPreview.d.ts.map +1 -0
  400. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  401. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  402. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  403. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  404. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  405. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  406. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  407. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  408. package/dist/plugins/link.mjs +1 -1
  409. package/dist/plugins/list.mjs +1 -1
  410. package/dist/plugins/print.mjs +1 -1
  411. package/dist/plugins/shared/PopupManager.d.ts +5 -0
  412. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  413. package/dist/plugins/shared.mjs +1 -1
  414. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
  415. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
  416. package/dist/plugins/smart-paste.mjs +1 -1
  417. package/dist/plugins/table.mjs +1 -1
  418. package/dist/plugins/text-direction.mjs +1 -1
  419. package/dist/plugins/toolbar.mjs +1 -1
  420. package/dist/plugins/video.mjs +1 -1
  421. package/dist/presets/full.mjs +1 -1
  422. package/dist/presets.mjs +1 -1
  423. package/dist/register.mjs +1 -1
  424. package/dist/state/History.d.ts.map +1 -1
  425. package/dist/state/StepApplication.d.ts.map +1 -1
  426. package/dist/state/Steps.d.ts +3 -0
  427. package/dist/state/Steps.d.ts.map +1 -1
  428. package/dist/state/StructuralPositions.d.ts +15 -0
  429. package/dist/state/StructuralPositions.d.ts.map +1 -0
  430. package/dist/state/TransactionBuilder.d.ts +6 -14
  431. package/dist/state/TransactionBuilder.d.ts.map +1 -1
  432. package/dist/test/TestUtils.d.ts.map +1 -1
  433. package/dist/view/EditorViewEvents.d.ts.map +1 -1
  434. package/package.json +8 -8
  435. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs +0 -2
  436. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs.map +0 -1
  437. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs.map +0 -1
  438. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +0 -2
  439. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs.map +0 -1
  440. package/dist/chunks/Commands-DBBCAYBn.mjs +0 -2
  441. package/dist/chunks/Commands-DBBCAYBn.mjs.map +0 -1
  442. package/dist/chunks/ContentModel-BLC3Tez8.mjs +0 -2
  443. package/dist/chunks/ContentModel-BLC3Tez8.mjs.map +0 -1
  444. package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +0 -1
  445. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +0 -1
  446. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +0 -2
  447. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +0 -1
  448. package/dist/chunks/HardBreakPlugin-svNnJ9Xj.mjs.map +0 -1
  449. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs.map +0 -1
  450. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +0 -2
  451. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +0 -1
  452. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs +0 -2
  453. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs.map +0 -1
  454. package/dist/chunks/ListPlugin-DTgpvBEt.mjs.map +0 -1
  455. package/dist/chunks/MarkdownParser-CvYOvU3d.mjs.map +0 -1
  456. package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +0 -1
  457. package/dist/chunks/NodeSelectionCommands-B0Sb4ux4.mjs.map +0 -1
  458. package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
  459. package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
  460. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs.map +0 -1
  461. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs +0 -2
  462. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs.map +0 -1
  463. package/dist/chunks/TablePlugin-WPwp902E.mjs.map +0 -1
  464. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +0 -1
  465. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +0 -1
  466. package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
  467. package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
  468. package/dist/chunks/de-JhGflzS5.mjs +0 -2
  469. package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
  470. package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
  471. package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
  472. package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
  473. package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
  474. package/dist/chunks/full-BiQ93ERr.mjs +0 -2
  475. package/dist/chunks/full-BiQ93ERr.mjs.map +0 -1
  476. package/dist/chunks/hi-Bu799xIO.mjs +0 -2
  477. package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
  478. package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
  479. package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
  480. package/dist/chunks/register-Cb1YTAN4.mjs +0 -3
  481. package/dist/chunks/register-Cb1YTAN4.mjs.map +0 -1
  482. package/dist/chunks/ru-BxySx7an.mjs +0 -2
  483. package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
  484. package/dist/chunks/zh-DuucmOns.mjs +0 -2
  485. package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"HardBreakPlugin-svNnJ9Xj.mjs","names":[],"sources":["../../src/plugins/hard-break/HardBreakPlugin.ts"],"sourcesContent":["/**\n * HardBreakPlugin: registers a hard line break (Shift+Enter → `<br>`)\n * as an InlineNode, with command and keymap bindings.\n */\n\nimport { insertHardBreakCommand } from '../../commands/Commands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface InlineNodeAttrRegistry {\n\t\thard_break: Record<string, never>;\n\t}\n}\n\n// --- Plugin ---\n\nexport class HardBreakPlugin implements Plugin {\n\treadonly id = 'hard-break';\n\treadonly name = 'Hard Break';\n\treadonly priority = 10;\n\n\tinit(context: PluginContext): void {\n\t\tthis.registerInlineNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t}\n\n\tprivate registerInlineNodeSpec(context: PluginContext): void {\n\t\tcontext.registerInlineNodeSpec({\n\t\t\ttype: 'hard_break',\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement('br');\n\t\t\t},\n\t\t\ttoHTMLString() {\n\t\t\t\treturn '<br>';\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'br' }],\n\t\t\tsanitize: { tags: ['br'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('insertHardBreak', () => {\n\t\t\tconst state = context.getState();\n\t\t\tconst tr = insertHardBreakCommand(state);\n\t\t\tif (!tr) return false;\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Shift-Enter': () => {\n\t\t\t\tconst state = context.getState();\n\t\t\t\tconst tr = insertHardBreakCommand(state);\n\t\t\t\tif (!tr) return false;\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":"4CAkBA,IAAa,EAAb,MACC,GAAc,aACd,KAAgB,aAChB,SAAoB,GAEpB,IAAA,CAAK,GACJ,KAAK,uBAAuB,GAC5B,KAAK,iBAAiB,GACtB,KAAK,eAAe,EACrB,CAEA,sBAAA,CAA+B,GAC9B,EAAQ,uBAAuB,CAC9B,KAAM,aACN,MAAA,IACQ,SAAS,cAAc,MAE/B,aAAA,IACQ,OAER,UAAW,CAAC,CAAE,IAAK,OACnB,SAAU,CAAE,KAAM,CAAC,QAErB,CAEA,gBAAA,CAAyB,GACxB,EAAQ,gBAAgB,kBAAA,KACvB,MAAM,EAAQ,EAAQ,WAChB,EAAK,EAAuB,GAClC,QAAK,IACL,EAAQ,SAAS,IACV,IAET,CAEA,cAAA,CAAuB,GACtB,EAAQ,eAAe,CACtB,cAAA,KACC,MAAM,EAAQ,EAAQ,WAChB,EAAK,EAAuB,GAClC,QAAK,IACL,EAAQ,SAAS,IACV,KAGV"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HorizontalRulePlugin-CQ5NT2Mo.mjs","names":[],"sources":["../../src/plugins/horizontal-rule/HorizontalRuleLocale.ts","../../src/plugins/horizontal-rule/HorizontalRulePlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the HorizontalRulePlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface HorizontalRuleLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_EN: HorizontalRuleLocale = {\n\tlabel: 'Horizontal Rule',\n\ttooltip: (shortcut: string) => `Horizontal Rule (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<HorizontalRuleLocale> = import.meta.glob<{\n\tdefault: HorizontalRuleLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadHorizontalRuleLocale(lang: string): Promise<HorizontalRuleLocale> {\n\treturn loadLocaleModule(localeModules, lang, HORIZONTAL_RULE_LOCALE_EN);\n}\n","/**\n * HorizontalRulePlugin: registers a horizontal rule (divider) void block type\n * with NodeSpec, insert command, input rule, keyboard shortcut, and toolbar button.\n */\n\nimport { insertBlockObjectOnOwnLine } from '../../commands/BlockInsertion.js';\nimport { createBlockNode } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { getSelectedBlockId, resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport {\n\tHORIZONTAL_RULE_LOCALE_EN,\n\ttype HorizontalRuleLocale,\n\tloadHorizontalRuleLocale,\n} from './HorizontalRuleLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\thorizontal_rule: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface HorizontalRuleConfig {\n\t/** Live Markdown shortcut: `--- ` to insert a horizontal rule. Default true. */\n\treadonly inputRule?: boolean;\n\t/** Locale override for user-facing strings. */\n\treadonly locale?: HorizontalRuleLocale;\n}\n\nconst DEFAULT_CONFIG: HorizontalRuleConfig = {};\n\n// --- Helpers ---\n\n/** Finds the index of the cursor's block among top-level document children. */\nfunction findBlockIndexForCursor(state: EditorState): number {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return -1;\n\treturn state.doc.children.findIndex((b) => b.id === sel.anchor.blockId);\n}\n\n// --- Plugin ---\n\nexport class HorizontalRulePlugin implements Plugin {\n\treadonly id = 'horizontal-rule';\n\treadonly name = 'Horizontal Rule';\n\treadonly priority = 40;\n\n\tprivate readonly config: HorizontalRuleConfig;\n\tprivate locale!: HorizontalRuleLocale;\n\n\tconstructor(config?: Partial<HorizontalRuleConfig>) {\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\tHORIZONTAL_RULE_LOCALE_EN,\n\t\t\tloadHorizontalRuleLocale,\n\t\t);\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: 'horizontal_rule',\n\t\t\tgroup: 'block',\n\t\t\tisVoid: true,\n\t\t\ttoDOM(node) {\n\t\t\t\treturn createBlockElement('hr', node.id);\n\t\t\t},\n\t\t\ttoHTML() {\n\t\t\t\treturn '<hr>';\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'hr' }],\n\t\t\tsanitize: { tags: ['hr'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('insertHorizontalRule', () => {\n\t\t\treturn this.insertHorizontalRule(context);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-H': () => context.executeCommand('insertHorizontalRule'),\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: /^-{3,} $/,\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 blockIndex: number = findBlockIndexForCursor(state);\n\t\t\t\tif (blockIndex === -1) return null;\n\n\t\t\t\tconst newParagraph = createBlockNode(nodeType('paragraph'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, 0, end)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('horizontal_rule'))\n\t\t\t\t\t.insertNode([], blockIndex + 1, newParagraph)\n\t\t\t\t\t.setSelection(createCollapsedSelection(newParagraph.id, 0))\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=\"M4 11h16v2H4z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'horizontal-rule',\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-H')),\n\t\t\tcommand: 'insertHorizontalRule',\n\t\t\tisActive: () => false,\n\t\t});\n\t}\n\n\t/**\n\t * Inserts a horizontal rule after the current block,\n\t * followed by a new paragraph for continued editing.\n\t */\n\tprivate insertHorizontalRule(context: PluginContext): boolean {\n\t\tconst state: EditorState = context.getState();\n\t\tconst anchorBlockId = getSelectedBlockId(state);\n\t\tif (!anchorBlockId) return false;\n\n\t\tconst builder = state.transaction('command');\n\t\tconst trailing = insertBlockObjectOnOwnLine(\n\t\t\tstate,\n\t\t\tbuilder,\n\t\t\tanchorBlockId,\n\t\t\tcreateBlockNode(nodeType('horizontal_rule')),\n\t\t);\n\t\tif (!trailing) return false;\n\n\t\tbuilder.setSelection(createCollapsedSelection(trailing.id, 0));\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n}\n"],"mappings":"wWAaA,IAAa,EAAkD,CAC9D,MAAO,kBACP,QAAU,GAAqB,oBAAoB,MAK9C,iBAAuD,OAAA,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBA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,UAAW,GAAM,EAAE,KAAO,EAAI,OAAO,UAD7B,CAEnC,CAqE+B,CAAwB,GACnD,IAAmB,IAAf,EAAmB,OAAO,KAE9B,MAAM,EAAe,EAAgB,EAAS,cAE9C,OAAO,EACL,YAAY,SACZ,aAAa,EAAI,OAAO,QAAS,EAAG,GACpC,aAAa,EAAI,OAAO,QAAS,EAAS,oBAC1C,WAAW,GAAI,EAAa,EAAG,GAC/B,aAAa,EAAyB,EAAa,GAAI,IACvD,OACH,GAEF,CAEA,mBAAA,CAA4B,GAI3B,EAAQ,oBAAoB,CAC3B,GAAI,kBACJ,MAAO,QACP,KAAA,8FACA,MAAO,KAAK,OAAO,MACnB,QAAS,KAAK,OAAO,QAAQ,EAAe,gBAC5C,QAAS,uBACT,SAAA,KAAgB,GAElB,CAMA,oBAAA,CAA6B,GAC5B,MAAM,EAAqB,EAAQ,WAC7B,EAAgB,EAAmB,GACzC,IAAK,EAAe,OAAO,EAE3B,MAAM,EAAU,EAAM,YAAY,WAC5B,EAAW,EAChB,EACA,EACA,EACA,EAAgB,EAAS,qBAE1B,QAAK,IAEL,EAAQ,aAAa,EAAyB,EAAS,GAAI,IAC3D,EAAQ,SAAS,EAAQ,UAClB,EACR"}
@@ -1,2 +0,0 @@
1
- import{i as e}from"./HTMLUtils-DTpsjZyK.mjs";import{D as t,R as i,p as n}from"./Document-ssR6hBzG.mjs";import{d as r,i as o,u as a}from"./Selection-DC6AOGgF.mjs";import{a as s}from"./TypeBrands-Ch9856Gb.mjs";import{s as l}from"./BlockInsertion-CxKdCKJd.mjs";import{t as c}from"./NodeSelectionCommands-B0Sb4ux4.mjs";import{n as d}from"./TypedKeys-CA4bfw9O.mjs";import{c as g,o as m}from"./PluginHelpers-B3gk3VB3.mjs";import{c as p,n as u,s as h}from"./StyleRuntime-C0RSqKzG.mjs";import{t as f}from"./Platform-ByobkiCc.mjs";import{n as b}from"./DomUtils-Bf7JLFlx.mjs";import{t as v}from"./ShortcutFormatting-TwiufqeV.mjs";function x(e,c){const d=e.getState(),g=d.selection,m={src:c.src,alt:c.alt??"",align:c.align??"center",...void 0!==c.width?{width:c.width}:{},...void 0!==c.height?{height:c.height}:{}};if(a(g))return!1;const p=r(g)?g.nodeId:g.anchor.blockId,u=function(e,t){if("table_cell"===e.getBlock(t)?.type)return t;const i=e.getNodePath(t);if(i)for(const n of i)if("table_cell"===e.getBlock(n)?.type)return n}(d,p);return u?function(e,r,a,l){const c=e.getNodePath(a);if(!c)return!1;const d=n(s("image"),[],void 0,l),g=e.getBlock(a);if(!g)return!1;const m=e.transaction("command"),p=t(g);for(let t=p.length-1;t>=0;t--){const e=g.children.findIndex(e=>i(e)&&e.id===p[t]?.id);-1!==e&&m.removeNode(c,e)}return m.insertNode(c,0,d),m.setSelection(o(d.id,[...c,d.id])),r.dispatch(m.build()),!0}(d,e,u,m):function(e,t,i,r){const a=n(s("image"),[],void 0,r),c=e.transaction("command");return!!l(e,c,i,a)&&(c.setSelection(o(a.id,[])),t.dispatch(c.build()),!0)}(d,e,p,m)}function _(e,t,i){const n=e.getState(),o=n.selection;if(!r(o))return!1;const a=n.getBlock(o.nodeId);if(!a||"image"!==a.type)return!1;const s=a.attrs?.width,l=a.attrs?.height;if(void 0===s||void 0===l)return!1;const c=l>0?s/l:1,d=Math.max(50,Math.min(i,s+t)),g=Math.round(d/c);return(d!==s||g!==l)&&function(e,t){const i=e.getState(),n=i.selection;if(!r(n))return!1;const o=i.getBlock(n.nodeId);if(!o||"image"!==o.type)return!1;const a=i.getNodePath(n.nodeId);if(!a)return!1;const s={...o.attrs??{},...t},l=i.transaction("command").setNodeAttr(a,s).build();return e.dispatch(l),!0}(e,{width:d,height:g})}var w={insertImage:"Insert Image",insertImageTooltip:"Insert Image",uploadFromComputer:"Upload from computer",uploadAria:"Upload image from computer",separator:"or",urlPlaceholder:"https://...",urlAria:"Image URL",insertButton:"Insert",insertAria:"Insert image",imageAria:(e,t,i)=>{const n=[e||"Image"];return void 0!==t&&void 0!==i&&n.push(`${t} by ${i} pixels`),n.join(", ")},resetToNaturalSize:"Image reset to natural size.",uploadFailed:"Upload failed.",uploading:"Uploading...",resizeHandleLabel:e=>`Resize ${e}`,imageSelected:"Image selected.",altTextPrefix:"Alt text: ",imageSizeAnnounce:(e,t)=>`Size: ${e} by ${t} pixels.`,resizeHint:(e,t)=>`${e} / ${t} to resize.`,imageResized:(e,t)=>`Image resized to ${e} by ${t} pixels.`,keyboardResizeHint:(e,t)=>`${e} / ${t} to resize`},z=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-4b8e2YSc.mjs"),"./locales/de.ts":()=>import("./de-i95F9SDy.mjs"),"./locales/es.ts":()=>import("./es-DehVGwQ8.mjs"),"./locales/fr.ts":()=>import("./fr-DEZ_oxzS.mjs"),"./locales/hi.ts":()=>import("./hi-J8ErB5nB.mjs"),"./locales/pt.ts":()=>import("./pt-BlFAJZo7.mjs"),"./locales/ru.ts":()=>import("./ru-D53d-_UB.mjs"),"./locales/zh.ts":()=>import("./zh-DdzgYD7k.mjs")});async function y(e){return g(z,e,w)}var S={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"},I={nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"},k={nw:-1,ne:1,sw:-1,se:1},A={nw:"nesw-resize",ne:"nwse-resize",sw:"nwse-resize",se:"nesw-resize"},L=null;function C(){L&&(L.remove(),L=null)}function N(e,t,i,n=w){return(r,o,a)=>{const s=document.createElement("figure");s.className="notectl-image",s.setAttribute("data-block-id",r.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const l=document.createElement("div");l.className="notectl-image__container";const c=document.createElement("img");c.className="notectl-image__img",c.draggable=!1;const d=document.createElement("div");d.className="notectl-image__overlay",l.appendChild(c),l.appendChild(d),s.appendChild(l);let g=r.id,m=null;function b(e){const i=e.attrs?.src??"",r=e.attrs?.alt??"",o=e.attrs?.width,a=e.attrs?.height,l=e.attrs?.align??"center";c.src!==i&&(c.src=i),c.alt=r,p(c,"width",void 0!==o?`${o}px`:""),p(c,"height",void 0!==a?`${a}px`:"");for(const t of Object.values(S))s.classList.remove(t);const g=S[l];g&&s.classList.add(g);const m=t.get(e.id)??"idle",u="uploading"===m;d.classList.toggle("notectl-image__overlay--uploading",u),d.classList.toggle("notectl-image__overlay--error","error"===m),d.textContent=u?n.uploading:"error"===m?n.uploadFailed:"",u?s.setAttribute("aria-busy","true"):s.removeAttribute("aria-busy"),function(e){const t=e.attrs?.alt??"",i=e.attrs?.width,r=e.attrs?.height;s.setAttribute("aria-label",n.imageAria(t,i,r))}(e)}b(r);let x=!1;function _(t,i,n,r){let l=0,d=0,g=1,m=k[i];const p=t=>{const i=t.clientX-l,n=(o=d+i*m,Math.max(50,Math.min(e.maxWidth,o)));var o;const a=Math.round(n/g);h(c,{width:`${n}px`,height:`${a}px`}),r.textContent=`${Math.round(n)} × ${a}`},b=e=>{document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",b),s.classList.remove("notectl-image--resizing"),r.classList.remove("notectl-image__size-indicator--visible"),C();const t=Math.round(c.getBoundingClientRect().width);!function(e,t,i){const n=o(),r=n.getBlock(e);if(!r)return;const s=r.attrs?.width,l=r.attrs?.height;if(s===t&&l===i)return;const c=n.getNodePath(e);if(!c)return;const d={...r.attrs??{},width:t,height:i};a(n.transaction("command").setNodeAttr(c,d).build())}(n,t,Math.round(t/g)),e.target?.releasePointerCapture?.(e.pointerId)};t.addEventListener("pointerdown",e=>{e.preventDefault(),e.stopPropagation();const t="rtl"===f(s);m=function(e,t){const i=k[e];return t?-i:i}(i,t),l=e.clientX,d=c.getBoundingClientRect().width;const n=c.getBoundingClientRect().height;g=n>0?d/n:1,s.classList.add("notectl-image--resizing"),r.textContent=`${Math.round(d)} × ${Math.round(n)}`,r.classList.add("notectl-image__size-indicator--visible"),function(e,t){C(),L=document.createElement("style");const i=t?u(t):void 0;i&&L.setAttribute("nonce",i),L.textContent=`*{cursor:${e}!important;user-select:none!important}`,document.head.appendChild(L)}(t?A[i]:I[i],s),e.target.setPointerCapture(e.pointerId),document.addEventListener("pointermove",p),document.addEventListener("pointerup",b)})}function w(){C(),m&&(m.remove(),m=null)}return c.addEventListener("load",()=>{if(x)return;const t=o(),i=t.getBlock(g);if(!i||"image"!==i.type)return;const n=void 0!==i.attrs?.width,r=void 0!==i.attrs?.height;if(n&&r)return void(x=!0);const s=c.naturalWidth,l=c.naturalHeight;if(0===s||0===l)return;const d=Math.min(s,e.maxWidth),m=s>0?l/s:1,p=Math.round(d*m),u=t.getNodePath(g);if(!u)return;const h={...i.attrs??{},width:d,height:p};a(t.transaction("command").setNodeAttr(u,h).build()),x=!0}),{dom:s,contentDOM:null,update:e=>"image"===e.type&&(g=e.id,s.setAttribute("data-block-id",e.id),b(e),!0),selectNode(){s.classList.add("notectl-image--selected"),function(t){if(!e.resizable||m)return;m=document.createElement("div"),m.className="notectl-image__resize-overlay",m.setAttribute("data-notectl-no-print","");const r=document.createElement("div");r.className="notectl-image__size-indicator",m.appendChild(r);for(const e of["nw","ne","sw","se"]){const i=document.createElement("div");i.className=`notectl-image__resize-handle notectl-image__resize-handle--${e}`,i.setAttribute("aria-hidden","true"),_(i,e,t,r),m.appendChild(i)}if(i){const e=function(e,t){const i=e.shrinkWidth??null,n=e.growWidth??null;return i&&n?t.keyboardResizeHint(v(i),v(n)):""}(i,n);if(e){const t=document.createElement("div");t.className="notectl-image__keyboard-hint",t.setAttribute("aria-hidden","true"),t.textContent=e,m.appendChild(t)}}l.appendChild(m)}(g)},deselectNode(){s.classList.remove("notectl-image--selected"),w()},destroy(){w()}}}}var j=new d("image:upload"),$={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},E={maxWidth:800,maxFileSize:10485760,acceptedTypes:["image/png","image/jpeg","image/gif","image/webp","image/svg+xml"],resizable:!0,resizeStep:10,resizeStepLarge:50},M=class{id="image";name="Image";priority=45;config;resolvedKeymap;uploadStates=/* @__PURE__ */new Map;blobUrls=/* @__PURE__ */new Set;context=null;locale;constructor(e){this.config={...E,...e},this.resolvedKeymap={...$,...e?.keymap}}async init(e){this.locale=await m(e,this.config.locale,w,y),e.registerStyleSheet(".notectl-image{-webkit-user-select:none;-moz-user-select:none;user-select:none;margin:8px 0;line-height:0}.notectl-image--center{text-align:center}.notectl-image--start{text-align:start}.notectl-image--end{text-align:end}.notectl-image__container{line-height:0;display:inline-block;position:relative}.notectl-image__img{border-radius:4px;max-width:100%;display:block}.notectl-image--selected .notectl-image__container{outline:2px solid var(--notectl-primary);outline-offset:2px;border-radius:6px}.notectl-image__align-toolbar{background:var(--notectl-surface-overlay);border:1px solid var(--notectl-border);box-shadow:0 2px 8px var(--notectl-shadow);z-index:10;border-radius:6px;gap:2px;padding:2px;display:flex;position:absolute;top:-36px;left:50%;transform:translate(-50%)}.notectl-image__align-btn{cursor:pointer;width:28px;height:28px;color:var(--notectl-fg);background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;display:flex}.notectl-image__align-btn:hover{background:var(--notectl-hover-bg)}.notectl-image__align-btn--active{background:var(--notectl-active-bg);color:var(--notectl-accent-fg)}.notectl-image__align-btn svg{fill:currentColor;width:16px;height:16px}.notectl-image__overlay{color:var(--notectl-fg-muted);background:#fffc;border-radius:4px;justify-content:center;align-items:center;font-size:13px;display:none;position:absolute;inset:0}.notectl-image__overlay--uploading{display:flex}.notectl-image__overlay--error{background:var(--notectl-danger-muted);color:var(--notectl-danger);display:flex}.notectl-image__resize-overlay{pointer-events:none;position:absolute;inset:0}.notectl-image__resize-handle{background:var(--notectl-surface-raised);border:2px solid var(--notectl-primary);pointer-events:all;z-index:2;border-radius:50%;width:10px;height:10px;transition:transform .1s,background .1s;position:absolute}.notectl-image__resize-handle:hover{background:var(--notectl-primary);transform:scale(1.3)}.notectl-image--resizing .notectl-image__resize-handle{background:var(--notectl-primary)}.notectl-image__resize-handle--nw{top:-5px;cursor:nwse-resize;inset-inline-start:-5px}.notectl-image__resize-handle--ne{top:-5px;cursor:nesw-resize;inset-inline-end:-5px}.notectl-image__resize-handle--sw{bottom:-5px;cursor:nesw-resize;inset-inline-start:-5px}.notectl-image__resize-handle--se{bottom:-5px;cursor:nwse-resize;inset-inline-end:-5px}[dir=rtl] .notectl-image__resize-handle--nw{cursor:nesw-resize}[dir=rtl] .notectl-image__resize-handle--ne,[dir=rtl] .notectl-image__resize-handle--sw{cursor:nwse-resize}[dir=rtl] .notectl-image__resize-handle--se{cursor:nesw-resize}.notectl-image__size-indicator{background:var(--notectl-tooltip-bg);color:var(--notectl-tooltip-fg);white-space:nowrap;pointer-events:none;opacity:0;z-index:3;border-radius:4px;padding:2px 8px;font-size:11px;font-weight:500;transition:opacity .15s;position:absolute;bottom:-28px;left:50%;transform:translate(-50%)}.notectl-image__size-indicator--visible{opacity:1}.notectl-image__keyboard-hint{color:var(--notectl-fg-muted);white-space:nowrap;pointer-events:none;z-index:3;padding:2px 8px;font-size:11px;display:none;position:absolute;bottom:-28px;left:50%;transform:translate(-50%)}.notectl-image--selected .notectl-image__keyboard-hint{display:block}.notectl-image--resizing .notectl-image__keyboard-hint{display:none}.notectl-image--resizing .notectl-image__img{opacity:.85}"),e.registerStyleSheet(".notectl-image-popup{min-width:240px;padding:8px}.notectl-image-popup__file-input{opacity:0;width:0;height:0;position:absolute;overflow:hidden}.notectl-image-popup__upload-btn{cursor:pointer;text-align:center;box-sizing:border-box;border:1px solid var(--notectl-border);background:var(--notectl-surface-raised);width:100%;color:var(--notectl-fg);border-radius:4px;padding:8px 12px;display:block}.notectl-image-popup__separator{color:var(--notectl-fg-muted);align-items:center;margin:8px 0;font-size:12px;display:flex}.notectl-image-popup__separator-line{background:var(--notectl-border);flex:1;height:1px}.notectl-image-popup__separator-text{padding:0 8px}.notectl-image-popup__url-input{box-sizing:border-box;border:1px solid var(--notectl-border);background:var(--notectl-surface-overlay);width:100%;color:var(--notectl-fg);border-radius:4px;padding:6px 8px}.notectl-image-popup__insert-btn{cursor:pointer;border:1px solid var(--notectl-border);background:var(--notectl-surface-raised);width:100%;color:var(--notectl-fg);border-radius:4px;margin-top:4px;padding:8px 12px}"),this.context=e,this.registerNodeSpec(e),this.registerInlineImageNodeSpec(e),this.registerNodeView(e),function(e){e.registerCommand("insertImage",()=>x(e,{src:""})),e.registerCommand("removeImage",()=>function(e){const t=e.getState(),i=t.selection;if(!r(i))return!1;const n=t.getBlock(i.nodeId);if(!n||"image"!==n.type)return!1;const a=t.getNodePath(i.nodeId);if(!a||0===a.length)return!1;const s=c(t,o(i.nodeId,a));return!!s&&(e.dispatch(s),!0)}(e))}(e),this.registerResizeCommands(e),this.registerResizeKeymaps(e),this.registerFileHandler(e),this.registerToolbarItem(e)}destroy(){for(const e of this.blobUrls)URL.revokeObjectURL(e);this.blobUrls.clear(),this.uploadStates.clear(),this.context=null}onStateChange(e,t,i){if(!this.context)return;for(const o of this.uploadStates.keys())t.getBlock(o)||this.uploadStates.delete(o);const n=this.isImageSelected(e),r=this.isImageSelected(t);!n&&r&&this.announceImageSelection(t)}registerNodeSpec(t){const i=this.locale;t.registerNodeSpec({type:"image",group:"block",isVoid:!0,selectable:!0,attrs:{src:{default:""},alt:{default:""},title:{default:""},align:{default:"center"}},toDOM(e){const t=b("figure",e.id);t.className="notectl-image",t.setAttribute("data-void","true"),t.setAttribute("data-selectable","true");const n=document.createElement("div");n.className="notectl-image__container";const r=e.attrs?.alt??"",o=e.attrs?.width,a=e.attrs?.height,s=document.createElement("img");s.className="notectl-image__img",s.src=e.attrs?.src??"",s.alt=r;const l=e.attrs?.title??"";l&&(s.title=l),s.draggable=!1,void 0!==o&&p(s,"width",`${o}px`),void 0!==a&&p(s,"height",`${a}px`);const c={start:"notectl-image--start",center:"notectl-image--center",end:"notectl-image--end"}[e.attrs?.align??"center"];return c&&t.classList.add(c),t.setAttribute("aria-label",i.imageAria(r,o,a)),n.appendChild(s),t.appendChild(n),t},toHTML(t){const i=e(t.attrs?.src??""),n=e(t.attrs?.alt??""),r=t.attrs?.width,o=t.attrs?.height,a=(void 0!==r?` width="${r}"`:"")+(void 0!==o?` height="${o}"`:""),s=t.attrs?.title??"";return`<figure><img src="${i}" alt="${n}"${s?` title="${e(s)}"`:""}${a}></figure>`},parseHTML:[{tag:"figure",getAttrs(e){const t=e.querySelector("img");if(!t)return!1;const i={src:t.getAttribute("src")??"",alt:t.getAttribute("alt")??"",align:"center"},n=t.getAttribute("width"),r=t.getAttribute("height");n&&(i.width=Number.parseInt(n,10)),r&&(i.height=Number.parseInt(r,10));const o=t.getAttribute("title");o&&(i.title=o);const a=e.style?.textAlign??"";return"start"===a||"end"===a||"center"===a?i.align=a:"left"===a?i.align="start":"right"===a?i.align="end":e.classList.contains("notectl-align-start")||e.classList.contains("notectl-align-left")||e.classList.contains("notectl-image--start")||e.classList.contains("notectl-image--left")?i.align="start":e.classList.contains("notectl-align-end")||e.classList.contains("notectl-align-right")||e.classList.contains("notectl-image--end")||e.classList.contains("notectl-image--right")?i.align="end":e.classList.contains("notectl-align-center")&&(i.align="center"),i}},{tag:"img",getAttrs(e){const t={src:e.getAttribute("src")??"",alt:e.getAttribute("alt")??"",align:"center"},i=e.getAttribute("width"),n=e.getAttribute("height");i&&(t.width=Number.parseInt(i,10)),n&&(t.height=Number.parseInt(n,10));const r=e.getAttribute("title");return r&&(t.title=r),t}}],sanitize:{tags:["figure","img"],attrs:["src","alt","title","width","height","class","style"]}})}registerInlineImageNodeSpec(t){t.registerInlineNodeSpec({type:"image_inline",group:"inline",attrs:{src:{default:""},alt:{default:""},title:{default:""}},toDOM(e){const t=document.createElement("img");t.className="notectl-image-inline",t.setAttribute("contenteditable","false"),t.src=String(e.attrs.src??""),t.alt=String(e.attrs.alt??"");const i=String(e.attrs.title??"");return i&&(t.title=i),t.draggable=!1,t},toHTMLString(t){const i=e(String(t.attrs.src??"")),n=e(String(t.attrs.alt??"")),r=String(t.attrs.title??"");return`<img src="${i}" alt="${n}"${r?` title="${e(r)}"`:""}>`},parseHTML:[{tag:"img",getAttrs:e=>{const t={src:e.getAttribute("src")??"",alt:e.getAttribute("alt")??""},i=e.getAttribute("title");return i&&(t.title=i),t}}],sanitize:{tags:["img"],attrs:["src","alt","title"]}})}registerNodeView(e){e.registerNodeView("image",N(this.config,this.uploadStates,this.resolvedKeymap,this.locale))}registerResizeCommands(e){const t=this.config.resizeStep??10,i=this.config.resizeStepLarge??50,n=this.config.maxWidth;e.registerCommand("resizeImageGrow",()=>{const i=_(e,t,n);return i&&this.announceCurrentSize(e),i}),e.registerCommand("resizeImageShrink",()=>{const i=_(e,-t,n);return i&&this.announceCurrentSize(e),i}),e.registerCommand("resizeImageGrowLarge",()=>{const t=_(e,i,n);return t&&this.announceCurrentSize(e),t}),e.registerCommand("resizeImageShrinkLarge",()=>{const t=_(e,-i,n);return t&&this.announceCurrentSize(e),t}),e.registerCommand("resetImageSize",()=>{const t=function(e){const t=e.getState(),i=t.selection;if(!r(i))return!1;const n=t.getBlock(i.nodeId);if(!n||"image"!==n.type)return!1;const o=t.getNodePath(i.nodeId);if(!o)return!1;const a={...n.attrs??{}},s=Object.fromEntries(Object.entries(a).filter(([e])=>"width"!==e&&"height"!==e)),l=t.transaction("command").setNodeAttr(o,s).build();return e.dispatch(l),!0}(e);return t&&e.announce(this.locale.resetToNaturalSize),t})}registerResizeKeymaps(e){const t={};for(const[i,n]of Object.entries({growWidth:"resizeImageGrow",shrinkWidth:"resizeImageShrink",growWidthLarge:"resizeImageGrowLarge",shrinkWidthLarge:"resizeImageShrinkLarge",resetSize:"resetImageSize"})){const r=this.resolvedKeymap[i]??null;r&&(t[r]=()=>e.executeCommand(n))}Object.keys(t).length>0&&e.registerKeymap(t)}registerFileHandler(e){e.registerFileHandler("image/*",async(t,i)=>!!this.isAcceptedType(t.type)&&(this.handleFileInsert(e,t),!0))}handleFileInsert(e,t){if(t.size>this.config.maxFileSize)return;const i=URL.createObjectURL(t);if(this.blobUrls.add(i),!x(e,{src:i}))return URL.revokeObjectURL(i),void this.blobUrls.delete(i);const n=e.getState().selection;if(!r(n))return;const o=n.nodeId;this.uploadStates.set(o,"uploading"),e.getService(j)?this.uploadFile(e,t,o,i):this.uploadStates.set(o,"complete")}async uploadFile(e,t,i,n){const r=e.getService(j);if(r)try{const o=await r.upload(t);this.uploadStates.set(i,"complete");const a=e.getState(),s=a.getBlock(i);if(!s)return;const l=a.getNodePath(i);if(!l)return;const c={...s.attrs??{},src:o.url,...void 0!==o.width?{width:o.width}:{},...void 0!==o.height?{height:o.height}:{}},d=a.transaction("command").setNodeAttr(l,c).build();e.dispatch(d),URL.revokeObjectURL(n),this.blobUrls.delete(n)}catch{this.uploadStates.set(i,"error"),e.announce(this.locale.uploadFailed)}}registerToolbarItem(e){e.registerToolbarItem({id:"image",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',label:this.locale.insertImage,tooltip:this.locale.insertImageTooltip,command:"insertImage",popupType:"custom",renderPopup:(e,t,i)=>{!function(e,t,i){e.classList.add("notectl-image-popup"),function(e,t,i){const n=document.createElement("input");n.type="file",n.accept=i.acceptedTypes.join(","),n.className="notectl-image-popup__file-input";const r=document.createElement("button");r.type="button",r.textContent=i.locale.uploadFromComputer,r.setAttribute("aria-label",i.locale.uploadAria),r.className="notectl-image-popup__upload-btn",r.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),r.addEventListener("click",()=>{n.click()}),n.addEventListener("change",()=>{const e=n.files?.[0];e&&(i.onFileInsert(t,e),i.onClose(),t.getContainer().focus())}),e.appendChild(n),e.appendChild(r)}(e,t,i),function(e,t){const i=document.createElement("div");i.className="notectl-image-popup__separator";const n=document.createElement("span");n.className="notectl-image-popup__separator-line";const r=document.createElement("span");r.textContent=t.separator,r.className="notectl-image-popup__separator-text";const o=document.createElement("span");o.className="notectl-image-popup__separator-line",i.appendChild(n),i.appendChild(r),i.appendChild(o),e.appendChild(i)}(e,i.locale),function(e,t,i){const n=document.createElement("input");n.type="url",n.placeholder=i.locale.urlPlaceholder,n.setAttribute("aria-label",i.locale.urlAria),n.className="notectl-image-popup__url-input";const r=document.createElement("button");r.type="button",r.textContent=i.locale.insertButton,r.setAttribute("aria-label",i.locale.insertAria),r.className="notectl-image-popup__insert-btn";const o=()=>{const e=n.value.trim();e&&(x(t,{src:e}),i.onClose(),t.getContainer().focus())};r.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation()}),r.addEventListener("click",()=>{o()}),n.addEventListener("keydown",e=>{"Enter"===e.key&&(e.preventDefault(),o())}),e.appendChild(n),e.appendChild(r),requestAnimationFrame(()=>n.focus())}(e,t,i)}(e,t,{acceptedTypes:this.config.acceptedTypes,locale:this.locale,onFileInsert:(e,t)=>this.handleFileInsert(e,t),onClose:i})}})}isAcceptedType(e){return this.config.acceptedTypes.some(t=>t===e||t.endsWith("/*")&&e.startsWith(t.slice(0,-1)))}isImageSelected(e){const t=e.selection;return!!r(t)&&"image"===e.getBlock(t.nodeId)?.type}announceImageSelection(e){if(!this.context)return;const t=e.selection;if(!r(t))return;const i=e.getBlock(t.nodeId);if(!i||"image"!==i.type)return;const n=i.attrs?.alt??"",o=i.attrs?.width,a=i.attrs?.height,s=[this.locale.imageSelected];n&&s.push(`${this.locale.altTextPrefix}${n}.`),void 0!==o&&void 0!==a&&s.push(this.locale.imageSizeAnnounce(o,a));const l=this.resolvedKeymap.shrinkWidth??null,c=this.resolvedKeymap.growWidth??null;l&&c&&s.push(this.locale.resizeHint(v(l),v(c))),this.context.announce(s.join(" "))}announceCurrentSize(e){const t=e.getState(),i=t.selection;if(!r(i))return;const n=t.getBlock(i.nodeId);if(!n||"image"!==n.type)return;const o=n.attrs?.width,a=n.attrs?.height;void 0!==o&&void 0!==a&&e.announce(this.locale.imageResized(o,a))}};export{y as a,w as i,$ as n,j as r,M as t};
2
- //# sourceMappingURL=ImagePlugin-BzLvPXGo.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImagePlugin-BzLvPXGo.mjs","names":[],"sources":["../../src/editor/styles/image.css?inline","../../src/plugins/image/ImageCommands.ts","../../src/plugins/image/ImageLocale.ts","../../src/plugins/image/ImageNodeView.ts","../../src/plugins/image/ImagePopup.ts","../../src/plugins/image/ImagePopupStyles.css?inline","../../src/plugins/image/ImageUpload.ts","../../src/plugins/image/ImagePlugin.ts"],"sourcesContent":["/** Image styles — display, alignment, resize handles, upload overlay. */\n/* Image */\n.notectl-image {\n\tmargin: 8px 0;\n\tuser-select: none;\n\tline-height: 0;\n}\n\n.notectl-image--center {\n\ttext-align: center;\n}\n\n.notectl-image--start {\n\ttext-align: start;\n}\n\n.notectl-image--end {\n\ttext-align: end;\n}\n\n.notectl-image__container {\n\tdisplay: inline-block;\n\tposition: relative;\n\tline-height: 0;\n}\n\n.notectl-image__img {\n\tdisplay: block;\n\tmax-width: 100%;\n\tborder-radius: 4px;\n}\n\n.notectl-image--selected .notectl-image__container {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n\tborder-radius: 6px;\n}\n\n/* Alignment toolbar (appears on image selection) */\n.notectl-image__align-toolbar {\n\tdisplay: flex;\n\tgap: 2px;\n\tposition: absolute;\n\ttop: -36px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tbackground: var(--notectl-surface-overlay);\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tpadding: 2px;\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-image__align-btn {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tbackground: transparent;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image__align-btn:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-image__align-btn--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-accent-fg);\n}\n\n.notectl-image__align-btn svg {\n\twidth: 16px;\n\theight: 16px;\n\tfill: currentColor;\n}\n\n/* Upload overlay */\n.notectl-image__overlay {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: none;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground: rgba(255, 255, 255, 0.8);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-image__overlay--uploading {\n\tdisplay: flex;\n}\n\n.notectl-image__overlay--error {\n\tdisplay: flex;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n}\n\n/* Resize overlay + handles */\n.notectl-image__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-image__resize-handle {\n\tposition: absolute;\n\twidth: 10px;\n\theight: 10px;\n\tbackground: var(--notectl-surface-raised);\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 50%;\n\tpointer-events: all;\n\tz-index: 2;\n\ttransition: transform 0.1s, background 0.1s;\n}\n\n.notectl-image__resize-handle:hover {\n\tbackground: var(--notectl-primary);\n\ttransform: scale(1.3);\n}\n\n.notectl-image--resizing .notectl-image__resize-handle {\n\tbackground: var(--notectl-primary);\n}\n\n.notectl-image__resize-handle--nw {\n\ttop: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nwse-resize;\n}\n\n.notectl-image__resize-handle--ne {\n\ttop: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--sw {\n\tbottom: -5px;\n\tinset-inline-start: -5px;\n\tcursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--se {\n\tbottom: -5px;\n\tinset-inline-end: -5px;\n\tcursor: nwse-resize;\n}\n\n/* RTL cursor overrides — flip diagonal cursors when in RTL context */\n[dir=\"rtl\"] .notectl-image__resize-handle--nw {\n\tcursor: nesw-resize;\n}\n\n[dir=\"rtl\"] .notectl-image__resize-handle--ne {\n\tcursor: nwse-resize;\n}\n\n[dir=\"rtl\"] .notectl-image__resize-handle--sw {\n\tcursor: nwse-resize;\n}\n\n[dir=\"rtl\"] .notectl-image__resize-handle--se {\n\tcursor: nesw-resize;\n}\n\n/* Size indicator tooltip */\n.notectl-image__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\tborder-radius: 4px;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-image__size-indicator--visible {\n\topacity: 1;\n}\n\n/* Keyboard resize hint (shown on selection, hidden during drag) */\n.notectl-image__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-image--selected .notectl-image__keyboard-hint {\n\tdisplay: block;\n}\n\n.notectl-image--resizing .notectl-image__keyboard-hint {\n\tdisplay: none;\n}\n\n/* Resizing feedback */\n.notectl-image--resizing .notectl-image__img {\n\topacity: 0.85;\n}\n","/**\n * Image plugin commands: insert, remove, and attribute updates.\n * Supports both root-level and nested contexts (e.g. images inside table cells).\n */\n\nimport { insertBlockObjectOnOwnLine } from '../../commands/BlockInsertion.js';\nimport { deleteNodeSelection } from '../../commands/NodeSelectionCommands.js';\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport { createBlockNode, getBlockChildren, isBlockNode } from '../../model/Document.js';\nimport { createNodeSelection, isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { ImageAttrs } from './ImageUpload.js';\n\n/**\n * Inserts an image block. When the cursor is inside a table cell,\n * the image is inserted as a child of the cell. Otherwise it is\n * inserted after the current block at document root.\n */\nexport function insertImage(\n\tcontext: PluginContext,\n\tattrs: Partial<ImageAttrs> & { readonly src: string },\n): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\n\tconst imageAttrs: BlockAttrs = {\n\t\tsrc: attrs.src,\n\t\talt: attrs.alt ?? '',\n\t\talign: attrs.align ?? 'center',\n\t\t...(attrs.width !== undefined ? { width: attrs.width } : {}),\n\t\t...(attrs.height !== undefined ? { height: attrs.height } : {}),\n\t};\n\n\tif (isGapCursor(sel)) return false;\n\n\tconst anchorBlockId: BlockId = isNodeSelection(sel) ? sel.nodeId : sel.anchor.blockId;\n\n\t// Check if we're inside a table cell\n\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\tif (cellId) {\n\t\treturn insertImageIntoCell(state, context, cellId, imageAttrs);\n\t}\n\n\treturn insertImageAtRoot(state, context, anchorBlockId, imageAttrs);\n}\n\n/** Finds a table_cell ancestor for the given block (or the block itself). */\nfunction findTableCellAncestor(state: EditorState, bid: BlockId): BlockId | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(bid);\n\tif (block?.type === 'table_cell') return bid;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(bid);\n\tif (!path) return undefined;\n\n\tfor (const id of path) {\n\t\tconst node: BlockNode | undefined = state.getBlock(id);\n\t\tif (node?.type === 'table_cell') return id;\n\t}\n\treturn undefined;\n}\n\n/** Inserts an image on its own line at document root, after the anchor block. */\nfunction insertImageAtRoot(\n\tstate: EditorState,\n\tcontext: PluginContext,\n\tanchorBlockId: BlockId,\n\timageAttrs: BlockAttrs,\n): boolean {\n\tconst imageBlock: BlockNode = createBlockNode(nodeType('image'), [], undefined, imageAttrs);\n\tconst builder = state.transaction('command');\n\tconst trailing = insertBlockObjectOnOwnLine(state, builder, anchorBlockId, imageBlock);\n\tif (!trailing) return false;\n\n\tbuilder.setSelection(createNodeSelection(imageBlock.id, []));\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Inserts an image as a child of a table cell. */\nfunction insertImageIntoCell(\n\tstate: EditorState,\n\tcontext: PluginContext,\n\tcellId: BlockId,\n\timageAttrs: BlockAttrs,\n): boolean {\n\tconst cellPath: BlockId[] | undefined = state.getNodePath(cellId);\n\tif (!cellPath) return false;\n\n\tconst imageBlock: BlockNode = createBlockNode(nodeType('image'), [], undefined, imageAttrs);\n\n\t// Remove existing block children first (if any)\n\tconst cell: BlockNode | undefined = state.getBlock(cellId);\n\tif (!cell) return false;\n\n\tconst builder = state.transaction('command');\n\tconst blockChildren: readonly BlockNode[] = getBlockChildren(cell);\n\tfor (let i = blockChildren.length - 1; i >= 0; i--) {\n\t\t// Find the raw index in children array\n\t\tconst rawIndex: number = cell.children.findIndex(\n\t\t\t(c) => isBlockNode(c) && c.id === blockChildren[i]?.id,\n\t\t);\n\t\tif (rawIndex !== -1) {\n\t\t\tbuilder.removeNode(cellPath, rawIndex);\n\t\t}\n\t}\n\n\t// Insert image at index 0 (before any text nodes)\n\tbuilder.insertNode(cellPath, 0, imageBlock);\n\tbuilder.setSelection(createNodeSelection(imageBlock.id, [...cellPath, imageBlock.id]));\n\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Removes the currently selected image block (works for nested images too). */\nexport function removeImage(context: PluginContext): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst nodePath: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!nodePath || nodePath.length === 0) return false;\n\n\tconst tr = deleteNodeSelection(state, createNodeSelection(sel.nodeId, nodePath));\n\tif (!tr) return false;\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Updates attributes on the currently selected image block. */\nexport function setImageAttr(context: PluginContext, attrs: Partial<ImageAttrs>): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!path) return false;\n\n\tconst merged: BlockAttrs = { ...(block.attrs ?? {}), ...attrs };\n\tconst tr = state.transaction('command').setNodeAttr(path, merged).build();\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Minimum image width in pixels (shared with NodeView). */\nexport const MIN_IMAGE_WIDTH = 50;\n\n/**\n * Resizes the currently selected image by a pixel delta, preserving aspect ratio.\n * Returns false if no image is selected or the image has no width/height attributes.\n */\nexport function resizeImageByDelta(\n\tcontext: PluginContext,\n\tdelta: number,\n\tmaxWidth: number,\n): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst currentWidth: number | undefined = block.attrs?.width as number | undefined;\n\tconst currentHeight: number | undefined = block.attrs?.height as number | undefined;\n\tif (currentWidth === undefined || currentHeight === undefined) return false;\n\n\tconst aspectRatio: number = currentHeight > 0 ? currentWidth / currentHeight : 1;\n\tconst clampedWidth: number = Math.max(MIN_IMAGE_WIDTH, Math.min(maxWidth, currentWidth + delta));\n\tconst newHeight: number = Math.round(clampedWidth / aspectRatio);\n\n\tif (clampedWidth === currentWidth && newHeight === currentHeight) return false;\n\n\treturn setImageAttr(context, { width: clampedWidth, height: newHeight });\n}\n\n/** Resets the currently selected image to its natural size by removing width/height. */\nexport function resetImageSize(context: PluginContext): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!path) return false;\n\n\tconst attrs: BlockAttrs = { ...(block.attrs ?? {}) };\n\tconst cleaned: BlockAttrs = Object.fromEntries(\n\t\tObject.entries(attrs).filter(([k]) => k !== 'width' && k !== 'height'),\n\t);\n\n\tconst tr = state.transaction('command').setNodeAttr(path, cleaned).build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Registers all image commands on the plugin context. */\nexport function registerImageCommands(context: PluginContext): void {\n\tcontext.registerCommand('insertImage', () => {\n\t\treturn insertImage(context, { src: '' });\n\t});\n\n\tcontext.registerCommand('removeImage', () => {\n\t\treturn removeImage(context);\n\t});\n}\n","/** Locale interface and default English locale for the ImagePlugin. */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ImageLocale {\n\treadonly insertImage: string;\n\treadonly insertImageTooltip: string;\n\treadonly uploadFromComputer: string;\n\treadonly uploadAria: string;\n\treadonly separator: string;\n\treadonly urlPlaceholder: string;\n\treadonly urlAria: string;\n\treadonly insertButton: string;\n\treadonly insertAria: string;\n\treadonly imageAria: (alt: string, width?: number, height?: number) => string;\n\treadonly resetToNaturalSize: string;\n\treadonly uploadFailed: string;\n\treadonly uploading: string;\n\treadonly resizeHandleLabel: (position: string) => string;\n\treadonly imageSelected: string;\n\treadonly altTextPrefix: string;\n\treadonly imageSizeAnnounce: (w: number, h: number) => string;\n\treadonly resizeHint: (shrink: string, grow: string) => string;\n\treadonly imageResized: (w: number, h: number) => string;\n\treadonly keyboardResizeHint: (shrink: string, grow: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const IMAGE_LOCALE_EN: ImageLocale = {\n\tinsertImage: 'Insert Image',\n\tinsertImageTooltip: 'Insert Image',\n\tuploadFromComputer: 'Upload from computer',\n\tuploadAria: 'Upload image from computer',\n\tseparator: 'or',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Image URL',\n\tinsertButton: 'Insert',\n\tinsertAria: 'Insert image',\n\timageAria: (alt: string, width?: number, height?: number) => {\n\t\tconst parts: string[] = [alt || 'Image'];\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tparts.push(`${width} by ${height} pixels`);\n\t\t}\n\t\treturn parts.join(', ');\n\t},\n\tresetToNaturalSize: 'Image reset to natural size.',\n\tuploadFailed: 'Upload failed.',\n\tuploading: 'Uploading...',\n\tresizeHandleLabel: (position: string) => `Resize ${position}`,\n\timageSelected: 'Image selected.',\n\taltTextPrefix: 'Alt text: ',\n\timageSizeAnnounce: (w: number, h: number) => `Size: ${w} by ${h} pixels.`,\n\tresizeHint: (shrink: string, grow: string) => `${shrink} / ${grow} to resize.`,\n\timageResized: (w: number, h: number) => `Image resized to ${w} by ${h} pixels.`,\n\tkeyboardResizeHint: (shrink: string, grow: string) => `${shrink} / ${grow} to resize`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ImageLocale> = import.meta.glob<{\n\tdefault: ImageLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadImageLocale(lang: string): Promise<ImageLocale> {\n\treturn loadLocaleModule(localeModules, lang, IMAGE_LOCALE_EN);\n}\n","/**\n * NodeView factory for image blocks.\n * Renders <figure> with <img>, handles selection state, upload overlay,\n * resize with 4 corner handles + live size indicator, and a keyboard-hint\n * showing resize shortcuts when the image is selected.\n */\n\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { getTextDirection } from '../../platform/Platform.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport {\n\tgetStyleNonceForNode,\n\tsetStyleProperties,\n\tsetStyleProperty,\n} from '../../style/StyleRuntime.js';\nimport type { NodeView, NodeViewFactory } from '../../view/NodeView.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { IMAGE_LOCALE_EN, type ImageLocale } from './ImageLocale.js';\nimport type { ImageKeymap, ImagePluginConfig, UploadState } from './ImageUpload.js';\n\nconst ALIGNMENT_CLASSES: Record<string, string> = {\n\tstart: 'notectl-image--start',\n\tcenter: 'notectl-image--center',\n\tend: 'notectl-image--end',\n};\n\nconst MIN_IMAGE_WIDTH = 50;\n\ntype HandlePosition = 'nw' | 'ne' | 'sw' | 'se';\n\nconst HANDLE_CURSORS: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'nwse-resize',\n\tne: 'nesw-resize',\n\tsw: 'nesw-resize',\n\tse: 'nwse-resize',\n};\n\n/** +1 means dragging right increases width; -1 means dragging left does. */\nconst HANDLE_X_SIGN: Readonly<Record<HandlePosition, 1 | -1>> = {\n\tnw: -1,\n\tne: 1,\n\tsw: -1,\n\tse: 1,\n};\n\nconst HANDLE_POSITIONS_LTR: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'top-left',\n\tne: 'top-right',\n\tsw: 'bottom-left',\n\tse: 'bottom-right',\n};\n\nconst HANDLE_POSITIONS_RTL: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'top-right',\n\tne: 'top-left',\n\tsw: 'bottom-right',\n\tse: 'bottom-left',\n};\n\nconst RTL_CURSOR_MAP: Readonly<Record<HandlePosition, string>> = {\n\tnw: 'nesw-resize',\n\tne: 'nwse-resize',\n\tsw: 'nwse-resize',\n\tse: 'nesw-resize',\n};\n\n/** Returns the direction-aware ARIA label for a resize handle. */\nexport function getHandleLabel(\n\tposition: HandlePosition,\n\tisRtl: boolean,\n\tlocale: ImageLocale = IMAGE_LOCALE_EN,\n): string {\n\tconst positionName: string = (isRtl ? HANDLE_POSITIONS_RTL : HANDLE_POSITIONS_LTR)[position];\n\treturn locale.resizeHandleLabel(positionName);\n}\n\n/** Returns the X-sign for resize drag, flipped in RTL. */\nexport function getResizeXSign(position: HandlePosition, isRtl: boolean): 1 | -1 {\n\tconst sign: 1 | -1 = HANDLE_X_SIGN[position];\n\treturn isRtl ? (-sign as 1 | -1) : sign;\n}\n\n// --- Global cursor override during resize ---\n\nlet activeCursorStyle: HTMLStyleElement | null = null;\n\nfunction setGlobalResizeCursor(cursor: string, referenceNode?: Node): void {\n\tclearGlobalResizeCursor();\n\tactiveCursorStyle = document.createElement('style');\n\tconst nonce = referenceNode ? getStyleNonceForNode(referenceNode) : undefined;\n\tif (nonce) {\n\t\tactiveCursorStyle.setAttribute('nonce', nonce);\n\t}\n\tactiveCursorStyle.textContent = `*{cursor:${cursor}!important;user-select:none!important}`;\n\tdocument.head.appendChild(activeCursorStyle);\n}\n\nfunction clearGlobalResizeCursor(): void {\n\tif (activeCursorStyle) {\n\t\tactiveCursorStyle.remove();\n\t\tactiveCursorStyle = null;\n\t}\n}\n\n/** Builds the keyboard-hint text from the resolved keymap. */\nfunction buildKeyboardHintText(\n\tresolvedKeymap: Readonly<Record<keyof ImageKeymap, string | null>>,\n\tlocale: ImageLocale,\n): string {\n\tconst shrink: string | null = resolvedKeymap.shrinkWidth ?? null;\n\tconst grow: string | null = resolvedKeymap.growWidth ?? null;\n\tif (!shrink || !grow) return '';\n\treturn locale.keyboardResizeHint(formatShortcut(shrink), formatShortcut(grow));\n}\n\n/** Creates a NodeViewFactory for image blocks. */\nexport function createImageNodeViewFactory(\n\tconfig: ImagePluginConfig,\n\tuploadStates: Map<BlockId, UploadState>,\n\tresolvedKeymap?: Readonly<Record<keyof ImageKeymap, string | null>>,\n\tlocale: ImageLocale = IMAGE_LOCALE_EN,\n): NodeViewFactory {\n\treturn (\n\t\tnode: BlockNode,\n\t\tgetState: () => EditorState,\n\t\tdispatch: (tr: Transaction) => void,\n\t): NodeView => {\n\t\t// --- DOM Construction ---\n\t\tconst figure: HTMLElement = document.createElement('figure');\n\t\tfigure.className = 'notectl-image';\n\t\tfigure.setAttribute('data-block-id', node.id);\n\t\tfigure.setAttribute('data-void', 'true');\n\t\tfigure.setAttribute('data-selectable', 'true');\n\n\t\tconst container: HTMLDivElement = document.createElement('div');\n\t\tcontainer.className = 'notectl-image__container';\n\n\t\tconst img: HTMLImageElement = document.createElement('img');\n\t\timg.className = 'notectl-image__img';\n\t\timg.draggable = false;\n\n\t\tconst overlay: HTMLDivElement = document.createElement('div');\n\t\toverlay.className = 'notectl-image__overlay';\n\n\t\tcontainer.appendChild(img);\n\t\tcontainer.appendChild(overlay);\n\t\tfigure.appendChild(container);\n\n\t\tlet currentNodeId: BlockId = node.id;\n\t\tlet resizeOverlay: HTMLDivElement | null = null;\n\n\t\t// --- ARIA Label ---\n\n\t\tfunction updateAriaLabel(n: BlockNode): void {\n\t\t\tconst alt: string = (n.attrs?.alt as string | undefined) ?? '';\n\t\t\tconst width: number | undefined = n.attrs?.width as number | undefined;\n\t\t\tconst height: number | undefined = n.attrs?.height as number | undefined;\n\t\t\tfigure.setAttribute('aria-label', locale.imageAria(alt, width, height));\n\t\t}\n\n\t\t// --- Attribute Application ---\n\n\t\tfunction applyAttrs(n: BlockNode): void {\n\t\t\tconst src: string = (n.attrs?.src as string | undefined) ?? '';\n\t\t\tconst alt: string = (n.attrs?.alt as string | undefined) ?? '';\n\t\t\tconst width: number | undefined = n.attrs?.width as number | undefined;\n\t\t\tconst height: number | undefined = n.attrs?.height as number | undefined;\n\t\t\tconst align: string = (n.attrs?.align as string | undefined) ?? 'center';\n\n\t\t\t// Only update src when it changes to avoid re-triggering load events\n\t\t\tif (img.src !== src) img.src = src;\n\t\t\timg.alt = alt;\n\n\t\t\tif (width !== undefined) {\n\t\t\t\tsetStyleProperty(img, 'width', `${width}px`);\n\t\t\t} else {\n\t\t\t\tsetStyleProperty(img, 'width', '');\n\t\t\t}\n\t\t\tif (height !== undefined) {\n\t\t\t\tsetStyleProperty(img, 'height', `${height}px`);\n\t\t\t} else {\n\t\t\t\tsetStyleProperty(img, 'height', '');\n\t\t\t}\n\n\t\t\tfor (const cls of Object.values(ALIGNMENT_CLASSES)) {\n\t\t\t\tfigure.classList.remove(cls);\n\t\t\t}\n\t\t\tconst alignClass: string | undefined = ALIGNMENT_CLASSES[align];\n\t\t\tif (alignClass) {\n\t\t\t\tfigure.classList.add(alignClass);\n\t\t\t}\n\n\t\t\tconst uploadState: UploadState = uploadStates.get(n.id) ?? 'idle';\n\t\t\tconst isUploading: boolean = uploadState === 'uploading';\n\t\t\toverlay.classList.toggle('notectl-image__overlay--uploading', isUploading);\n\t\t\toverlay.classList.toggle('notectl-image__overlay--error', uploadState === 'error');\n\n\t\t\tif (isUploading) {\n\t\t\t\toverlay.textContent = locale.uploading;\n\t\t\t} else if (uploadState === 'error') {\n\t\t\t\toverlay.textContent = locale.uploadFailed;\n\t\t\t} else {\n\t\t\t\toverlay.textContent = '';\n\t\t\t}\n\n\t\t\tif (isUploading) {\n\t\t\t\tfigure.setAttribute('aria-busy', 'true');\n\t\t\t} else {\n\t\t\t\tfigure.removeAttribute('aria-busy');\n\t\t\t}\n\n\t\t\tupdateAriaLabel(n);\n\t\t}\n\n\t\tapplyAttrs(node);\n\n\t\t// --- Commit natural dimensions on first load ---\n\n\t\tlet dimensionsCommitted = false;\n\n\t\timg.addEventListener('load', () => {\n\t\t\tif (dimensionsCommitted) return;\n\n\t\t\tconst state: EditorState = getState();\n\t\t\tconst block: BlockNode | undefined = state.getBlock(currentNodeId);\n\t\t\tif (!block || block.type !== 'image') return;\n\n\t\t\tconst hasWidth: boolean = block.attrs?.width !== undefined;\n\t\t\tconst hasHeight: boolean = block.attrs?.height !== undefined;\n\t\t\tif (hasWidth && hasHeight) {\n\t\t\t\tdimensionsCommitted = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst naturalW: number = img.naturalWidth;\n\t\t\tconst naturalH: number = img.naturalHeight;\n\t\t\tif (naturalW === 0 || naturalH === 0) return;\n\n\t\t\tconst clampedW: number = Math.min(naturalW, config.maxWidth);\n\t\t\tconst ratio: number = naturalW > 0 ? naturalH / naturalW : 1;\n\t\t\tconst clampedH: number = Math.round(clampedW * ratio);\n\n\t\t\tconst path: BlockId[] | undefined = state.getNodePath(currentNodeId);\n\t\t\tif (!path) return;\n\n\t\t\tconst merged: BlockAttrs = {\n\t\t\t\t...(block.attrs ?? {}),\n\t\t\t\twidth: clampedW,\n\t\t\t\theight: clampedH,\n\t\t\t};\n\n\t\t\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, merged).build();\n\t\t\tdispatch(tr);\n\t\t\tdimensionsCommitted = true;\n\t\t});\n\n\t\t// --- Resize Logic ---\n\n\t\tfunction clampWidth(width: number): number {\n\t\t\treturn Math.max(MIN_IMAGE_WIDTH, Math.min(config.maxWidth, width));\n\t\t}\n\n\t\tfunction commitResize(nodeId: BlockId, width: number, height: number): void {\n\t\t\tconst state: EditorState = getState();\n\t\t\tconst block: BlockNode | undefined = state.getBlock(nodeId);\n\t\t\tif (!block) return;\n\n\t\t\tconst prevWidth: number | undefined = block.attrs?.width as number | undefined;\n\t\t\tconst prevHeight: number | undefined = block.attrs?.height as number | undefined;\n\t\t\tif (prevWidth === width && prevHeight === height) return;\n\n\t\t\tconst path: BlockId[] | undefined = state.getNodePath(nodeId);\n\t\t\tif (!path) return;\n\n\t\t\tconst merged: BlockAttrs = {\n\t\t\t\t...(block.attrs ?? {}),\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t};\n\n\t\t\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, merged).build();\n\t\t\tdispatch(tr);\n\t\t}\n\n\t\tfunction attachHandleListeners(\n\t\t\thandle: HTMLDivElement,\n\t\t\tposition: HandlePosition,\n\t\t\tnodeId: BlockId,\n\t\t\tsizeIndicator: HTMLDivElement,\n\t\t): void {\n\t\t\tlet startX = 0;\n\t\t\tlet startWidth = 0;\n\t\t\tlet aspectRatio = 1;\n\t\t\tlet xSign: 1 | -1 = HANDLE_X_SIGN[position];\n\n\t\t\tconst onPointerMove = (e: PointerEvent): void => {\n\t\t\t\tconst deltaX: number = e.clientX - startX;\n\t\t\t\tconst newWidth: number = clampWidth(startWidth + deltaX * xSign);\n\t\t\t\tconst newHeight: number = Math.round(newWidth / aspectRatio);\n\n\t\t\t\tsetStyleProperties(img, {\n\t\t\t\t\twidth: `${newWidth}px`,\n\t\t\t\t\theight: `${newHeight}px`,\n\t\t\t\t});\n\n\t\t\t\tsizeIndicator.textContent = `${Math.round(newWidth)} \\u00D7 ${newHeight}`;\n\t\t\t};\n\n\t\t\tconst onPointerUp = (e: PointerEvent): void => {\n\t\t\t\tdocument.removeEventListener('pointermove', onPointerMove);\n\t\t\t\tdocument.removeEventListener('pointerup', onPointerUp);\n\n\t\t\t\tfigure.classList.remove('notectl-image--resizing');\n\t\t\t\tsizeIndicator.classList.remove('notectl-image__size-indicator--visible');\n\t\t\t\tclearGlobalResizeCursor();\n\n\t\t\t\tconst finalWidth: number = Math.round(img.getBoundingClientRect().width);\n\t\t\t\tconst finalHeight: number = Math.round(finalWidth / aspectRatio);\n\n\t\t\t\tcommitResize(nodeId, finalWidth, finalHeight);\n\n\t\t\t\t(e.target as HTMLElement | null)?.releasePointerCapture?.(e.pointerId);\n\t\t\t};\n\n\t\t\thandle.addEventListener('pointerdown', (e: PointerEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\n\t\t\t\tconst isRtl: boolean = getTextDirection(figure) === 'rtl';\n\t\t\t\txSign = getResizeXSign(position, isRtl);\n\n\t\t\t\tstartX = e.clientX;\n\t\t\t\tstartWidth = img.getBoundingClientRect().width;\n\t\t\t\tconst imgHeight: number = img.getBoundingClientRect().height;\n\t\t\t\taspectRatio = imgHeight > 0 ? startWidth / imgHeight : 1;\n\n\t\t\t\tfigure.classList.add('notectl-image--resizing');\n\t\t\t\tsizeIndicator.textContent = `${Math.round(startWidth)} \\u00D7 ${Math.round(imgHeight)}`;\n\t\t\t\tsizeIndicator.classList.add('notectl-image__size-indicator--visible');\n\t\t\t\tconst cursor: string = isRtl ? RTL_CURSOR_MAP[position] : HANDLE_CURSORS[position];\n\t\t\t\tsetGlobalResizeCursor(cursor, figure);\n\n\t\t\t\t(e.target as HTMLElement).setPointerCapture(e.pointerId);\n\t\t\t\tdocument.addEventListener('pointermove', onPointerMove);\n\t\t\t\tdocument.addEventListener('pointerup', onPointerUp);\n\t\t\t});\n\t\t}\n\n\t\tfunction createResizeOverlay(nodeId: BlockId): void {\n\t\t\tif (!config.resizable || resizeOverlay) return;\n\n\t\t\tresizeOverlay = document.createElement('div');\n\t\t\tresizeOverlay.className = 'notectl-image__resize-overlay';\n\t\t\tresizeOverlay.setAttribute('data-notectl-no-print', '');\n\n\t\t\tconst sizeIndicator: HTMLDivElement = document.createElement('div');\n\t\t\tsizeIndicator.className = 'notectl-image__size-indicator';\n\t\t\tresizeOverlay.appendChild(sizeIndicator);\n\n\t\t\tconst positions: readonly HandlePosition[] = ['nw', 'ne', 'sw', 'se'];\n\t\t\tfor (const pos of positions) {\n\t\t\t\tconst handle: HTMLDivElement = document.createElement('div');\n\t\t\t\thandle.className = `notectl-image__resize-handle notectl-image__resize-handle--${pos}`;\n\t\t\t\t// Pointer-only visual grips. Keyboard resize is provided via shortcuts\n\t\t\t\t// with live-region announcements (see registerResizeKeymaps), so these\n\t\t\t\t// decorative handles are hidden from assistive technology rather than\n\t\t\t\t// exposed with a misleading `separator` role.\n\t\t\t\thandle.setAttribute('aria-hidden', 'true');\n\t\t\t\tattachHandleListeners(handle, pos, nodeId, sizeIndicator);\n\t\t\t\tresizeOverlay.appendChild(handle);\n\t\t\t}\n\n\t\t\t// Keyboard hint (hidden from screenreaders, visual only)\n\t\t\tif (resolvedKeymap) {\n\t\t\t\tconst hintText: string = buildKeyboardHintText(resolvedKeymap, locale);\n\t\t\t\tif (hintText) {\n\t\t\t\t\tconst hint: HTMLDivElement = document.createElement('div');\n\t\t\t\t\thint.className = 'notectl-image__keyboard-hint';\n\t\t\t\t\thint.setAttribute('aria-hidden', 'true');\n\t\t\t\t\thint.textContent = hintText;\n\t\t\t\t\tresizeOverlay.appendChild(hint);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontainer.appendChild(resizeOverlay);\n\t\t}\n\n\t\tfunction removeResizeOverlay(): void {\n\t\t\tclearGlobalResizeCursor();\n\t\t\tif (resizeOverlay) {\n\t\t\t\tresizeOverlay.remove();\n\t\t\t\tresizeOverlay = null;\n\t\t\t}\n\t\t}\n\n\t\t// --- NodeView Interface ---\n\n\t\treturn {\n\t\t\tdom: figure,\n\t\t\tcontentDOM: null,\n\n\t\t\tupdate(updatedNode: BlockNode): boolean {\n\t\t\t\tif (updatedNode.type !== 'image') return false;\n\t\t\t\tcurrentNodeId = updatedNode.id;\n\t\t\t\tfigure.setAttribute('data-block-id', updatedNode.id);\n\t\t\t\tapplyAttrs(updatedNode);\n\t\t\t\treturn true;\n\t\t\t},\n\n\t\t\tselectNode(): void {\n\t\t\t\tfigure.classList.add('notectl-image--selected');\n\t\t\t\tcreateResizeOverlay(currentNodeId);\n\t\t\t},\n\n\t\t\tdeselectNode(): void {\n\t\t\t\tfigure.classList.remove('notectl-image--selected');\n\t\t\t\tremoveResizeOverlay();\n\t\t\t},\n\n\t\t\tdestroy(): void {\n\t\t\t\tremoveResizeOverlay();\n\t\t\t\t// Do NOT revoke blob URLs here — the URL may still be referenced\n\t\t\t\t// by the clipboard (cut/paste) or undo history. Blob URLs are\n\t\t\t\t// automatically released when the document is unloaded.\n\t\t\t},\n\t\t};\n\t};\n}\n","/**\n * Renders the image insert popup with file upload and URL input,\n * following the same pattern as FontSizePopup.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport { insertImage } from './ImageCommands.js';\nimport type { ImageLocale } from './ImageLocale.js';\n\n// --- Config ---\n\nexport interface ImagePopupConfig {\n\treadonly acceptedTypes: readonly string[];\n\treadonly locale: ImageLocale;\n\treadonly onFileInsert: (context: PluginContext, file: File) => void;\n\treadonly onClose: () => void;\n}\n\n// --- Public Entry Point ---\n\n/** Builds the image insert popup DOM inside the given container. */\nexport function renderImagePopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ImagePopupConfig,\n): void {\n\tcontainer.classList.add('notectl-image-popup');\n\n\tappendFileUploadSection(container, context, config);\n\tappendSeparator(container, config.locale);\n\tappendUrlSection(container, context, config);\n}\n\n// --- File Upload Section ---\n\nfunction appendFileUploadSection(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ImagePopupConfig,\n): void {\n\tconst fileInput: HTMLInputElement = document.createElement('input');\n\tfileInput.type = 'file';\n\tfileInput.accept = config.acceptedTypes.join(',');\n\tfileInput.className = 'notectl-image-popup__file-input';\n\n\tconst uploadBtn: HTMLButtonElement = document.createElement('button');\n\tuploadBtn.type = 'button';\n\tuploadBtn.textContent = config.locale.uploadFromComputer;\n\tuploadBtn.setAttribute('aria-label', config.locale.uploadAria);\n\tuploadBtn.className = 'notectl-image-popup__upload-btn';\n\n\tuploadBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t});\n\tuploadBtn.addEventListener('click', () => {\n\t\tfileInput.click();\n\t});\n\n\tfileInput.addEventListener('change', () => {\n\t\tconst file: File | undefined = fileInput.files?.[0];\n\t\tif (file) {\n\t\t\tconfig.onFileInsert(context, file);\n\t\t\tconfig.onClose();\n\t\t\tcontext.getContainer().focus();\n\t\t}\n\t});\n\n\tcontainer.appendChild(fileInput);\n\tcontainer.appendChild(uploadBtn);\n}\n\n// --- Separator ---\n\nfunction appendSeparator(container: HTMLElement, locale: ImageLocale): void {\n\tconst separator: HTMLDivElement = document.createElement('div');\n\tseparator.className = 'notectl-image-popup__separator';\n\n\tconst line1: HTMLSpanElement = document.createElement('span');\n\tline1.className = 'notectl-image-popup__separator-line';\n\n\tconst orText: HTMLSpanElement = document.createElement('span');\n\torText.textContent = locale.separator;\n\torText.className = 'notectl-image-popup__separator-text';\n\n\tconst line2: HTMLSpanElement = document.createElement('span');\n\tline2.className = 'notectl-image-popup__separator-line';\n\n\tseparator.appendChild(line1);\n\tseparator.appendChild(orText);\n\tseparator.appendChild(line2);\n\tcontainer.appendChild(separator);\n}\n\n// --- URL Input Section ---\n\nfunction appendUrlSection(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: ImagePopupConfig,\n): void {\n\tconst urlInput: HTMLInputElement = document.createElement('input');\n\turlInput.type = 'url';\n\turlInput.placeholder = config.locale.urlPlaceholder;\n\turlInput.setAttribute('aria-label', config.locale.urlAria);\n\turlInput.className = 'notectl-image-popup__url-input';\n\n\tconst insertBtn: HTMLButtonElement = document.createElement('button');\n\tinsertBtn.type = 'button';\n\tinsertBtn.textContent = config.locale.insertButton;\n\tinsertBtn.setAttribute('aria-label', config.locale.insertAria);\n\tinsertBtn.className = 'notectl-image-popup__insert-btn';\n\n\tconst applyUrl = (): void => {\n\t\tconst src: string = urlInput.value.trim();\n\t\tif (src) {\n\t\t\tinsertImage(context, { src });\n\t\t\tconfig.onClose();\n\t\t\tcontext.getContainer().focus();\n\t\t}\n\t};\n\n\tinsertBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t});\n\tinsertBtn.addEventListener('click', () => {\n\t\tapplyUrl();\n\t});\n\n\turlInput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Enter') {\n\t\t\te.preventDefault();\n\t\t\tapplyUrl();\n\t\t}\n\t});\n\n\tcontainer.appendChild(urlInput);\n\tcontainer.appendChild(insertBtn);\n\n\trequestAnimationFrame(() => urlInput.focus());\n}\n","/** Image insert popup styles (file upload + URL input). */\n.notectl-image-popup {\n\tpadding: 8px;\n\tmin-width: 240px;\n}\n\n.notectl-image-popup__file-input {\n\tposition: absolute;\n\twidth: 0;\n\theight: 0;\n\toverflow: hidden;\n\topacity: 0;\n}\n\n.notectl-image-popup__upload-btn {\n\tdisplay: block;\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tcursor: pointer;\n\ttext-align: center;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__separator {\n\tdisplay: flex;\n\talign-items: center;\n\tmargin: 8px 0;\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n}\n\n.notectl-image-popup__separator-line {\n\tflex: 1;\n\theight: 1px;\n\tbackground: var(--notectl-border);\n}\n\n.notectl-image-popup__separator-text {\n\tpadding: 0 8px;\n}\n\n.notectl-image-popup__url-input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-image-popup__insert-btn {\n\twidth: 100%;\n\tpadding: 8px 12px;\n\tmargin-top: 4px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n}\n","/**\n * Image plugin types, configuration, and service key.\n */\n\nimport { ServiceKey } from '../Plugin.js';\nimport type { ImageLocale } from './ImageLocale.js';\n\n// --- Image Attributes ---\n\nexport interface ImageAttrs {\n\treadonly src: string;\n\treadonly alt: string;\n\treadonly width?: number;\n\treadonly height?: number;\n\treadonly align: 'start' | 'center' | 'end';\n}\n\n// --- Upload Types ---\n\nexport interface ImageUploadResult {\n\treadonly url: string;\n\treadonly width?: number;\n\treadonly height?: number;\n}\n\nexport interface ImageUploadService {\n\tupload(file: File): Promise<ImageUploadResult>;\n}\n\nexport const IMAGE_UPLOAD_SERVICE = new ServiceKey<ImageUploadService>('image:upload');\n\nexport type UploadState = 'idle' | 'uploading' | 'complete' | 'error';\n\n// --- Keyboard Bindings ---\n\n/**\n * Configurable keyboard bindings for image resize actions.\n * Omit a slot to use the default; set to `null` to disable the binding.\n *\n * Key descriptor format: `'Mod-Shift-ArrowRight'`, etc.\n * `Mod` resolves to Cmd on macOS, Ctrl on Windows/Linux.\n */\nexport interface ImageKeymap {\n\treadonly growWidth?: string | null;\n\treadonly shrinkWidth?: string | null;\n\treadonly growWidthLarge?: string | null;\n\treadonly shrinkWidthLarge?: string | null;\n\treadonly resetSize?: string | null;\n}\n\nexport const DEFAULT_IMAGE_KEYMAP: Readonly<Record<keyof ImageKeymap, string>> = {\n\tgrowWidth: 'Mod-Shift-ArrowRight',\n\tshrinkWidth: 'Mod-Shift-ArrowLeft',\n\tgrowWidthLarge: 'Mod-Shift-Alt-ArrowRight',\n\tshrinkWidthLarge: 'Mod-Shift-Alt-ArrowLeft',\n\tresetSize: 'Mod-Shift-0',\n};\n\n// --- Configuration ---\n\nexport interface ImagePluginConfig {\n\treadonly maxWidth: number;\n\treadonly maxFileSize: number;\n\treadonly acceptedTypes: readonly string[];\n\treadonly resizable: boolean;\n\t/** Pixels to grow/shrink per small resize step. @default 10 */\n\treadonly resizeStep?: number;\n\t/** Pixels to grow/shrink per large resize step. @default 50 */\n\treadonly resizeStepLarge?: number;\n\t/** Customize keyboard bindings for image resize actions. */\n\treadonly keymap?: ImageKeymap;\n\t/** Locale override for user-facing strings. */\n\treadonly locale?: ImageLocale;\n}\n\nexport const DEFAULT_IMAGE_CONFIG: ImagePluginConfig = {\n\tmaxWidth: 800,\n\tmaxFileSize: 10 * 1024 * 1024,\n\tacceptedTypes: ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/svg+xml'],\n\tresizable: true,\n\tresizeStep: 10,\n\tresizeStepLarge: 50,\n};\n","/**\n * ImagePlugin: registers an image void block type with NodeSpec,\n * NodeView, commands, file handler, toolbar button, and accessible\n * keyboard resize with screenreader announcements.\n */\n\nimport IMAGE_CSS from '../../editor/styles/image.css?inline';\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport { isNodeSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport {\n\tinsertImage,\n\tregisterImageCommands,\n\tresetImageSize,\n\tresizeImageByDelta,\n} from './ImageCommands.js';\nimport { IMAGE_LOCALE_EN, type ImageLocale, loadImageLocale } from './ImageLocale.js';\nimport { createImageNodeViewFactory } from './ImageNodeView.js';\nimport { renderImagePopup } from './ImagePopup.js';\nimport IMAGE_POPUP_CSS from './ImagePopupStyles.css?inline';\nimport {\n\tDEFAULT_IMAGE_CONFIG,\n\tDEFAULT_IMAGE_KEYMAP,\n\tIMAGE_UPLOAD_SERVICE,\n\ttype ImageKeymap,\n\ttype ImagePluginConfig,\n\ttype UploadState,\n} from './ImageUpload.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\timage: {\n\t\t\tsrc: string;\n\t\t\talt: string;\n\t\t\ttitle?: string;\n\t\t\twidth?: number;\n\t\t\theight?: number;\n\t\t\talign: 'start' | 'center' | 'end';\n\t\t};\n\t}\n\tinterface InlineNodeAttrRegistry {\n\t\timage_inline: { src: string; alt: string; title?: string };\n\t}\n}\n\n// --- Plugin ---\n\nexport class ImagePlugin implements Plugin {\n\treadonly id = 'image';\n\treadonly name = 'Image';\n\treadonly priority = 45;\n\n\tprivate readonly config: ImagePluginConfig;\n\tprivate readonly resolvedKeymap: Readonly<Record<keyof ImageKeymap, string | null>>;\n\tprivate readonly uploadStates = new Map<BlockId, UploadState>();\n\tprivate readonly blobUrls = new Set<string>();\n\tprivate context: PluginContext | null = null;\n\tprivate locale!: ImageLocale;\n\n\tconstructor(config?: Partial<ImagePluginConfig>) {\n\t\tthis.config = { ...DEFAULT_IMAGE_CONFIG, ...config };\n\t\tthis.resolvedKeymap = { ...DEFAULT_IMAGE_KEYMAP, ...config?.keymap };\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\tIMAGE_LOCALE_EN,\n\t\t\tloadImageLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(IMAGE_CSS);\n\t\tcontext.registerStyleSheet(IMAGE_POPUP_CSS);\n\t\tthis.context = context;\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerInlineImageNodeSpec(context);\n\t\tthis.registerNodeView(context);\n\t\tregisterImageCommands(context);\n\t\tthis.registerResizeCommands(context);\n\t\tthis.registerResizeKeymaps(context);\n\t\tthis.registerFileHandler(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tdestroy(): void {\n\t\tfor (const url of this.blobUrls) {\n\t\t\tURL.revokeObjectURL(url);\n\t\t}\n\t\tthis.blobUrls.clear();\n\t\tthis.uploadStates.clear();\n\t\tthis.context = null;\n\t}\n\n\tonStateChange(oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tif (!this.context) return;\n\n\t\t// Clean up upload states for removed blocks (searches full tree)\n\t\tfor (const id of this.uploadStates.keys()) {\n\t\t\tif (!newState.getBlock(id)) {\n\t\t\t\tthis.uploadStates.delete(id);\n\t\t\t}\n\t\t}\n\n\t\t// Announce image selection for screenreaders\n\t\tconst oldIsImage: boolean = this.isImageSelected(oldState);\n\t\tconst nowIsImage: boolean = this.isImageSelected(newState);\n\n\t\tif (!oldIsImage && nowIsImage) {\n\t\t\tthis.announceImageSelection(newState);\n\t\t}\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tconst locale = this.locale;\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'image',\n\t\t\tgroup: 'block',\n\t\t\tisVoid: true,\n\t\t\tselectable: true,\n\t\t\tattrs: {\n\t\t\t\tsrc: { default: '' },\n\t\t\t\talt: { default: '' },\n\t\t\t\ttitle: { default: '' },\n\t\t\t\talign: { default: 'center' },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst figure = createBlockElement('figure', node.id);\n\t\t\t\tfigure.className = 'notectl-image';\n\t\t\t\tfigure.setAttribute('data-void', 'true');\n\t\t\t\tfigure.setAttribute('data-selectable', 'true');\n\n\t\t\t\tconst imgContainer: HTMLDivElement = document.createElement('div');\n\t\t\t\timgContainer.className = 'notectl-image__container';\n\n\t\t\t\tconst alt: string = (node.attrs?.alt as string | undefined) ?? '';\n\t\t\t\tconst width: number | undefined = node.attrs?.width as number | undefined;\n\t\t\t\tconst height: number | undefined = node.attrs?.height as number | undefined;\n\n\t\t\t\tconst img: HTMLImageElement = document.createElement('img');\n\t\t\t\timg.className = 'notectl-image__img';\n\t\t\t\timg.src = (node.attrs?.src as string | undefined) ?? '';\n\t\t\t\timg.alt = alt;\n\t\t\t\tconst titleAttr: string = (node.attrs?.title as string | undefined) ?? '';\n\t\t\t\tif (titleAttr) img.title = titleAttr;\n\t\t\t\timg.draggable = false;\n\n\t\t\t\tif (width !== undefined) setStyleProperty(img, 'width', `${width}px`);\n\t\t\t\tif (height !== undefined) setStyleProperty(img, 'height', `${height}px`);\n\n\t\t\t\tconst align: string = (node.attrs?.align as string | undefined) ?? 'center';\n\t\t\t\tconst alignClass: string | undefined = {\n\t\t\t\t\tstart: 'notectl-image--start',\n\t\t\t\t\tcenter: 'notectl-image--center',\n\t\t\t\t\tend: 'notectl-image--end',\n\t\t\t\t}[align];\n\t\t\t\tif (alignClass) figure.classList.add(alignClass);\n\n\t\t\t\tfigure.setAttribute('aria-label', locale.imageAria(alt, width, height));\n\n\t\t\t\timgContainer.appendChild(img);\n\t\t\t\tfigure.appendChild(imgContainer);\n\t\t\t\treturn figure;\n\t\t\t},\n\t\t\ttoHTML(node) {\n\t\t\t\tconst src: string = escapeHTML((node.attrs?.src as string | undefined) ?? '');\n\t\t\t\tconst alt: string = escapeHTML((node.attrs?.alt as string | undefined) ?? '');\n\t\t\t\tconst width: number | undefined = node.attrs?.width as number | undefined;\n\t\t\t\tconst height: number | undefined = node.attrs?.height as number | undefined;\n\n\t\t\t\tconst sizeAttrs: string =\n\t\t\t\t\t(width !== undefined ? ` width=\"${width}\"` : '') +\n\t\t\t\t\t(height !== undefined ? ` height=\"${height}\"` : '');\n\n\t\t\t\t// Alignment is handled by the serializer's alignment injection,\n\t\t\t\t// which works in both inline-style and CSS-class modes.\n\t\t\t\tconst titleValue: string = (node.attrs?.title as string | undefined) ?? '';\n\t\t\t\tconst titleHTML: string = titleValue ? ` title=\"${escapeHTML(titleValue)}\"` : '';\n\t\t\t\treturn `<figure><img src=\"${src}\" alt=\"${alt}\"${titleHTML}${sizeAttrs}></figure>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'figure',\n\t\t\t\t\tgetAttrs(el) {\n\t\t\t\t\t\tconst img: HTMLImageElement | null = el.querySelector('img');\n\t\t\t\t\t\tif (!img) return false;\n\t\t\t\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t\t\t\tsrc: img.getAttribute('src') ?? '',\n\t\t\t\t\t\t\talt: img.getAttribute('alt') ?? '',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst width: string | null = img.getAttribute('width');\n\t\t\t\t\t\tconst height: string | null = img.getAttribute('height');\n\t\t\t\t\t\tif (width) attrs.width = Number.parseInt(width, 10);\n\t\t\t\t\t\tif (height) attrs.height = Number.parseInt(height, 10);\n\n\t\t\t\t\t\tconst title: string | null = img.getAttribute('title');\n\t\t\t\t\t\tif (title) attrs.title = title;\n\n\t\t\t\t\t\t// Check inline style first, then class names (new + legacy)\n\t\t\t\t\t\tconst textAlign: string = el.style?.textAlign ?? '';\n\t\t\t\t\t\tif (textAlign === 'start' || textAlign === 'end' || textAlign === 'center') {\n\t\t\t\t\t\t\tattrs.align = textAlign;\n\t\t\t\t\t\t} else if (textAlign === 'left') {\n\t\t\t\t\t\t\tattrs.align = 'start';\n\t\t\t\t\t\t} else if (textAlign === 'right') {\n\t\t\t\t\t\t\tattrs.align = 'end';\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-start') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-left') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--start') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--left')\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tattrs.align = 'start';\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-end') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-align-right') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--end') ||\n\t\t\t\t\t\t\tel.classList.contains('notectl-image--right')\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tattrs.align = 'end';\n\t\t\t\t\t\t} else if (el.classList.contains('notectl-align-center')) {\n\t\t\t\t\t\t\tattrs.align = 'center';\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn attrs;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttag: 'img',\n\t\t\t\t\tgetAttrs(el) {\n\t\t\t\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t\t\t\tsrc: el.getAttribute('src') ?? '',\n\t\t\t\t\t\t\talt: el.getAttribute('alt') ?? '',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst width: string | null = el.getAttribute('width');\n\t\t\t\t\t\tconst height: string | null = el.getAttribute('height');\n\t\t\t\t\t\tif (width) attrs.width = Number.parseInt(width, 10);\n\t\t\t\t\t\tif (height) attrs.height = Number.parseInt(height, 10);\n\t\t\t\t\t\tconst title: string | null = el.getAttribute('title');\n\t\t\t\t\t\tif (title) attrs.title = title;\n\t\t\t\t\t\treturn attrs;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['figure', 'img'],\n\t\t\t\tattrs: ['src', 'alt', 'title', 'width', 'height', 'class', 'style'],\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Registers a minimal inline image node (D7) so mid-paragraph images (badge\n\t * rows, inline icons) round-trip faithfully without splitting the paragraph.\n\t * Atomic and `contenteditable=\"false\"`, mirroring other inline nodes.\n\t */\n\tprivate registerInlineImageNodeSpec(context: PluginContext): void {\n\t\tcontext.registerInlineNodeSpec({\n\t\t\ttype: 'image_inline',\n\t\t\tgroup: 'inline',\n\t\t\tattrs: {\n\t\t\t\tsrc: { default: '' },\n\t\t\t\talt: { default: '' },\n\t\t\t\ttitle: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst img: HTMLImageElement = document.createElement('img');\n\t\t\t\timg.className = 'notectl-image-inline';\n\t\t\t\timg.setAttribute('contenteditable', 'false');\n\t\t\t\timg.src = String(node.attrs.src ?? '');\n\t\t\t\timg.alt = String(node.attrs.alt ?? '');\n\t\t\t\tconst title: string = String(node.attrs.title ?? '');\n\t\t\t\tif (title) img.title = title;\n\t\t\t\timg.draggable = false;\n\t\t\t\treturn img;\n\t\t\t},\n\t\t\ttoHTMLString(node) {\n\t\t\t\tconst src: string = escapeHTML(String(node.attrs.src ?? ''));\n\t\t\t\tconst alt: string = escapeHTML(String(node.attrs.alt ?? ''));\n\t\t\t\tconst title: string = String(node.attrs.title ?? '');\n\t\t\t\tconst titleAttr: string = title ? ` title=\"${escapeHTML(title)}\"` : '';\n\t\t\t\treturn `<img src=\"${src}\" alt=\"${alt}\"${titleAttr}>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'img',\n\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\tconst attrs: Record<string, string> = {\n\t\t\t\t\t\t\tsrc: el.getAttribute('src') ?? '',\n\t\t\t\t\t\t\talt: el.getAttribute('alt') ?? '',\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst title: string | null = el.getAttribute('title');\n\t\t\t\t\t\tif (title) attrs.title = title;\n\t\t\t\t\t\treturn attrs;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['img'], attrs: ['src', 'alt', 'title'] },\n\t\t});\n\t}\n\n\tprivate registerNodeView(context: PluginContext): void {\n\t\tcontext.registerNodeView(\n\t\t\t'image',\n\t\t\tcreateImageNodeViewFactory(this.config, this.uploadStates, this.resolvedKeymap, this.locale),\n\t\t);\n\t}\n\n\tprivate registerResizeCommands(context: PluginContext): void {\n\t\tconst step: number = this.config.resizeStep ?? 10;\n\t\tconst stepLarge: number = this.config.resizeStepLarge ?? 50;\n\t\tconst maxWidth: number = this.config.maxWidth;\n\n\t\tcontext.registerCommand('resizeImageGrow', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, step, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageShrink', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, -step, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageGrowLarge', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, stepLarge, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageShrinkLarge', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, -stepLarge, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resetImageSize', () => {\n\t\t\tconst result: boolean = resetImageSize(context);\n\t\t\tif (result) context.announce(this.locale.resetToNaturalSize);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tprivate registerResizeKeymaps(context: PluginContext): void {\n\t\tconst bindings: Record<string, () => boolean> = {};\n\t\tconst commands: Record<keyof ImageKeymap, string> = {\n\t\t\tgrowWidth: 'resizeImageGrow',\n\t\t\tshrinkWidth: 'resizeImageShrink',\n\t\t\tgrowWidthLarge: 'resizeImageGrowLarge',\n\t\t\tshrinkWidthLarge: 'resizeImageShrinkLarge',\n\t\t\tresetSize: 'resetImageSize',\n\t\t};\n\n\t\tfor (const [slot, commandName] of Object.entries(commands)) {\n\t\t\tconst binding: string | null = this.resolvedKeymap[slot as keyof ImageKeymap] ?? null;\n\t\t\tif (binding) {\n\t\t\t\tbindings[binding] = () => context.executeCommand(commandName);\n\t\t\t}\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\tprivate registerFileHandler(context: PluginContext): void {\n\t\tcontext.registerFileHandler('image/*', async (file, _position) => {\n\t\t\tif (!this.isAcceptedType(file.type)) return false;\n\t\t\tthis.handleFileInsert(context, file);\n\t\t\treturn true;\n\t\t});\n\t}\n\n\tprivate handleFileInsert(context: PluginContext, file: File): void {\n\t\tif (file.size > this.config.maxFileSize) return;\n\n\t\tconst blobUrl: string = URL.createObjectURL(file);\n\t\tthis.blobUrls.add(blobUrl);\n\n\t\tconst inserted: boolean = insertImage(context, { src: blobUrl });\n\t\tif (!inserted) {\n\t\t\tURL.revokeObjectURL(blobUrl);\n\t\t\tthis.blobUrls.delete(blobUrl);\n\t\t\treturn;\n\t\t}\n\n\t\t// Find the newly inserted image block\n\t\tconst state: EditorState = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\t\tconst imageBlockId: BlockId = sel.nodeId;\n\n\t\tthis.uploadStates.set(imageBlockId, 'uploading');\n\n\t\t// Upload if service is registered\n\t\tconst uploadService = context.getService(IMAGE_UPLOAD_SERVICE);\n\t\tif (uploadService) {\n\t\t\tthis.uploadFile(context, file, imageBlockId, blobUrl);\n\t\t} else {\n\t\t\tthis.uploadStates.set(imageBlockId, 'complete');\n\t\t}\n\t}\n\n\tprivate async uploadFile(\n\t\tcontext: PluginContext,\n\t\tfile: File,\n\t\timageBlockId: BlockId,\n\t\tblobUrl: string,\n\t): Promise<void> {\n\t\tconst uploadService = context.getService(IMAGE_UPLOAD_SERVICE);\n\t\tif (!uploadService) return;\n\n\t\ttry {\n\t\t\tconst result = await uploadService.upload(file);\n\t\t\tthis.uploadStates.set(imageBlockId, 'complete');\n\n\t\t\t// Replace blob URL with uploaded URL\n\t\t\tconst state: EditorState = context.getState();\n\t\t\tconst block: BlockNode | undefined = state.getBlock(imageBlockId);\n\t\t\tif (!block) return;\n\n\t\t\tconst path: BlockId[] | undefined = state.getNodePath(imageBlockId);\n\t\t\tif (!path) return;\n\n\t\t\tconst merged: BlockAttrs = {\n\t\t\t\t...(block.attrs ?? {}),\n\t\t\t\tsrc: result.url,\n\t\t\t\t...(result.width !== undefined ? { width: result.width } : {}),\n\t\t\t\t...(result.height !== undefined ? { height: result.height } : {}),\n\t\t\t};\n\n\t\t\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, merged).build();\n\t\t\tcontext.dispatch(tr);\n\n\t\t\t// Clean up blob URL\n\t\t\tURL.revokeObjectURL(blobUrl);\n\t\t\tthis.blobUrls.delete(blobUrl);\n\t\t} catch {\n\t\t\tthis.uploadStates.set(imageBlockId, 'error');\n\t\t\tcontext.announce(this.locale.uploadFailed);\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=\"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'image',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.insertImage,\n\t\t\ttooltip: this.locale.insertImageTooltip,\n\t\t\tcommand: 'insertImage',\n\t\t\tpopupType: 'custom',\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\trenderImagePopup(container, ctx, {\n\t\t\t\t\tacceptedTypes: this.config.acceptedTypes,\n\t\t\t\t\tlocale: this.locale,\n\t\t\t\t\tonFileInsert: (c, file) => this.handleFileInsert(c, file),\n\t\t\t\t\tonClose,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate isAcceptedType(mimeType: string): boolean {\n\t\treturn this.config.acceptedTypes.some(\n\t\t\t(accepted) =>\n\t\t\t\taccepted === mimeType ||\n\t\t\t\t(accepted.endsWith('/*') && mimeType.startsWith(accepted.slice(0, -1))),\n\t\t);\n\t}\n\n\tprivate isImageSelected(state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return false;\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\treturn block?.type === 'image';\n\t}\n\n\tprivate announceImageSelection(state: EditorState): void {\n\t\tif (!this.context) return;\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\tif (!block || block.type !== 'image') return;\n\n\t\tconst alt: string = (block.attrs?.alt as string | undefined) ?? '';\n\t\tconst width: number | undefined = block.attrs?.width as number | undefined;\n\t\tconst height: number | undefined = block.attrs?.height as number | undefined;\n\n\t\tconst parts: string[] = [this.locale.imageSelected];\n\t\tif (alt) parts.push(`${this.locale.altTextPrefix}${alt}.`);\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tparts.push(this.locale.imageSizeAnnounce(width, height));\n\t\t}\n\n\t\tconst shrinkKey: string | null = this.resolvedKeymap.shrinkWidth ?? null;\n\t\tconst growKey: string | null = this.resolvedKeymap.growWidth ?? null;\n\t\tif (shrinkKey && growKey) {\n\t\t\tparts.push(this.locale.resizeHint(formatShortcut(shrinkKey), formatShortcut(growKey)));\n\t\t}\n\n\t\tthis.context.announce(parts.join(' '));\n\t}\n\n\tprivate announceCurrentSize(context: PluginContext): void {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\tif (!block || block.type !== 'image') return;\n\n\t\tconst width: number | undefined = block.attrs?.width as number | undefined;\n\t\tconst height: number | undefined = block.attrs?.height as number | undefined;\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tcontext.announce(this.locale.imageResized(width, height));\n\t\t}\n\t}\n}\n"],"mappings":"4mBCqBA,SAAgB,EACf,EACA,GAEA,MAAM,EAAQ,EAAQ,WAChB,EAAM,EAAM,UAEZ,EAAyB,CAC9B,IAAK,EAAM,IACX,IAAK,EAAM,KAAO,GAClB,MAAO,EAAM,OAAS,iBACF,IAAhB,EAAM,MAAsB,CAAE,MAAO,EAAM,OAAU,CAAC,UACrC,IAAjB,EAAM,OAAuB,CAAE,OAAQ,EAAM,QAAW,CAAC,GAG9D,GAAI,EAAY,GAAM,OAAO,EAE7B,MAAM,EAAyB,EAAgB,GAAO,EAAI,OAAS,EAAI,OAAO,QAGxE,EASP,SAA+B,EAAoB,GAElD,GAAoB,eADiB,EAAM,SAAS,IACzC,KAAuB,OAAO,EAEzC,MAAM,EAA8B,EAAM,YAAY,GACtD,GAAK,EAEL,IAAK,MAAM,KAAM,EAEhB,GAAmB,eADiB,EAAM,SAAS,IACzC,KAAuB,OAAO,CAG1C,CArBqC,CAAsB,EAAO,GACjE,OAAI,EAwCL,SACC,EACA,EACA,EACA,GAEA,MAAM,EAAkC,EAAM,YAAY,GAC1D,IAA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hBzG.mjs";import{c as i,f as o,n as l}from"./Selection-DC6AOGgF.mjs";import{i as s}from"./TypeBrands-Ch9856Gb.mjs";import{i as a,r as c,t as u}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as m,n as p,o as d}from"./PluginHelpers-B3gk3VB3.mjs";import{t as h}from"./ShortcutFormatting-TwiufqeV.mjs";var f={label:"Link",tooltip:t=>`Insert Link (${t})`,removeLink:"Remove Link",removeLinkAria:"Remove link",urlPlaceholder:"https://...",urlAria:"Link URL",apply:"Apply",applyAria:"Apply link",invalidUrl:"Only http(s), mailto, tel, fragments, and relative paths are allowed."},g=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Ctrv6cIi.mjs"),"./locales/de.ts":()=>import("./de-JhGflzS5.mjs"),"./locales/es.ts":()=>import("./es-Bv7bDbMp.mjs"),"./locales/fr.ts":()=>import("./fr-DtzIu6tU.mjs"),"./locales/hi.ts":()=>import("./hi-Bu799xIO.mjs"),"./locales/pt.ts":()=>import("./pt-DmN9u3NX.mjs"),"./locales/ru.ts":()=>import("./ru-BxySx7an.mjs"),"./locales/zh.ts":()=>import("./zh-DuucmOns.mjs")});async function k(t){return m(g,t,f)}var v={openInNewTab:!0},b=/(?:^|[^!])(\[([^\]\uFFFC]+)\]\(([^)\s\uFFFC]+)(?:\s+"([^"\uFFFC]*)")?\))$/,L=/(<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^<>\s\uFFFC]+)>)$/;function C(t,e){return e&&!t.startsWith("#")}var A=class{id="link";name="Link";priority=25;config;locale;fragmentClickContainer=null;fragmentClickHandler=null;constructor(t){this.config={...v,...t}}async init(t){this.locale=await d(t,this.config.locale,f,k),this.registerMarkSpec(t),this.registerCommands(t),this.registerKeymap(t),this.registerToolbarItem(t),!1!==this.config.inputRule&&this.registerInputRules(t),this.installFragmentClickHandler(t)}destroy(){this.removeFragmentClickHandler()}registerInputRules(t){const n=(t,e,n,r,i,o,a)=>{const c={href:o};return a&&(c.title=a),t.transaction("input").deleteTextAt(e,n,r).insertText(e,n,i,[{type:s("link"),attrs:c}]).setSelection(l(e,n+i.length)).build()};t.registerInputRule({pattern:b,handler(t,r,l,s){const a=t.selection;if(!o(a)||!i(a))return null;const c=t.getBlock(a.anchor.blockId);if(!c||"code_block"===c.type)return null;const u=r[1],m=r[2],p=r[3],d=r[4];if(!u||!m||!p)return null;const h=e(p);return""===h?null:n(t,a.anchor.blockId,s-u.length,s,m,h,d)}}),t.registerInputRule({pattern:L,handler(t,r,l,s){const a=t.selection;if(!o(a)||!i(a))return null;const c=t.getBlock(a.anchor.blockId);if(!c||"code_block"===c.type)return null;const u=r[1],m=r[2];if(!u||!m)return null;const p=e(m);return""===p?null:n(t,a.anchor.blockId,s-u.length,s,m,p)}})}registerMarkSpec(n){const r=this.config.openInNewTab;n.registerMarkSpec({type:"link",rank:10,inclusive:!1,attrs:{href:{default:""},title:{default:""}},toDOM(t){const n=document.createElement("a"),i=e(String(t.attrs?.href??""));n.setAttribute("href",i);const o=String(t.attrs?.title??"");return o&&n.setAttribute("title",o),C(i,r)&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer")),n},toHTMLString:(n,i)=>{const o=e(String(n.attrs?.href??"")),l=t(o),s=String(n.attrs?.title??""),a=s?` title="${t(s)}"`:"";return C(o,r)?`<a href="${l}"${a} target="_blank" rel="noopener noreferrer">${i}</a>`:`<a href="${l}"${a}>${i}</a>`},parseHTML:[{tag:"a",getAttrs:t=>{const n=e(t.getAttribute("href")??""),r=t.getAttribute("title")??"";return r?{href:n,title:r}:{href:n}}}],sanitize:{tags:["a"],attrs:["href","title","target","rel"]}})}installFragmentClickHandler(t){this.removeFragmentClickHandler();const e=t.getContainer(),r=t=>{if(t.defaultPrevented||0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;const r=function(t,e){let n=e instanceof Element?e:e instanceof Node?e.parentElement:null;for(;n&&t.contains(n);){if(n instanceof HTMLAnchorElement)return n;if(n===t)break;n=n.parentElement}return null}(e,t.target);if(!r)return;const i=n(r.getAttribute("href")??"");if(0===i.length)return;const o=function(t,e){for(const n of e){if(t.id===n)return t;const e=t.getElementsByTagName("*");for(let t=0;t<e.length;t++){const r=e.item(t);if(r?.id===n)return r}}return null}(e,i);o&&(t.preventDefault(),o.scrollIntoView())};this.fragmentClickContainer=e,this.fragmentClickHandler=r,e.addEventListener("click",r)}removeFragmentClickHandler(){this.fragmentClickContainer&&this.fragmentClickHandler&&this.fragmentClickContainer.removeEventListener("click",this.fragmentClickHandler),this.fragmentClickContainer=null,this.fragmentClickHandler=null}registerCommands(t){t.registerCommand("toggleLink",()=>{const e=t.getState();return this.toggleLink(t,e)}),t.registerCommand("setLink",()=>!1),t.registerCommand("removeLink",()=>{const e=t.getState();return this.removeLink(t,e)})}registerKeymap(t){t.registerKeymap({"Mod-K":()=>t.executeCommand("toggleLink")})}registerToolbarItem(t){t.registerToolbarItem({id:"link",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(h("Mod-K")),command:"toggleLink",popupType:"custom",renderPopup:(t,e,n)=>{this.renderLinkPopup(t,e,n)},isActive:t=>this.isLinkActive(t),isEnabled:t=>!i(t.selection)})}isLinkActive(t){return c(t,"link")}toggleLink(t,e){return!!this.isLinkActive(e)&&this.removeLink(t,e)}addLink(t,e,n){const r=e.selection;if(!o(r))return!1;if(i(r))return!1;const l={type:s("link"),attrs:{href:n}};return p(t,u(e,l))}removeLink(t,e){const n=e.selection;if(!o(n))return!1;if(i(n)){const i=e.getBlock(n.anchor.blockId);if(!i)return!1;const o=[];let l=0;for(const t of i.children){if(!("text"in t))continue;const e=l+t.text.length;o.push({pos:l,end:e,hasLink:r(t.marks,s("link"))}),l=e}const a=o.findIndex(t=>n.anchor.offset>=t.pos&&n.anchor.offset<=t.end),c=a>=0?o[a]:void 0;if(-1===a||!c?.hasLink)return!1;let u=a;for(;u>0&&o[u-1]?.hasLink;)u--;let m=a;for(;m<o.length-1&&o[m+1]?.hasLink;)m++;const p=o[u],d=o[m];if(!p||!d)return!1;const h=p.pos,f=d.end,g=e.transaction("command");return g.removeMark(n.anchor.blockId,h,f,{type:s("link")}),g.setSelection(n),t.dispatch(g.build()),!0}return p(t,a(e,s("link")))}renderLinkPopup(t,n,r){t.classList.add("notectl-link-popup");const i=n.getState();if(this.isLinkActive(i)){const e=document.createElement("button");e.type="button",e.className="notectl-link-popup__button",e.textContent=this.locale.removeLink,e.setAttribute("aria-label",this.locale.removeLinkAria),e.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),e.addEventListener("click",()=>{n.executeCommand("removeLink"),r(),n.getContainer().focus()}),t.appendChild(e)}else{const i=document.createElement("input");i.type="url",i.className="notectl-link-popup__input",i.placeholder=this.locale.urlPlaceholder,i.setAttribute("aria-label",this.locale.urlAria);const o=document.createElement("button");o.type="button",o.className="notectl-link-popup__button notectl-link-popup__button--apply",o.textContent=this.locale.apply,o.setAttribute("aria-label",this.locale.applyAria);const l=document.createElement("div");l.className="notectl-link-popup__error",l.setAttribute("role","alert"),l.hidden=!0;const s=()=>{const t=i.value.trim();if(""===t)return;const o=e(t);if(""===o)return l.textContent=this.locale.invalidUrl,l.hidden=!1,i.setAttribute("aria-invalid","true"),void i.focus();l.hidden=!0,i.removeAttribute("aria-invalid"),this.addLink(n,n.getState(),o),r(),n.getContainer().focus()};o.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),o.addEventListener("click",()=>{s()}),i.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),s())}),i.addEventListener("input",()=>{l.hidden||(l.hidden=!0,i.removeAttribute("aria-invalid"))}),t.appendChild(i),t.appendChild(o),t.appendChild(l),requestAnimationFrame(()=>i.focus())}}};export{f as n,k as r,A as t};
2
- //# sourceMappingURL=LinkPlugin-BuzrXo2c.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LinkPlugin-BuzrXo2c.mjs","names":[],"sources":["../../src/plugins/link/LinkLocale.ts","../../src/plugins/link/LinkPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the LinkPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface LinkLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly removeLink: string;\n\treadonly removeLinkAria: string;\n\treadonly urlPlaceholder: string;\n\treadonly urlAria: string;\n\treadonly apply: string;\n\treadonly applyAria: string;\n\treadonly invalidUrl: string;\n}\n\n// --- Default English Locale ---\n\nexport const LINK_LOCALE_EN: LinkLocale = {\n\tlabel: 'Link',\n\ttooltip: (shortcut: string) => `Insert Link (${shortcut})`,\n\tremoveLink: 'Remove Link',\n\tremoveLinkAria: 'Remove link',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Link URL',\n\tapply: 'Apply',\n\tapplyAria: 'Apply link',\n\tinvalidUrl: 'Only http(s), mailto, tel, fragments, and relative paths are allowed.',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<LinkLocale> = import.meta.glob<{\n\tdefault: LinkLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadLinkLocale(lang: string): Promise<LinkLocale> {\n\treturn loadLocaleModule(localeModules, lang, LINK_LOCALE_EN);\n}\n","/**\n * LinkPlugin: registers a link mark type with href attribute,\n * toggle command, keyboard shortcut (Mod-K), and toolbar button\n * with a URL input popup.\n */\n\nimport {\n\tapplyAttributedMark,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { hasMark } from '../../model/Document.js';\nimport { escapeHTML, fragmentIdentifiers, sanitizeHref } from '../../model/HTMLUtils.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent, resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { LINK_LOCALE_EN, type LinkLocale, loadLinkLocale } from './LinkLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tlink: { href: string; title?: string };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface LinkConfig {\n\t/** Whether to add rel=\"noopener noreferrer\" and target=\"_blank\" by default. */\n\treadonly openInNewTab: boolean;\n\t/** Live Markdown shortcuts: `[text](url \"title\")` and `<url>` autolink. Default true. */\n\treadonly inputRule?: boolean;\n\treadonly locale?: LinkLocale;\n}\n\nconst DEFAULT_CONFIG: LinkConfig = {\n\topenInNewTab: true,\n};\n\n// The inline-node placeholder (U+FFFC) is excluded from every re-inserted\n// capture so a live link rule never spans an inline node nor writes the\n// sentinel back as literal text.\n/** `[text](url \"optional title\")`, not preceded by `!` (which would be an image). */\nconst LINK_RULE = /(?:^|[^!])(\\[([^\\]\\uFFFC]+)\\]\\(([^)\\s\\uFFFC]+)(?:\\s+\"([^\"\\uFFFC]*)\")?\\))$/;\n/** `<scheme:...>` autolink. */\nconst AUTOLINK_RULE = /(<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^<>\\s\\uFFFC]+)>)$/;\n\n/** Fragment-only links stay in the current editor even when external links open in a new tab. */\nfunction shouldOpenInNewTab(href: string, openInNewTab: boolean): boolean {\n\treturn openInNewTab && !href.startsWith('#');\n}\n\n/** Finds the clicked anchor without interpolating user-controlled data into a CSS selector. */\nfunction findClickedAnchor(\n\tcontainer: HTMLElement,\n\ttarget: EventTarget | null,\n): HTMLAnchorElement | null {\n\tlet element: Element | null =\n\t\ttarget instanceof Element ? target : target instanceof Node ? target.parentElement : null;\n\n\twhile (element && container.contains(element)) {\n\t\tif (element instanceof HTMLAnchorElement) return element;\n\t\tif (element === container) break;\n\t\telement = element.parentElement;\n\t}\n\n\treturn null;\n}\n\n/** Resolves an ID inside this editor by direct string comparison, never through a CSS selector. */\nfunction findFragmentTarget(\n\tcontainer: HTMLElement,\n\tidentifiers: readonly string[],\n): Element | null {\n\tfor (const identifier of identifiers) {\n\t\tif (container.id === identifier) return container;\n\n\t\tconst descendants: HTMLCollectionOf<Element> = container.getElementsByTagName('*');\n\t\tfor (let index = 0; index < descendants.length; index++) {\n\t\t\tconst descendant: Element | null = descendants.item(index);\n\t\t\tif (descendant?.id === identifier) return descendant;\n\t\t}\n\t}\n\n\treturn null;\n}\n\n// --- Plugin ---\n\nexport class LinkPlugin implements Plugin {\n\treadonly id = 'link';\n\treadonly name = 'Link';\n\treadonly priority = 25;\n\n\tprivate readonly config: LinkConfig;\n\tprivate locale!: LinkLocale;\n\tprivate fragmentClickContainer: HTMLElement | null = null;\n\tprivate fragmentClickHandler: ((event: MouseEvent) => void) | null = null;\n\n\tconstructor(config?: Partial<LinkConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LINK_LOCALE_EN, loadLinkLocale);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t\tif (this.config.inputRule !== false) {\n\t\t\tthis.registerInputRules(context);\n\t\t}\n\t\tthis.installFragmentClickHandler(context);\n\t}\n\n\tdestroy(): void {\n\t\tthis.removeFragmentClickHandler();\n\t}\n\n\t/**\n\t * Live Markdown link rules: `[text](url \"title\")` and `<url>` autolink. Bespoke\n\t * (not the shared wrapping-mark helper) because links carry an `href`/`title`\n\t * attribute and two capture groups (D6).\n\t */\n\tprivate registerInputRules(context: PluginContext): void {\n\t\tconst buildLink = (\n\t\t\tstate: EditorState,\n\t\t\tblockId: BlockNode['id'],\n\t\t\tstart: number,\n\t\t\tend: number,\n\t\t\ttext: string,\n\t\t\thref: string,\n\t\t\ttitle?: string,\n\t\t) => {\n\t\t\tconst attrs: Record<string, string> = { href };\n\t\t\tif (title) attrs.title = title;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.deleteTextAt(blockId, start, end)\n\t\t\t\t.insertText(blockId, start, text, [{ type: markType('link'), attrs }])\n\t\t\t\t.setSelection(createCollapsedSelection(blockId, start + text.length))\n\t\t\t\t.build();\n\t\t};\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern: LINK_RULE,\n\t\t\thandler(state, match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel) || !isCollapsed(sel)) return null;\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\t\tconst expr = match[1];\n\t\t\t\tconst text = match[2];\n\t\t\t\tconst rawHref = match[3];\n\t\t\t\tconst title = match[4];\n\t\t\t\tif (!expr || !text || !rawHref) return null;\n\t\t\t\tconst href: string = sanitizeHref(rawHref);\n\t\t\t\tif (href === '') return null;\n\n\t\t\t\treturn buildLink(state, sel.anchor.blockId, end - expr.length, end, text, href, title);\n\t\t\t},\n\t\t});\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern: AUTOLINK_RULE,\n\t\t\thandler(state, match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel) || !isCollapsed(sel)) return null;\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\t\tconst expr = match[1];\n\t\t\t\tconst url = match[2];\n\t\t\t\tif (!expr || !url) return null;\n\t\t\t\tconst href: string = sanitizeHref(url);\n\t\t\t\tif (href === '') return null;\n\n\t\t\t\treturn buildLink(state, sel.anchor.blockId, end - expr.length, end, url, href);\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tconst openInNewTab = this.config.openInNewTab;\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'link',\n\t\t\trank: 10,\n\t\t\tinclusive: false,\n\t\t\tattrs: {\n\t\t\t\thref: { default: '' },\n\t\t\t\ttitle: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst a = document.createElement('a');\n\t\t\t\tconst href: string = sanitizeHref(String(mark.attrs?.href ?? ''));\n\t\t\t\ta.setAttribute('href', href);\n\t\t\t\tconst title: string = String(mark.attrs?.title ?? '');\n\t\t\t\tif (title) a.setAttribute('title', title);\n\t\t\t\tif (shouldOpenInNewTab(href, openInNewTab)) {\n\t\t\t\t\ta.setAttribute('target', '_blank');\n\t\t\t\t\ta.setAttribute('rel', 'noopener noreferrer');\n\t\t\t\t}\n\t\t\t\treturn a;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst safeHref: string = sanitizeHref(String(mark.attrs?.href ?? ''));\n\t\t\t\tconst href: string = escapeHTML(safeHref);\n\t\t\t\tconst titleValue: string = String(mark.attrs?.title ?? '');\n\t\t\t\tconst titleAttr: string = titleValue ? ` title=\"${escapeHTML(titleValue)}\"` : '';\n\t\t\t\tif (shouldOpenInNewTab(safeHref, openInNewTab)) {\n\t\t\t\t\treturn `<a href=\"${href}\"${titleAttr} target=\"_blank\" rel=\"noopener noreferrer\">${content}</a>`;\n\t\t\t\t}\n\t\t\t\treturn `<a href=\"${href}\"${titleAttr}>${content}</a>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'a',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\t// Returning an empty href (instead of `false`) keeps the link mark\n\t\t\t\t\t\t// applied so the parser does not fall back to the core HTMLParser's\n\t\t\t\t\t\t// raw-href default; the empty value renders as a no-op anchor.\n\t\t\t\t\t\tconst href: string = sanitizeHref(el.getAttribute('href') ?? '');\n\t\t\t\t\t\tconst title: string = el.getAttribute('title') ?? '';\n\t\t\t\t\t\treturn title ? { href, title } : { href };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['a'], attrs: ['href', 'title', 'target', 'rel'] },\n\t\t});\n\t}\n\n\tprivate installFragmentClickHandler(context: PluginContext): void {\n\t\tthis.removeFragmentClickHandler();\n\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tconst handler = (event: MouseEvent): void => {\n\t\t\tif (\n\t\t\t\tevent.defaultPrevented ||\n\t\t\t\tevent.button !== 0 ||\n\t\t\t\tevent.metaKey ||\n\t\t\t\tevent.ctrlKey ||\n\t\t\t\tevent.shiftKey ||\n\t\t\t\tevent.altKey\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst anchor: HTMLAnchorElement | null = findClickedAnchor(container, event.target);\n\t\t\tif (!anchor) return;\n\n\t\t\tconst identifiers: readonly string[] = fragmentIdentifiers(anchor.getAttribute('href') ?? '');\n\t\t\tif (identifiers.length === 0) return;\n\n\t\t\tconst target: Element | null = findFragmentTarget(container, identifiers);\n\t\t\tif (!target) return;\n\n\t\t\tevent.preventDefault();\n\t\t\ttarget.scrollIntoView();\n\t\t};\n\n\t\tthis.fragmentClickContainer = container;\n\t\tthis.fragmentClickHandler = handler;\n\t\tcontainer.addEventListener('click', handler);\n\t}\n\n\tprivate removeFragmentClickHandler(): void {\n\t\tif (this.fragmentClickContainer && this.fragmentClickHandler) {\n\t\t\tthis.fragmentClickContainer.removeEventListener('click', this.fragmentClickHandler);\n\t\t}\n\t\tthis.fragmentClickContainer = null;\n\t\tthis.fragmentClickHandler = null;\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.toggleLink(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setLink', () => {\n\t\t\t// setLink is called by the popup after URL input\n\t\t\t// The actual URL is set via the popup's custom render\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('removeLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.removeLink(context, state);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-K': () => context.executeCommand('toggleLink'),\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=\"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'link',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-K')),\n\t\t\tcommand: 'toggleLink',\n\t\t\tpopupType: 'custom',\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\tthis.renderLinkPopup(container, ctx, onClose);\n\t\t\t},\n\t\t\tisActive: (state) => this.isLinkActive(state),\n\t\t\tisEnabled: (state) => !isCollapsed(state.selection),\n\t\t});\n\t}\n\n\tprivate isLinkActive(state: EditorState): boolean {\n\t\treturn isAttributedMarkActive(state, 'link');\n\t}\n\n\tprivate toggleLink(context: PluginContext, state: EditorState): boolean {\n\t\tif (this.isLinkActive(state)) {\n\t\t\treturn this.removeLink(context, state);\n\t\t}\n\t\t// Adding links requires the toolbar popup for URL input\n\t\treturn false;\n\t}\n\n\tprivate addLink(context: PluginContext, state: EditorState, href: string): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\t\tif (isCollapsed(sel)) return false;\n\n\t\tconst mark = { type: markType('link'), attrs: { href } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\n\tprivate removeLink(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\t// Remove link from entire link span around cursor (plugin-specific extent scan)\n\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block) return false;\n\n\t\t\tconst textChildren: { pos: number; end: number; hasLink: boolean }[] = [];\n\t\t\tlet pos = 0;\n\t\t\tfor (const child of block.children) {\n\t\t\t\tif (!('text' in child)) continue;\n\t\t\t\tconst end = pos + child.text.length;\n\t\t\t\ttextChildren.push({ pos, end, hasLink: hasMark(child.marks, markType('link')) });\n\t\t\t\tpos = end;\n\t\t\t}\n\n\t\t\tconst cursorIdx = textChildren.findIndex(\n\t\t\t\t(c) => sel.anchor.offset >= c.pos && sel.anchor.offset <= c.end,\n\t\t\t);\n\t\t\tconst cursorEntry = cursorIdx >= 0 ? textChildren[cursorIdx] : undefined;\n\t\t\tif (cursorIdx === -1 || !cursorEntry?.hasLink) return false;\n\n\t\t\tlet startIdx = cursorIdx;\n\t\t\twhile (startIdx > 0 && textChildren[startIdx - 1]?.hasLink) {\n\t\t\t\tstartIdx--;\n\t\t\t}\n\n\t\t\tlet endIdx = cursorIdx;\n\t\t\twhile (endIdx < textChildren.length - 1 && textChildren[endIdx + 1]?.hasLink) {\n\t\t\t\tendIdx++;\n\t\t\t}\n\n\t\t\tconst startEntry = textChildren[startIdx];\n\t\t\tconst endEntry = textChildren[endIdx];\n\t\t\tif (!startEntry || !endEntry) return false;\n\n\t\t\tconst linkStart = startEntry.pos;\n\t\t\tconst linkEnd = endEntry.end;\n\n\t\t\tconst builder = state.transaction('command');\n\t\t\tbuilder.removeMark(sel.anchor.blockId, linkStart, linkEnd, { type: markType('link') });\n\t\t\tbuilder.setSelection(sel);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\t// Range selection: delegate to shared helper\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('link')));\n\t}\n\n\tprivate renderLinkPopup(\n\t\tcontainer: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tonClose: () => void,\n\t): void {\n\t\tcontainer.classList.add('notectl-link-popup');\n\n\t\tconst state = context.getState();\n\t\tconst isActive = this.isLinkActive(state);\n\n\t\tif (isActive) {\n\t\t\t// Show remove link button\n\t\t\tconst removeBtn = document.createElement('button');\n\t\t\tremoveBtn.type = 'button';\n\t\t\tremoveBtn.className = 'notectl-link-popup__button';\n\t\t\tremoveBtn.textContent = this.locale.removeLink;\n\t\t\tremoveBtn.setAttribute('aria-label', this.locale.removeLinkAria);\n\t\t\tremoveBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t});\n\t\t\tremoveBtn.addEventListener('click', () => {\n\t\t\t\tcontext.executeCommand('removeLink');\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t});\n\t\t\tcontainer.appendChild(removeBtn);\n\t\t} else {\n\t\t\t// Show URL input\n\t\t\tconst input = document.createElement('input');\n\t\t\tinput.type = 'url';\n\t\t\tinput.className = 'notectl-link-popup__input';\n\t\t\tinput.placeholder = this.locale.urlPlaceholder;\n\t\t\tinput.setAttribute('aria-label', this.locale.urlAria);\n\n\t\t\tconst applyBtn = document.createElement('button');\n\t\t\tapplyBtn.type = 'button';\n\t\t\tapplyBtn.className = 'notectl-link-popup__button notectl-link-popup__button--apply';\n\t\t\tapplyBtn.textContent = this.locale.apply;\n\t\t\tapplyBtn.setAttribute('aria-label', this.locale.applyAria);\n\n\t\t\tconst errorMsg = document.createElement('div');\n\t\t\terrorMsg.className = 'notectl-link-popup__error';\n\t\t\terrorMsg.setAttribute('role', 'alert');\n\t\t\terrorMsg.hidden = true;\n\n\t\t\tconst applyLink = (): void => {\n\t\t\t\tconst raw: string = input.value.trim();\n\t\t\t\tif (raw === '') return;\n\t\t\t\tconst sanitized: string = sanitizeHref(raw);\n\t\t\t\tif (sanitized === '') {\n\t\t\t\t\terrorMsg.textContent = this.locale.invalidUrl;\n\t\t\t\t\terrorMsg.hidden = false;\n\t\t\t\t\tinput.setAttribute('aria-invalid', 'true');\n\t\t\t\t\tinput.focus();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\terrorMsg.hidden = true;\n\t\t\t\tinput.removeAttribute('aria-invalid');\n\t\t\t\tthis.addLink(context, context.getState(), sanitized);\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t};\n\n\t\t\tapplyBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t});\n\t\t\tapplyBtn.addEventListener('click', () => {\n\t\t\t\tapplyLink();\n\t\t\t});\n\n\t\t\tinput.addEventListener('keydown', (e) => {\n\t\t\t\tif (e.key === 'Enter') {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tapplyLink();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tinput.addEventListener('input', () => {\n\t\t\t\tif (!errorMsg.hidden) {\n\t\t\t\t\terrorMsg.hidden = true;\n\t\t\t\t\tinput.removeAttribute('aria-invalid');\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tcontainer.appendChild(input);\n\t\t\tcontainer.appendChild(applyBtn);\n\t\t\tcontainer.appendChild(errorM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,EAAM,iBAAiB,QAAA,KACjB,EAAS,SACb,EAAS,QAAS,EAClB,EAAM,gBAAgB,mBAIxB,EAAU,YAAY,GACtB,EAAU,YAAY,GACtB,EAAU,YAAY,GAGtB,sBAAA,IAA4B,EAAM,QACnC,CACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListPlugin-DTgpvBEt.mjs","names":[],"sources":["../../src/editor/styles/list.ts","../../src/plugins/list/ListAttrsFactory.ts","../../src/plugins/list/ListItemContext.ts","../../src/plugins/list/ListCommands.ts","../../src/plugins/list/ListDefinitions.ts","../../src/plugins/list/ListInputRules.ts","../../src/plugins/list/ListKeyboardHandlers.ts","../../src/plugins/list/ListLocale.ts","../../src/plugins/list/ListMarker.ts","../../src/plugins/list/ListToolbarItems.ts","../../src/plugins/list/ListPlugin.ts"],"sourcesContent":["/** Width of the list marker / checkbox area in pixels. */\nexport const LIST_MARKER_WIDTH = 24;\n\n/** List styles — bullet, ordered, checklist items. */\nexport const LIST_CSS = `\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: ${LIST_MARKER_WIDTH}px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n`;\n","/**\n * Factory for building list item block attributes.\n * Centralizes attribute construction to avoid repetitive inline object literals.\n */\n\nimport type { BlockAttrs } from '../../model/Document.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Builds a `BlockAttrs` object for a list_item block. */\nexport function buildListItemAttrs(\n\tlistType: ListType,\n\tindent: number,\n\tchecked?: boolean,\n): BlockAttrs {\n\tif (listType === 'checklist') {\n\t\treturn { listType, indent, checked: checked ?? false };\n\t}\n\treturn { listType, indent };\n}\n","/**\n * Shared resolution helpers for container list items (#194).\n *\n * With `list_item` a hybrid leaf/container block, the caret may sit inside a\n * block child of an item. Commands and keyboard handlers resolve the owning\n * item through the ancestor chain and address structural edits through the\n * item's location (parent path + child index), mirroring the blockquote\n * container conventions.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { getBlockChildren } from '../../model/Document.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TransactionBuilder } from '../../state/TransactionBuilder.js';\n\n/** A list item's structural address: its parent path and child index. */\nexport interface ListItemLocation {\n\treadonly item: BlockNode;\n\t/** Path from the document root to the item's parent ([] = root). */\n\treadonly parentPath: readonly BlockId[];\n\t/** The item's index among its parent's block children. */\n\treadonly index: number;\n}\n\n/**\n * Resolves the list item owning a block: the block itself when it is a\n * `list_item`, otherwise its nearest `list_item` ancestor.\n */\nexport function resolveListItem(state: EditorState, id: BlockId): BlockNode | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(id);\n\tif (block?.type === 'list_item') return block;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(id);\n\tif (!path) return undefined;\n\tfor (let i = path.length - 2; i >= 0; i--) {\n\t\tconst ancestorId: BlockId | undefined = path[i];\n\t\tconst ancestor: BlockNode | undefined = ancestorId ? state.getBlock(ancestorId) : undefined;\n\t\tif (ancestor?.type === 'list_item') return ancestor;\n\t}\n\treturn undefined;\n}\n\n/** Locates a list item's structural address, or undefined if it is not found. */\nexport function locateListItem(state: EditorState, itemId: BlockId): ListItemLocation | undefined {\n\tconst item: BlockNode | undefined = state.getBlock(itemId);\n\tif (!item || item.type !== 'list_item') return undefined;\n\tconst path: readonly BlockId[] | undefined = state.getNodePath(itemId);\n\tif (!path) return undefined;\n\n\tconst parentPath: readonly BlockId[] = path.slice(0, -1);\n\tconst parentId: BlockId | undefined = parentPath[parentPath.length - 1];\n\tconst siblings: readonly BlockNode[] = parentId\n\t\t? getBlockChildren(state.getBlock(parentId) as BlockNode)\n\t\t: state.doc.children;\n\tconst index: number = siblings.findIndex((sibling) => sibling.id === itemId);\n\tif (index < 0) return undefined;\n\treturn { item, parentPath, index };\n}\n\n/**\n * Replaces a container list item with its block children in place. The\n * children keep their IDs, so a selection inside them survives the lift.\n * Leaf items must not be dissolved (their inline content is not a block);\n * convert those via `setBlockType` instead.\n */\nexport function dissolveListItem(builder: TransactionBuilder, location: ListItemLocation): void {\n\tbuilder.removeNode(location.parentPath, location.index);\n\tconst children: readonly BlockNode[] = getBlockChildren(location.item);\n\tchildren.forEach((child, offset) => {\n\t\tbuilder.insertNode(location.parentPath, location.index + offset, child);\n\t});\n}\n","/**\n * Command registration and implementations for list block types.\n * Handles toggle between list types and paragraph, indent/outdent,\n * and checklist toggle.\n */\n\nimport { forEachBlockIdInRange } from '../../commands/RangeIterator.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { isLeafBlock } from '../../model/Document.js';\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport { type BlockId, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { dissolveListItem, locateListItem, resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListConfig, ListType } from './ListPlugin.js';\n\n/** Registers all list commands (toggleList:*, indent, outdent, toggleChecklistItem). */\nexport function registerListCommands(\n\tcontext: PluginContext,\n\tconfig: ListConfig,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerCommand(`toggleList:${def.type}`, () => {\n\t\t\treturn toggleList(context, def.type);\n\t\t});\n\t}\n\n\tcontext.registerCommand('indentListItem', () => changeIndent(context, 1, config.maxIndent));\n\n\tcontext.registerCommand('outdentListItem', () => changeIndent(context, -1, config.maxIndent));\n\n\tif (config.types.includes('checklist')) {\n\t\tconst toggleChecklistItem = (): boolean =>\n\t\t\ttoggleChecked(context, { interactiveCheckboxes: config.interactiveCheckboxes, locale });\n\n\t\tcontext.registerCommand('toggleChecklistItem', toggleChecklistItem, {\n\t\t\treadonlyAllowed: config.interactiveCheckboxes,\n\t\t});\n\n\t\t// Mod-Enter gives keyboard-only users a way to toggle a checklist item\n\t\t// (WCAG 2.1.1). The handler declines on non-checklist blocks, so it falls\n\t\t// through to other Mod-Enter bindings (e.g. code-block insert-after).\n\t\t// Registered at navigation priority so it stays reachable in read-only mode\n\t\t// when interactiveCheckboxes is enabled, matching the mouse handler.\n\t\tcontext.registerKeymap({ 'Mod-Enter': toggleChecklistItem }, { priority: 'navigation' });\n\t}\n\n\tcontext.registerKeymap({\n\t\tTab: () => changeIndent(context, 1, config.maxIndent),\n\t\t'Shift-Tab': () => changeIndent(context, -1, config.maxIndent),\n\t});\n}\n\n// --- Command Implementations ---\n\nfunction toggleList(context: PluginContext, listType: ListType): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tif (sel.anchor.blockId !== sel.head.blockId) {\n\t\treturn toggleListRange(context, state, listType);\n\t}\n\treturn toggleListSingleBlock(context, state, listType);\n}\n\nfunction toggleListSingleBlock(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tlistType: ListType,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\t// The caret may sit inside a block child of a container item (#194):\n\t// toggling always targets the owning item, never the child.\n\tconst item: BlockNode | undefined = resolveListItem(state, sel.anchor.blockId);\n\tconst target: BlockNode = item ?? block;\n\n\tif (item && item.attrs?.listType === listType) {\n\t\tconst builder = state.transaction('command');\n\t\tif (isLeafBlock(item)) {\n\t\t\tbuilder.setBlockType(item.id, nodeType('paragraph'));\n\t\t} else {\n\t\t\t// A container item cannot become a paragraph (its children are\n\t\t\t// blocks) — dissolve it into those children instead.\n\t\t\tconst location = locateListItem(state, item.id);\n\t\t\tif (!location) return false;\n\t\t\tdissolveListItem(builder, location);\n\t\t}\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\tconst attrs = buildListItemAttrs(listType, existingIndent);\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(target.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction toggleListRange(context: PluginContext, state: EditorState, listType: ListType): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst toggleOff: boolean = allBlocksMatchListType(state, range, listType);\n\tconst builder = state.transaction('command');\n\n\t// Children of a container item resolve to their owning item (#194), so a\n\t// range over its paragraphs toggles the item once, not each child.\n\tconst targets: BlockNode[] = collectToggleTargets(state, range);\n\n\t// Dissolving replaces one node with several, shifting later sibling\n\t// indices — process targets back-to-front so earlier addresses stay valid.\n\tfor (let i = targets.length - 1; i >= 0; i--) {\n\t\tconst target: BlockNode | undefined = targets[i];\n\t\tif (!target) continue;\n\n\t\tif (toggleOff) {\n\t\t\tif (isLeafBlock(target)) {\n\t\t\t\tbuilder.setBlockType(target.id, nodeType('paragraph'));\n\t\t\t} else {\n\t\t\t\tconst location = locateListItem(state, target.id);\n\t\t\t\tif (location) dissolveListItem(builder, location);\n\t\t\t}\n\t\t} else {\n\t\t\tconst existingIndent: number = isNodeOfType(target, 'list_item') ? target.attrs.indent : 0;\n\t\t\tconst existingChecked: boolean =\n\t\t\t\tisNodeOfType(target, 'list_item') &&\n\t\t\t\ttarget.attrs.listType === 'checklist' &&\n\t\t\t\ttarget.attrs.checked;\n\t\t\tbuilder.setBlockType(\n\t\t\t\ttarget.id,\n\t\t\t\tnodeType('list_item'),\n\t\t\t\tbuildListItemAttrs(listType, existingIndent, existingChecked),\n\t\t\t);\n\t\t}\n\t}\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Collects unique toggle targets: each leaf block or its owning list item. */\nfunction collectToggleTargets(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n): BlockNode[] {\n\tconst targets: BlockNode[] = [];\n\tconst seen = new Set<BlockId>();\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block) return;\n\t\tconst target: BlockNode = resolveListItem(state, bid) ?? block;\n\t\tif (seen.has(target.id)) return;\n\t\tseen.add(target.id);\n\t\ttargets.push(target);\n\t});\n\treturn targets;\n}\n\n// --- Indent / Outdent ---\n\nfunction changeIndent(context: PluginContext, delta: 1 | -1, maxIndent: number): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\treturn changeIndentRange(context, state, delta, maxIndent);\n\t}\n\n\tconst sel = state.selection;\n\tconst block = resolveListItem(state, sel.anchor.blockId);\n\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\tconst newIndent: number = block.attrs.indent + delta;\n\tif (newIndent < 0 || newIndent > maxIndent) return false;\n\n\tconst attrs = buildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked);\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(sel)\n\t\t.build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\nfunction changeIndentRange(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdelta: 1 | -1,\n\tmaxIndent: number,\n): boolean {\n\tconst sel = state.selection;\n\tif (!isTextSelection(sel)) return false;\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\tlet changed = false;\n\tconst seen = new Set<BlockId>();\n\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return;\n\t\tif (seen.has(block.id)) return;\n\t\tseen.add(block.id);\n\n\t\tconst newIndent: number = block.attrs.indent + delta;\n\t\tif (newIndent < 0 || newIndent > maxIndent) return;\n\n\t\tbuilder.setBlockType(\n\t\t\tblock.id,\n\t\t\tnodeType('list_item'),\n\t\t\tbuildListItemAttrs(block.attrs.listType, newIndent, block.attrs.checked),\n\t\t);\n\t\tchanged = true;\n\t});\n\n\tif (!changed) return false;\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Checklist Toggle ---\n\n/** Options for {@link toggleChecked}. */\nexport interface ToggleCheckedOptions {\n\t/** When true, the toggle is allowed even in read-only mode. */\n\treadonly interactiveCheckboxes?: boolean;\n\t/** Specific checklist item to toggle. Defaults to the selection's block. */\n\treadonly targetId?: BlockId;\n\t/** Locale used for the screen-reader announcement of the new state. */\n\treadonly locale: ListLocale;\n}\n\n/**\n * Toggles the checked state of a checklist item and announces the new state to\n * screen readers. Exported for use in the checkbox click handler.\n */\nexport function toggleChecked(context: PluginContext, options: ToggleCheckedOptions): boolean {\n\tconst { interactiveCheckboxes, targetId, locale } = options;\n\tif (context.isReadOnly() && !interactiveCheckboxes) return false;\n\n\tconst state: EditorState = context.getState();\n\tconst bid: BlockId | null =\n\t\ttargetId ?? (!isTextSelection(state.selection) ? null : state.selection.anchor.blockId);\n\tif (!bid) return false;\n\n\tconst block = resolveListItem(state, bid);\n\tif (!block || !isNodeOfType(block, 'list_item') || block.attrs.listType !== 'checklist') {\n\t\treturn false;\n\t}\n\n\tconst nextChecked: boolean = !block.attrs.checked;\n\tconst attrs = buildListItemAttrs(block.attrs.listType, block.attrs.indent, nextChecked);\n\n\tconst builder = state\n\t\t.transaction('command')\n\t\t.setBlockType(block.id, nodeType('list_item'), attrs)\n\t\t.setSelection(state.selection);\n\tif (context.isReadOnly() && interactiveCheckboxes) builder.readonlyAllowed();\n\tcontext.dispatch(builder.build());\n\n\t// Dispatch is synchronous, but the production EditorView may reject a\n\t// transaction (read-only guard or re-entrant update). Only report/announce a\n\t// state transition that actually reached the authoritative editor state.\n\tconst applied = context.getState().getBlock(block.id);\n\tif (\n\t\t!applied ||\n\t\t!isNodeOfType(applied, 'list_item') ||\n\t\tapplied.attrs.listType !== 'checklist' ||\n\t\tapplied.attrs.checked !== nextChecked\n\t) {\n\t\treturn false;\n\t}\n\n\t// The marker is not focused while editing, so the aria-checked change alone is\n\t// not spoken — announce the new state explicitly (WCAG 4.1.3).\n\tcontext.announce(nextChecked ? locale.checkedAnnouncement : locale.uncheckedAnnouncement);\n\treturn true;\n}\n\n// --- Helpers ---\n\n/**\n * Checks whether all blocks in a range belong to list items of the given type\n * (children of container items resolve to their owning item, #194). Exported\n * for toolbar active-state detection.\n */\nexport function allBlocksMatchListType(\n\tstate: EditorState,\n\trange: ReturnType<typeof selectionRange>,\n\tlistType: ListType,\n): boolean {\n\tlet allMatch = true;\n\tforEachBlockIdInRange(state, range, (bid: BlockId) => {\n\t\tconst block = resolveListItem(state, bid);\n\t\tif (!block || block.type !== 'list_item' || block.attrs?.listType !== listType) {\n\t\t\tallMatch = false;\n\t\t}\n\t});\n\treturn allMatch;\n}\n","/**\n * List type metadata: icons, patterns, and type definitions.\n * Pure data constants shared across list plugin modules.\n */\n\nimport type { ListType } from './ListPlugin.js';\n\n// --- List Type Metadata ---\n\nexport interface ListTypeDefinition {\n\treadonly type: ListType;\n\treadonly icon: string;\n\treadonly inputPattern: RegExp;\n\treadonly inputPrefix: string;\n}\n\nconst BULLET_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z\"/></svg>';\nconst NUMBERED_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z\"/></svg>';\nconst CHECKLIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z\"/></svg>';\n\nexport const LIST_TYPE_DEFINITIONS: readonly ListTypeDefinition[] = [\n\t{\n\t\ttype: 'bullet',\n\t\ticon: BULLET_LIST_ICON,\n\t\tinputPattern: /^[-*] $/,\n\t\tinputPrefix: '- ',\n\t},\n\t{\n\t\ttype: 'ordered',\n\t\ticon: NUMBERED_LIST_ICON,\n\t\tinputPattern: /^\\d+\\. $/,\n\t\tinputPrefix: '1. ',\n\t},\n\t{\n\t\ttype: 'checklist',\n\t\ticon: CHECKLIST_ICON,\n\t\tinputPattern: /^\\[[ x]] $/,\n\t\tinputPrefix: '[ ] ',\n\t},\n];\n","/**\n * Input rule registration for list block types.\n * Converts `- `, `* `, `1. `, `[ ] `, `[x] ` at the start of a paragraph into list items.\n */\n\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\n\n/** Registers markdown-style input rules for configured list types. */\nexport function registerListInputRules(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: def.inputPattern,\n\t\t\thandler: (state, match, start, _end) => {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\t// Inside a container list item (#194) the rule must not fire: it\n\t\t\t\t// would nest a list_item into a list_item, which the schema forbids.\n\t\t\t\tconst parent = state.getParent(sel.anchor.blockId);\n\t\t\t\tif (parent?.type === 'list_item') return null;\n\n\t\t\t\tconst matchStr = match[0] ?? '';\n\t\t\t\tconst matchLen = matchStr.length;\n\t\t\t\tconst attrs = buildListItemAttrs(def.type, 0, matchStr.includes('[x]'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + matchLen)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n}\n","/**\n * Keyboard handlers for list block types.\n *\n * Leaf items: Enter splits into a new item (or exits an empty item),\n * Backspace at the start converts back to a paragraph.\n *\n * Container items (#194): the caret sits inside a block child. Enter on an\n * empty trailing child exits into a new sibling item (Enter-Enter continues\n * the list); Backspace at the start of the first child dissolves the item\n * into its children — both mirroring the blockquote container conventions.\n * Everything else falls through to the default split/merge behavior.\n */\n\nimport { isEmptyParagraph } from '../../commands/BlockInsertion.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockChildren, getBlockText } from '../../model/Document.js';\nimport { createBlockNode, createTextNode } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { buildListItemAttrs } from './ListAttrsFactory.js';\nimport { type ListItemLocation, dissolveListItem, locateListItem } from './ListItemContext.js';\n\n// --- Context Guard ---\n\ninterface ListContext {\n\treadonly state: EditorState;\n\t/** The list item owning the caret (the caret block itself for leaf items). */\n\treadonly item: BlockNode;\n\t/** The caret's block child of a container item; undefined for leaf items. */\n\treadonly child: BlockNode | undefined;\n\treadonly childIndex: number;\n\treadonly childCount: number;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection, non-collapsed selections, and carets outside\n * list items. Resolves both leaf items (caret directly inside the item) and\n * container items (caret inside a direct block child of the item).\n */\nfunction withListContext(context: PluginContext, handler: (ctx: ListContext) => boolean): boolean {\n\tconst state: EditorState = context.getState();\n\tif (!isTextSelection(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'list_item') {\n\t\treturn handler({\n\t\t\tstate,\n\t\t\titem: block,\n\t\t\tchild: undefined,\n\t\t\tchildIndex: -1,\n\t\t\tchildCount: 0,\n\t\t\tblockId: sel.anchor.blockId,\n\t\t\toffset: sel.anchor.offset,\n\t\t});\n\t}\n\n\tconst parent: BlockNode | undefined = state.getParent(sel.anchor.blockId);\n\tif (!parent || parent.type !== 'list_item') return false;\n\tconst children: readonly BlockNode[] = getBlockChildren(parent);\n\tconst childIndex: number = children.findIndex((c) => c.id === block.id);\n\tif (childIndex < 0) return false;\n\n\treturn handler({\n\t\tstate,\n\t\titem: parent,\n\t\tchild: block,\n\t\tchildIndex,\n\t\tchildCount: children.length,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers Enter and Backspace keymaps for list items. */\nexport function registerListKeymaps(context: PluginContext): void {\n\tcontext.registerKeymap({\n\t\tEnter: () => handleEnter(context),\n\t\tBackspace: () => handleBackspace(context),\n\t});\n}\n\n// --- Enter Handler ---\n\n/**\n * Handles Enter inside a list item.\n * Leaf items: empty → exit list (convert to paragraph); non-empty → split\n * into a new item of the same type.\n * Container items: an empty trailing child exits into a new sibling item;\n * a lone empty child dissolves the item. Everything else falls through to\n * the default split (which grows the item's children).\n */\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.child) return handleEnterInContainerChild(context, ctx, ctx.child);\n\n\t\tconst text: string = getBlockText(ctx.item);\n\n\t\tif (text === '') {\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(ctx.state.selection)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst newBlockId = generateBlockId();\n\t\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\t\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\t\tconst attrs = buildListItemAttrs(listType, indent);\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.splitBlock(ctx.blockId, ctx.offset, newBlockId)\n\t\t\t.setBlockType(newBlockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n\n/** Enter inside a container item's child: exit on an empty trailing child. */\nfunction handleEnterInContainerChild(\n\tcontext: PluginContext,\n\tctx: ListContext,\n\tchild: BlockNode,\n): boolean {\n\tif (!isEmptyParagraph(child)) return false;\n\tif (ctx.childIndex !== ctx.childCount - 1) return false;\n\n\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\tif (!location) return false;\n\n\tconst builder = ctx.state.transaction('input');\n\n\tif (ctx.childCount === 1) {\n\t\t// A lone empty child: the item has no content left — dissolve it and\n\t\t// keep the paragraph (same ID, so the caret stays put).\n\t\tdissolveListItem(builder, location);\n\t\tbuilder.setSelection(ctx.state.selection);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\t// Drop the empty trailing child and continue the list with a fresh item.\n\tconst listType = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.listType : 'bullet';\n\tconst indent: number = isNodeOfType(ctx.item, 'list_item') ? ctx.item.attrs.indent : 0;\n\tconst newItemId = generateBlockId();\n\tconst newItem: BlockNode = createBlockNode(\n\t\tnodeType('list_item'),\n\t\t[createTextNode('')],\n\t\tnewItemId,\n\t\tbuildListItemAttrs(listType, indent),\n\t);\n\n\tbuilder\n\t\t.removeNode([...location.parentPath, ctx.item.id], ctx.childIndex)\n\t\t.insertNode(location.parentPath, location.index + 1, newItem)\n\t\t.setSelection(createCollapsedSelection(newItemId, 0));\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n// --- Backspace Handler ---\n\n/**\n * Handles Backspace at the start of a list item.\n * Leaf items convert back to a paragraph. Container items dissolve into\n * their block children when the caret sits at the very start of the first\n * child (the un-list gesture); later children fall through to the default\n * sibling merge.\n */\nfunction handleBackspace(context: PluginContext): boolean {\n\treturn withListContext(context, (ctx) => {\n\t\tif (ctx.offset !== 0) return false;\n\n\t\tif (ctx.child) {\n\t\t\tif (ctx.childIndex !== 0) return false;\n\t\t\tconst location: ListItemLocation | undefined = locateListItem(ctx.state, ctx.item.id);\n\t\t\tif (!location) return false;\n\t\t\tconst builder = ctx.state.transaction('input');\n\t\t\tdissolveListItem(builder, location);\n\t\t\tbuilder.setSelection(ctx.state.selection);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\tconst tr = ctx.state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(ctx.state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t});\n}\n","/**\n * Locale interface and default English locale for the ListPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface ListLocale {\n\treadonly bulletList: string;\n\treadonly numberedList: string;\n\treadonly checklist: string;\n\t/** Accessible name for the checklist item's checkbox marker (screen readers). */\n\treadonly checkboxLabel: string;\n\t/** Announced when a checklist item is toggled on. */\n\treadonly checkedAnnouncement: string;\n\t/** Announced when a checklist item is toggled off. */\n\treadonly uncheckedAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const LIST_LOCALE_EN: ListLocale = {\n\tbulletList: 'Bullet List',\n\tnumberedList: 'Numbered List',\n\tchecklist: 'Checklist',\n\tcheckboxLabel: 'To-do item',\n\tcheckedAnnouncement: 'Checked',\n\tuncheckedAnnouncement: 'Unchecked',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<ListLocale> = import.meta.glob<{\n\tdefault: ListLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadListLocale(lang: string): Promise<ListLocale> {\n\treturn loadLocaleModule(localeModules, lang, LIST_LOCALE_EN);\n}\n","/**\n * Accessible checkbox marker for checklist items.\n *\n * The marker is a real `role=\"checkbox\"` element so assistive technology can\n * announce the item's checked state (WCAG 4.1.2 Name, Role, Value). It is\n * rendered `contenteditable=\"false\"` and flagged `data-widget` so the selection\n * layer treats it as zero-width view chrome, never as document content or a caret\n * position. The visible checkbox glyph is drawn in CSS.\n */\n\n/** CSS class identifying the checklist checkbox marker element. */\nexport const CHECKLIST_MARKER_CLASS = 'notectl-checklist-marker';\n\n/** Creates the accessible checkbox marker for a checklist item. */\nexport function createChecklistMarker(checked: boolean, label: string): HTMLElement {\n\tconst marker: HTMLElement = document.createElement('span');\n\tmarker.className = CHECKLIST_MARKER_CLASS;\n\tmarker.setAttribute('role', 'checkbox');\n\tmarker.setAttribute('aria-checked', String(checked));\n\tmarker.setAttribute('aria-label', label);\n\tmarker.setAttribute('contenteditable', 'false');\n\tmarker.setAttribute('data-widget', 'true');\n\treturn marker;\n}\n","/**\n * Toolbar item registration for list block types.\n * Registers bullet, ordered, and checklist toolbar buttons with active-state detection.\n */\n\nimport { isTextSelection, selectionRange } from '../../model/Selection.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { allBlocksMatchListType } from './ListCommands.js';\nimport type { ListTypeDefinition } from './ListDefinitions.js';\nimport { resolveListItem } from './ListItemContext.js';\nimport type { ListLocale } from './ListLocale.js';\nimport type { ListType } from './ListPlugin.js';\n\n/** Registers toolbar items for each enabled list type. */\nexport function registerListToolbarItems(\n\tcontext: PluginContext,\n\tenabledTypes: readonly ListTypeDefinition[],\n\tlocale: ListLocale,\n): void {\n\tfor (const def of enabledTypes) {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: `list-${def.type}`,\n\t\t\tgroup: 'block',\n\t\t\ticon: def.icon,\n\t\t\tlabel: getListLabel(def.type, locale),\n\t\t\tcommand: `toggleList:${def.type}`,\n\t\t\tisActive: (state) => isListActive(state, def.type),\n\t\t});\n\t}\n}\n\n// --- Helpers ---\n\nfunction getListLabel(type: ListType, locale: ListLocale): string {\n\tconst labels: Record<ListType, string> = {\n\t\tbullet: locale.bulletList,\n\t\tordered: locale.numberedList,\n\t\tchecklist: locale.checklist,\n\t};\n\treturn labels[type];\n}\n\nfunction isListActive(state: EditorState, listType: ListType): boolean {\n\tif (!isTextSelection(state.selection)) return false;\n\n\tif (state.selection.anchor.blockId !== state.selection.head.blockId) {\n\t\tconst range = selectionRange(state.selection, state.getBlockOrder());\n\t\treturn allBlocksMatchListType(state, range, listType);\n\t}\n\n\t// Children of container items resolve to their owning item (#194).\n\tconst block = resolveListItem(state, state.selection.anchor.blockId);\n\treturn block?.type === 'list_item' && block.attrs?.listType === listType;\n}\n","/**\n * ListPlugin: registers ordered, unordered, and checklist block types\n * with NodeSpecs, toggle commands, indent/outdent (Tab/Shift-Tab),\n * input rules, and toolbar buttons.\n *\n * This file is a thin orchestrator — command logic, input rules, keyboard\n * handlers, and toolbar rendering are delegated to dedicated modules.\n *\n * Sibling structure is modeled flat: every item carries a `listType` and an\n * `indent` attribute, so nesting between items needs no deep tree. Item\n * content is hybrid (#194): a single-paragraph item is a leaf with inline\n * children, while a multi-block item (second paragraph, code block, quote,\n * heading) is a container whose children are blocks.\n */\n\nimport { DecorationSet, type WidgetDecoration, widget } from '../../decorations/Decoration.js';\nimport { LIST_CSS, LIST_MARKER_WIDTH } from '../../editor/styles/list.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport { blockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { registerListCommands, toggleChecked } from './ListCommands.js';\nimport { LIST_TYPE_DEFINITIONS, type ListTypeDefinition } from './ListDefinitions.js';\nimport { registerListInputRules } from './ListInputRules.js';\nimport { registerListKeymaps } from './ListKeyboardHandlers.js';\nimport { LIST_LOCALE_EN, type ListLocale, loadListLocale } from './ListLocale.js';\nimport { CHECKLIST_MARKER_CLASS, createChecklistMarker } from './ListMarker.js';\nimport { registerListToolbarItems } from './ListToolbarItems.js';\n\n// --- Attribute Registry Augmentation ---\n\nexport type ListType = 'bullet' | 'ordered' | 'checklist';\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tlist_item: { listType: ListType; indent: number; checked: boolean };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface ListConfig {\n\t/** Which list types to enable. Defaults to all. */\n\treadonly types: readonly ListType[];\n\t/** Maximum indent depth. Defaults to 4. */\n\treadonly maxIndent: number;\n\t/** Live Markdown shortcuts: `- `/`* ` (bullet), `1. ` (ordered), `[ ] ` (checklist). Default true. */\n\treadonly inputRule?: boolean;\n\t/**\n\t * When true, checklist checkboxes remain interactive even in read-only mode.\n\t * Defaults to false (checkboxes are fully read-only).\n\t */\n\treadonly interactiveCheckboxes?: boolean;\n\treadonly locale?: ListLocale;\n}\n\nconst DEFAULT_CONFIG: ListConfig = {\n\ttypes: ['bullet', 'ordered', 'checklist'],\n\tmaxIndent: 4,\n};\n\n// --- Plugin ---\n\nexport class ListPlugin implements Plugin {\n\treadonly id = 'list';\n\treadonly name = 'List';\n\treadonly priority = 35;\n\n\tprivate readonly config: ListConfig;\n\tprivate locale!: ListLocale;\n\tprivate context: PluginContext | null = null;\n\tprivate checkboxMouseDownHandler: ((e: MouseEvent) => void) | null = null;\n\tprivate checkboxClickHandler: ((e: MouseEvent) => void) | null = null;\n\n\tconstructor(config?: Partial<ListConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LIST_LOCALE_EN, loadListLocale);\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tcontext.registerStyleSheet(LIST_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tregisterListCommands(context, this.config, enabledTypes, this.locale);\n\t\tregisterListKeymaps(context);\n\t\tif (this.config.inputRule !== false) registerListInputRules(context, enabledTypes);\n\t\tregisterListToolbarItems(context, enabledTypes, this.locale);\n\t\tthis.registerCheckboxHandlers(context);\n\t}\n\n\t/**\n\t * Leaf content rendering replaces a NodeSpec element's children, so the\n\t * checklist marker is declared as zero-width view chrome at offset zero.\n\t * Container list items retain the marker created by `toDOM`; only leaf IDs\n\t * occur in `getBlockOrder()` and therefore receive this decoration.\n\t */\n\tdecorations(state: EditorState): DecorationSet {\n\t\tconst markers: WidgetDecoration[] = [];\n\t\tfor (const id of state.getBlockOrder()) {\n\t\t\tconst block = state.getBlock(id);\n\t\t\tif (!block || !isNodeOfType(block, 'list_item') || block.attrs.listType !== 'checklist') {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst checked = block.attrs.checked;\n\t\t\tmarkers.push(\n\t\t\t\twidget(id, 0, () => createChecklistMarker(checked, this.locale.checkboxLabel), {\n\t\t\t\t\tkey: `checklist-marker:${checked}`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn DecorationSet.create(markers);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.context) {\n\t\t\tconst container: HTMLElement = this.context.getContainer();\n\t\t\tif (this.checkboxMouseDownHandler) {\n\t\t\t\tcontainer.removeEventListener('mousedown', this.checkboxMouseDownHandler);\n\t\t\t}\n\t\t\tif (this.checkboxClickHandler) {\n\t\t\t\tcontainer.removeEventListener('click', this.checkboxClickHandler);\n\t\t\t}\n\t\t}\n\t\tthis.checkboxMouseDownHandler = null;\n\t\tthis.checkboxClickHandler = null;\n\t\tthis.context = null;\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tconst checkboxLabel: string = this.locale.checkboxLabel;\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'list_item',\n\t\t\tgroup: 'block',\n\t\t\t// Hybrid content model (#194): the common single-paragraph item is a\n\t\t\t// leaf (inline text children); multi-block items are containers with\n\t\t\t// block children. Sibling nesting stays flat-with-indent, so list_item\n\t\t\t// itself is deliberately not an allowed child.\n\t\t\tcontent: {\n\t\t\t\tallow: ['text', 'paragraph', 'heading', 'code_block', 'blockquote', 'horizontal_rule'],\n\t\t\t},\n\t\t\tattrs: {\n\t\t\t\tlistType: { default: 'bullet' },\n\t\t\t\tindent: { default: 0 },\n\t\t\t\tchecked: { default: false },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst indent = node.attrs?.indent ?? 0;\n\t\t\t\tconst checked = node.attrs?.checked ?? false;\n\n\t\t\t\tconst li = createBlockElement('li', node.id);\n\t\t\t\tli.setAttribute('role', 'listitem');\n\t\t\t\tli.setAttribute('data-list-type', listType);\n\t\t\t\tli.setAttribute('data-indent', String(indent));\n\t\t\t\tli.className = `notectl-list-item notectl-list-item--${listType}`;\n\n\t\t\t\tif (indent > 0) {\n\t\t\t\t\tsetStyleProperty(li, 'marginLeft', `${indent * LIST_MARKER_WIDTH}px`);\n\t\t\t\t}\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\t// `data-checked` drives the CSS glyph; the checked state is exposed to\n\t\t\t\t\t// assistive technology via the marker's own role=\"checkbox\", not via an\n\t\t\t\t\t// (invalid) aria-checked on the listitem. The marker is the first child\n\t\t\t\t\t// so reconciled inline content is appended after it.\n\t\t\t\t\tli.setAttribute('data-checked', String(checked));\n\t\t\t\t\tli.appendChild(createChecklistMarker(checked, checkboxLabel));\n\t\t\t\t}\n\t\t\t\tli.setAttribute('aria-level', String(indent + 1));\n\n\t\t\t\treturn li;\n\t\t\t},\n\t\t\twrapper(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst tag = listType === 'ordered' ? 'ol' : 'ul';\n\t\t\t\treturn {\n\t\t\t\t\ttag,\n\t\t\t\t\tkey: `list-${listType}`,\n\t\t\t\t\tclassName: `notectl-list notectl-list--${listType}`,\n\t\t\t\t\tattrs: { role: 'list' },\n\t\t\t\t};\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst listType: string = (node.attrs?.listType as string) ?? 'bullet';\n\t\t\t\tconst checked: boolean = (node.attrs?.checked as boolean) ?? false;\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tconst checkedAttr: string = checked ? ' checked' : '';\n\t\t\t\t\tconst ariaChecked: string = String(checked);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t`<li role=\"checkbox\" aria-checked=\"${ariaChecked}\">` +\n\t\t\t\t\t\t`<input type=\"checkbox\" disabled${checkedAttr}>` +\n\t\t\t\t\t\t`${content || '<br>'}</li>`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn `<li>${content || '<br>'}</li>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'li' }],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['ul', 'ol', 'li', 'input'],\n\t\t\t\tattrs: ['type', 'disabled', 'checked', 'role', 'aria-checked'],\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerCheckboxHandlers(context: PluginContext): void {\n\t\tif (!this.config.types.includes('checklist')) return;\n\n\t\tconst findChecklistItem = (target: EventTarget | null): Element | null => {\n\t\t\tif (!(target instanceof HTMLElement)) return null;\n\t\t\tconst marker: Element | null = target.closest(`.${CHECKLIST_MARKER_CLASS}`);\n\t\t\tif (!marker) return null;\n\t\t\treturn marker.closest('.notectl-list-item--checklist');\n\t\t};\n\n\t\tthis.checkboxMouseDownHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\t\t\tif (!findChecklistItem(e.target)) return;\n\t\t\te.preventDefault();\n\t\t};\n\n\t\tthis.checkboxClickHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\t\t\tconst li: Element | null = findChecklistItem(e.target);\n\t\t\tif (!li) return;\n\n\t\t\te.preventDefault();\n\n\t\t\tconst bid: string | null = li.getAttribute('data-block-id');\n\t\t\tif (!bid) return;\n\n\t\t\ttoggleChecked(context, {\n\t\t\t\tinteractiveCheckboxes: this.config.interactiveCheckboxes,\n\t\t\t\ttargetId: blockId(bid),\n\t\t\t\tlocale: this.locale,\n\t\t\t});\n\t\t};\n\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.addEventListener('mousedown', this.checkboxMouseDownHandler);\n\t\tcontainer.addEventListener('click', this.checkboxClickHandler);\n\t}\n\n\tprivate getEnabledTypes(): readonly ListTypeDefinition[] {\n\t\treturn LIST_TYPE_DEFINITIONS.filter((def) => this.config.types.includes(def.type));\n\t}\n}\n"],"mappings":"kiBCSA,SAAgB,EACf,EACA,EACA,GAEA,MAAiB,cAAb,EACI,CAAE,WAAU,SAAQ,QAAS,IAAW,GAEzC,CAAE,WAAU,SACpB,CCWA,SAAgB,EAAgB,EAAoB,GACnD,MAAM,EAA+B,EAAM,SAAS,GACpD,GAAoB,cAAhB,GAAO,KAAsB,OAAO,EACxC,MAAM,EAAuC,EAAM,YAAY,GAC/D,GAAK,EACL,IAAK,IAAI,EAAI,EAAK,OAAS,EAAG,GAAK,EAAG,IAAK,CAC1C,MAAM,EAAkC,EAAK,GACvC,EAAkC,EAAa,EAAM,SAAS,QAAc,EAClF,GAAuB,cAAnB,GAAU,KAAsB,OAAO,CAC5C,CAED,CAGA,SAAgB,EAAe,EAAoB,GAClD,MAAM,EAA8B,EAAM,SAAS,GACnD,IAAK,GAAsB,cAAd,EAAK,KAAsB,OACxC,MAAM,EAAuC,EAAM,YAAY,GAC/D,IAAK,EAAM,OAEX,MAAM,EAAiC,EAAK,MAAM,GAAG,GAC/C,EAAgC,EAAW,EAAW,OAAS,GAI/D,GAHiC,EACpC,EAAiB,EAAM,SAAS,IAChC,EAAM,IAAI,UACkB,UAAW,GAAY,EAAQ,KAAO,GACrE,OAAI,EAAQ,OAAZ,EACO,CAAE,OAAM,aAAY,QAC5B,CAQA,SAAgB,EAAiB,EAA6B,GAC7D,EAAQ,WAAW,EAAS,WAAY,EAAS,OAEjD,EADwD,EAAS,MACxD,QAAA,CAAS,EAAO,KACxB,EAAQ,WAAW,EAAS,WAAY,EAAS,MAAQ,E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