@notectl/core 2.0.7 → 2.0.9

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 (282) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/AlignmentPlugin-D1wmhWE6.mjs +2 -0
  3. package/dist/chunks/AlignmentPlugin-D1wmhWE6.mjs.map +1 -0
  4. package/dist/chunks/{AttributedMarkCommands-D_PYkbBt.mjs → AttributedMarkCommands-35jTbVRg.mjs} +2 -2
  5. package/dist/chunks/{AttributedMarkCommands-D_PYkbBt.mjs.map → AttributedMarkCommands-35jTbVRg.mjs.map} +1 -1
  6. package/dist/chunks/{BlockInsertion-DaG_4D31.mjs → BlockInsertion-DsnHLcvM.mjs} +2 -2
  7. package/dist/chunks/{BlockInsertion-DaG_4D31.mjs.map → BlockInsertion-DsnHLcvM.mjs.map} +1 -1
  8. package/dist/chunks/BlockquotePlugin-Bwny0CP6.mjs +2 -0
  9. package/dist/chunks/BlockquotePlugin-Bwny0CP6.mjs.map +1 -0
  10. package/dist/chunks/CaretNavigationPlugin-C-rCDbu0.mjs +2 -0
  11. package/dist/chunks/CaretNavigationPlugin-C-rCDbu0.mjs.map +1 -0
  12. package/dist/chunks/CodeBlockPlugin-CNC290_q.mjs +2 -0
  13. package/dist/chunks/CodeBlockPlugin-CNC290_q.mjs.map +1 -0
  14. package/dist/chunks/{ColorGrid-BNDaG3b2.mjs → ColorGrid-BUSIBKZH.mjs} +1 -1
  15. package/dist/chunks/{ColorGrid-BNDaG3b2.mjs.map → ColorGrid-BUSIBKZH.mjs.map} +1 -1
  16. package/dist/chunks/{ColorPickerPopup-BwU_WZHh.mjs → ColorPickerPopup-CvE90IAu.mjs} +2 -2
  17. package/dist/chunks/{ColorPickerPopup-BwU_WZHh.mjs.map → ColorPickerPopup-CvE90IAu.mjs.map} +1 -1
  18. package/dist/chunks/{CommandHelpers-BoRO1KfE.mjs → CommandHelpers-DTlQcGv5.mjs} +2 -2
  19. package/dist/chunks/{CommandHelpers-BoRO1KfE.mjs.map → CommandHelpers-DTlQcGv5.mjs.map} +1 -1
  20. package/dist/chunks/Commands-BuYF23lf.mjs +2 -0
  21. package/dist/chunks/Commands-BuYF23lf.mjs.map +1 -0
  22. package/dist/chunks/FontPlugin-z0QF1M5q.mjs +2 -0
  23. package/dist/chunks/FontPlugin-z0QF1M5q.mjs.map +1 -0
  24. package/dist/chunks/FontSizePlugin-DYKvhu9w.mjs +2 -0
  25. package/dist/chunks/FontSizePlugin-DYKvhu9w.mjs.map +1 -0
  26. package/dist/chunks/{GapCursorNavigation-PhJeqELx.mjs → GapCursorNavigation-BaXDnjFf.mjs} +2 -2
  27. package/dist/chunks/{GapCursorNavigation-PhJeqELx.mjs.map → GapCursorNavigation-BaXDnjFf.mjs.map} +1 -1
  28. package/dist/chunks/GapCursorPlugin-uxw7W7vj.mjs +2 -0
  29. package/dist/chunks/GapCursorPlugin-uxw7W7vj.mjs.map +1 -0
  30. package/dist/chunks/{HardBreakPlugin-BzAU3DoJ.mjs → HardBreakPlugin-BpXipf8h.mjs} +2 -2
  31. package/dist/chunks/{HardBreakPlugin-BzAU3DoJ.mjs.map → HardBreakPlugin-BpXipf8h.mjs.map} +1 -1
  32. package/dist/chunks/HeadingPlugin-CUN746aD.mjs +2 -0
  33. package/dist/chunks/{HeadingPlugin-1BVn57NF.mjs.map → HeadingPlugin-CUN746aD.mjs.map} +1 -1
  34. package/dist/chunks/HighlightPlugin-bbAi6W6k.mjs +2 -0
  35. package/dist/chunks/HighlightPlugin-bbAi6W6k.mjs.map +1 -0
  36. package/dist/chunks/HorizontalRulePlugin-D8w6paMa.mjs +2 -0
  37. package/dist/chunks/HorizontalRulePlugin-D8w6paMa.mjs.map +1 -0
  38. package/dist/chunks/ImagePlugin-De7lWcZ7.mjs +2 -0
  39. package/dist/chunks/ImagePlugin-De7lWcZ7.mjs.map +1 -0
  40. package/dist/chunks/InlineCodePlugin-DKQIYhTb.mjs +2 -0
  41. package/dist/chunks/InlineCodePlugin-DKQIYhTb.mjs.map +1 -0
  42. package/dist/chunks/LinkPlugin-BD7mcRHS.mjs +2 -0
  43. package/dist/chunks/LinkPlugin-BD7mcRHS.mjs.map +1 -0
  44. package/dist/chunks/ListPlugin-DbixSqMH.mjs +2 -0
  45. package/dist/chunks/{ListPlugin-Datp4nPR.mjs.map → ListPlugin-DbixSqMH.mjs.map} +1 -1
  46. package/dist/chunks/{NavigationQueries-_xQtPALX.mjs → NavigationQueries-CgYPG6oY.mjs} +1 -1
  47. package/dist/chunks/{NavigationQueries-_xQtPALX.mjs.map → NavigationQueries-CgYPG6oY.mjs.map} +1 -1
  48. package/dist/chunks/NodeSelectionCommands-Ddxu5Qck.mjs +2 -0
  49. package/dist/chunks/NodeSelectionCommands-Ddxu5Qck.mjs.map +1 -0
  50. package/dist/chunks/PluginHelpers-D1QF-YaF.mjs +2 -0
  51. package/dist/chunks/PluginHelpers-D1QF-YaF.mjs.map +1 -0
  52. package/dist/chunks/{shared-BLU27F7-.mjs → PopupKeyboardPatterns-DhcUe29m.mjs} +1 -1
  53. package/dist/chunks/PopupKeyboardPatterns-DhcUe29m.mjs.map +1 -0
  54. package/dist/chunks/PrintPlugin-DVRybXSN.mjs +2 -0
  55. package/dist/chunks/PrintPlugin-DVRybXSN.mjs.map +1 -0
  56. package/dist/chunks/{RangeIterator-CVUeIB4P.mjs → RangeIterator-DytL1lUT.mjs} +1 -1
  57. package/dist/chunks/{RangeIterator-CVUeIB4P.mjs.map → RangeIterator-DytL1lUT.mjs.map} +1 -1
  58. package/dist/chunks/SmartPastePlugin-i96yAnXZ.mjs +2 -0
  59. package/dist/chunks/SmartPastePlugin-i96yAnXZ.mjs.map +1 -0
  60. package/dist/chunks/StrikethroughPlugin-RGZATXUZ.mjs +2 -0
  61. package/dist/chunks/StrikethroughPlugin-RGZATXUZ.mjs.map +1 -0
  62. package/dist/chunks/SuperSubPlugin-BOWFP1Kr.mjs +2 -0
  63. package/dist/chunks/SuperSubPlugin-BOWFP1Kr.mjs.map +1 -0
  64. package/dist/chunks/TablePlugin-DZTMBkyu.mjs +2 -0
  65. package/dist/chunks/TablePlugin-DZTMBkyu.mjs.map +1 -0
  66. package/dist/chunks/TextColorPlugin-CB3RpTSQ.mjs +2 -0
  67. package/dist/chunks/TextColorPlugin-CB3RpTSQ.mjs.map +1 -0
  68. package/dist/chunks/{TextDirectionCorePlugin-CXCxX532.mjs → TextDirectionCorePlugin-tNecTcrX.mjs} +2 -2
  69. package/dist/chunks/{TextDirectionCorePlugin-CXCxX532.mjs.map → TextDirectionCorePlugin-tNecTcrX.mjs.map} +1 -1
  70. package/dist/chunks/TextDirectionLocale-_AUfZu9j.mjs +2 -0
  71. package/dist/chunks/{TextDirectionLocale-Kh3r4XQS.mjs.map → TextDirectionLocale-_AUfZu9j.mjs.map} +1 -1
  72. package/dist/chunks/TextFormattingPlugin-CZ6D-luc.mjs +2 -0
  73. package/dist/chunks/TextFormattingPlugin-CZ6D-luc.mjs.map +1 -0
  74. package/dist/chunks/ToolbarPlugin-2K96zYut.mjs +2 -0
  75. package/dist/chunks/ToolbarPlugin-2K96zYut.mjs.map +1 -0
  76. package/dist/chunks/WordBoundary-BE2u997Q.mjs +2 -0
  77. package/dist/chunks/WordBoundary-BE2u997Q.mjs.map +1 -0
  78. package/dist/chunks/XmlSupport-DG8PEZhO.mjs +2 -0
  79. package/dist/chunks/XmlSupport-DG8PEZhO.mjs.map +1 -0
  80. package/dist/chunks/ar--dzNQRg4.mjs +2 -0
  81. package/dist/chunks/{ar-DLxmSv7R.mjs.map → ar--dzNQRg4.mjs.map} +1 -1
  82. package/dist/chunks/{color-picker-D4Vi72Z_.mjs → color-picker-ChYYdC-r.mjs} +1 -1
  83. package/dist/chunks/{color-picker-D4Vi72Z_.mjs.map → color-picker-ChYYdC-r.mjs.map} +1 -1
  84. package/dist/chunks/de-C7Grl0t1.mjs +2 -0
  85. package/dist/chunks/de-C7Grl0t1.mjs.map +1 -0
  86. package/dist/chunks/{es-BL7KuLOg.mjs → es-BwmzRdDZ.mjs} +2 -2
  87. package/dist/chunks/es-BwmzRdDZ.mjs.map +1 -0
  88. package/dist/chunks/{fonts-B3hiRKxQ.mjs → fonts-CG_dDwvT.mjs} +1 -1
  89. package/dist/chunks/{fonts-B3hiRKxQ.mjs.map → fonts-CG_dDwvT.mjs.map} +1 -1
  90. package/dist/chunks/fr-CC7TYK5K.mjs +2 -0
  91. package/dist/chunks/{fr-GSoPohxY.mjs.map → fr-CC7TYK5K.mjs.map} +1 -1
  92. package/dist/chunks/full-B9IqlP6u.mjs +2 -0
  93. package/dist/chunks/{full-DCZ8MMpe.mjs.map → full-B9IqlP6u.mjs.map} +1 -1
  94. package/dist/chunks/{hi-CTb2tu17.mjs → hi-BtN2T9la.mjs} +2 -2
  95. package/dist/chunks/{hi-CTb2tu17.mjs.map → hi-BtN2T9la.mjs.map} +1 -1
  96. package/dist/chunks/minimal-J-u7e_pr.mjs +2 -0
  97. package/dist/chunks/{minimal-DmYfqOxb.mjs.map → minimal-J-u7e_pr.mjs.map} +1 -1
  98. package/dist/chunks/{pt-BattAVOq.mjs → pt-B59gJzMS.mjs} +2 -2
  99. package/dist/chunks/pt-B59gJzMS.mjs.map +1 -0
  100. package/dist/chunks/{ru-U-UhwubV.mjs → ru-KBX9Y7TT.mjs} +2 -2
  101. package/dist/chunks/{ru-U-UhwubV.mjs.map → ru-KBX9Y7TT.mjs.map} +1 -1
  102. package/dist/chunks/src-DPhUQ25M.mjs +2 -0
  103. package/dist/chunks/src-DPhUQ25M.mjs.map +1 -0
  104. package/dist/chunks/{text-direction-advanced-CkFu0K_I.mjs → text-direction-advanced-S4MgVMLX.mjs} +2 -2
  105. package/dist/chunks/{text-direction-advanced-CkFu0K_I.mjs.map → text-direction-advanced-S4MgVMLX.mjs.map} +1 -1
  106. package/dist/chunks/{zh-TXVgSc3H.mjs → zh-D4eu30KQ.mjs} +2 -2
  107. package/dist/chunks/{zh-TXVgSc3H.mjs.map → zh-D4eu30KQ.mjs.map} +1 -1
  108. package/dist/commands/CommandHelpers.d.ts +13 -0
  109. package/dist/commands/CommandHelpers.d.ts.map +1 -1
  110. package/dist/commands/DeleteCommands.d.ts.map +1 -1
  111. package/dist/editor/EditorConfig.d.ts +7 -0
  112. package/dist/editor/EditorConfig.d.ts.map +1 -1
  113. package/dist/editor/EditorLocale.d.ts.map +1 -1
  114. package/dist/editor/styles/code-block.d.ts.map +1 -1
  115. package/dist/fonts.mjs +1 -1
  116. package/dist/full.mjs +1 -1
  117. package/dist/index.d.ts +2 -1
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/notectl-core.mjs +1 -1
  120. package/dist/notectl-core.umd.js +1 -1
  121. package/dist/notectl-core.umd.js.map +1 -1
  122. package/dist/plugins/CommandRegistry.d.ts +3 -0
  123. package/dist/plugins/CommandRegistry.d.ts.map +1 -1
  124. package/dist/plugins/EventBus.d.ts +3 -0
  125. package/dist/plugins/EventBus.d.ts.map +1 -1
  126. package/dist/plugins/Logger.d.ts +50 -0
  127. package/dist/plugins/Logger.d.ts.map +1 -0
  128. package/dist/plugins/MiddlewareChain.d.ts +3 -0
  129. package/dist/plugins/MiddlewareChain.d.ts.map +1 -1
  130. package/dist/plugins/PluginContextFactory.d.ts +2 -0
  131. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  132. package/dist/plugins/PluginLifecycle.d.ts +3 -1
  133. package/dist/plugins/PluginLifecycle.d.ts.map +1 -1
  134. package/dist/plugins/PluginManager.d.ts +14 -1
  135. package/dist/plugins/PluginManager.d.ts.map +1 -1
  136. package/dist/plugins/alignment/AlignmentLocale.d.ts.map +1 -1
  137. package/dist/plugins/alignment.mjs +1 -1
  138. package/dist/plugins/blockquote/BlockquoteLocale.d.ts.map +1 -1
  139. package/dist/plugins/blockquote.mjs +1 -1
  140. package/dist/plugins/caret-navigation/CaretNavigationLocale.d.ts.map +1 -1
  141. package/dist/plugins/caret-navigation.mjs +1 -1
  142. package/dist/plugins/code-block/CodeBlockCommands.d.ts.map +1 -1
  143. package/dist/plugins/code-block/CodeBlockLocale.d.ts +4 -0
  144. package/dist/plugins/code-block/CodeBlockLocale.d.ts.map +1 -1
  145. package/dist/plugins/code-block/CodeBlockNodeView.d.ts +13 -1
  146. package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
  147. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  148. package/dist/plugins/code-block/CodeBlockService.d.ts +2 -2
  149. package/dist/plugins/code-block/CodeBlockService.d.ts.map +1 -1
  150. package/dist/plugins/code-block/LanguagePicker.d.ts +14 -0
  151. package/dist/plugins/code-block/LanguagePicker.d.ts.map +1 -0
  152. package/dist/plugins/code-block/highlighter/RegexTokenizer.d.ts.map +1 -1
  153. package/dist/plugins/code-block/highlighter/TokenizerTypes.d.ts +1 -1
  154. package/dist/plugins/code-block/highlighter/TokenizerTypes.d.ts.map +1 -1
  155. package/dist/plugins/code-block/locales/ar.d.ts.map +1 -1
  156. package/dist/plugins/code-block/locales/de.d.ts.map +1 -1
  157. package/dist/plugins/code-block/locales/es.d.ts.map +1 -1
  158. package/dist/plugins/code-block/locales/fr.d.ts.map +1 -1
  159. package/dist/plugins/code-block/locales/hi.d.ts.map +1 -1
  160. package/dist/plugins/code-block/locales/pt.d.ts.map +1 -1
  161. package/dist/plugins/code-block/locales/ru.d.ts.map +1 -1
  162. package/dist/plugins/code-block/locales/zh.d.ts.map +1 -1
  163. package/dist/plugins/code-block.mjs +1 -1
  164. package/dist/plugins/font/FontLocale.d.ts.map +1 -1
  165. package/dist/plugins/font-size/FontSizeLocale.d.ts.map +1 -1
  166. package/dist/plugins/font-size.mjs +1 -1
  167. package/dist/plugins/font.mjs +1 -1
  168. package/dist/plugins/gap-cursor/GapCursorLocale.d.ts.map +1 -1
  169. package/dist/plugins/gap-cursor.mjs +1 -1
  170. package/dist/plugins/hard-break.mjs +1 -1
  171. package/dist/plugins/heading/HeadingLocale.d.ts.map +1 -1
  172. package/dist/plugins/heading.mjs +1 -1
  173. package/dist/plugins/highlight/HighlightLocale.d.ts.map +1 -1
  174. package/dist/plugins/highlight.mjs +1 -1
  175. package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts.map +1 -1
  176. package/dist/plugins/horizontal-rule.mjs +1 -1
  177. package/dist/plugins/image/ImageLocale.d.ts.map +1 -1
  178. package/dist/plugins/image.mjs +1 -1
  179. package/dist/plugins/inline-code/InlineCodeLocale.d.ts.map +1 -1
  180. package/dist/plugins/inline-code.mjs +1 -1
  181. package/dist/plugins/language.mjs +1 -1
  182. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  183. package/dist/plugins/link.mjs +1 -1
  184. package/dist/plugins/list/ListLocale.d.ts.map +1 -1
  185. package/dist/plugins/list.mjs +1 -1
  186. package/dist/plugins/print/PrintLocale.d.ts.map +1 -1
  187. package/dist/plugins/print.mjs +1 -1
  188. package/dist/plugins/shared/LocaleLoader.d.ts +49 -0
  189. package/dist/plugins/shared/LocaleLoader.d.ts.map +1 -0
  190. package/dist/plugins/shared/index.d.ts +1 -0
  191. package/dist/plugins/shared/index.d.ts.map +1 -1
  192. package/dist/plugins/shared.mjs +1 -1
  193. package/dist/plugins/smart-paste/SmartPasteLocale.d.ts.map +1 -1
  194. package/dist/plugins/smart-paste.mjs +1 -1
  195. package/dist/plugins/strikethrough/StrikethroughLocale.d.ts.map +1 -1
  196. package/dist/plugins/strikethrough.mjs +1 -1
  197. package/dist/plugins/super-sub/SuperSubLocale.d.ts.map +1 -1
  198. package/dist/plugins/super-sub.mjs +1 -1
  199. package/dist/plugins/table/TableCommands.d.ts.map +1 -1
  200. package/dist/plugins/table/TableLocale.d.ts.map +1 -1
  201. package/dist/plugins/table.mjs +1 -1
  202. package/dist/plugins/text-color/TextColorLocale.d.ts.map +1 -1
  203. package/dist/plugins/text-color.mjs +1 -1
  204. package/dist/plugins/text-direction/TextDirectionLocale.d.ts.map +1 -1
  205. package/dist/plugins/text-direction-advanced.mjs +1 -1
  206. package/dist/plugins/text-direction.mjs +1 -1
  207. package/dist/plugins/text-formatting/TextFormattingLocale.d.ts.map +1 -1
  208. package/dist/plugins/text-formatting.mjs +1 -1
  209. package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -1
  210. package/dist/plugins/toolbar.mjs +1 -1
  211. package/dist/presets/full.mjs +1 -1
  212. package/dist/presets/minimal.mjs +1 -1
  213. package/dist/presets.mjs +1 -1
  214. package/dist/state/EditorState.d.ts +2 -0
  215. package/dist/state/EditorState.d.ts.map +1 -1
  216. package/dist/view/EditorView.d.ts +11 -1
  217. package/dist/view/EditorView.d.ts.map +1 -1
  218. package/package.json +11 -11
  219. package/dist/chunks/AlignmentPlugin-CD11uRY3.mjs +0 -2
  220. package/dist/chunks/AlignmentPlugin-CD11uRY3.mjs.map +0 -1
  221. package/dist/chunks/BlockquotePlugin-DpMA33pk.mjs +0 -2
  222. package/dist/chunks/BlockquotePlugin-DpMA33pk.mjs.map +0 -1
  223. package/dist/chunks/CaretNavigationPlugin-BxU2lMwX.mjs +0 -2
  224. package/dist/chunks/CaretNavigationPlugin-BxU2lMwX.mjs.map +0 -1
  225. package/dist/chunks/CodeBlockPlugin-CSb6Fxce.mjs +0 -2
  226. package/dist/chunks/CodeBlockPlugin-CSb6Fxce.mjs.map +0 -1
  227. package/dist/chunks/Commands-C7zBYmhA.mjs +0 -2
  228. package/dist/chunks/Commands-C7zBYmhA.mjs.map +0 -1
  229. package/dist/chunks/FontPlugin-CUVcS-40.mjs +0 -2
  230. package/dist/chunks/FontPlugin-CUVcS-40.mjs.map +0 -1
  231. package/dist/chunks/FontSizePlugin-a8YyFsjf.mjs +0 -2
  232. package/dist/chunks/FontSizePlugin-a8YyFsjf.mjs.map +0 -1
  233. package/dist/chunks/GapCursorPlugin-9V0Ne0Sw.mjs +0 -2
  234. package/dist/chunks/GapCursorPlugin-9V0Ne0Sw.mjs.map +0 -1
  235. package/dist/chunks/HeadingPlugin-1BVn57NF.mjs +0 -2
  236. package/dist/chunks/HighlightPlugin-7S6Y_IFY.mjs +0 -2
  237. package/dist/chunks/HighlightPlugin-7S6Y_IFY.mjs.map +0 -1
  238. package/dist/chunks/HorizontalRulePlugin-bZ4nat7E.mjs +0 -2
  239. package/dist/chunks/HorizontalRulePlugin-bZ4nat7E.mjs.map +0 -1
  240. package/dist/chunks/ImagePlugin-wz0SBhFQ.mjs +0 -2
  241. package/dist/chunks/ImagePlugin-wz0SBhFQ.mjs.map +0 -1
  242. package/dist/chunks/InlineCodePlugin-DW5_oiac.mjs +0 -2
  243. package/dist/chunks/InlineCodePlugin-DW5_oiac.mjs.map +0 -1
  244. package/dist/chunks/LinkPlugin-pWzPs-dS.mjs +0 -2
  245. package/dist/chunks/LinkPlugin-pWzPs-dS.mjs.map +0 -1
  246. package/dist/chunks/ListPlugin-Datp4nPR.mjs +0 -2
  247. package/dist/chunks/NodeSelectionCommands-BFHLrE5I.mjs +0 -2
  248. package/dist/chunks/NodeSelectionCommands-BFHLrE5I.mjs.map +0 -1
  249. package/dist/chunks/PluginHelpers-Db50-BRE.mjs +0 -2
  250. package/dist/chunks/PluginHelpers-Db50-BRE.mjs.map +0 -1
  251. package/dist/chunks/PrintPlugin-Dv8_E40e.mjs +0 -2
  252. package/dist/chunks/PrintPlugin-Dv8_E40e.mjs.map +0 -1
  253. package/dist/chunks/SmartPastePlugin-PCLFN5yA.mjs +0 -2
  254. package/dist/chunks/SmartPastePlugin-PCLFN5yA.mjs.map +0 -1
  255. package/dist/chunks/StrikethroughPlugin-J5eDn_sY.mjs +0 -2
  256. package/dist/chunks/StrikethroughPlugin-J5eDn_sY.mjs.map +0 -1
  257. package/dist/chunks/SuperSubPlugin-uSLscUwN.mjs +0 -2
  258. package/dist/chunks/SuperSubPlugin-uSLscUwN.mjs.map +0 -1
  259. package/dist/chunks/TablePlugin-DJHHWTD2.mjs +0 -2
  260. package/dist/chunks/TablePlugin-DJHHWTD2.mjs.map +0 -1
  261. package/dist/chunks/TextColorPlugin-CawTv5pV.mjs +0 -2
  262. package/dist/chunks/TextColorPlugin-CawTv5pV.mjs.map +0 -1
  263. package/dist/chunks/TextDirectionLocale-Kh3r4XQS.mjs +0 -2
  264. package/dist/chunks/TextFormattingPlugin-DKgwX4Gy.mjs +0 -2
  265. package/dist/chunks/TextFormattingPlugin-DKgwX4Gy.mjs.map +0 -1
  266. package/dist/chunks/ToolbarPlugin-BipA0zez.mjs +0 -2
  267. package/dist/chunks/ToolbarPlugin-BipA0zez.mjs.map +0 -1
  268. package/dist/chunks/WordBoundary-DI0G6Wk2.mjs +0 -2
  269. package/dist/chunks/WordBoundary-DI0G6Wk2.mjs.map +0 -1
  270. package/dist/chunks/XmlSupport-UA-iNWTl.mjs +0 -2
  271. package/dist/chunks/XmlSupport-UA-iNWTl.mjs.map +0 -1
  272. package/dist/chunks/ar-DLxmSv7R.mjs +0 -2
  273. package/dist/chunks/de-BnhP65y3.mjs +0 -2
  274. package/dist/chunks/de-BnhP65y3.mjs.map +0 -1
  275. package/dist/chunks/es-BL7KuLOg.mjs.map +0 -1
  276. package/dist/chunks/fr-GSoPohxY.mjs +0 -2
  277. package/dist/chunks/full-DCZ8MMpe.mjs +0 -2
  278. package/dist/chunks/minimal-DmYfqOxb.mjs +0 -2
  279. package/dist/chunks/pt-BattAVOq.mjs.map +0 -1
  280. package/dist/chunks/shared-BLU27F7-.mjs.map +0 -1
  281. package/dist/chunks/src-CgbuJfYr.mjs +0 -2
  282. package/dist/chunks/src-CgbuJfYr.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImagePlugin-wz0SBhFQ.mjs","names":[],"sources":["../../src/editor/styles/image.ts","../../src/plugins/image/ImageCommands.ts","../../src/plugins/image/ImageLocale.ts","../../src/plugins/image/ImageNodeView.ts","../../src/plugins/image/ImagePopup.ts","../../src/plugins/image/ImageUpload.ts","../../src/plugins/image/ImagePlugin.ts"],"sourcesContent":["/** Image styles — display, alignment, resize handles, upload overlay. */\nexport const IMAGE_CSS = `\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-primary-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","/**\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 { deleteNodeSelection } from '../../commands/NodeSelectionCommands.js';\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport { createBlockNode, getBlockChildren, isBlockNode } from '../../model/Document.js';\nimport { createNodeSelection, isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { ImageAttrs } from './ImageUpload.js';\n\n/**\n * Inserts an image block. When the cursor is inside a table cell,\n * the image is inserted as a child of the cell. Otherwise it is\n * inserted after the current block at document root.\n */\nexport function insertImage(\n\tcontext: PluginContext,\n\tattrs: Partial<ImageAttrs> & { readonly src: string },\n): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\n\tconst imageAttrs: BlockAttrs = {\n\t\tsrc: attrs.src,\n\t\talt: attrs.alt ?? '',\n\t\talign: attrs.align ?? 'center',\n\t\t...(attrs.width !== undefined ? { width: attrs.width } : {}),\n\t\t...(attrs.height !== undefined ? { height: attrs.height } : {}),\n\t};\n\n\tif (isGapCursor(sel)) return false;\n\n\tconst anchorBlockId: BlockId = isNodeSelection(sel) ? sel.nodeId : sel.anchor.blockId;\n\n\t// Check if we're inside a table cell\n\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\tif (cellId) {\n\t\treturn insertImageIntoCell(state, context, cellId, imageAttrs);\n\t}\n\n\treturn insertImageAtRoot(state, context, anchorBlockId, imageAttrs);\n}\n\n/** Finds a table_cell ancestor for the given block (or the block itself). */\nfunction findTableCellAncestor(state: EditorState, bid: BlockId): BlockId | undefined {\n\tconst block: BlockNode | undefined = state.getBlock(bid);\n\tif (block?.type === 'table_cell') return bid;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(bid);\n\tif (!path) return undefined;\n\n\tfor (const id of path) {\n\t\tconst node: BlockNode | undefined = state.getBlock(id);\n\t\tif (node?.type === 'table_cell') return id;\n\t}\n\treturn undefined;\n}\n\n/** Inserts an image at document root after the anchor block. */\nfunction insertImageAtRoot(\n\tstate: EditorState,\n\tcontext: PluginContext,\n\tanchorBlockId: BlockId,\n\timageAttrs: BlockAttrs,\n): boolean {\n\tconst blockIndex: number = state.doc.children.findIndex((b) => b.id === anchorBlockId);\n\tif (blockIndex === -1) return false;\n\n\tconst imageBlock: BlockNode = createBlockNode(nodeType('image'), [], undefined, imageAttrs);\n\tconst newParagraph: BlockNode = createBlockNode(nodeType('paragraph'));\n\n\tconst tr = state\n\t\t.transaction('command')\n\t\t.insertNode([], blockIndex + 1, imageBlock)\n\t\t.insertNode([], blockIndex + 2, newParagraph)\n\t\t.setSelection(createNodeSelection(imageBlock.id, []))\n\t\t.build();\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Inserts an image as a child of a table cell. */\nfunction insertImageIntoCell(\n\tstate: EditorState,\n\tcontext: PluginContext,\n\tcellId: BlockId,\n\timageAttrs: BlockAttrs,\n): boolean {\n\tconst cellPath: BlockId[] | undefined = state.getNodePath(cellId);\n\tif (!cellPath) return false;\n\n\tconst imageBlock: BlockNode = createBlockNode(nodeType('image'), [], undefined, imageAttrs);\n\n\t// Remove existing block children first (if any)\n\tconst cell: BlockNode | undefined = state.getBlock(cellId);\n\tif (!cell) return false;\n\n\tconst builder = state.transaction('command');\n\tconst blockChildren: readonly BlockNode[] = getBlockChildren(cell);\n\tfor (let i = blockChildren.length - 1; i >= 0; i--) {\n\t\t// Find the raw index in children array\n\t\tconst rawIndex: number = cell.children.findIndex(\n\t\t\t(c) => isBlockNode(c) && c.id === blockChildren[i]?.id,\n\t\t);\n\t\tif (rawIndex !== -1) {\n\t\t\tbuilder.removeNode(cellPath, rawIndex);\n\t\t}\n\t}\n\n\t// Insert image at index 0 (before any text nodes)\n\tbuilder.insertNode(cellPath, 0, imageBlock);\n\tbuilder.setSelection(createNodeSelection(imageBlock.id, [...cellPath, imageBlock.id]));\n\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Removes the currently selected image block (works for nested images too). */\nexport function removeImage(context: PluginContext): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst nodePath: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!nodePath || nodePath.length === 0) return false;\n\n\tconst tr = deleteNodeSelection(state, createNodeSelection(sel.nodeId, nodePath));\n\tif (!tr) return false;\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Updates attributes on the currently selected image block. */\nexport function setImageAttr(context: PluginContext, attrs: Partial<ImageAttrs>): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!path) return false;\n\n\tconst merged: BlockAttrs = { ...(block.attrs ?? {}), ...attrs };\n\tconst tr = state.transaction('command').setNodeAttr(path, merged).build();\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Minimum image width in pixels (shared with NodeView). */\nexport const MIN_IMAGE_WIDTH = 50;\n\n/**\n * Resizes the currently selected image by a pixel delta, preserving aspect ratio.\n * Returns false if no image is selected or the image has no width/height attributes.\n */\nexport function resizeImageByDelta(\n\tcontext: PluginContext,\n\tdelta: number,\n\tmaxWidth: number,\n): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst currentWidth: number | undefined = block.attrs?.width as number | undefined;\n\tconst currentHeight: number | undefined = block.attrs?.height as number | undefined;\n\tif (currentWidth === undefined || currentHeight === undefined) return false;\n\n\tconst aspectRatio: number = currentHeight > 0 ? currentWidth / currentHeight : 1;\n\tconst clampedWidth: number = Math.max(MIN_IMAGE_WIDTH, Math.min(maxWidth, currentWidth + delta));\n\tconst newHeight: number = Math.round(clampedWidth / aspectRatio);\n\n\tif (clampedWidth === currentWidth && newHeight === currentHeight) return false;\n\n\treturn setImageAttr(context, { width: clampedWidth, height: newHeight });\n}\n\n/** Resets the currently selected image to its natural size by removing width/height. */\nexport function resetImageSize(context: PluginContext): boolean {\n\tconst state = context.getState();\n\tconst sel = state.selection;\n\tif (!isNodeSelection(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\tif (!block || block.type !== 'image') return false;\n\n\tconst path: BlockId[] | undefined = state.getNodePath(sel.nodeId);\n\tif (!path) return false;\n\n\tconst attrs: BlockAttrs = { ...(block.attrs ?? {}) };\n\tconst cleaned: BlockAttrs = Object.fromEntries(\n\t\tObject.entries(attrs).filter(([k]) => k !== 'width' && k !== 'height'),\n\t);\n\n\tconst tr = state.transaction('command').setNodeAttr(path, cleaned).build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Registers all image commands on the plugin context. */\nexport function registerImageCommands(context: PluginContext): void {\n\tcontext.registerCommand('insertImage', () => {\n\t\treturn insertImage(context, { src: '' });\n\t});\n\n\tcontext.registerCommand('removeImage', () => {\n\t\treturn removeImage(context);\n\t});\n}\n","/** Locale interface and default English locale for the ImagePlugin. */\n\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: Record<string, () => Promise<{ default: ImageLocale }>> = import.meta.glob<{\n\tdefault: ImageLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadImageLocale(lang: string): Promise<ImageLocale> {\n\tif (lang === 'en') return IMAGE_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return IMAGE_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn IMAGE_LOCALE_EN;\n\t}\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 isRtl: boolean = getTextDirection(figure) === 'rtl';\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\thandle.setAttribute('role', 'separator');\n\t\t\t\thandle.setAttribute('aria-label', getHandleLabel(pos, isRtl, locale));\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 { setStyleProperty, setStyleText } from '../../style/StyleRuntime.js';\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\tsetStyleProperty(container, 'padding', '8px');\n\tsetStyleProperty(container, 'minWidth', '240px');\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\tsetStyleText(fileInput, 'position:absolute;width:0;height:0;overflow:hidden;opacity:0;');\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\tsetStyleText(\n\t\tuploadBtn,\n\t\t'display:block;width:100%;padding:8px 12px;cursor:pointer;' +\n\t\t\t'text-align:center;box-sizing:border-box;' +\n\t\t\t'border:1px solid var(--notectl-border);border-radius:4px;' +\n\t\t\t'background:var(--notectl-surface-raised);color:var(--notectl-fg);',\n\t);\n\n\tuploadBtn.addEventListener('mousedown', (e: MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\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\tsetStyleText(\n\t\tseparator,\n\t\t'display:flex;align-items:center;margin:8px 0;' +\n\t\t\t'color:var(--notectl-fg-muted);font-size:12px;',\n\t);\n\n\tconst line1: HTMLSpanElement = document.createElement('span');\n\tsetStyleText(line1, 'flex:1;height:1px;background:var(--notectl-border);');\n\n\tconst orText: HTMLSpanElement = document.createElement('span');\n\torText.textContent = locale.separator;\n\tsetStyleText(orText, 'padding:0 8px;');\n\n\tconst line2: HTMLSpanElement = document.createElement('span');\n\tsetStyleText(line2, 'flex:1;height:1px;background:var(--notectl-border);');\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\tsetStyleText(\n\t\turlInput,\n\t\t'width:100%;padding:6px 8px;box-sizing:border-box;' +\n\t\t\t'border:1px solid var(--notectl-border);border-radius:4px;' +\n\t\t\t'background:var(--notectl-surface-overlay);color:var(--notectl-fg);',\n\t);\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\tsetStyleText(\n\t\tinsertBtn,\n\t\t'width:100%;padding:8px 12px;margin-top:4px;cursor:pointer;' +\n\t\t\t'border:1px solid var(--notectl-border);border-radius:4px;' +\n\t\t\t'background:var(--notectl-surface-raised);color:var(--notectl-fg);',\n\t);\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\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","/**\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.js';\nimport type { BlockAttrs, BlockNode } from '../../model/Document.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport { isNodeSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport { createBlockElement } from '../../view/DomUtils.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport {\n\tinsertImage,\n\tregisterImageCommands,\n\tresetImageSize,\n\tresizeImageByDelta,\n} from './ImageCommands.js';\nimport { IMAGE_LOCALE_EN, type ImageLocale, loadImageLocale } from './ImageLocale.js';\nimport { createImageNodeViewFactory } from './ImageNodeView.js';\nimport { renderImagePopup } from './ImagePopup.js';\nimport {\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\twidth?: number;\n\t\t\theight?: number;\n\t\t\talign: 'start' | 'center' | 'end';\n\t\t};\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\tthis.context = context;\n\t\tthis.registerNodeSpec(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\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\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\treturn `<figure><img src=\"${src}\" alt=\"${alt}\"${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\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\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', 'width', 'height', 'class', 'style'],\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerNodeView(context: PluginContext): void {\n\t\tcontext.registerNodeView(\n\t\t\t'image',\n\t\t\tcreateImageNodeViewFactory(this.config, this.uploadStates, this.resolvedKeymap, this.locale),\n\t\t);\n\t}\n\n\tprivate registerResizeCommands(context: PluginContext): void {\n\t\tconst step: number = this.config.resizeStep ?? 10;\n\t\tconst stepLarge: number = this.config.resizeStepLarge ?? 50;\n\t\tconst maxWidth: number = this.config.maxWidth;\n\n\t\tcontext.registerCommand('resizeImageGrow', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, step, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageShrink', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, -step, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageGrowLarge', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, stepLarge, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resizeImageShrinkLarge', () => {\n\t\t\tconst result: boolean = resizeImageByDelta(context, -stepLarge, maxWidth);\n\t\t\tif (result) this.announceCurrentSize(context);\n\t\t\treturn result;\n\t\t});\n\n\t\tcontext.registerCommand('resetImageSize', () => {\n\t\t\tconst result: boolean = resetImageSize(context);\n\t\t\tif (result) context.announce(this.locale.resetToNaturalSize);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\tprivate registerResizeKeymaps(context: PluginContext): void {\n\t\tconst bindings: Record<string, () => boolean> = {};\n\t\tconst commands: Record<keyof ImageKeymap, string> = {\n\t\t\tgrowWidth: 'resizeImageGrow',\n\t\t\tshrinkWidth: 'resizeImageShrink',\n\t\t\tgrowWidthLarge: 'resizeImageGrowLarge',\n\t\t\tshrinkWidthLarge: 'resizeImageShrinkLarge',\n\t\t\tresetSize: 'resetImageSize',\n\t\t};\n\n\t\tfor (const [slot, commandName] of Object.entries(commands)) {\n\t\t\tconst binding: string | null = this.resolvedKeymap[slot as keyof ImageKeymap] ?? null;\n\t\t\tif (binding) {\n\t\t\t\tbindings[binding] = () => context.executeCommand(commandName);\n\t\t\t}\n\t\t}\n\n\t\tif (Object.keys(bindings).length > 0) {\n\t\t\tcontext.registerKeymap(bindings);\n\t\t}\n\t}\n\n\tprivate registerFileHandler(context: PluginContext): void {\n\t\tcontext.registerFileHandler('image/*', async (file, _position) => {\n\t\t\tif (!this.isAcceptedType(file.type)) return false;\n\t\t\tthis.handleFileInsert(context, file);\n\t\t\treturn true;\n\t\t});\n\t}\n\n\tprivate handleFileInsert(context: PluginContext, file: File): void {\n\t\tif (file.size > this.config.maxFileSize) return;\n\n\t\tconst blobUrl: string = URL.createObjectURL(file);\n\t\tthis.blobUrls.add(blobUrl);\n\n\t\tconst inserted: boolean = insertImage(context, { src: blobUrl });\n\t\tif (!inserted) {\n\t\t\tURL.revokeObjectURL(blobUrl);\n\t\t\tthis.blobUrls.delete(blobUrl);\n\t\t\treturn;\n\t\t}\n\n\t\t// Find the newly inserted image block\n\t\tconst state: EditorState = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\t\tconst imageBlockId: BlockId = sel.nodeId;\n\n\t\tthis.uploadStates.set(imageBlockId, 'uploading');\n\n\t\t// Upload if service is registered\n\t\tconst uploadService = context.getService(IMAGE_UPLOAD_SERVICE);\n\t\tif (uploadService) {\n\t\t\tthis.uploadFile(context, file, imageBlockId, blobUrl);\n\t\t} else {\n\t\t\tthis.uploadStates.set(imageBlockId, 'complete');\n\t\t}\n\t}\n\n\tprivate async uploadFile(\n\t\tcontext: PluginContext,\n\t\tfile: File,\n\t\timageBlockId: BlockId,\n\t\tblobUrl: string,\n\t): Promise<void> {\n\t\tconst uploadService = context.getService(IMAGE_UPLOAD_SERVICE);\n\t\tif (!uploadService) return;\n\n\t\ttry {\n\t\t\tconst result = await uploadService.upload(file);\n\t\t\tthis.uploadStates.set(imageBlockId, 'complete');\n\n\t\t\t// Replace blob URL with uploaded URL\n\t\t\tconst state: EditorState = context.getState();\n\t\t\tconst block: BlockNode | undefined = state.getBlock(imageBlockId);\n\t\t\tif (!block) return;\n\n\t\t\tconst path: BlockId[] | undefined = state.getNodePath(imageBlockId);\n\t\t\tif (!path) return;\n\n\t\t\tconst merged: BlockAttrs = {\n\t\t\t\t...(block.attrs ?? {}),\n\t\t\t\tsrc: result.url,\n\t\t\t\t...(result.width !== undefined ? { width: result.width } : {}),\n\t\t\t\t...(result.height !== undefined ? { height: result.height } : {}),\n\t\t\t};\n\n\t\t\tconst tr: Transaction = state.transaction('command').setNodeAttr(path, merged).build();\n\t\t\tcontext.dispatch(tr);\n\n\t\t\t// Clean up blob URL\n\t\t\tURL.revokeObjectURL(blobUrl);\n\t\t\tthis.blobUrls.delete(blobUrl);\n\t\t} catch {\n\t\t\tthis.uploadStates.set(imageBlockId, 'error');\n\t\t\tcontext.announce(this.locale.uploadFailed);\n\t\t}\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'image',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.insertImage,\n\t\t\ttooltip: this.locale.insertImageTooltip,\n\t\t\tcommand: 'insertImage',\n\t\t\tpopupType: 'custom',\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\trenderImagePopup(container, ctx, {\n\t\t\t\t\tacceptedTypes: this.config.acceptedTypes,\n\t\t\t\t\tlocale: this.locale,\n\t\t\t\t\tonFileInsert: (c, file) => this.handleFileInsert(c, file),\n\t\t\t\t\tonClose,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate isAcceptedType(mimeType: string): boolean {\n\t\treturn this.config.acceptedTypes.some(\n\t\t\t(accepted) =>\n\t\t\t\taccepted === mimeType ||\n\t\t\t\t(accepted.endsWith('/*') && mimeType.startsWith(accepted.slice(0, -1))),\n\t\t);\n\t}\n\n\tprivate isImageSelected(state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return false;\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\treturn block?.type === 'image';\n\t}\n\n\tprivate announceImageSelection(state: EditorState): void {\n\t\tif (!this.context) return;\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\tif (!block || block.type !== 'image') return;\n\n\t\tconst alt: string = (block.attrs?.alt as string | undefined) ?? '';\n\t\tconst width: number | undefined = block.attrs?.width as number | undefined;\n\t\tconst height: number | undefined = block.attrs?.height as number | undefined;\n\n\t\tconst parts: string[] = [this.locale.imageSelected];\n\t\tif (alt) parts.push(`${this.locale.altTextPrefix}${alt}.`);\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tparts.push(this.locale.imageSizeAnnounce(width, height));\n\t\t}\n\n\t\tconst shrinkKey: string | null = this.resolvedKeymap.shrinkWidth ?? null;\n\t\tconst growKey: string | null = this.resolvedKeymap.growWidth ?? null;\n\t\tif (shrinkKey && growKey) {\n\t\t\tparts.push(this.locale.resizeHint(formatShortcut(shrinkKey), formatShortcut(growKey)));\n\t\t}\n\n\t\tthis.context.announce(parts.join(' '));\n\t}\n\n\tprivate announceCurrentSize(context: PluginContext): void {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (!isNodeSelection(sel)) return;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.nodeId);\n\t\tif (!block || block.type !== 'image') return;\n\n\t\tconst width: number | undefined = block.attrs?.width as number | undefined;\n\t\tconst height: number | undefined = block.attrs?.height as number | undefined;\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tcontext.announce(this.locale.imageResized(width, height));\n\t\t}\n\t}\n}\n"],"mappings":"kjBCoBA,SAAgB,EACf,EACA,GAEA,MAAM,EAAQ,EAAQ,WAChB,EAAM,EAAM,UAEZ,EAAyB,CAC9B,IAAK,EAAM,IACX,IAAK,EAAM,KAAO,GAClB,MAAO,EAAM,OAAS,iBACF,IAAhB,EAAM,MAAsB,CAAE,MAAO,EAAM,OAAU,CAAA,UACpC,IAAjB,EAAM,OAAuB,CAAE,OAAQ,EAAM,QAAW,CAAA,GAG7D,GAAI,EAAY,GAAM,OAAO,EAE7B,MAAM,EAAyB,EAAgB,GAAO,EAAI,OAAS,EAAI,OAAO,QAGxE,EASP,SAA+B,EAAoB,GAElD,GAAoB,eADiB,EAAM,SAAS,IACzC,KAAuB,OAAO,EAEzC,MAAM,EAA8B,EAAM,YAAY,GACtD,GAAK,EAEL,IAAK,MAAM,KAAM,EAEhB,GAAmB,eADiB,EAAM,SAAS,IACzC,KAAuB,OAAO,EAlBL,CAAsB,EAAO,GACjE,OAAI,EA+CL,SACC,EACA,EACA,EACA,GAEA,MAAM,EAAkC,EAAM,YAAY,GAC1D,IAAK,EAAU,OAAO,EAEtB,MAAM,EAAwB,EAAgB,EAAS,SAAU,QAAI,EAAW,GAG1E,EAA8B,EAAM,SAAS,GACnD,IAAK,EAAM,OAAO,EAElB,MAAM,EAAU,EAAM,YAAY,WAC5B,EAA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AC1B,EAAQ,SAAS,KAAK,OAAO,aAAa,EAAO"}
@@ -1,2 +0,0 @@
1
- import{u as t}from"./Document-_qdGR4vh.mjs";import{o as e,t as o,u as r}from"./Selection-aeiSsvhe.mjs";import{_ as s,m as i}from"./Commands-C7zBYmhA.mjs";import{i as n}from"./TypeBrands-BZDKMjR-.mjs";import{i as a}from"./PluginHelpers-Db50-BRE.mjs";import{t as c}from"./ShortcutFormatting-DE6B8iGs.mjs";var l={label:"Inline Code",tooltip:t=>`Inline Code (${t})`},m=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Bs3sx3Oz.mjs"),"./locales/de.ts":()=>import("./de-CWwHCIzX.mjs"),"./locales/es.ts":()=>import("./es-y2SZmX3P.mjs"),"./locales/fr.ts":()=>import("./fr-D66EEW9-.mjs"),"./locales/hi.ts":()=>import("./hi-D0RKvhDO.mjs"),"./locales/pt.ts":()=>import("./pt-Bau_d96t.mjs"),"./locales/ru.ts":()=>import("./ru-DR7ji_U_.mjs"),"./locales/zh.ts":()=>import("./zh-Dt7zL1Bl.mjs")});async function d(t){if("en"===t)return l;const e=m[`./locales/${t}.ts`];if(!e)return l;try{return(await e()).default}catch{return l}}var p={toolbar:!0,keymap:"Mod-E",inputRule:!0},g=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 a(t,this.config.locale,l,d),t.registerStyleSheet("\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"),this.registerMarkSpec(t),this.registerCommand(t),null!==this.config.keymap&&this.registerKeymap(t),!1!==this.config.inputRule&&this.registerInputRule(t),!1!==this.config.toolbar&&this.registerToolbarItem(t),this.registerExclusivityMiddleware(t)}registerMarkSpec(t){t.registerMarkSpec({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"]}})}registerCommand(t){t.registerCommand("toggleInlineCode",()=>{const e=s(t.getState(),n("code"));return!!e&&(t.dispatch(e),!0)})}registerKeymap(t){const e=this.config.keymap??"Mod-E";t.registerKeymap({[e]:()=>t.executeCommand("toggleInlineCode")})}registerInputRule(t){t.registerInputRule({pattern:/(?:^|[^`])(`([^`]+)`)$/,handler(t,s,i,a){const c=t.selection;if(!r(c))return null;if(!e(c))return null;const l=t.getBlock(c.anchor.blockId);if(!l||"code_block"===l.type)return null;const m=s[2],d=s[1];if(!m||!d)return null;const p=a-d.length;return t.transaction("input").deleteTextAt(c.anchor.blockId,p,a).insertText(c.anchor.blockId,p,m,[{type:n("code")}]).setSelection(o(c.anchor.blockId,p+m.length)).build()}})}registerToolbarItem(t){t.registerToolbarItem({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(c(this.config.keymap??"Mod-E")),command:"toggleInlineCode",isActive:t=>i(t,n("code"))})}registerExclusivityMiddleware(e){e.registerMiddleware((e,o,r)=>{let s=!1;const i=[];for(const c of e.steps){if("addMark"!==c.type){i.push(c);continue}const e=c.mark.type;if("code"===e){const e=o.getBlock(c.blockId);if(e){const o=t(e,c.from,c.to),r=/* @__PURE__ */new Set;for(const t of o)if("text"===t.kind)for(const e of t.marks)g.has(e.type)&&r.add(e.type);for(const t of r)s=!0,i.push({type:"removeMark",blockId:c.blockId,from:c.from,to:c.to,mark:{type:n(t)},...c.path?{path:c.path}:{}})}i.push(c);continue}if(g.has(e)){const e=o.getBlock(c.blockId);if(e&&t(e,c.from,c.to).some(t=>"text"===t.kind&&t.marks.some(t=>"code"===t.type))){s=!0;continue}}i.push(c)}let a=e.storedMarksAfter;if(a){const t=a.some(t=>"code"===t.type),e=a.some(t=>g.has(t.type));t&&e&&(a=a.filter(t=>!g.has(t.type)),s=!0)}r(s?{...e,steps:i,storedMarksAfter:a}:e)},{name:"inline-code:mark-exclusivity",priority:50})}};export{l as n,d as r,u as t};
2
- //# sourceMappingURL=InlineCodePlugin-DW5_oiac.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InlineCodePlugin-DW5_oiac.mjs","names":[],"sources":["../../src/plugins/inline-code/InlineCodeLocale.ts","../../src/plugins/inline-code/InlineCodePlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the InlineCodePlugin.\n */\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: Record<string, () => Promise<{ default: InlineCodeLocale }>> =\n\timport.meta.glob<{ default: InlineCodeLocale }>('./locales/*.ts', { eager: false });\n\nexport async function loadInlineCodeLocale(lang: string): Promise<InlineCodeLocale> {\n\tif (lang === 'en') return INLINE_CODE_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return INLINE_CODE_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn INLINE_CODE_LOCALE_EN;\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 { isMarkActive, toggleMark } from '../../commands/Commands.js';\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 {\n\tINLINE_CODE_LOCALE_EN,\n\ttype InlineCodeLocale,\n\tloadInlineCodeLocale,\n} from './InlineCodeLocale.js';\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// --- CSS ---\n\nconst INLINE_CODE_CSS = `\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\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.registerMarkSpec(context);\n\t\tthis.registerCommand(context);\n\n\t\tif (this.config.keymap !== null) {\n\t\t\tthis.registerKeymap(context);\n\t\t}\n\t\tif (this.config.inputRule !== false) {\n\t\t\tthis.registerInputRule(context);\n\t\t}\n\t\tif (this.config.toolbar !== false) {\n\t\t\tthis.registerToolbarItem(context);\n\t\t}\n\t\tthis.registerExclusivityMiddleware(context);\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'code',\n\t\t\trank: 3,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement('code');\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => `<code>${content}</code>`,\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'code',\n\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\tif (el.parentElement?.tagName === 'PRE') return false;\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttag: 'span',\n\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\tconst fontFamily: string = el.style.fontFamily.replace(/['\"]/g, '').trim();\n\t\t\t\t\t\tif (/^monospace$/i.test(fontFamily)) return {};\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['code'] },\n\t\t});\n\t}\n\n\tprivate registerCommand(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleInlineCode', () => {\n\t\t\tconst tr = toggleMark(context.getState(), markType('code'));\n\t\t\tif (tr) {\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tconst key: string = this.config.keymap ?? 'Mod-E';\n\t\tcontext.registerKeymap({\n\t\t\t[key]: () => context.executeCommand('toggleInlineCode'),\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tconst pattern: RegExp = /(?:^|[^`])(`([^`]+)`)$/;\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\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=\"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\tcontext.registerToolbarItem({\n\t\t\tid: 'inline_code',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut(this.config.keymap ?? 'Mod-E')),\n\t\t\tcommand: 'toggleInlineCode',\n\t\t\tisActive: (state) => isMarkActive(state, markType('code')),\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":"+SAaA,IAAa,EAA0C,CACtD,MAAO,cACP,QAAU,GAAqB,gBAAgB,MAK1C,iBACL,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAED,eAAsB,EAAqB,GAC1C,GAAa,OAAT,EAAe,OAAO,EAC1B,MAAM,EAAS,EAAc,aAAa,QAC1C,IAAK,EAAQ,OAAO,EACpB,IAEC,aADkB,KACP,cAEX,OAAO,GCWT,IAAM,EAAmC,CACxC,SAAS,EACT,OAAQ,QACR,WAAW,GAw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KAAM,CAAE,KAAM,EAAS,OACnB,EAAK,KAAO,CAAE,KAAM,EAAK,MAAS,CAAA,IAIzC,EAAa,KAAK,GAClB,SAGD,GAAI,EAAmB,IAAI,GAAe,CAEzC,MAAM,EAA+B,EAAM,SAAS,EAAK,SACzD,GAAI,GACc,EAA+B,EAAO,EAAK,KAAM,EAAK,IACrC,KAChC,GAAqB,SAAb,EAAI,MAAmB,EAAI,MAAM,KAAM,GAAiB,SAAX,EAAE,OAE5C,CACZ,GAAU,EACV,UAKH,EAAa,KAAK,GAInB,IAAI,EAA2C,EAAG,iBAClD,GAAI,EAAkB,CACrB,MAAM,EAAmB,EAAiB,KAAM,GAAiB,SAAX,EAAE,MAClD,EAAuB,EAAiB,KAAM,GAAM,EAAmB,IAAI,EAAE,OAE/E,GAAW,IAEd,EAAmB,EAAiB,OAAQ,IAAO,EAAmB,IAAI,EAAE,OAC5E,GAAU,GAIZ,EAAK,EAAU,IAAK,EAAI,MAAO,EAAc,oBAAqB,IAEnE,CAAE,KAAM,+BAAgC,SAAU"}
@@ -1,2 +0,0 @@
1
- import{v as t}from"./Document-_qdGR4vh.mjs";import{o as e,u as r}from"./Selection-aeiSsvhe.mjs";import{i as n}from"./TypeBrands-BZDKMjR-.mjs";import{r as o}from"./HTMLUtils-B8xj8Z1x.mjs";import{i,r as s,t as a}from"./AttributedMarkCommands-D_PYkbBt.mjs";import{i as l}from"./PluginHelpers-Db50-BRE.mjs";import{t as c}from"./ShortcutFormatting-DE6B8iGs.mjs";var p={label:"Link",tooltip:t=>`Insert Link (${t})`,removeLink:"Remove Link",removeLinkAria:"Remove link",urlPlaceholder:"https://...",urlAria:"Link URL",apply:"Apply",applyAria:"Apply link"},m=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-DJ6K9HnU.mjs"),"./locales/de.ts":()=>import("./de-CWsXH4_J.mjs"),"./locales/es.ts":()=>import("./es-8kEYE5eN.mjs"),"./locales/fr.ts":()=>import("./fr-DVteHTTh.mjs"),"./locales/hi.ts":()=>import("./hi-BqdojmVi.mjs"),"./locales/pt.ts":()=>import("./pt-DchozfDf.mjs"),"./locales/ru.ts":()=>import("./ru-CYMaDdFA.mjs"),"./locales/zh.ts":()=>import("./zh-CBMpL9ha.mjs")});async function u(t){if("en"===t)return p;const e=m[`./locales/${t}.ts`];if(!e)return p;try{return(await e()).default}catch{return p}}var h={openInNewTab:!0},d=class{id="link";name="Link";priority=25;config;locale;constructor(t){this.config={...h,...t}}async init(t){this.locale=await l(t,this.config.locale,p,u),this.registerMarkSpec(t),this.registerCommands(t),this.registerKeymap(t),this.registerToolbarItem(t)}registerMarkSpec(t){const e=this.config.openInNewTab;t.registerMarkSpec({type:"link",rank:10,attrs:{href:{default:""}},toDOM(t){const r=document.createElement("a"),n=t.attrs?.href??"";return r.setAttribute("href",n),e&&(r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer")),r},toHTMLString:(t,r)=>{const n=o(String(t.attrs?.href??""));return e?`<a href="${n}" target="_blank" rel="noopener noreferrer">${r}</a>`:`<a href="${n}">${r}</a>`},parseHTML:[{tag:"a",getAttrs:t=>({href:t.getAttribute("href")??""})}],sanitize:{tags:["a"],attrs:["href","target","rel"]}})}registerCommands(t){t.registerCommand("toggleLink",()=>{const e=t.getState();return this.toggleLink(t,e)}),t.registerCommand("setLink",()=>!1),t.registerCommand("removeLink",()=>{const e=t.getState();return this.removeLink(t,e)})}registerKeymap(t){t.registerKeymap({"Mod-K":()=>t.executeCommand("toggleLink")})}registerToolbarItem(t){t.registerToolbarItem({id:"link",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(c("Mod-K")),command:"toggleLink",popupType:"custom",renderPopup:(t,e,r)=>{this.renderLinkPopup(t,e,r)},isActive:t=>this.isLinkActive(t),isEnabled:t=>!e(t.selection)})}isLinkActive(t){return s(t,"link")}toggleLink(t,e){return!!this.isLinkActive(e)&&this.removeLink(t,e)}addLink(t,o,i){const s=o.selection;if(!r(s))return!1;if(e(s))return!1;const l=a(o,{type:n("link"),attrs:{href:i}});return!!l&&(t.dispatch(l),!0)}removeLink(o,s){const a=s.selection;if(!r(a))return!1;if(e(a)){const e=s.getBlock(a.anchor.blockId);if(!e)return!1;const r=[];let i=0;for(const o of e.children){if(!("text"in o))continue;const e=i+o.text.length;r.push({pos:i,end:e,hasLink:t(o.marks,n("link"))}),i=e}const l=r.findIndex(t=>a.anchor.offset>=t.pos&&a.anchor.offset<=t.end),c=l>=0?r[l]:void 0;if(-1===l||!c?.hasLink)return!1;let p=l;for(;p>0&&r[p-1]?.hasLink;)p--;let m=l;for(;m<r.length-1&&r[m+1]?.hasLink;)m++;const u=r[p],h=r[m];if(!u||!h)return!1;const d=u.pos,k=h.end,g=s.transaction("command");return g.removeMark(a.anchor.blockId,d,k,{type:n("link")}),g.setSelection(a),o.dispatch(g.build()),!0}const l=i(s,n("link"));return!!l&&(o.dispatch(l),!0)}renderLinkPopup(t,e,r){t.classList.add("notectl-link-popup");const n=e.getState();if(this.isLinkActive(n)){const n=document.createElement("button");n.type="button",n.className="notectl-link-popup__button",n.textContent=this.locale.removeLink,n.setAttribute("aria-label",this.locale.removeLinkAria),n.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),e.executeCommand("removeLink"),r(),e.getContainer().focus()}),t.appendChild(n)}else{const n=document.createElement("input");n.type="url",n.className="notectl-link-popup__input",n.placeholder=this.locale.urlPlaceholder,n.setAttribute("aria-label",this.locale.urlAria);const o=document.createElement("button");o.type="button",o.className="notectl-link-popup__button notectl-link-popup__button--apply",o.textContent=this.locale.apply,o.setAttribute("aria-label",this.locale.applyAria);const i=()=>{const t=n.value.trim();t&&(this.addLink(e,e.getState(),t),r(),e.getContainer().focus())};o.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation(),i()}),n.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),i())}),t.appendChild(n),t.appendChild(o),requestAnimationFrame(()=>n.focus())}}};export{p as n,u as r,d as t};
2
- //# sourceMappingURL=LinkPlugin-pWzPs-dS.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LinkPlugin-pWzPs-dS.mjs","names":[],"sources":["../../src/plugins/link/LinkLocale.ts","../../src/plugins/link/LinkPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the LinkPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface LinkLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly removeLink: string;\n\treadonly removeLinkAria: string;\n\treadonly urlPlaceholder: string;\n\treadonly urlAria: string;\n\treadonly apply: string;\n\treadonly applyAria: string;\n}\n\n// --- Default English Locale ---\n\nexport const LINK_LOCALE_EN: LinkLocale = {\n\tlabel: 'Link',\n\ttooltip: (shortcut: string) => `Insert Link (${shortcut})`,\n\tremoveLink: 'Remove Link',\n\tremoveLinkAria: 'Remove link',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Link URL',\n\tapply: 'Apply',\n\tapplyAria: 'Apply link',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: Record<string, () => Promise<{ default: LinkLocale }>> = import.meta.glob<{\n\tdefault: LinkLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadLinkLocale(lang: string): Promise<LinkLocale> {\n\tif (lang === 'en') return LINK_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return LINK_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn LINK_LOCALE_EN;\n\t}\n}\n","/**\n * LinkPlugin: registers a link mark type with href attribute,\n * toggle command, keyboard shortcut (Mod-K), and toolbar button\n * with a URL input popup.\n */\n\nimport {\n\tapplyAttributedMark,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { hasMark } from '../../model/Document.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport { 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 { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { LINK_LOCALE_EN, type LinkLocale, loadLinkLocale } from './LinkLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tlink: { href: string };\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\treadonly locale?: LinkLocale;\n}\n\nconst DEFAULT_CONFIG: LinkConfig = {\n\topenInNewTab: true,\n};\n\n// --- Plugin ---\n\nexport class LinkPlugin implements Plugin {\n\treadonly id = 'link';\n\treadonly name = 'Link';\n\treadonly priority = 25;\n\n\tprivate readonly config: LinkConfig;\n\tprivate locale!: LinkLocale;\n\n\tconstructor(config?: Partial<LinkConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LINK_LOCALE_EN, loadLinkLocale);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t}\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\tattrs: {\n\t\t\t\thref: { 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 = mark.attrs?.href ?? '';\n\t\t\t\ta.setAttribute('href', href);\n\t\t\t\tif (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 href: string = escapeHTML(String(mark.attrs?.href ?? ''));\n\t\t\t\tif (openInNewTab) {\n\t\t\t\t\treturn `<a href=\"${href}\" target=\"_blank\" rel=\"noopener noreferrer\">${content}</a>`;\n\t\t\t\t}\n\t\t\t\treturn `<a href=\"${href}\">${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\tconst href: string = el.getAttribute('href') ?? '';\n\t\t\t\t\t\treturn { href };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['a'], attrs: ['href', 'target', 'rel'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.toggleLink(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setLink', () => {\n\t\t\t// setLink is called by the popup after URL input\n\t\t\t// The actual URL is set via the popup's custom render\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('removeLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.removeLink(context, state);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-K': () => context.executeCommand('toggleLink'),\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'link',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-K')),\n\t\t\tcommand: 'toggleLink',\n\t\t\tpopupType: 'custom',\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\tthis.renderLinkPopup(container, ctx, onClose);\n\t\t\t},\n\t\t\tisActive: (state) => this.isLinkActive(state),\n\t\t\tisEnabled: (state) => !isCollapsed(state.selection),\n\t\t});\n\t}\n\n\tprivate isLinkActive(state: EditorState): boolean {\n\t\treturn isAttributedMarkActive(state, 'link');\n\t}\n\n\tprivate toggleLink(context: PluginContext, state: EditorState): boolean {\n\t\tif (this.isLinkActive(state)) {\n\t\t\treturn this.removeLink(context, state);\n\t\t}\n\t\t// Adding links requires the toolbar popup for URL input\n\t\treturn false;\n\t}\n\n\tprivate addLink(context: PluginContext, state: EditorState, href: string): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\t\tif (isCollapsed(sel)) return false;\n\n\t\tconst mark = { type: markType('link'), attrs: { href } };\n\t\tconst tr = applyAttributedMark(state, mark);\n\t\tif (!tr) return false;\n\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate removeLink(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\t// Remove link from entire link span around cursor (plugin-specific extent scan)\n\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block) return false;\n\n\t\t\tconst textChildren: { pos: number; end: number; hasLink: boolean }[] = [];\n\t\t\tlet pos = 0;\n\t\t\tfor (const child of block.children) {\n\t\t\t\tif (!('text' in child)) continue;\n\t\t\t\tconst end = pos + child.text.length;\n\t\t\t\ttextChildren.push({ pos, end, hasLink: hasMark(child.marks, markType('link')) });\n\t\t\t\tpos = end;\n\t\t\t}\n\n\t\t\tconst cursorIdx = textChildren.findIndex(\n\t\t\t\t(c) => sel.anchor.offset >= c.pos && sel.anchor.offset <= c.end,\n\t\t\t);\n\t\t\tconst cursorEntry = cursorIdx >= 0 ? textChildren[cursorIdx] : undefined;\n\t\t\tif (cursorIdx === -1 || !cursorEntry?.hasLink) return false;\n\n\t\t\tlet startIdx = cursorIdx;\n\t\t\twhile (startIdx > 0 && textChildren[startIdx - 1]?.hasLink) {\n\t\t\t\tstartIdx--;\n\t\t\t}\n\n\t\t\tlet endIdx = cursorIdx;\n\t\t\twhile (endIdx < textChildren.length - 1 && textChildren[endIdx + 1]?.hasLink) {\n\t\t\t\tendIdx++;\n\t\t\t}\n\n\t\t\tconst startEntry = textChildren[startIdx];\n\t\t\tconst endEntry = textChildren[endIdx];\n\t\t\tif (!startEntry || !endEntry) return false;\n\n\t\t\tconst linkStart = startEntry.pos;\n\t\t\tconst linkEnd = endEntry.end;\n\n\t\t\tconst builder = state.transaction('command');\n\t\t\tbuilder.removeMark(sel.anchor.blockId, linkStart, linkEnd, { type: markType('link') });\n\t\t\tbuilder.setSelection(sel);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\t// Range selection: delegate to shared helper\n\t\tconst tr = removeAttributedMark(state, markType('link'));\n\t\tif (!tr) return false;\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate renderLinkPopup(\n\t\tcontainer: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tonClose: () => void,\n\t): void {\n\t\tcontainer.classList.add('notectl-link-popup');\n\n\t\tconst state = context.getState();\n\t\tconst isActive = this.isLinkActive(state);\n\n\t\tif (isActive) {\n\t\t\t// Show remove link button\n\t\t\tconst removeBtn = document.createElement('button');\n\t\t\tremoveBtn.type = 'button';\n\t\t\tremoveBtn.className = 'notectl-link-popup__button';\n\t\t\tremoveBtn.textContent = this.locale.removeLink;\n\t\t\tremoveBtn.setAttribute('aria-label', this.locale.removeLinkAria);\n\t\t\tremoveBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tcontext.executeCommand('removeLink');\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t});\n\t\t\tcontainer.appendChild(removeBtn);\n\t\t} else {\n\t\t\t// Show URL input\n\t\t\tconst input = document.createElement('input');\n\t\t\tinput.type = 'url';\n\t\t\tinput.className = 'notectl-link-popup__input';\n\t\t\tinput.placeholder = this.locale.urlPlaceholder;\n\t\t\tinput.setAttribute('aria-label', this.locale.urlAria);\n\n\t\t\tconst applyBtn = document.createElement('button');\n\t\t\tapplyBtn.type = 'button';\n\t\t\tapplyBtn.className = 'notectl-link-popup__button notectl-link-popup__button--apply';\n\t\t\tapplyBtn.textContent = this.locale.apply;\n\t\t\tapplyBtn.setAttribute('aria-label', this.locale.applyAria);\n\n\t\t\tconst applyLink = (): void => {\n\t\t\t\tconst href = input.value.trim();\n\t\t\t\tif (href) {\n\t\t\t\t\tthis.addLink(context, context.getState(), href);\n\t\t\t\t\tonClose();\n\t\t\t\t\tcontext.getContainer().focus();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tapplyBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tapplyLink();\n\t\t\t});\n\n\t\t\tinput.addEventListener('keydown', (e) => {\n\t\t\t\tif (e.key === 'Enter') {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tapplyLink();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tcontainer.appendChild(input);\n\t\t\tcontainer.appendChild(applyBtn);\n\n\t\t\t// Auto-focus input\n\t\t\trequestAnimationFrame(() => input.focus());\n\t\t}\n\t}\n}\n"],"mappings":"qWAmBA,IAAa,EAA6B,CACzC,MAAO,OACP,QAAU,GAAqB,gBAAgB,KAC/C,WAAY,cACZ,eAAgB,cAChB,eAAgB,cAChB,QAAS,WACT,MAAO,QACP,UAAW,cAKN,iBAAwE,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAI9E,eAAsB,EAAe,GACpC,GAAa,OAAT,EAAe,OAAO,EAC1B,MAAM,EAAS,EAAc,aAAa,QAC1C,IAAK,EAAQ,OAAO,EACpB,IAEC,aADkB,KACP,cAEX,OAAO,GCPT,IAAM,EAA6B,CAClC,cAAc,GAKF,EAAb,MACC,GAAc,OACd,KAAgB,OAChB,SAAoB,GAEpB,OACA,OAEA,WAAA,CAAY,GACX,KAAK,OAAS,IAAK,KAAmB,GAGvC,UAAM,CAAK,GACV,KAAK,aAAe,EAAc,EAAS,KAAK,OAAO,OAAQ,EAAgB,GAC/E,KAAK,iBAAiB,GACtB,KAAK,iBAAiB,GACtB,KAAK,eAAe,GACpB,KAAK,oBAAoB,GAG1B,gBAAA,CAAyB,GACxB,MAAM,EAAe,KAAK,OAAO,aAEjC,EAAQ,iBAAiB,CACxB,KAAM,OACN,KAAM,GACN,MAAO,CACN,KA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EA,EAAU,UAAU,IAAI,sBAExB,MAAM,EAAQ,EAAQ,WAGtB,GAFiB,KAAK,aAAa,GAErB,CAEb,MAAM,EAAY,SAAS,cAAc,UACzC,EAAU,KAAO,SACjB,EAAU,UAAY,6BACtB,EAAU,YAAc,KAAK,OAAO,WACpC,EAAU,aAAa,aAAc,KAAK,OAAO,gBACjD,EAAU,iBAAiB,YAAc,IACxC,EAAE,iBACF,EAAE,kBACF,EAAQ,eAAe,cACvB,IACA,EAAQ,eAAe,UAExB,EAAU,YAAY,OAChB,CAEN,MAAM,EAAQ,SAAS,cAAc,SACrC,EAAM,KAAO,MACb,EAAM,UAAY,4BAClB,EAAM,YAAc,KAAK,OAAO,eAChC,EAAM,aAAa,aAAc,KAAK,OAAO,SAE7C,MAAM,EAAW,SAAS,cAAc,UACxC,EAAS,KAAO,SAChB,EAAS,UAAY,+DACrB,EAAS,YAAc,KAAK,OAAO,MACnC,EAAS,aAAa,aAAc,KAAK,OAAO,WAEhD,MAAM,EAAA,KACL,MAAM,EAAO,EAAM,MAAM,OACrB,IACH,KAAK,QAAQ,EAAS,EAAQ,WAAY,GAC1C,IACA,EAAQ,eAAe,UAIzB,EAAS,iBAAiB,YAAc,IACvC,EAAE,iBACF,EAAE,kBACF,MAGD,EAAM,iBAAiB,UAAY,IACpB,UAAV,EAAE,MACL,EAAE,iBACF,OAIF,EAAU,YAAY,GACtB,EAAU,YAAY,GAGtB,sBAAA,IAA4B,EAAM"}
@@ -1,2 +0,0 @@
1
- import{c as t,m as e}from"./Document-_qdGR4vh.mjs";import{d as n,o as i,t as s,u as c}from"./Selection-aeiSsvhe.mjs";import{a as o,t as r}from"./TypeBrands-BZDKMjR-.mjs";import{r as l}from"./AttrRegistry-nDKtHK87.mjs";import{n as a}from"./DomUtils-RKbAVBQz.mjs";import{t as d}from"./RangeIterator-CVUeIB4P.mjs";import{s as u}from"./StyleRuntime-D3d1XFFe.mjs";import{i as p}from"./PluginHelpers-Db50-BRE.mjs";function m(t,e,n){return"checklist"===t?{listType:t,indent:e,checked:n??!1}:{listType:t,indent:e}}function h(t,e){const i=t.getState(),s=i.selection;return!!c(s)&&(s.anchor.blockId!==s.head.blockId?function(t,e,i){const s=e.selection;if(!c(s))return!1;const r=n(s,e.getBlockOrder()),a=g(e,r,i),u=e.transaction("command");return d(e,r,t=>{const n=e.getBlock(t);if(n)if(a)u.setBlockType(t,o("paragraph"));else{const e=l(n,"list_item")?n.attrs.indent:0,s=l(n,"list_item")&&"checklist"===n.attrs.listType&&n.attrs.checked;u.setBlockType(t,o("list_item"),m(i,e,s))}}),u.setSelection(s),t.dispatch(u.build()),!0}(t,i,e):function(t,e,n){const i=e.selection;if(!c(i))return!1;const s=e.getBlock(i.anchor.blockId);if(!s)return!1;if("list_item"===s.type&&s.attrs?.listType===n){const n=e.transaction("command").setBlockType(i.anchor.blockId,o("paragraph")).setSelection(i).build();return t.dispatch(n),!0}const r=m(n,l(s,"list_item")?s.attrs.indent:0),a=e.transaction("command").setBlockType(i.anchor.blockId,o("list_item"),r).setSelection(i).build();return t.dispatch(a),!0}(t,i,e))}function k(t,e,i){const s=t.getState();if(!c(s.selection))return!1;if(s.selection.anchor.blockId!==s.selection.head.blockId)return function(t,e,i,s){const r=e.selection;if(!c(r))return!1;const a=n(r,e.getBlockOrder()),u=e.transaction("command");let p=!1;return d(e,a,t=>{const n=e.getBlock(t);if(!n||!l(n,"list_item"))return;const c=n.attrs.indent+i;c<0||c>s||(u.setBlockType(t,o("list_item"),m(n.attrs.listType,c,n.attrs.checked)),p=!0)}),!!p&&(u.setSelection(r),t.dispatch(u.build()),!0)}(t,s,e,i);const r=s.selection,a=s.getBlock(r.anchor.blockId);if(!a||!l(a,"list_item"))return!1;const u=a.attrs.indent+e;if(u<0||u>i)return!1;const p=m(a.attrs.listType,u,a.attrs.checked),h=s.transaction("command").setBlockType(r.anchor.blockId,o("list_item"),p).setSelection(r).build();return t.dispatch(h),!0}function f(t,e,n){if(t.isReadOnly()&&!e)return!1;const i=t.getState(),s=n??(c(i.selection)?i.selection.anchor.blockId:null);if(!s)return!1;const r=i.getBlock(s);if(!r||!l(r,"list_item")||"checklist"!==r.attrs.listType)return!1;const a=m(r.attrs.listType,r.attrs.indent,!r.attrs.checked),d=i.transaction("command").setBlockType(s,o("list_item"),a).setSelection(i.selection).build();return t.dispatch(d),!0}function g(t,e,n){let i=!0;return d(t,e,e=>{const s=t.getBlock(e);s&&"list_item"===s.type&&s.attrs?.listType===n||(i=!1)}),i}var b=[{type:"bullet",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',inputPattern:/^[-*] $/,inputPrefix:"- "},{type:"ordered",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',inputPattern:/^\d+\. $/,inputPrefix:"1. "},{type:"checklist",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>',inputPattern:/^\[[ x]] $/,inputPrefix:"[ ] "}];function y(t,e){const n=t.getState();if(!c(n.selection))return!1;const s=n.selection;if(!i(s))return!1;const o=n.getBlock(s.anchor.blockId);return!(!o||"list_item"!==o.type)&&e({state:n,block:o,blockId:s.anchor.blockId,offset:s.anchor.offset})}var v={bulletList:"Bullet List",numberedList:"Numbered List",checklist:"Checklist"},x=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-DH06YQkP.mjs"),"./locales/de.ts":()=>import("./de-p1zboXJW.mjs"),"./locales/es.ts":()=>import("./es-BBaS8xrI.mjs"),"./locales/fr.ts":()=>import("./fr-Ame1k629.mjs"),"./locales/hi.ts":()=>import("./hi-BEBdteKo.mjs"),"./locales/pt.ts":()=>import("./pt-D7n_VUMD.mjs"),"./locales/ru.ts":()=>import("./ru-333jycve.mjs"),"./locales/zh.ts":()=>import("./zh-CP6_YzAc.mjs")});async function T(t){if("en"===t)return v;const e=x[`./locales/${t}.ts`];if(!e)return v;try{return(await e()).default}catch{return v}}function I(t,e){return{bullet:e.bulletList,ordered:e.numberedList,checklist:e.checklist}[t]}function B(t,e){if(!c(t.selection))return!1;if(t.selection.anchor.blockId!==t.selection.head.blockId)return g(t,n(t.selection,t.getBlockOrder()),e);const i=t.getBlock(t.selection.anchor.blockId);return"list_item"===i?.type&&i.attrs?.listType===e}var S={types:["bullet","ordered","checklist"],maxIndent:4},L=class{id="list";name="List";priority=35;config;locale;context=null;checkboxClickHandler=null;constructor(t){this.config={...S,...t}}async init(n){this.context=n,this.locale=await p(n,this.config.locale,v,T);const r=this.getEnabledTypes();n.registerStyleSheet("\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist */\n.notectl-list-item--checklist::before {\n\tcontent: '\\2610';\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\tpointer-events: auto;\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"]::before {\n\tcontent: '\\2611';\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n"),this.registerNodeSpec(n),function(t,e,n){for(const i of n)t.registerCommand(`toggleList:${i.type}`,()=>h(t,i.type));t.registerCommand("indentListItem",()=>k(t,1,e.maxIndent)),t.registerCommand("outdentListItem",()=>k(t,-1,e.maxIndent)),e.types.includes("checklist")&&t.registerCommand("toggleChecklistItem",()=>f(t,e.interactiveCheckboxes),{readonlyAllowed:!0}),t.registerKeymap({Tab:()=>k(t,1,e.maxIndent),"Shift-Tab":()=>k(t,-1,e.maxIndent)})}(n,this.config,r),function(n){n.registerKeymap({Enter:()=>function(n){return y(n,i=>{if(""===e(i.block)){const t=i.state.transaction("input").setBlockType(i.blockId,o("paragraph")).setSelection(i.state.selection).build();return n.dispatch(t),!0}const c=t(),r=m(l(i.block,"list_item")?i.block.attrs.listType:"bullet",l(i.block,"list_item")?i.block.attrs.indent:0),a=i.state.transaction("input").splitBlock(i.blockId,i.offset,c).setBlockType(c,o("list_item"),r).setSelection(s(c,0)).build();return n.dispatch(a),!0})}(n),Backspace:()=>function(t){return y(t,e=>{if(0!==e.offset)return!1;const n=e.state.transaction("input").setBlockType(e.blockId,o("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0})}(n)})}(n),function(t,e){for(const n of e)t.registerInputRule({pattern:n.inputPattern,handler:(t,e,r,l)=>{const a=t.selection;if(!c(a))return null;if(!i(a))return null;const d=t.getBlock(a.anchor.blockId);if(!d||"paragraph"!==d.type)return null;const u=e[0]??"",p=u.length,h=m(n.type,0,u.includes("[x]"));return t.transaction("input").deleteTextAt(a.anchor.blockId,r,r+p).setBlockType(a.anchor.blockId,o("list_item"),h).setSelection(s(a.anchor.blockId,0)).build()}})}(n,r),function(t,e,n){for(const i of e)t.registerToolbarItem({id:`list-${i.type}`,group:"block",icon:i.icon,label:I(i.type,n),command:`toggleList:${i.type}`,isActive:t=>B(t,i.type)})}(n,r,this.locale),this.registerCheckboxClickHandler(n)}destroy(){this.checkboxClickHandler&&this.context&&this.context.getContainer().removeEventListener("mousedown",this.checkboxClickHandler),this.checkboxClickHandler=null,this.context=null}registerNodeSpec(t){t.registerNodeSpec({type:"list_item",group:"block",content:{allow:["text"]},attrs:{listType:{default:"bullet"},indent:{default:0},checked:{default:!1}},toDOM(t){const e=t.attrs?.listType??"bullet",n=t.attrs?.indent??0,i=t.attrs?.checked??!1,s=a("li",t.id);return s.setAttribute("role","listitem"),s.setAttribute("data-list-type",e),s.setAttribute("data-indent",String(n)),s.className=`notectl-list-item notectl-list-item--${e}`,n>0&&u(s,"marginLeft",24*n+"px"),"checklist"===e&&(s.setAttribute("data-checked",String(i)),s.setAttribute("aria-checked",String(i))),s.setAttribute("aria-level",String(n+1)),s},wrapper(t){const e=t.attrs?.listType??"bullet";return{tag:"ordered"===e?"ol":"ul",key:`list-${e}`,className:`notectl-list notectl-list--${e}`,attrs:{role:"list"}}},toHTML(t,e){const n=t.attrs?.listType??"bullet",i=t.attrs?.checked??!1;return"checklist"===n?`<li role="checkbox" aria-checked="${String(i)}"><input type="checkbox" disabled${i?" checked":""}>${e||"<br>"}</li>`:`<li>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}})}registerCheckboxClickHandler(t){this.config.types.includes("checklist")&&(this.checkboxClickHandler=e=>{if(t.isReadOnly()&&!this.config.interactiveCheckboxes)return;const n=e.target;if(!(n instanceof HTMLElement))return;const i=n.closest(".notectl-list-item--checklist");if(!i)return;const s=i.getBoundingClientRect();if(("rtl"===getComputedStyle(i).direction?s.right-e.clientX:e.clientX-s.left)>=24)return;e.preventDefault();const c=i.getAttribute("data-block-id");c&&f(t,this.config.interactiveCheckboxes,r(c))},t.getContainer().addEventListener("mousedown",this.checkboxClickHandler))}getEnabledTypes(){return b.filter(t=>this.config.types.includes(t.type))}};export{v as n,T as r,L as t};
2
- //# sourceMappingURL=ListPlugin-Datp4nPR.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as n,c as t,d as e,y as o}from"./Document-_qdGR4vh.mjs";import{c as i,l as r,n as s,o as c,r as l,t as u}from"./Selection-aeiSsvhe.mjs";import{n as d}from"./NodeResolver-DVPpO5nC.mjs";import{i as a}from"./NavigationQueries-_xQtPALX.mjs";import{a as f,n as m,o as b,t as p}from"./CommandHelpers-BoRO1KfE.mjs";function I(e,i){const r=d(e.doc,i.nodeId);if(!r)return null;const s=m(r),c=b(e,s),l=f(c,i.nodeId);if(l<0)return null;const a=e.transaction("input");if(1===c.length){const e=t();return a.insertNode(s,0,n(e)),a.removeNode(s,1),a.setSelection(u(e,0)),a.build()}a.removeNode(s,l);const I=c[l-1];if(I&&o(I)){const n=p(e,I.id,"end");if(n)return a.setSelection(n),a.build()}const S=c[l+1];if(S&&o(S)){const n=p(e,S.id,"start");if(n)return a.setSelection(n),a.build()}return a.build()}function S(e,o){const i=d(e.doc,o.nodeId);if(!i)return null;const r=m(i),s=f(b(e,r),o.nodeId);if(s<0)return null;const c=t(),l=e.transaction("input");return l.insertNode(r,s+1,n(c)),l.setSelection(u(c,0)),l.build()}function g(e,o,i,r){const s=m(d(e.doc,o.nodeId)),c=b(e,s),l=f(c,o.nodeId),a=t(),p=e.transaction(r),I=l>=0?l+1:c.length;return p.insertNode(s,I,n(a)),p.insertText(a,0,i,[]),p.setSelection(u(a,i.length)),p.build()}function h(n,t,o){const f=n.selection,m=n.getBlockOrder(),b=!o||"left"!==t&&"right"!==t?t:"left"===t?"right":"left";return r(f)?function(n,t,o,i){const r=i.indexOf(t.nodeId),c=d(n.doc,t.nodeId)??[];if("left"===o||"up"===o){if(r>0){const o=i[r-1];if(!o)return null;if(a(n,o))return n.transaction("input").setSelection(s(t.nodeId,"before",c)).build();const l=n.getBlock(o),d=l?e(l):0;return n.transaction("input").setSelection(u(o,d)).build()}return n.transaction("input").setSelection(s(t.nodeId,"before",c)).build()}if(r<i.length-1){const e=i[r+1];return e?a(n,e)?n.transaction("input").setSelection(s(t.nodeId,"after",c)).build():n.transaction("input").setSelection(u(e,0)).build():null}return n.transaction("input").setSelection(s(t.nodeId,"after",c)).build()}(n,f,b,m):i(f)?null:c(f)?function(n,t,o,i){const r=i.indexOf(t.anchor.blockId),s=n.getBlock(t.anchor.blockId);if(!s)return null;const c=e(s);if(("right"===o||"down"===o)&&t.anchor.offset===c&&r<i.length-1){const t=i[r+1];if(t&&a(n,t)){const e=d(n.doc,t)??[];return n.transaction("input").setSelection(l(t,e)).build()}}if(("left"===o||"up"===o)&&0===t.anchor.offset&&r>0){const t=i[r-1];if(t&&a(n,t)){const e=d(n.doc,t)??[];return n.transaction("input").setSelection(l(t,e)).build()}}return null}(n,f,b,m):null}export{h as i,S as n,g as r,I as t};
2
- //# sourceMappingURL=NodeSelectionCommands-BFHLrE5I.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeSelectionCommands-BFHLrE5I.mjs","names":[],"sources":["../../src/commands/NodeSelectionCommands.ts"],"sourcesContent":["/**\n * Commands for NodeSelection: deleting void blocks, inserting paragraphs\n * after void blocks, and navigating arrow keys into/out of void blocks.\n */\n\nimport {\n\tcreateEmptyParagraph,\n\tgenerateBlockId,\n\tgetBlockLength,\n\tisBlockNode,\n} from '../model/Document.js';\nimport { findNodePath } from '../model/NodeResolver.js';\nimport type { NodeSelection } from '../model/Selection.js';\nimport {\n\tcreateCollapsedSelection,\n\tcreateGapCursor,\n\tcreateNodeSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../model/Selection.js';\nimport type { BlockId } from '../model/TypeBrands.js';\nimport type { EditorState } from '../state/EditorState.js';\nimport { isVoidBlock } from '../state/NavigationQueries.js';\nimport type { Transaction } from '../state/Transaction.js';\nimport {\n\tcreateSelectionForBlockBoundary,\n\textractParentPath,\n\tfindSiblingIndex,\n\tgetSiblings,\n} from './CommandHelpers.js';\n\nexport { findFirstLeafBlockId, findLastLeafBlockId } from './CommandHelpers.js';\n\n/**\n * Deletes the selected block and places cursor on a valid adjacent position.\n * If it is the only child in its parent, replaces it with an empty paragraph.\n */\nexport function deleteNodeSelection(state: EditorState, sel: NodeSelection): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = findSiblingIndex(siblings, sel.nodeId);\n\tif (index < 0) return null;\n\n\tconst builder = state.transaction('input');\n\n\t// Keep container invariants intact when removing the only child in any parent.\n\tif (siblings.length === 1) {\n\t\tconst newId = generateBlockId();\n\t\tbuilder.insertNode(parentPath, 0, createEmptyParagraph(newId));\n\t\tbuilder.removeNode(parentPath, 1);\n\t\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\t\treturn builder.build();\n\t}\n\n\tbuilder.removeNode(parentPath, index);\n\n\t// Prefer the previous sibling, matching Backspace/Delete semantics.\n\tconst prevSibling = siblings[index - 1];\n\tif (prevSibling && isBlockNode(prevSibling)) {\n\t\tconst selection = createSelectionForBlockBoundary(state, prevSibling.id, 'end');\n\t\tif (selection) {\n\t\t\tbuilder.setSelection(selection);\n\t\t\treturn builder.build();\n\t\t}\n\t}\n\n\tconst nextSibling = siblings[index + 1];\n\tif (nextSibling && isBlockNode(nextSibling)) {\n\t\tconst selection = createSelectionForBlockBoundary(state, nextSibling.id, 'start');\n\t\tif (selection) {\n\t\t\tbuilder.setSelection(selection);\n\t\t\treturn builder.build();\n\t\t}\n\t}\n\n\treturn builder.build();\n}\n\n/** Inserts a new paragraph after a NodeSelection-targeted void block. */\nexport function insertParagraphAfterNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n): Transaction | null {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tif (!path) return null;\n\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = findSiblingIndex(siblings, sel.nodeId);\n\tif (index < 0) return null;\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction('input');\n\tbuilder.insertNode(parentPath, index + 1, createEmptyParagraph(newId));\n\tbuilder.setSelection(createCollapsedSelection(newId, 0));\n\treturn builder.build();\n}\n\n/** Inserts text in a new paragraph after a NodeSelection-targeted void block. */\nexport function insertTextAfterNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n\ttext: string,\n\torigin: 'input' | 'paste',\n): Transaction {\n\tconst path = findNodePath(state.doc, sel.nodeId);\n\tconst parentPath: BlockId[] = extractParentPath(path);\n\tconst siblings = getSiblings(state, parentPath);\n\n\tconst index: number = findSiblingIndex(siblings, sel.nodeId);\n\n\tconst newId = generateBlockId();\n\tconst builder = state.transaction(origin);\n\n\tconst insertIdx = index >= 0 ? index + 1 : siblings.length;\n\tbuilder.insertNode(parentPath, insertIdx, createEmptyParagraph(newId));\n\tbuilder.insertText(newId, 0, text, []);\n\tbuilder.setSelection(createCollapsedSelection(newId, text.length));\n\treturn builder.build();\n}\n\n/**\n * Navigates arrow keys into/out of void blocks.\n * Returns a transaction if navigation should create a NodeSelection, or null.\n *\n * @param isRtl — When true, flips left/right to account for RTL block direction.\n */\nexport function navigateArrowIntoVoid(\n\tstate: EditorState,\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tisRtl?: boolean,\n): Transaction | null {\n\tconst sel = state.selection;\n\tconst blockOrder = state.getBlockOrder();\n\tconst effectiveDir: 'left' | 'right' | 'up' | 'down' =\n\t\tisRtl && (direction === 'left' || direction === 'right')\n\t\t\t? direction === 'left'\n\t\t\t\t? 'right'\n\t\t\t\t: 'left'\n\t\t\t: direction;\n\n\t// If currently on a NodeSelection, navigate away from it\n\tif (isNodeSelection(sel)) {\n\t\treturn navigateAwayFromNodeSelection(state, sel, effectiveDir, blockOrder);\n\t}\n\n\t// GapCursor is handled by navigateFromGapCursor in CaretNavigation\n\tif (isGapCursor(sel)) return null;\n\n\t// Text selection: check if navigating into a void block\n\tif (!isCollapsed(sel)) return null;\n\n\treturn navigateIntoVoid(state, sel, effectiveDir, blockOrder);\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/** Handles navigation away from a NodeSelection (arrow keys while void is selected). */\nfunction navigateAwayFromNodeSelection(\n\tstate: EditorState,\n\tsel: NodeSelection,\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tblockOrder: readonly BlockId[],\n): Transaction | null {\n\tconst nodeIdx = blockOrder.indexOf(sel.nodeId);\n\tconst nodePath = (findNodePath(state.doc, sel.nodeId) ?? []) as BlockId[];\n\n\tif (direction === 'left' || direction === 'up') {\n\t\tif (nodeIdx > 0) {\n\t\t\tconst prevId = blockOrder[nodeIdx - 1];\n\t\t\tif (!prevId) return null;\n\t\t\tif (isVoidBlock(state, prevId)) {\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createGapCursor(sel.nodeId, 'before', nodePath))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t\tconst prevBlock = state.getBlock(prevId);\n\t\t\tconst prevLen = prevBlock ? getBlockLength(prevBlock) : 0;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setSelection(createCollapsedSelection(prevId, prevLen))\n\t\t\t\t.build();\n\t\t}\n\t\treturn state\n\t\t\t.transaction('input')\n\t\t\t.setSelection(createGapCursor(sel.nodeId, 'before', nodePath))\n\t\t\t.build();\n\t}\n\n\t// right or down\n\tif (nodeIdx < blockOrder.length - 1) {\n\t\tconst nextId = blockOrder[nodeIdx + 1];\n\t\tif (!nextId) return null;\n\t\tif (isVoidBlock(state, nextId)) {\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setSelection(createGapCursor(sel.nodeId, 'after', nodePath))\n\t\t\t\t.build();\n\t\t}\n\t\treturn state.transaction('input').setSelection(createCollapsedSelection(nextId, 0)).build();\n\t}\n\treturn state\n\t\t.transaction('input')\n\t\t.setSelection(createGapCursor(sel.nodeId, 'after', nodePath))\n\t\t.build();\n}\n\n/** Handles text selection navigating into an adjacent void block. */\nfunction navigateIntoVoid(\n\tstate: EditorState,\n\tsel: { readonly anchor: { readonly blockId: BlockId; readonly offset: number } },\n\tdirection: 'left' | 'right' | 'up' | 'down',\n\tblockOrder: readonly BlockId[],\n): Transaction | null {\n\tconst blockIdx = blockOrder.indexOf(sel.anchor.blockId);\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\tconst blockLen = getBlockLength(block);\n\n\tif (direction === 'right' || direction === 'down') {\n\t\tif (sel.anchor.offset === blockLen && blockIdx < blockOrder.length - 1) {\n\t\t\tconst nextId = blockOrder[blockIdx + 1];\n\t\t\tif (nextId && isVoidBlock(state, nextId)) {\n\t\t\t\tconst path = findNodePath(state.doc, nextId) ?? [];\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createNodeSelection(nextId, path as BlockId[]))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (direction === 'left' || direction === 'up') {\n\t\tif (sel.anchor.offset === 0 && blockIdx > 0) {\n\t\t\tconst prevId = blockOrder[blockIdx - 1];\n\t\t\tif (prevId && isVoidBlock(state, prevId)) {\n\t\t\t\tconst path = findNodePath(state.doc, prevId) ?? [];\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.setSelection(createNodeSelection(prevId, path as BlockId[]))\n\t\t\t\t\t.build();\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n"],"mappings":"6TAsCA,SAAgB,EAAoB,EAAoB,GACvD,MAAM,EAAO,EAAa,EAAM,IAAK,EAAI,QACzC,IAAK,EAAM,OAAO,KAElB,MAAM,EAAwB,EAAkB,GAC1C,EAAW,EAAY,EAAO,GAE9B,EAAgB,EAAiB,EAAU,EAAI,QACrD,GAAI,EAAQ,EAAG,OAAO,KAEtB,MAAM,EAAU,EAAM,YAAY,SAGlC,GAAwB,IAApB,EAAS,OAAc,CAC1B,MAAM,EAAQ,IAId,OAHA,EAAQ,WAAW,EAAY,EAAG,EAAqB,IACvD,EAAQ,WAAW,EAAY,GAC/B,EAAQ,aAAa,EAAyB,EAAO,IAC9C,EAAQ,QAGhB,EAAQ,WAAW,EAAY,GAG/B,MAAM,EAAc,EAAS,EAAQ,GACrC,GAAI,GAAe,EAAY,GAAc,CAC5C,MAAM,EAAY,EAAgC,EAAO,EAAY,GAAI,OACzE,GAAI,EAEH,OADA,EAAQ,aAAa,GACd,EAAQ,QAIjB,MAAM,EAAc,EAAS,EAAQ,GACrC,GAAI,GAAe,EAAY,GAAc,CAC5C,MAAM,EAAY,EAAgC,EAAO,EAAY,GAAI,SACzE,GAAI,EAEH,OADA,EAAQ,aAAa,GACd,EAAQ,QAIjB,OAAO,EAAQ,QAIhB,SAAgB,EACf,EACA,GAEA,MAAM,EAAO,EAAa,EAAM,IAAK,EAAI,QACzC,IAAK,EAAM,OAAO,KAElB,MAAM,EAAwB,EAAkB,GAG1C,EAAg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IH,GAAI,EAAU,EAAW,OAAS,EAAG,CACpC,MAAM,EAAS,EAAW,EAAU,GACpC,OAAK,EACD,EAAY,EAAO,GACf,EACL,YAAY,SACZ,aAAa,EAAgB,EAAI,OAAQ,QAAS,IAClD,QAEI,EAAM,YAAY,SAAS,aAAa,EAAyB,EAAQ,IAAI,QAPhE,KASrB,OAAO,EACL,YAAY,SACZ,aAAa,EAAgB,EAAI,OAAQ,QAAS,IAClD,QAhEM,CAA8B,EAAO,EAAK,EAAc,GAI5D,EAAY,GAAa,KAGxB,EAAY,GA6DlB,SACC,EACA,EACA,EACA,GAEA,MAAM,EAAW,EAAW,QAAQ,EAAI,OAAO,SACzC,EAAQ,EAAM,SAAS,EAAI,OAAO,SACxC,IAAK,EAAO,OAAO,KACnB,MAAM,EAAW,EAAe,GAEhC,IAAkB,UAAd,GAAuC,SAAd,IACxB,EAAI,OAAO,SAAW,GAAY,EAAW,EAAW,OAAS,EAAG,CACvE,MAAM,EAAS,EAAW,EAAW,GACrC,GAAI,GAAU,EAAY,EAAO,GAAS,CACzC,MAAM,EAAO,EAAa,EAAM,IAAK,IAAW,GAChD,OAAO,EACL,YAAY,SACZ,aAAa,EAAoB,EAAQ,IACzC,SAKL,IAAkB,SAAd,GAAsC,OAAd,IACD,IAAtB,EAAI,OAAO,QAAgB,EAAW,EAAG,CAC5C,MAAM,EAAS,EAAW,EAAW,GACrC,GAAI,GAAU,EAAY,EAAO,GAAS,CACzC,MAAM,EAAO,EAAa,EAAM,IAAK,IAAW,GAChD,OAAO,EACL,YAAY,SACZ,aAAa,EAAoB,EAAQ,IACzC,SAKL,OAAO,KAhGA,CAAiB,EAAO,EAAK,EAAc,GAFpB"}
@@ -1,2 +0,0 @@
1
- import{l as e,u as o}from"./Selection-aeiSsvhe.mjs";import{n}from"./Plugin-BUNGKupW.mjs";var t=class{resolvedLocale;constructor(e){this.resolvedLocale="browser"===e?"undefined"!=typeof navigator?navigator.language.split("-")[0]??"en":"en":e}getLocale(){return this.resolvedLocale}},r=new n("locale");function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function a(e){return`toggle${s(e)}`}async function c(e,o,n,t){if(o)return o;const s=e.getService(r)?.getLocale()??"en";return"en"===s?n:t(s)}function l(n){const t=n.selection;return e(t)?n.getBlock(t.nodeId):o(t)?n.getBlock(t.anchor.blockId):void 0}function i(n){const t=n.selection;return e(t)?t.nodeId:o(t)?t.anchor.blockId:void 0}export{a,c as i,l as n,t as o,i as r,r as s,s as t};
2
- //# sourceMappingURL=PluginHelpers-Db50-BRE.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginHelpers-Db50-BRE.mjs","names":[],"sources":["../../src/i18n/LocaleService.ts","../../src/plugins/shared/PluginHelpers.ts"],"sourcesContent":["/**\n * Global locale service that resolves the active language.\n * Registered as a system-level service before plugin init.\n */\n\nimport { ServiceKey } from '../plugins/Plugin.js';\n\nexport class LocaleService {\n\tprivate readonly resolvedLocale: string;\n\n\tconstructor(locale: string) {\n\t\tthis.resolvedLocale =\n\t\t\tlocale === 'browser'\n\t\t\t\t? typeof navigator !== 'undefined'\n\t\t\t\t\t? (navigator.language.split('-')[0] ?? 'en')\n\t\t\t\t\t: 'en'\n\t\t\t\t: locale;\n\t}\n\n\tgetLocale(): string {\n\t\treturn this.resolvedLocale;\n\t}\n}\n\nexport const LocaleServiceKey = new ServiceKey<LocaleService>('locale');\n","/**\n * Shared helper utilities for plugins.\n * Common operations extracted to avoid code duplication across plugins.\n */\n\nimport { LocaleServiceKey } from '../../i18n/LocaleService.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { isNodeSelection, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\n\n/** Capitalizes the first character of a string. */\nexport function capitalize(s: string): string {\n\treturn s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n/** Converts a mark type to its toggle command name (e.g. 'bold' → 'toggleBold'). */\nexport function toCommandName(markType: string): string {\n\treturn `toggle${capitalize(markType)}`;\n}\n\n/**\n * Resolves the locale for a plugin, using config override, default, or dynamic loader.\n * Plugins provide their config locale, a default English locale, and a loader for other languages.\n */\nexport async function resolveLocale<T>(\n\tcontext: PluginContext,\n\tconfigLocale: T | undefined,\n\tdefaultLocale: T,\n\tloader: (lang: string) => Promise<T>,\n): Promise<T> {\n\tif (configLocale) return configLocale;\n\tconst service = context.getService(LocaleServiceKey);\n\tconst lang: string = service?.getLocale() ?? 'en';\n\treturn lang === 'en' ? defaultLocale : loader(lang);\n}\n\n/** Returns the block under the cursor, handling both TextSelection and NodeSelection. */\nexport function getSelectedBlock(state: EditorState): BlockNode | undefined {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) return state.getBlock(sel.nodeId);\n\tif (isTextSelection(sel)) return state.getBlock(sel.anchor.blockId);\n\treturn undefined;\n}\n\n/** Returns the block ID under the cursor, handling both TextSelection and NodeSelection. */\nexport function getSelectedBlockId(state: EditorState): BlockId | undefined {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) return sel.nodeId;\n\tif (isTextSelection(sel)) return sel.anchor.blockId;\n\treturn undefined;\n}\n"],"mappings":"yFAOA,IAAa,EAAb,MACC,eAEA,WAAA,CAAY,GACX,KAAK,eACO,YAAX,EACwB,oBAAd,UACL,UAAU,SAAS,MAAM,KAAK,IAAM,KACrC,KACD,EAGL,SAAA,GACC,OAAO,KAAK,iBAID,EAAmB,IAAI,EAA0B,UCX9D,SAAgB,EAAW,GAC1B,OAAO,EAAE,OAAO,GAAG,cAAgB,EAAE,MAAM,GAI5C,SAAgB,EAAc,GAC7B,MAAO,SAAS,EAAW,KAO5B,eAAsB,EACrB,EACA,EACA,EACA,GAEA,GAAI,EAAc,OAAO,EAEzB,MAAM,EADU,EAAQ,WAAW,IACL,aAAe,KAC7C,MAAgB,OAAT,EAAgB,EAAgB,EAAO,GAI/C,SAAgB,EAAiB,GAChC,MAAM,EAAM,EAAM,UAClB,OAAI,EAAgB,GAAa,EAAM,SAAS,EAAI,QAChD,EAAgB,GAAa,EAAM,SAAS,EAAI,OAAO,cAA3D,EAKD,SAAgB,EAAmB,GAClC,MAAM,EAAM,EAAM,UAClB,OAAI,EAAgB,GAAa,EAAI,OACjC,EAAgB,GAAa,EAAI,OAAO,aAA5C"}
@@ -1,2 +0,0 @@
1
- import{c as t,o as e}from"./StyleRuntime-D3d1XFFe.mjs";import{a as o,c as n,f as r,i,m as s,n as c,r as a,t as l}from"./PrintTypes-DTV3-mSe.mjs";import{i as p}from"./PluginHelpers-Db50-BRE.mjs";import{t as u}from"./ShortcutFormatting-DE6B8iGs.mjs";import m from"dompurify";var h={label:"Print",tooltip:t=>`Print (${t})`,printingAnnouncement:"Printing"},f=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-7XO2HmsM.mjs"),"./locales/de.ts":()=>import("./de-DPzOP2Ge.mjs"),"./locales/es.ts":()=>import("./es-Bq_XkuDG.mjs"),"./locales/fr.ts":()=>import("./fr-CXzpB6GU.mjs"),"./locales/hi.ts":()=>import("./hi-xjChf5ZY.mjs"),"./locales/pt.ts":()=>import("./pt-B9c20zi-.mjs"),"./locales/ru.ts":()=>import("./ru-qL1ebv4O.mjs"),"./locales/zh.ts":()=>import("./zh-CT4V3EmW.mjs")});async function d(t){if("en"===t)return h;const e=f[`./locales/${t}.ts`];if(!e)return h;try{return(await e()).default}catch{return h}}var g=["h1","h2","h3","h4","h5","h6","p","div","span","br","hr","strong","b","em","i","u","s","sub","sup","small","ul","ol","li","table","thead","tbody","tr","th","td","img"],v=["style","class","src","alt","width","height","colspan","rowspan"];function y(t){const e="function"==typeof t?t():t;return m.sanitize(e,{ALLOWED_TAGS:[...g],ALLOWED_ATTR:[...v]})}var b={print(){},toHTML:()=>""},j=class{id="print";name="Print";config;service=null;locale;constructor(t){this.config=t??{}}async init(o){this.locale=await p(o,this.config.locale,h,d);const i=o.getContainer(),m=i.getRootNode();if(m instanceof ShadowRoot){const a=m.host;this.service=function(o,i,a,p){function u(t){return t??{}}function m(t){const u={options:t,cancelled:!1};if(p.emit(c,u),u.cancelled)return null;const m=u.options,h=function(t,e,o,n="en"){return["<!DOCTYPE html>",`<html lang="${n}">`,"<head>",'<meta charset="utf-8">',`<title>${o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</title>`,`<style>${t}</style>`,"</head>",`<body>${e}</body>`,"</html>"].join("\n")}(function(t,e,o){const i=[],c=function(t){const e=[];for(const o of t.adoptedStyleSheets)for(const t of o.cssRules)e.push(t.cssText);return e.join("\n")}(t);c&&i.push(c);const a=!1!==o.forceLightTheme;if(a)i.push(r(s).replace(":host {",":root {"));else{const t=function(t){const e=getComputedStyle(t),o=[];for(let n=0;n<e.length;n++){const t=e[n]??"";if(t.startsWith("--notectl-")){const n=e.getPropertyValue(t).trim();n&&o.push(` ${t}: ${n};`)}}return 0===o.length?"":`:root {\n${o.join("\n")}\n}`}(e);t&&i.push(t)}const l=a?s.primitives.foreground:void 0;i.push(function(t,e){const o=getComputedStyle(t),n=["font-family","font-size","font-weight","line-height","letter-spacing","word-spacing","color"],r=[" margin: 0;"];for(const i of n){if("color"===i&&e){r.push(` color: ${e};`);continue}const t=o.getPropertyValue(i).trim();t&&r.push(` ${i}: ${t};`)}return`body {\n${r.join("\n")}\n}`}(e,l));const p=function(t){const e=[],o=[];if(t.margin?o.push(` margin: ${t.margin};`):t.paperSize&&o.push(" margin: 0;"),t.paperSize||t.orientation){const e=[t.paperSize?n(t.paperSize):"A4"];t.orientation&&e.push(t.orientation),o.push(` size: ${e.join(" ")};`)}o.length>0&&e.push(`@page {\n${o.join("\n")}\n}`),t.paperSize&&e.push(".notectl-content { padding: 48px 56px !important; }");const r=[];return r.push("[data-notectl-no-print] { display: none !important; }"),r.push(".notectl-code-block { white-space: pre-wrap !important; word-break: break-all !important; page-break-inside: avoid; }"),r.push("img { page-break-inside: avoid; }"),r.push(".notectl-table { break-inside: avoid; }"),!1!==t.printBackground&&r.push("* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }"),e.push(`@media print {\n ${r.join("\n ")}\n}`),e.join("\n\n")}(o);return p&&i.push(p),o.customCSS&&i.push(o.customCSS),i.join("\n\n")}(o,i,m),function(t,o){const n=function(t){return(t.querySelector(".notectl-content")??t).cloneNode(!0)}(t);return function(t){t.removeAttribute("contenteditable");for(const e of["notectl-node-selected","notectl-content--empty"]){t.classList.remove(e);for(const o of t.querySelectorAll(`.${e}`))o.classList.remove(e)}t.removeAttribute("data-placeholder")}(n),function(t,o){if(o.excludeBlockTypes)for(const e of o.excludeBlockTypes){const o=t.querySelectorAll(`[data-block-type="${e}"]`);for(const t of o)t.remove()}if(o.pageBreakBefore)for(const n of o.pageBreakBefore){const o=t.querySelectorAll(`[data-block-type="${n}"]`);for(const t of o)e(t,{breakBefore:"page",pageBreakBefore:"always"})}}(n,o),function(t,e){if(e.header){const o=document.createElement("div");o.className="notectl-print-header",o.innerHTML=y(e.header),t.insertBefore(o,t.firstChild)}if(e.footer){const o=document.createElement("div");o.className="notectl-print-footer",o.innerHTML=y(e.footer),t.appendChild(o)}}(n,o),n}(a,m).outerHTML,m.title??"",i.closest("[lang]")?.getAttribute("lang")??(document.documentElement.lang||"en")),f={html:h};return p.emit(l,f),h}return{print(e){const o=m(u(e));if(!o)return;const n=document.createElement("iframe");t(n,"position:fixed;left:-9999px;width:0;height:0;border:none"),document.body.appendChild(n);const r=n.contentDocument;if(!r)return void document.body.removeChild(n);r.open(),r.write(o),r.close();const i=()=>{n.remove()};n.contentWindow?(n.contentWindow.addEventListener("afterprint",i,{once:!0}),n.contentWindow.print()):i()},toHTML:t=>m(u(t))??""}}(m,a,i,o.getEventBus())}else this.service=b;o.registerService(a,this.service);const f=this.config.defaults??{},g=this.service,v=this.locale;o.registerCommand("print",()=>(o.announce(v.printingAnnouncement),g.print(f),!0));const j=this.config.keyBinding??"Mod-P";if(o.registerKeymap({[j]:()=>(o.executeCommand("print"),!0)}),!1!==this.config.showToolbarItem){const t=u(j);o.registerToolbarItem({id:"print",group:"actions",label:this.locale.label,tooltip:this.locale.tooltip(t),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>',command:"print"})}}destroy(){this.service=null}};export{h as n,d as r,j as t};
2
- //# sourceMappingURL=PrintPlugin-Dv8_E40e.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrintPlugin-Dv8_E40e.mjs","names":[],"sources":["../../src/plugins/print/PrintLocale.ts","../../src/plugins/print/PrintContentPreparer.ts","../../src/plugins/print/PrintStyleCollector.ts","../../src/plugins/print/PrintServiceImpl.ts","../../src/plugins/print/PrintPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the PrintPlugin. */\n\n// --- Locale Interface ---\n\nexport interface PrintLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly printingAnnouncement: string;\n}\n\n// --- Default English Locale ---\n\nexport const PRINT_LOCALE_EN: PrintLocale = {\n\tlabel: 'Print',\n\ttooltip: (shortcut: string) => `Print (${shortcut})`,\n\tprintingAnnouncement: 'Printing',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: Record<string, () => Promise<{ default: PrintLocale }>> = import.meta.glob<{\n\tdefault: PrintLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadPrintLocale(lang: string): Promise<PrintLocale> {\n\tif (lang === 'en') return PRINT_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return PRINT_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn PRINT_LOCALE_EN;\n\t}\n}\n","/**\n * Prepares editor content for print output.\n * Clones the DOM, sanitizes interactive attributes, applies block filters,\n * and inserts header/footer elements.\n */\n\nimport DOMPurify from 'dompurify';\nimport { setStyleProperties } from '../../style/StyleRuntime.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Deep-clones the .notectl-content element from the editor container. */\nexport function cloneContent(container: HTMLElement): HTMLElement {\n\tconst content: HTMLElement | null = container.querySelector('.notectl-content');\n\tconst source: HTMLElement = content ?? container;\n\treturn source.cloneNode(true) as HTMLElement;\n}\n\n/** Sanitizes the cloned content for print: removes interactive attributes and selection styling. */\nexport function sanitize(clone: HTMLElement): void {\n\t// Remove contenteditable from the root\n\tclone.removeAttribute('contenteditable');\n\n\t// Remove selection-related CSS classes\n\tconst selectionClasses: readonly string[] = ['notectl-node-selected', 'notectl-content--empty'];\n\tfor (const cls of selectionClasses) {\n\t\tclone.classList.remove(cls);\n\t\tfor (const el of clone.querySelectorAll(`.${cls}`)) {\n\t\t\tel.classList.remove(cls);\n\t\t}\n\t}\n\n\t// Remove data-placeholder to avoid showing placeholder in print\n\tclone.removeAttribute('data-placeholder');\n}\n\n/** Removes excluded block types and applies page-break-before to configured block types. */\nexport function applyBlockFilters(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.excludeBlockTypes) {\n\t\tfor (const type of options.excludeBlockTypes) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tel.remove();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (options.pageBreakBefore) {\n\t\tfor (const type of options.pageBreakBefore) {\n\t\t\tconst elements: NodeListOf<Element> = clone.querySelectorAll(`[data-block-type=\"${type}\"]`);\n\t\t\tfor (const el of elements) {\n\t\t\t\tsetStyleProperties(el as HTMLElement, {\n\t\t\t\t\tbreakBefore: 'page',\n\t\t\t\t\tpageBreakBefore: 'always',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Tags allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_TAGS: readonly string[] = [\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'p',\n\t'div',\n\t'span',\n\t'br',\n\t'hr',\n\t'strong',\n\t'b',\n\t'em',\n\t'i',\n\t'u',\n\t's',\n\t'sub',\n\t'sup',\n\t'small',\n\t'ul',\n\t'ol',\n\t'li',\n\t'table',\n\t'thead',\n\t'tbody',\n\t'tr',\n\t'th',\n\t'td',\n\t'img',\n];\n\n/** Attributes allowed in print header/footer content. */\nconst HEADER_FOOTER_ALLOWED_ATTRS: readonly string[] = [\n\t'style',\n\t'class',\n\t'src',\n\t'alt',\n\t'width',\n\t'height',\n\t'colspan',\n\t'rowspan',\n];\n\n/** Resolves a header/footer value to a sanitized HTML string. */\nfunction resolveContent(value: string | (() => string)): string {\n\tconst raw: string = typeof value === 'function' ? value() : value;\n\treturn DOMPurify.sanitize(raw, {\n\t\tALLOWED_TAGS: [...HEADER_FOOTER_ALLOWED_TAGS],\n\t\tALLOWED_ATTR: [...HEADER_FOOTER_ALLOWED_ATTRS],\n\t});\n}\n\n/** Inserts header and footer elements into the cloned content. */\nexport function insertHeaderFooter(clone: HTMLElement, options: PrintOptions): void {\n\tif (options.header) {\n\t\tconst headerEl: HTMLDivElement = document.createElement('div');\n\t\theaderEl.className = 'notectl-print-header';\n\t\theaderEl.innerHTML = resolveContent(options.header);\n\t\tclone.insertBefore(headerEl, clone.firstChild);\n\t}\n\n\tif (options.footer) {\n\t\tconst footerEl: HTMLDivElement = document.createElement('div');\n\t\tfooterEl.className = 'notectl-print-footer';\n\t\tfooterEl.innerHTML = resolveContent(options.footer);\n\t\tclone.appendChild(footerEl);\n\t}\n}\n\n/** Orchestrates all content preparation steps. Returns a ready-to-print DOM element. */\nexport function prepare(container: HTMLElement, options: PrintOptions): HTMLElement {\n\tconst clone: HTMLElement = cloneContent(container);\n\tsanitize(clone);\n\tapplyBlockFilters(clone, options);\n\tinsertHeaderFooter(clone, options);\n\treturn clone;\n}\n","/**\n * Collects and aggregates CSS for print output.\n * Extracts adopted stylesheets, snapshots theme tokens, and generates print-specific CSS.\n */\n\nimport { generateThemeCSS } from '../../editor/theme/ThemeEngine.js';\nimport { LIGHT_THEME } from '../../editor/theme/ThemeTokens.js';\nimport {\n\tPAPER_MARGIN_HORIZONTAL_PX,\n\tPAPER_MARGIN_TOP_PX,\n\tgetPaperCSSSize,\n} from '../../model/PaperSize.js';\nimport type { PrintOptions } from './PrintTypes.js';\n\n/** Extracts CSS text from all adopted stylesheets on a ShadowRoot. */\nexport function extractAdoptedStyles(shadowRoot: ShadowRoot): string {\n\tconst parts: string[] = [];\n\tfor (const sheet of shadowRoot.adoptedStyleSheets) {\n\t\tfor (const rule of sheet.cssRules) {\n\t\t\tparts.push(rule.cssText);\n\t\t}\n\t}\n\treturn parts.join('\\n');\n}\n\n/**\n * Generates light theme CSS custom properties for print output.\n * Uses the static LIGHT_THEME definition rather than reading computed styles,\n * ensuring print output is always readable on paper regardless of the active editor theme.\n */\nexport function generateLightThemeTokens(): string {\n\treturn generateThemeCSS(LIGHT_THEME).replace(':host {', ':root {');\n}\n\n/** Snapshots --notectl-* CSS custom properties from the host element into a :root block. */\nexport function snapshotThemeTokens(host: HTMLElement): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst tokens: string[] = [];\n\n\tfor (let i = 0; i < computed.length; i++) {\n\t\tconst prop: string = computed[i] ?? '';\n\t\tif (prop.startsWith('--notectl-')) {\n\t\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\t\tif (value) {\n\t\t\t\ttokens.push(` ${prop}: ${value};`);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tokens.length === 0) return '';\n\treturn `:root {\\n${tokens.join('\\n')}\\n}`;\n}\n\n/**\n * Snapshots computed typography from the host element into a `body` rule.\n * In the editor, typography is inherited from `:host` (shadow DOM).\n * The print iframe is a regular document where `:host` doesn't match,\n * so we must apply the same font/line-height explicitly.\n */\nexport function snapshotTypography(host: HTMLElement, colorOverride?: string): string {\n\tconst computed: CSSStyleDeclaration = getComputedStyle(host);\n\tconst props: string[] = [\n\t\t'font-family',\n\t\t'font-size',\n\t\t'font-weight',\n\t\t'line-height',\n\t\t'letter-spacing',\n\t\t'word-spacing',\n\t\t'color',\n\t];\n\tconst rules: string[] = [' margin: 0;'];\n\tfor (const prop of props) {\n\t\tif (prop === 'color' && colorOverride) {\n\t\t\trules.push(` color: ${colorOverride};`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value: string = computed.getPropertyValue(prop).trim();\n\t\tif (value) {\n\t\t\trules.push(` ${prop}: ${value};`);\n\t\t}\n\t}\n\treturn `body {\\n${rules.join('\\n')}\\n}`;\n}\n\n/** Generates print-specific CSS rules based on PrintOptions. */\nexport function generatePrintCSS(options: PrintOptions): string {\n\tconst parts: string[] = [];\n\n\t// @page rule\n\tconst pageProps: string[] = [];\n\tif (options.margin) {\n\t\tpageProps.push(` margin: ${options.margin};`);\n\t} else if (options.paperSize) {\n\t\t// WYSIWYG: zero @page margin so body = full paper width;\n\t\t// document margins are applied as content padding below.\n\t\tpageProps.push(' margin: 0;');\n\t}\n\tif (options.paperSize || options.orientation) {\n\t\tconst sizeKeyword: string = options.paperSize ? getPaperCSSSize(options.paperSize) : 'A4';\n\t\tconst sizeParts: string[] = [sizeKeyword];\n\t\tif (options.orientation) {\n\t\t\tsizeParts.push(options.orientation);\n\t\t}\n\t\tpageProps.push(` size: ${sizeParts.join(' ')};`);\n\t}\n\tif (pageProps.length > 0) {\n\t\tparts.push(`@page {\\n${pageProps.join('\\n')}\\n}`);\n\t}\n\n\t// WYSIWYG: apply paper-mode document margins to print content\n\tif (options.paperSize) {\n\t\tparts.push(\n\t\t\t`.notectl-content { padding: ${PAPER_MARGIN_TOP_PX}px ${PAPER_MARGIN_HORIZONTAL_PX}px !important; }`,\n\t\t);\n\t}\n\n\t// Print media rules\n\tconst printRules: string[] = [];\n\n\t// Hide non-printable elements\n\tprintRules.push('[data-notectl-no-print] { display: none !important; }');\n\n\t// Code blocks: preserve background, force wrapping\n\tprintRules.push(\n\t\t'.notectl-code-block { white-space: pre-wrap !important; ' +\n\t\t\t'word-break: break-all !important; page-break-inside: avoid; }',\n\t);\n\n\t// Images: avoid page breaks\n\tprintRules.push('img { page-break-inside: avoid; }');\n\n\t// Tables: avoid page breaks\n\tprintRules.push('.notectl-table { break-inside: avoid; }');\n\n\t// Preserve background colors and images in print output (WYSIWYG default).\n\t// Only omitted when the consumer explicitly opts out via printBackground: false.\n\tif (options.printBackground !== false) {\n\t\tprintRules.push(\n\t\t\t'* { -webkit-print-color-adjust: exact !important; ' +\n\t\t\t\t'print-color-adjust: exact !important; }',\n\t\t);\n\t}\n\n\tparts.push(`@media print {\\n ${printRules.join('\\n ')}\\n}`);\n\n\treturn parts.join('\\n\\n');\n}\n\n/** Collects all CSS needed for print: adopted styles, theme tokens, print CSS, and custom CSS. */\nexport function collectAll(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\toptions: PrintOptions,\n): string {\n\tconst parts: string[] = [];\n\n\tconst adopted: string = extractAdoptedStyles(shadowRoot);\n\tif (adopted) parts.push(adopted);\n\n\tconst forceLightTheme: boolean = options.forceLightTheme !== false;\n\n\tif (forceLightTheme) {\n\t\tparts.push(generateLightThemeTokens());\n\t} else {\n\t\tconst theme: string = snapshotThemeTokens(host);\n\t\tif (theme) parts.push(theme);\n\t}\n\n\t// WYSIWYG: snapshot host typography so the print iframe matches the editor.\n\t// In the editor, .notectl-content inherits font from :host (shadow DOM).\n\t// The print iframe is a regular document where :host doesn't apply.\n\tconst colorOverride: string | undefined = forceLightTheme\n\t\t? LIGHT_THEME.primitives.foreground\n\t\t: undefined;\n\tparts.push(snapshotTypography(host, colorOverride));\n\n\tconst printCSS: string = generatePrintCSS(options);\n\tif (printCSS) parts.push(printCSS);\n\n\tif (options.customCSS) {\n\t\tparts.push(options.customCSS);\n\t}\n\n\treturn parts.join('\\n\\n');\n}\n","/**\n * PrintService implementation.\n * Handles the synchronous print flow: event emission, style collection,\n * content preparation, iframe creation, and cleanup.\n */\n\nimport { setStyleText } from '../../style/StyleRuntime.js';\nimport type { PluginEventBus } from '../Plugin.js';\nimport { prepare } from './PrintContentPreparer.js';\nimport { collectAll } from './PrintStyleCollector.js';\nimport {\n\tAFTER_PRINT,\n\ttype AfterPrintEvent,\n\tBEFORE_PRINT,\n\ttype BeforePrintEvent,\n\ttype PrintOptions,\n\ttype PrintService,\n} from './PrintTypes.js';\n\n/** Escapes HTML special characters in a plain-text string. */\nfunction escapeHTML(text: string): string {\n\treturn text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n\n/** Builds a complete HTML document string from CSS, body content, and title. */\nexport function buildHTMLDocument(\n\tcss: string,\n\tcontent: string,\n\ttitle: string,\n\tlang = 'en',\n): string {\n\tconst safeTitle: string = escapeHTML(title);\n\treturn [\n\t\t'<!DOCTYPE html>',\n\t\t`<html lang=\"${lang}\">`,\n\t\t'<head>',\n\t\t`<meta charset=\"utf-8\">`,\n\t\t`<title>${safeTitle}</title>`,\n\t\t`<style>${css}</style>`,\n\t\t'</head>',\n\t\t`<body>${content}</body>`,\n\t\t'</html>',\n\t].join('\\n');\n}\n\n/** Creates and returns the PrintService implementation. */\nexport function createPrintService(\n\tshadowRoot: ShadowRoot,\n\thost: HTMLElement,\n\tcontainer: HTMLElement,\n\teventBus: PluginEventBus,\n): PrintService {\n\tfunction mergeOptions(options?: PrintOptions): PrintOptions {\n\t\treturn options ?? {};\n\t}\n\n\tfunction executePrint(options: PrintOptions): string | null {\n\t\t// 1. Emit BEFORE_PRINT — listeners can mutate options or cancel\n\t\tconst beforeEvent: BeforePrintEvent = {\n\t\t\toptions,\n\t\t\tcancelled: false,\n\t\t};\n\t\teventBus.emit(BEFORE_PRINT, beforeEvent);\n\n\t\tif (beforeEvent.cancelled) return null;\n\n\t\tconst finalOptions: PrintOptions = beforeEvent.options;\n\n\t\t// 2. Collect styles\n\t\tconst css: string = collectAll(shadowRoot, host, finalOptions);\n\n\t\t// 3. Prepare content\n\t\tconst clone: HTMLElement = prepare(container, finalOptions);\n\t\tconst contentHTML: string = clone.outerHTML;\n\n\t\t// 4. Build HTML document\n\t\tconst title: string = finalOptions.title ?? '';\n\t\tconst lang: string =\n\t\t\thost.closest('[lang]')?.getAttribute('lang') ?? (document.documentElement.lang || 'en');\n\t\tconst html: string = buildHTMLDocument(css, contentHTML, title, lang);\n\n\t\t// 5. Emit AFTER_PRINT\n\t\tconst afterEvent: AfterPrintEvent = { html };\n\t\teventBus.emit(AFTER_PRINT, afterEvent);\n\n\t\treturn html;\n\t}\n\n\treturn {\n\t\tprint(options?: PrintOptions): void {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\tconst html: string | null = executePrint(resolved);\n\t\t\tif (!html) return;\n\n\t\t\t// Create hidden iframe\n\t\t\tconst iframe: HTMLIFrameElement = document.createElement('iframe');\n\t\t\tsetStyleText(iframe, 'position:fixed;left:-9999px;width:0;height:0;border:none');\n\t\t\tdocument.body.appendChild(iframe);\n\n\t\t\tconst iframeDoc: Document | null = iframe.contentDocument;\n\t\t\tif (!iframeDoc) {\n\t\t\t\tdocument.body.removeChild(iframe);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tiframeDoc.open();\n\t\t\tiframeDoc.write(html);\n\t\t\tiframeDoc.close();\n\n\t\t\tconst cleanup = (): void => {\n\t\t\t\tiframe.remove();\n\t\t\t};\n\n\t\t\t// Defer cleanup until print dialog closes\n\t\t\tif (iframe.contentWindow) {\n\t\t\t\tiframe.contentWindow.addEventListener('afterprint', cleanup, { once: true });\n\t\t\t\tiframe.contentWindow.print();\n\t\t\t} else {\n\t\t\t\tcleanup();\n\t\t\t}\n\t\t},\n\n\t\ttoHTML(options?: PrintOptions): string {\n\t\t\tconst resolved: PrintOptions = mergeOptions(options);\n\t\t\treturn executePrint(resolved) ?? '';\n\t\t},\n\t};\n}\n","/**\n * PrintPlugin: provides print functionality for the notectl editor.\n * Registers a command, keymap, toolbar item, and exposes a PrintService.\n * Orchestrator only — delegates all logic to PrintServiceImpl, PrintStyleCollector,\n * and PrintContentPreparer.\n */\n\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { PRINT_LOCALE_EN, type PrintLocale, loadPrintLocale } from './PrintLocale.js';\nimport { createPrintService } from './PrintServiceImpl.js';\nimport type { PrintOptions, PrintPluginConfig, PrintService } from './PrintTypes.js';\nimport { PRINT_SERVICE_KEY } from './PrintTypes.js';\n\nconst PRINT_ICON: string =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">' +\n\t'<path d=\"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3' +\n\t' 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z\"/>' +\n\t'</svg>';\n\n/** No-op fallback service for environments without ShadowRoot. */\nconst NOOP_SERVICE: PrintService = {\n\tprint(): void {},\n\ttoHTML(): string {\n\t\treturn '';\n\t},\n};\n\nexport class PrintPlugin implements Plugin {\n\treadonly id = 'print';\n\treadonly name = 'Print';\n\n\tprivate readonly config: PrintPluginConfig;\n\tprivate service: PrintService | null = null;\n\tprivate locale!: PrintLocale;\n\n\tconstructor(config?: PrintPluginConfig) {\n\t\tthis.config = config ?? {};\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tPRINT_LOCALE_EN,\n\t\t\tloadPrintLocale,\n\t\t);\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tconst rootNode: Node = container.getRootNode();\n\n\t\tif (rootNode instanceof ShadowRoot) {\n\t\t\tconst host: HTMLElement = rootNode.host as HTMLElement;\n\t\t\tconst eventBus = context.getEventBus();\n\t\t\tthis.service = createPrintService(rootNode, host, container, eventBus);\n\t\t} else {\n\t\t\tthis.service = NOOP_SERVICE;\n\t\t}\n\n\t\tcontext.registerService(PRINT_SERVICE_KEY, this.service);\n\n\t\tconst defaults: PrintOptions = this.config.defaults ?? {};\n\t\tconst service: PrintService = this.service;\n\n\t\tconst printLocale = this.locale;\n\t\tcontext.registerCommand('print', () => {\n\t\t\tcontext.announce(printLocale.printingAnnouncement);\n\t\t\tservice.print(defaults);\n\t\t\treturn true;\n\t\t});\n\n\t\tconst keyBinding: string = this.config.keyBinding ?? 'Mod-P';\n\t\tcontext.registerKeymap({\n\t\t\t[keyBinding]: () => {\n\t\t\t\tcontext.executeCommand('print');\n\t\t\t\treturn true;\n\t\t\t},\n\t\t});\n\n\t\tif (this.config.showToolbarItem !== false) {\n\t\t\tconst shortcut: string = formatShortcut(keyBinding);\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: 'print',\n\t\t\t\tgroup: 'actions',\n\t\t\t\tlabel: this.locale.label,\n\t\t\t\ttooltip: this.locale.tooltip(shortcut),\n\t\t\t\ticon: PRINT_ICON,\n\t\t\t\tcommand: 'print',\n\t\t\t});\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.service = null;\n\t}\n}\n"],"mappings":"iRAYA,IAAa,EAA+B,CAC3C,MAAO,QACP,QAAU,GAAqB,UAAU,KACzC,qBAAsB,YAKjB,iBAAyE,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAI/E,eAAsB,EAAgB,GACrC,GAAa,OAA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ACrB,GAAA,KACA,EAAQ,eAAe,UAChB,MAI2B,IAAhC,KAAK,OAAO,gBAA2B,CAC1C,MAAM,EAAmB,EAAe,GACxC,EAAQ,oBAAoB,CAC3B,GAAI,QACJ,MAAO,UACP,MAAO,KAAK,OAAO,MACnB,QAAS,KAAK,OAAO,QAAQ,GAC7B,KAtEH,sPAuEG,QAAS,WAKZ,OAAA,GACC,KAAK,QAAU"}
@@ -1,2 +0,0 @@
1
- import{c as t,r as e,s as n}from"./Document-_qdGR4vh.mjs";import{c as o,o as s,t as c,u as r}from"./Selection-aeiSsvhe.mjs";import{t as i}from"./Commands-C7zBYmhA.mjs";import{a}from"./TypeBrands-BZDKMjR-.mjs";import{a as l,c as d,i as u,o as h,s as m}from"./BlockInsertion-DaG_4D31.mjs";import{n as g}from"./Plugin-BUNGKupW.mjs";import{i as f}from"./PluginHelpers-Db50-BRE.mjs";import{i as p}from"./XmlDetector-DlRdJOIX.mjs";var x=/\n(?:[ \t]*\n)+/;function k(t,e){return!t.detection&&!e.detection||!(!t.detection||!e.detection)&&t.detection.language===e.detection.language}function C(t,e){const n=`${t.text}\n\n${e.text}`;if(!t.detection&&!e.detection)return{text:n,detection:null};const o=t.detection,s=e.detection;return{text:n,detection:{language:o.language,formattedText:`${o.formattedText}\n\n${s.formattedText}`,confidence:Math.max(o.confidence,s.confidence)}}}var j={detectedAsCodeBlock:t=>`Pasted as ${t} code block with syntax highlighting.`,detectedMixedContent:(t,e,n)=>{const o=[];if(t>0&&o.push(`${t} paragraph${t>1?"s":""}`),e>0){const t=n.join(", ");o.push(`${e} code block${e>1?"s":""} (${t})`)}return`Pasted as ${o.join(" and ")}.`}},b=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-ChOxTdPI.mjs"),"./locales/de.ts":()=>import("./de-B92lssMU.mjs"),"./locales/es.ts":()=>import("./es-BJibD3UW.mjs"),"./locales/fr.ts":()=>import("./fr-DPPHZ6H7.mjs"),"./locales/hi.ts":()=>import("./hi-CRsCP_UU.mjs"),"./locales/pt.ts":()=>import("./pt-QZcGM_AW.mjs"),"./locales/ru.ts":()=>import("./ru-CQoFJYQk.mjs"),"./locales/zh.ts":()=>import("./zh-BogAT6ZW.mjs")});async function B(t){if("en"===t)return j;const e=b[`./locales/${t}.ts`];if(!e)return j;try{return(await e()).default}catch{return j}}var P=new g("smartPaste"),y=class{id="smart-paste";name="Smart Paste";dependencies=["code-block"];config;detectors=[];context=null;locale=j;constructor(t){this.config={...t}}async init(t){this.context=t,this.locale=await f(t,this.config.locale,j,B);const e=t.getService(p);if(e&&e.onRegister(t=>{t.detection&&this.detectors.push(t.detection)}),this.config.detectors)for(const n of this.config.detectors)this.detectors.push(n);t.registerPasteInterceptor(this.handlePaste,{name:"smart-paste",priority:50}),t.registerService(P,{registerDetector:t=>{this.detectors.push(t)}})}destroy(){this.context=null,this.detectors.length=0}handlePaste=(t,e,n)=>{if(this.isCursorInCodeBlock(n))return null;const o=function(t,e){const n=t.split(x).map(t=>t.trim()).filter(t=>t.length>0);if(0===n.length)return null;let o=!1;const s=n.map(t=>{const n=function(t,e){let n=null;for(const o of e){const e=o.detect(t);e&&(null===n||e.confidence>n.confidence)&&(n=e)}return n}(t,e);return n&&(o=!0),{text:t,detection:n}});return o?function(t){if(t.length<=1)return t;const e=[t[0]];for(let n=1;n<t.length;n++){const o=t[n],s=e[e.length-1];k(s,o)?e[e.length-1]=C(s,o):e.push(o)}return e}(s):null}(t,this.detectors);return o?1===o.length&&o[0]?.detection?this.handleSingleCodeBlock(n,o[0].detection):this.handleMixedContent(n,o):null};isCursorInCodeBlock(t){const e=t.selection;return!!r(e)&&"code_block"===t.getBlock(e.anchor.blockId)?.type}handleSingleCodeBlock(t,e){const n=this.buildCodeBlockTransaction(t,e);return n&&this.context&&this.context.announce(this.locale.detectedAsCodeBlock(e.language)),n}buildCodeBlockTransaction(o,d){const u=o.selection,m=o.transaction("paste");let g;g=r(u)&&!s(u)?i(o,m)??u.anchor.blockId:h(u);const f=t(),p=e(a("code_block"),[n(d.formattedText)],f,{language:d.language,backgroundColor:""});return l(o,m,g,p,u,this.context?.getSchemaRegistry())?(m.setSelection(c(f,d.formattedText.length)),m.build()):null}handleMixedContent(t,e){const n=this.buildMultiBlockTransaction(t,e);return n&&this.context&&this.announceMixedContent(e),n}buildMultiBlockTransaction(t,e){const n=t.selection,a=t.transaction("paste");let l;l=r(n)&&!s(n)?i(t,a)??n.anchor.blockId:h(n);const g=u(t,l),f=this.context?.getSchemaRegistry(),p=g?m(t,l,g,f):d(t,l,f);if(!p)return null;const x=!g&&o(n)&&"before"===n.side?0:1;let k,C=p.anchorIndex+x,j=0;for(const o of e){const t=o.detection?this.createCodeBlockNode(o.detection):this.createParagraphNode(o.text);a.insertNode(p.parentPath,C,t),C++,k=t.id,j=o.detection?o.detection.formattedText.length:o.text.length}return(g?p.isAnchorEmpty&&p.anchorIndex>=0:p.isAnchorEmpty&&!o(n))&&a.removeNode(p.parentPath,p.anchorIndex),k&&a.setSelection(c(k,j)),a.build()}createCodeBlockNode(o){return e(a("code_block"),[n(o.formattedText)],t(),{language:o.language,backgroundColor:""})}createParagraphNode(o){return e(a("paragraph"),[n(o)],t())}announceMixedContent(t){let e=0,n=0;const o=[];for(const s of t)s.detection?(n++,o.includes(s.detection.language)||o.push(s.detection.language)):e++;this.context?.announce(this.locale.detectedMixedContent(e,n,o))}};export{B as i,P as n,j as r,y as t};
2
- //# sourceMappingURL=SmartPastePlugin-PCLFN5yA.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SmartPastePlugin-PCLFN5yA.mjs","names":[],"sources":["../../src/plugins/smart-paste/ContentSplitter.ts","../../src/plugins/smart-paste/SmartPasteLocale.ts","../../src/plugins/smart-paste/SmartPasteTypes.ts","../../src/plugins/smart-paste/SmartPastePlugin.ts"],"sourcesContent":["/**\n * Splits pasted text at blank-line boundaries and classifies each segment\n * using content detectors. Adjacent segments of the same type are merged.\n */\n\nimport type { ContentDetector, DetectionResult, PasteSegment } from './SmartPasteTypes.js';\n\n/** Pattern matching one or more consecutive blank lines (may contain whitespace). */\nconst BLANK_LINE_SPLIT: RegExp = /\\n(?:[ \\t]*\\n)+/;\n\n/**\n * Splits text at blank-line boundaries and classifies each segment\n * using the provided detectors. Returns null if no code is detected\n * in any segment (the paste should fall through to default handling).\n */\nexport function splitAndClassify(\n\ttext: string,\n\tdetectors: readonly ContentDetector[],\n): readonly PasteSegment[] | null {\n\tconst rawSegments: readonly string[] = text.split(BLANK_LINE_SPLIT);\n\tconst trimmed: readonly string[] = rawSegments\n\t\t.map((s: string) => s.trim())\n\t\t.filter((s: string) => s.length > 0);\n\n\tif (trimmed.length === 0) return null;\n\n\tlet hasCode = false;\n\tconst segments: PasteSegment[] = trimmed.map((segmentText: string): PasteSegment => {\n\t\tconst detection: DetectionResult | null = detectBest(segmentText, detectors);\n\t\tif (detection) hasCode = true;\n\t\treturn { text: segmentText, detection };\n\t});\n\n\tif (!hasCode) return null;\n\n\treturn mergeAdjacentSegments(segments);\n}\n\n/**\n * Merges adjacent segments that share the same classification:\n * consecutive text segments become one paragraph, consecutive code\n * segments of the same language become one code block.\n */\nexport function mergeAdjacentSegments(segments: readonly PasteSegment[]): readonly PasteSegment[] {\n\tif (segments.length <= 1) return segments;\n\n\tconst merged: PasteSegment[] = [segments[0] as PasteSegment];\n\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tconst current: PasteSegment = segments[i] as PasteSegment;\n\t\tconst previous: PasteSegment = merged[merged.length - 1] as PasteSegment;\n\n\t\tif (canMerge(previous, current)) {\n\t\t\tmerged[merged.length - 1] = merge(previous, current);\n\t\t} else {\n\t\t\tmerged.push(current);\n\t\t}\n\t}\n\n\treturn merged;\n}\n\n/** Picks the highest-confidence detection result from all detectors. */\nfunction detectBest(text: string, detectors: readonly ContentDetector[]): DetectionResult | null {\n\tlet best: DetectionResult | null = null;\n\n\tfor (const detector of detectors) {\n\t\tconst result: DetectionResult | null = detector.detect(text);\n\t\tif (result && (best === null || result.confidence > best.confidence)) {\n\t\t\tbest = result;\n\t\t}\n\t}\n\n\treturn best;\n}\n\n/** Two segments can merge if both are text or both are code of the same language. */\nfunction canMerge(a: PasteSegment, b: PasteSegment): boolean {\n\tif (!a.detection && !b.detection) return true;\n\tif (a.detection && b.detection) return a.detection.language === b.detection.language;\n\treturn false;\n}\n\n/** Merges two compatible segments into one. */\nfunction merge(a: PasteSegment, b: PasteSegment): PasteSegment {\n\tconst joinedText: string = `${a.text}\\n\\n${b.text}`;\n\n\tif (!a.detection && !b.detection) {\n\t\treturn { text: joinedText, detection: null };\n\t}\n\n\tconst detA: DetectionResult = a.detection as DetectionResult;\n\tconst detB: DetectionResult = b.detection as DetectionResult;\n\n\treturn {\n\t\ttext: joinedText,\n\t\tdetection: {\n\t\t\tlanguage: detA.language,\n\t\t\tformattedText: `${detA.formattedText}\\n\\n${detB.formattedText}`,\n\t\t\tconfidence: Math.max(detA.confidence, detB.confidence),\n\t\t},\n\t};\n}\n","/** Locale interface and default English locale for the SmartPastePlugin. */\n\nexport interface SmartPasteLocale {\n\treadonly detectedAsCodeBlock: (language: string) => string;\n\treadonly detectedMixedContent: (\n\t\ttextCount: number,\n\t\tcodeCount: number,\n\t\tlanguages: readonly string[],\n\t) => string;\n}\n\nexport const SMART_PASTE_LOCALE_EN: SmartPasteLocale = {\n\tdetectedAsCodeBlock: (language: string) =>\n\t\t`Pasted as ${language} code block with syntax highlighting.`,\n\tdetectedMixedContent: (textCount: number, codeCount: number, languages: readonly string[]) => {\n\t\tconst parts: string[] = [];\n\t\tif (textCount > 0) {\n\t\t\tparts.push(`${textCount} paragraph${textCount > 1 ? 's' : ''}`);\n\t\t}\n\t\tif (codeCount > 0) {\n\t\t\tconst langList: string = languages.join(', ');\n\t\t\tparts.push(`${codeCount} code block${codeCount > 1 ? 's' : ''} (${langList})`);\n\t\t}\n\t\treturn `Pasted as ${parts.join(' and ')}.`;\n\t},\n};\n\nconst localeModules: Record<string, () => Promise<{ default: SmartPasteLocale }>> =\n\timport.meta.glob<{ default: SmartPasteLocale }>('./locales/*.ts', { eager: false });\n\nexport async function loadSmartPasteLocale(lang: string): Promise<SmartPasteLocale> {\n\tif (lang === 'en') return SMART_PASTE_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return SMART_PASTE_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn SMART_PASTE_LOCALE_EN;\n\t}\n}\n","/**\n * Types for the smart paste plugin — content detection and formatting.\n */\n\nimport { ServiceKey } from '../Plugin.js';\nimport type { SmartPasteLocale } from './SmartPasteLocale.js';\n\n/** Result of detecting structured content in pasted text. */\nexport interface DetectionResult {\n\treadonly language: string;\n\treadonly formattedText: string;\n\treadonly confidence: number;\n}\n\n/** A classified segment of pasted text — either plain text or detected code. */\nexport interface PasteSegment {\n\treadonly text: string;\n\treadonly detection: DetectionResult | null;\n}\n\n/** Interface for content detectors that identify and format pasted text. */\nexport interface ContentDetector {\n\treadonly id: string;\n\tdetect(text: string): DetectionResult | null;\n}\n\n/** Configuration for the SmartPastePlugin. */\nexport interface SmartPasteConfig {\n\treadonly detectors?: readonly ContentDetector[];\n\treadonly locale?: SmartPasteLocale;\n}\n\n/** Public service for registering additional content detectors at runtime. */\nexport interface SmartPasteService {\n\tregisterDetector(detector: ContentDetector): void;\n}\n\nexport const SMART_PASTE_SERVICE_KEY = new ServiceKey<SmartPasteService>('smartPaste');\n","/**\n * SmartPastePlugin: detects structured content in clipboard text\n * and inserts it as formatted code blocks with syntax highlighting.\n * Mixed content (text + code) is split into separate blocks.\n */\n\nimport {\n\ttype InsertionContext,\n\tfindTableCellAncestor,\n\tinsertBlockAfterAnchor,\n\tresolveAnchorBlockId,\n\tresolveCellInsertionContext,\n\tresolveRootInsertionContext,\n} from '../../commands/BlockInsertion.js';\nimport { addDeleteSelectionSteps } from '../../commands/Commands.js';\nimport {\n\ttype BlockNode,\n\tcreateBlockNode,\n\tcreateTextNode,\n\tgenerateBlockId,\n} from '../../model/Document.js';\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisTextSelection,\n} from '../../model/Selection.js';\nimport type { BlockId, NodeTypeName } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { PasteInterceptor, Plugin, PluginContext } from '../Plugin.js';\nimport { LANGUAGE_REGISTRY_SERVICE_KEY } from '../language/LanguageTypes.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { splitAndClassify } from './ContentSplitter.js';\nimport {\n\tSMART_PASTE_LOCALE_EN,\n\ttype SmartPasteLocale,\n\tloadSmartPasteLocale,\n} from './SmartPasteLocale.js';\nimport type {\n\tContentDetector,\n\tDetectionResult,\n\tPasteSegment,\n\tSmartPasteConfig,\n} from './SmartPasteTypes.js';\nimport { SMART_PASTE_SERVICE_KEY } from './SmartPasteTypes.js';\n\nexport class SmartPastePlugin implements Plugin {\n\treadonly id = 'smart-paste';\n\treadonly name = 'Smart Paste';\n\treadonly dependencies = ['code-block'] as const;\n\n\tprivate readonly config: SmartPasteConfig;\n\tprivate readonly detectors: ContentDetector[] = [];\n\tprivate context: PluginContext | null = null;\n\tprivate locale: SmartPasteLocale = SMART_PASTE_LOCALE_EN;\n\n\tconstructor(config?: Partial<SmartPasteConfig>) {\n\t\tthis.config = { ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.context = context;\n\n\t\tthis.locale = await resolveLocale(\n\t\t\tcontext,\n\t\t\tthis.config.locale,\n\t\t\tSMART_PASTE_LOCALE_EN,\n\t\t\tloadSmartPasteLocale,\n\t\t);\n\n\t\t// Subscribe to language registry for detectors (replay provides built-ins)\n\t\tconst registry = context.getService(LANGUAGE_REGISTRY_SERVICE_KEY);\n\t\tif (registry) {\n\t\t\tregistry.onRegister((support) => {\n\t\t\t\tif (support.detection) {\n\t\t\t\t\tthis.detectors.push(support.detection);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Register config-provided detectors\n\t\tif (this.config.detectors) {\n\t\t\tfor (const detector of this.config.detectors) {\n\t\t\t\tthis.detectors.push(detector);\n\t\t\t}\n\t\t}\n\n\t\t// Register paste interceptor\n\t\tcontext.registerPasteInterceptor(this.handlePaste, { name: 'smart-paste', priority: 50 });\n\n\t\t// Register service for external detector registration\n\t\tcontext.registerService(SMART_PASTE_SERVICE_KEY, {\n\t\t\tregisterDetector: (detector: ContentDetector) => {\n\t\t\t\tthis.detectors.push(detector);\n\t\t\t},\n\t\t});\n\t}\n\n\tdestroy(): void {\n\t\tthis.context = null;\n\t\tthis.detectors.length = 0;\n\t}\n\n\t// --- Paste Interceptor ---\n\n\tprivate readonly handlePaste: PasteInterceptor = (\n\t\tplainText: string,\n\t\t_html: string,\n\t\tstate: EditorState,\n\t): Transaction | null => {\n\t\tif (this.isCursorInCodeBlock(state)) return null;\n\n\t\tconst segments: readonly PasteSegment[] | null = splitAndClassify(plainText, this.detectors);\n\t\tif (!segments) return null;\n\n\t\t// Single code-only segment: use existing fast path\n\t\tif (segments.length === 1 && segments[0]?.detection) {\n\t\t\treturn this.handleSingleCodeBlock(state, segments[0].detection);\n\t\t}\n\n\t\t// Mixed content: create multiple blocks\n\t\treturn this.handleMixedContent(state, segments);\n\t};\n\n\tprivate isCursorInCodeBlock(state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\treturn block?.type === 'code_block';\n\t}\n\n\t// --- Single Code Block (existing behavior) ---\n\n\tprivate handleSingleCodeBlock(\n\t\tstate: EditorState,\n\t\tdetection: DetectionResult,\n\t): Transaction | null {\n\t\tconst tr: Transaction | null = this.buildCodeBlockTransaction(state, detection);\n\t\tif (tr && this.context) {\n\t\t\tthis.context.announce(this.locale.detectedAsCodeBlock(detection.language));\n\t\t}\n\t\treturn tr;\n\t}\n\n\tprivate buildCodeBlockTransaction(\n\t\tstate: EditorState,\n\t\tdetection: DetectionResult,\n\t): Transaction | null {\n\t\tconst sel = state.selection;\n\t\tconst builder = state.transaction('paste');\n\n\t\t// Delete selection if range-selected\n\t\tlet anchorBlockId: BlockId;\n\t\tif (isTextSelection(sel) && !isCollapsed(sel)) {\n\t\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\t\tanchorBlockId = landingId ?? sel.anchor.blockId;\n\t\t} else {\n\t\t\tanchorBlockId = resolveAnchorBlockId(sel);\n\t\t}\n\n\t\t// Create the code block node\n\t\tconst newBlockId: BlockId = generateBlockId();\n\t\tconst codeBlock: BlockNode = createBlockNode(\n\t\t\tnodeType('code_block') as NodeTypeName,\n\t\t\t[createTextNode(detection.formattedText)],\n\t\t\tnewBlockId,\n\t\t\t{ language: detection.language, backgroundColor: '' },\n\t\t);\n\n\t\t// Insert at cursor (handles cell vs root, empty anchor removal)\n\t\tconst inserted: boolean = insertBlockAfterAnchor(\n\t\t\tstate,\n\t\t\tbuilder,\n\t\t\tanchorBlockId,\n\t\t\tcodeBlock,\n\t\t\tsel,\n\t\t\tthis.context?.getSchemaRegistry(),\n\t\t);\n\t\tif (!inserted) return null;\n\n\t\tbuilder.setSelection(createCollapsedSelection(newBlockId, detection.formattedText.length));\n\n\t\treturn builder.build();\n\t}\n\n\t// --- Mixed Content (multiple blocks) ---\n\n\tprivate handleMixedContent(\n\t\tstate: EditorState,\n\t\tsegments: readonly PasteSegment[],\n\t): Transaction | null {\n\t\tconst tr: Transaction | null = this.buildMultiBlockTransaction(state, segments);\n\t\tif (tr && this.context) {\n\t\t\tthis.announceMixedContent(segments);\n\t\t}\n\t\treturn tr;\n\t}\n\n\tprivate buildMultiBlockTransaction(\n\t\tstate: EditorState,\n\t\tsegments: readonly PasteSegment[],\n\t): Transaction | null {\n\t\tconst sel = state.selection;\n\t\tconst builder = state.transaction('paste');\n\n\t\tlet anchorBlockId: BlockId;\n\t\tif (isTextSelection(sel) && !isCollapsed(sel)) {\n\t\t\tconst landingId: BlockId | undefined = addDeleteSelectionSteps(state, builder);\n\t\t\tanchorBlockId = landingId ?? sel.anchor.blockId;\n\t\t} else {\n\t\t\tanchorBlockId = resolveAnchorBlockId(sel);\n\t\t}\n\n\t\tconst cellId: BlockId | undefined = findTableCellAncestor(state, anchorBlockId);\n\t\tconst schemaRegistry = this.context?.getSchemaRegistry();\n\n\t\tconst ctx: InsertionContext | undefined = cellId\n\t\t\t? resolveCellInsertionContext(state, anchorBlockId, cellId, schemaRegistry)\n\t\t\t: resolveRootInsertionContext(state, anchorBlockId, schemaRegistry);\n\t\tif (!ctx) return null;\n\n\t\tconst insertOffset: number = !cellId && isGapCursor(sel) && sel.side === 'before' ? 0 : 1;\n\t\tlet insertIndex: number = ctx.anchorIndex + insertOffset;\n\t\tlet lastBlockId: BlockId | undefined;\n\t\tlet lastBlockTextLen = 0;\n\n\t\tfor (const segment of segments) {\n\t\t\tconst block: BlockNode = segment.detection\n\t\t\t\t? this.createCodeBlockNode(segment.detection)\n\t\t\t\t: this.createParagraphNode(segment.text);\n\n\t\t\tbuilder.insertNode(ctx.parentPath, insertIndex, block);\n\t\t\tinsertIndex++;\n\t\t\tlastBlockId = block.id;\n\t\t\tlastBlockTextLen = segment.detection\n\t\t\t\t? segment.detection.formattedText.length\n\t\t\t\t: segment.text.length;\n\t\t}\n\n\t\tconst shouldRemoveAnchor: boolean = cellId\n\t\t\t? ctx.isAnchorEmpty && ctx.anchorIndex >= 0\n\t\t\t: ctx.isAnchorEmpty && !isGapCursor(sel);\n\n\t\tif (shouldRemoveAnchor) {\n\t\t\tbuilder.removeNode(ctx.parentPath, ctx.anchorIndex);\n\t\t}\n\n\t\tif (lastBlockId) {\n\t\t\tbuilder.setSelection(createCollapsedSelection(lastBlockId, lastBlockTextLen));\n\t\t}\n\n\t\treturn builder.build();\n\t}\n\n\tprivate createCodeBlockNode(detection: DetectionResult): BlockNode {\n\t\treturn createBlockNode(\n\t\t\tnodeType('code_block') as NodeTypeName,\n\t\t\t[createTextNode(detection.formattedText)],\n\t\t\tgenerateBlockId(),\n\t\t\t{ language: detection.language, backgroundColor: '' },\n\t\t);\n\t}\n\n\tprivate createParagraphNode(text: string): BlockNode {\n\t\treturn createBlockNode(\n\t\t\tnodeType('paragraph') as NodeTypeName,\n\t\t\t[createTextNode(text)],\n\t\t\tgenerateBlockId(),\n\t\t);\n\t}\n\n\tprivate announceMixedContent(segments: readonly PasteSegment[]): void {\n\t\tlet textCount = 0;\n\t\tlet codeCount = 0;\n\t\tconst languages: string[] = [];\n\n\t\tfor (const segment of segments) {\n\t\t\tif (segment.detection) {\n\t\t\t\tcodeCount++;\n\t\t\t\tif (!languages.includes(segment.detection.language)) {\n\t\t\t\t\tlanguages.push(segment.detection.language);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttextCount++;\n\t\t\t}\n\t\t}\n\n\t\tthis.context?.announce(this.locale.detectedMixedContent(textCount, codeCount, languages));\n\t}\n}\n"],"mappings":"yaAQA,IAAM,EAA2B,kBAqEjC,SAAS,EAAS,EAAiB,GAClC,OAAK,EAAE,YAAc,EAAE,cACnB,EAAE,YAAa,EAAE,YAAkB,EAAE,UAAU,WAAa,EAAE,UAAU,SAK7E,SAAS,EAAM,EAAiB,GAC/B,MAAM,EAAqB,GAAG,EAAE,WAAW,EAAE,OAE7C,IAAK,EAAE,YAAc,EAAE,UACtB,MAAO,CAAE,KAAM,EAAY,UAAW,MAGvC,MAAM,EAAwB,EAAE,UAC1B,EAAwB,EAAE,UAEhC,MAAO,CACN,KAAM,EACN,UAAW,CACV,SAAU,EAAK,SACf,cAAe,GAAG,EAAK,oBAAoB,EAAK,gBAChD,WAAY,KAAK,IAAI,EAAK,WAAY,EAAK,cCxF9C,IAAa,EAA0C,CACtD,oBAAsB,GACrB,aAAa,yCACd,qBAAA,CAAuB,EAAmB,EAAmB,KAC5D,MAAM,EAAkB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EACxC,EAAI,gBAAkB,EAAY,KAGpC,EAAQ,WAAW,EAAI,WAAY,EAAI,aAGpC,GACH,EAAQ,aAAa,EAAyB,EAAa,IAGrD,EAAQ,QAGhB,mBAAA,CAA4B,GAC3B,OAAO,EACN,EAAS,cACT,CAAC,EAAe,EAAU,gBAC1B,IACA,CAAE,SAAU,EAAU,SAAU,gBAAiB,KAInD,mBAAA,CAA4B,GAC3B,OAAO,EACN,EAAS,aACT,CAAC,EAAe,IAChB,KAIF,oBAAA,CAA6B,GAC5B,IAAI,EAAY,EACZ,EAAY,EAChB,MAAM,EAAsB,GAE5B,IAAK,MAAM,KAAW,EACjB,EAAQ,WACX,IACK,EAAU,SAAS,EAAQ,UAAU,WACzC,EAAU,KAAK,EAAQ,UAAU,WAGlC,IAIF,KAAK,SAAS,SAAS,KAAK,OAAO,qBAAqB,EAAW,EAAW"}
@@ -1,2 +0,0 @@
1
- import{_ as t,m as r}from"./Commands-C7zBYmhA.mjs";import{i as e}from"./TypeBrands-BZDKMjR-.mjs";import{i as s}from"./PluginHelpers-Db50-BRE.mjs";import{t as o}from"./ShortcutFormatting-DE6B8iGs.mjs";var i={label:"Strikethrough",tooltip:t=>`Strikethrough (${t})`},a=/* @__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BXeE6tKj.mjs"),"./locales/de.ts":()=>import("./de-BqHw2LVH.mjs"),"./locales/es.ts":()=>import("./es-2U-tuiWo.mjs"),"./locales/fr.ts":()=>import("./fr-aDJE54Is.mjs"),"./locales/hi.ts":()=>import("./hi-BGMkRr1l.mjs"),"./locales/pt.ts":()=>import("./pt-BYsPmDNG.mjs"),"./locales/ru.ts":()=>import("./ru-VAZhjO4q.mjs"),"./locales/zh.ts":()=>import("./zh-Dj5jzeIJ.mjs")});async function l(t){if("en"===t)return i;const r=a[`./locales/${t}.ts`];if(!r)return i;try{return(await r()).default}catch{return i}}var m={},h=class{id="strikethrough";name="Strikethrough";priority=22;config;locale;constructor(t){this.config={...m,...t}}async init(t){this.locale=await s(t,this.config.locale,i,l),this.registerMarkSpec(t),this.registerCommand(t),this.registerKeymap(t),this.registerToolbarItem(t)}registerMarkSpec(t){t.registerMarkSpec({type:"strikethrough",rank:3,toDOM:()=>document.createElement("s"),toHTMLString:(t,r)=>`<s>${r}</s>`,parseHTML:[{tag:"s"},{tag:"strike"},{tag:"del"},{tag:"span",getAttrs:t=>!!t.style.textDecoration.includes("line-through")&&{}}],sanitize:{tags:["s"]}})}registerCommand(r){r.registerCommand("toggleStrikethrough",()=>{const s=t(r.getState(),e("strikethrough"));return!!s&&(r.dispatch(s),!0)})}registerKeymap(t){t.registerKeymap({"Mod-Shift-X":()=>t.executeCommand("toggleStrikethrough")})}registerToolbarItem(t){t.registerToolbarItem({id:"strikethrough",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(o("Mod-Shift-X")),command:"toggleStrikethrough",isActive:t=>r(t,e("strikethrough"))})}};export{i as n,l as r,h as t};
2
- //# sourceMappingURL=StrikethroughPlugin-J5eDn_sY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StrikethroughPlugin-J5eDn_sY.mjs","names":[],"sources":["../../src/plugins/strikethrough/StrikethroughLocale.ts","../../src/plugins/strikethrough/StrikethroughPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the StrikethroughPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface StrikethroughLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const STRIKETHROUGH_LOCALE_EN: StrikethroughLocale = {\n\tlabel: 'Strikethrough',\n\ttooltip: (shortcut: string) => `Strikethrough (${shortcut})`,\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: Record<string, () => Promise<{ default: StrikethroughLocale }>> =\n\timport.meta.glob<{ default: StrikethroughLocale }>('./locales/*.ts', { eager: false });\n\nexport async function loadStrikethroughLocale(lang: string): Promise<StrikethroughLocale> {\n\tif (lang === 'en') return STRIKETHROUGH_LOCALE_EN;\n\tconst loader = localeModules[`./locales/${lang}.ts`];\n\tif (!loader) return STRIKETHROUGH_LOCALE_EN;\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn STRIKETHROUGH_LOCALE_EN;\n\t}\n}\n","/**\n * StrikethroughPlugin: registers a strikethrough inline mark with MarkSpec,\n * toggle command, keyboard shortcut (Mod-Shift-X), and a toolbar button.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport {\n\tSTRIKETHROUGH_LOCALE_EN,\n\ttype StrikethroughLocale,\n\tloadStrikethroughLocale,\n} from './StrikethroughLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tstrikethrough: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface StrikethroughConfig {\n\treadonly locale?: StrikethroughLocale;\n}\n\nconst DEFAULT_CONFIG: StrikethroughConfig = {};\n\n// --- Plugin ---\n\nexport class StrikethroughPlugin implements Plugin {\n\treadonly id = 'strikethrough';\n\treadonly name = 'Strikethrough';\n\treadonly priority = 22;\n\n\tprivate readonly config: StrikethroughConfig;\n\tprivate locale!: StrikethroughLocale;\n\n\tconstructor(config?: Partial<StrikethroughConfig>) {\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\tSTRIKETHROUGH_LOCALE_EN,\n\t\t\tloadStrikethroughLocale,\n\t\t);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommand(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'strikethrough',\n\t\t\trank: 3,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement('s');\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => `<s>${content}</s>`,\n\t\t\tparseHTML: [\n\t\t\t\t{ tag: 's' },\n\t\t\t\t{ tag: 'strike' },\n\t\t\t\t{ tag: 'del' },\n\t\t\t\t{\n\t\t\t\t\ttag: 'span',\n\t\t\t\t\tgetAttrs: (el: HTMLElement) => {\n\t\t\t\t\t\treturn el.style.textDecoration.includes('line-through') ? {} : false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['s'] },\n\t\t});\n\t}\n\n\tprivate registerCommand(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleStrikethrough', () => {\n\t\t\tconst tr = toggleMark(context.getState(), markType('strikethrough'));\n\t\t\tif (tr) {\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-X': () => context.executeCommand('toggleStrikethrough'),\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=\"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'strikethrough',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift-X')),\n\t\t\tcommand: 'toggleStrikethrough',\n\t\t\tisActive: (state) => isMarkActive(state, markType('strikethrough')),\n\t\t});\n\t}\n}\n"],"mappings":"wMAaA,IAAa,EAA+C,CAC3D,MAAO,gBACP,QAAU,GAAqB,kBAAkB,MAK5C,iBACL,OAAA,OAAA,CAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,qBAAA,kBAAA,IAAA,OAAA,uBAED,eAAsB,EAAwB,GAC7C,GAAa,OAAT,EAAe,OAAO,EAC1B,MAAM,EAAS,EAAc,aAAa,QAC1C,IAAK,EAAQ,OAAO,EACpB,IAEC,aADkB,KACP,cAEX,OAAO,GCDT,IAAM,EAAsC,CAAA,EAI/B,EAAb,MACC,GAAc,gBACd,KAAgB,gBAChB,SAAoB,GAEpB,OACA,OAEA,WAAA,CAAY,GACX,KAAK,OAAS,IAAK,KAAmB,GAGvC,UAAM,CAAK,GACV,KAAK,aAAe,EACnB,EACA,KAAK,OAAO,OACZ,EACA,GAED,KAAK,iBAAiB,GACtB,KAAK,gBAAgB,GACrB,KAAK,eAAe,GACpB,KAAK,oBAAoB,GAG1B,gBAAA,CAAyB,GACxB,EAAQ,iBAAiB,CACxB,KAAM,gBACN,KAAM,EACN,MAAA,IACQ,SAAS,cAAc,KAE/B,aAAA,CAAe,EAAO,IAAY,MAAM,QACxC,UAAW,CACV,CAAE,IAAK,KACP,CAAE,IAAK,UACP,CAAE,IAAK,OACP,CACC,IAAK,OACL,SAAW,KACH,EAAG,MAAM,eAAe,SAAS,iBAAkB,CAAA,IAI7D,SAAU,CAAE,KAAM,CAAC,QAIrB,eAAA,CAAwB,GACvB,EAAQ,gBAAgB,sBAAA,KACvB,MAAM,EAAK,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