@notectl/core 1.0.9 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) 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-DFkl1uYO.mjs → ToolbarPlugin-B6JETWaw.mjs} +3 -3
  28. package/dist/chunks/{ToolbarPlugin-DFkl1uYO.mjs.map → ToolbarPlugin-B6JETWaw.mjs.map} +1 -1
  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-uTnc9y7M.mjs → index-B-NSeaM4.mjs} +28 -28
  32. package/dist/chunks/index-B-NSeaM4.mjs.map +1 -0
  33. package/dist/chunks/{index-BTJfyJlJ.mjs → index-B9GkDVsx.mjs} +104 -104
  34. package/dist/chunks/index-B9GkDVsx.mjs.map +1 -0
  35. package/dist/chunks/{index-BRYzYOYC.mjs → index-C0cEs7Jc.mjs} +29 -29
  36. package/dist/chunks/index-C0cEs7Jc.mjs.map +1 -0
  37. package/dist/chunks/{index-BFsYGsBR.mjs → index-C9gc3Bws.mjs} +42 -42
  38. package/dist/chunks/{index-BFsYGsBR.mjs.map → index-C9gc3Bws.mjs.map} +1 -1
  39. package/dist/chunks/{index-DGrRWMlW.mjs → index-CAV2N-fF.mjs} +105 -105
  40. package/dist/chunks/index-CAV2N-fF.mjs.map +1 -0
  41. package/dist/chunks/{index-BQ8iIYLn.mjs → index-CKPrAOr6.mjs} +54 -54
  42. package/dist/chunks/index-CKPrAOr6.mjs.map +1 -0
  43. package/dist/chunks/{index-Bsp4LC5t.mjs → index-CNs4QQ8l.mjs} +36 -36
  44. package/dist/chunks/index-CNs4QQ8l.mjs.map +1 -0
  45. package/dist/chunks/{index-DC1EK22F.mjs → index-CflvcXSd.mjs} +24 -19
  46. package/dist/chunks/index-CflvcXSd.mjs.map +1 -0
  47. package/dist/chunks/{index-o6hDR07y.mjs → index-CoeD4T9-.mjs} +25 -20
  48. package/dist/chunks/index-CoeD4T9-.mjs.map +1 -0
  49. package/dist/chunks/{index-DA8TG2S8.mjs → index-D0s0Q8Wc.mjs} +56 -56
  50. package/dist/chunks/index-D0s0Q8Wc.mjs.map +1 -0
  51. package/dist/chunks/{index-BIL37LSL.mjs → index-D8tbbW97.mjs} +18 -18
  52. package/dist/chunks/{index-BIL37LSL.mjs.map → index-D8tbbW97.mjs.map} +1 -1
  53. package/dist/chunks/{index-DfO_fKw6.mjs → index-DMt3ojrY.mjs} +15 -15
  54. package/dist/chunks/{index-DfO_fKw6.mjs.map → index-DMt3ojrY.mjs.map} +1 -1
  55. package/dist/chunks/{index-BCvuDpVr.mjs → index-DfzCof6H.mjs} +31 -31
  56. package/dist/chunks/index-DfzCof6H.mjs.map +1 -0
  57. package/dist/chunks/{index-BL56fbXt.mjs → index-DyIwN_67.mjs} +89 -87
  58. package/dist/chunks/index-DyIwN_67.mjs.map +1 -0
  59. package/dist/chunks/{index-BSFLNveF.mjs → index-FlTg80Pk.mjs} +352 -341
  60. package/dist/chunks/index-FlTg80Pk.mjs.map +1 -0
  61. package/dist/chunks/{index-DAFCISBN.mjs → index-pxbbDHVH.mjs} +8 -8
  62. package/dist/chunks/{index-DAFCISBN.mjs.map → index-pxbbDHVH.mjs.map} +1 -1
  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 +7 -1
  81. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  82. package/dist/index.d.ts +28 -7
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/input/ClipboardHandler.d.ts.map +1 -1
  85. package/dist/input/CompositionTracker.d.ts +14 -0
  86. package/dist/input/CompositionTracker.d.ts.map +1 -0
  87. package/dist/input/FileHandlerRegistry.d.ts +16 -0
  88. package/dist/input/FileHandlerRegistry.d.ts.map +1 -0
  89. package/dist/input/InputHandler.d.ts +6 -4
  90. package/dist/input/InputHandler.d.ts.map +1 -1
  91. package/dist/input/InputRuleRegistry.d.ts +9 -0
  92. package/dist/input/InputRuleRegistry.d.ts.map +1 -0
  93. package/dist/input/KeyboardHandler.d.ts +20 -5
  94. package/dist/input/KeyboardHandler.d.ts.map +1 -1
  95. package/dist/input/Keymap.d.ts +11 -0
  96. package/dist/input/Keymap.d.ts.map +1 -1
  97. package/dist/input/KeymapRegistry.d.ts +19 -0
  98. package/dist/input/KeymapRegistry.d.ts.map +1 -0
  99. package/dist/input/PasteHandler.d.ts +3 -0
  100. package/dist/input/PasteHandler.d.ts.map +1 -1
  101. package/dist/model/Document.d.ts +8 -0
  102. package/dist/model/Document.d.ts.map +1 -1
  103. package/dist/model/GraphemeUtils.d.ts +20 -0
  104. package/dist/model/GraphemeUtils.d.ts.map +1 -0
  105. package/dist/model/HTMLUtils.d.ts +6 -1
  106. package/dist/model/HTMLUtils.d.ts.map +1 -1
  107. package/dist/model/NavigationUtils.d.ts +16 -0
  108. package/dist/model/NavigationUtils.d.ts.map +1 -0
  109. package/dist/model/SchemaRegistry.d.ts +0 -39
  110. package/dist/model/SchemaRegistry.d.ts.map +1 -1
  111. package/dist/model/Selection.d.ts +14 -3
  112. package/dist/model/Selection.d.ts.map +1 -1
  113. package/dist/notectl-core.mjs +2797 -2515
  114. package/dist/notectl-core.mjs.map +1 -1
  115. package/dist/notectl-core.umd.js +5869 -4844
  116. package/dist/notectl-core.umd.js.map +1 -1
  117. package/dist/plugins/Plugin.d.ts +17 -3
  118. package/dist/plugins/Plugin.d.ts.map +1 -1
  119. package/dist/plugins/PluginManager.d.ts +14 -0
  120. package/dist/plugins/PluginManager.d.ts.map +1 -1
  121. package/dist/plugins/alignment.mjs +3 -3
  122. package/dist/plugins/blockquote.mjs +2 -2
  123. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts +35 -0
  124. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts.map +1 -0
  125. package/dist/plugins/caret-navigation/index.d.ts +2 -0
  126. package/dist/plugins/caret-navigation/index.d.ts.map +1 -0
  127. package/dist/plugins/caret-navigation.mjs +5 -0
  128. package/dist/plugins/caret-navigation.mjs.map +1 -0
  129. package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts.map +1 -1
  130. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  131. package/dist/plugins/code-block.mjs +3 -3
  132. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  133. package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
  134. package/dist/plugins/font-size.mjs +2 -2
  135. package/dist/plugins/font.mjs +2 -2
  136. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts +15 -0
  137. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -0
  138. package/dist/plugins/gap-cursor/index.d.ts +2 -0
  139. package/dist/plugins/gap-cursor/index.d.ts.map +1 -0
  140. package/dist/plugins/gap-cursor.mjs +65 -0
  141. package/dist/plugins/gap-cursor.mjs.map +1 -0
  142. package/dist/plugins/hard-break.mjs +1 -1
  143. package/dist/plugins/heading/BlockTypePickerRegistry.d.ts +9 -0
  144. package/dist/plugins/heading/BlockTypePickerRegistry.d.ts.map +1 -0
  145. package/dist/plugins/heading/HeadingInputRules.d.ts.map +1 -1
  146. package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts.map +1 -1
  147. package/dist/plugins/heading.mjs +2 -2
  148. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
  149. package/dist/plugins/highlight.mjs +2 -2
  150. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
  151. package/dist/plugins/horizontal-rule.mjs +2 -2
  152. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  153. package/dist/plugins/image.mjs +3 -3
  154. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  155. package/dist/plugins/link.mjs +2 -2
  156. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  157. package/dist/plugins/list.mjs +2 -2
  158. package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
  159. package/dist/plugins/print/PrintTypes.d.ts +5 -1
  160. package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
  161. package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -1
  162. package/dist/plugins/shared/ColorValidation.d.ts +7 -0
  163. package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
  164. package/dist/plugins/strikethrough.mjs +2 -2
  165. package/dist/plugins/super-sub.mjs +2 -2
  166. package/dist/plugins/table/TableCommands.d.ts.map +1 -1
  167. package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
  168. package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
  169. package/dist/plugins/table.mjs +10 -10
  170. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
  171. package/dist/plugins/text-color.mjs +2 -2
  172. package/dist/plugins/text-formatting.mjs +1 -1
  173. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
  174. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +12 -0
  175. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -0
  176. package/dist/plugins/toolbar.mjs +2 -2
  177. package/dist/presets/FullPreset.d.ts +16 -0
  178. package/dist/presets/FullPreset.d.ts.map +1 -0
  179. package/dist/presets/MinimalPreset.d.ts +7 -0
  180. package/dist/presets/MinimalPreset.d.ts.map +1 -0
  181. package/dist/presets/PresetTypes.d.ts +50 -0
  182. package/dist/presets/PresetTypes.d.ts.map +1 -0
  183. package/dist/state/EditorState.d.ts.map +1 -1
  184. package/dist/state/History.d.ts.map +1 -1
  185. package/dist/state/SelectionTransactions.d.ts +10 -0
  186. package/dist/state/SelectionTransactions.d.ts.map +1 -0
  187. package/dist/test/TestUtils.d.ts +23 -0
  188. package/dist/test/TestUtils.d.ts.map +1 -1
  189. package/dist/view/CaretNavigation.d.ts +48 -0
  190. package/dist/view/CaretNavigation.d.ts.map +1 -0
  191. package/dist/view/CursorWrapper.d.ts +19 -0
  192. package/dist/view/CursorWrapper.d.ts.map +1 -0
  193. package/dist/view/DomPointUtils.d.ts +20 -0
  194. package/dist/view/DomPointUtils.d.ts.map +1 -0
  195. package/dist/view/EditorView.d.ts +43 -0
  196. package/dist/view/EditorView.d.ts.map +1 -1
  197. package/dist/view/MarkRendering.d.ts +7 -0
  198. package/dist/view/MarkRendering.d.ts.map +1 -0
  199. package/dist/view/NodeViewRegistry.d.ts +9 -0
  200. package/dist/view/NodeViewRegistry.d.ts.map +1 -0
  201. package/dist/view/Platform.d.ts +29 -0
  202. package/dist/view/Platform.d.ts.map +1 -0
  203. package/dist/view/Reconciler.d.ts +4 -0
  204. package/dist/view/Reconciler.d.ts.map +1 -1
  205. package/dist/view/SelectionSync.d.ts +2 -0
  206. package/dist/view/SelectionSync.d.ts.map +1 -1
  207. package/dist/view/ViewMovementCommands.d.ts +40 -0
  208. package/dist/view/ViewMovementCommands.d.ts.map +1 -0
  209. package/package.json +10 -2
  210. package/dist/chunks/ColorNames-iaWsSZx1.mjs +0 -35
  211. package/dist/chunks/ColorNames-iaWsSZx1.mjs.map +0 -1
  212. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs +0 -140
  213. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs.map +0 -1
  214. package/dist/chunks/Commands-CSpSwGXv.mjs +0 -461
  215. package/dist/chunks/Commands-CSpSwGXv.mjs.map +0 -1
  216. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs +0 -7
  217. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs.map +0 -1
  218. package/dist/chunks/Selection-D5ZjXoB7.mjs +0 -44
  219. package/dist/chunks/Selection-D5ZjXoB7.mjs.map +0 -1
  220. package/dist/chunks/ToolbarItem-ugDymuXi.mjs +0 -7
  221. package/dist/chunks/ToolbarItem-ugDymuXi.mjs.map +0 -1
  222. package/dist/chunks/index-BCvuDpVr.mjs.map +0 -1
  223. package/dist/chunks/index-BL56fbXt.mjs.map +0 -1
  224. package/dist/chunks/index-BQ8iIYLn.mjs.map +0 -1
  225. package/dist/chunks/index-BRYzYOYC.mjs.map +0 -1
  226. package/dist/chunks/index-BSFLNveF.mjs.map +0 -1
  227. package/dist/chunks/index-BTJfyJlJ.mjs.map +0 -1
  228. package/dist/chunks/index-Bsp4LC5t.mjs.map +0 -1
  229. package/dist/chunks/index-DA8TG2S8.mjs.map +0 -1
  230. package/dist/chunks/index-DC1EK22F.mjs.map +0 -1
  231. package/dist/chunks/index-DGrRWMlW.mjs.map +0 -1
  232. package/dist/chunks/index-o6hDR07y.mjs.map +0 -1
  233. package/dist/chunks/index-uTnc9y7M.mjs.map +0 -1
@@ -1,12 +1,12 @@
1
- import { f as t } from "./Commands-CSpSwGXv.mjs";
1
+ import { f as t } from "./Commands-CicwYoTQ.mjs";
2
2
  import { r as n } from "./resolvePluginLocale-B4w1OkPy.mjs";
3
- import { i as e } from "./AttrRegistry-D-przlzb.mjs";
4
- import { e as o, h as r, v as i } from "./Document-CI3iCwEP.mjs";
5
- import { i as l, a, s } from "./Selection-D5ZjXoB7.mjs";
6
- import { m as c } from "./TypeBrands-C09nE2qO.mjs";
7
- import { a as f } from "./ToolbarPlugin-DFkl1uYO.mjs";
8
- const p = { label: "Font", tooltip: "Font Family" }, m = { en: p, de: { label: "Schriftart", tooltip: "Schriftfamilie" }, es: { label: "Fuente", tooltip: "Familia de fuente" }, fr: { label: "Police", tooltip: "Famille de police" }, zh: { label: "字体", tooltip: "字体系列" }, ru: { label: "Шрифт", tooltip: "Семейство шрифтов" }, ar: { label: "الخط", tooltip: "عائلة الخط" }, hi: { label: "फ़ॉन्ट", tooltip: "फ़ॉन्ट परिवार" } };
9
- class d {
3
+ import { i as e } from "./AttrRegistry-I-VdmRnN.mjs";
4
+ import { g as o, h as r, w as i } from "./Document-CuwE73FF.mjs";
5
+ import { i as l, a, b as s, s as c } from "./Selection-DmFDwiPJ.mjs";
6
+ import { m as f } from "./TypeBrands-C09nE2qO.mjs";
7
+ import { a as p } from "./ToolbarPlugin-B6JETWaw.mjs";
8
+ const m = { label: "Font", tooltip: "Font Family" }, d = { en: m, de: { label: "Schriftart", tooltip: "Schriftfamilie" }, es: { label: "Fuente", tooltip: "Familia de fuente" }, fr: { label: "Police", tooltip: "Famille de police" }, zh: { label: "字体", tooltip: "字体系列" }, ru: { label: "Шрифт", tooltip: "Семейство шрифтов" }, ar: { label: "الخط", tooltip: "عائلة الخط" }, hi: { label: "फ़ॉन्ट", tooltip: "फ़ॉन्ट परिवार" } };
9
+ class h {
10
10
  id = "font";
11
11
  name = "Font";
12
12
  priority = 22;
@@ -19,7 +19,7 @@ class d {
19
19
  this.config = t2;
20
20
  }
21
21
  init(t2) {
22
- this.locale = n(m, t2, this.config.locale), t2.registerStyleSheet("\n/* Font Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--font {\n width: auto;\n min-width: 100px;\n max-width: 160px;\n padding: 0 8px;\n gap: 4px;\n border: 1px solid var(--notectl-border);\n border-radius: 4px;\n background: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--font:hover {\n background: var(--notectl-hover-bg);\n border-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--font.notectl-toolbar-btn--active {\n background: var(--notectl-bg);\n border-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--font .notectl-toolbar-btn__icon {\n display: flex;\n align-items: center;\n gap: 4px;\n width: 100%;\n overflow: hidden;\n}\n\n.notectl-toolbar-btn--font .notectl-toolbar-btn__icon svg {\n display: none;\n}\n\n.notectl-font-select__label {\n flex: 1;\n font-size: 13px;\n font-weight: 500;\n color: var(--notectl-fg);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: left;\n line-height: 30px;\n}\n\n.notectl-font-select__arrow {\n flex-shrink: 0;\n font-size: 11px;\n color: var(--notectl-fg-muted);\n line-height: 30px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n min-width: 200px;\n max-height: 320px;\n overflow-y: auto;\n}\n\n.notectl-font-picker__list {\n padding: 4px 0;\n}\n\n.notectl-font-picker__item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 7px 12px;\n border: none;\n background: none;\n cursor: pointer;\n font-size: 14px;\n color: var(--notectl-fg);\n line-height: 1.4;\n text-align: left;\n white-space: nowrap;\n font-family: inherit;\n transition: background 0.1s;\n}\n\n.notectl-font-picker__item:hover {\n background: var(--notectl-hover-bg);\n}\n\n.notectl-font-picker__item--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__item--active:hover {\n background: var(--notectl-active-bg);\n}\n\n.notectl-font-picker__check {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n flex-shrink: 0;\n font-size: 13px;\n font-weight: 600;\n color: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__label {\n flex: 1;\n}\n\n.notectl-font-picker__separator {\n height: 1px;\n background: var(--notectl-border);\n margin: 4px 8px;\n}\n"), this.context = t2, this.registerMarkSpec(t2), this.registerCommands(t2), this.registerToolbarItem(t2), this.injectFontFaces();
22
+ this.locale = n(d, t2, this.config.locale), t2.registerStyleSheet("\n/* Font Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--font {\n width: auto;\n min-width: 100px;\n max-width: 160px;\n padding: 0 8px;\n gap: 4px;\n border: 1px solid var(--notectl-border);\n border-radius: 4px;\n background: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--font:hover {\n background: var(--notectl-hover-bg);\n border-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--font.notectl-toolbar-btn--active {\n background: var(--notectl-bg);\n border-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--font .notectl-toolbar-btn__icon {\n display: flex;\n align-items: center;\n gap: 4px;\n width: 100%;\n overflow: hidden;\n}\n\n.notectl-toolbar-btn--font .notectl-toolbar-btn__icon svg {\n display: none;\n}\n\n.notectl-font-select__label {\n flex: 1;\n font-size: 13px;\n font-weight: 500;\n color: var(--notectl-fg);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: left;\n line-height: 30px;\n}\n\n.notectl-font-select__arrow {\n flex-shrink: 0;\n font-size: 11px;\n color: var(--notectl-fg-muted);\n line-height: 30px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n min-width: 200px;\n max-height: 320px;\n overflow-y: auto;\n}\n\n.notectl-font-picker__list {\n padding: 4px 0;\n}\n\n.notectl-font-picker__item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 7px 12px;\n border: none;\n background: none;\n cursor: pointer;\n font-size: 14px;\n color: var(--notectl-fg);\n line-height: 1.4;\n text-align: left;\n white-space: nowrap;\n font-family: inherit;\n transition: background 0.1s;\n}\n\n.notectl-font-picker__item:hover {\n background: var(--notectl-hover-bg);\n}\n\n.notectl-font-picker__item--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__item--active:hover {\n background: var(--notectl-active-bg);\n}\n\n.notectl-font-picker__check {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n flex-shrink: 0;\n font-size: 13px;\n font-weight: 600;\n color: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__label {\n flex: 1;\n}\n\n.notectl-font-picker__separator {\n height: 1px;\n background: var(--notectl-border);\n margin: 4px 8px;\n}\n"), this.context = t2, this.registerMarkSpec(t2), this.registerCommands(t2), this.registerToolbarItem(t2), this.injectFontFaces();
23
23
  }
24
24
  destroy() {
25
25
  this.injectedStyleElement?.remove(), this.injectedStyleElement = null, this.context = null, this.comboLabel = null;
@@ -79,8 +79,8 @@ class d {
79
79
  }
80
80
  getActiveFont(t2) {
81
81
  const n2 = t2.selection;
82
- if (l(n2)) return null;
83
- if (a(n2)) {
82
+ if (l(n2) || a(n2)) return null;
83
+ if (s(n2)) {
84
84
  if (t2.storedMarks) {
85
85
  const n3 = t2.storedMarks.find((t3) => "font" === t3.type);
86
86
  return n3 && e(n3, "font") ? n3.attrs.family ?? null : null;
@@ -97,42 +97,42 @@ class d {
97
97
  }
98
98
  applyFont(n2, e2, r2) {
99
99
  const i2 = e2.selection;
100
- if (l(i2)) return false;
101
- if (a(i2)) {
100
+ if (l(i2) || a(i2)) return false;
101
+ if (s(i2)) {
102
102
  const t2 = e2.getBlock(i2.anchor.blockId);
103
103
  if (!t2) return false;
104
- const l2 = [...(e2.storedMarks ?? o(t2, i2.anchor.offset)).filter((t3) => "font" !== t3.type), { type: c("font"), attrs: { family: r2 } }], a2 = e2.transaction("command").setStoredMarks(l2, e2.storedMarks).setSelection(i2).build();
104
+ const l2 = [...(e2.storedMarks ?? o(t2, i2.anchor.offset)).filter((t3) => "font" !== t3.type), { type: f("font"), attrs: { family: r2 } }], a2 = e2.transaction("command").setStoredMarks(l2, e2.storedMarks).setSelection(i2).build();
105
105
  return n2.dispatch(a2), true;
106
106
  }
107
- const f2 = s(i2, e2.getBlockOrder()), p2 = e2.transaction("command"), m2 = { type: c("font"), attrs: { family: r2 } };
108
- return t(e2, f2, (t2, n3, o2) => {
107
+ const p2 = c(i2, e2.getBlockOrder()), m2 = e2.transaction("command"), d2 = { type: f("font"), attrs: { family: r2 } };
108
+ return t(e2, p2, (t2, n3, o2) => {
109
109
  const r3 = e2.getBlock(t2);
110
110
  if (r3) {
111
111
  const e3 = this.findFontMarkInRange(r3, n3, o2);
112
- e3 && p2.removeMark(t2, n3, o2, e3);
112
+ e3 && m2.removeMark(t2, n3, o2, e3);
113
113
  }
114
- p2.addMark(t2, n3, o2, m2);
115
- }), p2.setSelection(i2), n2.dispatch(p2.build()), true;
114
+ m2.addMark(t2, n3, o2, d2);
115
+ }), m2.setSelection(i2), n2.dispatch(m2.build()), true;
116
116
  }
117
117
  removeFont(n2, e2) {
118
118
  const i2 = e2.selection;
119
- if (l(i2)) return false;
120
- if (a(i2)) {
119
+ if (l(i2) || a(i2)) return false;
120
+ if (s(i2)) {
121
121
  const t2 = e2.getBlock(i2.anchor.blockId);
122
122
  if (!t2) return false;
123
123
  const l2 = e2.storedMarks ?? o(t2, i2.anchor.offset);
124
- if (!r(l2, c("font"))) return false;
124
+ if (!r(l2, f("font"))) return false;
125
125
  const a2 = l2.filter((t3) => "font" !== t3.type), s2 = e2.transaction("command").setStoredMarks(a2, e2.storedMarks).setSelection(i2).build();
126
126
  return n2.dispatch(s2), true;
127
127
  }
128
- const f2 = s(i2, e2.getBlockOrder()), p2 = e2.transaction("command");
129
- return t(e2, f2, (t2, n3, o2) => {
128
+ const p2 = c(i2, e2.getBlockOrder()), m2 = e2.transaction("command");
129
+ return t(e2, p2, (t2, n3, o2) => {
130
130
  const r2 = e2.getBlock(t2);
131
131
  if (r2) {
132
132
  const e3 = this.findFontMarkInRange(r2, n3, o2);
133
- e3 && p2.removeMark(t2, n3, o2, e3);
133
+ e3 && m2.removeMark(t2, n3, o2, e3);
134
134
  }
135
- }), p2.setSelection(i2), n2.dispatch(p2.build()), true;
135
+ }), m2.setSelection(i2), n2.dispatch(m2.build()), true;
136
136
  }
137
137
  findFontMarkInRange(t2, n2, e2) {
138
138
  const o2 = i(t2);
@@ -159,7 +159,7 @@ class d {
159
159
  n2.setAttribute("data-notectl-fonts", ""), n2.textContent = t2.join("\n\n"), document.head.appendChild(n2), this.injectedStyleElement = n2;
160
160
  }
161
161
  dismissPopup() {
162
- const t2 = this.context?.getService(f);
162
+ const t2 = this.context?.getService(p);
163
163
  t2?.closePopup();
164
164
  }
165
165
  renderFontPopup(t2, n2) {
@@ -184,8 +184,8 @@ class d {
184
184
  }
185
185
  }
186
186
  export {
187
- m as F,
188
- p as a,
189
- d as b
187
+ h as F,
188
+ d as a,
189
+ m as b
190
190
  };
191
- //# sourceMappingURL=index-BCvuDpVr.mjs.map
191
+ //# sourceMappingURL=index-DfzCof6H.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DfzCof6H.mjs","sources":["../../src/editor/styles/font-select.ts","../../src/plugins/font/FontLocale.ts","../../src/plugins/font/FontPlugin.ts"],"sourcesContent":["/** Font picker toolbar combobox + popup styles. */\nexport const FONT_SELECT_CSS = `\n/* Font Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--font {\n\twidth: auto;\n\tmin-width: 100px;\n\tmax-width: 160px;\n\tpadding: 0 8px;\n\tgap: 4px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--font:hover {\n\tbackground: var(--notectl-hover-bg);\n\tborder-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--font.notectl-toolbar-btn--active {\n\tbackground: var(--notectl-bg);\n\tborder-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--font .notectl-toolbar-btn__icon {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 4px;\n\twidth: 100%;\n\toverflow: hidden;\n}\n\n.notectl-toolbar-btn--font .notectl-toolbar-btn__icon svg {\n\tdisplay: none;\n}\n\n.notectl-font-select__label {\n\tflex: 1;\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: var(--notectl-fg);\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\ttext-align: left;\n\tline-height: 30px;\n}\n\n.notectl-font-select__arrow {\n\tflex-shrink: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\tline-height: 30px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-font-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-font-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: left;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n.notectl-font-picker__item:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-font-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__item--active:hover {\n\tbackground: var(--notectl-active-bg);\n}\n\n.notectl-font-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__label {\n\tflex: 1;\n}\n\n.notectl-font-picker__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 8px;\n}\n`;\n","/** Locale interface and default English locale for the FontPlugin. */\n\n// --- Locale Interface ---\n\nexport interface FontLocale {\n\treadonly label: string;\n\treadonly tooltip: string;\n}\n\n// --- Default English Locale ---\n\nexport const FONT_LOCALE_EN: FontLocale = {\n\tlabel: 'Font',\n\ttooltip: 'Font Family',\n};\n\n// --- German Locale ---\n\nexport const FONT_LOCALE_DE: FontLocale = {\n\tlabel: 'Schriftart',\n\ttooltip: 'Schriftfamilie',\n};\n\n// --- Spanish Locale ---\n\nexport const FONT_LOCALE_ES: FontLocale = {\n\tlabel: 'Fuente',\n\ttooltip: 'Familia de fuente',\n};\n\n// --- French Locale ---\n\nexport const FONT_LOCALE_FR: FontLocale = {\n\tlabel: 'Police',\n\ttooltip: 'Famille de police',\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const FONT_LOCALE_ZH: FontLocale = {\n\tlabel: '字体',\n\ttooltip: '字体系列',\n};\n\n// --- Russian Locale ---\n\nexport const FONT_LOCALE_RU: FontLocale = {\n\tlabel: 'Шрифт',\n\ttooltip: 'Семейство шрифтов',\n};\n\n// --- Arabic Locale ---\n\nexport const FONT_LOCALE_AR: FontLocale = {\n\tlabel: 'الخط',\n\ttooltip: 'عائلة الخط',\n};\n\n// --- Hindi Locale ---\n\nexport const FONT_LOCALE_HI: FontLocale = {\n\tlabel: 'फ़ॉन्ट',\n\ttooltip: 'फ़ॉन्ट परिवार',\n};\n\n// --- Locale Map ---\n\nexport const FONT_LOCALES: Record<string, FontLocale> = {\n\ten: FONT_LOCALE_EN,\n\tde: FONT_LOCALE_DE,\n\tes: FONT_LOCALE_ES,\n\tfr: FONT_LOCALE_FR,\n\tzh: FONT_LOCALE_ZH,\n\tru: FONT_LOCALE_RU,\n\tar: FONT_LOCALE_AR,\n\thi: FONT_LOCALE_HI,\n};\n","/**\n * FontPlugin: registers a font-family mark, a combobox-style toolbar selector\n * for font selection, and a developer-friendly API for registering custom fonts\n * (WOFF2, TTF, OTF).\n */\n\nimport { forEachBlockInRange } from '../../commands/Commands.js';\nimport { FONT_SELECT_CSS } from '../../editor/styles/font-select.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { isMarkOfType } from '../../model/AttrRegistry.js';\nimport { getBlockMarksAtOffset, getTextChildren, hasMark } from '../../model/Document.js';\nimport type { BlockNode, Mark } from '../../model/Document.js';\nimport {\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n\tselectionRange,\n} from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { ToolbarServiceKey } from '../toolbar/ToolbarPlugin.js';\nimport { FONT_LOCALES, type FontLocale } from './FontLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfont: { family: string };\n\t}\n}\n\n// --- Public Types ---\n\n/** Describes a single @font-face source. */\nexport interface FontFaceDescriptor {\n\t/** CSS `src` value, e.g. `\"url('/fonts/My.woff2') format('woff2')\"`. */\n\treadonly src: string;\n\t/** Font weight, e.g. `'400'` or `'300 700'` for variable fonts. */\n\treadonly weight?: string;\n\t/** Font style, e.g. `'normal'` or `'italic'`. */\n\treadonly style?: string;\n\t/** Font display strategy. Defaults to `'swap'`. */\n\treadonly display?: string;\n}\n\n/** Defines a font available in the editor. */\nexport interface FontDefinition {\n\t/** Display name shown in the toolbar dropdown. */\n\treadonly name: string;\n\t/** CSS `font-family` value, e.g. `\"'Fira Code', monospace\"`. */\n\treadonly family: string;\n\t/** Font category for grouping in the UI. */\n\treadonly category?: 'serif' | 'sans-serif' | 'monospace' | 'display' | 'handwriting';\n\t/**\n\t * Optional `@font-face` descriptors. When provided, the plugin\n\t * auto-injects the corresponding CSS rules into the document.\n\t */\n\treadonly fontFaces?: readonly FontFaceDescriptor[];\n}\n\n// --- Configuration ---\n\nexport interface FontConfig {\n\t/**\n\t * Fonts available in the editor. System fonts require no `fontFaces`.\n\t * Custom fonts with `fontFaces` get their `@font-face` rules auto-injected.\n\t *\n\t * Use `STARTER_FONTS` for a pre-configured set of fonts:\n\t * ```ts\n\t * new FontPlugin({ fonts: [...STARTER_FONTS] })\n\t * ```\n\t */\n\treadonly fonts: readonly FontDefinition[];\n\t/**\n\t * Name of the font that acts as the editor's default.\n\t * Selecting this font removes the mark (since the editor already uses it).\n\t * Defaults to the first font in the list.\n\t */\n\treadonly defaultFont?: string;\n\t/** When true, a separator is rendered after the font toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: FontLocale;\n}\n\n// --- Plugin ---\n\nexport class FontPlugin implements Plugin {\n\treadonly id = 'font';\n\treadonly name = 'Font';\n\treadonly priority = 22;\n\n\tprivate readonly config: FontConfig;\n\tprivate locale!: FontLocale;\n\tprivate injectedStyleElement: HTMLStyleElement | null = null;\n\tprivate context: PluginContext | null = null;\n\tprivate comboLabel: HTMLSpanElement | null = null;\n\n\tconstructor(config: FontConfig) {\n\t\tthis.config = config;\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(FONT_LOCALES, context, this.config.locale);\n\n\t\tcontext.registerStyleSheet(FONT_SELECT_CSS);\n\t\tthis.context = context;\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.injectFontFaces();\n\t}\n\n\tdestroy(): void {\n\t\tthis.injectedStyleElement?.remove();\n\t\tthis.injectedStyleElement = null;\n\t\tthis.context = null;\n\t\tthis.comboLabel = null;\n\t}\n\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tthis.updateComboLabel(newState);\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'font',\n\t\t\trank: 6,\n\t\t\tattrs: {\n\t\t\t\tfamily: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst span: HTMLElement = document.createElement('span');\n\t\t\t\tconst family: string = mark.attrs?.family ?? '';\n\t\t\t\tif (family) {\n\t\t\t\t\tspan.style.fontFamily = family;\n\t\t\t\t}\n\t\t\t\treturn span;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst family: string = String(mark.attrs?.family ?? '');\n\t\t\t\tif (!family) return content;\n\t\t\t\treturn `<span style=\"font-family: ${family}\">${content}</span>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'span',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\tconst family: string = el.style.fontFamily;\n\t\t\t\t\t\tif (!family) return false;\n\t\t\t\t\t\treturn { family };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['span'] },\n\t\t});\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFont', () => {\n\t\t\tconst state: EditorState = context.getState();\n\t\t\treturn this.removeFont(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setFont', () => {\n\t\t\treturn false;\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate get defaultFont(): FontDefinition {\n\t\tif (this.config.defaultFont) {\n\t\t\tconst found: FontDefinition | undefined = this.config.fonts.find(\n\t\t\t\t(f) => f.name === this.config.defaultFont,\n\t\t\t);\n\t\t\tif (found) return found;\n\t\t}\n\t\tconst first: FontDefinition | undefined = this.config.fonts[0];\n\t\tif (!first) throw new Error('FontPlugin: fonts list is empty');\n\t\treturn first;\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\t// The icon content renders as a combobox label + dropdown arrow.\n\t\t// The actual label text is updated via onStateChange → updateComboLabel.\n\t\tconst defaultName: string = this.defaultFont.name;\n\t\tconst label: string = `<span class=\"notectl-font-select__label\" data-font-label>${defaultName}</span>`;\n\t\tconst arrow = '<span class=\"notectl-font-select__arrow\">\\u25BE</span>';\n\t\tconst icon = `${label}${arrow}`;\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'font',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip,\n\t\t\tcommand: 'removeFont',\n\t\t\tpriority: 5,\n\t\t\tpopupType: 'custom',\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\trenderPopup: (container, ctx) => {\n\t\t\t\tthis.renderFontPopup(container, ctx);\n\t\t\t},\n\t\t\tisActive: (state) => this.isFontActive(state),\n\t\t});\n\t}\n\n\tprivate updateComboLabel(state: EditorState): void {\n\t\t// Lazily find the label element in the DOM\n\t\tif (!this.comboLabel) {\n\t\t\tconst container: HTMLElement | undefined = this.context?.getPluginContainer('top');\n\t\t\tif (!container) return;\n\t\t\tthis.comboLabel = container.querySelector<HTMLSpanElement>('[data-font-label]') ?? null;\n\t\t\tif (!this.comboLabel) return;\n\t\t}\n\n\t\tconst activeFamily: string | null = this.getActiveFont(state);\n\t\tconst displayName: string = this.resolveFontName(activeFamily);\n\t\tthis.comboLabel.textContent = displayName;\n\t}\n\n\tprivate resolveFontName(family: string | null): string {\n\t\tif (!family) return this.defaultFont.name;\n\t\tconst match: FontDefinition | undefined = this.config.fonts.find((f) => f.family === family);\n\t\treturn match?.name ?? (family.split(',')[0] ?? '').trim().replace(/'/g, '');\n\t}\n\n\t// --- State Queries ---\n\n\tprivate isFontActive(state: EditorState): boolean {\n\t\treturn this.getActiveFont(state) !== null;\n\t}\n\n\tgetActiveFont(state: EditorState): string | null {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\tif (state.storedMarks) {\n\t\t\t\tconst mark = state.storedMarks.find((m) => m.type === 'font');\n\t\t\t\treturn mark && isMarkOfType(mark, 'font') ? (mark.attrs.family ?? null) : null;\n\t\t\t}\n\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block) return null;\n\t\t\tconst marks = getBlockMarksAtOffset(block, sel.anchor.offset);\n\t\t\tconst mark = marks.find((m) => m.type === 'font');\n\t\t\treturn mark && isMarkOfType(mark, 'font') ? (mark.attrs.family ?? null) : null;\n\t\t}\n\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return null;\n\t\tconst marks = getBlockMarksAtOffset(block, sel.anchor.offset);\n\t\tconst mark = marks.find((m) => m.type === 'font');\n\t\treturn mark && isMarkOfType(mark, 'font') ? (mark.attrs.family ?? null) : null;\n\t}\n\n\t// --- Font Application ---\n\n\tapplyFont(context: PluginContext, state: EditorState, family: string): boolean {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!anchorBlock) return false;\n\t\t\tconst currentMarks =\n\t\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\t\tconst withoutFont = currentMarks.filter((m) => m.type !== 'font');\n\t\t\tconst newMarks = [...withoutFont, { type: markType('font'), attrs: { family } }];\n\n\t\t\tconst tr = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t\t.setSelection(sel)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst range = selectionRange(sel, state.getBlockOrder());\n\t\tconst builder = state.transaction('command');\n\t\tconst mark = { type: markType('font'), attrs: { family } };\n\n\t\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\t\tconst block = state.getBlock(blockId);\n\t\t\tif (block) {\n\t\t\t\tconst existing: Mark | undefined = this.findFontMarkInRange(block, from, to);\n\t\t\t\tif (existing) {\n\t\t\t\t\tbuilder.removeMark(blockId, from, to, existing);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t});\n\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\tprivate removeFont(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!anchorBlock) return false;\n\t\t\tconst currentMarks =\n\t\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\t\tif (!hasMark(currentMarks, markType('font'))) return false;\n\n\t\t\tconst newMarks = currentMarks.filter((m) => m.type !== 'font');\n\t\t\tconst tr = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t\t.setSelection(sel)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst range = selectionRange(sel, state.getBlockOrder());\n\t\tconst builder = state.transaction('command');\n\n\t\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\t\tconst block = state.getBlock(blockId);\n\t\t\tif (block) {\n\t\t\t\tconst existing: Mark | undefined = this.findFontMarkInRange(block, from, to);\n\t\t\t\tif (existing) {\n\t\t\t\t\tbuilder.removeMark(blockId, from, to, existing);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\t/** Finds the first font mark in a block's text range (for proper step inversion). */\n\tprivate findFontMarkInRange(block: BlockNode, from: number, to: number): Mark | undefined {\n\t\tconst textChildren = getTextChildren(block);\n\t\tlet pos = 0;\n\t\tfor (const node of textChildren) {\n\t\t\tconst nodeEnd: number = pos + node.text.length;\n\t\t\tif (nodeEnd > from && pos < to) {\n\t\t\t\tconst fontMark: Mark | undefined = node.marks.find((m) => m.type === 'font');\n\t\t\t\tif (fontMark) return fontMark;\n\t\t\t}\n\t\t\tpos = nodeEnd;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t// --- @font-face Injection ---\n\n\tprivate injectFontFaces(): void {\n\t\tconst rules: string[] = [];\n\n\t\tfor (const font of this.config.fonts) {\n\t\t\tif (!font.fontFaces?.length) continue;\n\n\t\t\tfor (const face of font.fontFaces) {\n\t\t\t\tconst familyName: string = (font.family.split(',')[0] ?? '').trim().replace(/'/g, '');\n\t\t\t\tconst declarations: string[] = [`font-family: '${familyName}'`, `src: ${face.src}`];\n\t\t\t\tif (face.weight) {\n\t\t\t\t\tdeclarations.push(`font-weight: ${face.weight}`);\n\t\t\t\t}\n\t\t\t\tif (face.style) {\n\t\t\t\t\tdeclarations.push(`font-style: ${face.style}`);\n\t\t\t\t}\n\t\t\t\tdeclarations.push(`font-display: ${face.display ?? 'swap'}`);\n\n\t\t\t\trules.push(`@font-face {\\n\\t${declarations.join(';\\n\\t')};\\n}`);\n\t\t\t}\n\t\t}\n\n\t\tif (rules.length === 0) return;\n\n\t\tconst style: HTMLStyleElement = document.createElement('style');\n\t\tstyle.setAttribute('data-notectl-fonts', '');\n\t\tstyle.textContent = rules.join('\\n\\n');\n\t\tdocument.head.appendChild(style);\n\t\tthis.injectedStyleElement = style;\n\t}\n\n\t// --- Popup Rendering ---\n\n\tprivate dismissPopup(): void {\n\t\tconst toolbar = this.context?.getService(ToolbarServiceKey);\n\t\ttoolbar?.closePopup();\n\t}\n\n\tprivate renderFontPopup(container: HTMLElement, context: PluginContext): void {\n\t\tcontainer.classList.add('notectl-font-picker');\n\n\t\tconst state: EditorState = context.getState();\n\t\tconst activeFont: string | null = this.getActiveFont(state);\n\t\tconst defaultFamily: string = this.defaultFont.family;\n\n\t\tconst list: HTMLDivElement = document.createElement('div');\n\t\tlist.className = 'notectl-font-picker__list';\n\n\t\tfor (const font of this.config.fonts) {\n\t\t\tconst isDefault: boolean = font.family === defaultFamily;\n\t\t\tconst isActive: boolean = isDefault\n\t\t\t\t? !activeFont || activeFont === font.family\n\t\t\t\t: activeFont === font.family;\n\n\t\t\tconst item: HTMLButtonElement = this.createFontItem(\n\t\t\t\tfont.name,\n\t\t\t\tfont.family,\n\t\t\t\tisActive,\n\t\t\t\t(e: MouseEvent) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tif (isDefault) {\n\t\t\t\t\t\tcontext.executeCommand('removeFont');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.applyFont(context, context.getState(), font.family);\n\t\t\t\t\t}\n\t\t\t\t\tthis.dismissPopup();\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tif (font.category) {\n\t\t\t\titem.setAttribute('data-category', font.category);\n\t\t\t}\n\n\t\t\tlist.appendChild(item);\n\t\t}\n\n\t\tcontainer.appendChild(list);\n\t}\n\n\tprivate createFontItem(\n\t\tname: string,\n\t\tfamily: string,\n\t\tisActive: boolean,\n\t\thandler: (e: MouseEvent) => void,\n\t): HTMLButtonElement {\n\t\tconst item: HTMLButtonElement = document.createElement('button');\n\t\titem.type = 'button';\n\t\titem.className = 'notectl-font-picker__item';\n\n\t\tif (isActive) {\n\t\t\titem.classList.add('notectl-font-picker__item--active');\n\t\t}\n\n\t\t// Checkmark indicator\n\t\tconst check: HTMLSpanElement = document.createElement('span');\n\t\tcheck.className = 'notectl-font-picker__check';\n\t\tcheck.textContent = isActive ? '\\u2713' : '';\n\t\titem.appendChild(check);\n\n\t\t// Font name label (rendered in the font itself for preview)\n\t\tconst label: HTMLSpanElement = document.createElement('span');\n\t\tlabel.className = 'notectl-font-picker__label';\n\t\tlabel.textContent = name;\n\t\tif (family) {\n\t\t\tlabel.style.fontFamily = family;\n\t\t}\n\t\titem.appendChild(label);\n\n\t\titem.addEventListener('mousedown', handler);\n\t\treturn item;\n\t}\n}\n"],"names":["FONT_LOCALE_EN","label","tooltip","FONT_LOCALES","en","de","es","fr","zh","ru","ar","hi","FontPlugin","id","name","priority","config","locale","injectedStyleElement","context","comboLabel","this","resolvePluginLocale","registerStyleSheet","registerMarkSpec","registerCommands","registerToolbarItem","injectFontFaces","destroy","remove","_oldState","newState","_tr","updateComboLabel","type","rank","attrs","family","default","mark","span","document","createElement","style","fontFamily","toHTMLString","content","String","parseHTML","tag","getAttrs","el","sanitize","tags","registerCommand","state","getState","removeFont","defaultFont","found","fonts","find","f","first","Error","icon","group","command","popupType","separatorAfter","renderPopup","container","ctx","renderFontPopup","isActive","isFontActive","getPluginContainer","querySelector","activeFamily","getActiveFont","displayName","resolveFontName","textContent","match","split","trim","replace","sel","selection","isNodeSelection","isGapCursor","isCollapsed","storedMarks","m","isMarkOfType","block","getBlock","anchor","blockId","getBlockMarksAtOffset","offset","anchorBlock","newMarks","filter","markType","tr","transaction","setStoredMarks","setSelection","build","dispatch","range","selectionRange","getBlockOrder","builder","forEachBlockInRange","from","to","existing","findFontMarkInRange","removeMark","addMark","currentMarks","hasMark","textChildren","getTextChildren","pos","node","nodeEnd","text","length","fontMark","marks","rules","font","fontFaces","face","declarations","src","weight","push","display","join","setAttribute","head","appendChild","dismissPopup","toolbar","getService","ToolbarServiceKey","closePopup","classList","add","activeFont","defaultFamily","list","className","isDefault","item","createFontItem","e","preventDefault","stopPropagation","executeCommand","applyFont","category","handler","check","addEventListener"],"mappings":";;;;;;;AACO,MCUMA,IAA6B,EACzCC,OAAO,QACPC,SAAS,cAAA,GAsDGC,IAA2C,EACvDC,IAAIJ,GACJK,IAnDyC,EACzCJ,OAAO,cACPC,SAAS,iBAAA,GAkDTI,IA7CyC,EACzCL,OAAO,UACPC,SAAS,oBAAA,GA4CTK,IAvCyC,EACzCN,OAAO,UACPC,SAAS,oBAAA,GAsCTM,IAjCyC,EACzCP,OAAO,MACPC,SAAS,OAAA,GAgCTO,IA3ByC,EACzCR,OAAO,SACPC,SAAS,oBAAA,GA0BTQ,IArByC,EACzCT,OAAO,QACPC,SAAS,aAAA,GAoBTS,IAfyC,EACzCV,OAAO,UACPC,SAAS,gBAAA,EAAA;AC0BH,MAAMU,EAAAA;AAAAA,EACHC,KAAK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,IAClB;AAEAvF,IAAAA,GAAU0E,YAAYU,EAAAA;AAAAA,EACvB;AAAA,EAEQ,eACP7I,IACAuB,IACAqC,IACA4F,IAAAA;AAEA,UAAMR,KAA0BrH,SAASC,cAAc,QAAA;AACvDoH,IAAAA,GAAK5H,OAAO,UACZ4H,GAAKF,YAAY,6BAEblF,MACHoF,GAAKP,UAAUC,IAAI,mCAAA;AAIpB,UAAMe,KAAyB9H,SAASC,cAAc,MAAA;AACtD6H,IAAAA,GAAMX,YAAY,8BAClBW,GAAMrF,cAAcR,KAAW,MAAW,IAC1CoF,GAAKb,YAAYsB,EAAAA;AAGjB,UAAMtK,KAAyBwC,SAASC,cAAc,MAAA;AAStD,WARAzC,GAAM2J,YAAY,8BAClB3J,GAAMiF,cAAcpE,IAChBuB,OACHpC,GAAM0C,MAAMC,aAAaP,KAE1ByH,GAAKb,YAAYhJ,EAAAA,GAEjB6J,GAAKU,iBAAiB,aAAaF,EAAAA,GAC5BR;AAAAA,EACR;AAAA;"}
@@ -1,12 +1,14 @@
1
1
  import { S as e, r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
2
- import { e as n } from "./HTMLUtils-0wvCRvJc.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(e2, t2) {
9
- const n2 = e2.getState(), i2 = n2.selection, o2 = { src: t2.src, alt: t2.alt ?? "", align: t2.align ?? "center", ...void 0 !== t2.width ? { width: t2.width } : {}, ...void 0 !== t2.height ? { height: t2.height } : {} }, s2 = r(i2) ? i2.nodeId : i2.anchor.blockId, u2 = (function(e3, t3) {
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) {
10
12
  const n3 = e3.getBlock(t3);
11
13
  if ("table_cell" === n3?.type) return t3;
12
14
  const i3 = e3.getNodePath(t3);
@@ -14,26 +16,26 @@ function u(e2, t2) {
14
16
  const n4 = e3.getBlock(t4);
15
17
  if ("table_cell" === n4?.type) return t4;
16
18
  }
17
- })(n2, s2);
18
- return u2 ? (function(e3, t3, n3, i3) {
19
+ })(n2, l2);
20
+ return m2 ? (function(e3, t3, n3, i3) {
19
21
  const r2 = e3.getNodePath(n3);
20
22
  if (!r2) return false;
21
- const o3 = c(g("image"), [], void 0, i3), s3 = e3.getBlock(n3);
22
- if (!s3) return false;
23
- const u3 = e3.transaction("command"), m2 = d(s3);
24
- for (let e4 = m2.length - 1; e4 >= 0; e4--) {
25
- const t4 = s3.children.findIndex((t5) => l(t5) && t5.id === m2[e4]?.id);
26
- -1 !== t4 && u3.removeNode(r2, t4);
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])), t3.dispatch(u3.build()), true;
29
- })(n2, e2, u2, o2) : (function(e3, t3, n3, i3) {
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) {
30
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 = e3.transaction("command").insertNode([], r2 + 1, o3).insertNode([], r2 + 2, s3).setSelection(a(o3.id, [])).build();
33
- return t3.dispatch(l2), true;
34
- })(n2, e2, 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(e2, t2, n2) {
38
+ function p(e2, t2, n2) {
37
39
  const i2 = e2.getState(), o2 = i2.selection;
38
40
  if (!r(o2)) return false;
39
41
  const a2 = i2.getBlock(o2.nodeId);
@@ -52,10 +54,10 @@ function m(e2, t2, n2) {
52
54
  return e3.dispatch(l3), true;
53
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: (e2, t2, n2) => {
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) => {
56
58
  const i2 = [e2 || "Image"];
57
59
  return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} 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: (e2, t2, n2) => {
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) => {
59
61
  const i2 = [e2 || "Bild"];
60
62
  return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} mal ${n2} Pixel`), i2.join(", ");
61
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) => {
@@ -76,28 +78,28 @@ const p = { insertImage: "Insert Image", insertImageTooltip: "Insert Image", upl
76
78
  }, resetToNaturalSize: "تمت إعادة الصورة إلى حجمها الطبيعي.", uploadFailed: "فشل رفع الصورة." }, hi: { insertImage: "चित्र डालें", insertImageTooltip: "चित्र डालें", uploadFromComputer: "कंप्यूटर से अपलोड करें", uploadAria: "कंप्यूटर से चित्र अपलोड करें", separator: "या", urlPlaceholder: "https://...", urlAria: "चित्र URL", insertButton: "डालें", insertAria: "चित्र डालें", imageAria: (e2, t2, n2) => {
77
79
  const i2 = [e2 || "चित्र"];
78
80
  return void 0 !== t2 && void 0 !== n2 && i2.push(`${t2} 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);
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(e2, t2, 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
97
  function m2(e3) {
96
- const n3 = e3.attrs?.src ?? "", i3 = e3.attrs?.alt ?? "", r3 = e3.attrs?.width, o3 = e3.attrs?.height, s2 = e3.attrs?.align ?? "center";
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 e4 of Object.values(f)) a2.classList.remove(e4);
99
- const l3 = f[s2];
100
- l3 && a2.classList.add(l3);
100
+ for (const e4 of Object.values(b)) a2.classList.remove(e4);
101
+ const l2 = b[s3];
102
+ l2 && a2.classList.add(l2);
101
103
  const g3 = t2.get(e3.id) ?? "idle", u3 = "uploading" === g3;
102
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) {
103
105
  const t3 = e4.attrs?.alt ?? "", n4 = e4.attrs?.width, i4 = e4.attrs?.height, r4 = [];
@@ -106,21 +108,21 @@ function z(e2, t2, n2) {
106
108
  }
107
109
  m2(i2);
108
110
  let p2 = false;
109
- function h2(t3, n3, i3, s2) {
110
- let l3 = 0, d3 = 0, g3 = 1;
111
+ function h2(t3, n3, i3, s3) {
112
+ let l2 = 0, d3 = 0, g3 = 1;
111
113
  const u3 = (t4) => {
112
- const i4 = t4.clientX - l3, r3 = (o3 = d3 + i4 * v[n3], Math.max(50, Math.min(e2.maxWidth, o3)));
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}`;
117
+ c2.style.width = `${r3}px`, c2.style.height = `${a3}px`, s3.textContent = `${Math.round(r3)} × ${a3}`;
116
118
  }, m3 = (e3) => {
117
- document.removeEventListener("pointermove", u3), document.removeEventListener("pointerup", m3), a2.classList.remove("notectl-image--resizing"), s2.classList.remove("notectl-image__size-indicator--visible"), I();
119
+ document.removeEventListener("pointermove", u3), document.removeEventListener("pointerup", m3), a2.classList.remove("notectl-image--resizing"), s3.classList.remove("notectl-image__size-indicator--visible"), z();
118
120
  const t4 = Math.round(c2.getBoundingClientRect().width), n4 = Math.round(t4 / g3);
119
121
  !(function(e4, t5, n5) {
120
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 === t5 && l4 === n5) return;
124
+ const s4 = a3.attrs?.width, l3 = a3.attrs?.height;
125
+ if (s4 === t5 && l3 === n5) return;
124
126
  const c3 = i4.getNodePath(e4);
125
127
  if (!c3) return;
126
128
  const d4 = { ...a3.attrs ?? {}, width: t5, height: n5 }, g4 = i4.transaction("command").setNodeAttr(c3, d4).build();
@@ -128,14 +130,14 @@ function z(e2, t2, n2) {
128
130
  })(i3, t4, n4), e3.target?.releasePointerCapture?.(e3.pointerId);
129
131
  };
130
132
  t3.addEventListener("pointerdown", (e3) => {
131
- e3.preventDefault(), e3.stopPropagation(), l3 = e3.clientX, d3 = c2.getBoundingClientRect().width;
133
+ e3.preventDefault(), e3.stopPropagation(), l2 = e3.clientX, d3 = c2.getBoundingClientRect().width;
132
134
  const t4 = c2.getBoundingClientRect().height;
133
135
  var i4;
134
- g3 = t4 > 0 ? d3 / t4 : 1, a2.classList.add("notectl-image--resizing"), s2.textContent = `${Math.round(d3)} × ${Math.round(t4)}`, 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), e3.target.setPointerCapture(e3.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;
@@ -143,11 +145,11 @@ function z(e2, t2, n2) {
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, e2.maxWidth), u3 = s2 > 0 ? l3 / s2 : 1, m3 = Math.round(d3 * u3), h3 = t3.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 = t3.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
154
  }), { dom: a2, contentDOM: null, update: (e3) => "image" === e3.type && (g2 = e3.id, a2.setAttribute("data-block-id", e3.id), m2(e3), true), selectNode() {
153
155
  a2.classList.add("notectl-image--selected"), (function(t3) {
@@ -158,29 +160,29 @@ function z(e2, t2, n2) {
158
160
  const r3 = ["nw", "ne", "sw", "se"];
159
161
  for (const e3 of r3) {
160
162
  const n3 = document.createElement("div");
161
- n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${e3}`, n3.setAttribute("role", "separator"), n3.setAttribute("aria-label", x[e3]), h2(n3, e3, t3, 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
166
  const e3 = (function(e4) {
165
167
  const t4 = e4.shrinkWidth ?? null, n3 = e4.growWidth ?? null;
166
- return t4 && n3 ? `${s(t4)} / ${s(n3)} to resize` : "";
168
+ return t4 && n3 ? `${l(t4)} / ${l(n3)} to resize` : "";
167
169
  })(n2);
168
170
  if (e3) {
169
171
  const t4 = document.createElement("div");
170
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 e("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;
@@ -191,26 +193,26 @@ class S {
191
193
  context = null;
192
194
  locale;
193
195
  constructor(e2) {
194
- this.config = { ..._, ...e2 }, this.resolvedKeymap = { ...A, ...e2?.keymap };
196
+ this.config = { ...S, ...e2 }, this.resolvedKeymap = { ..._, ...e2?.keymap };
195
197
  }
196
198
  init(e2) {
197
- this.locale = t(h, 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) {
198
- e3.registerCommand("insertImage", () => u(e3, { src: "" })), e3.registerCommand("removeImage", () => (function(e4) {
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) {
199
201
  const t2 = e4.getState(), n2 = t2.selection;
200
202
  if (!r(n2)) return false;
201
203
  const i2 = t2.getBlock(n2.nodeId);
202
204
  if (!i2 || "image" !== i2.type) return false;
203
- const a2 = t2.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 = t2.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
211
  const e5 = s2[s2.length - 1];
210
- c2 = e5 ? t2.getBlock(e5) : void 0;
212
+ l2 = e5 ? t2.getBlock(e5) : void 0;
211
213
  }
212
- if (!c2) return false;
213
- const d2 = c2.children.findIndex((e5) => l(e5) && e5.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
217
  const g2 = (function(e5, t3, n3) {
216
218
  if (0 === t3.length) {
@@ -220,7 +222,7 @@ class S {
220
222
  return t3[t3.length - 1];
221
223
  })(t2, s2, n2.nodeId);
222
224
  if (!g2) return false;
223
- const u2 = t2.transaction("command").removeNode(s2, d2).setSelection(o(g2, 0)).build();
225
+ const u2 = t2.transaction("command").removeNode(s2, d2).setSelection(a(g2, 0)).build();
224
226
  return e4.dispatch(u2), true;
225
227
  })(e3));
226
228
  })(e2), this.registerResizeCommands(e2), this.registerResizeKeymaps(e2), this.registerFileHandler(e2), this.registerToolbarItem(e2);
@@ -260,21 +262,21 @@ class S {
260
262
  } }], sanitize: { tags: ["figure", "img"], attrs: ["src", "alt", "width", "height", "class"] } });
261
263
  }
262
264
  registerNodeView(e2) {
263
- e2.registerNodeView("image", z(this.config, this.uploadStates, this.resolvedKeymap));
265
+ e2.registerNodeView("image", w(this.config, this.uploadStates, this.resolvedKeymap));
264
266
  }
265
267
  registerResizeCommands(e2) {
266
268
  const t2 = this.config.resizeStep ?? 10, n2 = this.config.resizeStepLarge ?? 50, i2 = this.config.maxWidth;
267
269
  e2.registerCommand("resizeImageGrow", () => {
268
- const n3 = m(e2, t2, i2);
270
+ const n3 = p(e2, t2, i2);
269
271
  return n3 && this.announceCurrentSize(e2), n3;
270
272
  }), e2.registerCommand("resizeImageShrink", () => {
271
- const n3 = m(e2, -t2, i2);
273
+ const n3 = p(e2, -t2, i2);
272
274
  return n3 && this.announceCurrentSize(e2), n3;
273
275
  }), e2.registerCommand("resizeImageGrowLarge", () => {
274
- const t3 = m(e2, n2, i2);
276
+ const t3 = p(e2, n2, i2);
275
277
  return t3 && this.announceCurrentSize(e2), t3;
276
278
  }), e2.registerCommand("resizeImageShrinkLarge", () => {
277
- const t3 = m(e2, -n2, i2);
279
+ const t3 = p(e2, -n2, i2);
278
280
  return t3 && this.announceCurrentSize(e2), t3;
279
281
  }), e2.registerCommand("resetImageSize", () => {
280
282
  const t3 = (function(e3) {
@@ -304,14 +306,14 @@ class S {
304
306
  handleFileInsert(e2, t2) {
305
307
  if (t2.size > this.config.maxFileSize) return;
306
308
  const n2 = URL.createObjectURL(t2);
307
- if (this.blobUrls.add(n2), !u(e2, { src: n2 })) return URL.revokeObjectURL(n2), void this.blobUrls.delete(n2);
309
+ if (this.blobUrls.add(n2), !m(e2, { src: n2 })) return URL.revokeObjectURL(n2), void this.blobUrls.delete(n2);
308
310
  const i2 = e2.getState().selection;
309
311
  if (!r(i2)) return;
310
312
  const o2 = i2.nodeId;
311
- this.uploadStates.set(o2, "uploading"), e2.getService(w) ? this.uploadFile(e2, t2, 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");
312
314
  }
313
315
  async uploadFile(e2, t2, n2, i2) {
314
- const r2 = e2.getService(w);
316
+ const r2 = e2.getService(A);
315
317
  if (r2) try {
316
318
  const o2 = await r2.upload(t2);
317
319
  this.uploadStates.set(n2, "complete");
@@ -355,7 +357,7 @@ class S {
355
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);";
356
358
  const g2 = () => {
357
359
  const e3 = c2.value.trim();
358
- e3 && (u(t2, { src: e3 }), n2(), t2.getContainer().focus());
360
+ e3 && (m(t2, { src: e3 }), n2(), t2.getContainer().focus());
359
361
  };
360
362
  d2.addEventListener("mousedown", (e3) => {
361
363
  e3.preventDefault(), e3.stopPropagation(), g2();
@@ -378,10 +380,10 @@ class S {
378
380
  if (!r(t2)) return;
379
381
  const n2 = e2.getBlock(t2.nodeId);
380
382
  if (!n2 || "image" !== n2.type) return;
381
- const i2 = n2.attrs?.alt ?? "", o2 = n2.attrs?.width, a2 = n2.attrs?.height, l2 = ["Image selected."];
382
- 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.`);
383
385
  const c2 = this.resolvedKeymap.shrinkWidth ?? null, d2 = this.resolvedKeymap.growWidth ?? null;
384
- 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(" "));
385
387
  }
386
388
  announceCurrentSize(e2) {
387
389
  const t2 = e2.getState(), n2 = t2.selection;
@@ -393,10 +395,10 @@ class S {
393
395
  }
394
396
  }
395
397
  export {
396
- A as D,
397
- h as I,
398
- p as a,
399
- w as b,
400
- S as c
398
+ _ as D,
399
+ k as I,
400
+ f as a,
401
+ h as b,
402
+ A as c
401
403
  };
402
- //# sourceMappingURL=index-BL56fbXt.mjs.map
404
+ //# sourceMappingURL=index-DyIwN_67.mjs.map