@notectl/core 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (757) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs +2 -0
  3. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs.map +1 -0
  4. package/dist/chunks/AttrRegistry-Di936wMv.mjs.map +1 -1
  5. package/dist/chunks/AttributedMarkCommands-DKHuhZA7.mjs.map +1 -1
  6. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs +2 -0
  7. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs.map +1 -0
  8. package/dist/chunks/BlockAlignment-BqyBQ4uV.mjs.map +1 -1
  9. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs +2 -0
  10. package/dist/chunks/BlockInsertion-CXfXqUZl.mjs.map +1 -0
  11. package/dist/chunks/BlockTypePickerRegistry-BTET9jM-.mjs.map +1 -1
  12. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs +2 -0
  13. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs.map +1 -0
  14. package/dist/chunks/CSSValueEquivalence-DeyUKPQ7.mjs.map +1 -1
  15. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs +2 -0
  16. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs.map +1 -0
  17. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs +2 -0
  18. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs.map +1 -0
  19. package/dist/chunks/ColorGrid-DAs0--ty.mjs.map +1 -1
  20. package/dist/chunks/ColorPickerPopup-B6340f3p.mjs.map +1 -1
  21. package/dist/chunks/ColorValidation-ZBKZ_gTr.mjs.map +1 -1
  22. package/dist/chunks/Commands-vqbwh6Ic.mjs +2 -0
  23. package/dist/chunks/Commands-vqbwh6Ic.mjs.map +1 -0
  24. package/dist/chunks/ContentModel-dkGOh3N7.mjs +2 -0
  25. package/dist/chunks/ContentModel-dkGOh3N7.mjs.map +1 -0
  26. package/dist/chunks/CursorMarks-CqHLzGNI.mjs.map +1 -1
  27. package/dist/chunks/Decoration-BoFcdSXk.mjs.map +1 -1
  28. package/dist/chunks/DirectionDetection-a-1iksmh.mjs.map +1 -1
  29. package/dist/chunks/DirectionIcons-Bbawl9ei.mjs.map +1 -1
  30. package/dist/chunks/Document-ssR6hBzG.mjs.map +1 -1
  31. package/dist/chunks/DocumentParser-D4g5npEi.mjs +2 -0
  32. package/dist/chunks/DocumentParser-D4g5npEi.mjs.map +1 -0
  33. package/dist/chunks/DomUtils-Bf7JLFlx.mjs.map +1 -1
  34. package/dist/chunks/EditorEventBoundary-zpYRxryo.mjs.map +1 -1
  35. package/dist/chunks/EditorUI-DrQI95FW.mjs +2 -0
  36. package/dist/chunks/EditorUI-DrQI95FW.mjs.map +1 -0
  37. package/dist/chunks/FontPlugin-Bzlluh1_.mjs +2 -0
  38. package/dist/chunks/FontPlugin-Bzlluh1_.mjs.map +1 -0
  39. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs +2 -0
  40. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs.map +1 -0
  41. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs +2 -0
  42. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs.map +1 -0
  43. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs +2 -0
  44. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs.map +1 -0
  45. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs +2 -0
  46. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs.map +1 -0
  47. package/dist/chunks/HTMLUtils-DTpsjZyK.mjs.map +1 -1
  48. package/dist/chunks/{HardBreakPlugin-svNnJ9Xj.mjs → HardBreakPlugin-lo8Mcg9G.mjs} +2 -2
  49. package/dist/chunks/HardBreakPlugin-lo8Mcg9G.mjs.map +1 -0
  50. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs +2 -0
  51. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs.map +1 -0
  52. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs +2 -0
  53. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs.map +1 -0
  54. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs +2 -0
  55. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs.map +1 -0
  56. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs +2 -0
  57. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs.map +1 -0
  58. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs +2 -0
  59. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs.map +1 -0
  60. package/dist/chunks/InlineStyleMarkSpec-BhfGgfH9.mjs.map +1 -1
  61. package/dist/chunks/KeyboardNav-D0my3wuy.mjs.map +1 -1
  62. package/dist/chunks/LinkPlugin-CFw22a9X.mjs +2 -0
  63. package/dist/chunks/LinkPlugin-CFw22a9X.mjs.map +1 -0
  64. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs +2 -0
  65. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs.map +1 -0
  66. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs +2 -0
  67. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs.map +1 -0
  68. package/dist/chunks/MarkCommands-C0ps9h0z.mjs.map +1 -1
  69. package/dist/chunks/MarkInputRule-DNneF2gp.mjs.map +1 -1
  70. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs → MarkdownHTMLRegistry-Cj7N2wqs.mjs} +2 -2
  71. package/dist/chunks/MarkdownHTMLRegistry-Cj7N2wqs.mjs.map +1 -0
  72. package/dist/chunks/{MarkdownParser-CvYOvU3d.mjs → MarkdownParser-JOfPSvGv.mjs} +2 -2
  73. package/dist/chunks/MarkdownParser-JOfPSvGv.mjs.map +1 -0
  74. package/dist/chunks/{MarkdownSerializer-CdUBWWGI.mjs → MarkdownSerializer-Y6saYClE.mjs} +2 -2
  75. package/dist/chunks/MarkdownSerializer-Y6saYClE.mjs.map +1 -0
  76. package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -1
  77. package/dist/chunks/NavigationQueries-CaKfccu7.mjs.map +1 -1
  78. package/dist/chunks/NodeResolver-F4RtpoEd.mjs.map +1 -1
  79. package/dist/chunks/{NodeSelectionCommands-B0Sb4ux4.mjs → NodeSelectionCommands-CAqIHW_6.mjs} +2 -2
  80. package/dist/chunks/NodeSelectionCommands-CAqIHW_6.mjs.map +1 -0
  81. package/dist/chunks/NodeSpecPatching-BrjPAbqe.mjs.map +1 -1
  82. package/dist/chunks/Platform-ByobkiCc.mjs.map +1 -1
  83. package/dist/chunks/PopupKeyboardPatterns-BcwdDxRq.mjs.map +1 -1
  84. package/dist/chunks/PopupManager-DpxoBl54.mjs +2 -0
  85. package/dist/chunks/PopupManager-DpxoBl54.mjs.map +1 -0
  86. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  87. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs +2 -0
  88. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs.map +1 -0
  89. package/dist/chunks/RangeIterator-sJ_c9MNr.mjs.map +1 -1
  90. package/dist/chunks/Schema-BSM4YLNT.mjs.map +1 -1
  91. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs → SchemaRegistry-CT3T7S1i.mjs} +2 -2
  92. package/dist/chunks/SchemaRegistry-CT3T7S1i.mjs.map +1 -0
  93. package/dist/chunks/Selection-DC6AOGgF.mjs.map +1 -1
  94. package/dist/chunks/SelectionReplacement-Cj4FLlPz.mjs +2 -0
  95. package/dist/chunks/SelectionReplacement-Cj4FLlPz.mjs.map +1 -0
  96. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs → SelectionSync-8y0nbBHZ.mjs} +2 -2
  97. package/dist/chunks/SelectionSync-8y0nbBHZ.mjs.map +1 -0
  98. package/dist/chunks/SelectionTransactions-mQ1NfMEg.mjs.map +1 -1
  99. package/dist/chunks/ShortcutFormatting-TwiufqeV.mjs.map +1 -1
  100. package/dist/chunks/SimpleMark-DPTsIl9w.mjs +2 -0
  101. package/dist/chunks/SimpleMark-DPTsIl9w.mjs.map +1 -0
  102. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs +2 -0
  103. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs.map +1 -0
  104. package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -1
  105. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs +2 -0
  106. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs.map +1 -0
  107. package/dist/chunks/StyleClassNames-BsAx7k5T.mjs.map +1 -1
  108. package/dist/chunks/StyleRuntime-C0RSqKzG.mjs.map +1 -1
  109. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs +2 -0
  110. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs.map +1 -0
  111. package/dist/chunks/SyntaxTokenTypes-BUCOMtL8.mjs.map +1 -1
  112. package/dist/chunks/{TableDimensions-BSEOEox2.mjs → TableDimensions-B-OWjTuW.mjs} +2 -2
  113. package/dist/chunks/TableDimensions-B-OWjTuW.mjs.map +1 -0
  114. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs +2 -0
  115. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs.map +1 -0
  116. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs +2 -0
  117. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs.map +1 -0
  118. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs +2 -0
  119. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs.map +1 -0
  120. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs → TextDirectionAutoPlugin-CkIETM5n.mjs} +2 -2
  121. package/dist/chunks/TextDirectionAutoPlugin-CkIETM5n.mjs.map +1 -0
  122. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs +2 -0
  123. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs.map +1 -0
  124. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
  125. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs.map +1 -0
  126. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs +2 -0
  127. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs.map +1 -0
  128. package/dist/chunks/ThemeEngine-kIXtSRkI.mjs.map +1 -1
  129. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs +2 -0
  130. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs.map +1 -0
  131. package/dist/chunks/TypeBrands-Ch9856Gb.mjs.map +1 -1
  132. package/dist/chunks/TypedKeys-CA4bfw9O.mjs.map +1 -1
  133. package/dist/chunks/VideoPlugin-lZCBlIon.mjs +2 -0
  134. package/dist/chunks/VideoPlugin-lZCBlIon.mjs.map +1 -0
  135. package/dist/chunks/XmlPatterns-RN32-0ob.mjs.map +1 -1
  136. package/dist/chunks/XmlSupport-3Za6SIqF.mjs.map +1 -1
  137. package/dist/chunks/ar--Isa9OHJ.mjs.map +1 -1
  138. package/dist/chunks/ar--O0A9OTR.mjs.map +1 -1
  139. package/dist/chunks/ar-0g2bmXTn.mjs.map +1 -1
  140. package/dist/chunks/ar-4b8e2YSc.mjs.map +1 -1
  141. package/dist/chunks/ar-B03uY4xr.mjs.map +1 -1
  142. package/dist/chunks/ar-BAfInw85.mjs.map +1 -1
  143. package/dist/chunks/ar-BRX5E_Pw.mjs.map +1 -1
  144. package/dist/chunks/ar-BWOue6jG.mjs.map +1 -1
  145. package/dist/chunks/ar-Bdmunk5h.mjs.map +1 -1
  146. package/dist/chunks/ar-BwaoCUVN.mjs.map +1 -1
  147. package/dist/chunks/ar-BzqAYGER.mjs.map +1 -1
  148. package/dist/chunks/ar-C9lO1jsY.mjs.map +1 -1
  149. package/dist/chunks/ar-CMXjVzFx.mjs.map +1 -1
  150. package/dist/chunks/ar-CR6UdFL9.mjs.map +1 -1
  151. package/dist/chunks/ar-CrOb0jL2.mjs.map +1 -1
  152. package/dist/chunks/ar-Cy_77yRf.mjs.map +1 -1
  153. package/dist/chunks/ar-D1jFXqLJ.mjs.map +1 -1
  154. package/dist/chunks/ar-DahJwMI9.mjs.map +1 -1
  155. package/dist/chunks/ar-Dcl3kgtd.mjs.map +1 -1
  156. package/dist/chunks/ar-Dg9PdDet.mjs.map +1 -1
  157. package/dist/chunks/ar-Dp1oBWyG.mjs +2 -0
  158. package/dist/chunks/ar-Dp1oBWyG.mjs.map +1 -0
  159. package/dist/chunks/ar-Dx2lO0Nm.mjs.map +1 -1
  160. package/dist/chunks/ar-NV_puwI2.mjs.map +1 -1
  161. package/dist/chunks/ar-Uzo1Azdw.mjs.map +1 -1
  162. package/dist/chunks/ar-XmSFrtmd.mjs.map +1 -1
  163. package/dist/chunks/ar-eOA3UmiE.mjs.map +1 -1
  164. package/dist/chunks/ar-sGZ-oZqB.mjs.map +1 -1
  165. package/dist/chunks/color-picker-D6HrTsDM.mjs.map +1 -1
  166. package/dist/chunks/de-B8-w9gPi.mjs.map +1 -1
  167. package/dist/chunks/de-B9zSHWqY.mjs.map +1 -1
  168. package/dist/chunks/de-BX4y4PlH.mjs.map +1 -1
  169. package/dist/chunks/de-BXQBXxFJ.mjs.map +1 -1
  170. package/dist/chunks/de-BcPntcnr.mjs.map +1 -1
  171. package/dist/chunks/de-BdD3DpUB.mjs.map +1 -1
  172. package/dist/chunks/de-Bwxlcuee.mjs.map +1 -1
  173. package/dist/chunks/de-BxQIt_1Y.mjs.map +1 -1
  174. package/dist/chunks/de-C-Yf378-.mjs.map +1 -1
  175. package/dist/chunks/de-C7uehgMu.mjs.map +1 -1
  176. package/dist/chunks/de-C9ZhDqPi.mjs.map +1 -1
  177. package/dist/chunks/de-CHcv_Vmf.mjs.map +1 -1
  178. package/dist/chunks/de-CTzAMkXC.mjs.map +1 -1
  179. package/dist/chunks/de-CaeEIyzV.mjs.map +1 -1
  180. package/dist/chunks/de-D3J8XPCR.mjs +2 -0
  181. package/dist/chunks/de-D3J8XPCR.mjs.map +1 -0
  182. package/dist/chunks/de-DHs9i4af.mjs.map +1 -1
  183. package/dist/chunks/de-DJ5EkXQo.mjs.map +1 -1
  184. package/dist/chunks/de-DRbhnS4T.mjs.map +1 -1
  185. package/dist/chunks/de-DViI26lG.mjs.map +1 -1
  186. package/dist/chunks/de-DY3obIAF.mjs.map +1 -1
  187. package/dist/chunks/de-DcMhfRBu.mjs.map +1 -1
  188. package/dist/chunks/de-DiPz7abS.mjs.map +1 -1
  189. package/dist/chunks/de-Dl4QFHMa.mjs.map +1 -1
  190. package/dist/chunks/de-XCCpWyg0.mjs.map +1 -1
  191. package/dist/chunks/de-e6J6nvAD.mjs.map +1 -1
  192. package/dist/chunks/de-i95F9SDy.mjs.map +1 -1
  193. package/dist/chunks/de-uKR7koQe.mjs.map +1 -1
  194. package/dist/chunks/es-B0Za939C.mjs.map +1 -1
  195. package/dist/chunks/es-B8K3Yvf3.mjs.map +1 -1
  196. package/dist/chunks/es-BIXm2Coj.mjs.map +1 -1
  197. package/dist/chunks/es-BJHF95J_.mjs.map +1 -1
  198. package/dist/chunks/es-BMm9kqjC.mjs.map +1 -1
  199. package/dist/chunks/es-BQ9dox_E.mjs.map +1 -1
  200. package/dist/chunks/es-BQweZX6P.mjs.map +1 -1
  201. package/dist/chunks/es-Bbz885DZ.mjs +2 -0
  202. package/dist/chunks/es-Bbz885DZ.mjs.map +1 -0
  203. package/dist/chunks/es-BdpTTRuX.mjs.map +1 -1
  204. package/dist/chunks/es-C7uVqFYr.mjs.map +1 -1
  205. package/dist/chunks/es-CCQFu1t1.mjs.map +1 -1
  206. package/dist/chunks/es-CEAJj7aB.mjs.map +1 -1
  207. package/dist/chunks/es-CUKJujcb.mjs.map +1 -1
  208. package/dist/chunks/es-CXuMz87y.mjs.map +1 -1
  209. package/dist/chunks/es-CgMfhkJJ.mjs.map +1 -1
  210. package/dist/chunks/es-CtOtKQCP.mjs.map +1 -1
  211. package/dist/chunks/es-DD01rZ6N.mjs.map +1 -1
  212. package/dist/chunks/es-DDoqchUq.mjs.map +1 -1
  213. package/dist/chunks/es-DFokqQst.mjs.map +1 -1
  214. package/dist/chunks/es-DHxdoEzR.mjs.map +1 -1
  215. package/dist/chunks/es-DehVGwQ8.mjs.map +1 -1
  216. package/dist/chunks/es-DrJyl38L.mjs.map +1 -1
  217. package/dist/chunks/es-fTW0TkYV.mjs.map +1 -1
  218. package/dist/chunks/es-kfKiqpyD.mjs.map +1 -1
  219. package/dist/chunks/es-nRLq7bgP.mjs.map +1 -1
  220. package/dist/chunks/es-paXY7HFt.mjs.map +1 -1
  221. package/dist/chunks/es-xuahrvJN.mjs.map +1 -1
  222. package/dist/chunks/fr-0qEo3bRP.mjs.map +1 -1
  223. package/dist/chunks/fr-5HkMazAf.mjs.map +1 -1
  224. package/dist/chunks/fr-B9pBLaVx.mjs.map +1 -1
  225. package/dist/chunks/fr-BRXUnq3R.mjs.map +1 -1
  226. package/dist/chunks/fr-BSUKEtTk.mjs.map +1 -1
  227. package/dist/chunks/fr-BeRlON1t.mjs.map +1 -1
  228. package/dist/chunks/fr-Bg937iAy.mjs.map +1 -1
  229. package/dist/chunks/fr-BwWrFThE.mjs.map +1 -1
  230. package/dist/chunks/fr-C3EKRThN.mjs.map +1 -1
  231. package/dist/chunks/fr-CKjH6tJI.mjs.map +1 -1
  232. package/dist/chunks/fr-CQs0-pNX.mjs.map +1 -1
  233. package/dist/chunks/fr-CfhyYN-t.mjs.map +1 -1
  234. package/dist/chunks/fr-D0MDdoir.mjs.map +1 -1
  235. package/dist/chunks/fr-D5ulA3Z6.mjs.map +1 -1
  236. package/dist/chunks/fr-DEZ_oxzS.mjs.map +1 -1
  237. package/dist/chunks/fr-DciSEykY.mjs.map +1 -1
  238. package/dist/chunks/fr-DhWQzZy3.mjs.map +1 -1
  239. package/dist/chunks/fr-DiDhVhyV.mjs.map +1 -1
  240. package/dist/chunks/fr-DjMZ-3K5.mjs.map +1 -1
  241. package/dist/chunks/fr-F2ZrfVaF.mjs.map +1 -1
  242. package/dist/chunks/fr-GEgM1j3w.mjs +2 -0
  243. package/dist/chunks/fr-GEgM1j3w.mjs.map +1 -0
  244. package/dist/chunks/fr-KXmbys88.mjs.map +1 -1
  245. package/dist/chunks/fr-NVOinLyF.mjs.map +1 -1
  246. package/dist/chunks/fr-SbpHNrQ-.mjs.map +1 -1
  247. package/dist/chunks/fr-ZsRdLuys.mjs.map +1 -1
  248. package/dist/chunks/fr-eC0UdAPu.mjs.map +1 -1
  249. package/dist/chunks/fr-fshsDD66.mjs.map +1 -1
  250. package/dist/chunks/full-wDTdOuGt.mjs +2 -0
  251. package/dist/chunks/full-wDTdOuGt.mjs.map +1 -0
  252. package/dist/chunks/hi-4CiAKVjT.mjs.map +1 -1
  253. package/dist/chunks/hi-B-ZuX4aN.mjs.map +1 -1
  254. package/dist/chunks/hi-B2YB3Bo4.mjs.map +1 -1
  255. package/dist/chunks/hi-B2uhiPCN.mjs.map +1 -1
  256. package/dist/chunks/hi-B5cl8TWK.mjs.map +1 -1
  257. package/dist/chunks/hi-BNJIGWQQ.mjs.map +1 -1
  258. package/dist/chunks/hi-BOMkDPqC.mjs.map +1 -1
  259. package/dist/chunks/hi-Bl-yeeOI.mjs.map +1 -1
  260. package/dist/chunks/hi-BsZzSMfL.mjs.map +1 -1
  261. package/dist/chunks/hi-By8YwVIX.mjs.map +1 -1
  262. package/dist/chunks/hi-BzbMD_cP.mjs.map +1 -1
  263. package/dist/chunks/hi-C2jEsf8v.mjs.map +1 -1
  264. package/dist/chunks/hi-CKg8i4Mm.mjs +2 -0
  265. package/dist/chunks/hi-CKg8i4Mm.mjs.map +1 -0
  266. package/dist/chunks/hi-CTWubxLY.mjs.map +1 -1
  267. package/dist/chunks/hi-CoclKAUM.mjs.map +1 -1
  268. package/dist/chunks/hi-CrmakMVj.mjs.map +1 -1
  269. package/dist/chunks/hi-DWX6k5ZD.mjs.map +1 -1
  270. package/dist/chunks/hi-DY55FuDK.mjs.map +1 -1
  271. package/dist/chunks/hi-DrC2H81d.mjs.map +1 -1
  272. package/dist/chunks/hi-DsdXcOB6.mjs.map +1 -1
  273. package/dist/chunks/hi-Dt89SxNy.mjs.map +1 -1
  274. package/dist/chunks/hi-J8ErB5nB.mjs.map +1 -1
  275. package/dist/chunks/hi-L6pJxZam.mjs.map +1 -1
  276. package/dist/chunks/hi-SECtQQzq.mjs.map +1 -1
  277. package/dist/chunks/hi-j3TDLMYd.mjs.map +1 -1
  278. package/dist/chunks/hi-l6DA-aOw.mjs.map +1 -1
  279. package/dist/chunks/hi-uACJUw53.mjs.map +1 -1
  280. package/dist/chunks/minimal-FfmHwMGU.mjs +2 -0
  281. package/dist/chunks/minimal-FfmHwMGU.mjs.map +1 -0
  282. package/dist/chunks/nl-2IdjTNeJ.mjs +2 -0
  283. package/dist/chunks/nl-2IdjTNeJ.mjs.map +1 -0
  284. package/dist/chunks/nl-B1i04NvZ.mjs +2 -0
  285. package/dist/chunks/nl-B1i04NvZ.mjs.map +1 -0
  286. package/dist/chunks/nl-BEmzpzKO.mjs +2 -0
  287. package/dist/chunks/nl-BEmzpzKO.mjs.map +1 -0
  288. package/dist/chunks/nl-B_U0D3Qq.mjs +2 -0
  289. package/dist/chunks/nl-B_U0D3Qq.mjs.map +1 -0
  290. package/dist/chunks/nl-C437Xz6z.mjs +2 -0
  291. package/dist/chunks/nl-C437Xz6z.mjs.map +1 -0
  292. package/dist/chunks/nl-C5P8Fogm.mjs +2 -0
  293. package/dist/chunks/nl-C5P8Fogm.mjs.map +1 -0
  294. package/dist/chunks/nl-CST62bzx.mjs +2 -0
  295. package/dist/chunks/nl-CST62bzx.mjs.map +1 -0
  296. package/dist/chunks/nl-CWQT-W-6.mjs +2 -0
  297. package/dist/chunks/nl-CWQT-W-6.mjs.map +1 -0
  298. package/dist/chunks/nl-CdpcDkbM.mjs +2 -0
  299. package/dist/chunks/nl-CdpcDkbM.mjs.map +1 -0
  300. package/dist/chunks/nl-CgYWZnga.mjs +2 -0
  301. package/dist/chunks/nl-CgYWZnga.mjs.map +1 -0
  302. package/dist/chunks/nl-Cr--x8bX.mjs +2 -0
  303. package/dist/chunks/nl-Cr--x8bX.mjs.map +1 -0
  304. package/dist/chunks/nl-Cwl5dxFZ.mjs +2 -0
  305. package/dist/chunks/nl-Cwl5dxFZ.mjs.map +1 -0
  306. package/dist/chunks/nl-Czjd9Bw9.mjs +2 -0
  307. package/dist/chunks/nl-Czjd9Bw9.mjs.map +1 -0
  308. package/dist/chunks/nl-DUOT2ZMQ.mjs +2 -0
  309. package/dist/chunks/nl-DUOT2ZMQ.mjs.map +1 -0
  310. package/dist/chunks/nl-DYnRYvZ5.mjs +2 -0
  311. package/dist/chunks/nl-DYnRYvZ5.mjs.map +1 -0
  312. package/dist/chunks/nl-DaNJ-ffX.mjs +2 -0
  313. package/dist/chunks/nl-DaNJ-ffX.mjs.map +1 -0
  314. package/dist/chunks/nl-DeOJ64xy.mjs +2 -0
  315. package/dist/chunks/nl-DeOJ64xy.mjs.map +1 -0
  316. package/dist/chunks/nl-DwZajfpP.mjs +2 -0
  317. package/dist/chunks/nl-DwZajfpP.mjs.map +1 -0
  318. package/dist/chunks/nl-Dyjc9M7o.mjs +2 -0
  319. package/dist/chunks/nl-Dyjc9M7o.mjs.map +1 -0
  320. package/dist/chunks/nl-GBpv7W4L.mjs +2 -0
  321. package/dist/chunks/nl-GBpv7W4L.mjs.map +1 -0
  322. package/dist/chunks/nl-HFfWJOEo.mjs +2 -0
  323. package/dist/chunks/nl-HFfWJOEo.mjs.map +1 -0
  324. package/dist/chunks/nl-KqmiCeD7.mjs +2 -0
  325. package/dist/chunks/nl-KqmiCeD7.mjs.map +1 -0
  326. package/dist/chunks/nl-_QT7e2Qt.mjs +2 -0
  327. package/dist/chunks/nl-_QT7e2Qt.mjs.map +1 -0
  328. package/dist/chunks/nl-i79IajbC.mjs +2 -0
  329. package/dist/chunks/nl-i79IajbC.mjs.map +1 -0
  330. package/dist/chunks/nl-lcZvrAz6.mjs +2 -0
  331. package/dist/chunks/nl-lcZvrAz6.mjs.map +1 -0
  332. package/dist/chunks/nl-tWJ2imhe.mjs +2 -0
  333. package/dist/chunks/nl-tWJ2imhe.mjs.map +1 -0
  334. package/dist/chunks/nl-xfiNOCgg.mjs +2 -0
  335. package/dist/chunks/nl-xfiNOCgg.mjs.map +1 -0
  336. package/dist/chunks/pt-5VeuNDd2.mjs.map +1 -1
  337. package/dist/chunks/pt-BCXgUDiU.mjs.map +1 -1
  338. package/dist/chunks/pt-BDam9cDu.mjs.map +1 -1
  339. package/dist/chunks/pt-Bb908r0n.mjs.map +1 -1
  340. package/dist/chunks/pt-BkpVtod-.mjs.map +1 -1
  341. package/dist/chunks/pt-BlFAJZo7.mjs.map +1 -1
  342. package/dist/chunks/pt-Bu7Mbz67.mjs.map +1 -1
  343. package/dist/chunks/pt-BuZ7acHF.mjs.map +1 -1
  344. package/dist/chunks/pt-C8sOyw0V.mjs.map +1 -1
  345. package/dist/chunks/pt-CEUgbrii.mjs.map +1 -1
  346. package/dist/chunks/pt-CFrcl1v_.mjs.map +1 -1
  347. package/dist/chunks/pt-CMrFpUWS.mjs.map +1 -1
  348. package/dist/chunks/pt-CMx2wPPY.mjs.map +1 -1
  349. package/dist/chunks/pt-CR4j8gtE.mjs.map +1 -1
  350. package/dist/chunks/pt-Cc4zysaT.mjs.map +1 -1
  351. package/dist/chunks/pt-Cv6q7x5x.mjs.map +1 -1
  352. package/dist/chunks/pt-DFKJVh7k.mjs.map +1 -1
  353. package/dist/chunks/pt-DP5c76Vo.mjs +2 -0
  354. package/dist/chunks/pt-DP5c76Vo.mjs.map +1 -0
  355. package/dist/chunks/pt-DYMyMgKQ.mjs.map +1 -1
  356. package/dist/chunks/pt-D__tcM2T.mjs.map +1 -1
  357. package/dist/chunks/pt-Dg2ctkug.mjs.map +1 -1
  358. package/dist/chunks/pt-DgfMoLWR.mjs.map +1 -1
  359. package/dist/chunks/pt-OXa_IR4Q.mjs.map +1 -1
  360. package/dist/chunks/pt-UPF7DBlz.mjs.map +1 -1
  361. package/dist/chunks/pt-_qxIe7zX.mjs.map +1 -1
  362. package/dist/chunks/pt-paXY7HFt.mjs.map +1 -1
  363. package/dist/chunks/pt-zMHcNGPk.mjs.map +1 -1
  364. package/dist/chunks/register-DSRtHVkk.mjs +3 -0
  365. package/dist/chunks/register-DSRtHVkk.mjs.map +1 -0
  366. package/dist/chunks/ru--iYEtsT5.mjs +2 -0
  367. package/dist/chunks/ru--iYEtsT5.mjs.map +1 -0
  368. package/dist/chunks/ru-B1m8J9dl.mjs.map +1 -1
  369. package/dist/chunks/ru-BNPUT-3S.mjs.map +1 -1
  370. package/dist/chunks/ru-BotG0MFT.mjs.map +1 -1
  371. package/dist/chunks/ru-C-APN_dm.mjs.map +1 -1
  372. package/dist/chunks/ru-C9yFslEG.mjs.map +1 -1
  373. package/dist/chunks/ru-CkG_bpfo.mjs.map +1 -1
  374. package/dist/chunks/ru-Cs8KCNyq.mjs.map +1 -1
  375. package/dist/chunks/ru-CsP6mLxp.mjs.map +1 -1
  376. package/dist/chunks/ru-CvDl-yEd.mjs.map +1 -1
  377. package/dist/chunks/ru-CwyPz2Va.mjs.map +1 -1
  378. package/dist/chunks/ru-D53d-_UB.mjs.map +1 -1
  379. package/dist/chunks/ru-DJMpeuey.mjs.map +1 -1
  380. package/dist/chunks/ru-DSRv3_Rg.mjs.map +1 -1
  381. package/dist/chunks/ru-DV-lgEtM.mjs.map +1 -1
  382. package/dist/chunks/ru-DiwQV30V.mjs.map +1 -1
  383. package/dist/chunks/ru-DkW9XZFy.mjs.map +1 -1
  384. package/dist/chunks/ru-DyCTlhjg.mjs.map +1 -1
  385. package/dist/chunks/ru-QGX8lOTs.mjs.map +1 -1
  386. package/dist/chunks/ru-QcTo2yoL.mjs.map +1 -1
  387. package/dist/chunks/ru-Y11wuxOB.mjs.map +1 -1
  388. package/dist/chunks/ru-Yngw7nFP.mjs.map +1 -1
  389. package/dist/chunks/ru-d68SZpEe.mjs.map +1 -1
  390. package/dist/chunks/ru-gxbzqLL8.mjs.map +1 -1
  391. package/dist/chunks/ru-k7o3Qks3.mjs.map +1 -1
  392. package/dist/chunks/ru-l73diFXn.mjs.map +1 -1
  393. package/dist/chunks/ru-q8kz-237.mjs.map +1 -1
  394. package/dist/chunks/src-DDkRstYh.mjs +2 -0
  395. package/dist/chunks/src-DDkRstYh.mjs.map +1 -0
  396. package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -1
  397. package/dist/chunks/zh-BFZOM3lF.mjs.map +1 -1
  398. package/dist/chunks/zh-BGYJXxVl.mjs.map +1 -1
  399. package/dist/chunks/zh-BP97XjlS.mjs.map +1 -1
  400. package/dist/chunks/zh-BQ73oqxc.mjs.map +1 -1
  401. package/dist/chunks/zh-BQqf3wJZ.mjs.map +1 -1
  402. package/dist/chunks/zh-Baxh6v0j.mjs.map +1 -1
  403. package/dist/chunks/zh-BvuAbM2S.mjs.map +1 -1
  404. package/dist/chunks/zh-C-wHnDo5.mjs.map +1 -1
  405. package/dist/chunks/zh-C7iCgCRP.mjs.map +1 -1
  406. package/dist/chunks/zh-CRsDvfPR.mjs.map +1 -1
  407. package/dist/chunks/zh-CWGAPVei.mjs.map +1 -1
  408. package/dist/chunks/zh-CWIzJcXi.mjs.map +1 -1
  409. package/dist/chunks/zh-CYV-db-K.mjs.map +1 -1
  410. package/dist/chunks/zh-CiIyOm6U.mjs.map +1 -1
  411. package/dist/chunks/zh-CnW44JEw.mjs.map +1 -1
  412. package/dist/chunks/zh-D1HSmSOf.mjs.map +1 -1
  413. package/dist/chunks/zh-DUS7JduA.mjs +2 -0
  414. package/dist/chunks/zh-DUS7JduA.mjs.map +1 -0
  415. package/dist/chunks/zh-DWN1Jqn3.mjs.map +1 -1
  416. package/dist/chunks/zh-DYD476c5.mjs.map +1 -1
  417. package/dist/chunks/zh-DdzgYD7k.mjs.map +1 -1
  418. package/dist/chunks/zh-DgSmvLyw.mjs.map +1 -1
  419. package/dist/chunks/zh-DlVfQn4z.mjs.map +1 -1
  420. package/dist/chunks/zh-Oj-qSUEp.mjs.map +1 -1
  421. package/dist/chunks/zh-YfuE_m2y.mjs.map +1 -1
  422. package/dist/chunks/zh-dGSDBBzb.mjs.map +1 -1
  423. package/dist/chunks/zh-ikm3rSTR.mjs.map +1 -1
  424. package/dist/chunks/zh-oZl1P_p0.mjs.map +1 -1
  425. package/dist/commands/BlockInsertion.d.ts +15 -19
  426. package/dist/commands/BlockInsertion.d.ts.map +1 -1
  427. package/dist/commands/Commands.d.ts +3 -0
  428. package/dist/commands/Commands.d.ts.map +1 -1
  429. package/dist/commands/CompositionCommands.d.ts +14 -8
  430. package/dist/commands/CompositionCommands.d.ts.map +1 -1
  431. package/dist/commands/CompositionFallback.d.ts +13 -0
  432. package/dist/commands/CompositionFallback.d.ts.map +1 -0
  433. package/dist/commands/CompositionRebase.d.ts +17 -10
  434. package/dist/commands/CompositionRebase.d.ts.map +1 -1
  435. package/dist/commands/PasteCommand.d.ts.map +1 -1
  436. package/dist/commands/SelectionDeletion.d.ts +7 -5
  437. package/dist/commands/SelectionDeletion.d.ts.map +1 -1
  438. package/dist/commands/SelectionReplacement.d.ts +42 -0
  439. package/dist/commands/SelectionReplacement.d.ts.map +1 -0
  440. package/dist/editor/BlockIdentity.d.ts +16 -0
  441. package/dist/editor/BlockIdentity.d.ts.map +1 -0
  442. package/dist/editor/ContentSerializer.d.ts +13 -11
  443. package/dist/editor/ContentSerializer.d.ts.map +1 -1
  444. package/dist/editor/NotectlEditor.d.ts +6 -5
  445. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  446. package/dist/editor/locales/nl.d.ts +4 -0
  447. package/dist/editor/locales/nl.d.ts.map +1 -0
  448. package/dist/editor/styles/link.d.ts +3 -0
  449. package/dist/editor/styles/link.d.ts.map +1 -0
  450. package/dist/fonts/math.mjs +1 -1
  451. package/dist/fonts.mjs +1 -1
  452. package/dist/full.mjs +1 -1
  453. package/dist/html.mjs +1 -1
  454. package/dist/i18n/Locale.d.ts +1 -0
  455. package/dist/i18n/Locale.d.ts.map +1 -1
  456. package/dist/index.d.ts +1 -1
  457. package/dist/index.d.ts.map +1 -1
  458. package/dist/input/CompositionController.d.ts.map +1 -1
  459. package/dist/input/HTMLLineBreaks.d.ts +14 -0
  460. package/dist/input/HTMLLineBreaks.d.ts.map +1 -0
  461. package/dist/input/HTMLParser.d.ts +1 -7
  462. package/dist/input/HTMLParser.d.ts.map +1 -1
  463. package/dist/input/PasteHTMLHandler.d.ts +0 -1
  464. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  465. package/dist/input/PasteHandler.d.ts.map +1 -1
  466. package/dist/input/PasteRichBlockHandler.d.ts +10 -17
  467. package/dist/input/PasteRichBlockHandler.d.ts.map +1 -1
  468. package/dist/markdown.mjs +1 -1
  469. package/dist/model/ContentModel.d.ts +6 -1
  470. package/dist/model/ContentModel.d.ts.map +1 -1
  471. package/dist/model/FileHandlerDispatcher.d.ts +3 -1
  472. package/dist/model/FileHandlerDispatcher.d.ts.map +1 -1
  473. package/dist/model/FileHandlerRegistry.d.ts +11 -2
  474. package/dist/model/FileHandlerRegistry.d.ts.map +1 -1
  475. package/dist/notectl-core.mjs +1 -1
  476. package/dist/notectl-core.umd.js +1 -1
  477. package/dist/notectl-core.umd.js.map +1 -1
  478. package/dist/plugins/PluginContextFactory.d.ts +1 -0
  479. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  480. package/dist/plugins/PluginManager.d.ts +5 -0
  481. package/dist/plugins/PluginManager.d.ts.map +1 -1
  482. package/dist/plugins/alignment/locales/nl.d.ts +4 -0
  483. package/dist/plugins/alignment/locales/nl.d.ts.map +1 -0
  484. package/dist/plugins/alignment.mjs +1 -1
  485. package/dist/plugins/bidi-isolation/locales/nl.d.ts +4 -0
  486. package/dist/plugins/bidi-isolation/locales/nl.d.ts.map +1 -0
  487. package/dist/plugins/bidi-isolation.mjs +1 -1
  488. package/dist/plugins/blockquote/locales/nl.d.ts +4 -0
  489. package/dist/plugins/blockquote/locales/nl.d.ts.map +1 -0
  490. package/dist/plugins/blockquote.mjs +1 -1
  491. package/dist/plugins/caret-navigation/locales/nl.d.ts +4 -0
  492. package/dist/plugins/caret-navigation/locales/nl.d.ts.map +1 -0
  493. package/dist/plugins/caret-navigation.mjs +1 -1
  494. package/dist/plugins/code-block/CodeBlockSchema.d.ts.map +1 -1
  495. package/dist/plugins/code-block/locales/nl.d.ts +4 -0
  496. package/dist/plugins/code-block/locales/nl.d.ts.map +1 -0
  497. package/dist/plugins/code-block.mjs +1 -1
  498. package/dist/plugins/editor-ui/EditorUI.d.ts +50 -0
  499. package/dist/plugins/editor-ui/EditorUI.d.ts.map +1 -0
  500. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts +44 -0
  501. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts.map +1 -0
  502. package/dist/plugins/editor-ui/index.d.ts +6 -0
  503. package/dist/plugins/editor-ui/index.d.ts.map +1 -0
  504. package/dist/plugins/font/locales/nl.d.ts +4 -0
  505. package/dist/plugins/font/locales/nl.d.ts.map +1 -0
  506. package/dist/plugins/font-size/locales/nl.d.ts +4 -0
  507. package/dist/plugins/font-size/locales/nl.d.ts.map +1 -0
  508. package/dist/plugins/font-size.mjs +1 -1
  509. package/dist/plugins/font.mjs +1 -1
  510. package/dist/plugins/formula/FormulaCommands.d.ts +6 -4
  511. package/dist/plugins/formula/FormulaCommands.d.ts.map +1 -1
  512. package/dist/plugins/formula/locales/nl.d.ts +4 -0
  513. package/dist/plugins/formula/locales/nl.d.ts.map +1 -0
  514. package/dist/plugins/formula.mjs +1 -1
  515. package/dist/plugins/gap-cursor/locales/nl.d.ts +4 -0
  516. package/dist/plugins/gap-cursor/locales/nl.d.ts.map +1 -0
  517. package/dist/plugins/gap-cursor.mjs +1 -1
  518. package/dist/plugins/hard-break.mjs +1 -1
  519. package/dist/plugins/heading/locales/nl.d.ts +4 -0
  520. package/dist/plugins/heading/locales/nl.d.ts.map +1 -0
  521. package/dist/plugins/heading.mjs +1 -1
  522. package/dist/plugins/highlight/locales/nl.d.ts +4 -0
  523. package/dist/plugins/highlight/locales/nl.d.ts.map +1 -0
  524. package/dist/plugins/highlight.mjs +1 -1
  525. package/dist/plugins/horizontal-rule/locales/nl.d.ts +4 -0
  526. package/dist/plugins/horizontal-rule/locales/nl.d.ts.map +1 -0
  527. package/dist/plugins/horizontal-rule.mjs +1 -1
  528. package/dist/plugins/image/ImageCommands.d.ts +15 -3
  529. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  530. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  531. package/dist/plugins/image/locales/nl.d.ts +4 -0
  532. package/dist/plugins/image/locales/nl.d.ts.map +1 -0
  533. package/dist/plugins/image.mjs +1 -1
  534. package/dist/plugins/inline-code/locales/nl.d.ts +4 -0
  535. package/dist/plugins/inline-code/locales/nl.d.ts.map +1 -0
  536. package/dist/plugins/inline-code.mjs +1 -1
  537. package/dist/plugins/link/LinkBubble.d.ts +31 -0
  538. package/dist/plugins/link/LinkBubble.d.ts.map +1 -0
  539. package/dist/plugins/link/LinkBubbleContent.d.ts +4 -0
  540. package/dist/plugins/link/LinkBubbleContent.d.ts.map +1 -0
  541. package/dist/plugins/link/LinkInteractionController.d.ts +40 -0
  542. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -0
  543. package/dist/plugins/link/LinkLocale.d.ts +10 -1
  544. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  545. package/dist/plugins/link/LinkNavigation.d.ts +12 -0
  546. package/dist/plugins/link/LinkNavigation.d.ts.map +1 -0
  547. package/dist/plugins/link/LinkPlugin.d.ts +4 -5
  548. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  549. package/dist/plugins/link/LinkRange.d.ts +12 -0
  550. package/dist/plugins/link/LinkRange.d.ts.map +1 -0
  551. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  552. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  553. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  554. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  555. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  556. package/dist/plugins/link/locales/nl.d.ts +4 -0
  557. package/dist/plugins/link/locales/nl.d.ts.map +1 -0
  558. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  559. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  560. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  561. package/dist/plugins/link.mjs +1 -1
  562. package/dist/plugins/list/locales/nl.d.ts +4 -0
  563. package/dist/plugins/list/locales/nl.d.ts.map +1 -0
  564. package/dist/plugins/list.mjs +1 -1
  565. package/dist/plugins/print/locales/nl.d.ts +4 -0
  566. package/dist/plugins/print/locales/nl.d.ts.map +1 -0
  567. package/dist/plugins/print.mjs +1 -1
  568. package/dist/plugins/shared/PopupManager.d.ts +20 -2
  569. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  570. package/dist/plugins/shared/PopupPositioning.d.ts +2 -6
  571. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  572. package/dist/plugins/shared/index.d.ts +1 -1
  573. package/dist/plugins/shared/index.d.ts.map +1 -1
  574. package/dist/plugins/shared.mjs +1 -1
  575. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts +0 -1
  576. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
  577. package/dist/plugins/smart-paste/locales/nl.d.ts +4 -0
  578. package/dist/plugins/smart-paste/locales/nl.d.ts.map +1 -0
  579. package/dist/plugins/smart-paste.mjs +1 -1
  580. package/dist/plugins/strikethrough/locales/nl.d.ts +4 -0
  581. package/dist/plugins/strikethrough/locales/nl.d.ts.map +1 -0
  582. package/dist/plugins/strikethrough.mjs +1 -1
  583. package/dist/plugins/super-sub/locales/nl.d.ts +4 -0
  584. package/dist/plugins/super-sub/locales/nl.d.ts.map +1 -0
  585. package/dist/plugins/super-sub.mjs +1 -1
  586. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  587. package/dist/plugins/table/TableSelection.d.ts +4 -20
  588. package/dist/plugins/table/TableSelection.d.ts.map +1 -1
  589. package/dist/plugins/table/TableSelectionTypes.d.ts +21 -0
  590. package/dist/plugins/table/TableSelectionTypes.d.ts.map +1 -0
  591. package/dist/plugins/table/locales/nl.d.ts +4 -0
  592. package/dist/plugins/table/locales/nl.d.ts.map +1 -0
  593. package/dist/plugins/table.mjs +1 -1
  594. package/dist/plugins/text-color/locales/nl.d.ts +4 -0
  595. package/dist/plugins/text-color/locales/nl.d.ts.map +1 -0
  596. package/dist/plugins/text-color.mjs +1 -1
  597. package/dist/plugins/text-direction/locales/nl.d.ts +4 -0
  598. package/dist/plugins/text-direction/locales/nl.d.ts.map +1 -0
  599. package/dist/plugins/text-direction-auto.mjs +1 -1
  600. package/dist/plugins/text-direction.mjs +1 -1
  601. package/dist/plugins/text-formatting/locales/nl.d.ts +4 -0
  602. package/dist/plugins/text-formatting/locales/nl.d.ts.map +1 -0
  603. package/dist/plugins/text-formatting.mjs +1 -1
  604. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +2 -2
  605. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  606. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -1
  607. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  608. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +8 -3
  609. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  610. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +4 -0
  611. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -1
  612. package/dist/plugins/toolbar/locales/nl.d.ts +4 -0
  613. package/dist/plugins/toolbar/locales/nl.d.ts.map +1 -0
  614. package/dist/plugins/toolbar.mjs +1 -1
  615. package/dist/plugins/video/locales/nl.d.ts +4 -0
  616. package/dist/plugins/video/locales/nl.d.ts.map +1 -0
  617. package/dist/plugins/video.mjs +1 -1
  618. package/dist/presets/full.mjs +1 -1
  619. package/dist/presets/minimal.mjs +1 -1
  620. package/dist/presets.mjs +1 -1
  621. package/dist/register.mjs +1 -1
  622. package/dist/serialization/DocumentParser.d.ts +2 -2
  623. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  624. package/dist/serialization/HTMLParseRules.d.ts.map +1 -1
  625. package/dist/serialization/HTMLSanitization.d.ts +6 -0
  626. package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
  627. package/dist/serialization/PreformattedText.d.ts +3 -0
  628. package/dist/serialization/PreformattedText.d.ts.map +1 -0
  629. package/dist/state/History.d.ts.map +1 -1
  630. package/dist/state/RangeMapping.d.ts +10 -0
  631. package/dist/state/RangeMapping.d.ts.map +1 -0
  632. package/dist/state/StepApplication.d.ts.map +1 -1
  633. package/dist/state/Steps.d.ts +3 -0
  634. package/dist/state/Steps.d.ts.map +1 -1
  635. package/dist/state/StructuralPositions.d.ts +15 -0
  636. package/dist/state/StructuralPositions.d.ts.map +1 -0
  637. package/dist/state/TransactionBuilder.d.ts +6 -14
  638. package/dist/state/TransactionBuilder.d.ts.map +1 -1
  639. package/dist/test/TestUtils.d.ts.map +1 -1
  640. package/dist/ui.d.ts +3 -0
  641. package/dist/ui.d.ts.map +1 -0
  642. package/dist/ui.mjs +1 -0
  643. package/dist/view/EditorInteraction.d.ts +23 -0
  644. package/dist/view/EditorInteraction.d.ts.map +1 -0
  645. package/dist/view/EditorView.d.ts +2 -0
  646. package/dist/view/EditorView.d.ts.map +1 -1
  647. package/dist/view/EditorViewEvents.d.ts.map +1 -1
  648. package/dist/view/SelectionGeometry.d.ts +29 -0
  649. package/dist/view/SelectionGeometry.d.ts.map +1 -0
  650. package/dist/view/SelectionObserver.d.ts +19 -0
  651. package/dist/view/SelectionObserver.d.ts.map +1 -0
  652. package/dist/view/SelectionSync.d.ts +7 -0
  653. package/dist/view/SelectionSync.d.ts.map +1 -1
  654. package/package.json +12 -8
  655. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +0 -2
  656. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs.map +0 -1
  657. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +0 -2
  658. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs.map +0 -1
  659. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs +0 -2
  660. package/dist/chunks/BlockInsertion-CxKdCKJd.mjs.map +0 -1
  661. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +0 -2
  662. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs.map +0 -1
  663. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs +0 -2
  664. package/dist/chunks/CaretNavigationPlugin-BxWjR7SN.mjs.map +0 -1
  665. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs +0 -2
  666. package/dist/chunks/CodeBlockPlugin-BIrkK4ER.mjs.map +0 -1
  667. package/dist/chunks/Commands-DBBCAYBn.mjs +0 -2
  668. package/dist/chunks/Commands-DBBCAYBn.mjs.map +0 -1
  669. package/dist/chunks/ContentModel-BLC3Tez8.mjs +0 -2
  670. package/dist/chunks/ContentModel-BLC3Tez8.mjs.map +0 -1
  671. package/dist/chunks/DocumentParser-BKUrtgw1.mjs +0 -2
  672. package/dist/chunks/DocumentParser-BKUrtgw1.mjs.map +0 -1
  673. package/dist/chunks/FontPlugin-BcXNFqqO.mjs +0 -2
  674. package/dist/chunks/FontPlugin-BcXNFqqO.mjs.map +0 -1
  675. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs +0 -2
  676. package/dist/chunks/FontSizePlugin-BQ9Aj8cT.mjs.map +0 -1
  677. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs +0 -2
  678. package/dist/chunks/FormulaPlugin-Bw_sO_lq.mjs.map +0 -1
  679. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +0 -2
  680. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs.map +0 -1
  681. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +0 -2
  682. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +0 -1
  683. package/dist/chunks/HardBreakPlugin-svNnJ9Xj.mjs.map +0 -1
  684. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +0 -2
  685. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs.map +0 -1
  686. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +0 -2
  687. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs.map +0 -1
  688. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs +0 -2
  689. package/dist/chunks/HorizontalRulePlugin-CQ5NT2Mo.mjs.map +0 -1
  690. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs +0 -2
  691. package/dist/chunks/ImagePlugin-BzLvPXGo.mjs.map +0 -1
  692. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +0 -2
  693. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs.map +0 -1
  694. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs +0 -2
  695. package/dist/chunks/LinkPlugin-BuzrXo2c.mjs.map +0 -1
  696. package/dist/chunks/ListPlugin-DTgpvBEt.mjs +0 -2
  697. package/dist/chunks/ListPlugin-DTgpvBEt.mjs.map +0 -1
  698. package/dist/chunks/MarkdownHTMLRegistry-BunUDiza.mjs.map +0 -1
  699. package/dist/chunks/MarkdownParser-CvYOvU3d.mjs.map +0 -1
  700. package/dist/chunks/MarkdownSerializer-CdUBWWGI.mjs.map +0 -1
  701. package/dist/chunks/NodeSelectionCommands-B0Sb4ux4.mjs.map +0 -1
  702. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +0 -2
  703. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +0 -1
  704. package/dist/chunks/PopupManager-Jz5JrUdC.mjs +0 -2
  705. package/dist/chunks/PopupManager-Jz5JrUdC.mjs.map +0 -1
  706. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs +0 -2
  707. package/dist/chunks/PrintPlugin-BxNlFk2c.mjs.map +0 -1
  708. package/dist/chunks/SchemaRegistry-Cs7rxafF.mjs.map +0 -1
  709. package/dist/chunks/SelectionSync-BkjCwGp-.mjs.map +0 -1
  710. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +0 -2
  711. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs.map +0 -1
  712. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs +0 -2
  713. package/dist/chunks/SmartPastePlugin-C3SVKkWK.mjs.map +0 -1
  714. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs +0 -2
  715. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs.map +0 -1
  716. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs +0 -2
  717. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs.map +0 -1
  718. package/dist/chunks/TableDimensions-BSEOEox2.mjs.map +0 -1
  719. package/dist/chunks/TablePlugin-WPwp902E.mjs +0 -2
  720. package/dist/chunks/TablePlugin-WPwp902E.mjs.map +0 -1
  721. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +0 -2
  722. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs.map +0 -1
  723. package/dist/chunks/TextDirectionAutoPlugin-DOH5cfyy.mjs.map +0 -1
  724. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs +0 -2
  725. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs.map +0 -1
  726. package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
  727. package/dist/chunks/TextDirectionService-BcX07mw2.mjs.map +0 -1
  728. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs +0 -2
  729. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs.map +0 -1
  730. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs +0 -2
  731. package/dist/chunks/ToolbarPlugin-DmVI7MN9.mjs.map +0 -1
  732. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs +0 -2
  733. package/dist/chunks/VideoPlugin-D3zGQ6QV.mjs.map +0 -1
  734. package/dist/chunks/ar-Ctrv6cIi.mjs +0 -2
  735. package/dist/chunks/ar-Ctrv6cIi.mjs.map +0 -1
  736. package/dist/chunks/de-JhGflzS5.mjs +0 -2
  737. package/dist/chunks/de-JhGflzS5.mjs.map +0 -1
  738. package/dist/chunks/es-Bv7bDbMp.mjs +0 -2
  739. package/dist/chunks/es-Bv7bDbMp.mjs.map +0 -1
  740. package/dist/chunks/fr-DtzIu6tU.mjs +0 -2
  741. package/dist/chunks/fr-DtzIu6tU.mjs.map +0 -1
  742. package/dist/chunks/full-BiQ93ERr.mjs +0 -2
  743. package/dist/chunks/full-BiQ93ERr.mjs.map +0 -1
  744. package/dist/chunks/hi-Bu799xIO.mjs +0 -2
  745. package/dist/chunks/hi-Bu799xIO.mjs.map +0 -1
  746. package/dist/chunks/minimal-DO7LiFTa.mjs +0 -2
  747. package/dist/chunks/minimal-DO7LiFTa.mjs.map +0 -1
  748. package/dist/chunks/pt-DmN9u3NX.mjs +0 -2
  749. package/dist/chunks/pt-DmN9u3NX.mjs.map +0 -1
  750. package/dist/chunks/register-Cb1YTAN4.mjs +0 -3
  751. package/dist/chunks/register-Cb1YTAN4.mjs.map +0 -1
  752. package/dist/chunks/ru-BxySx7an.mjs +0 -2
  753. package/dist/chunks/ru-BxySx7an.mjs.map +0 -1
  754. package/dist/chunks/src-5GKFQ2mQ.mjs +0 -2
  755. package/dist/chunks/src-5GKFQ2mQ.mjs.map +0 -1
  756. package/dist/chunks/zh-DuucmOns.mjs +0 -2
  757. package/dist/chunks/zh-DuucmOns.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImagePlugin-aeqHr5zx.mjs","names":["MIN_IMAGE_WIDTH","IMAGE_CSS","IMAGE_POPUP_CSS","escapeHTML","getBlockChildren","isBlockNode","createBlockNode","isNodeSelection","createNodeSelection","isGapCursor","nodeType","insertBlockObjectOnOwnLine","findTableCellAncestor","deleteNodeSelection","ServiceKey","resolveLocale","loadLocaleModule","resolveReplacementTarget","setStyleProperty","getStyleNonceForNode","setStyleProperties","getTextDirection","createBlockElement","formatShortcut","insertImage","context","attrs","state","getState","sel","selection","anchorBlockId","nodeId","anchor","blockId","placeImage","transaction","pasteImage","builder","target","imageAttrs","src","alt","align","width","height","cellId","cellPath","getNodePath","imageBlock","cell","getBlock","blockChildren","i","length","rawIndex","children","findIndex","c","id","removeNode","insertNode","setSelection","insertImageIntoCell","insertImageAtRoot","dispatch","build","resizeImageByDelta","delta","maxWidth","block","type","currentWidth","currentHeight","aspectRatio","clampedWidth","Math","max","min","newHeight","round","path","merged","tr","setNodeAttr","setImageAttr","IMAGE_LOCALE_EN","insertImageTooltip","uploadFromComputer","uploadAria","separator","urlPlaceholder","urlAria","insertButton","insertAria","imageAria","parts","push","join","resetToNaturalSize","uploadFailed","uploading","resizeHandleLabel","position","imageSelected","altTextPrefix","imageSizeAnnounce","w","h","resizeHint","shrink","grow","imageResized","keyboardResizeHint","localeModules","Object","assign","async","loadImageLocale","lang","ALIGNMENT_CLASSES","start","center","end","HANDLE_CURSORS","nw","ne","sw","se","HANDLE_X_SIGN","RTL_CURSOR_MAP","activeCursorStyle","clearGlobalResizeCursor","remove","createImageNodeViewFactory","config","uploadStates","resolvedKeymap","locale","node","figure","document","createElement","className","setAttribute","container","img","draggable","overlay","appendChild","currentNodeId","resizeOverlay","applyAttrs","n","cls","values","classList","alignClass","add","uploadState","get","isUploading","toggle","textContent","removeAttribute","updateAriaLabel","dimensionsCommitted","attachHandleListeners","handle","sizeIndicator","startX","startWidth","xSign","onPointerMove","e","deltaX","clientX","newWidth","onPointerUp","removeEventListener","finalWidth","getBoundingClientRect","prevWidth","prevHeight","commitResize","releasePointerCapture","pointerId","addEventListener","preventDefault","stopPropagation","isRtl","sign","getResizeXSign","imgHeight","cursor","referenceNode","nonce","head","setGlobalResizeCursor","setPointerCapture","removeResizeOverlay","hasWidth","hasHeight","naturalW","naturalWidth","naturalH","naturalHeight","clampedW","ratio","clampedH","dom","contentDOM","update","updatedNode","selectNode","resizable","pos","hintText","shrinkWidth","growWidth","buildKeyboardHintText","hint","createResizeOverlay","deselectNode","destroy","IMAGE_UPLOAD_SERVICE","DEFAULT_IMAGE_KEYMAP","growWidthLarge","shrinkWidthLarge","resetSize","DEFAULT_IMAGE_CONFIG","maxFileSize","acceptedTypes","resizeStep","resizeStepLarge","ImagePlugin","name","priority","Map","blobUrls","Set","constructor","this","keymap","init","registerStyleSheet","registerNodeSpec","registerInlineImageNodeSpec","registerNodeView","registerCommand","nodePath","removeImage","registerImageCommands","registerResizeCommands","registerResizeKeymaps","registerFileHandler","registerToolbarItem","url","URL","revokeObjectURL","clear","onStateChange","oldState","newState","_tr","keys","delete","oldIsImage","isImageSelected","nowIsImage","announceImageSelection","group","isVoid","selectable","default","title","toDOM","imgContainer","titleAttr","toHTML","sizeAttrs","titleValue","parseHTML","tag","getAttrs","el","querySelector","getAttribute","Number","parseInt","textAlign","style","contains","sanitize","tags","registerInlineNodeSpec","String","toHTMLString","step","stepLarge","result","announceCurrentSize","cleaned","fromEntries","entries","filter","k","resetImageSize","announce","bindings","slot","commandName","binding","executeCommand","registerKeymap","file","_position","source","isAcceptedType","handleFileInsert","place","size","blobUrl","createObjectURL","imageBlockId","set","getService","uploadFile","uploadService","upload","icon","label","tooltip","command","popupType","renderPopup","ctx","onClose","fileInput","accept","uploadBtn","click","files","onFileInsert","getContainer","focus","appendFileUploadSection","line1","orText","line2","appendSeparator","urlInput","placeholder","insertBtn","applyUrl","value","trim","key","requestAnimationFrame","appendUrlSection","renderImagePopup","mimeType","some","accepted","endsWith","startsWith","slice","shrinkKey","growKey"],"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 {\n\tfindTableCellAncestor,\n\tinsertBlockObjectOnOwnLine,\n} from '../../commands/BlockInsertion.js';\nimport { deleteNodeSelection } from '../../commands/NodeSelectionCommands.js';\nimport {\n\ttype ReplacementTarget,\n\tresolveReplacementTarget,\n} from '../../commands/SelectionReplacement.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 { TransactionBuilder } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { ImageAttrs } from './ImageUpload.js';\n\n/** Attributes for a new image: a source plus any optional image attributes. */\ntype ImageInsertAttrs = Partial<ImageAttrs> & { readonly src: string };\n\n/** Places a new image at the selection: {@link insertImage} or {@link pasteImage}. */\nexport type ImagePlacement = (context: PluginContext, attrs: ImageInsertAttrs) => boolean;\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(context: PluginContext, attrs: ImageInsertAttrs): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (isGapCursor(sel)) return false;\n\n\tconst anchorBlockId: BlockId = isNodeSelection(sel) ? sel.nodeId : sel.anchor.blockId;\n\treturn placeImage(context, state, state.transaction('command'), anchorBlockId, attrs);\n}\n\n/**\n * Pastes an image block. Unlike {@link insertImage}, a range selection is\n * replaced, as by every other paste (#267): the range is deleted and the image\n * is placed relative to the block that receives the range start, in the same\n * transaction, so one undo restores both.\n */\nexport function pasteImage(context: PluginContext, attrs: ImageInsertAttrs): boolean {\n\tconst state = context.getState();\n\tif (isGapCursor(state.selection)) return false;\n\n\tconst builder: TransactionBuilder = state.transaction('paste');\n\tconst target: ReplacementTarget = resolveReplacementTarget(state, builder);\n\treturn placeImage(context, target.state, builder, target.blockId, attrs);\n}\n\n/**\n * Adds the steps placing an image relative to `anchorBlockId` in `state` to\n * `builder` and dispatches the transaction. Returns false, dispatching\n * nothing, when the anchor cannot be resolved.\n */\nfunction placeImage(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\tattrs: ImageInsertAttrs,\n): boolean {\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\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\tconst placed: boolean = cellId\n\t\t? insertImageIntoCell(state, builder, cellId, imageAttrs)\n\t\t: insertImageAtRoot(state, builder, anchorBlockId, imageAttrs);\n\tif (!placed) return false;\n\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Inserts an image on its own line at document root, after the anchor block. */\nfunction insertImageAtRoot(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\n\tanchorBlockId: BlockId,\n\timageAttrs: BlockAttrs,\n): boolean {\n\tconst imageBlock: BlockNode = createBlockNode(nodeType('image'), [], undefined, imageAttrs);\n\tconst trailing = insertBlockObjectOnOwnLine(state, builder, anchorBlockId, imageBlock);\n\tif (!trailing) return false;\n\n\tbuilder.setSelection(createNodeSelection(imageBlock.id, []));\n\treturn true;\n}\n\n/** Inserts an image as a child of a table cell. */\nfunction insertImageIntoCell(\n\tstate: EditorState,\n\tbuilder: TransactionBuilder,\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 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\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\ttype ImagePlacement,\n\tinsertImage,\n\tpasteImage,\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, source) => {\n\t\t\tif (!this.isAcceptedType(file.type)) return false;\n\t\t\t// A pasted file replaces a range selection like any other paste; a drop\n\t\t\t// never deletes the selection.\n\t\t\tthis.handleFileInsert(context, file, source === 'paste' ? pasteImage : insertImage);\n\t\t\treturn true;\n\t\t});\n\t}\n\n\tprivate handleFileInsert(context: PluginContext, file: File, place: ImagePlacement): 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 = place(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, insertImage),\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":"Y,8pBCmCA,SAAgBwB,EAAYC,EAAwBC,GACnD,MAAMC,EAAQF,EAAQG,WAChBC,EAAMF,EAAMG,UAClB,GAAIrB,EAAYoB,GAAM,OAAO,EAE7B,MAAME,EAAyBxB,EAAgBsB,GAAOA,EAAIG,OAASH,EAAII,OAAOC,QAC9E,OAAOC,EAAWV,EAASE,EAAOA,EAAMS,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AAKiJ,KAAKxG,OAAOhC,kBAAkB9D,EAAOC,IAGjD,MAAMkU,EAA2B7H,KAAKzG,eAAeiF,aAAe,KAC9DsJ,EAAyB9H,KAAKzG,eAAekF,WAAa,KAC5DoJ,GAAaC,GAChBhR,EAAMC,KAAKiJ,KAAKxG,OAAO7B,WAAWtF,EAAewV,GAAYxV,EAAeyV,KAG7E9H,KAAKzN,QAAQ2R,SAASpN,EAAME,KAAK,KAClC,CAEA,mBAAA2M,CAA4BpR,GAC3B,MAAME,EAAQF,EAAQG,WAChBC,EAAMF,EAAMG,UAClB,IAAKvB,EAAgBsB,GAAM,OAE3B,MAAMyC,EAA+B3C,EAAMwB,SAAStB,EAAIG,QACxD,IAAKsC,GAAwB,UAAfA,EAAMC,KAAkB,OAEtC,MAAM3B,EAA4B0B,EAAM5C,OAAOkB,MACzCC,EAA6ByB,EAAM5C,OAAOmB,YAClC,IAAVD,QAAkC,IAAXC,GAC1BpB,EAAQ2R,SAASlE,KAAKxG,OAAO1B,aAAapE,EAAOC,GAEnD,U"}
@@ -0,0 +1,2 @@
1
+ import{O as t}from"./Document-ssR6hBzG.mjs";import{c as e,f as o,n as r}from"./Selection-DC6AOGgF.mjs";import{i as s}from"./TypeBrands-Ch9856Gb.mjs";import{s as i,t as n}from"./LocaleLoader-DEpTFuVc.mjs";import{t as l}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as a}from"./SimpleMark-DPTsIl9w.mjs";var c={label:"Inline Code",tooltip:t=>`Inline Code (${t})`},m=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-CMXjVzFx.mjs"),"./locales/de.ts":()=>import("./de-e6J6nvAD.mjs"),"./locales/es.ts":()=>import("./es-fTW0TkYV.mjs"),"./locales/fr.ts":()=>import("./fr-CQs0-pNX.mjs"),"./locales/hi.ts":()=>import("./hi-C2jEsf8v.mjs"),"./locales/nl.ts":()=>import("./nl-_QT7e2Qt.mjs"),"./locales/pt.ts":()=>import("./pt-BDam9cDu.mjs"),"./locales/ru.ts":()=>import("./ru-QcTo2yoL.mjs"),"./locales/zh.ts":()=>import("./zh-DWN1Jqn3.mjs")});async function d(t){return n(m,t,c)}var p={toolbar:!0,keymap:"Mod-E",inputRule:!0},f=/* @__PURE__ */new Set(["bold","italic","underline","strikethrough","highlight","font","fontSize","superscript","subscript"]),u=class{id="inline-code";name="Inline Code";priority=22;config;locale;constructor(t){this.config={...p,...t}}async init(t){this.locale=await i(t,this.config.locale,c,d),t.registerStyleSheet(".notectl-content code{background-color:var(--notectl-code-bg);color:var(--notectl-code-color);word-break:break-word;border-radius:4px;padding:.15em .35em;font-family:ui-monospace,SF Mono,Cascadia Code,Fira Code,monospace;font-size:.9em}@media (forced-colors:active){.notectl-content code{border:1px solid linktext}}"),this.registerMark(t),!1!==this.config.inputRule&&this.registerInputRule(t),this.registerExclusivityMiddleware(t)}registerMark(t){a(t,{markSpec:{type:"code",rank:3,toDOM:()=>document.createElement("code"),toHTMLString:(t,e)=>`<code>${e}</code>`,parseHTML:[{tag:"code",getAttrs:t=>"PRE"!==t.parentElement?.tagName&&{}},{tag:"span",getAttrs:t=>{const e=t.style.fontFamily.replace(/['"]/g,"").trim();return!!/^monospace$/i.test(e)&&{}}}],sanitize:{tags:["code"]}},command:"toggleInlineCode",keyBinding:null!==this.config.keymap?this.config.keymap??"Mod-E":null,toolbar:!1!==this.config.toolbar?{id:"inline_code",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(l(this.config.keymap??"Mod-E"))}:void 0})}registerInputRule(t){t.registerInputRule({pattern:/(?:^|[^`])(`([^`\uFFFC]+)`)$/,handler(t,i,n,l){const a=t.selection;if(!o(a))return null;if(!e(a))return null;const c=t.getBlock(a.anchor.blockId);if(!c||"code_block"===c.type)return null;const m=i[2],d=i[1];if(!m||!d)return null;const p=l-d.length;return t.transaction("input").deleteTextAt(a.anchor.blockId,p,l).insertText(a.anchor.blockId,p,m,[{type:s("code")}]).setSelection(r(a.anchor.blockId,p+m.length)).build()}})}registerExclusivityMiddleware(e){e.registerMiddleware((e,o,r)=>{let i=!1;const n=[];for(const a of e.steps){if("addMark"!==a.type){n.push(a);continue}const e=a.mark.type;if("code"===e){const e=o.getBlock(a.blockId);if(e){const o=t(e,a.from,a.to),r=/* @__PURE__ */new Set;for(const t of o)if("text"===t.kind)for(const e of t.marks)f.has(e.type)&&r.add(e.type);for(const t of r)i=!0,n.push({type:"removeMark",blockId:a.blockId,from:a.from,to:a.to,mark:{type:s(t)},...a.path?{path:a.path}:{}})}n.push(a);continue}if(f.has(e)){const e=o.getBlock(a.blockId);if(e&&t(e,a.from,a.to).some(t=>"text"===t.kind&&t.marks.some(t=>"code"===t.type))){i=!0;continue}}n.push(a)}let l=e.storedMarksAfter;if(l){const t=l.some(t=>"code"===t.type),e=l.some(t=>f.has(t.type));t&&e&&(l=l.filter(t=>!f.has(t.type)),i=!0)}r(i?{...e,steps:n,storedMarksAfter:l}:e)},{name:"inline-code:mark-exclusivity",priority:50})}};export{c as n,d as r,u as t};
2
+ //# sourceMappingURL=InlineCodePlugin-CIks06ti.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineCodePlugin-CIks06ti.mjs","names":["INLINE_CODE_CSS","getBlockContentSegmentsInRange","isCollapsed","isTextSelection","createCollapsedSelection","markType","resolveLocale","loadLocaleModule","formatShortcut","registerSimpleMark","INLINE_CODE_LOCALE_EN","label","tooltip","shortcut","localeModules","Object","assign","async","loadInlineCodeLocale","lang","DEFAULT_CONFIG","toolbar","keymap","inputRule","EXCLUDED_WITH_CODE","Set","InlineCodePlugin","id","name","priority","config","locale","constructor","this","init","context","registerStyleSheet","registerMark","registerInputRule","registerExclusivityMiddleware","markSpec","type","rank","toDOM","document","createElement","toHTMLString","_mark","content","parseHTML","tag","getAttrs","el","parentElement","tagName","fontFamily","style","replace","trim","test","sanitize","tags","command","keyBinding","group","icon","pattern","handler","state","match","_start","end","sel","selection","block","getBlock","anchor","blockId","innerText","backtickExpr","backtickExprStart","length","transaction","deleteTextAt","insertText","setSelection","build","registerMiddleware","tr","next","patched","patchedSteps","step","steps","push","stepMarkType","mark","segments","from","to","marksToRemove","seg","kind","m","marks","has","add","mt","path","some","storedMarksAfter","hasCode","hasExcluded","filter"],"sources":["../../src/plugins/inline-code/InlineCodeLocale.ts","../../src/plugins/inline-code/InlineCodeStyles.css?inline","../../src/plugins/inline-code/InlineCodePlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the InlineCodePlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface InlineCodeLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const INLINE_CODE_LOCALE_EN: InlineCodeLocale = {\n\tlabel: 'Inline Code',\n\ttooltip: (shortcut: string) => `Inline Code (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<InlineCodeLocale> = import.meta.glob<{\n\tdefault: InlineCodeLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadInlineCodeLocale(lang: string): Promise<InlineCodeLocale> {\n\treturn loadLocaleModule(localeModules, lang, INLINE_CODE_LOCALE_EN);\n}\n",".notectl-content code {\n\tfont-family: ui-monospace, \"SF Mono\", \"Cascadia Code\", \"Fira Code\", monospace;\n\tfont-size: 0.9em;\n\tpadding: 0.15em 0.35em;\n\tborder-radius: 4px;\n\tbackground-color: var(--notectl-code-bg);\n\tcolor: var(--notectl-code-color);\n\tword-break: break-word;\n}\n@media (forced-colors: active) {\n\t.notectl-content code {\n\t\tborder: 1px solid LinkText;\n\t}\n}\n","/**\n * InlineCodePlugin: registers an inline code mark with MarkSpec,\n * toggle command, keyboard shortcut (Mod-E), backtick InputRule,\n * toolbar button, and mark exclusivity middleware.\n */\n\nimport type { BlockNode, Mark } from '../../model/Document.js';\nimport { getBlockContentSegmentsInRange } from '../../model/Document.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { Step } from '../../state/Steps.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { registerSimpleMark } from '../shared/SimpleMark.js';\nimport {\n\tINLINE_CODE_LOCALE_EN,\n\ttype InlineCodeLocale,\n\tloadInlineCodeLocale,\n} from './InlineCodeLocale.js';\nimport INLINE_CODE_CSS from './InlineCodeStyles.css?inline';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tcode: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface InlineCodeConfig {\n\t/** Show toolbar button. Default: true */\n\treadonly toolbar?: boolean;\n\t/** Override keyboard shortcut. Set to null to disable. Default: 'Mod-E' */\n\treadonly keymap?: string | null;\n\t/** Enable backtick InputRule. Default: true */\n\treadonly inputRule?: boolean;\n\t/** Override locale strings */\n\treadonly locale?: InlineCodeLocale;\n}\n\nconst DEFAULT_CONFIG: InlineCodeConfig = {\n\ttoolbar: true,\n\tkeymap: 'Mod-E',\n\tinputRule: true,\n};\n\n// --- Mark Exclusivity ---\n\nconst EXCLUDED_WITH_CODE: ReadonlySet<string> = new Set([\n\t'bold',\n\t'italic',\n\t'underline',\n\t'strikethrough',\n\t'highlight',\n\t'font',\n\t'fontSize',\n\t'superscript',\n\t'subscript',\n]);\n\n// --- Plugin ---\n\nexport class InlineCodePlugin implements Plugin {\n\treadonly id = 'inline-code';\n\treadonly name = 'Inline Code';\n\treadonly priority = 22;\n\n\tprivate readonly config: InlineCodeConfig;\n\tprivate locale!: InlineCodeLocale;\n\n\tconstructor(config?: Partial<InlineCodeConfig>) {\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\tINLINE_CODE_LOCALE_EN,\n\t\t\tloadInlineCodeLocale,\n\t\t);\n\t\tcontext.registerStyleSheet(INLINE_CODE_CSS);\n\t\tthis.registerMark(context);\n\n\t\tif (this.config.inputRule !== false) {\n\t\t\tthis.registerInputRule(context);\n\t\t}\n\t\tthis.registerExclusivityMiddleware(context);\n\t}\n\n\tprivate registerMark(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=\"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z\"/></svg>';\n\n\t\tregisterSimpleMark(context, {\n\t\t\tmarkSpec: {\n\t\t\t\ttype: 'code',\n\t\t\t\trank: 3,\n\t\t\t\ttoDOM() {\n\t\t\t\t\treturn document.createElement('code');\n\t\t\t\t},\n\t\t\t\ttoHTMLString: (_mark, content) => `<code>${content}</code>`,\n\t\t\t\tparseHTML: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'code',\n\t\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\t\tif (el.parentElement?.tagName === 'PRE') return false;\n\t\t\t\t\t\t\treturn {};\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'span',\n\t\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\t\tconst fontFamily: string = el.style.fontFamily.replace(/['\"]/g, '').trim();\n\t\t\t\t\t\t\tif (/^monospace$/i.test(fontFamily)) return {};\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tsanitize: { tags: ['code'] },\n\t\t\t},\n\t\t\tcommand: 'toggleInlineCode',\n\t\t\tkeyBinding: this.config.keymap !== null ? (this.config.keymap ?? 'Mod-E') : null,\n\t\t\ttoolbar:\n\t\t\t\tthis.config.toolbar !== false\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tid: 'inline_code',\n\t\t\t\t\t\t\tgroup: 'format',\n\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\tlabel: this.locale.label,\n\t\t\t\t\t\t\ttooltip: this.locale.tooltip(formatShortcut(this.config.keymap ?? 'Mod-E')),\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\t// The inline-node placeholder (U+FFFC) is excluded from the span body so\n\t\t// the rule never matches across an inline node nor re-inserts it.\n\t\tconst pattern: RegExp = /(?:^|[^`])(`([^`\\uFFFC]+)`)$/;\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern,\n\t\t\thandler(state, match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block: 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 innerText: string | undefined = match[2];\n\t\t\t\tconst backtickExpr: string | undefined = match[1];\n\t\t\t\tif (!innerText || !backtickExpr) return null;\n\n\t\t\t\tconst backtickExprStart: number = end - backtickExpr.length;\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, backtickExprStart, end)\n\t\t\t\t\t.insertText(sel.anchor.blockId, backtickExprStart, innerText, [\n\t\t\t\t\t\t{ type: markType('code') },\n\t\t\t\t\t])\n\t\t\t\t\t.setSelection(\n\t\t\t\t\t\tcreateCollapsedSelection(sel.anchor.blockId, backtickExprStart + innerText.length),\n\t\t\t\t\t)\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Prevents formatting marks from coexisting with the code mark.\n\t * Bold, italic, underline, etc. are stripped when code is applied,\n\t * and code is blocked on text that already has formatting marks.\n\t * The link mark is allowed to coexist.\n\t */\n\tprivate registerExclusivityMiddleware(context: PluginContext): void {\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, state, next) => {\n\t\t\t\tlet patched = false;\n\t\t\t\tconst patchedSteps: Step[] = [];\n\n\t\t\t\tfor (const step of tr.steps) {\n\t\t\t\t\tif (step.type !== 'addMark') {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst stepMarkType: string = step.mark.type;\n\n\t\t\t\t\tif (stepMarkType === 'code') {\n\t\t\t\t\t\t// Adding code mark: inject removeMark steps for excluded marks\n\t\t\t\t\t\tconst block: BlockNode | undefined = state.getBlock(step.blockId);\n\t\t\t\t\t\tif (block) {\n\t\t\t\t\t\t\tconst segments = getBlockContentSegmentsInRange(block, step.from, step.to);\n\t\t\t\t\t\t\tconst marksToRemove: Set<string> = new Set();\n\t\t\t\t\t\t\tfor (const seg of segments) {\n\t\t\t\t\t\t\t\tif (seg.kind !== 'text') continue;\n\t\t\t\t\t\t\t\tfor (const m of seg.marks) {\n\t\t\t\t\t\t\t\t\tif (EXCLUDED_WITH_CODE.has(m.type)) {\n\t\t\t\t\t\t\t\t\t\tmarksToRemove.add(m.type);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (const mt of marksToRemove) {\n\t\t\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t\t\t\tpatchedSteps.push({\n\t\t\t\t\t\t\t\t\ttype: 'removeMark',\n\t\t\t\t\t\t\t\t\tblockId: step.blockId,\n\t\t\t\t\t\t\t\t\tfrom: step.from,\n\t\t\t\t\t\t\t\t\tto: step.to,\n\t\t\t\t\t\t\t\t\tmark: { type: markType(mt) },\n\t\t\t\t\t\t\t\t\t...(step.path ? { path: step.path } : {}),\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (EXCLUDED_WITH_CODE.has(stepMarkType)) {\n\t\t\t\t\t\t// Adding a formatting mark: block if target range has code mark\n\t\t\t\t\t\tconst block: BlockNode | undefined = state.getBlock(step.blockId);\n\t\t\t\t\t\tif (block) {\n\t\t\t\t\t\t\tconst segments = getBlockContentSegmentsInRange(block, step.from, step.to);\n\t\t\t\t\t\t\tconst hasCode: boolean = segments.some(\n\t\t\t\t\t\t\t\t(seg) => seg.kind === 'text' && seg.marks.some((m) => m.type === 'code'),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (hasCode) {\n\t\t\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t\t\t\tcontinue; // skip this step\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t}\n\n\t\t\t\t// Handle stored marks\n\t\t\t\tlet storedMarksAfter: readonly Mark[] | null = tr.storedMarksAfter;\n\t\t\t\tif (storedMarksAfter) {\n\t\t\t\t\tconst hasCode: boolean = storedMarksAfter.some((m) => m.type === 'code');\n\t\t\t\t\tconst hasExcluded: boolean = storedMarksAfter.some((m) => EXCLUDED_WITH_CODE.has(m.type));\n\n\t\t\t\t\tif (hasCode && hasExcluded) {\n\t\t\t\t\t\t// Keep code, strip formatting marks\n\t\t\t\t\t\tstoredMarksAfter = storedMarksAfter.filter((m) => !EXCLUDED_WITH_CODE.has(m.type));\n\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps, storedMarksAfter } : tr);\n\t\t\t},\n\t\t\t{ name: 'inline-code:mark-exclusivity', priority: 50 },\n\t\t);\n\t}\n}\n"],"mappings":"Y,oSAeA,IAAaU,EAA0C,CACtDC,MAAO,cACPC,QAAUC,GAAqB,gBAAgBA,MAK1CC,iBAAmDC,OAAAC,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,uBAIzDC,eAAsBC,EAAqBC,GAC1C,OAAOZ,EAAiBO,EAAeK,EAAMT,EAC9C,C,IEeMU,EAAmC,CACxCC,SAAS,EACTC,OAAQ,QACRC,WAAW,GAKNC,iBAA0C,IAAIC,IAAI,CACvD,OACA,SACA,YACA,gBACA,YACA,OACA,WACA,cACA,cAKYC,EAAb,MACCC,GAAc,cACdC,KAAgB,cAChBC,SAAoB,GAEpBC,OACAC,OAEA,WAAAC,CAAYF,GACXG,KAAKH,OAAS,IAAKV,KAAmBU,EACvC,CAEA,UAAMI,CAAKC,GACVF,KAAKF,aAAezB,EACnB6B,EACAF,KAAKH,OAAOC,OACZrB,EACAQ,GAEDiB,EAAQC,mB,+TACRH,KAAKI,aAAaF,IAEY,IAA1BF,KAAKH,OAAOP,WACfU,KAAKK,kBAAkBH,GAExBF,KAAKM,8BAA8BJ,EACpC,CAEA,YAAAE,CAAqBF,GAIpB1B,EAAmB0B,EAAS,CAC3BK,SAAU,CACTC,KAAM,OACNC,KAAM,EACNC,MAAA,IACQC,SAASC,cAAc,QAE/BC,aAAA,CAAeC,EAAOC,IAAY,SAASA,WAC3CC,UAAW,CACV,CACCC,IAAK,OACLC,SAAWC,GACwB,QAA9BA,EAAGC,eAAeC,SACf,CAAC,GAGV,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AmBA,EAAiBG,OAAQV,IAAO/E,EAAmBiF,IAAIF,EAAE9D,OAC5EiD,GAAU,EAEZ,CAEAD,EAAKC,EAAU,IAAKF,EAAIK,MAAOF,EAAcmB,oBAAqBtB,IAEnE,CAAE5D,KAAM,+BAAgCC,SAAU,IAEpD,U"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineStyleMarkSpec-BhfGgfH9.mjs","names":[],"sources":["../../src/plugins/shared/InlineStyleMarkSpec.ts"],"sourcesContent":["/**\n * Factory for inline marks that carry a single CSS style declaration (text\n * color, highlight, font family, font size). These marks share the same DOM\n * rendering, HTML import/export, and `<span>`-based parse shape and differ only\n * in the attribute name, CSS property, validation, and the plugin's own values.\n */\n\nimport type { Mark } from '../../model/Document.js';\nimport { styleAttribute } from '../../model/HTMLUtils.js';\nimport type { MarkSpec } from '../../model/MarkSpec.js';\nimport type { HTMLExportContext } from '../../model/NodeSpec.js';\nimport {\n\ttype KnownValueLookup,\n\tcreateKnownValueLookup,\n} from '../../serialization/CSSValueEquivalence.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\n\nexport interface InlineStyleMarkConfig {\n\t/** Mark type name, e.g. `'textColor'`. */\n\treadonly type: string;\n\t/** Nesting rank (lower renders closer to the text). */\n\treadonly rank: number;\n\t/** Attribute key holding the value, e.g. `'color'` / `'family'` / `'size'`. */\n\treadonly valueAttr: string;\n\t/** camelCase DOM style property, e.g. `'backgroundColor'`. */\n\treadonly domStyleProperty: string;\n\t/** kebab-case CSS property for HTML export, e.g. `'background-color'`. */\n\treadonly cssProperty: string;\n\t/** Validates a value for HTML export (and optionally on parse). */\n\treadonly validate: (value: string) => boolean;\n\t/** When true, `validate` is also enforced while parsing HTML. */\n\treadonly validateOnParse?: boolean;\n\t/** Optional transform applied to a parsed value (e.g. CSS quote normalization). */\n\treadonly transformParsed?: (value: string) => string;\n\t/**\n\t * The plugin's own spellings of values, such as its palette. HTML import and\n\t * paste store a parsed value that the browser reads the same as one of them\n\t * in that spelling, so `#e03131` read back as `rgb(224, 49, 49)` stays\n\t * `#e03131`: pickers mark it as selected, and an HTML round trip keeps the\n\t * document unchanged. Other values are stored as parsed.\n\t */\n\treadonly knownValues?: readonly string[];\n}\n\n/** The raw CSS declaration a style mark exports for `value`, e.g. `color: #e03131`. */\nexport function styleDeclaration(cssProperty: string, value: string): string {\n\treturn `${cssProperty}: ${value}`;\n}\n\n/** Builds a MarkSpec for a single-CSS-property inline mark. */\nexport function createInlineStyleMarkSpec(config: InlineStyleMarkConfig): MarkSpec {\n\tconst {\n\t\ttype,\n\t\trank,\n\t\tvalueAttr,\n\t\tdomStyleProperty,\n\t\tcssProperty,\n\t\tvalidate,\n\t\tvalidateOnParse,\n\t\ttransformParsed,\n\t\tknownValues = [],\n\t} = config;\n\n\tconst readValue = (mark: Mark): string => String(mark.attrs?.[valueAttr] ?? '');\n\tconst knownSpelling: KnownValueLookup = createKnownValueLookup(cssProperty, knownValues);\n\tconst storedValue = (parsed: string): string =>\n\t\tknownSpelling(parsed) ?? (transformParsed ? transformParsed(parsed) : parsed);\n\tconst exportDeclaration = (mark: Mark): string | null => {\n\t\tconst value: string = readValue(mark);\n\t\treturn value && validate(value) ? styleDeclaration(cssProperty, value) : null;\n\t};\n\n\treturn {\n\t\ttype,\n\t\trank,\n\t\tattrs: { [valueAttr]: { default: '' } },\n\t\ttoDOM(mark) {\n\t\t\tconst span: HTMLElement = document.createElement('span');\n\t\t\tconst value: string = readValue(mark);\n\t\t\tif (value) {\n\t\t\t\tsetStyleProperty(span, domStyleProperty, value);\n\t\t\t}\n\t\t\treturn span;\n\t\t},\n\t\ttoHTMLString: (mark: Mark, content: string, ctx?: HTMLExportContext) => {\n\t\t\tconst declaration: string | null = exportDeclaration(mark);\n\t\t\treturn declaration ? `<span${styleAttribute(declaration, ctx)}>${content}</span>` : content;\n\t\t},\n\t\ttoHTMLStyle: exportDeclaration,\n\t\tparseHTML: [\n\t\t\t{\n\t\t\t\ttag: 'span',\n\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\tconst raw: string =\n\t\t\t\t\t\t(el.style as unknown as Record<string, string>)[domStyleProperty] ?? '';\n\t\t\t\t\tif (!raw) return false;\n\t\t\t\t\tif (validateOnParse && !validate(raw)) return false;\n\t\t\t\t\treturn { [valueAttr]: storedValue(raw) };\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tsanitize: { tags: ['span'] },\n\t};\n}\n"],"mappings":"oJA6CA,SAAgB,EAAiB,EAAqB,GACrD,MAAO,GAAG,MAAgB,GAC3B,CAGA,SAAgB,EAA0B,GACzC,MAAM,KACL,EAAA,KACA,EAAA,UACA,EAAA,iBACA,EAAA,YACA,EAAA,SACA,EAAA,gBACA,EAAA,gBACA,EAAA,YACA,EAAc,IACX,EAEE,EAAa,GAAuB,OAAO,EAAK,QAAQ,IAAc,IACtE,EAAkC,EAAuB,EAAa,GAGtE,EAAqB,IAC1B,MAAM,EAAgB,EAAU,GAChC,OAAO,GAAS,EAAS,GAAS,EAAiB,EAAa,GAAS,MAG1E,MAAO,CACN,OACA,OACA,MAAO,CAAA,CAAG,GAAY,CAAE,QAAS,KACjC,KAAA,CAAM,GACL,MAAM,EAAoB,SAAS,cAAc,QAC3C,EAAgB,EAAU,GAIhC,OAHI,GACH,EAAiB,EAAM,EAAkB,GAEnC,CACR,EACA,aAAA,CAAe,EAAY,EAAiB,KAC3C,MAAM,EAA6B,EAAkB,GACrD,OAAO,EAAc,QAAQ,EAAe,EAAa,MAAQ,WAAmB,GAErF,YAAa,EACb,UAAW,CACV,CACC,IAAK,OACL,SAAW,IACV,MAAM,EACJ,EAAG,MAA4C,IAAqB,GACtE,QAAK,KACD,IAAoB,EAAS,KAC1B,CAAA,CAAG,IAhCO,EAgCiB,EA/BrC,EAAc,KAAY,EAAkB,EAAgB,GAAU,KADjE,IAAe,KAoCpB,SAAU,CAAE,KAAM,CAAC,SAErB"}
1
+ {"version":3,"file":"InlineStyleMarkSpec-BhfGgfH9.mjs","names":["styleAttribute","createKnownValueLookup","setStyleProperty","styleDeclaration","cssProperty","value","createInlineStyleMarkSpec","config","type","rank","valueAttr","domStyleProperty","validate","validateOnParse","transformParsed","knownValues","readValue","mark","String","attrs","knownSpelling","exportDeclaration","default","toDOM","span","document","createElement","toHTMLString","content","ctx","declaration","toHTMLStyle","parseHTML","tag","getAttrs","el","raw","style","parsed","sanitize","tags"],"sources":["../../src/plugins/shared/InlineStyleMarkSpec.ts"],"sourcesContent":["/**\n * Factory for inline marks that carry a single CSS style declaration (text\n * color, highlight, font family, font size). These marks share the same DOM\n * rendering, HTML import/export, and `<span>`-based parse shape and differ only\n * in the attribute name, CSS property, validation, and the plugin's own values.\n */\n\nimport type { Mark } from '../../model/Document.js';\nimport { styleAttribute } from '../../model/HTMLUtils.js';\nimport type { MarkSpec } from '../../model/MarkSpec.js';\nimport type { HTMLExportContext } from '../../model/NodeSpec.js';\nimport {\n\ttype KnownValueLookup,\n\tcreateKnownValueLookup,\n} from '../../serialization/CSSValueEquivalence.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\n\nexport interface InlineStyleMarkConfig {\n\t/** Mark type name, e.g. `'textColor'`. */\n\treadonly type: string;\n\t/** Nesting rank (lower renders closer to the text). */\n\treadonly rank: number;\n\t/** Attribute key holding the value, e.g. `'color'` / `'family'` / `'size'`. */\n\treadonly valueAttr: string;\n\t/** camelCase DOM style property, e.g. `'backgroundColor'`. */\n\treadonly domStyleProperty: string;\n\t/** kebab-case CSS property for HTML export, e.g. `'background-color'`. */\n\treadonly cssProperty: string;\n\t/** Validates a value for HTML export (and optionally on parse). */\n\treadonly validate: (value: string) => boolean;\n\t/** When true, `validate` is also enforced while parsing HTML. */\n\treadonly validateOnParse?: boolean;\n\t/** Optional transform applied to a parsed value (e.g. CSS quote normalization). */\n\treadonly transformParsed?: (value: string) => string;\n\t/**\n\t * The plugin's own spellings of values, such as its palette. HTML import and\n\t * paste store a parsed value that the browser reads the same as one of them\n\t * in that spelling, so `#e03131` read back as `rgb(224, 49, 49)` stays\n\t * `#e03131`: pickers mark it as selected, and an HTML round trip keeps the\n\t * document unchanged. Other values are stored as parsed.\n\t */\n\treadonly knownValues?: readonly string[];\n}\n\n/** The raw CSS declaration a style mark exports for `value`, e.g. `color: #e03131`. */\nexport function styleDeclaration(cssProperty: string, value: string): string {\n\treturn `${cssProperty}: ${value}`;\n}\n\n/** Builds a MarkSpec for a single-CSS-property inline mark. */\nexport function createInlineStyleMarkSpec(config: InlineStyleMarkConfig): MarkSpec {\n\tconst {\n\t\ttype,\n\t\trank,\n\t\tvalueAttr,\n\t\tdomStyleProperty,\n\t\tcssProperty,\n\t\tvalidate,\n\t\tvalidateOnParse,\n\t\ttransformParsed,\n\t\tknownValues = [],\n\t} = config;\n\n\tconst readValue = (mark: Mark): string => String(mark.attrs?.[valueAttr] ?? '');\n\tconst knownSpelling: KnownValueLookup = createKnownValueLookup(cssProperty, knownValues);\n\tconst storedValue = (parsed: string): string =>\n\t\tknownSpelling(parsed) ?? (transformParsed ? transformParsed(parsed) : parsed);\n\tconst exportDeclaration = (mark: Mark): string | null => {\n\t\tconst value: string = readValue(mark);\n\t\treturn value && validate(value) ? styleDeclaration(cssProperty, value) : null;\n\t};\n\n\treturn {\n\t\ttype,\n\t\trank,\n\t\tattrs: { [valueAttr]: { default: '' } },\n\t\ttoDOM(mark) {\n\t\t\tconst span: HTMLElement = document.createElement('span');\n\t\t\tconst value: string = readValue(mark);\n\t\t\tif (value) {\n\t\t\t\tsetStyleProperty(span, domStyleProperty, value);\n\t\t\t}\n\t\t\treturn span;\n\t\t},\n\t\ttoHTMLString: (mark: Mark, content: string, ctx?: HTMLExportContext) => {\n\t\t\tconst declaration: string | null = exportDeclaration(mark);\n\t\t\treturn declaration ? `<span${styleAttribute(declaration, ctx)}>${content}</span>` : content;\n\t\t},\n\t\ttoHTMLStyle: exportDeclaration,\n\t\tparseHTML: [\n\t\t\t{\n\t\t\t\ttag: 'span',\n\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\tconst raw: string =\n\t\t\t\t\t\t(el.style as unknown as Record<string, string>)[domStyleProperty] ?? '';\n\t\t\t\t\tif (!raw) return false;\n\t\t\t\t\tif (validateOnParse && !validate(raw)) return false;\n\t\t\t\t\treturn { [valueAttr]: storedValue(raw) };\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tsanitize: { tags: ['span'] },\n\t};\n}\n"],"mappings":"Y,wIA6CA,SAAgBG,EAAiBC,EAAqBC,GACrD,MAAO,GAAGD,MAAgBC,GAC3B,CAGA,SAAgBC,EAA0BC,GACzC,MAAMC,KACLA,EAAAC,KACAA,EAAAC,UACAA,EAAAC,iBACAA,EAAAP,YACAA,EAAAQ,SACAA,EAAAC,gBACAA,EAAAC,gBACAA,EAAAC,YACAA,EAAc,IACXR,EAEES,EAAaC,GAAuBC,OAAOD,EAAKE,QAAQT,IAAc,IACtEU,EAAkCnB,EAAuBG,EAAaW,GAGtEM,EAAqBJ,IAC1B,MAAMZ,EAAgBW,EAAUC,GAChC,OAAOZ,GAASO,EAASP,GAASF,EAAiBC,EAAaC,GAAS,MAG1E,MAAO,CACNG,OACAC,OACAU,MAAO,CAAAT,CAAGA,GAAY,CAAEY,QAAS,KACjC,KAAAC,CAAMN,GACL,MAAMO,EAAoBC,SAASC,cAAc,QAC3CrB,EAAgBW,EAAUC,GAIhC,OAHIZ,GACHH,EAAiBsB,EAAMb,EAAkBN,GAEnCmB,CACR,EACAG,aAAA,CAAeV,EAAYW,EAAiBC,KAC3C,MAAMC,EAA6BT,EAAkBJ,GACrD,OAAOa,EAAc,QAAQ9B,EAAe8B,EAAaD,MAAQD,WAAmBA,GAErFG,YAAaV,EACbW,UAAW,CACV,CACCC,IAAK,OACLC,SAAWC,IACV,MAAMC,EACJD,EAAGE,MAA4C1B,IAAqB,GACtE,QAAKyB,KACDvB,IAAoBD,EAASwB,KAC1B,CAAA1B,CAAGA,IAhCO4B,EAgCiBF,EA/BrChB,EAAckB,KAAYxB,EAAkBA,EAAgBwB,GAAUA,KADjE,IAAeA,KAoCpBC,SAAU,CAAEC,KAAM,CAAC,SAErB,Q"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardNav-D0my3wuy.mjs","names":[],"sources":["../../src/plugins/shared/KeyboardNav.ts"],"sourcesContent":["/**\n * Generic keyboard navigation helpers reused by toolbar and popup UIs.\n */\n\n/**\n * Applies roving tabindex: sets tabindex=\"0\" on the focused item,\n * tabindex=\"-1\" on all others.\n */\nexport function applyRovingTabindex(items: readonly HTMLElement[], focusedIndex: number): void {\n\tfor (let i = 0; i < items.length; i++) {\n\t\tconst item: HTMLElement | undefined = items[i];\n\t\tif (item) {\n\t\t\titem.setAttribute('tabindex', i === focusedIndex ? '0' : '-1');\n\t\t}\n\t}\n}\n\n/** Navigates dropdown items with arrow keys (wraps around). */\nexport function findNextDropdownItem(\n\titems: readonly HTMLElement[],\n\tcurrent: number,\n\tdirection: 1 | -1,\n): number {\n\tconst len = items.length;\n\tif (len === 0) return -1;\n\treturn (current + direction + len) % len;\n}\n\n/** Flips horizontal arrow keys for RTL contexts. */\nfunction flipHorizontalKey(\n\tkey: 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n): 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' {\n\tif (key === 'ArrowLeft') return 'ArrowRight';\n\tif (key === 'ArrowRight') return 'ArrowLeft';\n\treturn key;\n}\n\n/**\n * Navigates a grid of cells with arrow keys.\n * Returns the new [row, col] position.\n * When `isRtl` is true, horizontal arrows are flipped to match visual direction.\n */\nexport function navigateGrid(\n\trow: number,\n\tcol: number,\n\tmaxRows: number,\n\tmaxCols: number,\n\tkey: 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\tisRtl = false,\n): [number, number] {\n\tconst resolved: 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' = isRtl\n\t\t? flipHorizontalKey(key)\n\t\t: key;\n\n\tswitch (resolved) {\n\t\tcase 'ArrowUp':\n\t\t\treturn [row > 1 ? row - 1 : maxRows, col];\n\t\tcase 'ArrowDown':\n\t\t\treturn [row < maxRows ? row + 1 : 1, col];\n\t\tcase 'ArrowLeft':\n\t\t\treturn [row, col > 1 ? col - 1 : maxCols];\n\t\tcase 'ArrowRight':\n\t\t\treturn [row, col < maxCols ? col + 1 : 1];\n\t}\n}\n"],"mappings":"AAQA,SAAgB,EAAoB,EAA+B,GAClE,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IAAK,CACtC,MAAM,EAAgC,EAAM,GACxC,GACH,EAAK,aAAa,WAAY,IAAM,EAAe,IAAM,KAE3D,CACD,CAGA,SAAgB,EACf,EACA,EACA,GAEA,MAAM,EAAM,EAAM,OAClB,OAAY,IAAR,GAAkB,GACd,EAAU,EAAY,GAAO,CACtC,CAgBA,SAAgB,EACf,EACA,EACA,EACA,EACA,EACA,GAAQ,GAMR,OAJuE,EArBxE,SACC,GAEA,MAAY,cAAR,EAA4B,aACpB,eAAR,EAA6B,YAC1B,CACR,CAgBI,CAAkB,GAClB,GAGF,IAAK,UACJ,MAAO,CAAC,EAAM,EAAI,EAAM,EAAI,EAAS,GACtC,IAAK,YACJ,MAAO,CAAC,EAAM,EAAU,EAAM,EAAI,EAAG,GACtC,IAAK,YACJ,MAAO,CAAC,EAAK,EAAM,EAAI,EAAM,EAAI,GAClC,IAAK,aACJ,MAAO,CAAC,EAAK,EAAM,EAAU,EAAM,EAAI,GAE1C"}
1
+ {"version":3,"file":"KeyboardNav-D0my3wuy.mjs","names":["applyRovingTabindex","items","focusedIndex","i","length","item","setAttribute","findNextDropdownItem","current","direction","len","navigateGrid","row","col","maxRows","maxCols","key","isRtl","flipHorizontalKey"],"sources":["../../src/plugins/shared/KeyboardNav.ts"],"sourcesContent":["/**\n * Generic keyboard navigation helpers reused by toolbar and popup UIs.\n */\n\n/**\n * Applies roving tabindex: sets tabindex=\"0\" on the focused item,\n * tabindex=\"-1\" on all others.\n */\nexport function applyRovingTabindex(items: readonly HTMLElement[], focusedIndex: number): void {\n\tfor (let i = 0; i < items.length; i++) {\n\t\tconst item: HTMLElement | undefined = items[i];\n\t\tif (item) {\n\t\t\titem.setAttribute('tabindex', i === focusedIndex ? '0' : '-1');\n\t\t}\n\t}\n}\n\n/** Navigates dropdown items with arrow keys (wraps around). */\nexport function findNextDropdownItem(\n\titems: readonly HTMLElement[],\n\tcurrent: number,\n\tdirection: 1 | -1,\n): number {\n\tconst len = items.length;\n\tif (len === 0) return -1;\n\treturn (current + direction + len) % len;\n}\n\n/** Flips horizontal arrow keys for RTL contexts. */\nfunction flipHorizontalKey(\n\tkey: 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n): 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' {\n\tif (key === 'ArrowLeft') return 'ArrowRight';\n\tif (key === 'ArrowRight') return 'ArrowLeft';\n\treturn key;\n}\n\n/**\n * Navigates a grid of cells with arrow keys.\n * Returns the new [row, col] position.\n * When `isRtl` is true, horizontal arrows are flipped to match visual direction.\n */\nexport function navigateGrid(\n\trow: number,\n\tcol: number,\n\tmaxRows: number,\n\tmaxCols: number,\n\tkey: 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight',\n\tisRtl = false,\n): [number, number] {\n\tconst resolved: 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' = isRtl\n\t\t? flipHorizontalKey(key)\n\t\t: key;\n\n\tswitch (resolved) {\n\t\tcase 'ArrowUp':\n\t\t\treturn [row > 1 ? row - 1 : maxRows, col];\n\t\tcase 'ArrowDown':\n\t\t\treturn [row < maxRows ? row + 1 : 1, col];\n\t\tcase 'ArrowLeft':\n\t\t\treturn [row, col > 1 ? col - 1 : maxCols];\n\t\tcase 'ArrowRight':\n\t\t\treturn [row, col < maxCols ? col + 1 : 1];\n\t}\n}\n"],"mappings":"AAQA,SAAgBA,EAAoBC,EAA+BC,GAClE,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAMG,OAAQD,IAAK,CACtC,MAAME,EAAgCJ,EAAME,GACxCE,GACHA,EAAKC,aAAa,WAAYH,IAAMD,EAAe,IAAM,KAE3D,CACD,CAGA,SAAgBK,EACfN,EACAO,EACAC,GAEA,MAAMC,EAAMT,EAAMG,OAClB,OAAY,IAARM,GAAkB,GACdF,EAAUC,EAAYC,GAAOA,CACtC,CAgBA,SAAgBC,EACfC,EACAC,EACAC,EACAC,EACAC,EACAC,GAAQ,GAMR,OAJuEA,EArBxE,SACCD,GAEA,MAAY,cAARA,EAA4B,aACpB,eAARA,EAA6B,YAC1BA,CACR,CAgBIE,CAAkBF,GAClBA,GAGF,IAAK,UACJ,MAAO,CAACJ,EAAM,EAAIA,EAAM,EAAIE,EAASD,GACtC,IAAK,YACJ,MAAO,CAACD,EAAME,EAAUF,EAAM,EAAI,EAAGC,GACtC,IAAK,YACJ,MAAO,CAACD,EAAKC,EAAM,EAAIA,EAAM,EAAIE,GAClC,IAAK,aACJ,MAAO,CAACH,EAAKC,EAAME,EAAUF,EAAM,EAAI,GAE1C,Q"}
@@ -0,0 +1,2 @@
1
+ import{i as t,l as e,o as n}from"./HTMLUtils-DTpsjZyK.mjs";import{P as o,U as i,V as r}from"./Document-ssR6hBzG.mjs";import{c as s,f as l,m as a,n as c}from"./Selection-DC6AOGgF.mjs";import{i as u}from"./TypeBrands-Ch9856Gb.mjs";import{n as h}from"./CursorMarks-CqHLzGNI.mjs";import{i as d,n as p,r as b,t as f}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{t as m}from"./PopupManager-DpxoBl54.mjs";import{r as g,s as k,t as v}from"./LocaleLoader-DEpTFuVc.mjs";import{t as y}from"./EditorEventBoundary-zpYRxryo.mjs";import{t as x}from"./ShortcutFormatting-TwiufqeV.mjs";var w={editLink:"Edit link",closeBubble:"Close link bubble",bubbleOpened:"Link bubble opened. Press Tab for link actions or Escape to dismiss.",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.",openLink:"Open link",openLinkInNewTab:"Open link in new tab",closePreview:"Close link preview",previewOpened:"Link preview opened. Press Tab to open the link or Escape to dismiss."},L=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Dp1oBWyG.mjs"),"./locales/de.ts":()=>import("./de-D3J8XPCR.mjs"),"./locales/es.ts":()=>import("./es-Bbz885DZ.mjs"),"./locales/fr.ts":()=>import("./fr-GEgM1j3w.mjs"),"./locales/hi.ts":()=>import("./hi-CKg8i4Mm.mjs"),"./locales/nl.ts":()=>import("./nl-B1i04NvZ.mjs"),"./locales/pt.ts":()=>import("./pt-DP5c76Vo.mjs"),"./locales/ru.ts":()=>import("./ru--iYEtsT5.mjs"),"./locales/zh.ts":()=>import("./zh-DUS7JduA.mjs")});async function A(t){return v(L,t,w)}function C(t,e){return e&&!t.startsWith("#")}function S(t,e){for(const o of n(e)){const e=t.id===o?t:Array.from(t.getElementsByTagName("*")).find(t=>t.id===o);if(e)return e.scrollIntoView(),!0}return!1}function E(t,n,o){const i=e(n);if(!i)return null;const r=t.createElement("a");return r.setAttribute("href",i),C(i,o)&&(r.target="_blank",r.rel="noopener noreferrer"),r}function _(t,e,n){const o=E(t.ownerDocument,e,n);if(!o)return!1;const i=o.getAttribute("href")??"";if(i.startsWith("#"))return S(t,i);o.hidden=!0,t.ownerDocument.body.appendChild(o);try{o.click()}finally{o.remove()}return!0}function I(t){const e=t.selection;if(!l(e)||e.anchor.blockId!==e.head.blockId)return null;const n=t.getBlock(e.anchor.blockId);if(!n)return null;const a=Math.min(e.anchor.offset,e.head.offset),c=Math.max(e.anchor.offset,e.head.offset),u=s(e)?h(t).find(t=>"link"===t.type):void 0;if(s(e)&&!u)return null;let d=0,p=null;const b=[];for(const s of o(n)){const t=d+(r(s)?s.text.length:1),e=r(s)?s.marks.find(t=>"link"===t.type):void 0;e&&p&&i(p.mark,e)?(p={mark:e,selection:{anchor:p.selection.anchor,head:{blockId:n.id,offset:t}}},b[b.length-1]=p):(p=e?{mark:e,selection:{anchor:{blockId:n.id,offset:d},head:{blockId:n.id,offset:t}}}:null,p&&b.push(p)),d=t}return b.find(t=>a>=t.selection.anchor.offset&&c<=t.selection.head.offset&&(s(e)?u&&i(t.mark,u):a<t.selection.head.offset&&c>t.selection.anchor.offset))??null}function T(t,e,n){if(void 0!==n&&n===e.mark.attrs?.href)return null;const o=t.withSelection(e.selection),i=void 0===n?d(o,u("link")):f(o,{...e.mark,attrs:{...e.mark.attrs,href:n}});return i?{...i,selectionBefore:t.selection,selectionAfter:t.selection,storedMarksAfter:null}:null}var R=class{container;locale;context;popups;handle=null;anchor=null;constructor(t,e,n){this.container=t,this.locale=e,this.context=n,this.popups=new m(t)}show(t){this.close();const e=t.getAttribute("href")??"",n=E(this.container.ownerDocument,e,!0);return!(t instanceof HTMLAnchorElement&&!n||(this.anchor=t,this.handle=this.popups.open({anchor:t,className:"notectl-link-bubble",ariaRole:"dialog",ariaLabel:this.locale.label,autoFocus:!1,onClose:()=>{this.handle=null,this.anchor=null},content:t=>{this.render(t,this.context,()=>this.close())}}),0))}render(t,n,o){!function(t,n,o,i){const r=n.getState(),c=I(r);let h=!1;const d=()=>{h||(h=!0,i())},p=()=>{d(),n.getContainer().focus()},m=()=>!n.isReadOnly()&&n.getState().doc===r.doc&&(c?JSON.stringify(I(n.getState()))===JSON.stringify(c):a(n.getState().selection,r.selection));t.classList.add("notectl-link-popup","notectl-link-bubble"),t.setAttribute("role","dialog"),t.setAttribute("aria-label",o.label);const g=document.createElement("div");t.append(g);const k=(t,e,n)=>{const o=document.createElement("button");return o.type="button",o.className="notectl-link-popup__button",o.textContent=t,o.setAttribute("aria-label",e),o.addEventListener("mousedown",t=>t.preventDefault()),o.addEventListener("click",n),o},v=()=>{g.replaceChildren();const t=document.createElement("input");t.type="url",t.className="notectl-link-popup__input",t.value=String(c?.mark.attrs?.href??""),t.placeholder=o.urlPlaceholder,t.setAttribute("aria-label",o.urlAria);const i=document.createElement("div");i.className="notectl-link-popup__error",i.setAttribute("role","alert"),i.hidden=!0;const a=()=>{if(!m())return void p();const a=e(t.value.trim());if(!a)return i.textContent=o.invalidUrl,i.hidden=!1,t.setAttribute("aria-invalid","true"),void t.focus();const h=c?T(n.getState(),c,a):l(r.selection)&&!s(r.selection)?f(r,{type:u("link"),attrs:{href:a}}):null;h&&n.dispatch(h),p()},h=k(o.apply,o.applyAria,a);h.classList.add("notectl-link-popup__button--apply"),t.addEventListener("keydown",t=>{"Enter"!==t.key||t.isComposing||(t.preventDefault(),a())}),t.addEventListener("input",()=>{i.hidden=!0,t.removeAttribute("aria-invalid")}),g.append(t,h,i),t.focus(),requestAnimationFrame(()=>{t.isConnected&&t.focus()})};if(t.addEventListener("keydown",e=>{if(e.stopImmediatePropagation(),"Escape"===e.key)return e.preventDefault(),void p();if(g.querySelector("input"))return;const n=Array.from(g.querySelectorAll("a, button")),o=n.indexOf(t.getRootNode()instanceof ShadowRoot?t.getRootNode().activeElement:document.activeElement);let i=o;if("ArrowRight"===e.key||"ArrowDown"===e.key)i=(o+1)%n.length;else if("ArrowLeft"===e.key||"ArrowUp"===e.key)i=(o+n.length-1)%n.length;else if("Home"===e.key)i=0;else{if("End"!==e.key)return;i=n.length-1}e.preventDefault(),n.forEach((t,e)=>{t.tabIndex=e===i?0:-1}),n[i]?.focus()}),t.addEventListener("focusout",e=>{e.relatedTarget instanceof Node&&!t.contains(e.relatedTarget)&&d()}),!c)return v(),void(b(r,"link")&&g.append(k(o.removeLink,o.removeLinkAria,()=>{m()&&n.executeCommand("removeLink"),p()})));const y=String(c.mark.attrs?.href??""),x=E(document,y,!0);if(x){x.className="notectl-link-bubble__open";const t=document.createElement("span");t.textContent=("_blank"===x.target?o.openLinkInNewTab:o.openLink)??w.openLink;const i=document.createElement("span");i.className="notectl-link-bubble__url",i.dir="ltr",i.textContent=e(y),x.append(t,i),x.addEventListener("click",t=>{!t.defaultPrevented&&y.startsWith("#")&&(t.preventDefault(),S(n.getContainer(),y))}),g.append(x)}const L=o.editLink??w.editLink,A=k(L,L,v),C=k(o.removeLink,o.removeLinkAria,()=>{m()&&n.executeCommand("removeLink"),p()});A.tabIndex=x?-1:0,C.tabIndex=-1,g.append(A,C);const _=k("×",o.closeBubble??w.closeBubble,p);_.className="notectl-link-bubble__close",t.append(_)}(t,n,this.locale,o)}reposition(){this.handle&&this.anchor&&(this.anchor.isConnected&&this.isWithinContent(this.anchor)?this.popups.reposition(this.handle):this.close())}isOpen(){return null!==this.handle}focus(t=!1){const e=this.handle?.getElement().querySelector(t?".notectl-link-bubble__close":"a, input");return!!e&&(e.focus(),!0)}close(t=!1){const e=this.handle;return this.handle=null,this.anchor=null,e?.close({restoreFocusTo:t?this.container:null}),null!==e}destroy(){this.close(),this.popups.destroy()}isWithinContent(t){const e=t.getBoundingClientRect(),n=this.container.getBoundingClientRect();return e.bottom>=n.top&&e.top<=n.bottom}},B=/* @__PURE__ */new Set(["Control","Meta","Shift","Alt"]),D=class{context;locale;container;bubble;layoutSources;handleLayoutChange=()=>{this.bubble.reposition()};handleClick=t=>this.onClick(t);handleKeydown=t=>this.onKeydown(t);announcementPending=!1;lastRange="";pointerSelection=!1;pendingTabs=0;pendingAnchor=null;handlePointer=()=>{this.pointerSelection=!0};toolbarClose=null;handleInput=()=>{this.closeBubble()};renderToolbar(t,e,n){this.closeBubble();let o=!1;const i=()=>{o||(o=!0,this.toolbarClose=null,n({restoreFocusTo:null}))};this.toolbarClose=i,this.bubble.render(t,e,i)}onSelectionChange(t,e){if(this.pendingAnchor&&I(e)&&this.showClickedLink(this.pendingAnchor),a(t.selection,e.selection))return;const n=s(e.selection)?I(e):null,o=n?JSON.stringify(n):"";if(o===this.lastRange)return;this.closeBubble(),this.lastRange=o;const i=this.container.getRootNode(),r=i instanceof ShadowRoot?i.activeElement:this.container.ownerDocument.activeElement;!n||this.pointerSelection||r!==this.container||this.context.isReadOnly()||this.showAtSelection()}showAtSelection(){if(this.context.isReadOnly())return!1;const t=this.context.getState(),n=t.selection;if(!l(n))return!1;const o=I(t);if(!o&&s(n))return!1;const i=this.container.querySelector(`[data-block-id="${CSS.escape(n.anchor.blockId)}"]`);if(!i)return!1;let r=i;if(o){const t=Array.from(i.querySelectorAll("a")),s=String(o.mark.attrs?.href??""),l=t.find(t=>{const o=N(i,t);return t.getAttribute("href")===e(s)&&o<=n.anchor.offset&&o+(t.textContent?.length??0)>=n.anchor.offset});if(!l)return!1;r=l}return this.closeBubble(),!!this.bubble.show(r)&&(this.lastRange=o?JSON.stringify(o):"",this.announcementPending=!0,this.announce(),!0)}constructor(t,e){this.context=t,this.locale=e,this.container=t.getContainer(),this.bubble=new R(this.container,e,t),this.layoutSources=function(t){const e=t.ownerDocument.defaultView,n=[{target:t,type:"scroll",capture:!0},{target:t.ownerDocument,type:"scroll",capture:!0}];return e&&n.push({target:e,type:"resize",capture:!1}),e?.visualViewport&&n.push({target:e.visualViewport,type:"resize",capture:!1},{target:e.visualViewport,type:"scroll",capture:!1}),n}(this.container),this.container.addEventListener("click",this.handleClick),this.container.addEventListener("pointerdown",this.handlePointer),this.container.addEventListener("beforeinput",this.handleInput),this.container.addEventListener("compositionstart",this.handleInput),this.container.addEventListener("keydown",this.handleKeydown,!0);for(const n of this.layoutSources)n.target.addEventListener(n.type,this.handleLayoutChange,n.capture)}dismissForDocument(t){this.closeBubble();const e=I(t);this.lastRange=e?JSON.stringify(e):""}closeBubble(){this.pendingAnchor=null,this.pendingTabs=0,this.bubble.close();const t=this.toolbarClose;this.toolbarClose=null,t?.()}restoreBubbleAnnouncement(){this.announcementPending&&this.bubble.isOpen()&&(this.announcementPending=!1,this.context.hasAnnouncement()||this.announce())}destroy(){this.container.removeEventListener("click",this.handleClick),this.container.removeEventListener("pointerdown",this.handlePointer),this.container.removeEventListener("beforeinput",this.handleInput),this.container.removeEventListener("compositionstart",this.handleInput),this.container.removeEventListener("keydown",this.handleKeydown,!0);for(const t of this.layoutSources)t.target.removeEventListener(t.type,this.handleLayoutChange,t.capture);this.closeBubble(),this.bubble.destroy()}onKeydown(t){if(y(t,this.container)){if(this.pointerSelection=!1,"Escape"===t.key&&(this.pendingAnchor||this.bubble.isOpen()))return this.closeBubble(),t.preventDefault(),void t.stopPropagation();if("Tab"===t.key&&!t.shiftKey&&this.pendingAnchor)return this.pendingTabs++,t.preventDefault(),void t.stopPropagation();if(this.pendingAnchor=null,"Tab"===t.key&&!t.shiftKey&&this.bubble.focus())return t.preventDefault(),void t.stopPropagation();B.has(t.key)||t.key.startsWith("Arrow")||"Home"===t.key||"End"===t.key||this.bubble.close()}}onClick(t){if(!y(t,this.container))return;if(this.closeBubble(),t.defaultPrevented||0!==t.button||t.altKey||t.shiftKey)return;const n=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}(this.container,t.target);if(!n)return;const o=e(n.getAttribute("href")??"");if(!o)return void t.preventDefault();const i=t.ctrlKey||t.metaKey;if(i||!S(this.container,o)){if(!this.context.isReadOnly())return i?(t.preventDefault(),void _(this.container,o,!0)):void(o.startsWith("#")||(t.preventDefault(),t.detail>1||(this.pendingAnchor=n,!1!==this.container.ownerDocument.getSelection()?.isCollapsed&&this.showClickedLink(n))))}else t.preventDefault()}showClickedLink(t){if(!s(this.context.getState().selection))return;const n=I(this.context.getState());if(!n||e(String(n.mark.attrs?.href??""))!==t.getAttribute("href"))return;const o=t.closest("[data-block-id]");if(o){const e=N(o,t);if(o.dataset.blockId!==n.selection.anchor.blockId||e<n.selection.anchor.offset||e>=n.selection.head.offset)return}this.pendingAnchor=null,this.bubble.show(t)&&(this.lastRange=JSON.stringify(n),this.pendingTabs&&this.bubble.focus(this.pendingTabs>1),this.pendingTabs=0,this.announcementPending=!0,this.announce())}announce(){this.context.announce(this.locale.bubbleOpened??w.bubbleOpened)}};function N(t,e){const n=t.ownerDocument.createRange();n.selectNodeContents(t),n.setEndBefore(e);const o=n.cloneContents();for(const i of o.querySelectorAll("[data-inline-type]"))i.replaceWith("");return o.textContent?.length??0}var O={openInNewTab:!0},P=/(?:^|[^!])(\[([^\]\uFFFC]+)\]\(([^)\s\uFFFC]+)(?:\s+"([^"\uFFFC]*)")?\))$/,j=/(<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^<>\s\uFFFC]+)>)$/,F=class{id="link";name="Link";priority=25;config;locale=w;interaction=null;constructor(t){this.config={...O,...t}}async init(t){this.locale=await k(t,this.config.locale,w,A),t.registerStyleSheet('\n.notectl-content[contenteditable="false"] a[href]:not([href=""]) {\n\tcursor: pointer;\n}\n.notectl-link-bubble {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 4px;\n\tbox-sizing: border-box;\n\twidth: max-content;\n\tmax-width: min(360px, calc(100vw - 16px));\n\tmargin: 0;\n\tpadding: 6px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px rgb(0 0 0 / 15%);\n\tfont: inherit;\n\tfont-size: 14px;\n\tline-height: 1.4;\n}\n.notectl-link-bubble__open {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n\tmin-height: 44px;\n\tbox-sizing: border-box;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tcolor: var(--notectl-fg);\n\ttext-decoration: none;\n\toverflow-wrap: anywhere;\n}\n.notectl-link-bubble__open > :first-child {\n\ttext-decoration: underline;\n\ttext-underline-offset: 2px;\n}\n.notectl-link-bubble__url {\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n\tunicode-bidi: isolate;\n}\n.notectl-link-bubble__close {\n\tflex: 0 0 44px;\n\twidth: 44px;\n\theight: 44px;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: inherit;\n\tfont-size: 22px;\n\tcursor: pointer;\n}\n.notectl-link-bubble .notectl-link-popup__button { min-height: 44px; }\n.notectl-link-bubble__close { min-width: 44px; }\n.notectl-link-bubble input { box-sizing: border-box; max-width: 100%; }\n.notectl-link-bubble > div { min-width: 0; }\n.notectl-link-bubble :focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -2px;\n}\n@media (hover: hover) {\n\t.notectl-link-bubble__open:hover,\n\t.notectl-link-bubble__close:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n.notectl-link-popup {\n\tmin-width: min(200px, calc(100vw - 16px));\n}\n\n.notectl-link-popup__input {\n\twidth: 100%;\n\tpadding: 4px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-surface-overlay);\n}\n\n\n.notectl-link-popup__button {\n\twidth: 100%;\n\tpadding: 6px 12px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tfont-size: 13px;\n}\n\n.notectl-link-popup__button--apply {\n\tmargin-top: 4px;\n}\n\n@media (hover: hover) {\n\t.notectl-link-popup__button:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n\n'),this.registerMarkSpec(t),this.registerCommands(t),this.registerKeymap(t),this.registerToolbarItem(t),!1!==this.config.inputRule&&this.registerInputRules(t),this.interaction?.destroy(),this.interaction=new D(t,this.locale)}destroy(){this.interaction?.destroy(),this.interaction=null}onStateChange(t,e){t.doc===e.doc?(this.interaction?.onSelectionChange(t,e),this.interaction?.restoreBubbleAnnouncement()):this.interaction?.dismissForDocument(e)}onReadOnlyChange(){this.interaction?.closeBubble()}registerInputRules(t){const n=(t,e,n,o,i,r,s)=>{const l={href:r};return s&&(l.title=s),t.transaction("input").deleteTextAt(e,n,o).insertText(e,n,i,[{type:u("link"),attrs:l}]).setSelection(c(e,n+i.length)).build()};t.registerInputRule({pattern:P,handler(t,o,i,r){const a=t.selection;if(!l(a)||!s(a))return null;const c=t.getBlock(a.anchor.blockId);if(!c||"code_block"===c.type)return null;const u=o[1],h=o[2],d=o[3],p=o[4];if(!u||!h||!d)return null;const b=e(d);return""===b?null:n(t,a.anchor.blockId,r-u.length,r,h,b,p)}}),t.registerInputRule({pattern:j,handler(t,o,i,r){const a=t.selection;if(!l(a)||!s(a))return null;const c=t.getBlock(a.anchor.blockId);if(!c||"code_block"===c.type)return null;const u=o[1],h=o[2];if(!u||!h)return null;const d=e(h);return""===d?null:n(t,a.anchor.blockId,r-u.length,r,h,d)}})}registerMarkSpec(n){const o=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 r=String(t.attrs?.title??"");return r&&n.setAttribute("title",r),C(i,o)&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer")),n},toHTMLString:(n,i)=>{const r=e(String(n.attrs?.href??"")),s=t(r),l=String(n.attrs?.title??""),a=l?` title="${t(l)}"`:"";return C(r,o)?`<a href="${s}"${a} target="_blank" rel="noopener noreferrer">${i}</a>`:`<a href="${s}"${a}>${i}</a>`},parseHTML:[{tag:"a",getAttrs:t=>{const n=e(t.getAttribute("href")??""),o=t.getAttribute("title")??"";return o?{href:n,title:o}:{href:n}}}],sanitize:{tags:["a"],attrs:["href","title","target","rel"]}})}registerCommands(t){t.registerCommand("showLinkBubble",()=>this.interaction?.showAtSelection()??!1),t.registerCommand("openLink",()=>{const e=p(t.getState(),"link",t=>t.attrs.href);if(null===e)return!1;const n=!t.isReadOnly()||this.config.openInNewTab;return _(t.getContainer(),e,n)},{readonlyAllowed:!0}),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("showLinkBubble")}),t.registerKeymap({"Alt-Enter":()=>t.executeCommand("openLink")},{priority:"navigation"})}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(x("Mod-K")),command:"toggleLink",popupType:"custom",renderPopup:(t,e,n)=>{this.renderLinkPopup(t,e,n)},isActive:t=>this.isLinkActive(t),isEnabled:t=>!s(t.selection)||this.isLinkActive(t)})}isLinkActive(t){return b(t,"link")}toggleLink(t,e){return!!this.isLinkActive(e)&&this.removeLink(t,e)}removeLink(t,e){const n=e.selection;if(!l(n))return!1;const o=I(e);return o?g(t,T(e,o)):!s(n)&&g(t,d(e,u("link")))}renderLinkPopup(t,e,n){this.interaction?.renderToolbar(t,e,n)}};export{w as n,A as r,F as t};
2
+ //# sourceMappingURL=LinkPlugin-CFw22a9X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkPlugin-CFw22a9X.mjs","names":["escapeHTML","sanitizeHref","fragmentIdentifiers","getInlineChildren","marksEqual","isTextNode","isCollapsed","isTextSelection","selectionsEqual","createCollapsedSelection","markType","resolveCursorMarks","removeAttributedMark","getMarkAttrAtSelection","isAttributedMarkActive","applyAttributedMark","PopupManager","dispatchIfPresent","resolveLocale","loadLocaleModule","isEventFromEditorContent","formatShortcut","LINK_LOCALE_EN","editLink","closeBubble","bubbleOpened","label","tooltip","shortcut","removeLink","removeLinkAria","urlPlaceholder","urlAria","apply","applyAria","invalidUrl","openLink","openLinkInNewTab","closePreview","previewOpened","localeModules","Object","assign","async","loadLinkLocale","lang","shouldOpenInNewTab","href","openInNewTab","startsWith","scrollToFragment","container","identifier","target","id","Array","from","getElementsByTagName","find","el","scrollIntoView","createNavigationLink","document","rawHref","link","createElement","setAttribute","rel","ownerDocument","getAttribute","hidden","body","appendChild","click","remove","resolveLinkRange","state","sel","selection","anchor","blockId","head","block","getBlock","Math","min","offset","to","max","active","m","type","run","runs","child","end","text","length","mark","marks","push","r","changeLink","range","attrs","selected","withSelection","tr","selectionBefore","selectionAfter","storedMarksAfter","LinkBubble","locale","context","popups","handle","constructor","this","show","close","HTMLAnchorElement","open","className","ariaRole","ariaLabel","autoFocus","onClose","content","popup","render","getState","dismissed","dismiss","getContainer","focus","valid","isReadOnly","doc","JSON","stringify","classList","add","append","button","aria","action","textContent","addEventListener","e","preventDefault","form","replaceChildren","input","value","String","placeholder","error","trim","dispatch","applyButton","key","isComposing","removeAttribute","requestAnimationFrame","isConnected","stopImmediatePropagation","querySelector","actions","querySelectorAll","index","indexOf","getRootNode","ShadowRoot","activeElement","next","forEach","i","tabIndex","relatedTarget","Node","contains","executeCommand","address","dir","defaultPrevented","editLabel","edit","closeButton","renderLinkBubble","reposition","isWithinContent","isOpen","getElement","restoreFocus","restoreFocusTo","destroy","anchorRect","getBoundingClientRect","contentRect","bottom","top","MODIFIER_KEYS","Set","LinkInteractionController","bubble","layoutSources","handleLayoutChange","handleClick","event","onClick","handleKeydown","onKeydown","announcementPending","lastRange","pointerSelection","pendingTabs","pendingAnchor","handlePointer","toolbarClose","handleInput","renderToolbar","closed","onSelectionChange","oldState","showClickedLink","root","showAtSelection","CSS","escape","links","start","anchorOffset","announce","view","defaultView","sources","capture","visualViewport","collectLayoutSources","source","dismissForDocument","restoreBubbleAnnouncement","hasAnnouncement","removeEventListener","stopPropagation","shiftKey","has","altKey","element","Element","parentElement","findLinkAnchor","modified","ctrlKey","metaKey","detail","getSelection","closest","dataset","before","createRange","selectNodeContents","setEndBefore","preceding","cloneContents","inline","replaceWith","DEFAULT_CONFIG","LINK_RULE","AUTOLINK_RULE","LinkPlugin","name","priority","config","interaction","init","registerStyleSheet","registerMarkSpec","registerCommands","registerKeymap","registerToolbarItem","inputRule","registerInputRules","onStateChange","newState","onReadOnlyChange","buildLink","title","transaction","deleteTextAt","insertText","setSelection","build","registerInputRule","pattern","handler","match","_start","expr","url","rank","inclusive","default","toDOM","a","toHTMLString","safeHref","titleValue","titleAttr","parseHTML","tag","getAttrs","sanitize","tags","registerCommand","newTab","readonlyAllowed","toggleLink","group","icon","command","popupType","renderPopup","ctx","renderLinkPopup","isActive","isLinkActive","isEnabled"],"sources":["../../src/editor/styles/link.ts","../../src/plugins/link/LinkLocale.ts","../../src/plugins/link/LinkNavigation.ts","../../src/plugins/link/LinkRange.ts","../../src/plugins/link/LinkBubbleContent.ts","../../src/plugins/link/LinkBubble.ts","../../src/plugins/link/LinkInteractionController.ts","../../src/plugins/link/LinkPlugin.ts"],"sourcesContent":["/** Link bubble styles; registered by LinkPlugin, including without a toolbar. */\nexport const LINK_CSS = `\n.notectl-content[contenteditable=\"false\"] a[href]:not([href=\"\"]) {\n\tcursor: pointer;\n}\n.notectl-link-bubble {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 4px;\n\tbox-sizing: border-box;\n\twidth: max-content;\n\tmax-width: min(360px, calc(100vw - 16px));\n\tmargin: 0;\n\tpadding: 6px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px rgb(0 0 0 / 15%);\n\tfont: inherit;\n\tfont-size: 14px;\n\tline-height: 1.4;\n}\n.notectl-link-bubble__open {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n\tmin-height: 44px;\n\tbox-sizing: border-box;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tcolor: var(--notectl-fg);\n\ttext-decoration: none;\n\toverflow-wrap: anywhere;\n}\n.notectl-link-bubble__open > :first-child {\n\ttext-decoration: underline;\n\ttext-underline-offset: 2px;\n}\n.notectl-link-bubble__url {\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n\tunicode-bidi: isolate;\n}\n.notectl-link-bubble__close {\n\tflex: 0 0 44px;\n\twidth: 44px;\n\theight: 44px;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: inherit;\n\tfont-size: 22px;\n\tcursor: pointer;\n}\n.notectl-link-bubble .notectl-link-popup__button { min-height: 44px; }\n.notectl-link-bubble__close { min-width: 44px; }\n.notectl-link-bubble input { box-sizing: border-box; max-width: 100%; }\n.notectl-link-bubble > div { min-width: 0; }\n.notectl-link-bubble :focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -2px;\n}\n@media (hover: hover) {\n\t.notectl-link-bubble__open:hover,\n\t.notectl-link-bubble__close:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n.notectl-link-popup {\n\tmin-width: min(200px, calc(100vw - 16px));\n}\n\n.notectl-link-popup__input {\n\twidth: 100%;\n\tpadding: 4px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-surface-overlay);\n}\n\n\n.notectl-link-popup__button {\n\twidth: 100%;\n\tpadding: 6px 12px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tfont-size: 13px;\n}\n\n.notectl-link-popup__button--apply {\n\tmargin-top: 4px;\n}\n\n@media (hover: hover) {\n\t.notectl-link-popup__button:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n\n`;\n","/**\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 editLink?: string;\n\treadonly closeBubble?: string;\n\treadonly bubbleOpened?: string;\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\t/** Optional for compatibility with existing custom locales; defaults to English. */\n\treadonly openLink?: string;\n\treadonly openLinkInNewTab?: string;\n\treadonly closePreview?: string;\n\t/** Screen reader announcement when a click or tap opens the non-modal preview. */\n\treadonly previewOpened?: string;\n}\n\n// --- Default English Locale ---\n\nexport const LINK_LOCALE_EN: Required<LinkLocale> = {\n\teditLink: 'Edit link',\n\tcloseBubble: 'Close link bubble',\n\tbubbleOpened: 'Link bubble opened. Press Tab for link actions or Escape to dismiss.',\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\topenLink: 'Open link',\n\topenLinkInNewTab: 'Open link in new tab',\n\tclosePreview: 'Close link preview',\n\tpreviewOpened: 'Link preview opened. Press Tab to open the link or Escape to dismiss.',\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","/** Safe link activation shared by editor gestures and link actions. */\n\nimport { fragmentIdentifiers, sanitizeHref } from '../../model/HTMLUtils.js';\n\n/** Fragment-only links always target this editor, including with a new-tab default. */\nexport function shouldOpenInNewTab(href: string, openInNewTab: boolean): boolean {\n\treturn openInNewTab && !href.startsWith('#');\n}\n\n/** Finds links through nested formatting without crossing the editor boundary. */\nexport function findLinkAnchor(\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\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\treturn null;\n}\n\n/** Resolves semantic IDs inside this editor without interpolating URLs into selectors. */\nexport function scrollToFragment(container: HTMLElement, href: string): boolean {\n\tfor (const identifier of fragmentIdentifiers(href)) {\n\t\tconst target: Element | undefined =\n\t\t\tcontainer.id === identifier\n\t\t\t\t? container\n\t\t\t\t: Array.from(container.getElementsByTagName('*')).find((el) => el.id === identifier);\n\t\tif (target) {\n\t\t\ttarget.scrollIntoView();\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/** Creates a native navigation link; rejected and empty URLs never become active links. */\nexport function createNavigationLink(\n\tdocument: Document,\n\trawHref: string,\n\topenInNewTab: boolean,\n): HTMLAnchorElement | null {\n\tconst href: string = sanitizeHref(rawHref);\n\tif (!href) return null;\n\tconst link: HTMLAnchorElement = document.createElement('a');\n\tlink.setAttribute('href', href);\n\tif (shouldOpenInNewTab(href, openInNewTab)) {\n\t\tlink.target = '_blank';\n\t\tlink.rel = 'noopener noreferrer';\n\t}\n\treturn link;\n}\n\n/** Activates synchronously within the user gesture so popup blockers allow the navigation. */\nexport function openLink(container: HTMLElement, rawHref: string, openInNewTab: boolean): boolean {\n\tconst link: HTMLAnchorElement | null = createNavigationLink(\n\t\tcontainer.ownerDocument,\n\t\trawHref,\n\t\topenInNewTab,\n\t);\n\tif (!link) return false;\n\tconst href: string = link.getAttribute('href') ?? '';\n\tif (href.startsWith('#')) return scrollToFragment(container, href);\n\n\t// Outside contenteditable: native activation retains URL/base/protocol handling.\n\tlink.hidden = true;\n\tcontainer.ownerDocument.body.appendChild(link);\n\ttry {\n\t\tlink.click();\n\t} finally {\n\t\tlink.remove();\n\t}\n\treturn true;\n}\n","/** Model-owned extent of one link, independent of formatting and DOM wrappers. */\nimport {\n\tapplyAttributedMark,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { resolveCursorMarks } from '../../commands/CursorMarks.js';\nimport { getInlineChildren, isTextNode, marksEqual } from '../../model/Document.js';\nimport type { BlockNode, Mark } from '../../model/Document.js';\nimport { isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport type { EditorSelection, Selection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\n\nexport interface LinkRange {\n\treadonly selection: Selection;\n\treadonly mark: Mark;\n}\n\nexport function resolveLinkRange(state: EditorState): LinkRange | null {\n\tconst sel: EditorSelection = state.selection;\n\tif (!isTextSelection(sel) || sel.anchor.blockId !== sel.head.blockId) return null;\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tconst from: number = Math.min(sel.anchor.offset, sel.head.offset);\n\tconst to: number = Math.max(sel.anchor.offset, sel.head.offset);\n\tconst active: Mark | undefined = isCollapsed(sel)\n\t\t? resolveCursorMarks(state).find((m) => m.type === 'link')\n\t\t: undefined;\n\tif (isCollapsed(sel) && !active) return null;\n\tlet offset = 0;\n\tlet run: LinkRange | null = null;\n\tconst runs: LinkRange[] = [];\n\tfor (const child of getInlineChildren(block)) {\n\t\tconst end: number = offset + (isTextNode(child) ? child.text.length : 1);\n\t\tconst mark: Mark | undefined = isTextNode(child)\n\t\t\t? child.marks.find((m) => m.type === 'link')\n\t\t\t: undefined;\n\t\tif (mark && run && marksEqual(run.mark, mark)) {\n\t\t\trun = {\n\t\t\t\tmark,\n\t\t\t\tselection: { anchor: run.selection.anchor, head: { blockId: block.id, offset: end } },\n\t\t\t};\n\t\t\truns[runs.length - 1] = run;\n\t\t} else {\n\t\t\trun = mark\n\t\t\t\t? {\n\t\t\t\t\t\tmark,\n\t\t\t\t\t\tselection: {\n\t\t\t\t\t\t\tanchor: { blockId: block.id, offset },\n\t\t\t\t\t\t\thead: { blockId: block.id, offset: end },\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: null;\n\t\t\tif (run) runs.push(run);\n\t\t}\n\t\toffset = end;\n\t}\n\treturn (\n\t\truns.find(\n\t\t\t(r) =>\n\t\t\t\tfrom >= r.selection.anchor.offset &&\n\t\t\t\tto <= r.selection.head.offset &&\n\t\t\t\t(isCollapsed(sel)\n\t\t\t\t\t? active && marksEqual(r.mark, active)\n\t\t\t\t\t: from < r.selection.head.offset && to > r.selection.anchor.offset),\n\t\t) ?? null\n\t);\n}\n\n/** One transaction keeps both undo selection and the editing caret intact. */\nexport function changeLink(\n\tstate: EditorState,\n\trange: LinkRange,\n\thref?: string,\n): Transaction | null {\n\tif (href !== undefined && href === range.mark.attrs?.href) return null;\n\tconst selected: EditorState = state.withSelection(range.selection);\n\tconst tr: Transaction | null =\n\t\thref === undefined\n\t\t\t? removeAttributedMark(selected, markType('link'))\n\t\t\t: applyAttributedMark(selected, { ...range.mark, attrs: { ...range.mark.attrs, href } });\n\treturn tr\n\t\t? {\n\t\t\t\t...tr,\n\t\t\t\tselectionBefore: state.selection,\n\t\t\t\tselectionAfter: state.selection,\n\t\t\t\tstoredMarksAfter: null,\n\t\t\t}\n\t\t: null;\n}\n","/** Shared actions and URL form for both link bubble hosts. */\nimport {\n\tapplyAttributedMark,\n\tisAttributedMarkActive,\n} from '../../commands/AttributedMarkCommands.js';\nimport { sanitizeHref } from '../../model/HTMLUtils.js';\nimport { isCollapsed, isTextSelection, selectionsEqual } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { LINK_LOCALE_EN, type LinkLocale } from './LinkLocale.js';\nimport { createNavigationLink, scrollToFragment } from './LinkNavigation.js';\nimport type { LinkRange } from './LinkRange.js';\nimport { changeLink, resolveLinkRange } from './LinkRange.js';\n\nexport function renderLinkBubble(\n\tpopup: HTMLElement,\n\tcontext: PluginContext,\n\tlocale: LinkLocale,\n\tonClose: () => void,\n): void {\n\tconst state: EditorState = context.getState();\n\tconst range: LinkRange | null = resolveLinkRange(state);\n\tlet dismissed = false;\n\tconst dismiss = (): void => {\n\t\tif (dismissed) return;\n\t\tdismissed = true;\n\t\tonClose();\n\t};\n\tconst close = (): void => {\n\t\tdismiss();\n\t\tcontext.getContainer().focus();\n\t};\n\tconst valid = (): boolean =>\n\t\t!context.isReadOnly() &&\n\t\tcontext.getState().doc === state.doc &&\n\t\t(range\n\t\t\t? JSON.stringify(resolveLinkRange(context.getState())) === JSON.stringify(range)\n\t\t\t: selectionsEqual(context.getState().selection, state.selection));\n\tpopup.classList.add('notectl-link-popup', 'notectl-link-bubble');\n\tpopup.setAttribute('role', 'dialog');\n\tpopup.setAttribute('aria-label', locale.label);\n\tconst content: HTMLDivElement = document.createElement('div');\n\tpopup.append(content);\n\tconst button = (label: string, aria: string, action: () => void): HTMLButtonElement => {\n\t\tconst el: HTMLButtonElement = document.createElement('button');\n\t\tel.type = 'button';\n\t\tel.className = 'notectl-link-popup__button';\n\t\tel.textContent = label;\n\t\tel.setAttribute('aria-label', aria);\n\t\tel.addEventListener('mousedown', (e) => e.preventDefault());\n\t\tel.addEventListener('click', action);\n\t\treturn el;\n\t};\n\tconst form = (): void => {\n\t\tcontent.replaceChildren();\n\t\tconst input: HTMLInputElement = document.createElement('input');\n\t\tinput.type = 'url';\n\t\tinput.className = 'notectl-link-popup__input';\n\t\tinput.value = String(range?.mark.attrs?.href ?? '');\n\t\tinput.placeholder = locale.urlPlaceholder;\n\t\tinput.setAttribute('aria-label', locale.urlAria);\n\t\tconst error: HTMLDivElement = document.createElement('div');\n\t\terror.className = 'notectl-link-popup__error';\n\t\terror.setAttribute('role', 'alert');\n\t\terror.hidden = true;\n\t\tconst apply = (): void => {\n\t\t\tif (!valid()) {\n\t\t\t\tclose();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst href: string = sanitizeHref(input.value.trim());\n\t\t\tif (!href) {\n\t\t\t\terror.textContent = locale.invalidUrl;\n\t\t\t\terror.hidden = false;\n\t\t\t\tinput.setAttribute('aria-invalid', 'true');\n\t\t\t\tinput.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst tr: Transaction | null = range\n\t\t\t\t? changeLink(context.getState(), range, href)\n\t\t\t\t: isTextSelection(state.selection) && !isCollapsed(state.selection)\n\t\t\t\t\t? applyAttributedMark(state, { type: markType('link'), attrs: { href } })\n\t\t\t\t\t: null;\n\t\t\tif (tr) context.dispatch(tr);\n\t\t\tclose();\n\t\t};\n\t\tconst applyButton: HTMLButtonElement = button(locale.apply, locale.applyAria, apply);\n\t\tapplyButton.classList.add('notectl-link-popup__button--apply');\n\t\tinput.addEventListener('keydown', (e) => {\n\t\t\tif (e.key === 'Enter' && !e.isComposing) {\n\t\t\t\te.preventDefault();\n\t\t\t\tapply();\n\t\t\t}\n\t\t});\n\t\tinput.addEventListener('input', () => {\n\t\t\terror.hidden = true;\n\t\t\tinput.removeAttribute('aria-invalid');\n\t\t});\n\t\tcontent.append(input, applyButton, error);\n\t\tinput.focus();\n\t\trequestAnimationFrame(() => {\n\t\t\tif (input.isConnected) input.focus();\n\t\t});\n\t};\n\tpopup.addEventListener('keydown', (e) => {\n\t\t// The custom dialog owns its keys, including text editing and form Tab order.\n\t\te.stopImmediatePropagation();\n\t\tif (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tclose();\n\t\t\treturn;\n\t\t}\n\t\tif (content.querySelector('input')) return;\n\t\tconst actions: HTMLElement[] = Array.from(content.querySelectorAll<HTMLElement>('a, button'));\n\t\tconst index: number = actions.indexOf(\n\t\t\tpopup.getRootNode() instanceof ShadowRoot\n\t\t\t\t? ((popup.getRootNode() as ShadowRoot).activeElement as HTMLElement)\n\t\t\t\t: (document.activeElement as HTMLElement),\n\t\t);\n\t\tlet next: number = index;\n\t\tif (e.key === 'ArrowRight' || e.key === 'ArrowDown') next = (index + 1) % actions.length;\n\t\telse if (e.key === 'ArrowLeft' || e.key === 'ArrowUp')\n\t\t\tnext = (index + actions.length - 1) % actions.length;\n\t\telse if (e.key === 'Home') next = 0;\n\t\telse if (e.key === 'End') next = actions.length - 1;\n\t\telse return;\n\t\te.preventDefault();\n\t\tactions.forEach((el, i) => {\n\t\t\tel.tabIndex = i === next ? 0 : -1;\n\t\t});\n\t\tactions[next]?.focus();\n\t});\n\tpopup.addEventListener('focusout', (e) => {\n\t\tif (e.relatedTarget instanceof Node && !popup.contains(e.relatedTarget)) dismiss();\n\t});\n\tif (!range) {\n\t\tform();\n\t\tif (isAttributedMarkActive(state, 'link')) {\n\t\t\tcontent.append(\n\t\t\t\tbutton(locale.removeLink, locale.removeLinkAria, () => {\n\t\t\t\t\tif (valid()) context.executeCommand('removeLink');\n\t\t\t\t\tclose();\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\tconst href: string = String(range.mark.attrs?.href ?? '');\n\tconst open: HTMLAnchorElement | null = createNavigationLink(document, href, true);\n\tif (open) {\n\t\topen.className = 'notectl-link-bubble__open';\n\t\tconst label: HTMLSpanElement = document.createElement('span');\n\t\tlabel.textContent =\n\t\t\t(open.target === '_blank' ? locale.openLinkInNewTab : locale.openLink) ??\n\t\t\tLINK_LOCALE_EN.openLink;\n\t\tconst address: HTMLSpanElement = document.createElement('span');\n\t\taddress.className = 'notectl-link-bubble__url';\n\t\taddress.dir = 'ltr';\n\t\taddress.textContent = sanitizeHref(href);\n\t\topen.append(label, address);\n\t\topen.addEventListener('click', (e) => {\n\t\t\tif (e.defaultPrevented || !href.startsWith('#')) return;\n\t\t\te.preventDefault();\n\t\t\tscrollToFragment(context.getContainer(), href);\n\t\t});\n\t\tcontent.append(open);\n\t}\n\tconst editLabel: string = locale.editLink ?? LINK_LOCALE_EN.editLink;\n\tconst edit: HTMLButtonElement = button(editLabel, editLabel, form);\n\tconst remove: HTMLButtonElement = button(locale.removeLink, locale.removeLinkAria, () => {\n\t\tif (valid()) context.executeCommand('removeLink');\n\t\tclose();\n\t});\n\tedit.tabIndex = open ? -1 : 0;\n\tremove.tabIndex = -1;\n\tcontent.append(edit, remove);\n\tconst closeButton: HTMLButtonElement = button(\n\t\t'×',\n\t\tlocale.closeBubble ?? LINK_LOCALE_EN.closeBubble,\n\t\tclose,\n\t);\n\tcloseButton.className = 'notectl-link-bubble__close';\n\tpopup.append(closeButton);\n}\n","/** Non-modal link bubble. Keeps the editing selection until an action is chosen. */\n\nimport type { PluginContext } from '../Plugin.js';\nimport { type PopupHandle, PopupManager } from '../shared/PopupManager.js';\nimport { renderLinkBubble } from './LinkBubbleContent.js';\nimport type { LinkLocale } from './LinkLocale.js';\nimport { createNavigationLink } from './LinkNavigation.js';\n\nexport class LinkBubble {\n\tprivate readonly popups: PopupManager;\n\tprivate handle: PopupHandle | null = null;\n\tprivate anchor: HTMLElement | null = null;\n\n\tconstructor(\n\t\tprivate readonly container: HTMLElement,\n\t\tprivate readonly locale: LinkLocale,\n\t\tprivate readonly context: PluginContext,\n\t) {\n\t\tthis.popups = new PopupManager(container);\n\t}\n\n\t/**\n\t * Shows the bubble for a link in the content. Returns `false` when the URL\n\t * is rejected. The author is mid-edit, so the open action always targets a\n\t * new tab regardless of how rendered links are configured.\n\t */\n\tshow(anchor: HTMLElement): boolean {\n\t\tthis.close();\n\t\tconst href: string = anchor.getAttribute('href') ?? '';\n\t\tconst link: HTMLAnchorElement | null = createNavigationLink(\n\t\t\tthis.container.ownerDocument,\n\t\t\thref,\n\t\t\ttrue,\n\t\t);\n\t\tif (anchor instanceof HTMLAnchorElement && !link) return false;\n\n\t\tthis.anchor = anchor;\n\t\tthis.handle = this.popups.open({\n\t\t\tanchor,\n\t\t\tclassName: 'notectl-link-bubble',\n\t\t\tariaRole: 'dialog',\n\t\t\tariaLabel: this.locale.label,\n\t\t\tautoFocus: false,\n\t\t\tonClose: () => {\n\t\t\t\tthis.handle = null;\n\t\t\t\tthis.anchor = null;\n\t\t\t},\n\t\t\tcontent: (popup: HTMLElement): void => {\n\t\t\t\tthis.render(popup, this.context, () => this.close());\n\t\t\t},\n\t\t});\n\t\treturn true;\n\t}\n\n\trender(popup: HTMLElement, context: PluginContext, close: () => void): void {\n\t\trenderLinkBubble(popup, context, this.locale, close);\n\t}\n\n\t/**\n\t * Follows the link through scrolling and resizing, such as the scroll a\n\t * virtual keyboard causes right after a tap. Closes once the link has left\n\t * the editor's visible area or the document.\n\t */\n\treposition(): void {\n\t\tif (!this.handle || !this.anchor) return;\n\t\tif (!this.anchor.isConnected || !this.isWithinContent(this.anchor)) {\n\t\t\tthis.close();\n\t\t\treturn;\n\t\t}\n\t\tthis.popups.reposition(this.handle);\n\t}\n\n\tisOpen(): boolean {\n\t\treturn this.handle !== null;\n\t}\n\n\t/** Moves from the editor into the bubble on Tab without changing the document selection. */\n\tfocus(closeButton = false): boolean {\n\t\tconst link: HTMLElement | null | undefined = this.handle\n\t\t\t?.getElement()\n\t\t\t.querySelector(closeButton ? '.notectl-link-bubble__close' : 'a, input');\n\t\tif (!link) return false;\n\t\tlink.focus();\n\t\treturn true;\n\t}\n\n\tclose(restoreFocus = false): boolean {\n\t\tconst handle: PopupHandle | null = this.handle;\n\t\tthis.handle = null;\n\t\tthis.anchor = null;\n\t\thandle?.close({ restoreFocusTo: restoreFocus ? this.container : null });\n\t\treturn handle !== null;\n\t}\n\n\tdestroy(): void {\n\t\tthis.close();\n\t\tthis.popups.destroy();\n\t}\n\n\tprivate isWithinContent(anchor: HTMLElement): boolean {\n\t\tconst anchorRect: DOMRect = anchor.getBoundingClientRect();\n\t\tconst contentRect: DOMRect = this.container.getBoundingClientRect();\n\t\treturn anchorRect.bottom >= contentRect.top && anchorRect.top <= contentRect.bottom;\n\t}\n}\n","/** Owns link gestures and the bubble lifecycle, independently of mark editing. */\n\nimport { sanitizeHref } from '../../model/HTMLUtils.js';\nimport { isCollapsed, isTextSelection, selectionsEqual } from '../../model/Selection.js';\nimport type { EditorSelection } from '../../model/Selection.js';\nimport { isEventFromEditorContent } from '../../platform/EditorEventBoundary.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport { LinkBubble } from './LinkBubble.js';\nimport { LINK_LOCALE_EN, type LinkLocale } from './LinkLocale.js';\nimport { findLinkAnchor, openLink, scrollToFragment } from './LinkNavigation.js';\nimport type { LinkRange } from './LinkRange.js';\nimport { resolveLinkRange } from './LinkRange.js';\n\nconst MODIFIER_KEYS: ReadonlySet<string> = new Set(['Control', 'Meta', 'Shift', 'Alt']);\n\ninterface LayoutSource {\n\treadonly target: EventTarget;\n\treadonly type: 'scroll' | 'resize';\n\treadonly capture: boolean;\n}\n\nexport class LinkInteractionController {\n\tprivate readonly container: HTMLElement;\n\tprivate readonly bubble: LinkBubble;\n\tprivate readonly layoutSources: readonly LayoutSource[];\n\tprivate readonly handleLayoutChange = (): void => {\n\t\tthis.bubble.reposition();\n\t};\n\tprivate readonly handleClick = (event: MouseEvent): void => this.onClick(event);\n\tprivate readonly handleKeydown = (event: KeyboardEvent): void => this.onKeydown(event);\n\tprivate announcementPending = false;\n\tprivate lastRange = '';\n\tprivate pointerSelection = false;\n\tprivate pendingTabs = 0;\n\tprivate pendingAnchor: HTMLAnchorElement | null = null;\n\tprivate readonly handlePointer = (): void => {\n\t\tthis.pointerSelection = true;\n\t};\n\tprivate toolbarClose: (() => void) | null = null;\n\tprivate readonly handleInput = (): void => {\n\t\tthis.closeBubble();\n\t};\n\n\trenderToolbar(\n\t\tpopup: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tclose: (options?: PopupCloseOptions) => void,\n\t): void {\n\t\tthis.closeBubble();\n\t\tlet closed = false;\n\t\tconst dismiss = (): void => {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tthis.toolbarClose = null;\n\t\t\tclose({ restoreFocusTo: null });\n\t\t};\n\t\tthis.toolbarClose = dismiss;\n\t\tthis.bubble.render(popup, context, dismiss);\n\t}\n\n\tonSelectionChange(oldState: EditorState, state: EditorState): void {\n\t\tif (this.pendingAnchor && resolveLinkRange(state)) {\n\t\t\tthis.showClickedLink(this.pendingAnchor);\n\t\t}\n\t\tif (selectionsEqual(oldState.selection, state.selection)) return;\n\t\tconst range: LinkRange | null = isCollapsed(state.selection) ? resolveLinkRange(state) : null;\n\t\tconst key: string = range ? JSON.stringify(range) : '';\n\t\tif (key === this.lastRange) return;\n\t\tthis.closeBubble();\n\t\tthis.lastRange = key;\n\t\tconst root: Node = this.container.getRootNode();\n\t\tconst active: Element | null =\n\t\t\troot instanceof ShadowRoot ? root.activeElement : this.container.ownerDocument.activeElement;\n\t\tif (range && !this.pointerSelection && active === this.container && !this.context.isReadOnly())\n\t\t\tthis.showAtSelection();\n\t}\n\n\tshowAtSelection(): boolean {\n\t\tif (this.context.isReadOnly()) return false;\n\t\tconst state: EditorState = this.context.getState();\n\t\tconst sel: EditorSelection = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\t\tconst range: LinkRange | null = resolveLinkRange(state);\n\t\tif (!range && isCollapsed(sel)) return false;\n\t\tconst block: HTMLElement | null = this.container.querySelector<HTMLElement>(\n\t\t\t`[data-block-id=\"${CSS.escape(sel.anchor.blockId)}\"]`,\n\t\t);\n\t\tif (!block) return false;\n\t\tlet anchor: HTMLElement = block;\n\t\tif (range) {\n\t\t\t// DOM is used only for placement; the model range owns all editing.\n\t\t\tconst links: HTMLAnchorElement[] = Array.from(block.querySelectorAll<HTMLAnchorElement>('a'));\n\t\t\tconst href: string = String(range.mark.attrs?.href ?? '');\n\t\t\tconst target: HTMLAnchorElement | undefined = links.find((link) => {\n\t\t\t\tconst start: number = anchorOffset(block, link);\n\t\t\t\treturn (\n\t\t\t\t\tlink.getAttribute('href') === sanitizeHref(href) &&\n\t\t\t\t\tstart <= sel.anchor.offset &&\n\t\t\t\t\tstart + (link.textContent?.length ?? 0) >= sel.anchor.offset\n\t\t\t\t);\n\t\t\t});\n\t\t\tif (!target) return false;\n\t\t\tanchor = target;\n\t\t}\n\t\tthis.closeBubble();\n\t\tif (!this.bubble.show(anchor)) return false;\n\t\tthis.lastRange = range ? JSON.stringify(range) : '';\n\t\tthis.announcementPending = true;\n\t\tthis.announce();\n\t\treturn true;\n\t}\n\n\tconstructor(\n\t\tprivate readonly context: PluginContext,\n\t\tprivate readonly locale: LinkLocale,\n\t) {\n\t\tthis.container = context.getContainer();\n\t\tthis.bubble = new LinkBubble(this.container, locale, context);\n\t\tthis.layoutSources = collectLayoutSources(this.container);\n\t\tthis.container.addEventListener('click', this.handleClick);\n\t\tthis.container.addEventListener('pointerdown', this.handlePointer);\n\t\tthis.container.addEventListener('beforeinput', this.handleInput);\n\t\tthis.container.addEventListener('compositionstart', this.handleInput);\n\t\tthis.container.addEventListener('keydown', this.handleKeydown, true);\n\t\tfor (const source of this.layoutSources) {\n\t\t\tsource.target.addEventListener(source.type, this.handleLayoutChange, source.capture);\n\t\t}\n\t}\n\n\tdismissForDocument(state: EditorState): void {\n\t\tthis.closeBubble();\n\t\tconst range: LinkRange | null = resolveLinkRange(state);\n\t\tthis.lastRange = range ? JSON.stringify(range) : '';\n\t}\n\n\tcloseBubble(): void {\n\t\tthis.pendingAnchor = null;\n\t\tthis.pendingTabs = 0;\n\t\tthis.bubble.close();\n\t\tconst close: (() => void) | null = this.toolbarClose;\n\t\tthis.toolbarClose = null;\n\t\tclose?.();\n\t}\n\n\t/**\n\t * The editor empties its live region on every transaction, including the\n\t * selection sync that follows the click which opened the preview. Repeats\n\t * the announcement once when that sync has wiped it.\n\t */\n\trestoreBubbleAnnouncement(): void {\n\t\tif (!this.announcementPending || !this.bubble.isOpen()) return;\n\t\tthis.announcementPending = false;\n\t\tif (!this.context.hasAnnouncement()) this.announce();\n\t}\n\n\tdestroy(): void {\n\t\tthis.container.removeEventListener('click', this.handleClick);\n\t\tthis.container.removeEventListener('pointerdown', this.handlePointer);\n\t\tthis.container.removeEventListener('beforeinput', this.handleInput);\n\t\tthis.container.removeEventListener('compositionstart', this.handleInput);\n\t\tthis.container.removeEventListener('keydown', this.handleKeydown, true);\n\t\tfor (const source of this.layoutSources) {\n\t\t\tsource.target.removeEventListener(source.type, this.handleLayoutChange, source.capture);\n\t\t}\n\t\tthis.closeBubble();\n\t\tthis.bubble.destroy();\n\t}\n\n\tprivate onKeydown(event: KeyboardEvent): void {\n\t\tif (!isEventFromEditorContent(event, this.container)) return;\n\t\tthis.pointerSelection = false;\n\t\tif (event.key === 'Escape' && (this.pendingAnchor || this.bubble.isOpen())) {\n\t\t\tthis.closeBubble();\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn;\n\t\t}\n\t\tif (event.key === 'Tab' && !event.shiftKey && this.pendingAnchor) {\n\t\t\tthis.pendingTabs++;\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn;\n\t\t}\n\t\tthis.pendingAnchor = null;\n\t\tif (event.key === 'Tab' && !event.shiftKey && this.bubble.focus()) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn;\n\t\t}\n\t\tif (\n\t\t\t!MODIFIER_KEYS.has(event.key) &&\n\t\t\t!event.key.startsWith('Arrow') &&\n\t\t\tevent.key !== 'Home' &&\n\t\t\tevent.key !== 'End'\n\t\t)\n\t\t\tthis.bubble.close();\n\t}\n\n\tprivate onClick(event: MouseEvent): void {\n\t\tif (!isEventFromEditorContent(event, this.container)) return;\n\t\tthis.closeBubble();\n\t\tif (event.defaultPrevented || event.button !== 0 || event.altKey || event.shiftKey) return;\n\t\tconst anchor: HTMLAnchorElement | null = findLinkAnchor(this.container, event.target);\n\t\tif (!anchor) return;\n\t\tconst href: string = sanitizeHref(anchor.getAttribute('href') ?? '');\n\t\tif (!href) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst modified: boolean = event.ctrlKey || event.metaKey;\n\t\tif (!modified && scrollToFragment(this.container, href)) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\t\t// Readonly links retain native navigation, modifiers, context menus and keyboard activation.\n\t\tif (this.context.isReadOnly()) return;\n\t\tif (modified) {\n\t\t\tevent.preventDefault();\n\t\t\topenLink(this.container, href, true);\n\t\t\treturn;\n\t\t}\n\t\tif (href.startsWith('#')) return;\n\n\t\tevent.preventDefault();\n\t\tif (event.detail > 1) return;\n\t\tthis.pendingAnchor = anchor;\n\t\t// Chromium can still expose the previous range until its selectionchange fires.\n\t\tif (this.container.ownerDocument.getSelection()?.isCollapsed !== false) {\n\t\t\tthis.showClickedLink(anchor);\n\t\t}\n\t}\n\n\tprivate showClickedLink(anchor: HTMLAnchorElement): void {\n\t\tif (!isCollapsed(this.context.getState().selection)) return;\n\t\tconst range: LinkRange | null = resolveLinkRange(this.context.getState());\n\t\tif (\n\t\t\t!range ||\n\t\t\tsanitizeHref(String(range.mark.attrs?.href ?? '')) !== anchor.getAttribute('href')\n\t\t)\n\t\t\treturn;\n\t\tconst block: HTMLElement | null = anchor.closest('[data-block-id]');\n\t\tif (block) {\n\t\t\tconst start: number = anchorOffset(block, anchor);\n\t\t\tif (\n\t\t\t\tblock.dataset.blockId !== range.selection.anchor.blockId ||\n\t\t\t\tstart < range.selection.anchor.offset ||\n\t\t\t\tstart >= range.selection.head.offset\n\t\t\t)\n\t\t\t\treturn;\n\t\t}\n\t\tthis.pendingAnchor = null;\n\t\tif (!this.bubble.show(anchor)) return;\n\t\tthis.lastRange = JSON.stringify(range);\n\t\tif (this.pendingTabs) this.bubble.focus(this.pendingTabs > 1);\n\t\tthis.pendingTabs = 0;\n\t\t// The preview takes no focus, so screen readers learn about it from the live region.\n\t\tthis.announcementPending = true;\n\t\tthis.announce();\n\t}\n\n\tprivate announce(): void {\n\t\tthis.context.announce(this.locale.bubbleOpened ?? LINK_LOCALE_EN.bubbleOpened);\n\t}\n}\n\n/**\n * Everything that can move a link on screen: scrolling inside the editor\n * (scroll does not cross the shadow boundary, so the content element needs\n * its own capture listener), scrolling the page, resizing the window, and the\n * visual viewport changes a virtual keyboard causes.\n */\nfunction collectLayoutSources(container: HTMLElement): readonly LayoutSource[] {\n\tconst view: Window | null = container.ownerDocument.defaultView;\n\tconst sources: LayoutSource[] = [\n\t\t{ target: container, type: 'scroll', capture: true },\n\t\t{ target: container.ownerDocument, type: 'scroll', capture: true },\n\t];\n\tif (view) sources.push({ target: view, type: 'resize', capture: false });\n\tif (view?.visualViewport) {\n\t\tsources.push(\n\t\t\t{ target: view.visualViewport, type: 'resize', capture: false },\n\t\t\t{ target: view.visualViewport, type: 'scroll', capture: false },\n\t\t);\n\t}\n\treturn sources;\n}\n\n/** Count model offsets before an anchor, treating inline objects as one position. */\nfunction anchorOffset(block: HTMLElement, anchor: HTMLAnchorElement): number {\n\tconst before: Range = block.ownerDocument.createRange();\n\tbefore.selectNodeContents(block);\n\tbefore.setEndBefore(anchor);\n\tconst preceding: DocumentFragment = before.cloneContents();\n\tfor (const inline of preceding.querySelectorAll('[data-inline-type]'))\n\t\tinline.replaceWith('\\uFFFC');\n\treturn preceding.textContent?.length ?? 0;\n}\n","/**\n * LinkPlugin: registers a link mark type with href attribute,\n * editing and navigation commands, keyboard shortcuts, and toolbar popup.\n * Link gestures and the non-modal bubble have their own lifecycle controller.\n */\n\nimport {\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { LINK_CSS } from '../../editor/styles/link.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { escapeHTML, 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 type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { LinkInteractionController } from './LinkInteractionController.js';\nimport { LINK_LOCALE_EN, type LinkLocale, loadLinkLocale } from './LinkLocale.js';\nimport { openLink, shouldOpenInNewTab } from './LinkNavigation.js';\nimport { changeLink, resolveLinkRange } from './LinkRange.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// --- 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 = LINK_LOCALE_EN;\n\tprivate interaction: LinkInteractionController | 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\tcontext.registerStyleSheet(LINK_CSS);\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.interaction?.destroy();\n\t\tthis.interaction = new LinkInteractionController(context, this.locale);\n\t}\n\n\tdestroy(): void {\n\t\tthis.interaction?.destroy();\n\t\tthis.interaction = null;\n\t}\n\n\tonStateChange(oldState: EditorState, newState: EditorState): void {\n\t\tif (oldState.doc !== newState.doc) {\n\t\t\tthis.interaction?.dismissForDocument(newState);\n\t\t\treturn;\n\t\t}\n\t\tthis.interaction?.onSelectionChange(oldState, newState);\n\t\tthis.interaction?.restoreBubbleAnnouncement();\n\t}\n\n\tonReadOnlyChange(): void {\n\t\tthis.interaction?.closeBubble();\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 registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('showLinkBubble', () => this.interaction?.showAtSelection() ?? false);\n\t\tcontext.registerCommand(\n\t\t\t'openLink',\n\t\t\t() => {\n\t\t\t\tconst href: string | null = getMarkAttrAtSelection(\n\t\t\t\t\tcontext.getState(),\n\t\t\t\t\t'link',\n\t\t\t\t\t(mark) => mark.attrs.href,\n\t\t\t\t);\n\t\t\t\tif (href === null) return false;\n\t\t\t\t// An author mid-edit keeps the editor; readers follow the configured target.\n\t\t\t\tconst newTab: boolean = context.isReadOnly() ? this.config.openInNewTab : true;\n\t\t\t\treturn openLink(context.getContainer(), href, newTab);\n\t\t\t},\n\t\t\t{ readonlyAllowed: true },\n\t\t);\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('showLinkBubble'),\n\t\t});\n\t\tcontext.registerKeymap(\n\t\t\t{ 'Alt-Enter': () => context.executeCommand('openLink') },\n\t\t\t{ priority: 'navigation' },\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) || this.isLinkActive(state),\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 removeLink(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst range: ReturnType<typeof resolveLinkRange> = resolveLinkRange(state);\n\t\tif (range) return dispatchIfPresent(context, changeLink(state, range));\n\t\tif (isCollapsed(sel)) return false;\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: (options?: PopupCloseOptions) => void,\n\t): void {\n\t\tthis.interaction?.renderToolbar(container, context, onClose);\n\t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