@kopexa/tiptap 17.1.0 → 17.2.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 (78) hide show
  1. package/dist/{chunk-SFG45HEU.mjs → chunk-2U5CQUZH.mjs} +1 -1
  2. package/dist/{chunk-QCRK7XVV.mjs → chunk-32SUXCAQ.mjs} +1 -1
  3. package/dist/chunk-5GFFTVMZ.mjs +62 -0
  4. package/dist/{chunk-B6SP3ADV.mjs → chunk-7SRL3P4B.mjs} +8 -8
  5. package/dist/{chunk-WKJGDCGA.mjs → chunk-7VGROP26.mjs} +1 -1
  6. package/dist/{chunk-6YGMTHOY.mjs → chunk-7VW67NVL.mjs} +1 -1
  7. package/dist/{chunk-SCL22AGK.mjs → chunk-BXHPO3T7.mjs} +14 -4
  8. package/dist/{chunk-EBFGDPWY.mjs → chunk-E5NW3MJZ.mjs} +4 -4
  9. package/dist/chunk-LMCQMSW2.mjs +345 -0
  10. package/dist/{chunk-EH2JHHGJ.mjs → chunk-NEHW62L7.mjs} +1 -3
  11. package/dist/{chunk-KTIMXK5V.mjs → chunk-NSYSECKW.mjs} +3 -3
  12. package/dist/{chunk-Z6GJ2GKW.mjs → chunk-QAE2D4KV.mjs} +13 -13
  13. package/dist/{chunk-IY4SCXZN.mjs → chunk-UU6JK5HX.mjs} +105 -11
  14. package/dist/{chunk-DSK3HK5D.mjs → chunk-UVHVCION.mjs} +14 -4
  15. package/dist/{chunk-MYO2CUDR.mjs → chunk-VF3G2URZ.mjs} +10 -2
  16. package/dist/chunk-VRQ6OSAZ.mjs +76 -0
  17. package/dist/chunk-WAAH3NLG.mjs +77 -0
  18. package/dist/context/editor-file-context.d.mts +70 -0
  19. package/dist/context/editor-file-context.d.ts +70 -0
  20. package/dist/context/editor-file-context.js +96 -0
  21. package/dist/context/editor-file-context.mjs +12 -0
  22. package/dist/extensions/callout/callout-view.js +8 -1
  23. package/dist/extensions/callout/callout-view.mjs +1 -1
  24. package/dist/extensions/callout/index.js +8 -1
  25. package/dist/extensions/callout/index.mjs +2 -2
  26. package/dist/extensions/image/image-view.d.mts +15 -0
  27. package/dist/extensions/image/image-view.d.ts +15 -0
  28. package/dist/extensions/image/image-view.js +423 -0
  29. package/dist/extensions/image/image-view.mjs +12 -0
  30. package/dist/extensions/image/index.d.mts +66 -0
  31. package/dist/extensions/image/index.d.ts +66 -0
  32. package/dist/extensions/image/index.js +495 -0
  33. package/dist/extensions/image/index.mjs +16 -0
  34. package/dist/extensions/image/messages.d.mts +56 -0
  35. package/dist/extensions/image/messages.d.ts +56 -0
  36. package/dist/extensions/image/messages.js +85 -0
  37. package/dist/extensions/image/messages.mjs +7 -0
  38. package/dist/extensions/math/index.js +20 -6
  39. package/dist/extensions/math/index.mjs +4 -4
  40. package/dist/extensions/math/inline-math-view.js +10 -3
  41. package/dist/extensions/math/inline-math-view.mjs +1 -1
  42. package/dist/extensions/math/inline-math.js +10 -3
  43. package/dist/extensions/math/inline-math.mjs +2 -2
  44. package/dist/extensions/math/math-block-view.js +10 -3
  45. package/dist/extensions/math/math-block-view.mjs +1 -1
  46. package/dist/hooks/use-create-editor.d.mts +12 -2
  47. package/dist/hooks/use-create-editor.d.ts +12 -2
  48. package/dist/hooks/use-create-editor.js +809 -237
  49. package/dist/hooks/use-create-editor.mjs +14 -10
  50. package/dist/index.d.mts +7 -2
  51. package/dist/index.d.ts +7 -2
  52. package/dist/index.js +1261 -630
  53. package/dist/index.mjs +51 -37
  54. package/dist/presets/basic/editor-header.mjs +16 -16
  55. package/dist/presets/basic/index.d.mts +2 -0
  56. package/dist/presets/basic/index.d.ts +2 -0
  57. package/dist/presets/basic/index.js +1198 -628
  58. package/dist/presets/basic/index.mjs +36 -32
  59. package/dist/ui/bubble-menu/index.mjs +5 -5
  60. package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +2 -2
  61. package/dist/ui/color-highlight-popover/index.mjs +2 -2
  62. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +2 -2
  63. package/dist/ui/link-popover/index.mjs +3 -3
  64. package/dist/ui/link-popover/link-popover.mjs +3 -3
  65. package/dist/ui/link-popover/use-link-popover.mjs +2 -2
  66. package/dist/ui/slash-dropdown-menu/index.js +1 -3
  67. package/dist/ui/slash-dropdown-menu/index.mjs +6 -6
  68. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +1 -3
  69. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +4 -4
  70. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +1 -3
  71. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +1 -1
  72. package/dist/ui/suggestion-menu/index.mjs +2 -2
  73. package/dist/ui/suggestion-menu/suggestion-menu.mjs +2 -2
  74. package/package.json +25 -24
  75. package/dist/{chunk-XL5FS7LN.mjs → chunk-C5RQWJKE.mjs} +3 -3
  76. package/dist/{chunk-JNL4KY45.mjs → chunk-DZLGLP7R.mjs} +3 -3
  77. package/dist/{chunk-LHXRE26G.mjs → chunk-VTKJPVNM.mjs} +3 -3
  78. package/dist/{chunk-XLSZK3WJ.mjs → chunk-ZYFCSR3E.mjs} +3 -3
@@ -35,9 +35,9 @@ __export(basic_exports, {
35
35
  BasicEditor: () => BasicEditor
36
36
  });
37
37
  module.exports = __toCommonJS(basic_exports);
38
- var import_theme5 = require("@kopexa/theme");
39
- var import_react47 = require("@tiptap/react");
40
- var import_react48 = require("react");
38
+ var import_theme6 = require("@kopexa/theme");
39
+ var import_react51 = require("@tiptap/react");
40
+ var import_react52 = require("react");
41
41
 
42
42
  // src/context/editor-context.ts
43
43
  var import_react_utils = require("@kopexa/react-utils");
@@ -47,6 +47,7 @@ var [EditorUIProvider, useEditorUIContext] = (0, import_react_utils.createContex
47
47
  var import_extension_code = require("@kopexa/extension-code");
48
48
  var import_extension_controlref = require("@kopexa/extension-controlref");
49
49
  var import_extension_table = require("@kopexa/extension-table");
50
+ var import_extension_file_handler = require("@tiptap/extension-file-handler");
50
51
  var import_extension_highlight = require("@tiptap/extension-highlight");
51
52
  var import_extension_invisible_characters = __toESM(require("@tiptap/extension-invisible-characters"));
52
53
  var import_extension_list = require("@tiptap/extension-list");
@@ -58,19 +59,29 @@ var import_extension_text_style = require("@tiptap/extension-text-style");
58
59
  var import_extension_typography = require("@tiptap/extension-typography");
59
60
  var import_extension_unique_id = require("@tiptap/extension-unique-id");
60
61
  var import_extensions = require("@tiptap/extensions");
61
- var import_react18 = require("@tiptap/react");
62
+ var import_react22 = require("@tiptap/react");
62
63
  var import_starter_kit = require("@tiptap/starter-kit");
63
- var import_react19 = require("react");
64
+ var import_react23 = require("react");
65
+
66
+ // src/context/editor-file-context.tsx
67
+ var import_react = require("react");
68
+ var import_jsx_runtime = require("react/jsx-runtime");
69
+ var EditorFileContext = (0, import_react.createContext)(null);
70
+ var DEFAULT_CACHE_BUFFER = 2 * 60 * 1e3;
71
+ var DEFAULT_CACHE_TTL = 10 * 60 * 1e3;
72
+ function useEditorFile() {
73
+ return (0, import_react.useContext)(EditorFileContext);
74
+ }
64
75
 
65
76
  // src/extensions/callout/index.ts
66
77
  var import_core = require("@tiptap/core");
67
- var import_react4 = require("@tiptap/react");
78
+ var import_react5 = require("@tiptap/react");
68
79
 
69
80
  // src/extensions/callout/callout-view.tsx
70
81
  var import_icons2 = require("@kopexa/icons");
71
82
  var import_theme = require("@kopexa/theme");
72
- var import_react2 = require("@tiptap/react");
73
- var import_react3 = require("react");
83
+ var import_react3 = require("@tiptap/react");
84
+ var import_react4 = require("react");
74
85
 
75
86
  // src/extensions/callout/callout-settings.tsx
76
87
  var import_button = require("@kopexa/button");
@@ -79,7 +90,7 @@ var import_icons = require("@kopexa/icons");
79
90
  var import_input = require("@kopexa/input");
80
91
  var import_label = require("@kopexa/label");
81
92
  var import_select = require("@kopexa/select");
82
- var import_react = require("react");
93
+ var import_react2 = require("react");
83
94
  var import_react_intl2 = require("react-intl");
84
95
 
85
96
  // src/extensions/callout/messages.ts
@@ -143,7 +154,7 @@ var messages = (0, import_react_intl.defineMessages)({
143
154
  });
144
155
 
145
156
  // src/extensions/callout/callout-settings.tsx
146
- var import_jsx_runtime = require("react/jsx-runtime");
157
+ var import_jsx_runtime2 = require("react/jsx-runtime");
147
158
  var VARIANTS = [
148
159
  { value: "default", messageKey: "variant_default" },
149
160
  { value: "info", messageKey: "variant_info" },
@@ -157,14 +168,14 @@ function CalloutSettings({
157
168
  getPos
158
169
  }) {
159
170
  const intl = (0, import_react_intl2.useIntl)();
160
- const [isOpen, setIsOpen] = (0, import_react.useState)(false);
161
- const [localAttrs, setLocalAttrs] = (0, import_react.useState)(attrs);
162
- (0, import_react.useEffect)(() => {
171
+ const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
172
+ const [localAttrs, setLocalAttrs] = (0, import_react2.useState)(attrs);
173
+ (0, import_react2.useEffect)(() => {
163
174
  if (isOpen) {
164
175
  setLocalAttrs(attrs);
165
176
  }
166
177
  }, [isOpen, attrs]);
167
- const handleSave = (0, import_react.useCallback)(() => {
178
+ const handleSave = (0, import_react2.useCallback)(() => {
168
179
  const pos = getPos();
169
180
  if (pos === void 0) return;
170
181
  editor.view.dispatch(
@@ -172,17 +183,17 @@ function CalloutSettings({
172
183
  );
173
184
  setIsOpen(false);
174
185
  }, [editor, localAttrs, getPos]);
175
- const handleCancel = (0, import_react.useCallback)(() => {
186
+ const handleCancel = (0, import_react2.useCallback)(() => {
176
187
  setLocalAttrs(attrs);
177
188
  setIsOpen(false);
178
189
  }, [attrs]);
179
- const handleVariantChange = (0, import_react.useCallback)((value) => {
190
+ const handleVariantChange = (0, import_react2.useCallback)((value) => {
180
191
  setLocalAttrs((prev) => ({
181
192
  ...prev,
182
193
  variant: String(value)
183
194
  }));
184
195
  }, []);
185
- const handleTitleChange = (0, import_react.useCallback)(
196
+ const handleTitleChange = (0, import_react2.useCallback)(
186
197
  (e) => {
187
198
  const value = e.target.value;
188
199
  setLocalAttrs((prev) => ({
@@ -195,8 +206,8 @@ function CalloutSettings({
195
206
  if (!editor.isEditable) {
196
207
  return null;
197
208
  }
198
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
209
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
210
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
200
211
  import_button.IconButton,
201
212
  {
202
213
  size: "sm",
@@ -207,30 +218,30 @@ function CalloutSettings({
207
218
  e.preventDefault();
208
219
  setIsOpen(true);
209
220
  },
210
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SettingsIcon, { className: "size-3.5" })
221
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.SettingsIcon, { className: "size-3.5" })
211
222
  }
212
223
  ),
213
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Content, { children: [
214
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Title, { children: intl.formatMessage(messages.settings) }) }),
215
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4", children: [
216
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
217
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.variant) }),
218
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
224
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_dialog.Dialog.Content, { children: [
225
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Title, { children: intl.formatMessage(messages.settings) }) }),
226
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-4", children: [
227
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1.5", children: [
228
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.variant) }),
229
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
219
230
  import_select.Select,
220
231
  {
221
232
  size: "sm",
222
233
  value: localAttrs.variant,
223
234
  onValueChange: handleVariantChange,
224
235
  children: [
225
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Value, {}) }),
226
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Content, { children: VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Item, { value: v.value, children: intl.formatMessage(messages[v.messageKey]) }, v.value)) })
236
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.Select.Value, {}) }),
237
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.Select.Content, { children: VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.Select.Item, { value: v.value, children: intl.formatMessage(messages[v.messageKey]) }, v.value)) })
227
238
  ]
228
239
  }
229
240
  )
230
241
  ] }),
231
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
232
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.title) }),
233
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1.5", children: [
243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.title) }),
244
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
234
245
  import_input.Input,
235
246
  {
236
247
  size: "sm",
@@ -241,34 +252,41 @@ function CalloutSettings({
241
252
  )
242
253
  ] })
243
254
  ] }) }),
244
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Footer, { children: [
245
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages.cancel) }),
246
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: handleSave, children: intl.formatMessage(messages.save) })
255
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_dialog.Dialog.Footer, { children: [
256
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_button.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages.cancel) }),
257
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_button.Button, { onClick: handleSave, children: intl.formatMessage(messages.save) })
247
258
  ] })
248
259
  ] }) })
249
260
  ] });
250
261
  }
251
262
 
252
263
  // src/extensions/callout/callout-view.tsx
253
- var import_jsx_runtime2 = require("react/jsx-runtime");
264
+ var import_jsx_runtime3 = require("react/jsx-runtime");
254
265
  function getVariantIcon(variant, iconClass) {
255
266
  switch (variant) {
256
267
  case "info":
257
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.InfoIcon, { className: iconClass });
268
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.InfoIcon, { className: iconClass });
258
269
  case "success":
259
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.CheckCirleIcon, { className: iconClass });
270
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.CheckCirleIcon, { className: iconClass });
260
271
  case "warning":
261
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.AlertIcon, { className: iconClass });
272
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.AlertIcon, { className: iconClass });
262
273
  case "destructive":
263
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.AlertCircleIcon, { className: iconClass });
274
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.AlertCircleIcon, { className: iconClass });
264
275
  default:
265
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.ShellIcon, { className: iconClass });
276
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.ShellIcon, { className: iconClass });
266
277
  }
267
278
  }
268
279
  function CalloutNodeView({ editor, node, getPos }) {
269
280
  const attrs = node.attrs;
270
281
  const { variant = "info", title } = attrs;
271
- const styles = (0, import_react3.useMemo)(
282
+ const isEditable = (0, import_react3.useEditorState)({
283
+ editor,
284
+ selector: ({ editor: e }) => {
285
+ var _a;
286
+ return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
287
+ }
288
+ });
289
+ const styles = (0, import_react4.useMemo)(
272
290
  () => (0, import_theme.callout)({
273
291
  variant,
274
292
  radius: "md",
@@ -276,19 +294,19 @@ function CalloutNodeView({ editor, node, getPos }) {
276
294
  }),
277
295
  [variant]
278
296
  );
279
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
280
- import_react2.NodeViewWrapper,
297
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
298
+ import_react3.NodeViewWrapper,
281
299
  {
282
300
  className: styles.root(),
283
301
  "data-type": "callout",
284
302
  "data-variant": variant,
285
303
  children: [
286
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.iconContainer(), children: getVariantIcon(variant, styles.icon()) }),
287
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.content(), children: [
288
- title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.title(), children: title }),
289
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewContent, { className: "callout-content" })
304
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.iconContainer(), children: getVariantIcon(variant, styles.icon()) }),
305
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: styles.content(), children: [
306
+ title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.title(), children: title }),
307
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.NodeViewContent, { className: "callout-content" })
290
308
  ] }),
291
- editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
309
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
292
310
  CalloutSettings,
293
311
  {
294
312
  editor,
@@ -351,7 +369,7 @@ var CalloutNode = import_core.Node.create({
351
369
  ];
352
370
  },
353
371
  addNodeView() {
354
- return (0, import_react4.ReactNodeViewRenderer)(CalloutNodeView);
372
+ return (0, import_react5.ReactNodeViewRenderer)(CalloutNodeView);
355
373
  },
356
374
  addCommands() {
357
375
  return {
@@ -404,10 +422,463 @@ var CalloutNode = import_core.Node.create({
404
422
  }
405
423
  });
406
424
 
425
+ // src/extensions/image/index.ts
426
+ var import_core2 = require("@tiptap/core");
427
+ var import_react8 = require("@tiptap/react");
428
+
429
+ // src/extensions/image/image-view.tsx
430
+ var import_button2 = require("@kopexa/button");
431
+ var import_icons3 = require("@kopexa/icons");
432
+ var import_theme2 = require("@kopexa/theme");
433
+ var import_react6 = require("@tiptap/react");
434
+ var import_react7 = require("react");
435
+ var import_react_intl4 = require("react-intl");
436
+
437
+ // src/extensions/image/messages.ts
438
+ var import_react_intl3 = require("react-intl");
439
+ var messages2 = (0, import_react_intl3.defineMessages)({
440
+ loading: {
441
+ id: "editor.image.loading",
442
+ defaultMessage: "Loading image..."
443
+ },
444
+ error: {
445
+ id: "editor.image.error",
446
+ defaultMessage: "Failed to load image"
447
+ },
448
+ upload_error: {
449
+ id: "editor.image.upload_error",
450
+ defaultMessage: "Failed to upload image"
451
+ },
452
+ uploading: {
453
+ id: "editor.image.uploading",
454
+ defaultMessage: "Uploading..."
455
+ },
456
+ upload_placeholder: {
457
+ id: "editor.image.upload_placeholder",
458
+ defaultMessage: "Click to upload or drag & drop"
459
+ },
460
+ upload_hint: {
461
+ id: "editor.image.upload_hint",
462
+ defaultMessage: "PNG, JPG, GIF, WebP, SVG"
463
+ },
464
+ alt_text: {
465
+ id: "editor.image.alt_text",
466
+ defaultMessage: "Alt text"
467
+ },
468
+ alt_placeholder: {
469
+ id: "editor.image.alt_placeholder",
470
+ defaultMessage: "Describe the image..."
471
+ },
472
+ files_not_supported: {
473
+ id: "editor.image.files_not_supported",
474
+ defaultMessage: "File upload is not configured"
475
+ },
476
+ file_too_large: {
477
+ id: "editor.image.file_too_large",
478
+ defaultMessage: "File is too large (max {maxSize})"
479
+ },
480
+ invalid_type: {
481
+ id: "editor.image.invalid_type",
482
+ defaultMessage: "Invalid file type"
483
+ },
484
+ retry: {
485
+ id: "editor.image.retry",
486
+ defaultMessage: "Retry"
487
+ },
488
+ remove: {
489
+ id: "editor.image.remove",
490
+ defaultMessage: "Remove"
491
+ }
492
+ });
493
+
494
+ // src/extensions/image/image-view.tsx
495
+ var import_jsx_runtime4 = require("react/jsx-runtime");
496
+ function ImageNodeView({ editor, node, getPos }) {
497
+ var _a;
498
+ const intl = (0, import_react_intl4.useIntl)();
499
+ const fileHandler = useEditorFile();
500
+ const attrs = node.attrs;
501
+ const isEditable = (0, import_react6.useEditorState)({
502
+ editor,
503
+ selector: ({ editor: e }) => {
504
+ var _a2;
505
+ return (_a2 = e == null ? void 0 : e.isEditable) != null ? _a2 : false;
506
+ }
507
+ });
508
+ const { src, alt, title, uploadState, uploadProgress } = attrs;
509
+ const [resolvedUrl, setResolvedUrl] = (0, import_react7.useState)(null);
510
+ const [resolveState, setResolveState] = (0, import_react7.useState)("idle");
511
+ const needsResolve = (_a = fileHandler == null ? void 0 : fileHandler.isReference(src)) != null ? _a : false;
512
+ const resolveImage = (0, import_react7.useCallback)(async () => {
513
+ if (!src) return;
514
+ if (!needsResolve) {
515
+ setResolvedUrl(src);
516
+ setResolveState("resolved");
517
+ return;
518
+ }
519
+ if (!fileHandler) {
520
+ setResolveState("error");
521
+ return;
522
+ }
523
+ setResolveState("loading");
524
+ try {
525
+ const url = await fileHandler.resolve(src);
526
+ setResolvedUrl(url);
527
+ setResolveState("resolved");
528
+ } catch {
529
+ setResolveState("error");
530
+ }
531
+ }, [src, needsResolve, fileHandler]);
532
+ (0, import_react7.useEffect)(() => {
533
+ resolveImage();
534
+ }, [resolveImage]);
535
+ const handleRetry = (0, import_react7.useCallback)(() => {
536
+ resolveImage();
537
+ }, [resolveImage]);
538
+ const handleRemove = (0, import_react7.useCallback)(() => {
539
+ const pos = getPos();
540
+ if (pos === void 0) return;
541
+ editor.commands.deleteRange({
542
+ from: pos,
543
+ to: pos + node.nodeSize
544
+ });
545
+ }, [editor, getPos, node.nodeSize]);
546
+ const fileInputRef = (0, import_react7.useRef)(null);
547
+ const handleFileSelect = (0, import_react7.useCallback)(
548
+ async (file) => {
549
+ if (!fileHandler) return;
550
+ const pos = getPos();
551
+ if (pos === void 0) return;
552
+ editor.view.dispatch(
553
+ editor.state.tr.setNodeMarkup(pos, void 0, {
554
+ ...attrs,
555
+ uploadState: "uploading",
556
+ uploadProgress: 0
557
+ })
558
+ );
559
+ try {
560
+ const ref = await fileHandler.upload(file, (percent) => {
561
+ const currentPos = getPos();
562
+ if (currentPos === void 0) return;
563
+ editor.view.dispatch(
564
+ editor.state.tr.setNodeMarkup(currentPos, void 0, {
565
+ ...attrs,
566
+ uploadState: "uploading",
567
+ uploadProgress: percent
568
+ })
569
+ );
570
+ });
571
+ const finalPos = getPos();
572
+ if (finalPos === void 0) return;
573
+ editor.view.dispatch(
574
+ editor.state.tr.setNodeMarkup(finalPos, void 0, {
575
+ src: ref,
576
+ uploadState: null,
577
+ uploadProgress: null
578
+ })
579
+ );
580
+ } catch {
581
+ const errorPos = getPos();
582
+ if (errorPos === void 0) return;
583
+ editor.view.dispatch(
584
+ editor.state.tr.setNodeMarkup(errorPos, void 0, {
585
+ ...attrs,
586
+ uploadState: "error",
587
+ uploadProgress: null
588
+ })
589
+ );
590
+ }
591
+ },
592
+ [fileHandler, editor, getPos, attrs]
593
+ );
594
+ const handleInputChange = (0, import_react7.useCallback)(
595
+ (e) => {
596
+ var _a2;
597
+ const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
598
+ if (file) {
599
+ handleFileSelect(file);
600
+ }
601
+ },
602
+ [handleFileSelect]
603
+ );
604
+ const handleDrop = (0, import_react7.useCallback)(
605
+ (e) => {
606
+ e.preventDefault();
607
+ e.stopPropagation();
608
+ const file = e.dataTransfer.files[0];
609
+ if (file == null ? void 0 : file.type.startsWith("image/")) {
610
+ handleFileSelect(file);
611
+ }
612
+ },
613
+ [handleFileSelect]
614
+ );
615
+ const handleDragOver = (0, import_react7.useCallback)((e) => {
616
+ e.preventDefault();
617
+ e.stopPropagation();
618
+ }, []);
619
+ const styles = (0, import_react7.useMemo)(() => (0, import_theme2.imagePlaceholder)({ size: "md" }), []);
620
+ const errorStyles = (0, import_react7.useMemo)(
621
+ () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "error" }),
622
+ []
623
+ );
624
+ const uploadingStyles = (0, import_react7.useMemo)(
625
+ () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "uploading" }),
626
+ []
627
+ );
628
+ const disabledStyles = (0, import_react7.useMemo)(
629
+ () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "disabled" }),
630
+ []
631
+ );
632
+ const isEmpty = !src;
633
+ if (isEmpty && !uploadState) {
634
+ if (!fileHandler) {
635
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: disabledStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: disabledStyles.content(), children: [
636
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.ImageIcon, { className: disabledStyles.icon() }),
637
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: disabledStyles.text(), children: intl.formatMessage(messages2.files_not_supported) }),
638
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
639
+ import_button2.IconButton,
640
+ {
641
+ size: "sm",
642
+ variant: "ghost",
643
+ onClick: handleRemove,
644
+ "aria-label": intl.formatMessage(messages2.remove),
645
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
646
+ }
647
+ )
648
+ ] }) }) });
649
+ }
650
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
651
+ "div",
652
+ {
653
+ className: styles.root(),
654
+ onClick: () => {
655
+ var _a2;
656
+ return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
657
+ },
658
+ onDrop: handleDrop,
659
+ onDragOver: handleDragOver,
660
+ children: [
661
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.content(), children: [
662
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.UploadIcon, { className: styles.icon() }),
663
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.text(), children: intl.formatMessage(messages2.upload_placeholder) }),
664
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.hint(), children: intl.formatMessage(messages2.upload_hint) })
665
+ ] }),
666
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
667
+ "input",
668
+ {
669
+ ref: fileInputRef,
670
+ type: "file",
671
+ accept: "image/*",
672
+ className: "hidden",
673
+ onChange: handleInputChange
674
+ }
675
+ ),
676
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
677
+ import_button2.IconButton,
678
+ {
679
+ size: "sm",
680
+ variant: "ghost",
681
+ className: styles.removeButton(),
682
+ onClick: (e) => {
683
+ e.stopPropagation();
684
+ handleRemove();
685
+ },
686
+ "aria-label": intl.formatMessage(messages2.remove),
687
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-3.5" })
688
+ }
689
+ )
690
+ ]
691
+ }
692
+ ) });
693
+ }
694
+ if (uploadState === "uploading") {
695
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: uploadingStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: uploadingStyles.content(), children: [
696
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative size-12", children: [
697
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
698
+ "svg",
699
+ {
700
+ className: "size-12 -rotate-90",
701
+ viewBox: "0 0 36 36",
702
+ "aria-hidden": "true",
703
+ children: [
704
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
705
+ "circle",
706
+ {
707
+ cx: "18",
708
+ cy: "18",
709
+ r: "16",
710
+ fill: "none",
711
+ className: "stroke-muted",
712
+ strokeWidth: "2"
713
+ }
714
+ ),
715
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
716
+ "circle",
717
+ {
718
+ cx: "18",
719
+ cy: "18",
720
+ r: "16",
721
+ fill: "none",
722
+ className: "stroke-primary",
723
+ strokeWidth: "2",
724
+ strokeDasharray: 100,
725
+ strokeDashoffset: 100 - (uploadProgress != null ? uploadProgress : 0),
726
+ strokeLinecap: "round"
727
+ }
728
+ )
729
+ ]
730
+ }
731
+ ),
732
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "absolute inset-0 flex items-center justify-center text-xs font-medium", children: [
733
+ uploadProgress != null ? uploadProgress : 0,
734
+ "%"
735
+ ] })
736
+ ] }),
737
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: uploadingStyles.text(), children: intl.formatMessage(messages2.uploading) })
738
+ ] }) }) });
739
+ }
740
+ if (uploadState === "error") {
741
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: errorStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: errorStyles.content(), children: [
742
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.AlertCircleIcon, { className: errorStyles.icon() }),
743
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages2.upload_error) }),
744
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
745
+ import_button2.IconButton,
746
+ {
747
+ size: "sm",
748
+ variant: "ghost",
749
+ onClick: handleRemove,
750
+ "aria-label": intl.formatMessage(messages2.remove),
751
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
752
+ }
753
+ ) })
754
+ ] }) }) });
755
+ }
756
+ if (resolveState === "loading") {
757
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${uploadingStyles.root()} animate-pulse`, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: uploadingStyles.text(), children: intl.formatMessage(messages2.loading) }) }) });
758
+ }
759
+ if (resolveState === "error") {
760
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: errorStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: errorStyles.content(), children: [
761
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.AlertCircleIcon, { className: errorStyles.icon() }),
762
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages2.error) }),
763
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex gap-2", children: [
764
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
765
+ import_button2.IconButton,
766
+ {
767
+ size: "sm",
768
+ variant: "outline",
769
+ onClick: handleRetry,
770
+ "aria-label": intl.formatMessage(messages2.retry),
771
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.ArrowCounterClockwiseIcon, { className: "size-4" })
772
+ }
773
+ ),
774
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
775
+ import_button2.IconButton,
776
+ {
777
+ size: "sm",
778
+ variant: "ghost",
779
+ onClick: handleRemove,
780
+ "aria-label": intl.formatMessage(messages2.remove),
781
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
782
+ }
783
+ )
784
+ ] })
785
+ ] }) }) });
786
+ }
787
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react6.NodeViewWrapper, { className: "my-4 relative group", "data-type": "image", children: [
788
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
789
+ "img",
790
+ {
791
+ src: resolvedUrl != null ? resolvedUrl : src,
792
+ alt: alt != null ? alt : "",
793
+ title: title != null ? title : void 0,
794
+ className: "max-w-full h-auto rounded-lg",
795
+ draggable: false
796
+ }
797
+ ),
798
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity flex gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
799
+ import_button2.IconButton,
800
+ {
801
+ size: "sm",
802
+ variant: "outline",
803
+ onClick: handleRemove,
804
+ "aria-label": intl.formatMessage(messages2.remove),
805
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-3.5" })
806
+ }
807
+ ) })
808
+ ] });
809
+ }
810
+
811
+ // src/extensions/image/index.ts
812
+ var ImageNode = import_core2.Node.create({
813
+ name: "image",
814
+ group: "block",
815
+ atom: true,
816
+ draggable: true,
817
+ addOptions() {
818
+ return {
819
+ allowBase64: true,
820
+ HTMLAttributes: {}
821
+ };
822
+ },
823
+ addAttributes() {
824
+ return {
825
+ src: {
826
+ default: null
827
+ },
828
+ alt: {
829
+ default: null
830
+ },
831
+ title: {
832
+ default: null
833
+ },
834
+ width: {
835
+ default: null
836
+ },
837
+ height: {
838
+ default: null
839
+ },
840
+ uploadState: {
841
+ default: null,
842
+ rendered: false
843
+ },
844
+ uploadProgress: {
845
+ default: null,
846
+ rendered: false
847
+ }
848
+ };
849
+ },
850
+ parseHTML() {
851
+ return [
852
+ {
853
+ tag: "img[src]"
854
+ }
855
+ ];
856
+ },
857
+ renderHTML({ HTMLAttributes }) {
858
+ return [
859
+ "img",
860
+ (0, import_core2.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)
861
+ ];
862
+ },
863
+ addNodeView() {
864
+ return (0, import_react8.ReactNodeViewRenderer)(ImageNodeView);
865
+ },
866
+ addCommands() {
867
+ return {
868
+ setImage: (options) => ({ commands }) => {
869
+ return commands.insertContent({
870
+ type: this.name,
871
+ attrs: options
872
+ });
873
+ }
874
+ };
875
+ }
876
+ });
877
+
407
878
  // src/extensions/link/index.ts
408
879
  var import_extension_link = __toESM(require("@tiptap/extension-link"));
409
880
  var import_state = require("@tiptap/pm/state");
410
- var import_react5 = require("@tiptap/react");
881
+ var import_react9 = require("@tiptap/react");
411
882
  var Link = import_extension_link.default.extend({
412
883
  inclusive: false,
413
884
  parseHTML() {
@@ -435,7 +906,7 @@ var Link = import_extension_link.default.extend({
435
906
  const { schema, doc, tr } = view.state;
436
907
  let range;
437
908
  if (schema.marks.link) {
438
- range = (0, import_react5.getMarkRange)(doc.resolve(pos), schema.marks.link);
909
+ range = (0, import_react9.getMarkRange)(doc.resolve(pos), schema.marks.link);
439
910
  }
440
911
  if (!range) {
441
912
  return;
@@ -460,23 +931,23 @@ var Link = import_extension_link.default.extend({
460
931
  });
461
932
 
462
933
  // src/extensions/math/index.ts
463
- var import_core3 = require("@tiptap/core");
464
- var import_react11 = require("@tiptap/react");
934
+ var import_core4 = require("@tiptap/core");
935
+ var import_react15 = require("@tiptap/react");
465
936
 
466
937
  // src/extensions/math/math-block-view.tsx
467
- var import_button2 = require("@kopexa/button");
938
+ var import_button3 = require("@kopexa/button");
468
939
  var import_dialog2 = require("@kopexa/dialog");
469
- var import_icons3 = require("@kopexa/icons");
940
+ var import_icons4 = require("@kopexa/icons");
470
941
  var import_label2 = require("@kopexa/label");
471
- var import_react6 = require("@tiptap/react");
942
+ var import_react10 = require("@tiptap/react");
472
943
  var import_katex = __toESM(require("katex"));
473
944
  var import_katex_min = require("katex/dist/katex.min.css");
474
- var import_react7 = require("react");
475
- var import_react_intl4 = require("react-intl");
945
+ var import_react11 = require("react");
946
+ var import_react_intl6 = require("react-intl");
476
947
 
477
948
  // src/extensions/math/messages.ts
478
- var import_react_intl3 = require("react-intl");
479
- var messages2 = (0, import_react_intl3.defineMessages)({
949
+ var import_react_intl5 = require("react-intl");
950
+ var messages3 = (0, import_react_intl5.defineMessages)({
480
951
  title: {
481
952
  id: "editor.math.title",
482
953
  defaultMessage: "Formula",
@@ -525,21 +996,28 @@ var messages2 = (0, import_react_intl3.defineMessages)({
525
996
  });
526
997
 
527
998
  // src/extensions/math/math-block-view.tsx
528
- var import_jsx_runtime3 = require("react/jsx-runtime");
999
+ var import_jsx_runtime5 = require("react/jsx-runtime");
529
1000
  function MathBlockView({ editor, node, getPos }) {
530
- const intl = (0, import_react_intl4.useIntl)();
1001
+ const intl = (0, import_react_intl6.useIntl)();
531
1002
  const attrs = node.attrs;
532
1003
  const { latex = "" } = attrs;
533
- const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
534
- const [localLatex, setLocalLatex] = (0, import_react7.useState)(latex);
535
- const [error, setError] = (0, import_react7.useState)(null);
536
- (0, import_react7.useEffect)(() => {
1004
+ const isEditable = (0, import_react10.useEditorState)({
1005
+ editor,
1006
+ selector: ({ editor: e }) => {
1007
+ var _a;
1008
+ return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
1009
+ }
1010
+ });
1011
+ const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
1012
+ const [localLatex, setLocalLatex] = (0, import_react11.useState)(latex);
1013
+ const [error, setError] = (0, import_react11.useState)(null);
1014
+ (0, import_react11.useEffect)(() => {
537
1015
  if (isOpen) {
538
1016
  setLocalLatex(latex);
539
1017
  setError(null);
540
1018
  }
541
1019
  }, [isOpen, latex]);
542
- const renderedHtml = (0, import_react7.useMemo)(() => {
1020
+ const renderedHtml = (0, import_react11.useMemo)(() => {
543
1021
  if (!latex) return null;
544
1022
  try {
545
1023
  return import_katex.default.renderToString(latex, {
@@ -551,7 +1029,7 @@ function MathBlockView({ editor, node, getPos }) {
551
1029
  return null;
552
1030
  }
553
1031
  }, [latex]);
554
- const previewHtml = (0, import_react7.useMemo)(() => {
1032
+ const previewHtml = (0, import_react11.useMemo)(() => {
555
1033
  if (!localLatex) return null;
556
1034
  try {
557
1035
  setError(null);
@@ -561,11 +1039,11 @@ function MathBlockView({ editor, node, getPos }) {
561
1039
  output: "html"
562
1040
  });
563
1041
  } catch (_e) {
564
- setError(intl.formatMessage(messages2.invalid_latex));
1042
+ setError(intl.formatMessage(messages3.invalid_latex));
565
1043
  return null;
566
1044
  }
567
1045
  }, [localLatex, intl]);
568
- const handleSave = (0, import_react7.useCallback)(() => {
1046
+ const handleSave = (0, import_react11.useCallback)(() => {
569
1047
  const pos = getPos();
570
1048
  if (pos === void 0) return;
571
1049
  editor.view.dispatch(
@@ -573,89 +1051,89 @@ function MathBlockView({ editor, node, getPos }) {
573
1051
  );
574
1052
  setIsOpen(false);
575
1053
  }, [editor, localLatex, getPos]);
576
- const handleCancel = (0, import_react7.useCallback)(() => {
1054
+ const handleCancel = (0, import_react11.useCallback)(() => {
577
1055
  setLocalLatex(latex);
578
1056
  setError(null);
579
1057
  setIsOpen(false);
580
1058
  }, [latex]);
581
- const handleOpenEditor = (0, import_react7.useCallback)(
1059
+ const handleOpenEditor = (0, import_react11.useCallback)(
582
1060
  (e) => {
583
1061
  e.stopPropagation();
584
1062
  e.preventDefault();
585
- if (editor.isEditable) {
1063
+ if (isEditable) {
586
1064
  setIsOpen(true);
587
1065
  }
588
1066
  },
589
- [editor.isEditable]
1067
+ [isEditable]
590
1068
  );
591
1069
  const isEmpty = !latex;
592
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
593
- import_react6.NodeViewWrapper,
1070
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1071
+ import_react10.NodeViewWrapper,
594
1072
  {
595
1073
  className: "my-4 relative group",
596
1074
  "data-type": "math-block",
597
1075
  "data-latex": latex,
598
1076
  children: [
599
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1077
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
600
1078
  "button",
601
1079
  {
602
1080
  type: "button",
603
1081
  className: "w-full flex items-center justify-center min-h-16 p-4 rounded-md border border-border bg-muted/30 cursor-pointer hover:bg-muted/50 transition-colors",
604
1082
  onClick: handleOpenEditor,
605
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
606
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-lg font-serif", children: "\u2211" }),
607
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-sm", children: intl.formatMessage(messages2.empty_formula) })
608
- ] }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1083
+ children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
1084
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-lg font-serif", children: "\u2211" }),
1085
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm", children: intl.formatMessage(messages3.empty_formula) })
1086
+ ] }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
609
1087
  "div",
610
1088
  {
611
1089
  className: "katex-display",
612
1090
  dangerouslySetInnerHTML: { __html: renderedHtml }
613
1091
  }
614
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages2.invalid_latex) })
1092
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages3.invalid_latex) })
615
1093
  }
616
1094
  ),
617
- editor.isEditable && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
618
- import_button2.IconButton,
1095
+ isEditable && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1096
+ import_button3.IconButton,
619
1097
  {
620
1098
  size: "sm",
621
1099
  variant: "ghost",
622
1100
  className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
623
- "aria-label": intl.formatMessage(messages2.edit),
1101
+ "aria-label": intl.formatMessage(messages3.edit),
624
1102
  onClick: handleOpenEditor,
625
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons3.EditIcon, { className: "size-3.5" })
1103
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.EditIcon, { className: "size-3.5" })
626
1104
  }
627
1105
  ),
628
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog2.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dialog2.Dialog.Content, { children: [
629
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog2.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog2.Dialog.Title, { children: intl.formatMessage(messages2.title) }) }),
630
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-4", children: [
631
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-1.5", children: [
632
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages2.latex_input) }),
633
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1106
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog2.Dialog.Content, { children: [
1107
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Title, { children: intl.formatMessage(messages3.title) }) }),
1108
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4", children: [
1109
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1110
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages3.latex_input) }),
1111
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
634
1112
  "textarea",
635
1113
  {
636
1114
  className: "w-full min-h-24 p-3 rounded-md border border-input bg-background font-mono text-sm resize-y focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
637
1115
  value: localLatex,
638
1116
  onChange: (e) => setLocalLatex(e.target.value),
639
- placeholder: intl.formatMessage(messages2.latex_placeholder),
1117
+ placeholder: intl.formatMessage(messages3.latex_placeholder),
640
1118
  spellCheck: false
641
1119
  }
642
1120
  ),
643
- error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-xs text-destructive", children: error })
1121
+ error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-destructive", children: error })
644
1122
  ] }),
645
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-1.5", children: [
646
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages2.preview) }),
647
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "min-h-16 p-4 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1123
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1124
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages3.preview) }),
1125
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-16 p-4 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
648
1126
  "div",
649
1127
  {
650
1128
  className: "katex-display",
651
1129
  dangerouslySetInnerHTML: { __html: previewHtml }
652
1130
  }
653
- ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages2.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages2.latex_placeholder) }) })
1131
+ ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages3.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages3.latex_placeholder) }) })
654
1132
  ] })
655
1133
  ] }) }),
656
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dialog2.Dialog.Footer, { children: [
657
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_button2.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages2.cancel) }),
658
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_button2.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages2.save) })
1134
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog2.Dialog.Footer, { children: [
1135
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button3.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1136
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button3.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages3.save) })
659
1137
  ] })
660
1138
  ] }) })
661
1139
  ]
@@ -664,33 +1142,40 @@ function MathBlockView({ editor, node, getPos }) {
664
1142
  }
665
1143
 
666
1144
  // src/extensions/math/inline-math.ts
667
- var import_core2 = require("@tiptap/core");
668
- var import_react10 = require("@tiptap/react");
1145
+ var import_core3 = require("@tiptap/core");
1146
+ var import_react14 = require("@tiptap/react");
669
1147
 
670
1148
  // src/extensions/math/inline-math-view.tsx
671
- var import_button3 = require("@kopexa/button");
1149
+ var import_button4 = require("@kopexa/button");
672
1150
  var import_dialog3 = require("@kopexa/dialog");
673
1151
  var import_label3 = require("@kopexa/label");
674
- var import_react8 = require("@tiptap/react");
1152
+ var import_react12 = require("@tiptap/react");
675
1153
  var import_katex2 = __toESM(require("katex"));
676
1154
  var import_katex_min2 = require("katex/dist/katex.min.css");
677
- var import_react9 = require("react");
678
- var import_react_intl5 = require("react-intl");
679
- var import_jsx_runtime4 = require("react/jsx-runtime");
1155
+ var import_react13 = require("react");
1156
+ var import_react_intl7 = require("react-intl");
1157
+ var import_jsx_runtime6 = require("react/jsx-runtime");
680
1158
  function InlineMathView({ editor, node, getPos }) {
681
- const intl = (0, import_react_intl5.useIntl)();
1159
+ const intl = (0, import_react_intl7.useIntl)();
682
1160
  const attrs = node.attrs;
683
1161
  const { latex = "" } = attrs;
684
- const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
685
- const [localLatex, setLocalLatex] = (0, import_react9.useState)(latex);
686
- const [error, setError] = (0, import_react9.useState)(null);
687
- (0, import_react9.useEffect)(() => {
1162
+ const isEditable = (0, import_react12.useEditorState)({
1163
+ editor,
1164
+ selector: ({ editor: e }) => {
1165
+ var _a;
1166
+ return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
1167
+ }
1168
+ });
1169
+ const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
1170
+ const [localLatex, setLocalLatex] = (0, import_react13.useState)(latex);
1171
+ const [error, setError] = (0, import_react13.useState)(null);
1172
+ (0, import_react13.useEffect)(() => {
688
1173
  if (isOpen) {
689
1174
  setLocalLatex(latex);
690
1175
  setError(null);
691
1176
  }
692
1177
  }, [isOpen, latex]);
693
- const renderedHtml = (0, import_react9.useMemo)(() => {
1178
+ const renderedHtml = (0, import_react13.useMemo)(() => {
694
1179
  if (!latex) return null;
695
1180
  try {
696
1181
  return import_katex2.default.renderToString(latex, {
@@ -702,7 +1187,7 @@ function InlineMathView({ editor, node, getPos }) {
702
1187
  return null;
703
1188
  }
704
1189
  }, [latex]);
705
- const previewHtml = (0, import_react9.useMemo)(() => {
1190
+ const previewHtml = (0, import_react13.useMemo)(() => {
706
1191
  if (!localLatex) return null;
707
1192
  try {
708
1193
  setError(null);
@@ -712,11 +1197,11 @@ function InlineMathView({ editor, node, getPos }) {
712
1197
  output: "html"
713
1198
  });
714
1199
  } catch (_e) {
715
- setError(intl.formatMessage(messages2.invalid_latex));
1200
+ setError(intl.formatMessage(messages3.invalid_latex));
716
1201
  return null;
717
1202
  }
718
1203
  }, [localLatex, intl]);
719
- const handleSave = (0, import_react9.useCallback)(() => {
1204
+ const handleSave = (0, import_react13.useCallback)(() => {
720
1205
  const pos = getPos();
721
1206
  if (pos === void 0) return;
722
1207
  editor.view.dispatch(
@@ -724,74 +1209,74 @@ function InlineMathView({ editor, node, getPos }) {
724
1209
  );
725
1210
  setIsOpen(false);
726
1211
  }, [editor, localLatex, getPos]);
727
- const handleCancel = (0, import_react9.useCallback)(() => {
1212
+ const handleCancel = (0, import_react13.useCallback)(() => {
728
1213
  setLocalLatex(latex);
729
1214
  setError(null);
730
1215
  setIsOpen(false);
731
1216
  }, [latex]);
732
- const handleClick = (0, import_react9.useCallback)(
1217
+ const handleClick = (0, import_react13.useCallback)(
733
1218
  (e) => {
734
1219
  e.stopPropagation();
735
1220
  e.preventDefault();
736
- if (editor.isEditable) {
1221
+ if (isEditable) {
737
1222
  setIsOpen(true);
738
1223
  }
739
1224
  },
740
- [editor.isEditable]
1225
+ [isEditable]
741
1226
  );
742
1227
  const isEmpty = !latex;
743
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
744
- import_react8.NodeViewWrapper,
1228
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1229
+ import_react12.NodeViewWrapper,
745
1230
  {
746
1231
  as: "span",
747
1232
  className: "inline-math-wrapper",
748
1233
  "data-type": "inline-math",
749
1234
  "data-latex": latex,
750
1235
  children: [
751
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1236
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
752
1237
  "span",
753
1238
  {
754
- className: `inline-math cursor-pointer rounded px-0.5 transition-colors ${editor.isEditable ? "hover:bg-primary/10 hover:ring-1 hover:ring-primary/20" : ""} ${isEmpty ? "text-muted-foreground italic" : ""}`,
1239
+ className: `inline-math cursor-pointer rounded px-0.5 transition-colors ${isEditable ? "hover:bg-primary/10 hover:ring-1 hover:ring-primary/20" : ""} ${isEmpty ? "text-muted-foreground italic" : ""}`,
755
1240
  onClick: handleClick,
756
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-xs", children: "$?$" }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1241
+ children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs", children: "$?$" }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
757
1242
  "span",
758
1243
  {
759
1244
  dangerouslySetInnerHTML: { __html: renderedHtml }
760
1245
  }
761
- ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-destructive text-xs", children: latex })
1246
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-destructive text-xs", children: latex })
762
1247
  }
763
1248
  ),
764
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog3.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_dialog3.Dialog.Content, { children: [
765
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog3.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog3.Dialog.Title, { children: intl.formatMessage(messages2.title) }) }),
766
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog3.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "space-y-4", children: [
767
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "space-y-1.5", children: [
768
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages2.latex_input) }),
769
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1249
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dialog3.Dialog.Content, { children: [
1250
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Title, { children: intl.formatMessage(messages3.title) }) }),
1251
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-4", children: [
1252
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1253
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages3.latex_input) }),
1254
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
770
1255
  "input",
771
1256
  {
772
1257
  type: "text",
773
1258
  className: "w-full p-2 rounded-md border border-input bg-background font-mono text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
774
1259
  value: localLatex,
775
1260
  onChange: (e) => setLocalLatex(e.target.value),
776
- placeholder: intl.formatMessage(messages2.latex_placeholder),
1261
+ placeholder: intl.formatMessage(messages3.latex_placeholder),
777
1262
  spellCheck: false
778
1263
  }
779
1264
  ),
780
- error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-xs text-destructive", children: error })
1265
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-destructive", children: error })
781
1266
  ] }),
782
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "space-y-1.5", children: [
783
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages2.preview) }),
784
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "min-h-10 p-3 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1267
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1268
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages3.preview) }),
1269
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "min-h-10 p-3 rounded-md border border-border bg-muted/30 flex items-center justify-center", children: previewHtml ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
785
1270
  "span",
786
1271
  {
787
1272
  dangerouslySetInnerHTML: { __html: previewHtml }
788
1273
  }
789
- ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages2.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-muted-foreground text-sm", children: "$...$" }) })
1274
+ ) : localLatex ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages3.invalid_latex) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground text-sm", children: "$...$" }) })
790
1275
  ] })
791
1276
  ] }) }),
792
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_dialog3.Dialog.Footer, { children: [
793
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_button3.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages2.cancel) }),
794
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_button3.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages2.save) })
1277
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dialog3.Dialog.Footer, { children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1279
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages3.save) })
795
1280
  ] })
796
1281
  ] }) })
797
1282
  ]
@@ -800,7 +1285,7 @@ function InlineMathView({ editor, node, getPos }) {
800
1285
  }
801
1286
 
802
1287
  // src/extensions/math/inline-math.ts
803
- var InlineMath = import_core2.Node.create({
1288
+ var InlineMath = import_core3.Node.create({
804
1289
  name: "inlineMath",
805
1290
  group: "inline",
806
1291
  inline: true,
@@ -831,13 +1316,13 @@ var InlineMath = import_core2.Node.create({
831
1316
  renderHTML({ HTMLAttributes }) {
832
1317
  return [
833
1318
  "span",
834
- (0, import_core2.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1319
+ (0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
835
1320
  "data-type": "inline-math"
836
1321
  })
837
1322
  ];
838
1323
  },
839
1324
  addNodeView() {
840
- return (0, import_react10.ReactNodeViewRenderer)(InlineMathView, {
1325
+ return (0, import_react14.ReactNodeViewRenderer)(InlineMathView, {
841
1326
  as: "span"
842
1327
  });
843
1328
  },
@@ -854,7 +1339,7 @@ var InlineMath = import_core2.Node.create({
854
1339
  addInputRules() {
855
1340
  return [
856
1341
  // Inline math with $...$
857
- new import_core2.InputRule({
1342
+ new import_core3.InputRule({
858
1343
  // Match $...$ but not $$...$$
859
1344
  find: /(?<!\$)\$([^$]+)\$(?!\$)/,
860
1345
  handler: ({ state, range, match }) => {
@@ -868,7 +1353,7 @@ var InlineMath = import_core2.Node.create({
868
1353
  });
869
1354
 
870
1355
  // src/extensions/math/index.ts
871
- var MathBlock = import_core3.Node.create({
1356
+ var MathBlock = import_core4.Node.create({
872
1357
  name: "mathBlock",
873
1358
  group: "block",
874
1359
  atom: true,
@@ -899,13 +1384,13 @@ var MathBlock = import_core3.Node.create({
899
1384
  renderHTML({ HTMLAttributes }) {
900
1385
  return [
901
1386
  "div",
902
- (0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1387
+ (0, import_core4.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
903
1388
  "data-type": "math-block"
904
1389
  })
905
1390
  ];
906
1391
  },
907
1392
  addNodeView() {
908
- return (0, import_react11.ReactNodeViewRenderer)(MathBlockView);
1393
+ return (0, import_react15.ReactNodeViewRenderer)(MathBlockView);
909
1394
  },
910
1395
  addCommands() {
911
1396
  return {
@@ -934,7 +1419,7 @@ var MathBlock = import_core3.Node.create({
934
1419
  addInputRules() {
935
1420
  return [
936
1421
  // Block math with $$...$$
937
- new import_core3.InputRule({
1422
+ new import_core4.InputRule({
938
1423
  find: /^\$\$(.+)\$\$$/,
939
1424
  handler: ({ state, range, match }) => {
940
1425
  const latex = match[1];
@@ -949,8 +1434,8 @@ var MathBlock = import_core3.Node.create({
949
1434
  // src/extensions/selection/index.ts
950
1435
  var import_state2 = require("@tiptap/pm/state");
951
1436
  var import_view = require("@tiptap/pm/view");
952
- var import_react12 = require("@tiptap/react");
953
- var Selection = import_react12.Extension.create({
1437
+ var import_react16 = require("@tiptap/react");
1438
+ var Selection = import_react16.Extension.create({
954
1439
  name: "selection",
955
1440
  addProseMirrorPlugins() {
956
1441
  const { editor } = this;
@@ -965,7 +1450,7 @@ var Selection = import_react12.Extension.create({
965
1450
  if (editor.isFocused === true || !editor.isEditable) {
966
1451
  return null;
967
1452
  }
968
- if ((0, import_react12.isNodeSelection)(state.selection)) {
1453
+ if ((0, import_react16.isNodeSelection)(state.selection)) {
969
1454
  return null;
970
1455
  }
971
1456
  return import_view.DecorationSet.create(state.doc, [
@@ -981,19 +1466,19 @@ var Selection = import_react12.Extension.create({
981
1466
  });
982
1467
 
983
1468
  // src/extensions/toc/index.ts
984
- var import_core4 = require("@tiptap/core");
985
- var import_react16 = require("@tiptap/react");
1469
+ var import_core5 = require("@tiptap/core");
1470
+ var import_react20 = require("@tiptap/react");
986
1471
 
987
1472
  // src/extensions/toc/toc-view.tsx
988
- var import_icons5 = require("@kopexa/icons");
989
- var import_theme2 = require("@kopexa/theme");
990
- var import_react14 = require("@tiptap/react");
991
- var import_react15 = require("react");
992
- var import_react_intl8 = require("react-intl");
1473
+ var import_icons6 = require("@kopexa/icons");
1474
+ var import_theme3 = require("@kopexa/theme");
1475
+ var import_react18 = require("@tiptap/react");
1476
+ var import_react19 = require("react");
1477
+ var import_react_intl10 = require("react-intl");
993
1478
 
994
1479
  // src/extensions/toc/messages.ts
995
- var import_react_intl6 = require("react-intl");
996
- var messages3 = (0, import_react_intl6.defineMessages)({
1480
+ var import_react_intl8 = require("react-intl");
1481
+ var messages4 = (0, import_react_intl8.defineMessages)({
997
1482
  title: {
998
1483
  id: "editor.toc.title",
999
1484
  defaultMessage: "Table of Contents",
@@ -1067,15 +1552,15 @@ var messages3 = (0, import_react_intl6.defineMessages)({
1067
1552
  });
1068
1553
 
1069
1554
  // src/extensions/toc/toc-settings.tsx
1070
- var import_button4 = require("@kopexa/button");
1555
+ var import_button5 = require("@kopexa/button");
1071
1556
  var import_dialog4 = require("@kopexa/dialog");
1072
- var import_icons4 = require("@kopexa/icons");
1557
+ var import_icons5 = require("@kopexa/icons");
1073
1558
  var import_label4 = require("@kopexa/label");
1074
1559
  var import_select2 = require("@kopexa/select");
1075
1560
  var import_switch = require("@kopexa/switch");
1076
- var import_react13 = require("react");
1077
- var import_react_intl7 = require("react-intl");
1078
- var import_jsx_runtime5 = require("react/jsx-runtime");
1561
+ var import_react17 = require("react");
1562
+ var import_react_intl9 = require("react-intl");
1563
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1079
1564
  var HEADING_LEVELS = [
1080
1565
  { value: "1", label: "H1" },
1081
1566
  { value: "2", label: "H2" },
@@ -1085,15 +1570,15 @@ var HEADING_LEVELS = [
1085
1570
  { value: "6", label: "H6" }
1086
1571
  ];
1087
1572
  function TocSettings({ editor, attrs, getPos }) {
1088
- const intl = (0, import_react_intl7.useIntl)();
1089
- const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
1090
- const [localAttrs, setLocalAttrs] = (0, import_react13.useState)(attrs);
1091
- (0, import_react13.useEffect)(() => {
1573
+ const intl = (0, import_react_intl9.useIntl)();
1574
+ const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
1575
+ const [localAttrs, setLocalAttrs] = (0, import_react17.useState)(attrs);
1576
+ (0, import_react17.useEffect)(() => {
1092
1577
  if (isOpen) {
1093
1578
  setLocalAttrs(attrs);
1094
1579
  }
1095
1580
  }, [isOpen, attrs]);
1096
- const handleSave = (0, import_react13.useCallback)(() => {
1581
+ const handleSave = (0, import_react17.useCallback)(() => {
1097
1582
  const pos = getPos();
1098
1583
  if (pos === void 0) return;
1099
1584
  editor.view.dispatch(
@@ -1101,11 +1586,11 @@ function TocSettings({ editor, attrs, getPos }) {
1101
1586
  );
1102
1587
  setIsOpen(false);
1103
1588
  }, [editor, localAttrs, getPos]);
1104
- const handleCancel = (0, import_react13.useCallback)(() => {
1589
+ const handleCancel = (0, import_react17.useCallback)(() => {
1105
1590
  setLocalAttrs(attrs);
1106
1591
  setIsOpen(false);
1107
1592
  }, [attrs]);
1108
- const handleMinLevelChange = (0, import_react13.useCallback)((value) => {
1593
+ const handleMinLevelChange = (0, import_react17.useCallback)((value) => {
1109
1594
  const minLevel = Number.parseInt(String(value), 10);
1110
1595
  setLocalAttrs((prev) => ({
1111
1596
  ...prev,
@@ -1114,7 +1599,7 @@ function TocSettings({ editor, attrs, getPos }) {
1114
1599
  maxLevel: Math.max(prev.maxLevel, minLevel)
1115
1600
  }));
1116
1601
  }, []);
1117
- const handleMaxLevelChange = (0, import_react13.useCallback)((value) => {
1602
+ const handleMaxLevelChange = (0, import_react17.useCallback)((value) => {
1118
1603
  const maxLevel = Number.parseInt(String(value), 10);
1119
1604
  setLocalAttrs((prev) => ({
1120
1605
  ...prev,
@@ -1123,10 +1608,10 @@ function TocSettings({ editor, attrs, getPos }) {
1123
1608
  minLevel: Math.min(prev.minLevel, maxLevel)
1124
1609
  }));
1125
1610
  }, []);
1126
- const handleNumberedChange = (0, import_react13.useCallback)((checked) => {
1611
+ const handleNumberedChange = (0, import_react17.useCallback)((checked) => {
1127
1612
  setLocalAttrs((prev) => ({ ...prev, numbered: checked }));
1128
1613
  }, []);
1129
- const handleStyleChange = (0, import_react13.useCallback)((value) => {
1614
+ const handleStyleChange = (0, import_react17.useCallback)((value) => {
1130
1615
  setLocalAttrs((prev) => ({
1131
1616
  ...prev,
1132
1617
  style: String(value)
@@ -1135,36 +1620,36 @@ function TocSettings({ editor, attrs, getPos }) {
1135
1620
  if (!editor.isEditable) {
1136
1621
  return null;
1137
1622
  }
1138
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1139
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1140
- import_button4.IconButton,
1623
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1624
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1625
+ import_button5.IconButton,
1141
1626
  {
1142
1627
  size: "sm",
1143
1628
  variant: "ghost",
1144
- "aria-label": intl.formatMessage(messages3.settings),
1629
+ "aria-label": intl.formatMessage(messages4.settings),
1145
1630
  onClick: (e) => {
1146
1631
  e.stopPropagation();
1147
1632
  e.preventDefault();
1148
1633
  setIsOpen(true);
1149
1634
  },
1150
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.SettingsIcon, { className: "size-3.5" })
1635
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons5.SettingsIcon, { className: "size-3.5" })
1151
1636
  }
1152
1637
  ),
1153
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog4.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog4.Dialog.Content, { children: [
1154
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog4.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog4.Dialog.Title, { children: intl.formatMessage(messages3.settings) }) }),
1155
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog4.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4", children: [
1156
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
1157
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1158
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.min_level) }),
1159
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1638
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog4.Dialog.Content, { children: [
1639
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Title, { children: intl.formatMessage(messages4.settings) }) }),
1640
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
1641
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
1642
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1643
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.min_level) }),
1644
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1160
1645
  import_select2.Select,
1161
1646
  {
1162
1647
  size: "sm",
1163
1648
  value: String(localAttrs.minLevel),
1164
1649
  onValueChange: handleMinLevelChange,
1165
1650
  children: [
1166
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Value, {}) }),
1167
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1651
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1652
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1168
1653
  import_select2.Select.Item,
1169
1654
  {
1170
1655
  value: level.value,
@@ -1177,17 +1662,17 @@ function TocSettings({ editor, attrs, getPos }) {
1177
1662
  }
1178
1663
  )
1179
1664
  ] }),
1180
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1181
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.max_level) }),
1182
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1665
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1666
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.max_level) }),
1667
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1183
1668
  import_select2.Select,
1184
1669
  {
1185
1670
  size: "sm",
1186
1671
  value: String(localAttrs.maxLevel),
1187
1672
  onValueChange: handleMaxLevelChange,
1188
1673
  children: [
1189
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Value, {}) }),
1190
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1674
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1675
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1191
1676
  import_select2.Select.Item,
1192
1677
  {
1193
1678
  value: level.value,
@@ -1201,12 +1686,12 @@ function TocSettings({ editor, attrs, getPos }) {
1201
1686
  )
1202
1687
  ] })
1203
1688
  ] }),
1204
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1205
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-0.5", children: [
1206
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.numbered) }),
1207
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages3.numbered_hint) })
1689
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1690
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-0.5", children: [
1691
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.numbered) }),
1692
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages4.numbered_hint) })
1208
1693
  ] }),
1209
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1694
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1210
1695
  import_switch.Switch,
1211
1696
  {
1212
1697
  size: "sm",
@@ -1215,36 +1700,36 @@ function TocSettings({ editor, attrs, getPos }) {
1215
1700
  }
1216
1701
  )
1217
1702
  ] }),
1218
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1219
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.style) }),
1220
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1703
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1704
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.style) }),
1705
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1221
1706
  import_select2.Select,
1222
1707
  {
1223
1708
  size: "sm",
1224
1709
  value: localAttrs.style,
1225
1710
  onValueChange: handleStyleChange,
1226
1711
  children: [
1227
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Value, {}) }),
1228
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_select2.Select.Content, { children: [
1229
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Item, { value: "default", children: intl.formatMessage(messages3.style_default) }),
1230
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Item, { value: "flat", children: intl.formatMessage(messages3.style_flat) }),
1231
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Item, { value: "compact", children: intl.formatMessage(messages3.style_compact) })
1712
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1713
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_select2.Select.Content, { children: [
1714
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "default", children: intl.formatMessage(messages4.style_default) }),
1715
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "flat", children: intl.formatMessage(messages4.style_flat) }),
1716
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "compact", children: intl.formatMessage(messages4.style_compact) })
1232
1717
  ] })
1233
1718
  ]
1234
1719
  }
1235
1720
  )
1236
1721
  ] })
1237
1722
  ] }) }),
1238
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog4.Dialog.Footer, { children: [
1239
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button4.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1240
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button4.Button, { onClick: handleSave, children: intl.formatMessage(messages3.save) })
1723
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog4.Dialog.Footer, { children: [
1724
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages4.cancel) }),
1725
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { onClick: handleSave, children: intl.formatMessage(messages4.save) })
1241
1726
  ] })
1242
1727
  ] }) })
1243
1728
  ] });
1244
1729
  }
1245
1730
 
1246
1731
  // src/extensions/toc/toc-view.tsx
1247
- var import_jsx_runtime6 = require("react/jsx-runtime");
1732
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1248
1733
  function generateHeadingNumbers(headings, minLevel) {
1249
1734
  const counters = [0, 0, 0, 0, 0, 0];
1250
1735
  return headings.map((heading) => {
@@ -1266,8 +1751,8 @@ function generateHeadingNumbers(headings, minLevel) {
1266
1751
  });
1267
1752
  }
1268
1753
  function TocNodeView({ editor, node, getPos }) {
1269
- const [headings, setHeadings] = (0, import_react15.useState)([]);
1270
- const intl = (0, import_react_intl8.useIntl)();
1754
+ const [headings, setHeadings] = (0, import_react19.useState)([]);
1755
+ const intl = (0, import_react_intl10.useIntl)();
1271
1756
  const attrs = node.attrs;
1272
1757
  const {
1273
1758
  minLevel = 1,
@@ -1275,8 +1760,8 @@ function TocNodeView({ editor, node, getPos }) {
1275
1760
  numbered = false,
1276
1761
  style = "default"
1277
1762
  } = attrs;
1278
- const styles = (0, import_react15.useMemo)(() => (0, import_theme2.toc)({ style }), [style]);
1279
- const updateHeadings = (0, import_react15.useCallback)(() => {
1763
+ const styles = (0, import_react19.useMemo)(() => (0, import_theme3.toc)({ style }), [style]);
1764
+ const updateHeadings = (0, import_react19.useCallback)(() => {
1280
1765
  const items = [];
1281
1766
  const { doc } = editor.state;
1282
1767
  doc.descendants((docNode, pos) => {
@@ -1296,14 +1781,14 @@ function TocNodeView({ editor, node, getPos }) {
1296
1781
  const numberedHeadings = generateHeadingNumbers(items, minLevel);
1297
1782
  setHeadings(numberedHeadings);
1298
1783
  }, [editor, minLevel, maxLevel]);
1299
- (0, import_react15.useEffect)(() => {
1784
+ (0, import_react19.useEffect)(() => {
1300
1785
  updateHeadings();
1301
1786
  editor.on("update", updateHeadings);
1302
1787
  return () => {
1303
1788
  editor.off("update", updateHeadings);
1304
1789
  };
1305
1790
  }, [editor, updateHeadings]);
1306
- const handleClick = (0, import_react15.useCallback)(
1791
+ const handleClick = (0, import_react19.useCallback)(
1307
1792
  (pos, id) => {
1308
1793
  var _a;
1309
1794
  editor.chain().focus().setTextSelection(pos).run();
@@ -1324,13 +1809,13 @@ function TocNodeView({ editor, node, getPos }) {
1324
1809
  const getIndent = (level) => {
1325
1810
  return (level - minLevel) * 16;
1326
1811
  };
1327
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react14.NodeViewWrapper, { className: styles.root(), "data-type": "toc", children: [
1328
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles.header(), children: [
1329
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles.headerContent(), children: [
1330
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons5.ListIcon, { className: styles.headerIcon() }),
1331
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles.headerTitle(), children: intl.formatMessage(messages3.title) })
1812
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react18.NodeViewWrapper, { className: styles.root(), "data-type": "toc", children: [
1813
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: styles.header(), children: [
1814
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: styles.headerContent(), children: [
1815
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons6.ListIcon, { className: styles.headerIcon() }),
1816
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: styles.headerTitle(), children: intl.formatMessage(messages4.title) })
1332
1817
  ] }),
1333
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles.headerActions(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1818
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: styles.headerActions(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1334
1819
  TocSettings,
1335
1820
  {
1336
1821
  editor,
@@ -1339,7 +1824,7 @@ function TocNodeView({ editor, node, getPos }) {
1339
1824
  }
1340
1825
  ) })
1341
1826
  ] }),
1342
- isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: styles.emptyState(), children: intl.formatMessage(messages3.empty_state) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("nav", { className: styles.nav(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: styles.list(), children: headings.map((heading) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1827
+ isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: styles.emptyState(), children: intl.formatMessage(messages4.empty_state) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { className: styles.nav(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: styles.list(), children: headings.map((heading) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1343
1828
  "li",
1344
1829
  {
1345
1830
  className: styles.item(),
@@ -1347,14 +1832,14 @@ function TocNodeView({ editor, node, getPos }) {
1347
1832
  paddingLeft: `${getIndent(heading.level)}px`
1348
1833
  },
1349
1834
  children: [
1350
- numbered && heading.number && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles.itemNumber(), children: heading.number }),
1351
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1835
+ numbered && heading.number && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: styles.itemNumber(), children: heading.number }),
1836
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1352
1837
  "button",
1353
1838
  {
1354
1839
  type: "button",
1355
1840
  onClick: () => handleClick(heading.pos, heading.id),
1356
1841
  className: styles.itemButton(),
1357
- children: heading.text || intl.formatMessage(messages3.empty_heading)
1842
+ children: heading.text || intl.formatMessage(messages4.empty_heading)
1358
1843
  }
1359
1844
  )
1360
1845
  ]
@@ -1365,7 +1850,7 @@ function TocNodeView({ editor, node, getPos }) {
1365
1850
  }
1366
1851
 
1367
1852
  // src/extensions/toc/index.ts
1368
- var TocNode = import_core4.Node.create({
1853
+ var TocNode = import_core5.Node.create({
1369
1854
  name: "tableOfContentsNode",
1370
1855
  group: "block",
1371
1856
  atom: true,
@@ -1417,13 +1902,13 @@ var TocNode = import_core4.Node.create({
1417
1902
  renderHTML({ HTMLAttributes }) {
1418
1903
  return [
1419
1904
  "div",
1420
- (0, import_core4.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1905
+ (0, import_core5.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1421
1906
  "data-type": "toc"
1422
1907
  })
1423
1908
  ];
1424
1909
  },
1425
1910
  addNodeView() {
1426
- return (0, import_react16.ReactNodeViewRenderer)(TocNodeView);
1911
+ return (0, import_react20.ReactNodeViewRenderer)(TocNodeView);
1427
1912
  },
1428
1913
  addCommands() {
1429
1914
  return {
@@ -1452,7 +1937,7 @@ var TocNode = import_core4.Node.create({
1452
1937
 
1453
1938
  // src/extensions/trailing-node/index.ts
1454
1939
  var import_state3 = require("@tiptap/pm/state");
1455
- var import_react17 = require("@tiptap/react");
1940
+ var import_react21 = require("@tiptap/react");
1456
1941
  function nodeEqualsType({
1457
1942
  types,
1458
1943
  node
@@ -1463,7 +1948,7 @@ function nodeEqualsType({
1463
1948
  }
1464
1949
  return node.type === types;
1465
1950
  }
1466
- var TrailingNode = import_react17.Extension.create({
1951
+ var TrailingNode = import_react21.Extension.create({
1467
1952
  name: "trailingNode",
1468
1953
  addOptions() {
1469
1954
  return {
@@ -1509,7 +1994,7 @@ var TrailingNode = import_react17.Extension.create({
1509
1994
  });
1510
1995
 
1511
1996
  // src/extensions/ui-state/index.ts
1512
- var import_core5 = require("@tiptap/core");
1997
+ var import_core6 = require("@tiptap/core");
1513
1998
  var defaultUiState = {
1514
1999
  aiGenerationIsSelection: false,
1515
2000
  aiGenerationIsLoading: false,
@@ -1519,7 +2004,7 @@ var defaultUiState = {
1519
2004
  lockDragHandle: false,
1520
2005
  isDragging: false
1521
2006
  };
1522
- var UiState = import_core5.Extension.create({
2007
+ var UiState = import_core6.Extension.create({
1523
2008
  name: "uiState",
1524
2009
  addStorage() {
1525
2010
  return {
@@ -1734,9 +2219,12 @@ var useCreateEditor = ({
1734
2219
  onChange,
1735
2220
  enableControls = false,
1736
2221
  controlResolver,
2222
+ fileHandler: fileHandlerProp,
1737
2223
  ...options
1738
2224
  }) => {
1739
- const editor = (0, import_react18.useEditor)({
2225
+ const fileHandlerFromContext = useEditorFile();
2226
+ const fileHandler = fileHandlerProp != null ? fileHandlerProp : fileHandlerFromContext;
2227
+ const editor = (0, import_react22.useEditor)({
1740
2228
  editorProps: {
1741
2229
  attributes: {
1742
2230
  autocomplete: "off",
@@ -1751,7 +2239,8 @@ var useCreateEditor = ({
1751
2239
  editable,
1752
2240
  placeholder,
1753
2241
  enableControls,
1754
- controlResolver
2242
+ controlResolver,
2243
+ fileHandler
1755
2244
  }),
1756
2245
  editable,
1757
2246
  onUpdate: ({ editor: editor2 }) => {
@@ -1760,7 +2249,7 @@ var useCreateEditor = ({
1760
2249
  content: safeParseContent(content),
1761
2250
  ...options
1762
2251
  });
1763
- (0, import_react19.useEffect)(() => {
2252
+ (0, import_react23.useEffect)(() => {
1764
2253
  if (editor && editor.isEditable !== editable) {
1765
2254
  editor.setEditable(editable);
1766
2255
  }
@@ -1771,7 +2260,8 @@ function getExtensions({
1771
2260
  editable,
1772
2261
  placeholder,
1773
2262
  enableControls = false,
1774
- controlResolver
2263
+ controlResolver,
2264
+ fileHandler
1775
2265
  }) {
1776
2266
  const extensions = [
1777
2267
  import_starter_kit.StarterKit.configure({
@@ -1823,6 +2313,8 @@ function getExtensions({
1823
2313
  CalloutNode,
1824
2314
  MathBlock,
1825
2315
  InlineMath,
2316
+ // Image support - always include for display
2317
+ ImageNode,
1826
2318
  import_extensions.Placeholder.configure({
1827
2319
  placeholder,
1828
2320
  emptyNodeClass: "is-empty with-slash"
@@ -1831,14 +2323,94 @@ function getExtensions({
1831
2323
  if (enableControls) {
1832
2324
  extensions.push(import_extension_controlref.ControlKit.configure({ resolver: controlResolver }));
1833
2325
  }
2326
+ if (fileHandler) {
2327
+ extensions.push(
2328
+ import_extension_file_handler.FileHandler.configure({
2329
+ allowedMimeTypes: [
2330
+ "image/jpeg",
2331
+ "image/png",
2332
+ "image/gif",
2333
+ "image/webp",
2334
+ "image/svg+xml"
2335
+ ],
2336
+ onDrop: (editor, files, pos) => {
2337
+ for (const file of files) {
2338
+ handleFileUpload(editor, file, fileHandler, pos);
2339
+ }
2340
+ },
2341
+ onPaste: (editor, files) => {
2342
+ for (const file of files) {
2343
+ handleFileUpload(editor, file, fileHandler);
2344
+ }
2345
+ }
2346
+ })
2347
+ );
2348
+ }
1834
2349
  return extensions;
1835
2350
  }
2351
+ async function handleFileUpload(editor, file, fileHandler, pos) {
2352
+ if (!editor) return;
2353
+ const tempId = `uploading-${Date.now()}-${Math.random().toString(36).slice(2)}`;
2354
+ const insertPos = pos != null ? pos : editor.state.selection.anchor;
2355
+ editor.chain().focus().insertContentAt(insertPos, {
2356
+ type: "image",
2357
+ attrs: {
2358
+ src: tempId,
2359
+ uploadState: "uploading",
2360
+ uploadProgress: 0
2361
+ }
2362
+ }).run();
2363
+ try {
2364
+ const ref = await fileHandler.upload(file, (percent) => {
2365
+ editor.state.doc.descendants((node, nodePos) => {
2366
+ if (node.type.name === "image" && node.attrs.src === tempId) {
2367
+ editor.view.dispatch(
2368
+ editor.state.tr.setNodeMarkup(nodePos, void 0, {
2369
+ ...node.attrs,
2370
+ uploadProgress: percent
2371
+ })
2372
+ );
2373
+ return false;
2374
+ }
2375
+ return true;
2376
+ });
2377
+ });
2378
+ editor.state.doc.descendants((node, nodePos) => {
2379
+ if (node.type.name === "image" && node.attrs.src === tempId) {
2380
+ editor.view.dispatch(
2381
+ editor.state.tr.setNodeMarkup(nodePos, void 0, {
2382
+ src: ref,
2383
+ uploadState: null,
2384
+ uploadProgress: null
2385
+ })
2386
+ );
2387
+ return false;
2388
+ }
2389
+ return true;
2390
+ });
2391
+ } catch (error) {
2392
+ editor.state.doc.descendants((node, nodePos) => {
2393
+ if (node.type.name === "image" && node.attrs.src === tempId) {
2394
+ editor.view.dispatch(
2395
+ editor.state.tr.setNodeMarkup(nodePos, void 0, {
2396
+ ...node.attrs,
2397
+ uploadState: "error",
2398
+ uploadProgress: null
2399
+ })
2400
+ );
2401
+ return false;
2402
+ }
2403
+ return true;
2404
+ });
2405
+ console.error("[FileHandler] Upload failed:", error);
2406
+ }
2407
+ }
1836
2408
 
1837
2409
  // src/hooks/use-ui-editor-state.ts
1838
- var import_react20 = require("@tiptap/react");
2410
+ var import_react24 = require("@tiptap/react");
1839
2411
  function useUiEditorState(editor) {
1840
2412
  var _a;
1841
- return (_a = (0, import_react20.useEditorState)({
2413
+ return (_a = (0, import_react24.useEditorState)({
1842
2414
  editor,
1843
2415
  selector: ({ editor: editor2 }) => {
1844
2416
  if (!editor2) return defaultUiState;
@@ -1859,23 +2431,23 @@ var import_toolbar3 = require("@kopexa/toolbar");
1859
2431
  var import_menus = require("@tiptap/react/menus");
1860
2432
 
1861
2433
  // src/ui/link-popover/link-popover.tsx
1862
- var import_button5 = require("@kopexa/button");
1863
- var import_icons7 = require("@kopexa/icons");
2434
+ var import_button6 = require("@kopexa/button");
2435
+ var import_icons8 = require("@kopexa/icons");
1864
2436
  var import_input2 = require("@kopexa/input");
1865
2437
  var import_popover = require("@kopexa/popover");
1866
2438
  var import_toolbar = require("@kopexa/toolbar");
1867
- var import_react23 = require("react");
2439
+ var import_react27 = require("react");
1868
2440
 
1869
2441
  // src/hooks/use-tiptap-editor.ts
1870
- var import_react21 = require("@tiptap/react");
1871
- var import_react22 = require("react");
2442
+ var import_react25 = require("@tiptap/react");
2443
+ var import_react26 = require("react");
1872
2444
  function useTiptapEditor(providedEditor) {
1873
- const { editor: coreEditor } = (0, import_react21.useCurrentEditor)();
1874
- const mainEditor = (0, import_react22.useMemo)(
2445
+ const { editor: coreEditor } = (0, import_react25.useCurrentEditor)();
2446
+ const mainEditor = (0, import_react26.useMemo)(
1875
2447
  () => providedEditor || coreEditor,
1876
2448
  [providedEditor, coreEditor]
1877
2449
  );
1878
- const editorState = (0, import_react21.useEditorState)({
2450
+ const editorState = (0, import_react25.useEditorState)({
1879
2451
  editor: mainEditor,
1880
2452
  selector(context) {
1881
2453
  if (!context.editor) {
@@ -1897,7 +2469,7 @@ function useTiptapEditor(providedEditor) {
1897
2469
 
1898
2470
  // src/ui/link-popover/use-link-popover.ts
1899
2471
  var import_editor_utils = require("@kopexa/editor-utils");
1900
- var import_icons6 = require("@kopexa/icons");
2472
+ var import_icons7 = require("@kopexa/icons");
1901
2473
  var React = __toESM(require("react"));
1902
2474
 
1903
2475
  // src/utils/index.ts
@@ -2071,15 +2643,15 @@ function useLinkPopover(config) {
2071
2643
  canSet,
2072
2644
  isActive,
2073
2645
  label: "Link",
2074
- Icon: import_icons6.LinkIcon,
2646
+ Icon: import_icons7.LinkIcon,
2075
2647
  ...linkHandler
2076
2648
  };
2077
2649
  }
2078
2650
 
2079
2651
  // src/ui/link-popover/link-popover.tsx
2080
- var import_jsx_runtime7 = require("react/jsx-runtime");
2652
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2081
2653
  var LinkButton = ({ className, children, ...props }) => {
2082
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2654
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2083
2655
  import_toolbar.ToolbarButton,
2084
2656
  {
2085
2657
  type: "button",
@@ -2091,7 +2663,7 @@ var LinkButton = ({ className, children, ...props }) => {
2091
2663
  title: "Link",
2092
2664
  isIconOnly: !children,
2093
2665
  ...props,
2094
- children: children || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.LinkIcon, {})
2666
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.LinkIcon, {})
2095
2667
  }
2096
2668
  );
2097
2669
  };
@@ -2104,8 +2676,8 @@ var LinkMain = ({
2104
2676
  isActive,
2105
2677
  onSave
2106
2678
  }) => {
2107
- const [isEditing, setIsEditing] = (0, import_react23.useState)(!isActive || !url);
2108
- (0, import_react23.useEffect)(() => {
2679
+ const [isEditing, setIsEditing] = (0, import_react27.useState)(!isActive || !url);
2680
+ (0, import_react27.useEffect)(() => {
2109
2681
  setIsEditing(!isActive || !url);
2110
2682
  }, [isActive, url]);
2111
2683
  const handleKeyDown = (event) => {
@@ -2128,8 +2700,8 @@ var LinkMain = ({
2128
2700
  setIsEditing(true);
2129
2701
  };
2130
2702
  if (isEditing) {
2131
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2132
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2703
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2704
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2133
2705
  import_input2.Input,
2134
2706
  {
2135
2707
  type: "url",
@@ -2144,8 +2716,8 @@ var LinkMain = ({
2144
2716
  autoFocus: true
2145
2717
  }
2146
2718
  ),
2147
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2148
- import_button5.IconButton,
2719
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2720
+ import_button6.IconButton,
2149
2721
  {
2150
2722
  type: "button",
2151
2723
  size: "sm",
@@ -2153,13 +2725,13 @@ var LinkMain = ({
2153
2725
  onClick: handleSave,
2154
2726
  "aria-label": "Save link",
2155
2727
  disabled: !url,
2156
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.CheckIcon, { className: "size-4" })
2728
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.CheckIcon, { className: "size-4" })
2157
2729
  }
2158
2730
  )
2159
2731
  ] });
2160
2732
  }
2161
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2162
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2733
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2734
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2163
2735
  "a",
2164
2736
  {
2165
2737
  href: url,
@@ -2173,38 +2745,38 @@ var LinkMain = ({
2173
2745
  children: url
2174
2746
  }
2175
2747
  ),
2176
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
2177
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2178
- import_button5.IconButton,
2748
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
2749
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2750
+ import_button6.IconButton,
2179
2751
  {
2180
2752
  type: "button",
2181
2753
  size: "sm",
2182
2754
  variant: "ghost",
2183
2755
  onClick: openLink,
2184
2756
  "aria-label": "Open link in new tab",
2185
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.ExternalLinkIcon, { className: "size-4" })
2757
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.ExternalLinkIcon, { className: "size-4" })
2186
2758
  }
2187
2759
  ),
2188
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2189
- import_button5.IconButton,
2760
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2761
+ import_button6.IconButton,
2190
2762
  {
2191
2763
  type: "button",
2192
2764
  size: "sm",
2193
2765
  variant: "ghost",
2194
2766
  onClick: handleEdit,
2195
2767
  "aria-label": "Edit link",
2196
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.EditIcon, { className: "size-4" })
2768
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.EditIcon, { className: "size-4" })
2197
2769
  }
2198
2770
  ),
2199
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2200
- import_button5.IconButton,
2771
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2772
+ import_button6.IconButton,
2201
2773
  {
2202
2774
  type: "button",
2203
2775
  size: "sm",
2204
2776
  variant: "ghost",
2205
2777
  onClick: removeLink,
2206
2778
  "aria-label": "Remove link",
2207
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.TrashIcon, { className: "size-4" })
2779
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.TrashIcon, { className: "size-4" })
2208
2780
  }
2209
2781
  )
2210
2782
  ] })
@@ -2221,7 +2793,7 @@ function LinkPopover({
2221
2793
  ...buttonProps
2222
2794
  }) {
2223
2795
  const { editor } = useTiptapEditor(providedEditor);
2224
- const [isOpen, setIsOpen] = (0, import_react23.useState)(false);
2796
+ const [isOpen, setIsOpen] = (0, import_react27.useState)(false);
2225
2797
  const {
2226
2798
  isVisible,
2227
2799
  canSet,
@@ -2237,18 +2809,18 @@ function LinkPopover({
2237
2809
  hideWhenUnavailable,
2238
2810
  onSetLink
2239
2811
  });
2240
- const handleOnOpenChange = (0, import_react23.useCallback)(
2812
+ const handleOnOpenChange = (0, import_react27.useCallback)(
2241
2813
  (nextIsOpen) => {
2242
2814
  setIsOpen(nextIsOpen);
2243
2815
  onOpenChange == null ? void 0 : onOpenChange(nextIsOpen);
2244
2816
  },
2245
2817
  [onOpenChange]
2246
2818
  );
2247
- const handleSetLink = (0, import_react23.useCallback)(() => {
2819
+ const handleSetLink = (0, import_react27.useCallback)(() => {
2248
2820
  setLink();
2249
2821
  setIsOpen(false);
2250
2822
  }, [setLink]);
2251
- const handleClick = (0, import_react23.useCallback)(
2823
+ const handleClick = (0, import_react27.useCallback)(
2252
2824
  (event) => {
2253
2825
  onClick == null ? void 0 : onClick(event);
2254
2826
  if (event.defaultPrevented) return;
@@ -2256,7 +2828,7 @@ function LinkPopover({
2256
2828
  },
2257
2829
  [onClick, isOpen]
2258
2830
  );
2259
- (0, import_react23.useEffect)(() => {
2831
+ (0, import_react27.useEffect)(() => {
2260
2832
  if (autoOpenOnLinkActive && isActive) {
2261
2833
  setIsOpen(true);
2262
2834
  }
@@ -2264,17 +2836,17 @@ function LinkPopover({
2264
2836
  if (!isVisible) {
2265
2837
  return null;
2266
2838
  }
2267
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2839
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2268
2840
  import_popover.Popover.Root,
2269
2841
  {
2270
2842
  open: isOpen,
2271
2843
  onOpenChange: handleOnOpenChange,
2272
2844
  spacing: "dense",
2273
2845
  children: [
2274
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2846
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2275
2847
  import_popover.Popover.Trigger,
2276
2848
  {
2277
- render: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2849
+ render: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2278
2850
  LinkButton,
2279
2851
  {
2280
2852
  "data-disabled": !canSet,
@@ -2288,7 +2860,7 @@ function LinkPopover({
2288
2860
  )
2289
2861
  }
2290
2862
  ),
2291
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2863
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2292
2864
  LinkMain,
2293
2865
  {
2294
2866
  url,
@@ -2308,19 +2880,19 @@ LinkButton.displayName = "LinkButton";
2308
2880
 
2309
2881
  // src/ui/mark-button/index.tsx
2310
2882
  var import_editor_utils2 = require("@kopexa/editor-utils");
2311
- var import_icons8 = require("@kopexa/icons");
2883
+ var import_icons9 = require("@kopexa/icons");
2312
2884
  var import_toolbar2 = require("@kopexa/toolbar");
2313
- var import_react24 = require("@tiptap/react");
2314
- var import_react25 = require("react");
2315
- var import_jsx_runtime8 = require("react/jsx-runtime");
2885
+ var import_react28 = require("@tiptap/react");
2886
+ var import_react29 = require("react");
2887
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2316
2888
  var markIcons = {
2317
- bold: import_icons8.BoldIcon,
2318
- italic: import_icons8.ItalicIcon,
2319
- underline: import_icons8.UnderlineIcon,
2320
- strike: import_icons8.StrikeIcon,
2321
- code: import_icons8.CodeIcon,
2322
- superscript: import_icons8.SuperscriptIcon,
2323
- subscript: import_icons8.SubscriptIcon
2889
+ bold: import_icons9.BoldIcon,
2890
+ italic: import_icons9.ItalicIcon,
2891
+ underline: import_icons9.UnderlineIcon,
2892
+ strike: import_icons9.StrikeIcon,
2893
+ code: import_icons9.CodeIcon,
2894
+ superscript: import_icons9.SuperscriptIcon,
2895
+ subscript: import_icons9.SubscriptIcon
2324
2896
  };
2325
2897
  var markShortcutKeys = {
2326
2898
  bold: "mod+b",
@@ -2358,7 +2930,7 @@ function shouldShowMarkButton(params) {
2358
2930
  return false;
2359
2931
  }
2360
2932
  if (hideWhenUnavailable) {
2361
- if ((0, import_react24.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
2933
+ if ((0, import_react28.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
2362
2934
  return false;
2363
2935
  }
2364
2936
  }
@@ -2403,7 +2975,7 @@ var MarkButton = ({
2403
2975
  shortcutKey,
2404
2976
  formattedName
2405
2977
  } = useMarkState(editor, type, disabled);
2406
- const handleClick = (0, import_react25.useCallback)(
2978
+ const handleClick = (0, import_react29.useCallback)(
2407
2979
  (e) => {
2408
2980
  onClick == null ? void 0 : onClick(e);
2409
2981
  if (!e.defaultPrevented && !isDisabled && editor) {
@@ -2412,7 +2984,7 @@ var MarkButton = ({
2412
2984
  },
2413
2985
  [onClick, isDisabled, editor, type]
2414
2986
  );
2415
- const show = (0, import_react25.useMemo)(() => {
2987
+ const show = (0, import_react29.useMemo)(() => {
2416
2988
  return shouldShowMarkButton({
2417
2989
  editor,
2418
2990
  type,
@@ -2423,7 +2995,7 @@ var MarkButton = ({
2423
2995
  if (!show || !editor || !editor.isEditable) {
2424
2996
  return null;
2425
2997
  }
2426
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2998
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2427
2999
  import_toolbar2.ToolbarButton,
2428
3000
  {
2429
3001
  type: "button",
@@ -2441,18 +3013,18 @@ var MarkButton = ({
2441
3013
  onClick: handleClick,
2442
3014
  isIconOnly: true,
2443
3015
  ...buttonProps,
2444
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, {})
3016
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, {})
2445
3017
  }
2446
3018
  );
2447
3019
  };
2448
3020
 
2449
3021
  // src/ui/bubble-menu/index.tsx
2450
- var import_jsx_runtime9 = require("react/jsx-runtime");
3022
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2451
3023
  function BubbleMenu({ editor }) {
2452
3024
  if (!editor) {
2453
3025
  return null;
2454
3026
  }
2455
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3027
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2456
3028
  import_menus.BubbleMenu,
2457
3029
  {
2458
3030
  editor,
@@ -2470,15 +3042,15 @@ function BubbleMenu({ editor }) {
2470
3042
  offset: 8
2471
3043
  },
2472
3044
  className: "rounded-lg border bg-background shadow-md",
2473
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
2474
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_toolbar3.ToolbarGroup, { children: [
2475
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "bold" }),
2476
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "italic" }),
2477
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "strike" }),
2478
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "code" })
3045
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
3046
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_toolbar3.ToolbarGroup, { children: [
3047
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "bold" }),
3048
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "italic" }),
3049
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "strike" }),
3050
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "code" })
2479
3051
  ] }),
2480
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_toolbar3.ToolbarSeparator, {}),
2481
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
3052
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toolbar3.ToolbarSeparator, {}),
3053
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
2482
3054
  ] })
2483
3055
  }
2484
3056
  );
@@ -2490,7 +3062,7 @@ var React3 = __toESM(require("react"));
2490
3062
 
2491
3063
  // src/hooks/use-floating-toolbar-visibility.ts
2492
3064
  var import_state4 = require("@tiptap/pm/state");
2493
- var import_react26 = require("@tiptap/react");
3065
+ var import_react30 = require("@tiptap/react");
2494
3066
  var React2 = __toESM(require("react"));
2495
3067
  var HIDE_FLOATING_META = "hideFloatingToolbar";
2496
3068
  var selectNodeAndHideFloating = (editor, pos) => {
@@ -2588,41 +3160,41 @@ function useScrollToHash(config = {}) {
2588
3160
  }
2589
3161
 
2590
3162
  // src/ui/link-bubble/index.tsx
2591
- var import_button6 = require("@kopexa/button");
2592
- var import_icons9 = require("@kopexa/icons");
3163
+ var import_button7 = require("@kopexa/button");
3164
+ var import_icons10 = require("@kopexa/icons");
2593
3165
  var import_input3 = require("@kopexa/input");
2594
3166
  var import_menus2 = require("@tiptap/react/menus");
2595
- var import_react27 = require("react");
2596
- var import_jsx_runtime10 = require("react/jsx-runtime");
3167
+ var import_react31 = require("react");
3168
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2597
3169
  function LinkBubble({ editor }) {
2598
- const [isEditing, setIsEditing] = (0, import_react27.useState)(false);
2599
- const [url, setUrl] = (0, import_react27.useState)("");
2600
- const getCurrentUrl = (0, import_react27.useCallback)(() => {
3170
+ const [isEditing, setIsEditing] = (0, import_react31.useState)(false);
3171
+ const [url, setUrl] = (0, import_react31.useState)("");
3172
+ const getCurrentUrl = (0, import_react31.useCallback)(() => {
2601
3173
  if (!editor) return "";
2602
3174
  const attrs = editor.getAttributes("link");
2603
3175
  return attrs.href || "";
2604
3176
  }, [editor]);
2605
- (0, import_react27.useEffect)(() => {
3177
+ (0, import_react31.useEffect)(() => {
2606
3178
  const isLinkActive2 = editor == null ? void 0 : editor.isActive("link");
2607
3179
  if (isLinkActive2) {
2608
3180
  setUrl(getCurrentUrl());
2609
3181
  setIsEditing(false);
2610
3182
  }
2611
3183
  }, [editor, getCurrentUrl]);
2612
- const handleOpenLink = (0, import_react27.useCallback)(() => {
3184
+ const handleOpenLink = (0, import_react31.useCallback)(() => {
2613
3185
  const href = getCurrentUrl();
2614
3186
  if (href) {
2615
3187
  window.open(href, "_blank", "noopener,noreferrer");
2616
3188
  }
2617
3189
  }, [getCurrentUrl]);
2618
- const handleRemoveLink = (0, import_react27.useCallback)(() => {
3190
+ const handleRemoveLink = (0, import_react31.useCallback)(() => {
2619
3191
  editor == null ? void 0 : editor.chain().focus().unsetLink().run();
2620
3192
  }, [editor]);
2621
- const handleEdit = (0, import_react27.useCallback)(() => {
3193
+ const handleEdit = (0, import_react31.useCallback)(() => {
2622
3194
  setUrl(getCurrentUrl());
2623
3195
  setIsEditing(true);
2624
3196
  }, [getCurrentUrl]);
2625
- const handleSave = (0, import_react27.useCallback)(() => {
3197
+ const handleSave = (0, import_react31.useCallback)(() => {
2626
3198
  if (url) {
2627
3199
  editor == null ? void 0 : editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
2628
3200
  } else {
@@ -2630,7 +3202,7 @@ function LinkBubble({ editor }) {
2630
3202
  }
2631
3203
  setIsEditing(false);
2632
3204
  }, [editor, url]);
2633
- const handleKeyDown = (0, import_react27.useCallback)(
3205
+ const handleKeyDown = (0, import_react31.useCallback)(
2634
3206
  (e) => {
2635
3207
  if (e.key === "Enter") {
2636
3208
  e.preventDefault();
@@ -2646,7 +3218,7 @@ function LinkBubble({ editor }) {
2646
3218
  if (!editor) {
2647
3219
  return null;
2648
3220
  }
2649
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3221
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2650
3222
  import_menus2.BubbleMenu,
2651
3223
  {
2652
3224
  editor,
@@ -2659,8 +3231,8 @@ function LinkBubble({ editor }) {
2659
3231
  offset: 8
2660
3232
  },
2661
3233
  className: "rounded-lg border bg-background shadow-md",
2662
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-center gap-1 p-1.5 min-w-[280px]", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2663
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3234
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center gap-1 p-1.5 min-w-[280px]", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3235
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2664
3236
  import_input3.Input,
2665
3237
  {
2666
3238
  type: "url",
@@ -2672,19 +3244,19 @@ function LinkBubble({ editor }) {
2672
3244
  autoFocus: true
2673
3245
  }
2674
3246
  ),
2675
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2676
- import_button6.IconButton,
3247
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3248
+ import_button7.IconButton,
2677
3249
  {
2678
3250
  type: "button",
2679
3251
  size: "sm",
2680
3252
  variant: "ghost",
2681
3253
  onClick: handleSave,
2682
3254
  "aria-label": "Save link",
2683
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.EditIcon, { className: "size-4" })
3255
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.EditIcon, { className: "size-4" })
2684
3256
  }
2685
3257
  )
2686
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2687
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3258
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3259
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2688
3260
  "a",
2689
3261
  {
2690
3262
  href: getCurrentUrl(),
@@ -2698,38 +3270,38 @@ function LinkBubble({ editor }) {
2698
3270
  children: getCurrentUrl()
2699
3271
  }
2700
3272
  ),
2701
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
2702
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2703
- import_button6.IconButton,
3273
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
3274
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3275
+ import_button7.IconButton,
2704
3276
  {
2705
3277
  type: "button",
2706
3278
  size: "sm",
2707
3279
  variant: "ghost",
2708
3280
  onClick: handleOpenLink,
2709
3281
  "aria-label": "Open link in new tab",
2710
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.ExternalLinkIcon, { className: "size-4" })
3282
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.ExternalLinkIcon, { className: "size-4" })
2711
3283
  }
2712
3284
  ),
2713
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2714
- import_button6.IconButton,
3285
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3286
+ import_button7.IconButton,
2715
3287
  {
2716
3288
  type: "button",
2717
3289
  size: "sm",
2718
3290
  variant: "ghost",
2719
3291
  onClick: handleEdit,
2720
3292
  "aria-label": "Edit link",
2721
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.EditIcon, { className: "size-4" })
3293
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.EditIcon, { className: "size-4" })
2722
3294
  }
2723
3295
  ),
2724
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2725
- import_button6.IconButton,
3296
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3297
+ import_button7.IconButton,
2726
3298
  {
2727
3299
  type: "button",
2728
3300
  size: "sm",
2729
3301
  variant: "ghost",
2730
3302
  onClick: handleRemoveLink,
2731
3303
  "aria-label": "Remove link",
2732
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.TrashIcon, { className: "size-4" })
3304
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.TrashIcon, { className: "size-4" })
2733
3305
  }
2734
3306
  )
2735
3307
  ] })
@@ -2739,30 +3311,30 @@ function LinkBubble({ editor }) {
2739
3311
  }
2740
3312
 
2741
3313
  // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
2742
- var import_button7 = require("@kopexa/button");
3314
+ var import_button8 = require("@kopexa/button");
2743
3315
  var import_editor_utils6 = require("@kopexa/editor-utils");
2744
3316
  var import_separator = require("@kopexa/separator");
2745
- var import_theme3 = require("@kopexa/theme");
3317
+ var import_theme4 = require("@kopexa/theme");
2746
3318
  var React8 = __toESM(require("react"));
2747
3319
 
2748
3320
  // src/ui/suggestion-menu/suggestion-menu.tsx
2749
- var import_react29 = require("@floating-ui/react");
3321
+ var import_react33 = require("@floating-ui/react");
2750
3322
  var import_state5 = require("@tiptap/pm/state");
2751
3323
  var import_suggestion = require("@tiptap/suggestion");
2752
3324
  var React6 = __toESM(require("react"));
2753
3325
 
2754
3326
  // src/hooks/use-floating-element.ts
2755
- var import_react28 = require("@floating-ui/react");
3327
+ var import_react32 = require("@floating-ui/react");
2756
3328
  var React4 = __toESM(require("react"));
2757
3329
  function useFloatingElement(show, referencePos, zIndex, options) {
2758
3330
  const { dismissOptions, ...floatingOptions } = options || {};
2759
- const { refs, update, context, floatingStyles } = (0, import_react28.useFloating)({
3331
+ const { refs, update, context, floatingStyles } = (0, import_react32.useFloating)({
2760
3332
  open: show,
2761
3333
  ...floatingOptions
2762
3334
  });
2763
- const { isMounted, styles } = (0, import_react28.useTransitionStyles)(context);
2764
- const dismiss = (0, import_react28.useDismiss)(context, dismissOptions);
2765
- const { getReferenceProps, getFloatingProps } = (0, import_react28.useInteractions)([dismiss]);
3335
+ const { isMounted, styles } = (0, import_react32.useTransitionStyles)(context);
3336
+ const dismiss = (0, import_react32.useDismiss)(context, dismissOptions);
3337
+ const { getReferenceProps, getFloatingProps } = (0, import_react32.useInteractions)([dismiss]);
2766
3338
  React4.useEffect(() => {
2767
3339
  update();
2768
3340
  }, [referencePos, update]);
@@ -2970,7 +3542,7 @@ function filterSuggestionItems(items, query) {
2970
3542
  }
2971
3543
 
2972
3544
  // src/ui/suggestion-menu/suggestion-menu.tsx
2973
- var import_jsx_runtime11 = require("react/jsx-runtime");
3545
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2974
3546
  var SuggestionMenu = ({
2975
3547
  editor: providedEditor,
2976
3548
  floatingOptions,
@@ -2996,13 +3568,13 @@ var SuggestionMenu = ({
2996
3568
  {
2997
3569
  placement: "bottom-start",
2998
3570
  middleware: [
2999
- (0, import_react29.offset)(10),
3000
- (0, import_react29.flip)({
3571
+ (0, import_react33.offset)(10),
3572
+ (0, import_react33.flip)({
3001
3573
  mainAxis: true,
3002
3574
  crossAxis: false
3003
3575
  }),
3004
- (0, import_react29.shift)(),
3005
- (0, import_react29.size)({
3576
+ (0, import_react33.shift)(),
3577
+ (0, import_react33.size)({
3006
3578
  apply({ availableHeight, elements }) {
3007
3579
  if (elements.floating) {
3008
3580
  const maxHeightValue = maxHeight ? Math.min(maxHeight, availableHeight) : availableHeight;
@@ -3141,7 +3713,7 @@ var SuggestionMenu = ({
3141
3713
  if (!isMounted || !show || !editor) {
3142
3714
  return null;
3143
3715
  }
3144
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3716
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3145
3717
  "div",
3146
3718
  {
3147
3719
  ref,
@@ -3163,14 +3735,14 @@ var SuggestionMenu = ({
3163
3735
 
3164
3736
  // src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
3165
3737
  var import_editor_utils5 = require("@kopexa/editor-utils");
3166
- var import_icons11 = require("@kopexa/icons");
3738
+ var import_icons12 = require("@kopexa/icons");
3167
3739
  var React7 = __toESM(require("react"));
3168
3740
 
3169
3741
  // src/ui/table-button/use-table.ts
3170
3742
  var import_editor_utils4 = require("@kopexa/editor-utils");
3171
- var import_icons10 = require("@kopexa/icons");
3172
- var import_react30 = require("@tiptap/react");
3173
- var import_react31 = require("react");
3743
+ var import_icons11 = require("@kopexa/icons");
3744
+ var import_react34 = require("@tiptap/react");
3745
+ var import_react35 = require("react");
3174
3746
  function canToggle(editor) {
3175
3747
  if (!editor || !editor.isEditable) return false;
3176
3748
  if (!(0, import_editor_utils4.isNodeInSchema)("table", editor) || (0, import_editor_utils4.isNodeTypeSelected)(editor, ["image"])) {
@@ -3201,7 +3773,7 @@ function shouldShowButton(props) {
3201
3773
  if (!editor || !editor.isEditable) return false;
3202
3774
  if (!(0, import_editor_utils4.isNodeInSchema)("table", editor)) return false;
3203
3775
  if (hideWhenUnavailable) {
3204
- if ((0, import_react30.isNodeSelection)(editor.state.selection) || !canToggle) {
3776
+ if ((0, import_react34.isNodeSelection)(editor.state.selection) || !canToggle) {
3205
3777
  return false;
3206
3778
  }
3207
3779
  }
@@ -3214,10 +3786,10 @@ function useTableBlock(config) {
3214
3786
  onToggled
3215
3787
  } = config || {};
3216
3788
  const { editor } = useTiptapEditor(providedEditor);
3217
- const [isVisible, setIsVisible] = (0, import_react31.useState)(true);
3789
+ const [isVisible, setIsVisible] = (0, import_react35.useState)(true);
3218
3790
  const canToggleState = canToggle(editor);
3219
3791
  const isActive = (editor == null ? void 0 : editor.isActive("table")) || false;
3220
- (0, import_react31.useEffect)(() => {
3792
+ (0, import_react35.useEffect)(() => {
3221
3793
  if (!editor) return;
3222
3794
  const handleSelectionUpdate = () => {
3223
3795
  setIsVisible(shouldShowButton({ editor, hideWhenUnavailable }));
@@ -3228,7 +3800,7 @@ function useTableBlock(config) {
3228
3800
  editor.off("selectionUpdate", handleSelectionUpdate);
3229
3801
  };
3230
3802
  }, [editor, hideWhenUnavailable]);
3231
- const handleToggle = (0, import_react31.useCallback)(() => {
3803
+ const handleToggle = (0, import_react35.useCallback)(() => {
3232
3804
  if (!editor) return false;
3233
3805
  const success = toggleTable(editor);
3234
3806
  if (success) {
@@ -3243,7 +3815,7 @@ function useTableBlock(config) {
3243
3815
  canToggle: canToggleState,
3244
3816
  label: "Table",
3245
3817
  // shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
3246
- Icon: import_icons10.TableIcon
3818
+ Icon: import_icons11.TableIcon
3247
3819
  };
3248
3820
  }
3249
3821
 
@@ -3254,14 +3826,14 @@ var texts = {
3254
3826
  title: "Continue Writing",
3255
3827
  subtext: "Continue writing from the current position",
3256
3828
  keywords: ["continue", "write", "continue writing", "ai"],
3257
- badge: import_icons11.AiSparklesIcon,
3829
+ badge: import_icons12.AiSparklesIcon,
3258
3830
  group: "AI"
3259
3831
  },
3260
3832
  ai_ask_button: {
3261
3833
  title: "Ask AI",
3262
3834
  subtext: "Ask AI to generate content",
3263
3835
  keywords: ["ai", "ask", "generate"],
3264
- badge: import_icons11.AiSparklesIcon,
3836
+ badge: import_icons12.AiSparklesIcon,
3265
3837
  group: "AI"
3266
3838
  },
3267
3839
  // Style
@@ -3269,63 +3841,63 @@ var texts = {
3269
3841
  title: "Text",
3270
3842
  subtext: "Regular text paragraph",
3271
3843
  keywords: ["p", "paragraph", "text"],
3272
- badge: import_icons11.TypeIcon,
3844
+ badge: import_icons12.TypeIcon,
3273
3845
  group: "Style"
3274
3846
  },
3275
3847
  heading_1: {
3276
3848
  title: "Heading 1",
3277
3849
  subtext: "Top-level heading",
3278
3850
  keywords: ["h", "heading1", "h1"],
3279
- badge: import_icons11.HeadingOneIcon,
3851
+ badge: import_icons12.HeadingOneIcon,
3280
3852
  group: "Style"
3281
3853
  },
3282
3854
  heading_2: {
3283
3855
  title: "Heading 2",
3284
3856
  subtext: "Key section heading",
3285
3857
  keywords: ["h2", "heading2", "subheading"],
3286
- badge: import_icons11.HeadingTwoIcon,
3858
+ badge: import_icons12.HeadingTwoIcon,
3287
3859
  group: "Style"
3288
3860
  },
3289
3861
  heading_3: {
3290
3862
  title: "Heading 3",
3291
3863
  subtext: "Subsection and group heading",
3292
3864
  keywords: ["h3", "heading3", "subheading"],
3293
- badge: import_icons11.HeadingThreeIcon,
3865
+ badge: import_icons12.HeadingThreeIcon,
3294
3866
  group: "Style"
3295
3867
  },
3296
3868
  bullet_list: {
3297
3869
  title: "Bullet List",
3298
3870
  subtext: "List with unordered items",
3299
3871
  keywords: ["ul", "li", "list", "bulletlist", "bullet list"],
3300
- badge: import_icons11.ListIcon,
3872
+ badge: import_icons12.ListIcon,
3301
3873
  group: "Style"
3302
3874
  },
3303
3875
  ordered_list: {
3304
3876
  title: "Numbered List",
3305
3877
  subtext: "List with ordered items",
3306
3878
  keywords: ["ol", "li", "list", "numberedlist", "numbered list"],
3307
- badge: import_icons11.ListOrderedIcon,
3879
+ badge: import_icons12.ListOrderedIcon,
3308
3880
  group: "Style"
3309
3881
  },
3310
3882
  task_list: {
3311
3883
  title: "To-do list",
3312
3884
  subtext: "List with tasks",
3313
3885
  keywords: ["tasklist", "task list", "todo", "checklist"],
3314
- badge: import_icons11.ListTodoIcon,
3886
+ badge: import_icons12.ListTodoIcon,
3315
3887
  group: "Style"
3316
3888
  },
3317
3889
  quote: {
3318
3890
  title: "Blockquote",
3319
3891
  subtext: "Blockquote block",
3320
3892
  keywords: ["quote", "blockquote"],
3321
- badge: import_icons11.BlockquoteIcon,
3893
+ badge: import_icons12.BlockquoteIcon,
3322
3894
  group: "Style"
3323
3895
  },
3324
3896
  code_block: {
3325
3897
  title: "Code Block",
3326
3898
  subtext: "Code block with syntax highlighting",
3327
3899
  keywords: ["code", "pre"],
3328
- badge: import_icons11.CodeBlockIcon,
3900
+ badge: import_icons12.CodeBlockIcon,
3329
3901
  group: "Style"
3330
3902
  },
3331
3903
  // Insert
@@ -3347,49 +3919,49 @@ var texts = {
3347
3919
  title: "Control",
3348
3920
  subtext: "Insert a control block",
3349
3921
  keywords: ["control"],
3350
- badge: import_icons11.ControlsIcon,
3922
+ badge: import_icons12.ControlsIcon,
3351
3923
  group: "Insert"
3352
3924
  },
3353
3925
  divider: {
3354
3926
  title: "Separator",
3355
3927
  subtext: "Horizontal line to separate content",
3356
3928
  keywords: ["hr", "horizontalRule", "line", "separator"],
3357
- badge: import_icons11.MinusIcon,
3929
+ badge: import_icons12.MinusIcon,
3358
3930
  group: "Insert"
3359
3931
  },
3360
3932
  table: {
3361
3933
  title: "Table",
3362
3934
  subtext: "Insert a table",
3363
3935
  keywords: ["table", "grid", "spreadsheet"],
3364
- badge: import_icons11.TableIcon,
3936
+ badge: import_icons12.TableIcon,
3365
3937
  group: "Insert"
3366
3938
  },
3367
3939
  table_of_contents: {
3368
3940
  title: "Table of Contents",
3369
3941
  subtext: "Auto-generated list of headings",
3370
3942
  keywords: ["toc", "table of contents", "index", "navigation", "headings"],
3371
- badge: import_icons11.TableOfContentsIcon,
3943
+ badge: import_icons12.TableOfContentsIcon,
3372
3944
  group: "Insert"
3373
3945
  },
3374
3946
  callout: {
3375
3947
  title: "Callout",
3376
3948
  subtext: "Highlighted block for important information",
3377
3949
  keywords: ["callout", "info", "warning", "alert", "note", "tip"],
3378
- badge: import_icons11.InfoIcon,
3950
+ badge: import_icons12.InfoIcon,
3379
3951
  group: "Insert"
3380
3952
  },
3381
3953
  callout_warning: {
3382
3954
  title: "Warning",
3383
3955
  subtext: "Warning callout block",
3384
3956
  keywords: ["warning", "caution", "attention"],
3385
- badge: import_icons11.AlertIcon,
3957
+ badge: import_icons12.AlertIcon,
3386
3958
  group: "Insert"
3387
3959
  },
3388
3960
  math: {
3389
3961
  title: "Formula",
3390
3962
  subtext: "LaTeX math formula block",
3391
3963
  keywords: ["math", "latex", "formula", "equation", "katex"],
3392
- badge: import_icons11.TypeIcon,
3964
+ badge: import_icons12.TypeIcon,
3393
3965
  group: "Insert"
3394
3966
  },
3395
3967
  // Upload
@@ -3405,7 +3977,7 @@ var texts = {
3405
3977
  "media",
3406
3978
  "url"
3407
3979
  ],
3408
- badge: import_icons11.ImageIcon,
3980
+ badge: import_icons12.ImageIcon,
3409
3981
  group: "Upload"
3410
3982
  }
3411
3983
  };
@@ -3569,9 +4141,7 @@ Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT R
3569
4141
  image: {
3570
4142
  check: (editor) => (0, import_editor_utils5.isNodeInSchema)("image", editor),
3571
4143
  action: ({ editor }) => {
3572
- editor.chain().focus().insertContent({
3573
- type: "imageUpload"
3574
- }).run();
4144
+ editor.chain().focus().setImage({ src: "" }).run();
3575
4145
  }
3576
4146
  }
3577
4147
  };
@@ -3632,11 +4202,11 @@ function useSlashDropdownMenu(config) {
3632
4202
  }
3633
4203
 
3634
4204
  // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
3635
- var import_jsx_runtime12 = require("react/jsx-runtime");
4205
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3636
4206
  var SlashDropdownMenu = (props) => {
3637
4207
  const { config, ...restProps } = props;
3638
4208
  const { getSlashMenuItems } = useSlashDropdownMenu(config);
3639
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4209
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3640
4210
  SuggestionMenu,
3641
4211
  {
3642
4212
  char: "/",
@@ -3646,7 +4216,7 @@ var SlashDropdownMenu = (props) => {
3646
4216
  selector: "tiptap-slash-dropdown-menu",
3647
4217
  items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor), query),
3648
4218
  ...restProps,
3649
- children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { ...props2, config })
4219
+ children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(List, { ...props2, config })
3650
4220
  }
3651
4221
  );
3652
4222
  };
@@ -3666,13 +4236,13 @@ var Item = (props) => {
3666
4236
  }
3667
4237
  }, [isSelected]);
3668
4238
  const BadgeIcon = item.badge;
3669
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3670
- import_button7.Button,
4239
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4240
+ import_button8.Button,
3671
4241
  {
3672
4242
  ref: itemRef,
3673
4243
  variant: "ghost",
3674
4244
  color: "default",
3675
- startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BadgeIcon, {}),
4245
+ startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BadgeIcon, {}),
3676
4246
  "data-active-state": isSelected ? "on" : "off",
3677
4247
  onClick: onSelect,
3678
4248
  fullWidth: true,
@@ -3687,14 +4257,14 @@ var List = ({
3687
4257
  onSelect,
3688
4258
  config
3689
4259
  }) => {
3690
- const styles = (0, import_theme3.slashDropdownMenu)();
4260
+ const styles = (0, import_theme4.slashDropdownMenu)();
3691
4261
  const renderedItems = React8.useMemo(() => {
3692
4262
  const rendered = [];
3693
4263
  const showGroups = (config == null ? void 0 : config.showGroups) !== false;
3694
4264
  if (!showGroups) {
3695
4265
  items.forEach((item, index) => {
3696
4266
  rendered.push(
3697
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4267
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3698
4268
  Item,
3699
4269
  {
3700
4270
  item,
@@ -3719,7 +4289,7 @@ var List = ({
3719
4289
  Object.entries(groups).forEach(([groupLabel, groupData], groupIndex) => {
3720
4290
  if (groupIndex > 0) {
3721
4291
  rendered.push(
3722
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4292
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3723
4293
  import_separator.Separator,
3724
4294
  {
3725
4295
  orientation: "horizontal"
@@ -3730,7 +4300,7 @@ var List = ({
3730
4300
  }
3731
4301
  const groupItems = groupData.items.map((item, itemIndex) => {
3732
4302
  const originalIndex = groupData.indices[itemIndex];
3733
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4303
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3734
4304
  Item,
3735
4305
  {
3736
4306
  item,
@@ -3742,13 +4312,13 @@ var List = ({
3742
4312
  });
3743
4313
  if (groupLabel) {
3744
4314
  rendered.push(
3745
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4315
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3746
4316
  "div",
3747
4317
  {
3748
4318
  className: styles.cardItemGroup(),
3749
4319
  children: [
3750
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
3751
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.cardGroup(), children: groupItems })
4320
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
4321
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.cardGroup(), children: groupItems })
3752
4322
  ]
3753
4323
  },
3754
4324
  `group-${groupIndex}-${groupLabel}`
@@ -3763,24 +4333,24 @@ var List = ({
3763
4333
  if (!renderedItems.length) {
3764
4334
  return null;
3765
4335
  }
3766
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4336
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3767
4337
  "div",
3768
4338
  {
3769
4339
  className: styles.card(),
3770
4340
  style: {
3771
4341
  maxHeight: "var(--suggestion-menu-max-height)"
3772
4342
  },
3773
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.body(), children: renderedItems })
4343
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.body(), children: renderedItems })
3774
4344
  }
3775
4345
  );
3776
4346
  };
3777
4347
 
3778
4348
  // src/presets/basic/editor-header.tsx
3779
- var import_icons23 = require("@kopexa/icons");
4349
+ var import_icons24 = require("@kopexa/icons");
3780
4350
  var import_popover3 = require("@kopexa/popover");
3781
4351
  var import_toolbar10 = require("@kopexa/toolbar");
3782
4352
  var import_use_is_mobile2 = require("@kopexa/use-is-mobile");
3783
- var import_react46 = require("react");
4353
+ var import_react50 = require("react");
3784
4354
 
3785
4355
  // src/hooks/use-cursor-visibility.ts
3786
4356
  var React10 = __toESM(require("react"));
@@ -3890,7 +4460,7 @@ var React12 = __toESM(require("react"));
3890
4460
 
3891
4461
  // src/ui/blockquote-button/use-blockquote.ts
3892
4462
  var import_editor_utils7 = require("@kopexa/editor-utils");
3893
- var import_icons12 = require("@kopexa/icons");
4463
+ var import_icons13 = require("@kopexa/icons");
3894
4464
  var import_state6 = require("@tiptap/pm/state");
3895
4465
  var React11 = __toESM(require("react"));
3896
4466
  var BLOCKQUOTE_SHORTCUT_KEY = "mod+shift+b";
@@ -3998,12 +4568,12 @@ function useBlockquote(config) {
3998
4568
  canToggle: canToggle3,
3999
4569
  label: "Blockquote",
4000
4570
  shortcutKeys: BLOCKQUOTE_SHORTCUT_KEY,
4001
- Icon: import_icons12.BlockquoteIcon
4571
+ Icon: import_icons13.BlockquoteIcon
4002
4572
  };
4003
4573
  }
4004
4574
 
4005
4575
  // src/ui/blockquote-button/blockquote-button.tsx
4006
- var import_jsx_runtime13 = require("react/jsx-runtime");
4576
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4007
4577
  var BlockquoteButton = ({
4008
4578
  editor: providedEditor,
4009
4579
  text,
@@ -4039,7 +4609,7 @@ var BlockquoteButton = ({
4039
4609
  if (!isVisible) {
4040
4610
  return null;
4041
4611
  }
4042
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4612
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4043
4613
  import_toolbar4.ToolbarButton,
4044
4614
  {
4045
4615
  type: "button",
@@ -4056,22 +4626,22 @@ var BlockquoteButton = ({
4056
4626
  onClick: handleClick,
4057
4627
  isIconOnly: !text && !children,
4058
4628
  ...buttonProps,
4059
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
4060
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, {}),
4061
- text && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: text })
4629
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
4630
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, {}),
4631
+ text && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: text })
4062
4632
  ] })
4063
4633
  }
4064
4634
  );
4065
4635
  };
4066
4636
 
4067
4637
  // src/ui/codeblock-button/code-block-button.tsx
4068
- var import_icons14 = require("@kopexa/icons");
4638
+ var import_icons15 = require("@kopexa/icons");
4069
4639
  var import_toolbar5 = require("@kopexa/toolbar");
4070
- var import_react32 = require("react");
4640
+ var import_react36 = require("react");
4071
4641
 
4072
4642
  // src/ui/codeblock-button/use-code-block.ts
4073
4643
  var import_editor_utils8 = require("@kopexa/editor-utils");
4074
- var import_icons13 = require("@kopexa/icons");
4644
+ var import_icons14 = require("@kopexa/icons");
4075
4645
  var import_state7 = require("@tiptap/pm/state");
4076
4646
  var React13 = __toESM(require("react"));
4077
4647
  var CODE_BLOCK_SHORTCUT_KEY = "mod+alt+c";
@@ -4179,12 +4749,12 @@ function useCodeBlock(config) {
4179
4749
  canToggle: canToggleState,
4180
4750
  label: "Code Block",
4181
4751
  shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
4182
- Icon: import_icons13.CodeblockIcon
4752
+ Icon: import_icons14.CodeblockIcon
4183
4753
  };
4184
4754
  }
4185
4755
 
4186
4756
  // src/ui/codeblock-button/code-block-button.tsx
4187
- var import_jsx_runtime14 = require("react/jsx-runtime");
4757
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4188
4758
  var CodeBlockButton = ({
4189
4759
  editor: providedEditor,
4190
4760
  text,
@@ -4201,7 +4771,7 @@ var CodeBlockButton = ({
4201
4771
  hideWhenUnavailable,
4202
4772
  onToggled
4203
4773
  });
4204
- const handleClick = (0, import_react32.useCallback)(
4774
+ const handleClick = (0, import_react36.useCallback)(
4205
4775
  (event) => {
4206
4776
  onClick == null ? void 0 : onClick(event);
4207
4777
  if (event.defaultPrevented) return;
@@ -4212,7 +4782,7 @@ var CodeBlockButton = ({
4212
4782
  if (!isVisible) {
4213
4783
  return null;
4214
4784
  }
4215
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4785
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4216
4786
  import_toolbar5.ToolbarButton,
4217
4787
  {
4218
4788
  type: "button",
@@ -4229,26 +4799,26 @@ var CodeBlockButton = ({
4229
4799
  onClick: handleClick,
4230
4800
  isIconOnly: true,
4231
4801
  ...buttonProps,
4232
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons14.CodeblockIcon, {})
4802
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons15.CodeblockIcon, {})
4233
4803
  }
4234
4804
  );
4235
4805
  };
4236
4806
 
4237
4807
  // src/ui/color-highlight-popover/color-highlight-popover.tsx
4238
- var import_button8 = require("@kopexa/button");
4239
- var import_icons16 = require("@kopexa/icons");
4808
+ var import_button9 = require("@kopexa/button");
4809
+ var import_icons17 = require("@kopexa/icons");
4240
4810
  var import_popover2 = require("@kopexa/popover");
4241
4811
  var import_toolbar7 = require("@kopexa/toolbar");
4242
- var import_react34 = require("react");
4812
+ var import_react38 = require("react");
4243
4813
 
4244
4814
  // src/ui/color-highlight-button/color-highlight-button.tsx
4245
- var import_theme4 = require("@kopexa/theme");
4815
+ var import_theme5 = require("@kopexa/theme");
4246
4816
  var import_toolbar6 = require("@kopexa/toolbar");
4247
- var import_react33 = require("react");
4817
+ var import_react37 = require("react");
4248
4818
 
4249
4819
  // src/ui/color-highlight-button/use-color-highlight.ts
4250
4820
  var import_editor_utils9 = require("@kopexa/editor-utils");
4251
- var import_icons15 = require("@kopexa/icons");
4821
+ var import_icons16 = require("@kopexa/icons");
4252
4822
  var import_use_is_mobile = require("@kopexa/use-is-mobile");
4253
4823
  var React14 = __toESM(require("react"));
4254
4824
  var import_react_hotkeys_hook = require("react-hotkeys-hook");
@@ -4405,12 +4975,12 @@ function useColorHighlight(config) {
4405
4975
  canColorHighlight: canColorHighlightState,
4406
4976
  label: label || `Highlight`,
4407
4977
  shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
4408
- Icon: import_icons15.HighlighterIcon
4978
+ Icon: import_icons16.HighlighterIcon
4409
4979
  };
4410
4980
  }
4411
4981
 
4412
4982
  // src/ui/color-highlight-button/color-highlight-button.tsx
4413
- var import_jsx_runtime15 = require("react/jsx-runtime");
4983
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4414
4984
  var ColorHighlightButton = ({
4415
4985
  editor: providedEditor,
4416
4986
  highlightColor,
@@ -4439,7 +5009,7 @@ var ColorHighlightButton = ({
4439
5009
  hideWhenUnavailable,
4440
5010
  onApplied
4441
5011
  });
4442
- const handleClick = (0, import_react33.useCallback)(
5012
+ const handleClick = (0, import_react37.useCallback)(
4443
5013
  (event) => {
4444
5014
  onClick == null ? void 0 : onClick(event);
4445
5015
  if (event.defaultPrevented) return;
@@ -4447,7 +5017,7 @@ var ColorHighlightButton = ({
4447
5017
  },
4448
5018
  [handleColorHighlight, onClick]
4449
5019
  );
4450
- const buttonStyle = (0, import_react33.useMemo)(
5020
+ const buttonStyle = (0, import_react37.useMemo)(
4451
5021
  () => ({
4452
5022
  ...style,
4453
5023
  "--highlight-color": highlightColor
@@ -4457,8 +5027,8 @@ var ColorHighlightButton = ({
4457
5027
  if (!isVisible) {
4458
5028
  return null;
4459
5029
  }
4460
- const styles = (0, import_theme4.colorHighlightButton)();
4461
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5030
+ const styles = (0, import_theme5.colorHighlightButton)();
5031
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4462
5032
  import_toolbar6.ToolbarButton,
4463
5033
  {
4464
5034
  type: "button",
@@ -4477,15 +5047,15 @@ var ColorHighlightButton = ({
4477
5047
  isIconOnly: true,
4478
5048
  ...buttonProps,
4479
5049
  children: [
4480
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5050
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4481
5051
  "span",
4482
5052
  {
4483
5053
  "data-active-state": isActive ? "on" : "off",
4484
5054
  className: styles.mark()
4485
5055
  }
4486
5056
  ),
4487
- children || /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
4488
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5057
+ children || /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
5058
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4489
5059
  "span",
4490
5060
  {
4491
5061
  style: { "--highlight-color": highlightColor }
@@ -4499,13 +5069,13 @@ var ColorHighlightButton = ({
4499
5069
  };
4500
5070
 
4501
5071
  // src/ui/color-highlight-popover/color-highlight-popover.tsx
4502
- var import_jsx_runtime16 = require("react/jsx-runtime");
5072
+ var import_jsx_runtime18 = require("react/jsx-runtime");
4503
5073
  var ColorHighlightPopoverButton = ({
4504
5074
  className,
4505
5075
  children,
4506
5076
  ...props
4507
- }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4508
- import_button8.IconButton,
5077
+ }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5078
+ import_button9.IconButton,
4509
5079
  {
4510
5080
  type: "button",
4511
5081
  className,
@@ -4516,7 +5086,7 @@ var ColorHighlightPopoverButton = ({
4516
5086
  tooltip: "Highlight",
4517
5087
  isIconOnly: !children,
4518
5088
  ...props,
4519
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons16.HighlighterIcon, {})
5089
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons17.HighlighterIcon, {})
4520
5090
  }
4521
5091
  );
4522
5092
  function ColorHighlightPopoverContent({
@@ -4530,8 +5100,8 @@ function ColorHighlightPopoverContent({
4530
5100
  ])
4531
5101
  }) {
4532
5102
  const { handleRemoveHighlight } = useColorHighlight({ editor });
4533
- const containerRef = (0, import_react34.useRef)(null);
4534
- const menuItems = (0, import_react34.useMemo)(
5103
+ const containerRef = (0, import_react38.useRef)(null);
5104
+ const menuItems = (0, import_react38.useMemo)(
4535
5105
  () => [...colors, { label: "Remove highlight", value: "none" }],
4536
5106
  [colors]
4537
5107
  );
@@ -4549,13 +5119,13 @@ function ColorHighlightPopoverContent({
4549
5119
  },
4550
5120
  autoSelectFirstItem: false
4551
5121
  });
4552
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, className: "flex gap-1 items-center", children: [
4553
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5122
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: containerRef, className: "flex gap-1 items-center", children: [
5123
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4554
5124
  "div",
4555
5125
  {
4556
5126
  className: "flex items-center gap-1 outline-none",
4557
5127
  "data-orientation": "horizontal",
4558
- children: colors.map((color, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5128
+ children: colors.map((color, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4559
5129
  ColorHighlightButton,
4560
5130
  {
4561
5131
  editor,
@@ -4568,9 +5138,9 @@ function ColorHighlightPopoverContent({
4568
5138
  ))
4569
5139
  }
4570
5140
  ),
4571
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_toolbar7.ToolbarSeparator, { orientation: "vertical" }),
4572
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4573
- import_button8.IconButton,
5141
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_toolbar7.ToolbarSeparator, { orientation: "vertical" }),
5142
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5143
+ import_button9.IconButton,
4574
5144
  {
4575
5145
  onClick: handleRemoveHighlight,
4576
5146
  "aria-label": "Remove highlight",
@@ -4580,7 +5150,7 @@ function ColorHighlightPopoverContent({
4580
5150
  variant: "ghost",
4581
5151
  color: "default",
4582
5152
  "data-highlighted": selectedIndex === colors.length,
4583
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons16.BanIcon, {})
5153
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons17.BanIcon, {})
4584
5154
  }
4585
5155
  ) })
4586
5156
  ] });
@@ -4599,18 +5169,18 @@ function ColorHighlightPopover({
4599
5169
  ...props
4600
5170
  }) {
4601
5171
  const { editor } = useTiptapEditor(providedEditor);
4602
- const [isOpen, setIsOpen] = (0, import_react34.useState)(false);
5172
+ const [isOpen, setIsOpen] = (0, import_react38.useState)(false);
4603
5173
  const { isVisible, canColorHighlight: canColorHighlight2, isActive, label } = useColorHighlight({
4604
5174
  editor,
4605
5175
  hideWhenUnavailable,
4606
5176
  onApplied
4607
5177
  });
4608
5178
  if (!isVisible) return null;
4609
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_popover2.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
4610
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5179
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_popover2.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
5180
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4611
5181
  import_popover2.Popover.Trigger,
4612
5182
  {
4613
- render: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5183
+ render: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4614
5184
  ColorHighlightPopoverButton,
4615
5185
  {
4616
5186
  disabled: !canColorHighlight2,
@@ -4624,26 +5194,26 @@ function ColorHighlightPopover({
4624
5194
  )
4625
5195
  }
4626
5196
  ),
4627
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_popover2.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
5197
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_popover2.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
4628
5198
  ] });
4629
5199
  }
4630
5200
 
4631
5201
  // src/ui/heading-dropdown-menu/index.tsx
4632
- var import_button10 = require("@kopexa/button");
5202
+ var import_button11 = require("@kopexa/button");
4633
5203
  var import_dropdown_menu = require("@kopexa/dropdown-menu");
4634
5204
  var import_editor_utils11 = require("@kopexa/editor-utils");
4635
- var import_icons18 = require("@kopexa/icons");
4636
- var import_react36 = require("@tiptap/react");
5205
+ var import_icons19 = require("@kopexa/icons");
5206
+ var import_react40 = require("@tiptap/react");
4637
5207
  var React16 = __toESM(require("react"));
4638
5208
 
4639
5209
  // src/ui/heading-button/index.tsx
4640
- var import_button9 = require("@kopexa/button");
5210
+ var import_button10 = require("@kopexa/button");
4641
5211
  var import_editor_utils10 = require("@kopexa/editor-utils");
4642
- var import_icons17 = require("@kopexa/icons");
5212
+ var import_icons18 = require("@kopexa/icons");
4643
5213
  var React15 = __toESM(require("react"));
4644
5214
 
4645
5215
  // src/ui/heading-button/utils.ts
4646
- var import_react35 = require("@tiptap/react");
5216
+ var import_react39 = require("@tiptap/react");
4647
5217
  var headingShortcutKeys = {
4648
5218
  1: "Ctrl-Alt-1",
4649
5219
  2: "Ctrl-Alt-2",
@@ -4684,7 +5254,7 @@ function shouldShowHeadingButton(params) {
4684
5254
  return false;
4685
5255
  }
4686
5256
  if (hideWhenUnavailable) {
4687
- if ((0, import_react35.isNodeSelection)(editor.state.selection)) {
5257
+ if ((0, import_react39.isNodeSelection)(editor.state.selection)) {
4688
5258
  return false;
4689
5259
  }
4690
5260
  }
@@ -4695,14 +5265,14 @@ function getFormattedHeadingName(level) {
4695
5265
  }
4696
5266
 
4697
5267
  // src/ui/heading-button/index.tsx
4698
- var import_jsx_runtime17 = require("react/jsx-runtime");
5268
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4699
5269
  var headingIcons = {
4700
- 1: import_icons17.HeadingOneIcon,
4701
- 2: import_icons17.HeadingTwoIcon,
4702
- 3: import_icons17.HeadingThreeIcon,
4703
- 4: import_icons17.HeadingFourIcon,
4704
- 5: import_icons17.HeadingFiveIcon,
4705
- 6: import_icons17.HeadingSixIcon
5270
+ 1: import_icons18.HeadingOneIcon,
5271
+ 2: import_icons18.HeadingTwoIcon,
5272
+ 3: import_icons18.HeadingThreeIcon,
5273
+ 4: import_icons18.HeadingFourIcon,
5274
+ 5: import_icons18.HeadingFiveIcon,
5275
+ 6: import_icons18.HeadingSixIcon
4706
5276
  };
4707
5277
  function useHeadingState(editor, level, disabled = false) {
4708
5278
  const headingInSchema = (0, import_editor_utils10.isNodeInSchema)("heading", editor);
@@ -4761,8 +5331,8 @@ var HeadingButton = ({
4761
5331
  if (!show || !editor || !editor.isEditable) {
4762
5332
  return null;
4763
5333
  }
4764
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4765
- import_button9.Button,
5334
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5335
+ import_button10.Button,
4766
5336
  {
4767
5337
  type: "button",
4768
5338
  className: className.trim(),
@@ -4777,7 +5347,7 @@ var HeadingButton = ({
4777
5347
  tooltip: formattedName,
4778
5348
  shortcutKeys: shortcutKey,
4779
5349
  onClick: handleClick,
4780
- startContent: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, {}),
5350
+ startContent: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, {}),
4781
5351
  ...buttonProps,
4782
5352
  ref,
4783
5353
  children: children || text
@@ -4786,7 +5356,7 @@ var HeadingButton = ({
4786
5356
  };
4787
5357
 
4788
5358
  // src/ui/heading-dropdown-menu/index.tsx
4789
- var import_jsx_runtime18 = require("react/jsx-runtime");
5359
+ var import_jsx_runtime20 = require("react/jsx-runtime");
4790
5360
  function HeadingDropdownMenu({
4791
5361
  editor: providedEditor,
4792
5362
  levels = [1, 2, 3, 4, 5, 6],
@@ -4806,13 +5376,13 @@ function HeadingDropdownMenu({
4806
5376
  [onOpenChange]
4807
5377
  );
4808
5378
  const getActiveIcon = React16.useCallback(() => {
4809
- if (!editor) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons18.HeadingIcon, {});
5379
+ if (!editor) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.HeadingIcon, {});
4810
5380
  const activeLevel = levels.find(
4811
5381
  (level) => editor.isActive("heading", { level })
4812
5382
  );
4813
- if (!activeLevel) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons18.HeadingIcon, {});
5383
+ if (!activeLevel) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.HeadingIcon, {});
4814
5384
  const ActiveIcon = headingIcons[activeLevel];
4815
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ActiveIcon, {});
5385
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActiveIcon, {});
4816
5386
  }, [editor, levels]);
4817
5387
  const canToggleAnyHeading = React16.useCallback(() => {
4818
5388
  if (!editor) return false;
@@ -4827,7 +5397,7 @@ function HeadingDropdownMenu({
4827
5397
  return false;
4828
5398
  }
4829
5399
  if (hideWhenUnavailable) {
4830
- if ((0, import_react36.isNodeSelection)(editor.state.selection) || !canToggleAnyHeading()) {
5400
+ if ((0, import_react40.isNodeSelection)(editor.state.selection) || !canToggleAnyHeading()) {
4831
5401
  return false;
4832
5402
  }
4833
5403
  }
@@ -4836,9 +5406,9 @@ function HeadingDropdownMenu({
4836
5406
  if (!show || !editor || !editor.isEditable) {
4837
5407
  return null;
4838
5408
  }
4839
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_dropdown_menu.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
4840
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_dropdown_menu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4841
- import_button10.Button,
5409
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_dropdown_menu.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5410
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5411
+ import_button11.Button,
4842
5412
  {
4843
5413
  type: "button",
4844
5414
  disabled: isDisabled,
@@ -4850,12 +5420,12 @@ function HeadingDropdownMenu({
4850
5420
  "aria-label": "Format text as heading",
4851
5421
  "aria-pressed": isAnyHeadingActive,
4852
5422
  tooltip: "Heading",
4853
- endContent: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons18.ChevronDownIcon, {}),
5423
+ endContent: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.ChevronDownIcon, {}),
4854
5424
  ...props,
4855
5425
  children: getActiveIcon()
4856
5426
  }
4857
5427
  ) }),
4858
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_dropdown_menu.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_dropdown_menu.DropdownMenu.Group, { children: levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_dropdown_menu.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5428
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Group, { children: levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4859
5429
  HeadingButton,
4860
5430
  {
4861
5431
  editor,
@@ -4870,35 +5440,35 @@ function HeadingDropdownMenu({
4870
5440
  }
4871
5441
 
4872
5442
  // src/ui/list-dropdown-menu/index.tsx
4873
- var import_button12 = require("@kopexa/button");
5443
+ var import_button13 = require("@kopexa/button");
4874
5444
  var import_dropdown_menu2 = require("@kopexa/dropdown-menu");
4875
5445
  var import_editor_utils13 = require("@kopexa/editor-utils");
4876
- var import_icons20 = require("@kopexa/icons");
4877
- var import_react39 = require("@tiptap/react");
4878
- var import_react40 = require("react");
5446
+ var import_icons21 = require("@kopexa/icons");
5447
+ var import_react43 = require("@tiptap/react");
5448
+ var import_react44 = require("react");
4879
5449
 
4880
5450
  // src/ui/list-button/index.tsx
4881
- var import_button11 = require("@kopexa/button");
5451
+ var import_button12 = require("@kopexa/button");
4882
5452
  var import_editor_utils12 = require("@kopexa/editor-utils");
4883
- var import_icons19 = require("@kopexa/icons");
4884
- var import_react37 = require("@tiptap/react");
4885
- var import_react38 = require("react");
4886
- var import_jsx_runtime19 = require("react/jsx-runtime");
5453
+ var import_icons20 = require("@kopexa/icons");
5454
+ var import_react41 = require("@tiptap/react");
5455
+ var import_react42 = require("react");
5456
+ var import_jsx_runtime21 = require("react/jsx-runtime");
4887
5457
  var listOptions = [
4888
5458
  {
4889
5459
  label: "Bullet List",
4890
5460
  type: "bulletList",
4891
- icon: import_icons19.ListIcon
5461
+ icon: import_icons20.ListIcon
4892
5462
  },
4893
5463
  {
4894
5464
  label: "Ordered List",
4895
5465
  type: "orderedList",
4896
- icon: import_icons19.ListOrderedIcon
5466
+ icon: import_icons20.ListOrderedIcon
4897
5467
  },
4898
5468
  {
4899
5469
  label: "Task List",
4900
5470
  type: "taskList",
4901
- icon: import_icons19.ListTodoIcon
5471
+ icon: import_icons20.ListTodoIcon
4902
5472
  }
4903
5473
  ];
4904
5474
  var listShortcutKeys = {
@@ -4957,7 +5527,7 @@ function shouldShowListButton(params) {
4957
5527
  return false;
4958
5528
  }
4959
5529
  if (hideWhenUnavailable) {
4960
- if ((0, import_react37.isNodeSelection)(editor.state.selection) || !canToggleList(editor, type)) {
5530
+ if ((0, import_react41.isNodeSelection)(editor.state.selection) || !canToggleList(editor, type)) {
4961
5531
  return false;
4962
5532
  }
4963
5533
  }
@@ -4991,8 +5561,8 @@ var ListButton = ({
4991
5561
  editor,
4992
5562
  type
4993
5563
  );
4994
- const Icon = (listOption == null ? void 0 : listOption.icon) || import_icons19.ListIcon;
4995
- const handleClick = (0, import_react38.useCallback)(
5564
+ const Icon = (listOption == null ? void 0 : listOption.icon) || import_icons20.ListIcon;
5565
+ const handleClick = (0, import_react42.useCallback)(
4996
5566
  (e) => {
4997
5567
  onClick == null ? void 0 : onClick(e);
4998
5568
  if (!e.defaultPrevented && editor) {
@@ -5001,7 +5571,7 @@ var ListButton = ({
5001
5571
  },
5002
5572
  [onClick, editor, type]
5003
5573
  );
5004
- const show = (0, import_react38.useMemo)(() => {
5574
+ const show = (0, import_react42.useMemo)(() => {
5005
5575
  return shouldShowListButton({
5006
5576
  editor,
5007
5577
  type,
@@ -5012,8 +5582,8 @@ var ListButton = ({
5012
5582
  if (!show || !editor || !editor.isEditable) {
5013
5583
  return null;
5014
5584
  }
5015
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5016
- import_button11.Button,
5585
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5586
+ import_button12.Button,
5017
5587
  {
5018
5588
  type: "button",
5019
5589
  className: className.trim(),
@@ -5026,7 +5596,7 @@ var ListButton = ({
5026
5596
  tooltip: (listOption == null ? void 0 : listOption.label) || type,
5027
5597
  shortcutKeys: shortcutKey,
5028
5598
  onClick: handleClick,
5029
- startContent: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, {}),
5599
+ startContent: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, {}),
5030
5600
  ...buttonProps,
5031
5601
  ref,
5032
5602
  children: children || text
@@ -5035,7 +5605,7 @@ var ListButton = ({
5035
5605
  };
5036
5606
 
5037
5607
  // src/ui/list-dropdown-menu/index.tsx
5038
- var import_jsx_runtime20 = require("react/jsx-runtime");
5608
+ var import_jsx_runtime22 = require("react/jsx-runtime");
5039
5609
  function canToggleAnyList(editor, listTypes) {
5040
5610
  if (!editor) return false;
5041
5611
  return listTypes.some((type) => canToggleList(editor, type));
@@ -5055,24 +5625,24 @@ function shouldShowListDropdown(params) {
5055
5625
  return false;
5056
5626
  }
5057
5627
  if (hideWhenUnavailable) {
5058
- if ((0, import_react39.isNodeSelection)(editor.state.selection) || !canToggleAny) {
5628
+ if ((0, import_react43.isNodeSelection)(editor.state.selection) || !canToggleAny) {
5059
5629
  return false;
5060
5630
  }
5061
5631
  }
5062
5632
  return true;
5063
5633
  }
5064
5634
  function useListDropdownState(editor, availableTypes) {
5065
- const [isOpen, setIsOpen] = (0, import_react40.useState)(false);
5635
+ const [isOpen, setIsOpen] = (0, import_react44.useState)(false);
5066
5636
  const listInSchema = availableTypes.some(
5067
5637
  (type) => (0, import_editor_utils13.isNodeInSchema)(type, editor)
5068
5638
  );
5069
- const filteredLists = (0, import_react40.useMemo)(
5639
+ const filteredLists = (0, import_react44.useMemo)(
5070
5640
  () => getFilteredListOptions(availableTypes),
5071
5641
  [availableTypes]
5072
5642
  );
5073
5643
  const canToggleAny = canToggleAnyList(editor, availableTypes);
5074
5644
  const isAnyActive = isAnyListActive(editor, availableTypes);
5075
- const handleOpenChange = (0, import_react40.useCallback)(
5645
+ const handleOpenChange = (0, import_react44.useCallback)(
5076
5646
  (open, callback) => {
5077
5647
  setIsOpen(open);
5078
5648
  callback == null ? void 0 : callback(open);
@@ -5090,11 +5660,11 @@ function useListDropdownState(editor, availableTypes) {
5090
5660
  };
5091
5661
  }
5092
5662
  function useActiveListIcon(editor, filteredLists) {
5093
- return (0, import_react40.useCallback)(() => {
5663
+ return (0, import_react44.useCallback)(() => {
5094
5664
  const activeOption = filteredLists.find(
5095
5665
  (option) => isListActive(editor, option.type)
5096
5666
  );
5097
- return activeOption ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(activeOption.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons20.ListIcon, {});
5667
+ return activeOption ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(activeOption.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons21.ListIcon, {});
5098
5668
  }, [editor, filteredLists]);
5099
5669
  }
5100
5670
  function ListDropdownMenu({
@@ -5114,7 +5684,7 @@ function ListDropdownMenu({
5114
5684
  handleOpenChange
5115
5685
  } = useListDropdownState(editor, types);
5116
5686
  const getActiveIcon = useActiveListIcon(editor, filteredLists);
5117
- const show = (0, import_react40.useMemo)(() => {
5687
+ const show = (0, import_react44.useMemo)(() => {
5118
5688
  return shouldShowListDropdown({
5119
5689
  editor,
5120
5690
  listTypes: types,
@@ -5123,16 +5693,16 @@ function ListDropdownMenu({
5123
5693
  canToggleAny
5124
5694
  });
5125
5695
  }, [editor, types, hideWhenUnavailable, listInSchema, canToggleAny]);
5126
- const handleOnOpenChange = (0, import_react40.useCallback)(
5696
+ const handleOnOpenChange = (0, import_react44.useCallback)(
5127
5697
  (open) => handleOpenChange(open, onOpenChange),
5128
5698
  [handleOpenChange, onOpenChange]
5129
5699
  );
5130
5700
  if (!show || !editor || !editor.isEditable) {
5131
5701
  return null;
5132
5702
  }
5133
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_dropdown_menu2.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5134
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu2.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5135
- import_button12.Button,
5703
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_dropdown_menu2.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5704
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5705
+ import_button13.Button,
5136
5706
  {
5137
5707
  type: "button",
5138
5708
  variant: "ghost",
@@ -5141,12 +5711,12 @@ function ListDropdownMenu({
5141
5711
  tabIndex: -1,
5142
5712
  "aria-label": "List options",
5143
5713
  tooltip: "List",
5144
- endContent: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons20.ChevronDownIcon, {}),
5714
+ endContent: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons21.ChevronDownIcon, {}),
5145
5715
  ...props,
5146
5716
  children: getActiveIcon()
5147
5717
  }
5148
5718
  ) }),
5149
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu2.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu2.DropdownMenu.Group, { children: filteredLists.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu2.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5719
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Group, { children: filteredLists.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Item, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5150
5720
  ListButton,
5151
5721
  {
5152
5722
  editor,
@@ -5163,8 +5733,8 @@ function ListDropdownMenu({
5163
5733
 
5164
5734
  // src/ui/table-button/index.tsx
5165
5735
  var import_toolbar8 = require("@kopexa/toolbar");
5166
- var import_react41 = require("react");
5167
- var import_jsx_runtime21 = require("react/jsx-runtime");
5736
+ var import_react45 = require("react");
5737
+ var import_jsx_runtime23 = require("react/jsx-runtime");
5168
5738
  var TableButton = ({
5169
5739
  editor: providedEditor,
5170
5740
  text,
@@ -5188,7 +5758,7 @@ var TableButton = ({
5188
5758
  hideWhenUnavailable,
5189
5759
  onToggled
5190
5760
  });
5191
- const handleClick = (0, import_react41.useCallback)(
5761
+ const handleClick = (0, import_react45.useCallback)(
5192
5762
  (event) => {
5193
5763
  onClick == null ? void 0 : onClick(event);
5194
5764
  if (event.defaultPrevented) return;
@@ -5199,7 +5769,7 @@ var TableButton = ({
5199
5769
  if (!isVisible) {
5200
5770
  return null;
5201
5771
  }
5202
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5772
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5203
5773
  import_toolbar8.ToolbarButton,
5204
5774
  {
5205
5775
  type: "button",
@@ -5215,22 +5785,22 @@ var TableButton = ({
5215
5785
  onClick: handleClick,
5216
5786
  isIconOnly: !text && !children,
5217
5787
  ...buttonProps,
5218
- children: children || /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
5219
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, {}),
5220
- text && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: text })
5788
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
5789
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, {}),
5790
+ text && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: text })
5221
5791
  ] })
5222
5792
  }
5223
5793
  );
5224
5794
  };
5225
5795
 
5226
5796
  // src/ui/text-align-button/text-align-button.tsx
5227
- var import_button13 = require("@kopexa/button");
5228
- var import_react43 = require("react");
5797
+ var import_button14 = require("@kopexa/button");
5798
+ var import_react47 = require("react");
5229
5799
 
5230
5800
  // src/ui/text-align-button/use-text-align.ts
5231
5801
  var import_editor_utils14 = require("@kopexa/editor-utils");
5232
- var import_icons21 = require("@kopexa/icons");
5233
- var import_react42 = require("react");
5802
+ var import_icons22 = require("@kopexa/icons");
5803
+ var import_react46 = require("react");
5234
5804
  var TEXT_ALIGN_SHORTCUT_KEYS = {
5235
5805
  left: "mod+shift+l",
5236
5806
  center: "mod+shift+e",
@@ -5238,10 +5808,10 @@ var TEXT_ALIGN_SHORTCUT_KEYS = {
5238
5808
  justify: "mod+shift+j"
5239
5809
  };
5240
5810
  var textAlignIcons = {
5241
- left: import_icons21.AlignLeftIcon,
5242
- center: import_icons21.AlignCenterIcon,
5243
- right: import_icons21.AlignRightIcon,
5244
- justify: import_icons21.AlignJustifyIcon
5811
+ left: import_icons22.AlignLeftIcon,
5812
+ center: import_icons22.AlignCenterIcon,
5813
+ right: import_icons22.AlignRightIcon,
5814
+ justify: import_icons22.AlignJustifyIcon
5245
5815
  };
5246
5816
  var textAlignLabels = {
5247
5817
  left: "Align left",
@@ -5288,10 +5858,10 @@ function useTextAlign(config) {
5288
5858
  onAligned
5289
5859
  } = config;
5290
5860
  const { editor } = useTiptapEditor(providedEditor);
5291
- const [isVisible, setIsVisible] = (0, import_react42.useState)(true);
5861
+ const [isVisible, setIsVisible] = (0, import_react46.useState)(true);
5292
5862
  const canAlign = canSetTextAlign(editor, align);
5293
5863
  const isActive = isTextAlignActive(editor, align);
5294
- (0, import_react42.useEffect)(() => {
5864
+ (0, import_react46.useEffect)(() => {
5295
5865
  if (!editor) return;
5296
5866
  const handleSelectionUpdate = () => {
5297
5867
  setIsVisible(shouldShowButton5({ editor, align, hideWhenUnavailable }));
@@ -5302,7 +5872,7 @@ function useTextAlign(config) {
5302
5872
  editor.off("selectionUpdate", handleSelectionUpdate);
5303
5873
  };
5304
5874
  }, [editor, hideWhenUnavailable, align]);
5305
- const handleTextAlign = (0, import_react42.useCallback)(() => {
5875
+ const handleTextAlign = (0, import_react46.useCallback)(() => {
5306
5876
  if (!editor) return false;
5307
5877
  const success = setTextAlign(editor, align);
5308
5878
  if (success) {
@@ -5322,7 +5892,7 @@ function useTextAlign(config) {
5322
5892
  }
5323
5893
 
5324
5894
  // src/ui/text-align-button/text-align-button.tsx
5325
- var import_jsx_runtime22 = require("react/jsx-runtime");
5895
+ var import_jsx_runtime24 = require("react/jsx-runtime");
5326
5896
  var TextAlignButton = ({
5327
5897
  editor: providedEditor,
5328
5898
  align,
@@ -5349,7 +5919,7 @@ var TextAlignButton = ({
5349
5919
  hideWhenUnavailable,
5350
5920
  onAligned
5351
5921
  });
5352
- const handleClick = (0, import_react43.useCallback)(
5922
+ const handleClick = (0, import_react47.useCallback)(
5353
5923
  (e) => {
5354
5924
  onClick == null ? void 0 : onClick(e);
5355
5925
  if (e.defaultPrevented) return;
@@ -5360,8 +5930,8 @@ var TextAlignButton = ({
5360
5930
  if (!isVisible) {
5361
5931
  return null;
5362
5932
  }
5363
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5364
- import_button13.IconButton,
5933
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5934
+ import_button14.IconButton,
5365
5935
  {
5366
5936
  type: "button",
5367
5937
  disabled: canAlign,
@@ -5376,19 +5946,19 @@ var TextAlignButton = ({
5376
5946
  shortcutKeys,
5377
5947
  onClick: handleClick,
5378
5948
  ...buttonProps,
5379
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, {})
5949
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, {})
5380
5950
  }
5381
5951
  );
5382
5952
  };
5383
5953
 
5384
5954
  // src/ui/undo-redo-button/undo-redo-button.tsx
5385
5955
  var import_toolbar9 = require("@kopexa/toolbar");
5386
- var import_react45 = require("react");
5956
+ var import_react49 = require("react");
5387
5957
 
5388
5958
  // src/ui/undo-redo-button/use-undo-redo.ts
5389
5959
  var import_editor_utils15 = require("@kopexa/editor-utils");
5390
- var import_icons22 = require("@kopexa/icons");
5391
- var import_react44 = require("react");
5960
+ var import_icons23 = require("@kopexa/icons");
5961
+ var import_react48 = require("react");
5392
5962
  var UNDO_REDO_SHORTCUT_KEYS = {
5393
5963
  undo: "mod+z",
5394
5964
  redo: "mod+shift+z"
@@ -5398,8 +5968,8 @@ var historyActionLabels = {
5398
5968
  redo: "Redo"
5399
5969
  };
5400
5970
  var historyIcons = {
5401
- undo: import_icons22.UndoIcon,
5402
- redo: import_icons22.RedoIcon
5971
+ undo: import_icons23.UndoIcon,
5972
+ redo: import_icons23.RedoIcon
5403
5973
  };
5404
5974
  function canExecuteUndoRedoAction(editor, action) {
5405
5975
  if (!editor || !editor.isEditable) return false;
@@ -5428,9 +5998,9 @@ function useUndoRedo(config) {
5428
5998
  onExecuted
5429
5999
  } = config;
5430
6000
  const { editor } = useTiptapEditor(providedEditor);
5431
- const [isVisible, setIsVisible] = (0, import_react44.useState)(true);
6001
+ const [isVisible, setIsVisible] = (0, import_react48.useState)(true);
5432
6002
  const canExecute = canExecuteUndoRedoAction(editor, action);
5433
- (0, import_react44.useEffect)(() => {
6003
+ (0, import_react48.useEffect)(() => {
5434
6004
  if (!editor) return;
5435
6005
  const handleUpdate = () => {
5436
6006
  setIsVisible(shouldShowButton6({ editor, hideWhenUnavailable, action }));
@@ -5441,7 +6011,7 @@ function useUndoRedo(config) {
5441
6011
  editor.off("transaction", handleUpdate);
5442
6012
  };
5443
6013
  }, [editor, hideWhenUnavailable, action]);
5444
- const handleAction = (0, import_react44.useCallback)(() => {
6014
+ const handleAction = (0, import_react48.useCallback)(() => {
5445
6015
  if (!editor) return false;
5446
6016
  const success = executeUndoRedoAction(editor, action);
5447
6017
  if (success) {
@@ -5460,7 +6030,7 @@ function useUndoRedo(config) {
5460
6030
  }
5461
6031
 
5462
6032
  // src/ui/undo-redo-button/undo-redo-button.tsx
5463
- var import_jsx_runtime23 = require("react/jsx-runtime");
6033
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5464
6034
  var UndoRedoButton = ({
5465
6035
  editor: providedEditor,
5466
6036
  action,
@@ -5479,7 +6049,7 @@ var UndoRedoButton = ({
5479
6049
  hideWhenUnavailable,
5480
6050
  onExecuted
5481
6051
  });
5482
- const handleClick = (0, import_react45.useCallback)(
6052
+ const handleClick = (0, import_react49.useCallback)(
5483
6053
  (event) => {
5484
6054
  onClick == null ? void 0 : onClick(event);
5485
6055
  if (event.defaultPrevented) return;
@@ -5490,7 +6060,7 @@ var UndoRedoButton = ({
5490
6060
  if (!isVisible) {
5491
6061
  return null;
5492
6062
  }
5493
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6063
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5494
6064
  import_toolbar9.ToolbarButton,
5495
6065
  {
5496
6066
  type: "button",
@@ -5505,13 +6075,13 @@ var UndoRedoButton = ({
5505
6075
  onClick: handleClick,
5506
6076
  isIconOnly: true,
5507
6077
  ...buttonProps,
5508
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, {})
6078
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, {})
5509
6079
  }
5510
6080
  );
5511
6081
  };
5512
6082
 
5513
6083
  // src/presets/basic/editor-header.tsx
5514
- var import_jsx_runtime24 = require("react/jsx-runtime");
6084
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5515
6085
  var EditorHeader = ({
5516
6086
  editor: providedEditor,
5517
6087
  variant
@@ -5521,7 +6091,7 @@ var EditorHeader = ({
5521
6091
  const isMobile = (0, import_use_is_mobile2.useIsMobile)();
5522
6092
  const windowSize = useWindowSize();
5523
6093
  const { styles } = useEditorUIContext();
5524
- const toolbarRef = (0, import_react46.useRef)(null);
6094
+ const toolbarRef = (0, import_react50.useRef)(null);
5525
6095
  const bodyRect = useCursorVisibility({
5526
6096
  editor,
5527
6097
  overlayHeight: (_b = (_a = toolbarRef.current) == null ? void 0 : _a.getBoundingClientRect().height) != null ? _b : 0
@@ -5530,7 +6100,7 @@ var EditorHeader = ({
5530
6100
  return null;
5531
6101
  }
5532
6102
  const ToolbarContent = variant === "comment" ? CommentToolbarContent : variant === "field" ? FieldToolbarContent : MainToolbarContent;
5533
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.toolbarContainer(), "data-slot": "editor-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6103
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: styles.toolbarContainer(), "data-slot": "editor-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5534
6104
  import_toolbar10.Toolbar,
5535
6105
  {
5536
6106
  sticky: true,
@@ -5540,54 +6110,54 @@ var EditorHeader = ({
5540
6110
  bottom: `calc(100% - ${windowSize.height - bodyRect.y}px)`
5541
6111
  } : {},
5542
6112
  className: styles.toolbar(),
5543
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ToolbarContent, {})
6113
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ToolbarContent, {})
5544
6114
  }
5545
6115
  ) });
5546
6116
  };
5547
- var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
5548
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5549
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UndoRedoButton, { action: "undo" }),
5550
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UndoRedoButton, { action: "redo" })
6117
+ var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6118
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6119
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UndoRedoButton, { action: "undo" }),
6120
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UndoRedoButton, { action: "redo" })
5551
6121
  ] }),
5552
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5553
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5554
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(HeadingDropdownMenu, { levels: [1, 2, 3, 4] }),
5555
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"] }),
5556
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BlockquoteButton, {}),
5557
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CodeBlockButton, {})
6122
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6123
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6124
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(HeadingDropdownMenu, { levels: [1, 2, 3, 4] }),
6125
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"] }),
6126
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BlockquoteButton, {}),
6127
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CodeBlockButton, {})
5558
6128
  ] }),
5559
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5560
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5561
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "bold" }),
5562
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "italic" }),
5563
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "strike" }),
5564
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "code" }),
5565
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "underline" }),
5566
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ColorHighlightPopover, {}),
5567
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LinkPopover, {})
6129
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6130
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6131
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6132
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6133
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6134
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "code" }),
6135
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "underline" }),
6136
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ColorHighlightPopover, {}),
6137
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {})
5568
6138
  ] }),
5569
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5570
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableButton, {}) }),
5571
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MoreOptions, { hideWhenUnavailable: true })
6139
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6140
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableButton, {}) }),
6141
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MoreOptions, { hideWhenUnavailable: true })
5572
6142
  ] });
5573
- var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
5574
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5575
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "bold" }),
5576
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "italic" }),
5577
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "strike" }),
5578
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "code" })
6143
+ var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6144
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6145
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6146
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6147
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6148
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "code" })
5579
6149
  ] }),
5580
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5581
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5582
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LinkPopover, {}),
5583
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
6150
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6151
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6152
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {}),
6153
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
5584
6154
  ] })
5585
6155
  ] });
5586
- var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5587
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "bold" }),
5588
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "italic" }),
5589
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "strike" }),
5590
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LinkPopover, {})
6156
+ var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6157
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6158
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6159
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6160
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {})
5591
6161
  ] });
5592
6162
  function MoreOptions({
5593
6163
  editor: providedEditor,
@@ -5595,8 +6165,8 @@ function MoreOptions({
5595
6165
  ...props
5596
6166
  }) {
5597
6167
  const { editor } = useTiptapEditor(providedEditor);
5598
- const [show, setShow] = (0, import_react46.useState)(false);
5599
- (0, import_react46.useEffect)(() => {
6168
+ const [show, setShow] = (0, import_react50.useState)(false);
6169
+ (0, import_react50.useEffect)(() => {
5600
6170
  if (!editor) return;
5601
6171
  const handleSelectionUpdate = () => {
5602
6172
  setShow(
@@ -5615,13 +6185,13 @@ function MoreOptions({
5615
6185
  if (!show || !editor || !editor.isEditable) {
5616
6186
  return null;
5617
6187
  }
5618
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
5619
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5620
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_popover3.Popover.Root, { spacing: "dense", width: "auto", children: [
5621
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6188
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6189
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6190
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_popover3.Popover.Root, { spacing: "dense", width: "auto", children: [
6191
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5622
6192
  import_popover3.Popover.Trigger,
5623
6193
  {
5624
- render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6194
+ render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5625
6195
  import_toolbar10.ToolbarButton,
5626
6196
  {
5627
6197
  type: "button",
@@ -5633,29 +6203,29 @@ function MoreOptions({
5633
6203
  title: "More options",
5634
6204
  isIconOnly: true,
5635
6205
  ...props,
5636
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons23.MoreVerticalIcon, {})
6206
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons24.MoreVerticalIcon, {})
5637
6207
  }
5638
6208
  )
5639
6209
  }
5640
6210
  ),
5641
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6211
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5642
6212
  import_popover3.Popover.Content,
5643
6213
  {
5644
6214
  side: "top",
5645
6215
  align: "end",
5646
6216
  alignOffset: 4,
5647
6217
  sideOffset: 4,
5648
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.Toolbar, { children: [
5649
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5650
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "superscript" }),
5651
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "subscript" })
6218
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.Toolbar, { children: [
6219
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6220
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "superscript" }),
6221
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "subscript" })
5652
6222
  ] }),
5653
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5654
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5655
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "left" }),
5656
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "center" }),
5657
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "right" }),
5658
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "justify" })
6223
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6224
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6225
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "left" }),
6226
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "center" }),
6227
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "right" }),
6228
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "justify" })
5659
6229
  ] })
5660
6230
  ] })
5661
6231
  }
@@ -5687,7 +6257,7 @@ function shouldShowMoreOptions(params) {
5687
6257
  }
5688
6258
 
5689
6259
  // src/presets/basic/index.tsx
5690
- var import_jsx_runtime25 = require("react/jsx-runtime");
6260
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5691
6261
  var BasicEditor = ({
5692
6262
  variant,
5693
6263
  bordered,
@@ -5695,28 +6265,28 @@ var BasicEditor = ({
5695
6265
  ...options
5696
6266
  }) => {
5697
6267
  const editor = useCreateEditor({ content, ...options });
5698
- const styles = (0, import_theme5.editorBasic)({ variant, bordered });
6268
+ const styles = (0, import_theme6.editorBasic)({ variant, bordered });
5699
6269
  if (!editor) {
5700
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LoadingSpinner, {});
6270
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LoadingSpinner, {});
5701
6271
  }
5702
6272
  const isBottomToolbar = variant === "field";
5703
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditorUIProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: styles.root(), "data-slot": "editor", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react47.EditorContext.Provider, { value: { editor }, children: [
5704
- !isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditorHeader, { editor, variant }),
5705
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditorContentArea, { variant }),
5706
- isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditorHeader, { editor, variant })
6273
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorUIProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.root(), "data-slot": "editor", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react51.EditorContext.Provider, { value: { editor }, children: [
6274
+ !isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorHeader, { editor, variant }),
6275
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorContentArea, { variant }),
6276
+ isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorHeader, { editor, variant })
5707
6277
  ] }) }) });
5708
6278
  };
5709
6279
  var EditorContentArea = ({ variant }) => {
5710
- const styles = (0, import_theme5.editorBasic)({ variant });
5711
- const { editor } = (0, import_react48.useContext)(import_react47.EditorContext);
6280
+ const styles = (0, import_theme6.editorBasic)({ variant });
6281
+ const { editor } = (0, import_react52.useContext)(import_react51.EditorContext);
5712
6282
  const { isDragging } = useUiEditorState(editor);
5713
6283
  useScrollToHash();
5714
6284
  if (!editor) {
5715
6285
  return null;
5716
6286
  }
5717
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: styles.wrapper(), children: [
5718
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5719
- import_react47.EditorContent,
6287
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: styles.wrapper(), children: [
6288
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6289
+ import_react51.EditorContent,
5720
6290
  {
5721
6291
  editor,
5722
6292
  role: "presentation",
@@ -5724,17 +6294,17 @@ var EditorContentArea = ({ variant }) => {
5724
6294
  style: {
5725
6295
  cursor: isDragging ? "grabbing" : "auto"
5726
6296
  },
5727
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlashDropdownMenu, {})
6297
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlashDropdownMenu, {})
5728
6298
  }
5729
6299
  ),
5730
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BubbleMenu, { editor }),
5731
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LinkBubble, { editor })
6300
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BubbleMenu, { editor }),
6301
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LinkBubble, { editor })
5732
6302
  ] });
5733
6303
  };
5734
6304
  function LoadingSpinner({ text = "Connecting..." }) {
5735
- const styles = (0, import_theme5.editorSpinner)();
5736
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: styles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: styles.content(), children: [
5737
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
6305
+ const styles = (0, import_theme6.editorSpinner)();
6306
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: styles.content(), children: [
6307
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5738
6308
  "svg",
5739
6309
  {
5740
6310
  className: styles.svg(),
@@ -5742,9 +6312,9 @@ function LoadingSpinner({ text = "Connecting..." }) {
5742
6312
  fill: "none",
5743
6313
  viewBox: "0 0 24 24",
5744
6314
  children: [
5745
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("title", { children: "Loading Spinner" }),
5746
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { className: styles.circle(), cx: "12", cy: "12", r: "10" }),
5747
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6315
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("title", { children: "Loading Spinner" }),
6316
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("circle", { className: styles.circle(), cx: "12", cy: "12", r: "10" }),
6317
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5748
6318
  "path",
5749
6319
  {
5750
6320
  className: styles.path(),
@@ -5754,7 +6324,7 @@ function LoadingSpinner({ text = "Connecting..." }) {
5754
6324
  ]
5755
6325
  }
5756
6326
  ),
5757
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: styles.text(), children: text })
6327
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.text(), children: text })
5758
6328
  ] }) });
5759
6329
  }
5760
6330
  // Annotate the CommonJS export names for ESM import in node: