@notectl/core 1.7.1 → 1.7.3

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 (182) hide show
  1. package/dist/chunks/{AttrRegistry-Ci0qAvtS.mjs → AttrRegistry-D9Jx_RVb.mjs} +2 -2
  2. package/dist/chunks/{AttrRegistry-Ci0qAvtS.mjs.map → AttrRegistry-D9Jx_RVb.mjs.map} +1 -1
  3. package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs +80 -0
  4. package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs.map +1 -0
  5. package/dist/chunks/{CaretNavigation-qLfeL0So.mjs → CaretNavigation-7JYpIKbs.mjs} +3 -3
  6. package/dist/chunks/{CaretNavigation-qLfeL0So.mjs.map → CaretNavigation-7JYpIKbs.mjs.map} +1 -1
  7. package/dist/chunks/{ColorGrid-BBkN0AOb.mjs → ColorGrid--lBQ7jCK.mjs} +56 -55
  8. package/dist/chunks/ColorGrid--lBQ7jCK.mjs.map +1 -0
  9. package/dist/chunks/{ColorPickerPopup-D3ysvOH-.mjs → ColorPickerPopup-TpIRlXc8.mjs} +15 -15
  10. package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs.map +1 -0
  11. package/dist/chunks/{Document-DfZ1NOjs.mjs → Document-Brtw2jL1.mjs} +6 -6
  12. package/dist/chunks/Document-Brtw2jL1.mjs.map +1 -0
  13. package/dist/chunks/{MarkCommands-uybmkw9l.mjs → MarkCommands-6RUJ4L3r.mjs} +3 -3
  14. package/dist/chunks/MarkCommands-6RUJ4L3r.mjs.map +1 -0
  15. package/dist/chunks/{NodeResolver-CzLmmrph.mjs → NodeResolver-C2XYkeOi.mjs} +2 -2
  16. package/dist/chunks/{NodeResolver-CzLmmrph.mjs.map → NodeResolver-C2XYkeOi.mjs.map} +1 -1
  17. package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +1 -1
  18. package/dist/chunks/PopupPositioning-CgjgAKjp.mjs +34 -0
  19. package/dist/chunks/PopupPositioning-CgjgAKjp.mjs.map +1 -0
  20. package/dist/chunks/RangeIterator-Bh4Vl_6D.mjs +16 -0
  21. package/dist/chunks/{RangeIterator-Bye0UtbY.mjs.map → RangeIterator-Bh4Vl_6D.mjs.map} +1 -1
  22. package/dist/chunks/StyleRuntime-CP4NCwKT.mjs +235 -0
  23. package/dist/chunks/StyleRuntime-CP4NCwKT.mjs.map +1 -0
  24. package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -1
  25. package/dist/chunks/{index-Bt_d4IqB.mjs → index--7pBhSF4.mjs} +74 -73
  26. package/dist/chunks/index--7pBhSF4.mjs.map +1 -0
  27. package/dist/chunks/{index-DayTn6Re.mjs → index-BXCkjDax.mjs} +78 -83
  28. package/dist/chunks/index-BXCkjDax.mjs.map +1 -0
  29. package/dist/chunks/{index-DGKQhSAl.mjs → index-BXtw5PNN.mjs} +2 -2
  30. package/dist/chunks/{index-DGKQhSAl.mjs.map → index-BXtw5PNN.mjs.map} +1 -1
  31. package/dist/chunks/{ToolbarPlugin-B7oJRzpl.mjs → index-BcDRT4K2.mjs} +110 -121
  32. package/dist/chunks/index-BcDRT4K2.mjs.map +1 -0
  33. package/dist/chunks/{index-DoCvDkfj.mjs → index-BjFBWBOC.mjs} +23 -25
  34. package/dist/chunks/index-BjFBWBOC.mjs.map +1 -0
  35. package/dist/chunks/{index-CrKz_IEn.mjs → index-C1opJocO.mjs} +2 -2
  36. package/dist/chunks/{index-CrKz_IEn.mjs.map → index-C1opJocO.mjs.map} +1 -1
  37. package/dist/chunks/{index-CfyS_pgH.mjs → index-CCyqQ0Dz.mjs} +32 -31
  38. package/dist/chunks/index-CCyqQ0Dz.mjs.map +1 -0
  39. package/dist/chunks/{index-E7OgN7hM.mjs → index-Cd3uJLP3.mjs} +2 -2
  40. package/dist/chunks/{index-E7OgN7hM.mjs.map → index-Cd3uJLP3.mjs.map} +1 -1
  41. package/dist/chunks/{index-yhz2qeeh.mjs → index-DSAuGP4n.mjs} +131 -127
  42. package/dist/chunks/index-DSAuGP4n.mjs.map +1 -0
  43. package/dist/chunks/{index-CH1r7DL-.mjs → index-DtRfqsq5.mjs} +211 -210
  44. package/dist/chunks/index-DtRfqsq5.mjs.map +1 -0
  45. package/dist/chunks/{index-CFPP456m.mjs → index-DxbQirny.mjs} +8 -8
  46. package/dist/chunks/{index-CFPP456m.mjs.map → index-DxbQirny.mjs.map} +1 -1
  47. package/dist/chunks/{index-DuRNETFv.mjs → index-ErZ5_a1o.mjs} +3 -3
  48. package/dist/chunks/{index-DuRNETFv.mjs.map → index-ErZ5_a1o.mjs.map} +1 -1
  49. package/dist/chunks/{index-Deag_lVi.mjs → index-WpbK_s_H.mjs} +29 -31
  50. package/dist/chunks/index-WpbK_s_H.mjs.map +1 -0
  51. package/dist/chunks/{index-DIvHQtE2.mjs → index-WrqH1wG8.mjs} +15 -14
  52. package/dist/chunks/index-WrqH1wG8.mjs.map +1 -0
  53. package/dist/chunks/{index-Dy6SllXW.mjs → index-fsVJLutn.mjs} +3 -3
  54. package/dist/chunks/{index-Dy6SllXW.mjs.map → index-fsVJLutn.mjs.map} +1 -1
  55. package/dist/chunks/{index-Ckzqtn5D.mjs → index-fx3KIap3.mjs} +15 -14
  56. package/dist/chunks/index-fx3KIap3.mjs.map +1 -0
  57. package/dist/chunks/{index-DmuuFS5D.mjs → index-oOJo-ywB.mjs} +4 -4
  58. package/dist/chunks/{index-DmuuFS5D.mjs.map → index-oOJo-ywB.mjs.map} +1 -1
  59. package/dist/chunks/{index-CFJFD4lF.mjs → index-toj88jtL.mjs} +19 -18
  60. package/dist/chunks/index-toj88jtL.mjs.map +1 -0
  61. package/dist/commands/AttributedMarkCommands.d.ts.map +1 -1
  62. package/dist/commands/MarkCommands.d.ts +3 -3
  63. package/dist/commands/MarkCommands.d.ts.map +1 -1
  64. package/dist/editor/CSSClassCollector.d.ts +36 -0
  65. package/dist/editor/CSSClassCollector.d.ts.map +1 -0
  66. package/dist/editor/ContentHTMLTypes.d.ts +29 -0
  67. package/dist/editor/ContentHTMLTypes.d.ts.map +1 -0
  68. package/dist/editor/ContentStyleInjector.d.ts +69 -0
  69. package/dist/editor/ContentStyleInjector.d.ts.map +1 -0
  70. package/dist/editor/DocumentParser.d.ts +9 -1
  71. package/dist/editor/DocumentParser.d.ts.map +1 -1
  72. package/dist/editor/DocumentSerializer.d.ts +6 -0
  73. package/dist/editor/DocumentSerializer.d.ts.map +1 -1
  74. package/dist/editor/EditorThemeController.d.ts +3 -0
  75. package/dist/editor/EditorThemeController.d.ts.map +1 -1
  76. package/dist/editor/MarkSerializer.d.ts +7 -0
  77. package/dist/editor/MarkSerializer.d.ts.map +1 -1
  78. package/dist/editor/NotectlEditor.d.ts +13 -3
  79. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  80. package/dist/editor/PaperLayoutController.d.ts.map +1 -1
  81. package/dist/editor/styles/font-select.d.ts +1 -1
  82. package/dist/editor/styles/font-select.d.ts.map +1 -1
  83. package/dist/editor/styles/font-size-select.d.ts +1 -1
  84. package/dist/editor/styles/font-size-select.d.ts.map +1 -1
  85. package/dist/editor/styles/heading-select.d.ts +1 -1
  86. package/dist/editor/styles/heading-select.d.ts.map +1 -1
  87. package/dist/editor/styles/toolbar.d.ts +1 -1
  88. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  89. package/dist/index.d.ts +10 -12
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/input/LegacyHTMLNormalizer.d.ts.map +1 -1
  92. package/dist/model/Document.d.ts +0 -4
  93. package/dist/model/Document.d.ts.map +1 -1
  94. package/dist/model/NodeSpec.d.ts +19 -2
  95. package/dist/model/NodeSpec.d.ts.map +1 -1
  96. package/dist/notectl-core.mjs +613 -477
  97. package/dist/notectl-core.mjs.map +1 -1
  98. package/dist/notectl-core.umd.js +1571 -1225
  99. package/dist/notectl-core.umd.js.map +1 -1
  100. package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
  101. package/dist/plugins/alignment.mjs +1 -1
  102. package/dist/plugins/caret-navigation.mjs +1 -1
  103. package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
  104. package/dist/plugins/code-block/CodeBlockPlugin.d.ts +0 -1
  105. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  106. package/dist/plugins/code-block/index.d.ts +2 -1
  107. package/dist/plugins/code-block/index.d.ts.map +1 -1
  108. package/dist/plugins/code-block.mjs +1 -1
  109. package/dist/plugins/font/FontPlugin.d.ts +0 -1
  110. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  111. package/dist/plugins/font-size/FontSizePlugin.d.ts +0 -2
  112. package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
  113. package/dist/plugins/font-size/FontSizePopup.d.ts +3 -1
  114. package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
  115. package/dist/plugins/font-size.mjs +1 -1
  116. package/dist/plugins/font.mjs +1 -1
  117. package/dist/plugins/gap-cursor.mjs +6 -6
  118. package/dist/plugins/hard-break.mjs +1 -1
  119. package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -1
  120. package/dist/plugins/heading.mjs +1 -1
  121. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
  122. package/dist/plugins/highlight.mjs +1 -1
  123. package/dist/plugins/horizontal-rule.mjs +1 -1
  124. package/dist/plugins/image/ImageNodeView.d.ts.map +1 -1
  125. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  126. package/dist/plugins/image.mjs +1 -1
  127. package/dist/plugins/link.mjs +1 -1
  128. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  129. package/dist/plugins/list.mjs +1 -1
  130. package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
  131. package/dist/plugins/shared/ColorGrid.d.ts.map +1 -1
  132. package/dist/plugins/shared/ColorPickerPopup.d.ts +2 -1
  133. package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
  134. package/dist/plugins/shared/PopupManager.d.ts +12 -2
  135. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  136. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  137. package/dist/plugins/strikethrough.mjs +1 -1
  138. package/dist/plugins/super-sub.mjs +1 -1
  139. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  140. package/dist/plugins/table/TableControls.d.ts.map +1 -1
  141. package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
  142. package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -1
  143. package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
  144. package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
  145. package/dist/plugins/table.mjs +1 -1
  146. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
  147. package/dist/plugins/text-color.mjs +1 -1
  148. package/dist/plugins/text-formatting.mjs +1 -1
  149. package/dist/plugins/toolbar/ToolbarItem.d.ts +3 -2
  150. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
  151. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  152. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +0 -3
  153. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  154. package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -1
  155. package/dist/plugins/toolbar/ToolbarTooltip.d.ts.map +1 -1
  156. package/dist/plugins/toolbar.mjs +2 -2
  157. package/dist/presets/PresetTypes.d.ts +1 -1
  158. package/dist/presets/PresetTypes.d.ts.map +1 -1
  159. package/dist/style/StyleRuntime.d.ts +34 -0
  160. package/dist/style/StyleRuntime.d.ts.map +1 -0
  161. package/dist/view/Reconciler.d.ts.map +1 -1
  162. package/package.json +1 -1
  163. package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs +0 -58
  164. package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs.map +0 -1
  165. package/dist/chunks/ColorGrid-BBkN0AOb.mjs.map +0 -1
  166. package/dist/chunks/ColorPickerPopup-D3ysvOH-.mjs.map +0 -1
  167. package/dist/chunks/Document-DfZ1NOjs.mjs.map +0 -1
  168. package/dist/chunks/MarkCommands-uybmkw9l.mjs.map +0 -1
  169. package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs +0 -30
  170. package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs.map +0 -1
  171. package/dist/chunks/RangeIterator-Bye0UtbY.mjs +0 -16
  172. package/dist/chunks/ToolbarPlugin-B7oJRzpl.mjs.map +0 -1
  173. package/dist/chunks/index-Bt_d4IqB.mjs.map +0 -1
  174. package/dist/chunks/index-CFJFD4lF.mjs.map +0 -1
  175. package/dist/chunks/index-CH1r7DL-.mjs.map +0 -1
  176. package/dist/chunks/index-CfyS_pgH.mjs.map +0 -1
  177. package/dist/chunks/index-Ckzqtn5D.mjs.map +0 -1
  178. package/dist/chunks/index-DIvHQtE2.mjs.map +0 -1
  179. package/dist/chunks/index-DayTn6Re.mjs.map +0 -1
  180. package/dist/chunks/index-Deag_lVi.mjs.map +0 -1
  181. package/dist/chunks/index-DoCvDkfj.mjs.map +0 -1
  182. package/dist/chunks/index-yhz2qeeh.mjs.map +0 -1
@@ -2,13 +2,14 @@ import { S as t, r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
2
2
  import { e as n } from "./HTMLUtils-DTqQzcKR.mjs";
3
3
  import { c as i } from "./NodeSpec-NZVvcCuH.mjs";
4
4
  import { i as r, a as o, d as a, e as s } from "./Selection-BRTab5hO.mjs";
5
- import { f as l } from "./ToolbarItem-BpZggUGo.mjs";
6
- import { b as c, k as d, q as g } from "./Document-DfZ1NOjs.mjs";
7
- import { n as u } from "./TypeBrands-C09nE2qO.mjs";
8
- function m(t2, e2) {
5
+ import { a as l, g as c, s as d, b as g } from "./StyleRuntime-CP4NCwKT.mjs";
6
+ import { f as u } from "./ToolbarItem-BpZggUGo.mjs";
7
+ import { d as m, k as p, q as h } from "./Document-Brtw2jL1.mjs";
8
+ import { n as f } from "./TypeBrands-C09nE2qO.mjs";
9
+ function b(t2, e2) {
9
10
  const n2 = t2.getState(), i2 = n2.selection, a2 = { src: e2.src, alt: e2.alt ?? "", align: e2.align ?? "center", ...void 0 !== e2.width ? { width: e2.width } : {}, ...void 0 !== e2.height ? { height: e2.height } : {} };
10
11
  if (o(i2)) return false;
11
- const l2 = r(i2) ? i2.nodeId : i2.anchor.blockId, m2 = (function(t3, e3) {
12
+ const l2 = r(i2) ? i2.nodeId : i2.anchor.blockId, c2 = (function(t3, e3) {
12
13
  const n3 = t3.getBlock(e3);
13
14
  if ("table_cell" === n3?.type) return e3;
14
15
  const i3 = t3.getNodePath(e3);
@@ -17,25 +18,25 @@ function m(t2, e2) {
17
18
  if ("table_cell" === n4?.type) return e4;
18
19
  }
19
20
  })(n2, l2);
20
- return m2 ? (function(t3, e3, n3, i3) {
21
+ return c2 ? (function(t3, e3, n3, i3) {
21
22
  const r2 = t3.getNodePath(n3);
22
23
  if (!r2) return false;
23
- const o2 = d(u("image"), [], void 0, i3), a3 = t3.getBlock(n3);
24
+ const o2 = p(f("image"), [], void 0, i3), a3 = t3.getBlock(n3);
24
25
  if (!a3) return false;
25
- const l3 = t3.transaction("command"), m3 = g(a3);
26
- for (let t4 = m3.length - 1; t4 >= 0; t4--) {
27
- const e4 = a3.children.findIndex((e5) => c(e5) && e5.id === m3[t4]?.id);
26
+ const l3 = t3.transaction("command"), c3 = h(a3);
27
+ for (let t4 = c3.length - 1; t4 >= 0; t4--) {
28
+ const e4 = a3.children.findIndex((e5) => m(e5) && e5.id === c3[t4]?.id);
28
29
  -1 !== e4 && l3.removeNode(r2, e4);
29
30
  }
30
31
  return l3.insertNode(r2, 0, o2), l3.setSelection(s(o2.id, [...r2, o2.id])), e3.dispatch(l3.build()), true;
31
- })(n2, t2, m2, a2) : (function(t3, e3, n3, i3) {
32
+ })(n2, t2, c2, a2) : (function(t3, e3, n3, i3) {
32
33
  const r2 = t3.doc.children.findIndex((t4) => t4.id === n3);
33
34
  if (-1 === r2) return false;
34
- const o2 = d(u("image"), [], void 0, i3), a3 = d(u("paragraph")), l3 = t3.transaction("command").insertNode([], r2 + 1, o2).insertNode([], r2 + 2, a3).setSelection(s(o2.id, [])).build();
35
+ const o2 = p(f("image"), [], void 0, i3), a3 = p(f("paragraph")), l3 = t3.transaction("command").insertNode([], r2 + 1, o2).insertNode([], r2 + 2, a3).setSelection(s(o2.id, [])).build();
35
36
  return e3.dispatch(l3), true;
36
37
  })(n2, t2, l2, a2);
37
38
  }
38
- function p(t2, e2, n2) {
39
+ function v(t2, e2, n2) {
39
40
  const i2 = t2.getState(), o2 = i2.selection;
40
41
  if (!r(o2)) return false;
41
42
  const a2 = i2.getBlock(o2.nodeId);
@@ -54,10 +55,10 @@ function p(t2, e2, n2) {
54
55
  return t3.dispatch(l3), true;
55
56
  })(t2, { width: d2, height: g2 });
56
57
  }
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: (t2, e2, n2) => {
58
+ const x = { 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) => {
58
59
  const i2 = [t2 || "Image"];
59
60
  return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} 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: (t2, e2, n2) => {
61
+ }, resetToNaturalSize: "Image reset to natural size.", uploadFailed: "Image upload failed." }, I = { en: x, 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) => {
61
62
  const i2 = [t2 || "Bild"];
62
63
  return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} mal ${n2} Pixel`), i2.join(", ");
63
64
  }, 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) => {
@@ -78,111 +79,114 @@ const h = { insertImage: "Insert Image", insertImageTooltip: "Insert Image", upl
78
79
  }, resetToNaturalSize: "تمت إعادة الصورة إلى حجمها الطبيعي.", uploadFailed: "فشل رفع الصورة." }, hi: { insertImage: "चित्र डालें", insertImageTooltip: "चित्र डालें", uploadFromComputer: "कंप्यूटर से अपलोड करें", uploadAria: "कंप्यूटर से चित्र अपलोड करें", separator: "या", urlPlaceholder: "https://...", urlAria: "चित्र URL", insertButton: "डालें", insertAria: "चित्र डालें", imageAria: (t2, e2, n2) => {
79
80
  const i2 = [t2 || "चित्र"];
80
81
  return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} 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);
82
+ }, resetToNaturalSize: "चित्र मूल आकार में पुनर्स्थापित।", uploadFailed: "चित्र अपलोड विफल।" } }, y = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }, z = { nw: "nwse-resize", ne: "nesw-resize", sw: "nesw-resize", se: "nwse-resize" }, w = { nw: -1, ne: 1, sw: -1, se: 1 }, A = { nw: "Resize top-left", ne: "Resize top-right", sw: "Resize bottom-left", se: "Resize bottom-right" };
83
+ let _ = null;
84
+ function S() {
85
+ _ && (_.remove(), _ = null);
85
86
  }
86
- function w(t2, e2, n2) {
87
+ function k(t2, e2, n2) {
87
88
  return (i2, r2, o2) => {
88
89
  const a2 = document.createElement("figure");
89
90
  a2.className = "notectl-image", a2.setAttribute("data-block-id", i2.id), a2.setAttribute("data-void", "true"), a2.setAttribute("data-selectable", "true");
90
91
  const s2 = document.createElement("div");
91
92
  s2.className = "notectl-image__container";
92
- const c2 = document.createElement("img");
93
- c2.className = "notectl-image__img", c2.draggable = false;
94
- const d2 = document.createElement("div");
95
- d2.className = "notectl-image__overlay", s2.appendChild(c2), s2.appendChild(d2), a2.appendChild(s2);
96
- let g2 = i2.id, u2 = null;
97
- function m2(t3) {
93
+ const g2 = document.createElement("img");
94
+ g2.className = "notectl-image__img", g2.draggable = false;
95
+ const m2 = document.createElement("div");
96
+ m2.className = "notectl-image__overlay", s2.appendChild(g2), s2.appendChild(m2), a2.appendChild(s2);
97
+ let p2 = i2.id, h2 = null;
98
+ function f2(t3) {
98
99
  const n3 = t3.attrs?.src ?? "", i3 = t3.attrs?.alt ?? "", r3 = t3.attrs?.width, o3 = t3.attrs?.height, s3 = t3.attrs?.align ?? "center";
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` : "";
100
- for (const t4 of Object.values(b)) a2.classList.remove(t4);
101
- const l2 = b[s3];
102
- l2 && a2.classList.add(l2);
103
- const g3 = e2.get(t3.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(t4) {
100
+ g2.src !== n3 && (g2.src = n3), g2.alt = i3, l(g2, "width", void 0 !== r3 ? `${r3}px` : ""), l(g2, "height", void 0 !== o3 ? `${o3}px` : "");
101
+ for (const t4 of Object.values(y)) a2.classList.remove(t4);
102
+ const c2 = y[s3];
103
+ c2 && a2.classList.add(c2);
104
+ const d2 = e2.get(t3.id) ?? "idle", u2 = "uploading" === d2;
105
+ m2.classList.toggle("notectl-image__overlay--uploading", u2), m2.classList.toggle("notectl-image__overlay--error", "error" === d2), m2.textContent = u2 ? "Uploading..." : "error" === d2 ? "Upload failed" : "", u2 ? a2.setAttribute("aria-busy", "true") : a2.removeAttribute("aria-busy"), (function(t4) {
105
106
  const e3 = t4.attrs?.alt ?? "", n4 = t4.attrs?.width, i4 = t4.attrs?.height, r4 = [];
106
107
  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(", "));
107
108
  })(t3);
108
109
  }
109
- m2(i2);
110
- let p2 = false;
111
- function h2(e3, n3, i3, s3) {
112
- let l2 = 0, d3 = 0, g3 = 1;
113
- const u3 = (e4) => {
114
- const i4 = e4.clientX - l2, r3 = (o3 = d3 + i4 * x[n3], Math.max(50, Math.min(t2.maxWidth, o3)));
110
+ f2(i2);
111
+ let b2 = false;
112
+ function v2(e3, n3, i3, s3) {
113
+ let l2 = 0, u2 = 0, m3 = 1;
114
+ const p3 = (e4) => {
115
+ const i4 = e4.clientX - l2, r3 = (o3 = u2 + i4 * w[n3], Math.max(50, Math.min(t2.maxWidth, o3)));
115
116
  var o3;
116
- const a3 = Math.round(r3 / g3);
117
- c2.style.width = `${r3}px`, c2.style.height = `${a3}px`, s3.textContent = `${Math.round(r3)} × ${a3}`;
118
- }, m3 = (t3) => {
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 e4 = Math.round(c2.getBoundingClientRect().width), n4 = Math.round(e4 / g3);
117
+ const a3 = Math.round(r3 / m3);
118
+ d(g2, { width: `${r3}px`, height: `${a3}px` }), s3.textContent = `${Math.round(r3)} × ${a3}`;
119
+ }, h3 = (t3) => {
120
+ document.removeEventListener("pointermove", p3), document.removeEventListener("pointerup", h3), a2.classList.remove("notectl-image--resizing"), s3.classList.remove("notectl-image__size-indicator--visible"), S();
121
+ const e4 = Math.round(g2.getBoundingClientRect().width), n4 = Math.round(e4 / m3);
121
122
  !(function(t4, e5, n5) {
122
123
  const i4 = r2(), a3 = i4.getBlock(t4);
123
124
  if (!a3) return;
124
125
  const s4 = a3.attrs?.width, l3 = a3.attrs?.height;
125
126
  if (s4 === e5 && l3 === n5) return;
126
- const c3 = i4.getNodePath(t4);
127
- if (!c3) return;
128
- const d4 = { ...a3.attrs ?? {}, width: e5, height: n5 }, g4 = i4.transaction("command").setNodeAttr(c3, d4).build();
129
- o2(g4);
127
+ const c2 = i4.getNodePath(t4);
128
+ if (!c2) return;
129
+ const d2 = { ...a3.attrs ?? {}, width: e5, height: n5 }, g3 = i4.transaction("command").setNodeAttr(c2, d2).build();
130
+ o2(g3);
130
131
  })(i3, e4, n4), t3.target?.releasePointerCapture?.(t3.pointerId);
131
132
  };
132
133
  e3.addEventListener("pointerdown", (t3) => {
133
- t3.preventDefault(), t3.stopPropagation(), l2 = t3.clientX, d3 = c2.getBoundingClientRect().width;
134
- const e4 = c2.getBoundingClientRect().height;
135
- var i4;
136
- g3 = e4 > 0 ? d3 / e4 : 1, a2.classList.add("notectl-image--resizing"), s3.textContent = `${Math.round(d3)} × ${Math.round(e4)}`, 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), t3.target.setPointerCapture(t3.pointerId), document.addEventListener("pointermove", u3), document.addEventListener("pointerup", m3);
134
+ t3.preventDefault(), t3.stopPropagation(), l2 = t3.clientX, u2 = g2.getBoundingClientRect().width;
135
+ const e4 = g2.getBoundingClientRect().height;
136
+ m3 = e4 > 0 ? u2 / e4 : 1, a2.classList.add("notectl-image--resizing"), s3.textContent = `${Math.round(u2)} × ${Math.round(e4)}`, s3.classList.add("notectl-image__size-indicator--visible"), (function(t4, e5) {
137
+ S(), _ = document.createElement("style");
138
+ const n4 = e5 ? c(e5) : void 0;
139
+ n4 && _.setAttribute("nonce", n4), _.textContent = `*{cursor:${t4}!important;user-select:none!important}`, document.head.appendChild(_);
140
+ })(z[n3], a2), t3.target.setPointerCapture(t3.pointerId), document.addEventListener("pointermove", p3), document.addEventListener("pointerup", h3);
137
141
  });
138
142
  }
139
- function f2() {
140
- z(), u2 && (u2.remove(), u2 = null);
143
+ function x2() {
144
+ S(), h2 && (h2.remove(), h2 = null);
141
145
  }
142
- return c2.addEventListener("load", () => {
143
- if (p2) return;
144
- const e3 = r2(), n3 = e3.getBlock(g2);
146
+ return g2.addEventListener("load", () => {
147
+ if (b2) return;
148
+ const e3 = r2(), n3 = e3.getBlock(p2);
145
149
  if (!n3 || "image" !== n3.type) return;
146
150
  const i3 = void 0 !== n3.attrs?.width, a3 = void 0 !== n3.attrs?.height;
147
- if (i3 && a3) return void (p2 = true);
148
- const s3 = c2.naturalWidth, l2 = c2.naturalHeight;
151
+ if (i3 && a3) return void (b2 = true);
152
+ const s3 = g2.naturalWidth, l2 = g2.naturalHeight;
149
153
  if (0 === s3 || 0 === l2) return;
150
- const d3 = Math.min(s3, t2.maxWidth), u3 = s3 > 0 ? l2 / s3 : 1, m3 = Math.round(d3 * u3), h3 = e3.getNodePath(g2);
151
- if (!h3) return;
152
- const f3 = { ...n3.attrs ?? {}, width: d3, height: m3 }, b2 = e3.transaction("command").setNodeAttr(h3, f3).build();
153
- o2(b2), p2 = true;
154
- }), { dom: a2, contentDOM: null, update: (t3) => "image" === t3.type && (g2 = t3.id, a2.setAttribute("data-block-id", t3.id), m2(t3), true), selectNode() {
154
+ const c2 = Math.min(s3, t2.maxWidth), d2 = s3 > 0 ? l2 / s3 : 1, u2 = Math.round(c2 * d2), m3 = e3.getNodePath(p2);
155
+ if (!m3) return;
156
+ const h3 = { ...n3.attrs ?? {}, width: c2, height: u2 }, f3 = e3.transaction("command").setNodeAttr(m3, h3).build();
157
+ o2(f3), b2 = true;
158
+ }), { dom: a2, contentDOM: null, update: (t3) => "image" === t3.type && (p2 = t3.id, a2.setAttribute("data-block-id", t3.id), f2(t3), true), selectNode() {
155
159
  a2.classList.add("notectl-image--selected"), (function(e3) {
156
- if (!t2.resizable || u2) return;
157
- u2 = document.createElement("div"), u2.className = "notectl-image__resize-overlay", u2.setAttribute("data-notectl-no-print", "");
160
+ if (!t2.resizable || h2) return;
161
+ h2 = document.createElement("div"), h2.className = "notectl-image__resize-overlay", h2.setAttribute("data-notectl-no-print", "");
158
162
  const i3 = document.createElement("div");
159
- i3.className = "notectl-image__size-indicator", u2.appendChild(i3);
163
+ i3.className = "notectl-image__size-indicator", h2.appendChild(i3);
160
164
  const r3 = ["nw", "ne", "sw", "se"];
161
165
  for (const t3 of r3) {
162
166
  const n3 = document.createElement("div");
163
- n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${t3}`, n3.setAttribute("role", "separator"), n3.setAttribute("aria-label", y[t3]), h2(n3, t3, e3, i3), u2.appendChild(n3);
167
+ n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${t3}`, n3.setAttribute("role", "separator"), n3.setAttribute("aria-label", A[t3]), v2(n3, t3, e3, i3), h2.appendChild(n3);
164
168
  }
165
169
  if (n2) {
166
170
  const t3 = (function(t4) {
167
171
  const e4 = t4.shrinkWidth ?? null, n3 = t4.growWidth ?? null;
168
- return e4 && n3 ? `${l(e4)} / ${l(n3)} to resize` : "";
172
+ return e4 && n3 ? `${u(e4)} / ${u(n3)} to resize` : "";
169
173
  })(n2);
170
174
  if (t3) {
171
175
  const e4 = document.createElement("div");
172
- e4.className = "notectl-image__keyboard-hint", e4.setAttribute("aria-hidden", "true"), e4.textContent = t3, u2.appendChild(e4);
176
+ e4.className = "notectl-image__keyboard-hint", e4.setAttribute("aria-hidden", "true"), e4.textContent = t3, h2.appendChild(e4);
173
177
  }
174
178
  }
175
- s2.appendChild(u2);
176
- })(g2);
179
+ s2.appendChild(h2);
180
+ })(p2);
177
181
  }, deselectNode() {
178
- a2.classList.remove("notectl-image--selected"), f2();
182
+ a2.classList.remove("notectl-image--selected"), x2();
179
183
  }, destroy() {
180
- f2();
184
+ x2();
181
185
  } };
182
186
  };
183
187
  }
184
- const A = new t("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 {
188
+ const C = new t("image:upload"), L = { growWidth: "Mod-Shift-ArrowRight", shrinkWidth: "Mod-Shift-ArrowLeft", growWidthLarge: "Mod-Shift-Alt-ArrowRight", shrinkWidthLarge: "Mod-Shift-Alt-ArrowLeft", resetSize: "Mod-Shift-0" }, N = { maxWidth: 800, maxFileSize: 10485760, acceptedTypes: ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"], resizable: true, resizeStep: 10, resizeStepLarge: 50 };
189
+ class $ {
186
190
  id = "image";
187
191
  name = "Image";
188
192
  priority = 45;
@@ -193,11 +197,11 @@ class k {
193
197
  context = null;
194
198
  locale;
195
199
  constructor(t2) {
196
- this.config = { ...S, ...t2 }, this.resolvedKeymap = { ..._, ...t2?.keymap };
200
+ this.config = { ...N, ...t2 }, this.resolvedKeymap = { ...L, ...t2?.keymap };
197
201
  }
198
202
  init(t2) {
199
- this.locale = e(f, 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) {
200
- t3.registerCommand("insertImage", () => m(t3, { src: "" })), t3.registerCommand("removeImage", () => (function(t4) {
203
+ this.locale = e(I, 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) {
204
+ t3.registerCommand("insertImage", () => b(t3, { src: "" })), t3.registerCommand("removeImage", () => (function(t4) {
201
205
  const e2 = t4.getState(), n2 = e2.selection;
202
206
  if (!r(n2)) return false;
203
207
  const i2 = e2.getBlock(n2.nodeId);
@@ -212,18 +216,18 @@ class k {
212
216
  l2 = t5 ? e2.getBlock(t5) : void 0;
213
217
  }
214
218
  if (!l2) return false;
215
- const d2 = l2.children.findIndex((t5) => c(t5) && t5.id === n2.nodeId);
216
- if (-1 === d2) return false;
217
- const g2 = (function(t5, e3, n3) {
219
+ const c2 = l2.children.findIndex((t5) => m(t5) && t5.id === n2.nodeId);
220
+ if (-1 === c2) return false;
221
+ const d2 = (function(t5, e3, n3) {
218
222
  if (0 === e3.length) {
219
223
  const e4 = t5.doc.children, i3 = e4.findIndex((t6) => t6.id === n3), r2 = e4[i3 + 1] ?? e4[i3 - 1];
220
224
  return r2?.id;
221
225
  }
222
226
  return e3[e3.length - 1];
223
227
  })(e2, s2, n2.nodeId);
224
- if (!g2) return false;
225
- const u2 = e2.transaction("command").removeNode(s2, d2).setSelection(a(g2, 0)).build();
226
- return t4.dispatch(u2), true;
228
+ if (!d2) return false;
229
+ const g2 = e2.transaction("command").removeNode(s2, c2).setSelection(a(d2, 0)).build();
230
+ return t4.dispatch(g2), true;
227
231
  })(t3));
228
232
  })(t2), this.registerResizeCommands(t2), this.registerResizeKeymaps(t2), this.registerFileHandler(t2), this.registerToolbarItem(t2);
229
233
  }
@@ -244,41 +248,41 @@ class k {
244
248
  n2.className = "notectl-image", n2.setAttribute("data-void", "true"), n2.setAttribute("data-selectable", "true");
245
249
  const r2 = document.createElement("div");
246
250
  r2.className = "notectl-image__container";
247
- const o2 = t3.attrs?.alt ?? "", a2 = t3.attrs?.width, s2 = t3.attrs?.height, l2 = document.createElement("img");
248
- 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`);
249
- const c2 = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }[t3.attrs?.align ?? "center"];
250
- return c2 && n2.classList.add(c2), n2.setAttribute("aria-label", e2.imageAria(o2, a2, s2)), r2.appendChild(l2), n2.appendChild(r2), n2;
251
+ const o2 = t3.attrs?.alt ?? "", a2 = t3.attrs?.width, s2 = t3.attrs?.height, c2 = document.createElement("img");
252
+ c2.className = "notectl-image__img", c2.src = t3.attrs?.src ?? "", c2.alt = o2, c2.draggable = false, void 0 !== a2 && l(c2, "width", `${a2}px`), void 0 !== s2 && l(c2, "height", `${s2}px`);
253
+ const d2 = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }[t3.attrs?.align ?? "center"];
254
+ return d2 && n2.classList.add(d2), n2.setAttribute("aria-label", e2.imageAria(o2, a2, s2)), r2.appendChild(c2), n2.appendChild(r2), n2;
251
255
  }, toHTML(t3) {
252
- 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}"` : "");
253
- return `<figure${a2 ? ` style="text-align: ${n(a2)}"` : ""}><img src="${e3}" alt="${i2}"${s2}></figure>`;
256
+ const e3 = n(t3.attrs?.src ?? ""), i2 = n(t3.attrs?.alt ?? ""), r2 = t3.attrs?.width, o2 = t3.attrs?.height;
257
+ return `<figure><img src="${e3}" alt="${i2}"${(void 0 !== r2 ? ` width="${r2}"` : "") + (void 0 !== o2 ? ` height="${o2}"` : "")}></figure>`;
254
258
  }, parseHTML: [{ tag: "figure", getAttrs(t3) {
255
259
  const e3 = t3.querySelector("img");
256
260
  if (!e3) return false;
257
261
  const n2 = { src: e3.getAttribute("src") ?? "", alt: e3.getAttribute("alt") ?? "", align: "center" }, i2 = e3.getAttribute("width"), r2 = e3.getAttribute("height");
258
262
  i2 && (n2.width = Number.parseInt(i2, 10)), r2 && (n2.height = Number.parseInt(r2, 10));
259
263
  const o2 = t3.style?.textAlign ?? "";
260
- return "left" === o2 || "right" === o2 || "center" === o2 ? n2.align = o2 : t3.classList.contains("notectl-image--left") ? n2.align = "left" : t3.classList.contains("notectl-image--right") && (n2.align = "right"), n2;
264
+ return "left" === o2 || "right" === o2 || "center" === o2 ? n2.align = o2 : t3.classList.contains("notectl-align-left") ? n2.align = "left" : t3.classList.contains("notectl-align-right") ? n2.align = "right" : t3.classList.contains("notectl-align-center") ? n2.align = "center" : t3.classList.contains("notectl-image--left") ? n2.align = "left" : t3.classList.contains("notectl-image--right") && (n2.align = "right"), n2;
261
265
  } }, { tag: "img", getAttrs(t3) {
262
266
  const e3 = { src: t3.getAttribute("src") ?? "", alt: t3.getAttribute("alt") ?? "", align: "center" }, n2 = t3.getAttribute("width"), i2 = t3.getAttribute("height");
263
267
  return n2 && (e3.width = Number.parseInt(n2, 10)), i2 && (e3.height = Number.parseInt(i2, 10)), e3;
264
268
  } }], sanitize: { tags: ["figure", "img"], attrs: ["src", "alt", "width", "height", "class", "style"] } });
265
269
  }
266
270
  registerNodeView(t2) {
267
- t2.registerNodeView("image", w(this.config, this.uploadStates, this.resolvedKeymap));
271
+ t2.registerNodeView("image", k(this.config, this.uploadStates, this.resolvedKeymap));
268
272
  }
269
273
  registerResizeCommands(t2) {
270
274
  const e2 = this.config.resizeStep ?? 10, n2 = this.config.resizeStepLarge ?? 50, i2 = this.config.maxWidth;
271
275
  t2.registerCommand("resizeImageGrow", () => {
272
- const n3 = p(t2, e2, i2);
276
+ const n3 = v(t2, e2, i2);
273
277
  return n3 && this.announceCurrentSize(t2), n3;
274
278
  }), t2.registerCommand("resizeImageShrink", () => {
275
- const n3 = p(t2, -e2, i2);
279
+ const n3 = v(t2, -e2, i2);
276
280
  return n3 && this.announceCurrentSize(t2), n3;
277
281
  }), t2.registerCommand("resizeImageGrowLarge", () => {
278
- const e3 = p(t2, n2, i2);
282
+ const e3 = v(t2, n2, i2);
279
283
  return e3 && this.announceCurrentSize(t2), e3;
280
284
  }), t2.registerCommand("resizeImageShrinkLarge", () => {
281
- const e3 = p(t2, -n2, i2);
285
+ const e3 = v(t2, -n2, i2);
282
286
  return e3 && this.announceCurrentSize(t2), e3;
283
287
  }), t2.registerCommand("resetImageSize", () => {
284
288
  const e3 = (function(t3) {
@@ -308,14 +312,14 @@ class k {
308
312
  handleFileInsert(t2, e2) {
309
313
  if (e2.size > this.config.maxFileSize) return;
310
314
  const n2 = URL.createObjectURL(e2);
311
- if (this.blobUrls.add(n2), !m(t2, { src: n2 })) return URL.revokeObjectURL(n2), void this.blobUrls.delete(n2);
315
+ if (this.blobUrls.add(n2), !b(t2, { src: n2 })) return URL.revokeObjectURL(n2), void this.blobUrls.delete(n2);
312
316
  const i2 = t2.getState().selection;
313
317
  if (!r(i2)) return;
314
318
  const o2 = i2.nodeId;
315
- this.uploadStates.set(o2, "uploading"), t2.getService(A) ? this.uploadFile(t2, e2, o2, n2) : this.uploadStates.set(o2, "complete");
319
+ this.uploadStates.set(o2, "uploading"), t2.getService(C) ? this.uploadFile(t2, e2, o2, n2) : this.uploadStates.set(o2, "complete");
316
320
  }
317
321
  async uploadFile(t2, e2, n2, i2) {
318
- const r2 = t2.getService(A);
322
+ const r2 = t2.getService(C);
319
323
  if (r2) try {
320
324
  const o2 = await r2.upload(e2);
321
325
  this.uploadStates.set(n2, "complete");
@@ -335,37 +339,37 @@ class k {
335
339
  } });
336
340
  }
337
341
  renderImagePopup(t2, e2, n2) {
338
- t2.style.padding = "8px", t2.style.minWidth = "240px";
342
+ l(t2, "padding", "8px"), l(t2, "minWidth", "240px");
339
343
  const i2 = document.createElement("input");
340
- i2.type = "file", i2.accept = this.config.acceptedTypes.join(","), i2.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;opacity:0;";
344
+ i2.type = "file", i2.accept = this.config.acceptedTypes.join(","), g(i2, "position:absolute;width:0;height:0;overflow:hidden;opacity:0;");
341
345
  const r2 = document.createElement("button");
342
- 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) => {
346
+ r2.type = "button", r2.textContent = this.locale.uploadFromComputer, r2.setAttribute("aria-label", this.locale.uploadAria), g(r2, "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) => {
343
347
  t3.preventDefault(), t3.stopPropagation(), i2.click();
344
348
  }), i2.addEventListener("change", () => {
345
349
  const t3 = i2.files?.[0];
346
350
  t3 && (this.handleFileInsert(e2, t3), n2(), e2.getContainer().focus());
347
351
  }), t2.appendChild(i2), t2.appendChild(r2);
348
352
  const o2 = document.createElement("div");
349
- o2.style.cssText = "display:flex;align-items:center;margin:8px 0;color:var(--notectl-fg-muted);font-size:12px;";
353
+ g(o2, "display:flex;align-items:center;margin:8px 0;color:var(--notectl-fg-muted);font-size:12px;");
350
354
  const a2 = document.createElement("span");
351
- a2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);";
355
+ g(a2, "flex:1;height:1px;background:var(--notectl-border);");
352
356
  const s2 = document.createElement("span");
353
- s2.textContent = this.locale.separator, s2.style.cssText = "padding:0 8px;";
354
- const l2 = document.createElement("span");
355
- l2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);", o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(l2), t2.appendChild(o2);
356
- const c2 = document.createElement("input");
357
- 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);";
358
- const d2 = document.createElement("button");
359
- 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);";
360
- const g2 = () => {
361
- const t3 = c2.value.trim();
362
- t3 && (m(e2, { src: t3 }), n2(), e2.getContainer().focus());
357
+ s2.textContent = this.locale.separator, g(s2, "padding:0 8px;");
358
+ const c2 = document.createElement("span");
359
+ g(c2, "flex:1;height:1px;background:var(--notectl-border);"), o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(c2), t2.appendChild(o2);
360
+ const d2 = document.createElement("input");
361
+ d2.type = "url", d2.placeholder = this.locale.urlPlaceholder, d2.setAttribute("aria-label", this.locale.urlAria), g(d2, "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);");
362
+ const u2 = document.createElement("button");
363
+ u2.type = "button", u2.textContent = this.locale.insertButton, u2.setAttribute("aria-label", this.locale.insertAria), g(u2, "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);");
364
+ const m2 = () => {
365
+ const t3 = d2.value.trim();
366
+ t3 && (b(e2, { src: t3 }), n2(), e2.getContainer().focus());
363
367
  };
364
- d2.addEventListener("mousedown", (t3) => {
365
- t3.preventDefault(), t3.stopPropagation(), g2();
366
- }), c2.addEventListener("keydown", (t3) => {
367
- "Enter" === t3.key && (t3.preventDefault(), g2());
368
- }), t2.appendChild(c2), t2.appendChild(d2), requestAnimationFrame(() => c2.focus());
368
+ u2.addEventListener("mousedown", (t3) => {
369
+ t3.preventDefault(), t3.stopPropagation(), m2();
370
+ }), d2.addEventListener("keydown", (t3) => {
371
+ "Enter" === t3.key && (t3.preventDefault(), m2());
372
+ }), t2.appendChild(d2), t2.appendChild(u2), requestAnimationFrame(() => d2.focus());
369
373
  }
370
374
  isAcceptedType(t2) {
371
375
  return this.config.acceptedTypes.some((e2) => e2 === t2 || e2.endsWith("/*") && t2.startsWith(e2.slice(0, -1)));
@@ -384,8 +388,8 @@ class k {
384
388
  if (!n2 || "image" !== n2.type) return;
385
389
  const i2 = n2.attrs?.alt ?? "", o2 = n2.attrs?.width, a2 = n2.attrs?.height, s2 = ["Image selected."];
386
390
  i2 && s2.push(`Alt text: ${i2}.`), void 0 !== o2 && void 0 !== a2 && s2.push(`Size: ${o2} by ${a2} pixels.`);
387
- const c2 = this.resolvedKeymap.shrinkWidth ?? null, d2 = this.resolvedKeymap.growWidth ?? null;
388
- c2 && d2 && s2.push(`${l(c2)} / ${l(d2)} to resize.`), this.context.announce(s2.join(" "));
391
+ const l2 = this.resolvedKeymap.shrinkWidth ?? null, c2 = this.resolvedKeymap.growWidth ?? null;
392
+ l2 && c2 && s2.push(`${u(l2)} / ${u(c2)} to resize.`), this.context.announce(s2.join(" "));
389
393
  }
390
394
  announceCurrentSize(t2) {
391
395
  const e2 = t2.getState(), n2 = e2.selection;
@@ -397,10 +401,10 @@ class k {
397
401
  }
398
402
  }
399
403
  export {
400
- _ as D,
401
- k as I,
402
- f as a,
403
- h as b,
404
- A as c
404
+ L as D,
405
+ $ as I,
406
+ I as a,
407
+ x as b,
408
+ C as c
405
409
  };
406
- //# sourceMappingURL=index-yhz2qeeh.mjs.map
410
+ //# sourceMappingURL=index-DSAuGP4n.mjs.map