@notectl/core 1.0.8 → 1.6.1

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 (269) hide show
  1. package/dist/chunks/{AttrRegistry-D-przlzb.mjs → AttrRegistry-I-VdmRnN.mjs} +2 -2
  2. package/dist/chunks/{AttrRegistry-D-przlzb.mjs.map → AttrRegistry-I-VdmRnN.mjs.map} +1 -1
  3. package/dist/chunks/CaretNavigation-CAJXoaae.mjs +311 -0
  4. package/dist/chunks/CaretNavigation-CAJXoaae.mjs.map +1 -0
  5. package/dist/chunks/ColorNames-BdsHwA2f.mjs +59 -0
  6. package/dist/chunks/ColorNames-BdsHwA2f.mjs.map +1 -0
  7. package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs +125 -0
  8. package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs.map +1 -0
  9. package/dist/chunks/Commands-CicwYoTQ.mjs +286 -0
  10. package/dist/chunks/Commands-CicwYoTQ.mjs.map +1 -0
  11. package/dist/chunks/{Document-CI3iCwEP.mjs → Document-CuwE73FF.mjs} +35 -22
  12. package/dist/chunks/{Document-CI3iCwEP.mjs.map → Document-CuwE73FF.mjs.map} +1 -1
  13. package/dist/chunks/HTMLUtils-DTqQzcKR.mjs +35 -0
  14. package/dist/chunks/HTMLUtils-DTqQzcKR.mjs.map +1 -0
  15. package/dist/chunks/MarkCommands-CC37WA7Z.mjs +94 -0
  16. package/dist/chunks/MarkCommands-CC37WA7Z.mjs.map +1 -0
  17. package/dist/chunks/NavigationUtils-CyW0Vo8A.mjs +47 -0
  18. package/dist/chunks/NavigationUtils-CyW0Vo8A.mjs.map +1 -0
  19. package/dist/chunks/{NodeResolver-D68ZLXti.mjs → NodeResolver-B-wzthAQ.mjs} +2 -2
  20. package/dist/chunks/{NodeResolver-D68ZLXti.mjs.map → NodeResolver-B-wzthAQ.mjs.map} +1 -1
  21. package/dist/chunks/Platform-S_xqIqcM.mjs +26 -0
  22. package/dist/chunks/Platform-S_xqIqcM.mjs.map +1 -0
  23. package/dist/chunks/Selection-DmFDwiPJ.mjs +52 -0
  24. package/dist/chunks/Selection-DmFDwiPJ.mjs.map +1 -0
  25. package/dist/chunks/ToolbarItem-BpZggUGo.mjs +8 -0
  26. package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -0
  27. package/dist/chunks/ToolbarPlugin-B6JETWaw.mjs +818 -0
  28. package/dist/chunks/ToolbarPlugin-B6JETWaw.mjs.map +1 -0
  29. package/dist/chunks/index--z_Txzej.mjs +467 -0
  30. package/dist/chunks/index--z_Txzej.mjs.map +1 -0
  31. package/dist/chunks/{index-o6hDR07y.mjs → index-83QoUENW.mjs} +25 -20
  32. package/dist/chunks/index-83QoUENW.mjs.map +1 -0
  33. package/dist/chunks/{index-CT3HGdQt.mjs → index-B0UFAfyb.mjs} +13 -13
  34. package/dist/chunks/{index-CT3HGdQt.mjs.map → index-B0UFAfyb.mjs.map} +1 -1
  35. package/dist/chunks/{index-C2GQoHot.mjs → index-BDMP86F4.mjs} +40 -40
  36. package/dist/chunks/{index-C2GQoHot.mjs.map → index-BDMP86F4.mjs.map} +1 -1
  37. package/dist/chunks/{index-Bsp4LC5t.mjs → index-BWXkaC2Z.mjs} +36 -36
  38. package/dist/chunks/index-BWXkaC2Z.mjs.map +1 -0
  39. package/dist/chunks/{index-C-YWHOcC.mjs → index-BigJ0z6n.mjs} +22 -22
  40. package/dist/chunks/{index-C-YWHOcC.mjs.map → index-BigJ0z6n.mjs.map} +1 -1
  41. package/dist/chunks/{index-uTnc9y7M.mjs → index-CPjf45-o.mjs} +28 -28
  42. package/dist/chunks/index-CPjf45-o.mjs.map +1 -0
  43. package/dist/chunks/{index-BAk1EG1x.mjs → index-CPyHuEzh.mjs} +106 -106
  44. package/dist/chunks/index-CPyHuEzh.mjs.map +1 -0
  45. package/dist/chunks/{index-Ct0ivLhO.mjs → index-D4GKlc-A.mjs} +256 -259
  46. package/dist/chunks/index-D4GKlc-A.mjs.map +1 -0
  47. package/dist/chunks/{index-BRYzYOYC.mjs → index-D67mP19g.mjs} +29 -29
  48. package/dist/chunks/index-D67mP19g.mjs.map +1 -0
  49. package/dist/chunks/index-D8tbbW97.mjs +73 -0
  50. package/dist/chunks/index-D8tbbW97.mjs.map +1 -0
  51. package/dist/chunks/{index-DC1EK22F.mjs → index-DIAXWwgJ.mjs} +24 -19
  52. package/dist/chunks/index-DIAXWwgJ.mjs.map +1 -0
  53. package/dist/chunks/{index-BSFLNveF.mjs → index-DQryjfJs.mjs} +352 -341
  54. package/dist/chunks/index-DQryjfJs.mjs.map +1 -0
  55. package/dist/chunks/index-DRZwd-1W.mjs +187 -0
  56. package/dist/chunks/index-DRZwd-1W.mjs.map +1 -0
  57. package/dist/chunks/{index-BYgspns5.mjs → index-DUC1X43Z.mjs} +54 -54
  58. package/dist/chunks/index-DUC1X43Z.mjs.map +1 -0
  59. package/dist/chunks/{index-CxiWyUho.mjs → index-DipAT_Q9.mjs} +31 -31
  60. package/dist/chunks/index-DipAT_Q9.mjs.map +1 -0
  61. package/dist/chunks/{index-D3CQWJiw.mjs → index-tBDVaSjG.mjs} +81 -61
  62. package/dist/chunks/index-tBDVaSjG.mjs.map +1 -0
  63. package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +1 -1
  64. package/dist/commands/Commands.d.ts +13 -45
  65. package/dist/commands/Commands.d.ts.map +1 -1
  66. package/dist/commands/DeleteCommands.d.ts +15 -0
  67. package/dist/commands/DeleteCommands.d.ts.map +1 -0
  68. package/dist/commands/GapCursorCommands.d.ts +24 -0
  69. package/dist/commands/GapCursorCommands.d.ts.map +1 -0
  70. package/dist/commands/MarkCommands.d.ts +19 -0
  71. package/dist/commands/MarkCommands.d.ts.map +1 -0
  72. package/dist/commands/MovementCommands.d.ts +27 -0
  73. package/dist/commands/MovementCommands.d.ts.map +1 -0
  74. package/dist/commands/NodeSelectionCommands.d.ts +24 -0
  75. package/dist/commands/NodeSelectionCommands.d.ts.map +1 -0
  76. package/dist/commands/PasteCommand.d.ts.map +1 -1
  77. package/dist/commands/WordBoundary.d.ts +12 -0
  78. package/dist/commands/WordBoundary.d.ts.map +1 -0
  79. package/dist/editor/DocumentSerializer.d.ts.map +1 -1
  80. package/dist/editor/NotectlEditor.d.ts +34 -6
  81. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  82. package/dist/editor/styles/list.d.ts +2 -0
  83. package/dist/editor/styles/list.d.ts.map +1 -1
  84. package/dist/editor/styles/toolbar.d.ts +1 -1
  85. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  86. package/dist/index.d.ts +31 -10
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/input/ClipboardHandler.d.ts +2 -0
  89. package/dist/input/ClipboardHandler.d.ts.map +1 -1
  90. package/dist/input/CompositionTracker.d.ts +14 -0
  91. package/dist/input/CompositionTracker.d.ts.map +1 -0
  92. package/dist/input/FileHandlerRegistry.d.ts +16 -0
  93. package/dist/input/FileHandlerRegistry.d.ts.map +1 -0
  94. package/dist/input/InputHandler.d.ts +8 -4
  95. package/dist/input/InputHandler.d.ts.map +1 -1
  96. package/dist/input/InputRuleRegistry.d.ts +9 -0
  97. package/dist/input/InputRuleRegistry.d.ts.map +1 -0
  98. package/dist/input/KeyboardHandler.d.ts +22 -5
  99. package/dist/input/KeyboardHandler.d.ts.map +1 -1
  100. package/dist/input/Keymap.d.ts +11 -0
  101. package/dist/input/Keymap.d.ts.map +1 -1
  102. package/dist/input/KeymapRegistry.d.ts +19 -0
  103. package/dist/input/KeymapRegistry.d.ts.map +1 -0
  104. package/dist/input/LegacyHTMLNormalizer.d.ts +18 -0
  105. package/dist/input/LegacyHTMLNormalizer.d.ts.map +1 -0
  106. package/dist/input/PasteHandler.d.ts +7 -0
  107. package/dist/input/PasteHandler.d.ts.map +1 -1
  108. package/dist/model/Document.d.ts +8 -0
  109. package/dist/model/Document.d.ts.map +1 -1
  110. package/dist/model/GraphemeUtils.d.ts +20 -0
  111. package/dist/model/GraphemeUtils.d.ts.map +1 -0
  112. package/dist/model/HTMLParser.d.ts +13 -0
  113. package/dist/model/HTMLParser.d.ts.map +1 -1
  114. package/dist/model/HTMLUtils.d.ts +6 -1
  115. package/dist/model/HTMLUtils.d.ts.map +1 -1
  116. package/dist/model/NavigationUtils.d.ts +16 -0
  117. package/dist/model/NavigationUtils.d.ts.map +1 -0
  118. package/dist/model/SchemaRegistry.d.ts +0 -39
  119. package/dist/model/SchemaRegistry.d.ts.map +1 -1
  120. package/dist/model/Selection.d.ts +14 -3
  121. package/dist/model/Selection.d.ts.map +1 -1
  122. package/dist/notectl-core.mjs +2831 -2420
  123. package/dist/notectl-core.mjs.map +1 -1
  124. package/dist/notectl-core.umd.js +3616 -2013
  125. package/dist/notectl-core.umd.js.map +1 -1
  126. package/dist/plugins/Plugin.d.ts +34 -5
  127. package/dist/plugins/Plugin.d.ts.map +1 -1
  128. package/dist/plugins/PluginManager.d.ts +31 -1
  129. package/dist/plugins/PluginManager.d.ts.map +1 -1
  130. package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
  131. package/dist/plugins/alignment.mjs +1 -1
  132. package/dist/plugins/blockquote.mjs +1 -1
  133. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts +35 -0
  134. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts.map +1 -0
  135. package/dist/plugins/caret-navigation/index.d.ts +2 -0
  136. package/dist/plugins/caret-navigation/index.d.ts.map +1 -0
  137. package/dist/plugins/caret-navigation.mjs +5 -0
  138. package/dist/plugins/caret-navigation.mjs.map +1 -0
  139. package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts.map +1 -1
  140. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  141. package/dist/plugins/code-block.mjs +1 -1
  142. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  143. package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
  144. package/dist/plugins/font-size.mjs +1 -1
  145. package/dist/plugins/font.mjs +1 -1
  146. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts +15 -0
  147. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -0
  148. package/dist/plugins/gap-cursor/index.d.ts +2 -0
  149. package/dist/plugins/gap-cursor/index.d.ts.map +1 -0
  150. package/dist/plugins/gap-cursor.mjs +65 -0
  151. package/dist/plugins/gap-cursor.mjs.map +1 -0
  152. package/dist/plugins/hard-break.mjs +1 -1
  153. package/dist/plugins/heading/BlockTypePickerRegistry.d.ts +9 -0
  154. package/dist/plugins/heading/BlockTypePickerRegistry.d.ts.map +1 -0
  155. package/dist/plugins/heading/HeadingBlockTypePicker.d.ts +14 -0
  156. package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -0
  157. package/dist/plugins/heading/HeadingCommands.d.ts +5 -0
  158. package/dist/plugins/heading/HeadingCommands.d.ts.map +1 -0
  159. package/dist/plugins/heading/HeadingInputRules.d.ts +5 -0
  160. package/dist/plugins/heading/HeadingInputRules.d.ts.map +1 -0
  161. package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts +5 -0
  162. package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts.map +1 -0
  163. package/dist/plugins/heading/HeadingPlugin.d.ts +1 -41
  164. package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
  165. package/dist/plugins/heading.mjs +1 -1
  166. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
  167. package/dist/plugins/highlight.mjs +1 -1
  168. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
  169. package/dist/plugins/horizontal-rule.mjs +1 -1
  170. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  171. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  172. package/dist/plugins/image.mjs +1 -1
  173. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  174. package/dist/plugins/link.mjs +1 -1
  175. package/dist/plugins/list/ListPlugin.d.ts +9 -0
  176. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  177. package/dist/plugins/list.mjs +1 -1
  178. package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
  179. package/dist/plugins/print/PrintTypes.d.ts +5 -1
  180. package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
  181. package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -1
  182. package/dist/plugins/shared/ColorValidation.d.ts +7 -0
  183. package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
  184. package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
  185. package/dist/plugins/strikethrough.mjs +1 -1
  186. package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
  187. package/dist/plugins/super-sub.mjs +1 -1
  188. package/dist/plugins/table/TableCommands.d.ts.map +1 -1
  189. package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
  190. package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
  191. package/dist/plugins/table.mjs +1 -1
  192. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
  193. package/dist/plugins/text-color.mjs +1 -1
  194. package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
  195. package/dist/plugins/text-formatting.mjs +1 -1
  196. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
  197. package/dist/plugins/toolbar/ToolbarLocale.d.ts +1 -0
  198. package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -1
  199. package/dist/plugins/toolbar/ToolbarOverflowBehavior.d.ts +23 -0
  200. package/dist/plugins/toolbar/ToolbarOverflowBehavior.d.ts.map +1 -0
  201. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +56 -0
  202. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -0
  203. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +17 -0
  204. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  205. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +12 -0
  206. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -0
  207. package/dist/plugins/toolbar.mjs +2 -2
  208. package/dist/state/EditorState.d.ts.map +1 -1
  209. package/dist/state/History.d.ts.map +1 -1
  210. package/dist/state/ReadonlyGuard.d.ts +6 -0
  211. package/dist/state/ReadonlyGuard.d.ts.map +1 -0
  212. package/dist/state/SelectionTransactions.d.ts +10 -0
  213. package/dist/state/SelectionTransactions.d.ts.map +1 -0
  214. package/dist/state/Transaction.d.ts +4 -0
  215. package/dist/state/Transaction.d.ts.map +1 -1
  216. package/dist/test/TestUtils.d.ts +23 -0
  217. package/dist/test/TestUtils.d.ts.map +1 -1
  218. package/dist/view/CaretNavigation.d.ts +48 -0
  219. package/dist/view/CaretNavigation.d.ts.map +1 -0
  220. package/dist/view/CursorWrapper.d.ts +19 -0
  221. package/dist/view/CursorWrapper.d.ts.map +1 -0
  222. package/dist/view/DomPointUtils.d.ts +20 -0
  223. package/dist/view/DomPointUtils.d.ts.map +1 -0
  224. package/dist/view/EditorView.d.ts +45 -0
  225. package/dist/view/EditorView.d.ts.map +1 -1
  226. package/dist/view/MarkRendering.d.ts +7 -0
  227. package/dist/view/MarkRendering.d.ts.map +1 -0
  228. package/dist/view/NodeViewRegistry.d.ts +9 -0
  229. package/dist/view/NodeViewRegistry.d.ts.map +1 -0
  230. package/dist/view/Platform.d.ts +29 -0
  231. package/dist/view/Platform.d.ts.map +1 -0
  232. package/dist/view/Reconciler.d.ts +4 -0
  233. package/dist/view/Reconciler.d.ts.map +1 -1
  234. package/dist/view/SelectionSync.d.ts +2 -0
  235. package/dist/view/SelectionSync.d.ts.map +1 -1
  236. package/dist/view/ViewMovementCommands.d.ts +40 -0
  237. package/dist/view/ViewMovementCommands.d.ts.map +1 -0
  238. package/package.json +10 -2
  239. package/dist/chunks/ColorNames-iaWsSZx1.mjs +0 -35
  240. package/dist/chunks/ColorNames-iaWsSZx1.mjs.map +0 -1
  241. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs +0 -140
  242. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs.map +0 -1
  243. package/dist/chunks/Commands-CSpSwGXv.mjs +0 -461
  244. package/dist/chunks/Commands-CSpSwGXv.mjs.map +0 -1
  245. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs +0 -7
  246. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs.map +0 -1
  247. package/dist/chunks/Selection-D5ZjXoB7.mjs +0 -44
  248. package/dist/chunks/Selection-D5ZjXoB7.mjs.map +0 -1
  249. package/dist/chunks/ToolbarItem-ugDymuXi.mjs +0 -7
  250. package/dist/chunks/ToolbarItem-ugDymuXi.mjs.map +0 -1
  251. package/dist/chunks/ToolbarPlugin-DY2xaJiu.mjs +0 -368
  252. package/dist/chunks/ToolbarPlugin-DY2xaJiu.mjs.map +0 -1
  253. package/dist/chunks/index-BAk1EG1x.mjs.map +0 -1
  254. package/dist/chunks/index-BRYzYOYC.mjs.map +0 -1
  255. package/dist/chunks/index-BSFLNveF.mjs.map +0 -1
  256. package/dist/chunks/index-BYgspns5.mjs.map +0 -1
  257. package/dist/chunks/index-B_3qDrUN.mjs +0 -64
  258. package/dist/chunks/index-B_3qDrUN.mjs.map +0 -1
  259. package/dist/chunks/index-Bsp4LC5t.mjs.map +0 -1
  260. package/dist/chunks/index-Ct0ivLhO.mjs.map +0 -1
  261. package/dist/chunks/index-CxiWyUho.mjs.map +0 -1
  262. package/dist/chunks/index-D3CQWJiw.mjs.map +0 -1
  263. package/dist/chunks/index-DC1EK22F.mjs.map +0 -1
  264. package/dist/chunks/index-Dh76rR13.mjs +0 -196
  265. package/dist/chunks/index-Dh76rR13.mjs.map +0 -1
  266. package/dist/chunks/index-o6hDR07y.mjs.map +0 -1
  267. package/dist/chunks/index-uTnc9y7M.mjs.map +0 -1
  268. package/dist/input/SourceNormalizer.d.ts +0 -7
  269. package/dist/input/SourceNormalizer.d.ts.map +0 -1
@@ -1,186 +1,188 @@
1
- import { S as t, r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
2
- import { e as n } from "./HTMLUtils-0wvCRvJc.mjs";
1
+ import { S as e, r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
2
+ import { e as n } from "./HTMLUtils-DTqQzcKR.mjs";
3
3
  import { c as i } from "./NodeSpec-NZVvcCuH.mjs";
4
- import { i as r, c as o, b as a } from "./Selection-D5ZjXoB7.mjs";
5
- import { f as s } from "./ToolbarItem-ugDymuXi.mjs";
6
- import { a as l, c, u as d } from "./Document-CI3iCwEP.mjs";
7
- import { n as g } from "./TypeBrands-C09nE2qO.mjs";
8
- function u(t2, e2) {
9
- const n2 = t2.getState(), i2 = n2.selection, o2 = { src: e2.src, alt: e2.alt ?? "", align: e2.align ?? "center", ...void 0 !== e2.width ? { width: e2.width } : {}, ...void 0 !== e2.height ? { height: e2.height } : {} }, s2 = r(i2) ? i2.nodeId : i2.anchor.blockId, u2 = (function(t3, e3) {
10
- const n3 = t3.getBlock(e3);
11
- if ("table_cell" === n3?.type) return e3;
12
- const i3 = t3.getNodePath(e3);
13
- if (i3) for (const e4 of i3) {
14
- const n4 = t3.getBlock(e4);
15
- if ("table_cell" === n4?.type) return e4;
4
+ import { i as r, a as o, c as a, e as s } from "./Selection-DmFDwiPJ.mjs";
5
+ import { f as l } from "./ToolbarItem-BpZggUGo.mjs";
6
+ import { a as c, f as d, u as g } from "./Document-CuwE73FF.mjs";
7
+ import { n as u } from "./TypeBrands-C09nE2qO.mjs";
8
+ function m(e2, t2) {
9
+ const n2 = e2.getState(), i2 = n2.selection, a2 = { src: t2.src, alt: t2.alt ?? "", align: t2.align ?? "center", ...void 0 !== t2.width ? { width: t2.width } : {}, ...void 0 !== t2.height ? { height: t2.height } : {} };
10
+ if (o(i2)) return false;
11
+ const l2 = r(i2) ? i2.nodeId : i2.anchor.blockId, m2 = (function(e3, t3) {
12
+ const n3 = e3.getBlock(t3);
13
+ if ("table_cell" === n3?.type) return t3;
14
+ const i3 = e3.getNodePath(t3);
15
+ if (i3) for (const t4 of i3) {
16
+ const n4 = e3.getBlock(t4);
17
+ if ("table_cell" === n4?.type) return t4;
16
18
  }
17
- })(n2, s2);
18
- return u2 ? (function(t3, e3, n3, i3) {
19
- const r2 = t3.getNodePath(n3);
19
+ })(n2, l2);
20
+ return m2 ? (function(e3, t3, n3, i3) {
21
+ const r2 = e3.getNodePath(n3);
20
22
  if (!r2) return false;
21
- const o3 = c(g("image"), [], void 0, i3), s3 = t3.getBlock(n3);
22
- if (!s3) return false;
23
- const u3 = t3.transaction("command"), m2 = d(s3);
24
- for (let t4 = m2.length - 1; t4 >= 0; t4--) {
25
- const e4 = s3.children.findIndex((e5) => l(e5) && e5.id === m2[t4]?.id);
26
- -1 !== e4 && u3.removeNode(r2, e4);
23
+ const o2 = d(u("image"), [], void 0, i3), a3 = e3.getBlock(n3);
24
+ if (!a3) return false;
25
+ const l3 = e3.transaction("command"), m3 = g(a3);
26
+ for (let e4 = m3.length - 1; e4 >= 0; e4--) {
27
+ const t4 = a3.children.findIndex((t5) => c(t5) && t5.id === m3[e4]?.id);
28
+ -1 !== t4 && l3.removeNode(r2, t4);
27
29
  }
28
- return u3.insertNode(r2, 0, o3), u3.setSelection(a(o3.id, [...r2, o3.id])), e3.dispatch(u3.build()), true;
29
- })(n2, t2, u2, o2) : (function(t3, e3, n3, i3) {
30
- const r2 = t3.doc.children.findIndex((t4) => t4.id === n3);
30
+ return l3.insertNode(r2, 0, o2), l3.setSelection(s(o2.id, [...r2, o2.id])), t3.dispatch(l3.build()), true;
31
+ })(n2, e2, m2, a2) : (function(e3, t3, n3, i3) {
32
+ const r2 = e3.doc.children.findIndex((e4) => e4.id === n3);
31
33
  if (-1 === r2) return false;
32
- const o3 = c(g("image"), [], void 0, i3), s3 = c(g("paragraph")), l2 = t3.transaction("command").insertNode([], r2 + 1, o3).insertNode([], r2 + 2, s3).setSelection(a(o3.id, [])).build();
33
- return e3.dispatch(l2), true;
34
- })(n2, t2, s2, o2);
34
+ const o2 = d(u("image"), [], void 0, i3), a3 = d(u("paragraph")), l3 = e3.transaction("command").insertNode([], r2 + 1, o2).insertNode([], r2 + 2, a3).setSelection(s(o2.id, [])).build();
35
+ return t3.dispatch(l3), true;
36
+ })(n2, e2, l2, a2);
35
37
  }
36
- function m(t2, e2, n2) {
37
- const i2 = t2.getState(), o2 = i2.selection;
38
+ function p(e2, t2, n2) {
39
+ const i2 = e2.getState(), o2 = i2.selection;
38
40
  if (!r(o2)) return false;
39
41
  const a2 = i2.getBlock(o2.nodeId);
40
42
  if (!a2 || "image" !== a2.type) return false;
41
43
  const s2 = a2.attrs?.width, l2 = a2.attrs?.height;
42
44
  if (void 0 === s2 || void 0 === l2) return false;
43
- const c2 = l2 > 0 ? s2 / l2 : 1, d2 = Math.max(50, Math.min(n2, s2 + e2)), g2 = Math.round(d2 / c2);
44
- return (d2 !== s2 || g2 !== l2) && (function(t3, e3) {
45
- const n3 = t3.getState(), i3 = n3.selection;
45
+ const c2 = l2 > 0 ? s2 / l2 : 1, d2 = Math.max(50, Math.min(n2, s2 + t2)), g2 = Math.round(d2 / c2);
46
+ return (d2 !== s2 || g2 !== l2) && (function(e3, t3) {
47
+ const n3 = e3.getState(), i3 = n3.selection;
46
48
  if (!r(i3)) return false;
47
49
  const o3 = n3.getBlock(i3.nodeId);
48
50
  if (!o3 || "image" !== o3.type) return false;
49
51
  const a3 = n3.getNodePath(i3.nodeId);
50
52
  if (!a3) return false;
51
- const s3 = { ...o3.attrs ?? {}, ...e3 }, l3 = n3.transaction("command").setNodeAttr(a3, s3).build();
52
- return t3.dispatch(l3), true;
53
- })(t2, { width: d2, height: g2 });
53
+ const s3 = { ...o3.attrs ?? {}, ...t3 }, l3 = n3.transaction("command").setNodeAttr(a3, s3).build();
54
+ return e3.dispatch(l3), true;
55
+ })(e2, { width: d2, height: g2 });
54
56
  }
55
- const p = { insertImage: "Insert Image", insertImageTooltip: "Insert Image", uploadFromComputer: "Upload from computer", uploadAria: "Upload image from computer", separator: "or", urlPlaceholder: "https://...", urlAria: "Image URL", insertButton: "Insert", insertAria: "Insert image", imageAria: (t2, e2, n2) => {
56
- const i2 = [t2 || "Image"];
57
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} by ${n2} pixels`), i2.join(", ");
58
- }, resetToNaturalSize: "Image reset to natural size.", uploadFailed: "Image upload failed." }, h = { en: p, de: { insertImage: "Bild einfügen", insertImageTooltip: "Bild einfügen", uploadFromComputer: "Vom Computer hochladen", uploadAria: "Bild vom Computer hochladen", separator: "oder", urlPlaceholder: "https://...", urlAria: "Bild-URL", insertButton: "Einfügen", insertAria: "Bild einfügen", imageAria: (t2, e2, n2) => {
59
- const i2 = [t2 || "Bild"];
60
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} mal ${n2} Pixel`), i2.join(", ");
61
- }, resetToNaturalSize: "Bild auf Originalgröße zurückgesetzt.", uploadFailed: "Bild-Upload fehlgeschlagen." }, es: { insertImage: "Insertar imagen", insertImageTooltip: "Insertar imagen", uploadFromComputer: "Subir desde el ordenador", uploadAria: "Subir imagen desde el ordenador", separator: "o", urlPlaceholder: "https://...", urlAria: "URL de la imagen", insertButton: "Insertar", insertAria: "Insertar imagen", imageAria: (t2, e2, n2) => {
62
- const i2 = [t2 || "Imagen"];
63
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} por ${n2} píxeles`), i2.join(", ");
64
- }, resetToNaturalSize: "Imagen restablecida a tamaño natural.", uploadFailed: "Error al subir la imagen." }, fr: { insertImage: "Insérer une image", insertImageTooltip: "Insérer une image", uploadFromComputer: "Télécharger depuis l’ordinateur", uploadAria: "Télécharger une image depuis l’ordinateur", separator: "ou", urlPlaceholder: "https://...", urlAria: "URL de l’image", insertButton: "Insérer", insertAria: "Insérer une image", imageAria: (t2, e2, n2) => {
65
- const i2 = [t2 || "Image"];
66
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} par ${n2} pixels`), i2.join(", ");
67
- }, resetToNaturalSize: "Image rétablie à sa taille d’origine.", uploadFailed: "Échec du téléchargement de l’image." }, zh: { insertImage: "插入图片", insertImageTooltip: "插入图片", uploadFromComputer: "从电脑上传", uploadAria: "从电脑上传图片", separator: "或", urlPlaceholder: "https://...", urlAria: "图片链接", insertButton: "插入", insertAria: "插入图片", imageAria: (t2, e2, n2) => {
68
- const i2 = [t2 || "图片"];
69
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} x ${n2} 像素`), i2.join(",");
70
- }, resetToNaturalSize: "图片已恢复原始大小。", uploadFailed: "图片上传失败。" }, ru: { insertImage: "Вставить изображение", insertImageTooltip: "Вставить изображение", uploadFromComputer: "Загрузить с компьютера", uploadAria: "Загрузить изображение с компьютера", separator: "или", urlPlaceholder: "https://...", urlAria: "URL изображения", insertButton: "Вставить", insertAria: "Вставить изображение", imageAria: (t2, e2, n2) => {
71
- const i2 = [t2 || "Изображение"];
72
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} на ${n2} пикселей`), i2.join(", ");
73
- }, resetToNaturalSize: "Изображение сброшено до исходного размера.", uploadFailed: "Ошибка загрузки изображения." }, ar: { insertImage: "إدراج صورة", insertImageTooltip: "إدراج صورة", uploadFromComputer: "رفع من الحاسوب", uploadAria: "رفع صورة من الحاسوب", separator: "أو", urlPlaceholder: "https://...", urlAria: "رابط الصورة", insertButton: "إدراج", insertAria: "إدراج صورة", imageAria: (t2, e2, n2) => {
74
- const i2 = [t2 || "صورة"];
75
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} × ${n2} بكسل`), i2.join("، ");
76
- }, resetToNaturalSize: "تمت إعادة الصورة إلى حجمها الطبيعي.", uploadFailed: "فشل رفع الصورة." }, hi: { insertImage: "चित्र डालें", insertImageTooltip: "चित्र डालें", uploadFromComputer: "कंप्यूटर से अपलोड करें", uploadAria: "कंप्यूटर से चित्र अपलोड करें", separator: "या", urlPlaceholder: "https://...", urlAria: "चित्र URL", insertButton: "डालें", insertAria: "चित्र डालें", imageAria: (t2, e2, n2) => {
77
- const i2 = [t2 || "चित्र"];
78
- return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} x ${n2} पिक्सेल`), i2.join(", ");
79
- }, resetToNaturalSize: "चित्र मूल आकार में पुनर्स्थापित।", uploadFailed: "चित्र अपलोड विफल।" } }, f = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }, b = { nw: "nwse-resize", ne: "nesw-resize", sw: "nesw-resize", se: "nwse-resize" }, v = { nw: -1, ne: 1, sw: -1, se: 1 }, x = { nw: "Resize top-left", ne: "Resize top-right", sw: "Resize bottom-left", se: "Resize bottom-right" };
80
- let y = null;
81
- function I() {
82
- y && (y.remove(), y = null);
57
+ const h = { insertImage: "Insert Image", insertImageTooltip: "Insert Image", uploadFromComputer: "Upload from computer", uploadAria: "Upload image from computer", separator: "or", urlPlaceholder: "https://...", urlAria: "Image URL", insertButton: "Insert", insertAria: "Insert image", imageAria: (e2, t2, n2) => {
58
+ const i2 = [e2 || "Image"];
59
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} by ${n2} pixels`), i2.join(", ");
60
+ }, resetToNaturalSize: "Image reset to natural size.", uploadFailed: "Image upload failed." }, f = { en: h, de: { insertImage: "Bild einfügen", insertImageTooltip: "Bild einfügen", uploadFromComputer: "Vom Computer hochladen", uploadAria: "Bild vom Computer hochladen", separator: "oder", urlPlaceholder: "https://...", urlAria: "Bild-URL", insertButton: "Einfügen", insertAria: "Bild einfügen", imageAria: (e2, t2, n2) => {
61
+ const i2 = [e2 || "Bild"];
62
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} mal ${n2} Pixel`), i2.join(", ");
63
+ }, resetToNaturalSize: "Bild auf Originalgröße zurückgesetzt.", uploadFailed: "Bild-Upload fehlgeschlagen." }, es: { insertImage: "Insertar imagen", insertImageTooltip: "Insertar imagen", uploadFromComputer: "Subir desde el ordenador", uploadAria: "Subir imagen desde el ordenador", separator: "o", urlPlaceholder: "https://...", urlAria: "URL de la imagen", insertButton: "Insertar", insertAria: "Insertar imagen", imageAria: (e2, t2, n2) => {
64
+ const i2 = [e2 || "Imagen"];
65
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} por ${n2} píxeles`), i2.join(", ");
66
+ }, resetToNaturalSize: "Imagen restablecida a tamaño natural.", uploadFailed: "Error al subir la imagen." }, fr: { insertImage: "Insérer une image", insertImageTooltip: "Insérer une image", uploadFromComputer: "Télécharger depuis l’ordinateur", uploadAria: "Télécharger une image depuis l’ordinateur", separator: "ou", urlPlaceholder: "https://...", urlAria: "URL de l’image", insertButton: "Insérer", insertAria: "Insérer une image", imageAria: (e2, t2, n2) => {
67
+ const i2 = [e2 || "Image"];
68
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} par ${n2} pixels`), i2.join(", ");
69
+ }, resetToNaturalSize: "Image rétablie à sa taille d’origine.", uploadFailed: "Échec du téléchargement de l’image." }, zh: { insertImage: "插入图片", insertImageTooltip: "插入图片", uploadFromComputer: "从电脑上传", uploadAria: "从电脑上传图片", separator: "或", urlPlaceholder: "https://...", urlAria: "图片链接", insertButton: "插入", insertAria: "插入图片", imageAria: (e2, t2, n2) => {
70
+ const i2 = [e2 || "图片"];
71
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} x ${n2} 像素`), i2.join(",");
72
+ }, resetToNaturalSize: "图片已恢复原始大小。", uploadFailed: "图片上传失败。" }, ru: { insertImage: "Вставить изображение", insertImageTooltip: "Вставить изображение", uploadFromComputer: "Загрузить с компьютера", uploadAria: "Загрузить изображение с компьютера", separator: "или", urlPlaceholder: "https://...", urlAria: "URL изображения", insertButton: "Вставить", insertAria: "Вставить изображение", imageAria: (e2, t2, n2) => {
73
+ const i2 = [e2 || "Изображение"];
74
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} на ${n2} пикселей`), i2.join(", ");
75
+ }, resetToNaturalSize: "Изображение сброшено до исходного размера.", uploadFailed: "Ошибка загрузки изображения." }, ar: { insertImage: "إدراج صورة", insertImageTooltip: "إدراج صورة", uploadFromComputer: "رفع من الحاسوب", uploadAria: "رفع صورة من الحاسوب", separator: "أو", urlPlaceholder: "https://...", urlAria: "رابط الصورة", insertButton: "إدراج", insertAria: "إدراج صورة", imageAria: (e2, t2, n2) => {
76
+ const i2 = [e2 || "صورة"];
77
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} × ${n2} بكسل`), i2.join("، ");
78
+ }, resetToNaturalSize: "تمت إعادة الصورة إلى حجمها الطبيعي.", uploadFailed: "فشل رفع الصورة." }, hi: { insertImage: "चित्र डालें", insertImageTooltip: "चित्र डालें", uploadFromComputer: "कंप्यूटर से अपलोड करें", uploadAria: "कंप्यूटर से चित्र अपलोड करें", separator: "या", urlPlaceholder: "https://...", urlAria: "चित्र URL", insertButton: "डालें", insertAria: "चित्र डालें", imageAria: (e2, t2, n2) => {
79
+ const i2 = [e2 || "चित्र"];
80
+ return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} x ${n2} पिक्सेल`), i2.join(", ");
81
+ }, resetToNaturalSize: "चित्र मूल आकार में पुनर्स्थापित।", uploadFailed: "चित्र अपलोड विफल।" } }, b = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }, v = { nw: "nwse-resize", ne: "nesw-resize", sw: "nesw-resize", se: "nwse-resize" }, x = { nw: -1, ne: 1, sw: -1, se: 1 }, y = { nw: "Resize top-left", ne: "Resize top-right", sw: "Resize bottom-left", se: "Resize bottom-right" };
82
+ let I = null;
83
+ function z() {
84
+ I && (I.remove(), I = null);
83
85
  }
84
- function z(t2, e2, n2) {
86
+ function w(e2, t2, n2) {
85
87
  return (i2, r2, o2) => {
86
88
  const a2 = document.createElement("figure");
87
89
  a2.className = "notectl-image", a2.setAttribute("data-block-id", i2.id), a2.setAttribute("data-void", "true"), a2.setAttribute("data-selectable", "true");
88
- const l2 = document.createElement("div");
89
- l2.className = "notectl-image__container";
90
+ const s2 = document.createElement("div");
91
+ s2.className = "notectl-image__container";
90
92
  const c2 = document.createElement("img");
91
93
  c2.className = "notectl-image__img", c2.draggable = false;
92
94
  const d2 = document.createElement("div");
93
- d2.className = "notectl-image__overlay", l2.appendChild(c2), l2.appendChild(d2), a2.appendChild(l2);
95
+ d2.className = "notectl-image__overlay", s2.appendChild(c2), s2.appendChild(d2), a2.appendChild(s2);
94
96
  let g2 = i2.id, u2 = null;
95
- function m2(t3) {
96
- const n3 = t3.attrs?.src ?? "", i3 = t3.attrs?.alt ?? "", r3 = t3.attrs?.width, o3 = t3.attrs?.height, s2 = t3.attrs?.align ?? "center";
97
+ function m2(e3) {
98
+ const n3 = e3.attrs?.src ?? "", i3 = e3.attrs?.alt ?? "", r3 = e3.attrs?.width, o3 = e3.attrs?.height, s3 = e3.attrs?.align ?? "center";
97
99
  c2.src !== n3 && (c2.src = n3), c2.alt = i3, c2.style.width = void 0 !== r3 ? `${r3}px` : "", c2.style.height = void 0 !== o3 ? `${o3}px` : "";
98
- for (const t4 of Object.values(f)) a2.classList.remove(t4);
99
- const l3 = f[s2];
100
- l3 && a2.classList.add(l3);
101
- const g3 = e2.get(t3.id) ?? "idle", u3 = "uploading" === g3;
102
- d2.classList.toggle("notectl-image__overlay--uploading", u3), d2.classList.toggle("notectl-image__overlay--error", "error" === g3), d2.textContent = u3 ? "Uploading..." : "error" === g3 ? "Upload failed" : "", u3 ? a2.setAttribute("aria-busy", "true") : a2.removeAttribute("aria-busy"), (function(t4) {
103
- const e3 = t4.attrs?.alt ?? "", n4 = t4.attrs?.width, i4 = t4.attrs?.height, r4 = [];
104
- e3 ? r4.push(e3) : r4.push("Image"), void 0 !== n4 && void 0 !== i4 && r4.push(`${n4} by ${i4} pixels`), a2.setAttribute("aria-label", r4.join(", "));
105
- })(t3);
100
+ for (const e4 of Object.values(b)) a2.classList.remove(e4);
101
+ const l2 = b[s3];
102
+ l2 && a2.classList.add(l2);
103
+ const g3 = t2.get(e3.id) ?? "idle", u3 = "uploading" === g3;
104
+ d2.classList.toggle("notectl-image__overlay--uploading", u3), d2.classList.toggle("notectl-image__overlay--error", "error" === g3), d2.textContent = u3 ? "Uploading..." : "error" === g3 ? "Upload failed" : "", u3 ? a2.setAttribute("aria-busy", "true") : a2.removeAttribute("aria-busy"), (function(e4) {
105
+ const t3 = e4.attrs?.alt ?? "", n4 = e4.attrs?.width, i4 = e4.attrs?.height, r4 = [];
106
+ t3 ? r4.push(t3) : r4.push("Image"), void 0 !== n4 && void 0 !== i4 && r4.push(`${n4} by ${i4} pixels`), a2.setAttribute("aria-label", r4.join(", "));
107
+ })(e3);
106
108
  }
107
109
  m2(i2);
108
110
  let p2 = false;
109
- function h2(e3, n3, i3, s2) {
110
- let l3 = 0, d3 = 0, g3 = 1;
111
- const u3 = (e4) => {
112
- const i4 = e4.clientX - l3, r3 = (o3 = d3 + i4 * v[n3], Math.max(50, Math.min(t2.maxWidth, o3)));
111
+ function h2(t3, n3, i3, s3) {
112
+ let l2 = 0, d3 = 0, g3 = 1;
113
+ const u3 = (t4) => {
114
+ const i4 = t4.clientX - l2, r3 = (o3 = d3 + i4 * x[n3], Math.max(50, Math.min(e2.maxWidth, o3)));
113
115
  var o3;
114
116
  const a3 = Math.round(r3 / g3);
115
- c2.style.width = `${r3}px`, c2.style.height = `${a3}px`, s2.textContent = `${Math.round(r3)} × ${a3}`;
116
- }, m3 = (t3) => {
117
- document.removeEventListener("pointermove", u3), document.removeEventListener("pointerup", m3), a2.classList.remove("notectl-image--resizing"), s2.classList.remove("notectl-image__size-indicator--visible"), I();
118
- const e4 = Math.round(c2.getBoundingClientRect().width), n4 = Math.round(e4 / g3);
119
- !(function(t4, e5, n5) {
120
- const i4 = r2(), a3 = i4.getBlock(t4);
117
+ c2.style.width = `${r3}px`, c2.style.height = `${a3}px`, s3.textContent = `${Math.round(r3)} × ${a3}`;
118
+ }, m3 = (e3) => {
119
+ document.removeEventListener("pointermove", u3), document.removeEventListener("pointerup", m3), a2.classList.remove("notectl-image--resizing"), s3.classList.remove("notectl-image__size-indicator--visible"), z();
120
+ const t4 = Math.round(c2.getBoundingClientRect().width), n4 = Math.round(t4 / g3);
121
+ !(function(e4, t5, n5) {
122
+ const i4 = r2(), a3 = i4.getBlock(e4);
121
123
  if (!a3) return;
122
- const s3 = a3.attrs?.width, l4 = a3.attrs?.height;
123
- if (s3 === e5 && l4 === n5) return;
124
- const c3 = i4.getNodePath(t4);
124
+ const s4 = a3.attrs?.width, l3 = a3.attrs?.height;
125
+ if (s4 === t5 && l3 === n5) return;
126
+ const c3 = i4.getNodePath(e4);
125
127
  if (!c3) return;
126
- const d4 = { ...a3.attrs ?? {}, width: e5, height: n5 }, g4 = i4.transaction("command").setNodeAttr(c3, d4).build();
128
+ const d4 = { ...a3.attrs ?? {}, width: t5, height: n5 }, g4 = i4.transaction("command").setNodeAttr(c3, d4).build();
127
129
  o2(g4);
128
- })(i3, e4, n4), t3.target?.releasePointerCapture?.(t3.pointerId);
130
+ })(i3, t4, n4), e3.target?.releasePointerCapture?.(e3.pointerId);
129
131
  };
130
- e3.addEventListener("pointerdown", (t3) => {
131
- t3.preventDefault(), t3.stopPropagation(), l3 = t3.clientX, d3 = c2.getBoundingClientRect().width;
132
- const e4 = c2.getBoundingClientRect().height;
132
+ t3.addEventListener("pointerdown", (e3) => {
133
+ e3.preventDefault(), e3.stopPropagation(), l2 = e3.clientX, d3 = c2.getBoundingClientRect().width;
134
+ const t4 = c2.getBoundingClientRect().height;
133
135
  var i4;
134
- g3 = e4 > 0 ? d3 / e4 : 1, a2.classList.add("notectl-image--resizing"), s2.textContent = `${Math.round(d3)} × ${Math.round(e4)}`, s2.classList.add("notectl-image__size-indicator--visible"), i4 = b[n3], I(), y = document.createElement("style"), y.textContent = `*{cursor:${i4}!important;user-select:none!important}`, document.head.appendChild(y), t3.target.setPointerCapture(t3.pointerId), document.addEventListener("pointermove", u3), document.addEventListener("pointerup", m3);
136
+ g3 = t4 > 0 ? d3 / t4 : 1, a2.classList.add("notectl-image--resizing"), s3.textContent = `${Math.round(d3)} × ${Math.round(t4)}`, s3.classList.add("notectl-image__size-indicator--visible"), i4 = v[n3], z(), I = document.createElement("style"), I.textContent = `*{cursor:${i4}!important;user-select:none!important}`, document.head.appendChild(I), e3.target.setPointerCapture(e3.pointerId), document.addEventListener("pointermove", u3), document.addEventListener("pointerup", m3);
135
137
  });
136
138
  }
137
- function z2() {
138
- I(), u2 && (u2.remove(), u2 = null);
139
+ function f2() {
140
+ z(), u2 && (u2.remove(), u2 = null);
139
141
  }
140
142
  return c2.addEventListener("load", () => {
141
143
  if (p2) return;
142
- const e3 = r2(), n3 = e3.getBlock(g2);
144
+ const t3 = r2(), n3 = t3.getBlock(g2);
143
145
  if (!n3 || "image" !== n3.type) return;
144
146
  const i3 = void 0 !== n3.attrs?.width, a3 = void 0 !== n3.attrs?.height;
145
147
  if (i3 && a3) return void (p2 = true);
146
- const s2 = c2.naturalWidth, l3 = c2.naturalHeight;
147
- if (0 === s2 || 0 === l3) return;
148
- const d3 = Math.min(s2, t2.maxWidth), u3 = s2 > 0 ? l3 / s2 : 1, m3 = Math.round(d3 * u3), h3 = e3.getNodePath(g2);
148
+ const s3 = c2.naturalWidth, l2 = c2.naturalHeight;
149
+ if (0 === s3 || 0 === l2) return;
150
+ const d3 = Math.min(s3, e2.maxWidth), u3 = s3 > 0 ? l2 / s3 : 1, m3 = Math.round(d3 * u3), h3 = t3.getNodePath(g2);
149
151
  if (!h3) return;
150
- const f2 = { ...n3.attrs ?? {}, width: d3, height: m3 }, b2 = e3.transaction("command").setNodeAttr(h3, f2).build();
152
+ const f3 = { ...n3.attrs ?? {}, width: d3, height: m3 }, b2 = t3.transaction("command").setNodeAttr(h3, f3).build();
151
153
  o2(b2), p2 = true;
152
- }), { dom: a2, contentDOM: null, update: (t3) => "image" === t3.type && (g2 = t3.id, a2.setAttribute("data-block-id", t3.id), m2(t3), true), selectNode() {
153
- a2.classList.add("notectl-image--selected"), (function(e3) {
154
- if (!t2.resizable || u2) return;
154
+ }), { dom: a2, contentDOM: null, update: (e3) => "image" === e3.type && (g2 = e3.id, a2.setAttribute("data-block-id", e3.id), m2(e3), true), selectNode() {
155
+ a2.classList.add("notectl-image--selected"), (function(t3) {
156
+ if (!e2.resizable || u2) return;
155
157
  u2 = document.createElement("div"), u2.className = "notectl-image__resize-overlay", u2.setAttribute("data-notectl-no-print", "");
156
158
  const i3 = document.createElement("div");
157
159
  i3.className = "notectl-image__size-indicator", u2.appendChild(i3);
158
160
  const r3 = ["nw", "ne", "sw", "se"];
159
- for (const t3 of r3) {
161
+ for (const e3 of r3) {
160
162
  const n3 = document.createElement("div");
161
- n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${t3}`, n3.setAttribute("role", "separator"), n3.setAttribute("aria-label", x[t3]), h2(n3, t3, e3, i3), u2.appendChild(n3);
163
+ n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${e3}`, n3.setAttribute("role", "separator"), n3.setAttribute("aria-label", y[e3]), h2(n3, e3, t3, i3), u2.appendChild(n3);
162
164
  }
163
165
  if (n2) {
164
- const t3 = (function(t4) {
165
- const e4 = t4.shrinkWidth ?? null, n3 = t4.growWidth ?? null;
166
- return e4 && n3 ? `${s(e4)} / ${s(n3)} to resize` : "";
166
+ const e3 = (function(e4) {
167
+ const t4 = e4.shrinkWidth ?? null, n3 = e4.growWidth ?? null;
168
+ return t4 && n3 ? `${l(t4)} / ${l(n3)} to resize` : "";
167
169
  })(n2);
168
- if (t3) {
169
- const e4 = document.createElement("div");
170
- e4.className = "notectl-image__keyboard-hint", e4.setAttribute("aria-hidden", "true"), e4.textContent = t3, u2.appendChild(e4);
170
+ if (e3) {
171
+ const t4 = document.createElement("div");
172
+ t4.className = "notectl-image__keyboard-hint", t4.setAttribute("aria-hidden", "true"), t4.textContent = e3, u2.appendChild(t4);
171
173
  }
172
174
  }
173
- l2.appendChild(u2);
175
+ s2.appendChild(u2);
174
176
  })(g2);
175
177
  }, deselectNode() {
176
- a2.classList.remove("notectl-image--selected"), z2();
178
+ a2.classList.remove("notectl-image--selected"), f2();
177
179
  }, destroy() {
178
- z2();
180
+ f2();
179
181
  } };
180
182
  };
181
183
  }
182
- const w = new t("image:upload"), A = { growWidth: "Mod-Shift-ArrowRight", shrinkWidth: "Mod-Shift-ArrowLeft", growWidthLarge: "Mod-Shift-Alt-ArrowRight", shrinkWidthLarge: "Mod-Shift-Alt-ArrowLeft", resetSize: "Mod-Shift-0" }, _ = { maxWidth: 800, maxFileSize: 10485760, acceptedTypes: ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"], resizable: true, resizeStep: 10, resizeStepLarge: 50 };
183
- class S {
184
+ const A = new e("image:upload"), _ = { growWidth: "Mod-Shift-ArrowRight", shrinkWidth: "Mod-Shift-ArrowLeft", growWidthLarge: "Mod-Shift-Alt-ArrowRight", shrinkWidthLarge: "Mod-Shift-Alt-ArrowLeft", resetSize: "Mod-Shift-0" }, S = { maxWidth: 800, maxFileSize: 10485760, acceptedTypes: ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"], resizable: true, resizeStep: 10, resizeStepLarge: 50 };
185
+ class k {
184
186
  id = "image";
185
187
  name = "Image";
186
188
  priority = 45;
@@ -190,162 +192,157 @@ class S {
190
192
  blobUrls = /* @__PURE__ */ new Set();
191
193
  context = null;
192
194
  locale;
193
- constructor(t2) {
194
- this.config = { ..._, ...t2 }, this.resolvedKeymap = { ...A, ...t2?.keymap };
195
+ constructor(e2) {
196
+ this.config = { ...S, ...e2 }, this.resolvedKeymap = { ..._, ...e2?.keymap };
195
197
  }
196
- init(t2) {
197
- this.locale = e(h, t2, this.config.locale), t2.registerStyleSheet("\n/* Image */\n.notectl-image {\n margin: 8px 0;\n user-select: none;\n line-height: 0;\n}\n\n.notectl-image--center {\n text-align: center;\n}\n\n.notectl-image--left {\n text-align: left;\n}\n\n.notectl-image--right {\n text-align: right;\n}\n\n.notectl-image__container {\n display: inline-block;\n position: relative;\n line-height: 0;\n}\n\n.notectl-image__img {\n display: block;\n max-width: 100%;\n border-radius: 4px;\n}\n\n.notectl-image--selected .notectl-image__container {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n border-radius: 6px;\n}\n\n/* Alignment toolbar (appears on image selection) */\n.notectl-image__align-toolbar {\n display: flex;\n gap: 2px;\n position: absolute;\n top: -36px;\n left: 50%;\n transform: translateX(-50%);\n background: var(--notectl-surface-overlay);\n border: 1px solid var(--notectl-border);\n border-radius: 6px;\n padding: 2px;\n box-shadow: 0 2px 8px var(--notectl-shadow);\n z-index: 10;\n}\n\n.notectl-image__align-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n color: var(--notectl-fg);\n}\n\n.notectl-image__align-btn:hover {\n background: var(--notectl-hover-bg);\n}\n\n.notectl-image__align-btn--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n.notectl-image__align-btn svg {\n width: 16px;\n height: 16px;\n fill: currentColor;\n}\n\n/* Upload overlay */\n.notectl-image__overlay {\n position: absolute;\n inset: 0;\n display: none;\n align-items: center;\n justify-content: center;\n background: rgba(255, 255, 255, 0.8);\n border-radius: 4px;\n font-size: 13px;\n color: var(--notectl-fg-muted);\n}\n\n.notectl-image__overlay--uploading {\n display: flex;\n}\n\n.notectl-image__overlay--error {\n display: flex;\n background: var(--notectl-danger-muted);\n color: var(--notectl-danger);\n}\n\n/* Resize overlay + handles */\n.notectl-image__resize-overlay {\n position: absolute;\n inset: 0;\n pointer-events: none;\n}\n\n.notectl-image__resize-handle {\n position: absolute;\n width: 10px;\n height: 10px;\n background: var(--notectl-bg);\n border: 2px solid var(--notectl-primary);\n border-radius: 50%;\n pointer-events: all;\n z-index: 2;\n transition: transform 0.1s, background 0.1s;\n}\n\n.notectl-image__resize-handle:hover {\n background: var(--notectl-primary);\n transform: scale(1.3);\n}\n\n.notectl-image--resizing .notectl-image__resize-handle {\n background: var(--notectl-primary);\n}\n\n.notectl-image__resize-handle--nw {\n top: -5px;\n left: -5px;\n cursor: nwse-resize;\n}\n\n.notectl-image__resize-handle--ne {\n top: -5px;\n right: -5px;\n cursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--sw {\n bottom: -5px;\n left: -5px;\n cursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--se {\n bottom: -5px;\n right: -5px;\n cursor: nwse-resize;\n}\n\n/* Size indicator tooltip */\n.notectl-image__size-indicator {\n position: absolute;\n bottom: -28px;\n left: 50%;\n transform: translateX(-50%);\n padding: 2px 8px;\n background: var(--notectl-tooltip-bg);\n color: var(--notectl-tooltip-fg);\n font-size: 11px;\n font-weight: 500;\n border-radius: 4px;\n white-space: nowrap;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s;\n z-index: 3;\n}\n\n.notectl-image__size-indicator--visible {\n opacity: 1;\n}\n\n/* Keyboard resize hint (shown on selection, hidden during drag) */\n.notectl-image__keyboard-hint {\n display: none;\n position: absolute;\n bottom: -28px;\n left: 50%;\n transform: translateX(-50%);\n padding: 2px 8px;\n font-size: 11px;\n color: var(--notectl-fg-muted);\n white-space: nowrap;\n pointer-events: none;\n z-index: 3;\n}\n\n.notectl-image--selected .notectl-image__keyboard-hint {\n display: block;\n}\n\n.notectl-image--resizing .notectl-image__keyboard-hint {\n display: none;\n}\n\n/* Resizing feedback */\n.notectl-image--resizing .notectl-image__img {\n opacity: 0.85;\n}\n"), this.context = t2, this.registerNodeSpec(t2), this.registerNodeView(t2), (function(t3) {
198
- t3.registerCommand("insertImage", () => u(t3, { src: "" })), t3.registerCommand("removeImage", () => (function(t4) {
199
- const e2 = t4.getState(), n2 = e2.selection;
198
+ init(e2) {
199
+ this.locale = t(f, e2, this.config.locale), e2.registerStyleSheet("\n/* Image */\n.notectl-image {\n margin: 8px 0;\n user-select: none;\n line-height: 0;\n}\n\n.notectl-image--center {\n text-align: center;\n}\n\n.notectl-image--left {\n text-align: left;\n}\n\n.notectl-image--right {\n text-align: right;\n}\n\n.notectl-image__container {\n display: inline-block;\n position: relative;\n line-height: 0;\n}\n\n.notectl-image__img {\n display: block;\n max-width: 100%;\n border-radius: 4px;\n}\n\n.notectl-image--selected .notectl-image__container {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n border-radius: 6px;\n}\n\n/* Alignment toolbar (appears on image selection) */\n.notectl-image__align-toolbar {\n display: flex;\n gap: 2px;\n position: absolute;\n top: -36px;\n left: 50%;\n transform: translateX(-50%);\n background: var(--notectl-surface-overlay);\n border: 1px solid var(--notectl-border);\n border-radius: 6px;\n padding: 2px;\n box-shadow: 0 2px 8px var(--notectl-shadow);\n z-index: 10;\n}\n\n.notectl-image__align-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n color: var(--notectl-fg);\n}\n\n.notectl-image__align-btn:hover {\n background: var(--notectl-hover-bg);\n}\n\n.notectl-image__align-btn--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n.notectl-image__align-btn svg {\n width: 16px;\n height: 16px;\n fill: currentColor;\n}\n\n/* Upload overlay */\n.notectl-image__overlay {\n position: absolute;\n inset: 0;\n display: none;\n align-items: center;\n justify-content: center;\n background: rgba(255, 255, 255, 0.8);\n border-radius: 4px;\n font-size: 13px;\n color: var(--notectl-fg-muted);\n}\n\n.notectl-image__overlay--uploading {\n display: flex;\n}\n\n.notectl-image__overlay--error {\n display: flex;\n background: var(--notectl-danger-muted);\n color: var(--notectl-danger);\n}\n\n/* Resize overlay + handles */\n.notectl-image__resize-overlay {\n position: absolute;\n inset: 0;\n pointer-events: none;\n}\n\n.notectl-image__resize-handle {\n position: absolute;\n width: 10px;\n height: 10px;\n background: var(--notectl-bg);\n border: 2px solid var(--notectl-primary);\n border-radius: 50%;\n pointer-events: all;\n z-index: 2;\n transition: transform 0.1s, background 0.1s;\n}\n\n.notectl-image__resize-handle:hover {\n background: var(--notectl-primary);\n transform: scale(1.3);\n}\n\n.notectl-image--resizing .notectl-image__resize-handle {\n background: var(--notectl-primary);\n}\n\n.notectl-image__resize-handle--nw {\n top: -5px;\n left: -5px;\n cursor: nwse-resize;\n}\n\n.notectl-image__resize-handle--ne {\n top: -5px;\n right: -5px;\n cursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--sw {\n bottom: -5px;\n left: -5px;\n cursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--se {\n bottom: -5px;\n right: -5px;\n cursor: nwse-resize;\n}\n\n/* Size indicator tooltip */\n.notectl-image__size-indicator {\n position: absolute;\n bottom: -28px;\n left: 50%;\n transform: translateX(-50%);\n padding: 2px 8px;\n background: var(--notectl-tooltip-bg);\n color: var(--notectl-tooltip-fg);\n font-size: 11px;\n font-weight: 500;\n border-radius: 4px;\n white-space: nowrap;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s;\n z-index: 3;\n}\n\n.notectl-image__size-indicator--visible {\n opacity: 1;\n}\n\n/* Keyboard resize hint (shown on selection, hidden during drag) */\n.notectl-image__keyboard-hint {\n display: none;\n position: absolute;\n bottom: -28px;\n left: 50%;\n transform: translateX(-50%);\n padding: 2px 8px;\n font-size: 11px;\n color: var(--notectl-fg-muted);\n white-space: nowrap;\n pointer-events: none;\n z-index: 3;\n}\n\n.notectl-image--selected .notectl-image__keyboard-hint {\n display: block;\n}\n\n.notectl-image--resizing .notectl-image__keyboard-hint {\n display: none;\n}\n\n/* Resizing feedback */\n.notectl-image--resizing .notectl-image__img {\n opacity: 0.85;\n}\n"), this.context = e2, this.registerNodeSpec(e2), this.registerNodeView(e2), (function(e3) {
200
+ e3.registerCommand("insertImage", () => m(e3, { src: "" })), e3.registerCommand("removeImage", () => (function(e4) {
201
+ const t2 = e4.getState(), n2 = t2.selection;
200
202
  if (!r(n2)) return false;
201
- const i2 = e2.getBlock(n2.nodeId);
203
+ const i2 = t2.getBlock(n2.nodeId);
202
204
  if (!i2 || "image" !== i2.type) return false;
203
- const a2 = e2.getNodePath(n2.nodeId);
204
- if (!a2 || 0 === a2.length) return false;
205
- const s2 = a2.slice(0, -1);
206
- let c2;
207
- if (0 === s2.length) c2 = e2.doc;
205
+ const o2 = t2.getNodePath(n2.nodeId);
206
+ if (!o2 || 0 === o2.length) return false;
207
+ const s2 = o2.slice(0, -1);
208
+ let l2;
209
+ if (0 === s2.length) l2 = t2.doc;
208
210
  else {
209
- const t5 = s2[s2.length - 1];
210
- c2 = t5 ? e2.getBlock(t5) : void 0;
211
+ const e5 = s2[s2.length - 1];
212
+ l2 = e5 ? t2.getBlock(e5) : void 0;
211
213
  }
212
- if (!c2) return false;
213
- const d2 = c2.children.findIndex((t5) => l(t5) && t5.id === n2.nodeId);
214
+ if (!l2) return false;
215
+ const d2 = l2.children.findIndex((e5) => c(e5) && e5.id === n2.nodeId);
214
216
  if (-1 === d2) return false;
215
- const g2 = (function(t5, e3, n3) {
216
- if (0 === e3.length) {
217
- const e4 = t5.doc.children, i3 = e4.findIndex((t6) => t6.id === n3), r2 = e4[i3 + 1] ?? e4[i3 - 1];
217
+ const g2 = (function(e5, t3, n3) {
218
+ if (0 === t3.length) {
219
+ const t4 = e5.doc.children, i3 = t4.findIndex((e6) => e6.id === n3), r2 = t4[i3 + 1] ?? t4[i3 - 1];
218
220
  return r2?.id;
219
221
  }
220
- return e3[e3.length - 1];
221
- })(e2, s2, n2.nodeId);
222
+ return t3[t3.length - 1];
223
+ })(t2, s2, n2.nodeId);
222
224
  if (!g2) return false;
223
- const u2 = e2.transaction("command").removeNode(s2, d2).setSelection(o(g2, 0)).build();
224
- return t4.dispatch(u2), true;
225
- })(t3));
226
- })(t2), this.registerResizeCommands(t2), this.registerResizeKeymaps(t2), this.registerFileHandler(t2), this.registerToolbarItem(t2);
225
+ const u2 = t2.transaction("command").removeNode(s2, d2).setSelection(a(g2, 0)).build();
226
+ return e4.dispatch(u2), true;
227
+ })(e3));
228
+ })(e2), this.registerResizeCommands(e2), this.registerResizeKeymaps(e2), this.registerFileHandler(e2), this.registerToolbarItem(e2);
227
229
  }
228
230
  destroy() {
229
- for (const t2 of this.blobUrls) URL.revokeObjectURL(t2);
231
+ for (const e2 of this.blobUrls) URL.revokeObjectURL(e2);
230
232
  this.blobUrls.clear(), this.uploadStates.clear(), this.context = null;
231
233
  }
232
- onStateChange(t2, e2, n2) {
234
+ onStateChange(e2, t2, n2) {
233
235
  if (!this.context) return;
234
- for (const t3 of this.uploadStates.keys()) e2.getBlock(t3) || this.uploadStates.delete(t3);
235
- const i2 = this.isImageSelected(t2), r2 = this.isImageSelected(e2);
236
- !i2 && r2 && this.announceImageSelection(e2);
236
+ for (const e3 of this.uploadStates.keys()) t2.getBlock(e3) || this.uploadStates.delete(e3);
237
+ const i2 = this.isImageSelected(e2), r2 = this.isImageSelected(t2);
238
+ !i2 && r2 && this.announceImageSelection(t2);
237
239
  }
238
- registerNodeSpec(t2) {
239
- const e2 = this.locale;
240
- t2.registerNodeSpec({ type: "image", group: "block", isVoid: true, selectable: true, attrs: { src: { default: "" }, alt: { default: "" }, align: { default: "center" } }, toDOM(t3) {
241
- const n2 = i("figure", t3.id);
240
+ registerNodeSpec(e2) {
241
+ const t2 = this.locale;
242
+ e2.registerNodeSpec({ type: "image", group: "block", isVoid: true, selectable: true, attrs: { src: { default: "" }, alt: { default: "" }, align: { default: "center" } }, toDOM(e3) {
243
+ const n2 = i("figure", e3.id);
242
244
  n2.className = "notectl-image", n2.setAttribute("data-void", "true"), n2.setAttribute("data-selectable", "true");
243
245
  const r2 = document.createElement("div");
244
246
  r2.className = "notectl-image__container";
245
- const o2 = t3.attrs?.alt ?? "", a2 = t3.attrs?.width, s2 = t3.attrs?.height, l2 = document.createElement("img");
246
- l2.className = "notectl-image__img", l2.src = t3.attrs?.src ?? "", l2.alt = o2, l2.draggable = false, void 0 !== a2 && (l2.style.width = `${a2}px`), void 0 !== s2 && (l2.style.height = `${s2}px`);
247
- const c2 = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }[t3.attrs?.align ?? "center"];
248
- return c2 && n2.classList.add(c2), n2.setAttribute("aria-label", e2.imageAria(o2, a2, s2)), r2.appendChild(l2), n2.appendChild(r2), n2;
249
- }, toHTML(t3) {
250
- const e3 = n(t3.attrs?.src ?? ""), i2 = n(t3.attrs?.alt ?? ""), r2 = t3.attrs?.width, o2 = t3.attrs?.height, a2 = t3.attrs?.align ?? "center", s2 = (void 0 !== r2 ? ` width="${r2}"` : "") + (void 0 !== o2 ? ` height="${o2}"` : "");
251
- return `<figure class="notectl-image notectl-image--${n(a2)}"><img src="${e3}" alt="${i2}"${s2}></figure>`;
252
- }, parseHTML: [{ tag: "figure", getAttrs(t3) {
253
- const e3 = t3.querySelector("img");
254
- if (!e3) return false;
255
- const n2 = { src: e3.getAttribute("src") ?? "", alt: e3.getAttribute("alt") ?? "", align: "center" }, i2 = e3.getAttribute("width"), r2 = e3.getAttribute("height");
256
- return i2 && (n2.width = Number.parseInt(i2, 10)), r2 && (n2.height = Number.parseInt(r2, 10)), t3.classList.contains("notectl-image--left") && (n2.align = "left"), t3.classList.contains("notectl-image--right") && (n2.align = "right"), n2;
257
- } }, { tag: "img", getAttrs(t3) {
258
- const e3 = { src: t3.getAttribute("src") ?? "", alt: t3.getAttribute("alt") ?? "", align: "center" }, n2 = t3.getAttribute("width"), i2 = t3.getAttribute("height");
259
- return n2 && (e3.width = Number.parseInt(n2, 10)), i2 && (e3.height = Number.parseInt(i2, 10)), e3;
247
+ const o2 = e3.attrs?.alt ?? "", a2 = e3.attrs?.width, s2 = e3.attrs?.height, l2 = document.createElement("img");
248
+ l2.className = "notectl-image__img", l2.src = e3.attrs?.src ?? "", l2.alt = o2, l2.draggable = false, void 0 !== a2 && (l2.style.width = `${a2}px`), void 0 !== s2 && (l2.style.height = `${s2}px`);
249
+ const c2 = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }[e3.attrs?.align ?? "center"];
250
+ return c2 && n2.classList.add(c2), n2.setAttribute("aria-label", t2.imageAria(o2, a2, s2)), r2.appendChild(l2), n2.appendChild(r2), n2;
251
+ }, toHTML(e3) {
252
+ const t3 = n(e3.attrs?.src ?? ""), i2 = n(e3.attrs?.alt ?? ""), r2 = e3.attrs?.width, o2 = e3.attrs?.height, a2 = e3.attrs?.align ?? "center", s2 = (void 0 !== r2 ? ` width="${r2}"` : "") + (void 0 !== o2 ? ` height="${o2}"` : "");
253
+ return `<figure class="notectl-image notectl-image--${n(a2)}"><img src="${t3}" alt="${i2}"${s2}></figure>`;
254
+ }, parseHTML: [{ tag: "figure", getAttrs(e3) {
255
+ const t3 = e3.querySelector("img");
256
+ if (!t3) return false;
257
+ const n2 = { src: t3.getAttribute("src") ?? "", alt: t3.getAttribute("alt") ?? "", align: "center" }, i2 = t3.getAttribute("width"), r2 = t3.getAttribute("height");
258
+ return i2 && (n2.width = Number.parseInt(i2, 10)), r2 && (n2.height = Number.parseInt(r2, 10)), e3.classList.contains("notectl-image--left") && (n2.align = "left"), e3.classList.contains("notectl-image--right") && (n2.align = "right"), n2;
259
+ } }, { tag: "img", getAttrs(e3) {
260
+ const t3 = { src: e3.getAttribute("src") ?? "", alt: e3.getAttribute("alt") ?? "", align: "center" }, n2 = e3.getAttribute("width"), i2 = e3.getAttribute("height");
261
+ return n2 && (t3.width = Number.parseInt(n2, 10)), i2 && (t3.height = Number.parseInt(i2, 10)), t3;
260
262
  } }], sanitize: { tags: ["figure", "img"], attrs: ["src", "alt", "width", "height", "class"] } });
261
263
  }
262
- registerNodeView(t2) {
263
- t2.registerNodeView("image", z(this.config, this.uploadStates, this.resolvedKeymap));
264
+ registerNodeView(e2) {
265
+ e2.registerNodeView("image", w(this.config, this.uploadStates, this.resolvedKeymap));
264
266
  }
265
- registerResizeCommands(t2) {
266
- const e2 = this.config.resizeStep ?? 10, n2 = this.config.resizeStepLarge ?? 50, i2 = this.config.maxWidth;
267
- t2.registerCommand("resizeImageGrow", () => {
268
- const n3 = m(t2, e2, i2);
269
- return n3 && this.announceCurrentSize(t2), n3;
270
- }), t2.registerCommand("resizeImageShrink", () => {
271
- const n3 = m(t2, -e2, i2);
272
- return n3 && this.announceCurrentSize(t2), n3;
273
- }), t2.registerCommand("resizeImageGrowLarge", () => {
274
- const e3 = m(t2, n2, i2);
275
- return e3 && this.announceCurrentSize(t2), e3;
276
- }), t2.registerCommand("resizeImageShrinkLarge", () => {
277
- const e3 = m(t2, -n2, i2);
278
- return e3 && this.announceCurrentSize(t2), e3;
279
- }), t2.registerCommand("resetImageSize", () => {
280
- const e3 = (function(t3) {
281
- const e4 = t3.getState(), n3 = e4.selection;
267
+ registerResizeCommands(e2) {
268
+ const t2 = this.config.resizeStep ?? 10, n2 = this.config.resizeStepLarge ?? 50, i2 = this.config.maxWidth;
269
+ e2.registerCommand("resizeImageGrow", () => {
270
+ const n3 = p(e2, t2, i2);
271
+ return n3 && this.announceCurrentSize(e2), n3;
272
+ }), e2.registerCommand("resizeImageShrink", () => {
273
+ const n3 = p(e2, -t2, i2);
274
+ return n3 && this.announceCurrentSize(e2), n3;
275
+ }), e2.registerCommand("resizeImageGrowLarge", () => {
276
+ const t3 = p(e2, n2, i2);
277
+ return t3 && this.announceCurrentSize(e2), t3;
278
+ }), e2.registerCommand("resizeImageShrinkLarge", () => {
279
+ const t3 = p(e2, -n2, i2);
280
+ return t3 && this.announceCurrentSize(e2), t3;
281
+ }), e2.registerCommand("resetImageSize", () => {
282
+ const t3 = (function(e3) {
283
+ const t4 = e3.getState(), n3 = t4.selection;
282
284
  if (!r(n3)) return false;
283
- const i3 = e4.getBlock(n3.nodeId);
285
+ const i3 = t4.getBlock(n3.nodeId);
284
286
  if (!i3 || "image" !== i3.type) return false;
285
- const o2 = e4.getNodePath(n3.nodeId);
287
+ const o2 = t4.getNodePath(n3.nodeId);
286
288
  if (!o2) return false;
287
- const a2 = { ...i3.attrs ?? {} }, s2 = Object.fromEntries(Object.entries(a2).filter(([t4]) => "width" !== t4 && "height" !== t4)), l2 = e4.transaction("command").setNodeAttr(o2, s2).build();
288
- return t3.dispatch(l2), true;
289
- })(t2);
290
- return e3 && t2.announce(this.locale.resetToNaturalSize), e3;
289
+ const a2 = { ...i3.attrs ?? {} }, s2 = Object.fromEntries(Object.entries(a2).filter(([e4]) => "width" !== e4 && "height" !== e4)), l2 = t4.transaction("command").setNodeAttr(o2, s2).build();
290
+ return e3.dispatch(l2), true;
291
+ })(e2);
292
+ return t3 && e2.announce(this.locale.resetToNaturalSize), t3;
291
293
  });
292
294
  }
293
- registerResizeKeymaps(t2) {
294
- const e2 = {}, n2 = { growWidth: "resizeImageGrow", shrinkWidth: "resizeImageShrink", growWidthLarge: "resizeImageGrowLarge", shrinkWidthLarge: "resizeImageShrinkLarge", resetSize: "resetImageSize" };
295
+ registerResizeKeymaps(e2) {
296
+ const t2 = {}, n2 = { growWidth: "resizeImageGrow", shrinkWidth: "resizeImageShrink", growWidthLarge: "resizeImageGrowLarge", shrinkWidthLarge: "resizeImageShrinkLarge", resetSize: "resetImageSize" };
295
297
  for (const [i2, r2] of Object.entries(n2)) {
296
298
  const n3 = this.resolvedKeymap[i2] ?? null;
297
- n3 && (e2[n3] = () => t2.executeCommand(r2));
299
+ n3 && (t2[n3] = () => e2.executeCommand(r2));
298
300
  }
299
- Object.keys(e2).length > 0 && t2.registerKeymap(e2);
301
+ Object.keys(t2).length > 0 && e2.registerKeymap(t2);
300
302
  }
301
- registerFileHandler(t2) {
302
- t2.registerFileHandler("image/*", async (e2, n2) => {
303
- const i2 = e2.filter((t3) => this.isAcceptedType(t3.type));
304
- if (0 === i2.length) return false;
305
- for (const e3 of i2) this.handleFileInsert(t2, e3);
306
- return true;
307
- });
303
+ registerFileHandler(e2) {
304
+ e2.registerFileHandler("image/*", async (t2, n2) => !!this.isAcceptedType(t2.type) && (this.handleFileInsert(e2, t2), true));
308
305
  }
309
- handleFileInsert(t2, e2) {
310
- if (e2.size > this.config.maxFileSize) return;
311
- const n2 = URL.createObjectURL(e2);
312
- if (this.blobUrls.add(n2), !u(t2, { src: n2 })) return URL.revokeObjectURL(n2), void this.blobUrls.delete(n2);
313
- const i2 = t2.getState().selection;
306
+ handleFileInsert(e2, t2) {
307
+ if (t2.size > this.config.maxFileSize) return;
308
+ const n2 = URL.createObjectURL(t2);
309
+ if (this.blobUrls.add(n2), !m(e2, { src: n2 })) return URL.revokeObjectURL(n2), void this.blobUrls.delete(n2);
310
+ const i2 = e2.getState().selection;
314
311
  if (!r(i2)) return;
315
312
  const o2 = i2.nodeId;
316
- this.uploadStates.set(o2, "uploading"), t2.getService(w) ? this.uploadFile(t2, e2, o2, n2) : this.uploadStates.set(o2, "complete");
313
+ this.uploadStates.set(o2, "uploading"), e2.getService(A) ? this.uploadFile(e2, t2, o2, n2) : this.uploadStates.set(o2, "complete");
317
314
  }
318
- async uploadFile(t2, e2, n2, i2) {
319
- const r2 = t2.getService(w);
315
+ async uploadFile(e2, t2, n2, i2) {
316
+ const r2 = e2.getService(A);
320
317
  if (r2) try {
321
- const o2 = await r2.upload(e2);
318
+ const o2 = await r2.upload(t2);
322
319
  this.uploadStates.set(n2, "complete");
323
- const a2 = t2.getState(), s2 = a2.getBlock(n2);
320
+ const a2 = e2.getState(), s2 = a2.getBlock(n2);
324
321
  if (!s2) return;
325
322
  const l2 = a2.getNodePath(n2);
326
323
  if (!l2) return;
327
324
  const c2 = { ...s2.attrs ?? {}, src: o2.url, ...void 0 !== o2.width ? { width: o2.width } : {}, ...void 0 !== o2.height ? { height: o2.height } : {} }, d2 = a2.transaction("command").setNodeAttr(l2, c2).build();
328
- t2.dispatch(d2), URL.revokeObjectURL(i2), this.blobUrls.delete(i2);
325
+ e2.dispatch(d2), URL.revokeObjectURL(i2), this.blobUrls.delete(i2);
329
326
  } catch {
330
- this.uploadStates.set(n2, "error"), t2.announce(this.locale.uploadFailed);
327
+ this.uploadStates.set(n2, "error"), e2.announce(this.locale.uploadFailed);
331
328
  }
332
329
  }
333
- registerToolbarItem(t2) {
334
- t2.registerToolbarItem({ id: "image", group: "insert", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>', label: this.locale.insertImage, tooltip: this.locale.insertImageTooltip, command: "insertImage", priority: 50, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (t3, e2, n2) => {
335
- this.renderImagePopup(t3, e2, n2);
330
+ registerToolbarItem(e2) {
331
+ e2.registerToolbarItem({ id: "image", group: "insert", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>', label: this.locale.insertImage, tooltip: this.locale.insertImageTooltip, command: "insertImage", priority: 50, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (e3, t2, n2) => {
332
+ this.renderImagePopup(e3, t2, n2);
336
333
  } });
337
334
  }
338
- renderImagePopup(t2, e2, n2) {
339
- t2.style.padding = "8px", t2.style.minWidth = "240px";
335
+ renderImagePopup(e2, t2, n2) {
336
+ e2.style.padding = "8px", e2.style.minWidth = "240px";
340
337
  const i2 = document.createElement("input");
341
338
  i2.type = "file", i2.accept = this.config.acceptedTypes.join(","), i2.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;opacity:0;";
342
339
  const r2 = document.createElement("button");
343
- r2.type = "button", r2.textContent = this.locale.uploadFromComputer, r2.setAttribute("aria-label", this.locale.uploadAria), r2.style.cssText = "display:block;width:100%;padding:8px 12px;cursor:pointer;text-align:center;box-sizing:border-box;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-surface-raised);color:var(--notectl-fg);", r2.addEventListener("mousedown", (t3) => {
344
- t3.preventDefault(), t3.stopPropagation(), i2.click();
340
+ r2.type = "button", r2.textContent = this.locale.uploadFromComputer, r2.setAttribute("aria-label", this.locale.uploadAria), r2.style.cssText = "display:block;width:100%;padding:8px 12px;cursor:pointer;text-align:center;box-sizing:border-box;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-surface-raised);color:var(--notectl-fg);", r2.addEventListener("mousedown", (e3) => {
341
+ e3.preventDefault(), e3.stopPropagation(), i2.click();
345
342
  }), i2.addEventListener("change", () => {
346
- const t3 = i2.files?.[0];
347
- t3 && (this.handleFileInsert(e2, t3), n2(), e2.getContainer().focus());
348
- }), t2.appendChild(i2), t2.appendChild(r2);
343
+ const e3 = i2.files?.[0];
344
+ e3 && (this.handleFileInsert(t2, e3), n2(), t2.getContainer().focus());
345
+ }), e2.appendChild(i2), e2.appendChild(r2);
349
346
  const o2 = document.createElement("div");
350
347
  o2.style.cssText = "display:flex;align-items:center;margin:8px 0;color:var(--notectl-fg-muted);font-size:12px;";
351
348
  const a2 = document.createElement("span");
@@ -353,55 +350,55 @@ class S {
353
350
  const s2 = document.createElement("span");
354
351
  s2.textContent = this.locale.separator, s2.style.cssText = "padding:0 8px;";
355
352
  const l2 = document.createElement("span");
356
- l2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);", o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(l2), t2.appendChild(o2);
353
+ l2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);", o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(l2), e2.appendChild(o2);
357
354
  const c2 = document.createElement("input");
358
355
  c2.type = "url", c2.placeholder = this.locale.urlPlaceholder, c2.setAttribute("aria-label", this.locale.urlAria), c2.style.cssText = "width:100%;padding:6px 8px;box-sizing:border-box;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-bg);color:var(--notectl-fg);";
359
356
  const d2 = document.createElement("button");
360
357
  d2.type = "button", d2.textContent = this.locale.insertButton, d2.setAttribute("aria-label", this.locale.insertAria), d2.style.cssText = "width:100%;padding:8px 12px;margin-top:4px;cursor:pointer;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-surface-raised);color:var(--notectl-fg);";
361
358
  const g2 = () => {
362
- const t3 = c2.value.trim();
363
- t3 && (u(e2, { src: t3 }), n2(), e2.getContainer().focus());
359
+ const e3 = c2.value.trim();
360
+ e3 && (m(t2, { src: e3 }), n2(), t2.getContainer().focus());
364
361
  };
365
- d2.addEventListener("mousedown", (t3) => {
366
- t3.preventDefault(), t3.stopPropagation(), g2();
367
- }), c2.addEventListener("keydown", (t3) => {
368
- "Enter" === t3.key && (t3.preventDefault(), g2());
369
- }), t2.appendChild(c2), t2.appendChild(d2), requestAnimationFrame(() => c2.focus());
362
+ d2.addEventListener("mousedown", (e3) => {
363
+ e3.preventDefault(), e3.stopPropagation(), g2();
364
+ }), c2.addEventListener("keydown", (e3) => {
365
+ "Enter" === e3.key && (e3.preventDefault(), g2());
366
+ }), e2.appendChild(c2), e2.appendChild(d2), requestAnimationFrame(() => c2.focus());
370
367
  }
371
- isAcceptedType(t2) {
372
- return this.config.acceptedTypes.some((e2) => e2 === t2 || e2.endsWith("/*") && t2.startsWith(e2.slice(0, -1)));
368
+ isAcceptedType(e2) {
369
+ return this.config.acceptedTypes.some((t2) => t2 === e2 || t2.endsWith("/*") && e2.startsWith(t2.slice(0, -1)));
373
370
  }
374
- isImageSelected(t2) {
375
- const e2 = t2.selection;
376
- if (!r(e2)) return false;
377
- const n2 = t2.getBlock(e2.nodeId);
371
+ isImageSelected(e2) {
372
+ const t2 = e2.selection;
373
+ if (!r(t2)) return false;
374
+ const n2 = e2.getBlock(t2.nodeId);
378
375
  return "image" === n2?.type;
379
376
  }
380
- announceImageSelection(t2) {
377
+ announceImageSelection(e2) {
381
378
  if (!this.context) return;
382
- const e2 = t2.selection;
383
- if (!r(e2)) return;
384
- const n2 = t2.getBlock(e2.nodeId);
379
+ const t2 = e2.selection;
380
+ if (!r(t2)) return;
381
+ const n2 = e2.getBlock(t2.nodeId);
385
382
  if (!n2 || "image" !== n2.type) return;
386
- const i2 = n2.attrs?.alt ?? "", o2 = n2.attrs?.width, a2 = n2.attrs?.height, l2 = ["Image selected."];
387
- i2 && l2.push(`Alt text: ${i2}.`), void 0 !== o2 && void 0 !== a2 && l2.push(`Size: ${o2} by ${a2} pixels.`);
383
+ const i2 = n2.attrs?.alt ?? "", o2 = n2.attrs?.width, a2 = n2.attrs?.height, s2 = ["Image selected."];
384
+ i2 && s2.push(`Alt text: ${i2}.`), void 0 !== o2 && void 0 !== a2 && s2.push(`Size: ${o2} by ${a2} pixels.`);
388
385
  const c2 = this.resolvedKeymap.shrinkWidth ?? null, d2 = this.resolvedKeymap.growWidth ?? null;
389
- c2 && d2 && l2.push(`${s(c2)} / ${s(d2)} to resize.`), this.context.announce(l2.join(" "));
386
+ c2 && d2 && s2.push(`${l(c2)} / ${l(d2)} to resize.`), this.context.announce(s2.join(" "));
390
387
  }
391
- announceCurrentSize(t2) {
392
- const e2 = t2.getState(), n2 = e2.selection;
388
+ announceCurrentSize(e2) {
389
+ const t2 = e2.getState(), n2 = t2.selection;
393
390
  if (!r(n2)) return;
394
- const i2 = e2.getBlock(n2.nodeId);
391
+ const i2 = t2.getBlock(n2.nodeId);
395
392
  if (!i2 || "image" !== i2.type) return;
396
393
  const o2 = i2.attrs?.width, a2 = i2.attrs?.height;
397
- void 0 !== o2 && void 0 !== a2 && t2.announce(`Image resized to ${o2} by ${a2} pixels.`);
394
+ void 0 !== o2 && void 0 !== a2 && e2.announce(`Image resized to ${o2} by ${a2} pixels.`);
398
395
  }
399
396
  }
400
397
  export {
401
- A as D,
402
- h as I,
403
- p as a,
404
- w as b,
405
- S as c
398
+ _ as D,
399
+ f as I,
400
+ h as a,
401
+ A as b,
402
+ k as c
406
403
  };
407
- //# sourceMappingURL=index-Ct0ivLhO.mjs.map
404
+ //# sourceMappingURL=index-D4GKlc-A.mjs.map