@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
package/dist/index.js CHANGED
@@ -33,6 +33,8 @@ var index_exports = {};
33
33
  __export(index_exports, {
34
34
  CalloutNode: () => CalloutNode,
35
35
  Editor: () => BasicEditor,
36
+ EditorFileProvider: () => EditorFileProvider,
37
+ ImageNode: () => ImageNode,
36
38
  InlineMath: () => InlineMath,
37
39
  MathBlock: () => MathBlock,
38
40
  TocNode: () => TocNode,
@@ -40,19 +42,84 @@ __export(index_exports, {
40
42
  getExtensions: () => getExtensions,
41
43
  handleImageUpload: () => handleImageUpload,
42
44
  isAllowedUri: () => isAllowedUri,
43
- sanitizeUrl: () => sanitizeUrl
45
+ sanitizeUrl: () => sanitizeUrl,
46
+ useEditorFile: () => useEditorFile,
47
+ useEditorFileRequired: () => useEditorFileRequired
44
48
  });
45
49
  module.exports = __toCommonJS(index_exports);
46
50
 
51
+ // src/context/editor-file-context.tsx
52
+ var import_react = require("react");
53
+ var import_jsx_runtime = require("react/jsx-runtime");
54
+ var EditorFileContext = (0, import_react.createContext)(null);
55
+ var DEFAULT_CACHE_BUFFER = 2 * 60 * 1e3;
56
+ var DEFAULT_CACHE_TTL = 10 * 60 * 1e3;
57
+ var defaultIsReference = (src) => {
58
+ if (!src) return false;
59
+ if (src.startsWith("http://") || src.startsWith("https://")) return false;
60
+ if (src.startsWith("data:")) return false;
61
+ if (src.startsWith("blob:")) return false;
62
+ return true;
63
+ };
64
+ function EditorFileProvider({
65
+ children,
66
+ onUpload,
67
+ onResolve,
68
+ isReference = defaultIsReference,
69
+ cacheBuffer = DEFAULT_CACHE_BUFFER,
70
+ defaultCacheTtl = DEFAULT_CACHE_TTL
71
+ }) {
72
+ const cacheRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
73
+ const resolve = (0, import_react.useCallback)(
74
+ async (ref) => {
75
+ const cache = cacheRef.current;
76
+ const now = Date.now();
77
+ const cached = cache.get(ref);
78
+ if (cached && cached.expiresAt > now + cacheBuffer) {
79
+ return cached.url;
80
+ }
81
+ const url = await onResolve(ref);
82
+ cache.set(ref, {
83
+ url,
84
+ expiresAt: now + defaultCacheTtl
85
+ });
86
+ return url;
87
+ },
88
+ [onResolve, cacheBuffer, defaultCacheTtl]
89
+ );
90
+ const value = (0, import_react.useMemo)(
91
+ () => ({
92
+ isAvailable: true,
93
+ upload: onUpload,
94
+ resolve,
95
+ isReference
96
+ }),
97
+ [onUpload, resolve, isReference]
98
+ );
99
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorFileContext.Provider, { value, children });
100
+ }
101
+ function useEditorFile() {
102
+ return (0, import_react.useContext)(EditorFileContext);
103
+ }
104
+ function useEditorFileRequired() {
105
+ const context = (0, import_react.useContext)(EditorFileContext);
106
+ if (!context) {
107
+ throw new Error(
108
+ "useEditorFileRequired must be used within an EditorFileProvider"
109
+ );
110
+ }
111
+ return context;
112
+ }
113
+
47
114
  // src/extensions/callout/index.ts
48
115
  var import_core = require("@tiptap/core");
49
- var import_react4 = require("@tiptap/react");
116
+ var import_react5 = require("@tiptap/react");
50
117
 
51
118
  // src/extensions/callout/callout-view.tsx
52
119
  var import_icons2 = require("@kopexa/icons");
53
120
  var import_theme = require("@kopexa/theme");
54
- var import_react2 = require("@tiptap/react");
55
- var import_react3 = require("react");
121
+ var import_react3 = require("@tiptap/react");
122
+ var import_react4 = require("react");
56
123
 
57
124
  // src/extensions/callout/callout-settings.tsx
58
125
  var import_button = require("@kopexa/button");
@@ -61,7 +128,7 @@ var import_icons = require("@kopexa/icons");
61
128
  var import_input = require("@kopexa/input");
62
129
  var import_label = require("@kopexa/label");
63
130
  var import_select = require("@kopexa/select");
64
- var import_react = require("react");
131
+ var import_react2 = require("react");
65
132
  var import_react_intl2 = require("react-intl");
66
133
 
67
134
  // src/extensions/callout/messages.ts
@@ -125,7 +192,7 @@ var messages = (0, import_react_intl.defineMessages)({
125
192
  });
126
193
 
127
194
  // src/extensions/callout/callout-settings.tsx
128
- var import_jsx_runtime = require("react/jsx-runtime");
195
+ var import_jsx_runtime2 = require("react/jsx-runtime");
129
196
  var VARIANTS = [
130
197
  { value: "default", messageKey: "variant_default" },
131
198
  { value: "info", messageKey: "variant_info" },
@@ -139,14 +206,14 @@ function CalloutSettings({
139
206
  getPos
140
207
  }) {
141
208
  const intl = (0, import_react_intl2.useIntl)();
142
- const [isOpen, setIsOpen] = (0, import_react.useState)(false);
143
- const [localAttrs, setLocalAttrs] = (0, import_react.useState)(attrs);
144
- (0, import_react.useEffect)(() => {
209
+ const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
210
+ const [localAttrs, setLocalAttrs] = (0, import_react2.useState)(attrs);
211
+ (0, import_react2.useEffect)(() => {
145
212
  if (isOpen) {
146
213
  setLocalAttrs(attrs);
147
214
  }
148
215
  }, [isOpen, attrs]);
149
- const handleSave = (0, import_react.useCallback)(() => {
216
+ const handleSave = (0, import_react2.useCallback)(() => {
150
217
  const pos = getPos();
151
218
  if (pos === void 0) return;
152
219
  editor.view.dispatch(
@@ -154,17 +221,17 @@ function CalloutSettings({
154
221
  );
155
222
  setIsOpen(false);
156
223
  }, [editor, localAttrs, getPos]);
157
- const handleCancel = (0, import_react.useCallback)(() => {
224
+ const handleCancel = (0, import_react2.useCallback)(() => {
158
225
  setLocalAttrs(attrs);
159
226
  setIsOpen(false);
160
227
  }, [attrs]);
161
- const handleVariantChange = (0, import_react.useCallback)((value) => {
228
+ const handleVariantChange = (0, import_react2.useCallback)((value) => {
162
229
  setLocalAttrs((prev) => ({
163
230
  ...prev,
164
231
  variant: String(value)
165
232
  }));
166
233
  }, []);
167
- const handleTitleChange = (0, import_react.useCallback)(
234
+ const handleTitleChange = (0, import_react2.useCallback)(
168
235
  (e) => {
169
236
  const value = e.target.value;
170
237
  setLocalAttrs((prev) => ({
@@ -177,8 +244,8 @@ function CalloutSettings({
177
244
  if (!editor.isEditable) {
178
245
  return null;
179
246
  }
180
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
181
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
247
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
248
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
182
249
  import_button.IconButton,
183
250
  {
184
251
  size: "sm",
@@ -189,30 +256,30 @@ function CalloutSettings({
189
256
  e.preventDefault();
190
257
  setIsOpen(true);
191
258
  },
192
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SettingsIcon, { className: "size-3.5" })
259
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.SettingsIcon, { className: "size-3.5" })
193
260
  }
194
261
  ),
195
- /* @__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: [
196
- /* @__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) }) }),
197
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4", children: [
198
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.variant) }),
200
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
262
+ /* @__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: [
263
+ /* @__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) }) }),
264
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-4", children: [
265
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1.5", children: [
266
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.variant) }),
267
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
201
268
  import_select.Select,
202
269
  {
203
270
  size: "sm",
204
271
  value: localAttrs.variant,
205
272
  onValueChange: handleVariantChange,
206
273
  children: [
207
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Value, {}) }),
208
- /* @__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)) })
274
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_select.Select.Value, {}) }),
275
+ /* @__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)) })
209
276
  ]
210
277
  }
211
278
  )
212
279
  ] }),
213
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
214
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.title) }),
215
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
280
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "space-y-1.5", children: [
281
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.title) }),
282
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
216
283
  import_input.Input,
217
284
  {
218
285
  size: "sm",
@@ -223,34 +290,41 @@ function CalloutSettings({
223
290
  )
224
291
  ] })
225
292
  ] }) }),
226
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Footer, { children: [
227
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages.cancel) }),
228
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: handleSave, children: intl.formatMessage(messages.save) })
293
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_dialog.Dialog.Footer, { children: [
294
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_button.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages.cancel) }),
295
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_button.Button, { onClick: handleSave, children: intl.formatMessage(messages.save) })
229
296
  ] })
230
297
  ] }) })
231
298
  ] });
232
299
  }
233
300
 
234
301
  // src/extensions/callout/callout-view.tsx
235
- var import_jsx_runtime2 = require("react/jsx-runtime");
302
+ var import_jsx_runtime3 = require("react/jsx-runtime");
236
303
  function getVariantIcon(variant, iconClass) {
237
304
  switch (variant) {
238
305
  case "info":
239
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.InfoIcon, { className: iconClass });
306
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.InfoIcon, { className: iconClass });
240
307
  case "success":
241
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.CheckCirleIcon, { className: iconClass });
308
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.CheckCirleIcon, { className: iconClass });
242
309
  case "warning":
243
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.AlertIcon, { className: iconClass });
310
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.AlertIcon, { className: iconClass });
244
311
  case "destructive":
245
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.AlertCircleIcon, { className: iconClass });
312
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.AlertCircleIcon, { className: iconClass });
246
313
  default:
247
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.ShellIcon, { className: iconClass });
314
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.ShellIcon, { className: iconClass });
248
315
  }
249
316
  }
250
317
  function CalloutNodeView({ editor, node, getPos }) {
251
318
  const attrs = node.attrs;
252
319
  const { variant = "info", title } = attrs;
253
- const styles = (0, import_react3.useMemo)(
320
+ const isEditable = (0, import_react3.useEditorState)({
321
+ editor,
322
+ selector: ({ editor: e }) => {
323
+ var _a;
324
+ return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
325
+ }
326
+ });
327
+ const styles = (0, import_react4.useMemo)(
254
328
  () => (0, import_theme.callout)({
255
329
  variant,
256
330
  radius: "md",
@@ -258,19 +332,19 @@ function CalloutNodeView({ editor, node, getPos }) {
258
332
  }),
259
333
  [variant]
260
334
  );
261
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
262
- import_react2.NodeViewWrapper,
335
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
336
+ import_react3.NodeViewWrapper,
263
337
  {
264
338
  className: styles.root(),
265
339
  "data-type": "callout",
266
340
  "data-variant": variant,
267
341
  children: [
268
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.iconContainer(), children: getVariantIcon(variant, styles.icon()) }),
269
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.content(), children: [
270
- title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.title(), children: title }),
271
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewContent, { className: "callout-content" })
342
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.iconContainer(), children: getVariantIcon(variant, styles.icon()) }),
343
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: styles.content(), children: [
344
+ title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: styles.title(), children: title }),
345
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react3.NodeViewContent, { className: "callout-content" })
272
346
  ] }),
273
- editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
347
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
274
348
  CalloutSettings,
275
349
  {
276
350
  editor,
@@ -333,7 +407,7 @@ var CalloutNode = import_core.Node.create({
333
407
  ];
334
408
  },
335
409
  addNodeView() {
336
- return (0, import_react4.ReactNodeViewRenderer)(CalloutNodeView);
410
+ return (0, import_react5.ReactNodeViewRenderer)(CalloutNodeView);
337
411
  },
338
412
  addCommands() {
339
413
  return {
@@ -386,24 +460,477 @@ var CalloutNode = import_core.Node.create({
386
460
  }
387
461
  });
388
462
 
463
+ // src/extensions/image/index.ts
464
+ var import_core2 = require("@tiptap/core");
465
+ var import_react8 = require("@tiptap/react");
466
+
467
+ // src/extensions/image/image-view.tsx
468
+ var import_button2 = require("@kopexa/button");
469
+ var import_icons3 = require("@kopexa/icons");
470
+ var import_theme2 = require("@kopexa/theme");
471
+ var import_react6 = require("@tiptap/react");
472
+ var import_react7 = require("react");
473
+ var import_react_intl4 = require("react-intl");
474
+
475
+ // src/extensions/image/messages.ts
476
+ var import_react_intl3 = require("react-intl");
477
+ var messages2 = (0, import_react_intl3.defineMessages)({
478
+ loading: {
479
+ id: "editor.image.loading",
480
+ defaultMessage: "Loading image..."
481
+ },
482
+ error: {
483
+ id: "editor.image.error",
484
+ defaultMessage: "Failed to load image"
485
+ },
486
+ upload_error: {
487
+ id: "editor.image.upload_error",
488
+ defaultMessage: "Failed to upload image"
489
+ },
490
+ uploading: {
491
+ id: "editor.image.uploading",
492
+ defaultMessage: "Uploading..."
493
+ },
494
+ upload_placeholder: {
495
+ id: "editor.image.upload_placeholder",
496
+ defaultMessage: "Click to upload or drag & drop"
497
+ },
498
+ upload_hint: {
499
+ id: "editor.image.upload_hint",
500
+ defaultMessage: "PNG, JPG, GIF, WebP, SVG"
501
+ },
502
+ alt_text: {
503
+ id: "editor.image.alt_text",
504
+ defaultMessage: "Alt text"
505
+ },
506
+ alt_placeholder: {
507
+ id: "editor.image.alt_placeholder",
508
+ defaultMessage: "Describe the image..."
509
+ },
510
+ files_not_supported: {
511
+ id: "editor.image.files_not_supported",
512
+ defaultMessage: "File upload is not configured"
513
+ },
514
+ file_too_large: {
515
+ id: "editor.image.file_too_large",
516
+ defaultMessage: "File is too large (max {maxSize})"
517
+ },
518
+ invalid_type: {
519
+ id: "editor.image.invalid_type",
520
+ defaultMessage: "Invalid file type"
521
+ },
522
+ retry: {
523
+ id: "editor.image.retry",
524
+ defaultMessage: "Retry"
525
+ },
526
+ remove: {
527
+ id: "editor.image.remove",
528
+ defaultMessage: "Remove"
529
+ }
530
+ });
531
+
532
+ // src/extensions/image/image-view.tsx
533
+ var import_jsx_runtime4 = require("react/jsx-runtime");
534
+ function ImageNodeView({ editor, node, getPos }) {
535
+ var _a;
536
+ const intl = (0, import_react_intl4.useIntl)();
537
+ const fileHandler = useEditorFile();
538
+ const attrs = node.attrs;
539
+ const isEditable = (0, import_react6.useEditorState)({
540
+ editor,
541
+ selector: ({ editor: e }) => {
542
+ var _a2;
543
+ return (_a2 = e == null ? void 0 : e.isEditable) != null ? _a2 : false;
544
+ }
545
+ });
546
+ const { src, alt, title, uploadState, uploadProgress } = attrs;
547
+ const [resolvedUrl, setResolvedUrl] = (0, import_react7.useState)(null);
548
+ const [resolveState, setResolveState] = (0, import_react7.useState)("idle");
549
+ const needsResolve = (_a = fileHandler == null ? void 0 : fileHandler.isReference(src)) != null ? _a : false;
550
+ const resolveImage = (0, import_react7.useCallback)(async () => {
551
+ if (!src) return;
552
+ if (!needsResolve) {
553
+ setResolvedUrl(src);
554
+ setResolveState("resolved");
555
+ return;
556
+ }
557
+ if (!fileHandler) {
558
+ setResolveState("error");
559
+ return;
560
+ }
561
+ setResolveState("loading");
562
+ try {
563
+ const url = await fileHandler.resolve(src);
564
+ setResolvedUrl(url);
565
+ setResolveState("resolved");
566
+ } catch {
567
+ setResolveState("error");
568
+ }
569
+ }, [src, needsResolve, fileHandler]);
570
+ (0, import_react7.useEffect)(() => {
571
+ resolveImage();
572
+ }, [resolveImage]);
573
+ const handleRetry = (0, import_react7.useCallback)(() => {
574
+ resolveImage();
575
+ }, [resolveImage]);
576
+ const handleRemove = (0, import_react7.useCallback)(() => {
577
+ const pos = getPos();
578
+ if (pos === void 0) return;
579
+ editor.commands.deleteRange({
580
+ from: pos,
581
+ to: pos + node.nodeSize
582
+ });
583
+ }, [editor, getPos, node.nodeSize]);
584
+ const fileInputRef = (0, import_react7.useRef)(null);
585
+ const handleFileSelect = (0, import_react7.useCallback)(
586
+ async (file) => {
587
+ if (!fileHandler) return;
588
+ const pos = getPos();
589
+ if (pos === void 0) return;
590
+ editor.view.dispatch(
591
+ editor.state.tr.setNodeMarkup(pos, void 0, {
592
+ ...attrs,
593
+ uploadState: "uploading",
594
+ uploadProgress: 0
595
+ })
596
+ );
597
+ try {
598
+ const ref = await fileHandler.upload(file, (percent) => {
599
+ const currentPos = getPos();
600
+ if (currentPos === void 0) return;
601
+ editor.view.dispatch(
602
+ editor.state.tr.setNodeMarkup(currentPos, void 0, {
603
+ ...attrs,
604
+ uploadState: "uploading",
605
+ uploadProgress: percent
606
+ })
607
+ );
608
+ });
609
+ const finalPos = getPos();
610
+ if (finalPos === void 0) return;
611
+ editor.view.dispatch(
612
+ editor.state.tr.setNodeMarkup(finalPos, void 0, {
613
+ src: ref,
614
+ uploadState: null,
615
+ uploadProgress: null
616
+ })
617
+ );
618
+ } catch {
619
+ const errorPos = getPos();
620
+ if (errorPos === void 0) return;
621
+ editor.view.dispatch(
622
+ editor.state.tr.setNodeMarkup(errorPos, void 0, {
623
+ ...attrs,
624
+ uploadState: "error",
625
+ uploadProgress: null
626
+ })
627
+ );
628
+ }
629
+ },
630
+ [fileHandler, editor, getPos, attrs]
631
+ );
632
+ const handleInputChange = (0, import_react7.useCallback)(
633
+ (e) => {
634
+ var _a2;
635
+ const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
636
+ if (file) {
637
+ handleFileSelect(file);
638
+ }
639
+ },
640
+ [handleFileSelect]
641
+ );
642
+ const handleDrop = (0, import_react7.useCallback)(
643
+ (e) => {
644
+ e.preventDefault();
645
+ e.stopPropagation();
646
+ const file = e.dataTransfer.files[0];
647
+ if (file == null ? void 0 : file.type.startsWith("image/")) {
648
+ handleFileSelect(file);
649
+ }
650
+ },
651
+ [handleFileSelect]
652
+ );
653
+ const handleDragOver = (0, import_react7.useCallback)((e) => {
654
+ e.preventDefault();
655
+ e.stopPropagation();
656
+ }, []);
657
+ const styles = (0, import_react7.useMemo)(() => (0, import_theme2.imagePlaceholder)({ size: "md" }), []);
658
+ const errorStyles = (0, import_react7.useMemo)(
659
+ () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "error" }),
660
+ []
661
+ );
662
+ const uploadingStyles = (0, import_react7.useMemo)(
663
+ () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "uploading" }),
664
+ []
665
+ );
666
+ const disabledStyles = (0, import_react7.useMemo)(
667
+ () => (0, import_theme2.imagePlaceholder)({ size: "md", variant: "disabled" }),
668
+ []
669
+ );
670
+ const isEmpty = !src;
671
+ if (isEmpty && !uploadState) {
672
+ if (!fileHandler) {
673
+ 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: [
674
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.ImageIcon, { className: disabledStyles.icon() }),
675
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: disabledStyles.text(), children: intl.formatMessage(messages2.files_not_supported) }),
676
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
677
+ import_button2.IconButton,
678
+ {
679
+ size: "sm",
680
+ variant: "ghost",
681
+ onClick: handleRemove,
682
+ "aria-label": intl.formatMessage(messages2.remove),
683
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
684
+ }
685
+ )
686
+ ] }) }) });
687
+ }
688
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react6.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
689
+ "div",
690
+ {
691
+ className: styles.root(),
692
+ onClick: () => {
693
+ var _a2;
694
+ return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
695
+ },
696
+ onDrop: handleDrop,
697
+ onDragOver: handleDragOver,
698
+ children: [
699
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.content(), children: [
700
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.UploadIcon, { className: styles.icon() }),
701
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.text(), children: intl.formatMessage(messages2.upload_placeholder) }),
702
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.hint(), children: intl.formatMessage(messages2.upload_hint) })
703
+ ] }),
704
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
705
+ "input",
706
+ {
707
+ ref: fileInputRef,
708
+ type: "file",
709
+ accept: "image/*",
710
+ className: "hidden",
711
+ onChange: handleInputChange
712
+ }
713
+ ),
714
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
715
+ import_button2.IconButton,
716
+ {
717
+ size: "sm",
718
+ variant: "ghost",
719
+ className: styles.removeButton(),
720
+ onClick: (e) => {
721
+ e.stopPropagation();
722
+ handleRemove();
723
+ },
724
+ "aria-label": intl.formatMessage(messages2.remove),
725
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-3.5" })
726
+ }
727
+ )
728
+ ]
729
+ }
730
+ ) });
731
+ }
732
+ if (uploadState === "uploading") {
733
+ 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: [
734
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative size-12", children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
736
+ "svg",
737
+ {
738
+ className: "size-12 -rotate-90",
739
+ viewBox: "0 0 36 36",
740
+ "aria-hidden": "true",
741
+ children: [
742
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
743
+ "circle",
744
+ {
745
+ cx: "18",
746
+ cy: "18",
747
+ r: "16",
748
+ fill: "none",
749
+ className: "stroke-muted",
750
+ strokeWidth: "2"
751
+ }
752
+ ),
753
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
754
+ "circle",
755
+ {
756
+ cx: "18",
757
+ cy: "18",
758
+ r: "16",
759
+ fill: "none",
760
+ className: "stroke-primary",
761
+ strokeWidth: "2",
762
+ strokeDasharray: 100,
763
+ strokeDashoffset: 100 - (uploadProgress != null ? uploadProgress : 0),
764
+ strokeLinecap: "round"
765
+ }
766
+ )
767
+ ]
768
+ }
769
+ ),
770
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "absolute inset-0 flex items-center justify-center text-xs font-medium", children: [
771
+ uploadProgress != null ? uploadProgress : 0,
772
+ "%"
773
+ ] })
774
+ ] }),
775
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: uploadingStyles.text(), children: intl.formatMessage(messages2.uploading) })
776
+ ] }) }) });
777
+ }
778
+ if (uploadState === "error") {
779
+ 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: [
780
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.AlertCircleIcon, { className: errorStyles.icon() }),
781
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages2.upload_error) }),
782
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
783
+ import_button2.IconButton,
784
+ {
785
+ size: "sm",
786
+ variant: "ghost",
787
+ onClick: handleRemove,
788
+ "aria-label": intl.formatMessage(messages2.remove),
789
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
790
+ }
791
+ ) })
792
+ ] }) }) });
793
+ }
794
+ if (resolveState === "loading") {
795
+ 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) }) }) });
796
+ }
797
+ if (resolveState === "error") {
798
+ 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: [
799
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.AlertCircleIcon, { className: errorStyles.icon() }),
800
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages2.error) }),
801
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex gap-2", children: [
802
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
803
+ import_button2.IconButton,
804
+ {
805
+ size: "sm",
806
+ variant: "outline",
807
+ onClick: handleRetry,
808
+ "aria-label": intl.formatMessage(messages2.retry),
809
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.ArrowCounterClockwiseIcon, { className: "size-4" })
810
+ }
811
+ ),
812
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
813
+ import_button2.IconButton,
814
+ {
815
+ size: "sm",
816
+ variant: "ghost",
817
+ onClick: handleRemove,
818
+ "aria-label": intl.formatMessage(messages2.remove),
819
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-4" })
820
+ }
821
+ )
822
+ ] })
823
+ ] }) }) });
824
+ }
825
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react6.NodeViewWrapper, { className: "my-4 relative group", "data-type": "image", children: [
826
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
827
+ "img",
828
+ {
829
+ src: resolvedUrl != null ? resolvedUrl : src,
830
+ alt: alt != null ? alt : "",
831
+ title: title != null ? title : void 0,
832
+ className: "max-w-full h-auto rounded-lg",
833
+ draggable: false
834
+ }
835
+ ),
836
+ 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)(
837
+ import_button2.IconButton,
838
+ {
839
+ size: "sm",
840
+ variant: "outline",
841
+ onClick: handleRemove,
842
+ "aria-label": intl.formatMessage(messages2.remove),
843
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons3.TrashIcon, { className: "size-3.5" })
844
+ }
845
+ ) })
846
+ ] });
847
+ }
848
+
849
+ // src/extensions/image/index.ts
850
+ var ImageNode = import_core2.Node.create({
851
+ name: "image",
852
+ group: "block",
853
+ atom: true,
854
+ draggable: true,
855
+ addOptions() {
856
+ return {
857
+ allowBase64: true,
858
+ HTMLAttributes: {}
859
+ };
860
+ },
861
+ addAttributes() {
862
+ return {
863
+ src: {
864
+ default: null
865
+ },
866
+ alt: {
867
+ default: null
868
+ },
869
+ title: {
870
+ default: null
871
+ },
872
+ width: {
873
+ default: null
874
+ },
875
+ height: {
876
+ default: null
877
+ },
878
+ uploadState: {
879
+ default: null,
880
+ rendered: false
881
+ },
882
+ uploadProgress: {
883
+ default: null,
884
+ rendered: false
885
+ }
886
+ };
887
+ },
888
+ parseHTML() {
889
+ return [
890
+ {
891
+ tag: "img[src]"
892
+ }
893
+ ];
894
+ },
895
+ renderHTML({ HTMLAttributes }) {
896
+ return [
897
+ "img",
898
+ (0, import_core2.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)
899
+ ];
900
+ },
901
+ addNodeView() {
902
+ return (0, import_react8.ReactNodeViewRenderer)(ImageNodeView);
903
+ },
904
+ addCommands() {
905
+ return {
906
+ setImage: (options) => ({ commands }) => {
907
+ return commands.insertContent({
908
+ type: this.name,
909
+ attrs: options
910
+ });
911
+ }
912
+ };
913
+ }
914
+ });
915
+
389
916
  // src/extensions/math/index.ts
390
- var import_core3 = require("@tiptap/core");
391
- var import_react10 = require("@tiptap/react");
917
+ var import_core4 = require("@tiptap/core");
918
+ var import_react14 = require("@tiptap/react");
392
919
 
393
920
  // src/extensions/math/math-block-view.tsx
394
- var import_button2 = require("@kopexa/button");
921
+ var import_button3 = require("@kopexa/button");
395
922
  var import_dialog2 = require("@kopexa/dialog");
396
- var import_icons3 = require("@kopexa/icons");
923
+ var import_icons4 = require("@kopexa/icons");
397
924
  var import_label2 = require("@kopexa/label");
398
- var import_react5 = require("@tiptap/react");
925
+ var import_react9 = require("@tiptap/react");
399
926
  var import_katex = __toESM(require("katex"));
400
927
  var import_katex_min = require("katex/dist/katex.min.css");
401
- var import_react6 = require("react");
402
- var import_react_intl4 = require("react-intl");
928
+ var import_react10 = require("react");
929
+ var import_react_intl6 = require("react-intl");
403
930
 
404
931
  // src/extensions/math/messages.ts
405
- var import_react_intl3 = require("react-intl");
406
- var messages2 = (0, import_react_intl3.defineMessages)({
932
+ var import_react_intl5 = require("react-intl");
933
+ var messages3 = (0, import_react_intl5.defineMessages)({
407
934
  title: {
408
935
  id: "editor.math.title",
409
936
  defaultMessage: "Formula",
@@ -452,21 +979,28 @@ var messages2 = (0, import_react_intl3.defineMessages)({
452
979
  });
453
980
 
454
981
  // src/extensions/math/math-block-view.tsx
455
- var import_jsx_runtime3 = require("react/jsx-runtime");
982
+ var import_jsx_runtime5 = require("react/jsx-runtime");
456
983
  function MathBlockView({ editor, node, getPos }) {
457
- const intl = (0, import_react_intl4.useIntl)();
984
+ const intl = (0, import_react_intl6.useIntl)();
458
985
  const attrs = node.attrs;
459
986
  const { latex = "" } = attrs;
460
- const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
461
- const [localLatex, setLocalLatex] = (0, import_react6.useState)(latex);
462
- const [error, setError] = (0, import_react6.useState)(null);
463
- (0, import_react6.useEffect)(() => {
987
+ const isEditable = (0, import_react9.useEditorState)({
988
+ editor,
989
+ selector: ({ editor: e }) => {
990
+ var _a;
991
+ return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
992
+ }
993
+ });
994
+ const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
995
+ const [localLatex, setLocalLatex] = (0, import_react10.useState)(latex);
996
+ const [error, setError] = (0, import_react10.useState)(null);
997
+ (0, import_react10.useEffect)(() => {
464
998
  if (isOpen) {
465
999
  setLocalLatex(latex);
466
1000
  setError(null);
467
1001
  }
468
1002
  }, [isOpen, latex]);
469
- const renderedHtml = (0, import_react6.useMemo)(() => {
1003
+ const renderedHtml = (0, import_react10.useMemo)(() => {
470
1004
  if (!latex) return null;
471
1005
  try {
472
1006
  return import_katex.default.renderToString(latex, {
@@ -478,7 +1012,7 @@ function MathBlockView({ editor, node, getPos }) {
478
1012
  return null;
479
1013
  }
480
1014
  }, [latex]);
481
- const previewHtml = (0, import_react6.useMemo)(() => {
1015
+ const previewHtml = (0, import_react10.useMemo)(() => {
482
1016
  if (!localLatex) return null;
483
1017
  try {
484
1018
  setError(null);
@@ -488,11 +1022,11 @@ function MathBlockView({ editor, node, getPos }) {
488
1022
  output: "html"
489
1023
  });
490
1024
  } catch (_e) {
491
- setError(intl.formatMessage(messages2.invalid_latex));
1025
+ setError(intl.formatMessage(messages3.invalid_latex));
492
1026
  return null;
493
1027
  }
494
1028
  }, [localLatex, intl]);
495
- const handleSave = (0, import_react6.useCallback)(() => {
1029
+ const handleSave = (0, import_react10.useCallback)(() => {
496
1030
  const pos = getPos();
497
1031
  if (pos === void 0) return;
498
1032
  editor.view.dispatch(
@@ -500,89 +1034,89 @@ function MathBlockView({ editor, node, getPos }) {
500
1034
  );
501
1035
  setIsOpen(false);
502
1036
  }, [editor, localLatex, getPos]);
503
- const handleCancel = (0, import_react6.useCallback)(() => {
1037
+ const handleCancel = (0, import_react10.useCallback)(() => {
504
1038
  setLocalLatex(latex);
505
1039
  setError(null);
506
1040
  setIsOpen(false);
507
1041
  }, [latex]);
508
- const handleOpenEditor = (0, import_react6.useCallback)(
1042
+ const handleOpenEditor = (0, import_react10.useCallback)(
509
1043
  (e) => {
510
1044
  e.stopPropagation();
511
1045
  e.preventDefault();
512
- if (editor.isEditable) {
1046
+ if (isEditable) {
513
1047
  setIsOpen(true);
514
1048
  }
515
1049
  },
516
- [editor.isEditable]
1050
+ [isEditable]
517
1051
  );
518
1052
  const isEmpty = !latex;
519
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
520
- import_react5.NodeViewWrapper,
1053
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1054
+ import_react9.NodeViewWrapper,
521
1055
  {
522
1056
  className: "my-4 relative group",
523
1057
  "data-type": "math-block",
524
1058
  "data-latex": latex,
525
1059
  children: [
526
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1060
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
527
1061
  "button",
528
1062
  {
529
1063
  type: "button",
530
1064
  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",
531
1065
  onClick: handleOpenEditor,
532
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
533
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-lg font-serif", children: "\u2211" }),
534
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-sm", children: intl.formatMessage(messages2.empty_formula) })
535
- ] }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1066
+ children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
1067
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-lg font-serif", children: "\u2211" }),
1068
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm", children: intl.formatMessage(messages3.empty_formula) })
1069
+ ] }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
536
1070
  "div",
537
1071
  {
538
1072
  className: "katex-display",
539
1073
  dangerouslySetInnerHTML: { __html: renderedHtml }
540
1074
  }
541
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages2.invalid_latex) })
1075
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-destructive text-sm", children: intl.formatMessage(messages3.invalid_latex) })
542
1076
  }
543
1077
  ),
544
- editor.isEditable && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
545
- import_button2.IconButton,
1078
+ isEditable && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1079
+ import_button3.IconButton,
546
1080
  {
547
1081
  size: "sm",
548
1082
  variant: "ghost",
549
1083
  className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
550
- "aria-label": intl.formatMessage(messages2.edit),
1084
+ "aria-label": intl.formatMessage(messages3.edit),
551
1085
  onClick: handleOpenEditor,
552
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons3.EditIcon, { className: "size-3.5" })
1086
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.EditIcon, { className: "size-3.5" })
553
1087
  }
554
1088
  ),
555
- /* @__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: [
556
- /* @__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) }) }),
557
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dialog2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-4", children: [
558
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-1.5", children: [
559
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages2.latex_input) }),
560
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1089
+ /* @__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: [
1090
+ /* @__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) }) }),
1091
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4", children: [
1092
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1093
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages3.latex_input) }),
1094
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
561
1095
  "textarea",
562
1096
  {
563
1097
  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",
564
1098
  value: localLatex,
565
1099
  onChange: (e) => setLocalLatex(e.target.value),
566
- placeholder: intl.formatMessage(messages2.latex_placeholder),
1100
+ placeholder: intl.formatMessage(messages3.latex_placeholder),
567
1101
  spellCheck: false
568
1102
  }
569
1103
  ),
570
- error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-xs text-destructive", children: error })
1104
+ error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-destructive", children: error })
571
1105
  ] }),
572
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "space-y-1.5", children: [
573
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages2.preview) }),
574
- /* @__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)(
1106
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1107
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label2.Label, { className: "text-sm", children: intl.formatMessage(messages3.preview) }),
1108
+ /* @__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)(
575
1109
  "div",
576
1110
  {
577
1111
  className: "katex-display",
578
1112
  dangerouslySetInnerHTML: { __html: previewHtml }
579
1113
  }
580
- ) : 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) }) })
1114
+ ) : 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) }) })
581
1115
  ] })
582
1116
  ] }) }),
583
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_dialog2.Dialog.Footer, { children: [
584
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_button2.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages2.cancel) }),
585
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_button2.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages2.save) })
1117
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog2.Dialog.Footer, { children: [
1118
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button3.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1119
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button3.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages3.save) })
586
1120
  ] })
587
1121
  ] }) })
588
1122
  ]
@@ -591,33 +1125,40 @@ function MathBlockView({ editor, node, getPos }) {
591
1125
  }
592
1126
 
593
1127
  // src/extensions/math/inline-math.ts
594
- var import_core2 = require("@tiptap/core");
595
- var import_react9 = require("@tiptap/react");
1128
+ var import_core3 = require("@tiptap/core");
1129
+ var import_react13 = require("@tiptap/react");
596
1130
 
597
1131
  // src/extensions/math/inline-math-view.tsx
598
- var import_button3 = require("@kopexa/button");
1132
+ var import_button4 = require("@kopexa/button");
599
1133
  var import_dialog3 = require("@kopexa/dialog");
600
1134
  var import_label3 = require("@kopexa/label");
601
- var import_react7 = require("@tiptap/react");
1135
+ var import_react11 = require("@tiptap/react");
602
1136
  var import_katex2 = __toESM(require("katex"));
603
1137
  var import_katex_min2 = require("katex/dist/katex.min.css");
604
- var import_react8 = require("react");
605
- var import_react_intl5 = require("react-intl");
606
- var import_jsx_runtime4 = require("react/jsx-runtime");
1138
+ var import_react12 = require("react");
1139
+ var import_react_intl7 = require("react-intl");
1140
+ var import_jsx_runtime6 = require("react/jsx-runtime");
607
1141
  function InlineMathView({ editor, node, getPos }) {
608
- const intl = (0, import_react_intl5.useIntl)();
1142
+ const intl = (0, import_react_intl7.useIntl)();
609
1143
  const attrs = node.attrs;
610
1144
  const { latex = "" } = attrs;
611
- const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
612
- const [localLatex, setLocalLatex] = (0, import_react8.useState)(latex);
613
- const [error, setError] = (0, import_react8.useState)(null);
614
- (0, import_react8.useEffect)(() => {
1145
+ const isEditable = (0, import_react11.useEditorState)({
1146
+ editor,
1147
+ selector: ({ editor: e }) => {
1148
+ var _a;
1149
+ return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
1150
+ }
1151
+ });
1152
+ const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
1153
+ const [localLatex, setLocalLatex] = (0, import_react12.useState)(latex);
1154
+ const [error, setError] = (0, import_react12.useState)(null);
1155
+ (0, import_react12.useEffect)(() => {
615
1156
  if (isOpen) {
616
1157
  setLocalLatex(latex);
617
1158
  setError(null);
618
1159
  }
619
1160
  }, [isOpen, latex]);
620
- const renderedHtml = (0, import_react8.useMemo)(() => {
1161
+ const renderedHtml = (0, import_react12.useMemo)(() => {
621
1162
  if (!latex) return null;
622
1163
  try {
623
1164
  return import_katex2.default.renderToString(latex, {
@@ -629,7 +1170,7 @@ function InlineMathView({ editor, node, getPos }) {
629
1170
  return null;
630
1171
  }
631
1172
  }, [latex]);
632
- const previewHtml = (0, import_react8.useMemo)(() => {
1173
+ const previewHtml = (0, import_react12.useMemo)(() => {
633
1174
  if (!localLatex) return null;
634
1175
  try {
635
1176
  setError(null);
@@ -639,11 +1180,11 @@ function InlineMathView({ editor, node, getPos }) {
639
1180
  output: "html"
640
1181
  });
641
1182
  } catch (_e) {
642
- setError(intl.formatMessage(messages2.invalid_latex));
1183
+ setError(intl.formatMessage(messages3.invalid_latex));
643
1184
  return null;
644
1185
  }
645
1186
  }, [localLatex, intl]);
646
- const handleSave = (0, import_react8.useCallback)(() => {
1187
+ const handleSave = (0, import_react12.useCallback)(() => {
647
1188
  const pos = getPos();
648
1189
  if (pos === void 0) return;
649
1190
  editor.view.dispatch(
@@ -651,74 +1192,74 @@ function InlineMathView({ editor, node, getPos }) {
651
1192
  );
652
1193
  setIsOpen(false);
653
1194
  }, [editor, localLatex, getPos]);
654
- const handleCancel = (0, import_react8.useCallback)(() => {
1195
+ const handleCancel = (0, import_react12.useCallback)(() => {
655
1196
  setLocalLatex(latex);
656
1197
  setError(null);
657
1198
  setIsOpen(false);
658
1199
  }, [latex]);
659
- const handleClick = (0, import_react8.useCallback)(
1200
+ const handleClick = (0, import_react12.useCallback)(
660
1201
  (e) => {
661
1202
  e.stopPropagation();
662
1203
  e.preventDefault();
663
- if (editor.isEditable) {
1204
+ if (isEditable) {
664
1205
  setIsOpen(true);
665
1206
  }
666
1207
  },
667
- [editor.isEditable]
1208
+ [isEditable]
668
1209
  );
669
1210
  const isEmpty = !latex;
670
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
671
- import_react7.NodeViewWrapper,
1211
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1212
+ import_react11.NodeViewWrapper,
672
1213
  {
673
1214
  as: "span",
674
1215
  className: "inline-math-wrapper",
675
1216
  "data-type": "inline-math",
676
1217
  "data-latex": latex,
677
1218
  children: [
678
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1219
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
679
1220
  "span",
680
1221
  {
681
- 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" : ""}`,
1222
+ 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" : ""}`,
682
1223
  onClick: handleClick,
683
- children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-xs", children: "$?$" }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1224
+ children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs", children: "$?$" }) : renderedHtml ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
684
1225
  "span",
685
1226
  {
686
1227
  dangerouslySetInnerHTML: { __html: renderedHtml }
687
1228
  }
688
- ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-destructive text-xs", children: latex })
1229
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-destructive text-xs", children: latex })
689
1230
  }
690
1231
  ),
691
- /* @__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: [
692
- /* @__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) }) }),
693
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dialog3.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "space-y-4", children: [
694
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "space-y-1.5", children: [
695
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages2.latex_input) }),
696
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1232
+ /* @__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: [
1233
+ /* @__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) }) }),
1234
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dialog3.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-4", children: [
1235
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1236
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages3.latex_input) }),
1237
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
697
1238
  "input",
698
1239
  {
699
1240
  type: "text",
700
1241
  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",
701
1242
  value: localLatex,
702
1243
  onChange: (e) => setLocalLatex(e.target.value),
703
- placeholder: intl.formatMessage(messages2.latex_placeholder),
1244
+ placeholder: intl.formatMessage(messages3.latex_placeholder),
704
1245
  spellCheck: false
705
1246
  }
706
1247
  ),
707
- error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-xs text-destructive", children: error })
1248
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-destructive", children: error })
708
1249
  ] }),
709
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "space-y-1.5", children: [
710
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages2.preview) }),
711
- /* @__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)(
1250
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1.5", children: [
1251
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_label3.Label, { className: "text-sm", children: intl.formatMessage(messages3.preview) }),
1252
+ /* @__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)(
712
1253
  "span",
713
1254
  {
714
1255
  dangerouslySetInnerHTML: { __html: previewHtml }
715
1256
  }
716
- ) : 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: "$...$" }) })
1257
+ ) : 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: "$...$" }) })
717
1258
  ] })
718
1259
  ] }) }),
719
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_dialog3.Dialog.Footer, { children: [
720
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_button3.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages2.cancel) }),
721
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_button3.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages2.save) })
1260
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_dialog3.Dialog.Footer, { children: [
1261
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1262
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button4.Button, { onClick: handleSave, disabled: !!error && !!localLatex, children: intl.formatMessage(messages3.save) })
722
1263
  ] })
723
1264
  ] }) })
724
1265
  ]
@@ -727,7 +1268,7 @@ function InlineMathView({ editor, node, getPos }) {
727
1268
  }
728
1269
 
729
1270
  // src/extensions/math/inline-math.ts
730
- var InlineMath = import_core2.Node.create({
1271
+ var InlineMath = import_core3.Node.create({
731
1272
  name: "inlineMath",
732
1273
  group: "inline",
733
1274
  inline: true,
@@ -758,13 +1299,13 @@ var InlineMath = import_core2.Node.create({
758
1299
  renderHTML({ HTMLAttributes }) {
759
1300
  return [
760
1301
  "span",
761
- (0, import_core2.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1302
+ (0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
762
1303
  "data-type": "inline-math"
763
1304
  })
764
1305
  ];
765
1306
  },
766
1307
  addNodeView() {
767
- return (0, import_react9.ReactNodeViewRenderer)(InlineMathView, {
1308
+ return (0, import_react13.ReactNodeViewRenderer)(InlineMathView, {
768
1309
  as: "span"
769
1310
  });
770
1311
  },
@@ -781,7 +1322,7 @@ var InlineMath = import_core2.Node.create({
781
1322
  addInputRules() {
782
1323
  return [
783
1324
  // Inline math with $...$
784
- new import_core2.InputRule({
1325
+ new import_core3.InputRule({
785
1326
  // Match $...$ but not $$...$$
786
1327
  find: /(?<!\$)\$([^$]+)\$(?!\$)/,
787
1328
  handler: ({ state, range, match }) => {
@@ -795,7 +1336,7 @@ var InlineMath = import_core2.Node.create({
795
1336
  });
796
1337
 
797
1338
  // src/extensions/math/index.ts
798
- var MathBlock = import_core3.Node.create({
1339
+ var MathBlock = import_core4.Node.create({
799
1340
  name: "mathBlock",
800
1341
  group: "block",
801
1342
  atom: true,
@@ -826,13 +1367,13 @@ var MathBlock = import_core3.Node.create({
826
1367
  renderHTML({ HTMLAttributes }) {
827
1368
  return [
828
1369
  "div",
829
- (0, import_core3.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1370
+ (0, import_core4.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
830
1371
  "data-type": "math-block"
831
1372
  })
832
1373
  ];
833
1374
  },
834
1375
  addNodeView() {
835
- return (0, import_react10.ReactNodeViewRenderer)(MathBlockView);
1376
+ return (0, import_react14.ReactNodeViewRenderer)(MathBlockView);
836
1377
  },
837
1378
  addCommands() {
838
1379
  return {
@@ -861,7 +1402,7 @@ var MathBlock = import_core3.Node.create({
861
1402
  addInputRules() {
862
1403
  return [
863
1404
  // Block math with $$...$$
864
- new import_core3.InputRule({
1405
+ new import_core4.InputRule({
865
1406
  find: /^\$\$(.+)\$\$$/,
866
1407
  handler: ({ state, range, match }) => {
867
1408
  const latex = match[1];
@@ -874,19 +1415,19 @@ var MathBlock = import_core3.Node.create({
874
1415
  });
875
1416
 
876
1417
  // src/extensions/toc/index.ts
877
- var import_core4 = require("@tiptap/core");
878
- var import_react14 = require("@tiptap/react");
1418
+ var import_core5 = require("@tiptap/core");
1419
+ var import_react18 = require("@tiptap/react");
879
1420
 
880
1421
  // src/extensions/toc/toc-view.tsx
881
- var import_icons5 = require("@kopexa/icons");
882
- var import_theme2 = require("@kopexa/theme");
883
- var import_react12 = require("@tiptap/react");
884
- var import_react13 = require("react");
885
- var import_react_intl8 = require("react-intl");
1422
+ var import_icons6 = require("@kopexa/icons");
1423
+ var import_theme3 = require("@kopexa/theme");
1424
+ var import_react16 = require("@tiptap/react");
1425
+ var import_react17 = require("react");
1426
+ var import_react_intl10 = require("react-intl");
886
1427
 
887
1428
  // src/extensions/toc/messages.ts
888
- var import_react_intl6 = require("react-intl");
889
- var messages3 = (0, import_react_intl6.defineMessages)({
1429
+ var import_react_intl8 = require("react-intl");
1430
+ var messages4 = (0, import_react_intl8.defineMessages)({
890
1431
  title: {
891
1432
  id: "editor.toc.title",
892
1433
  defaultMessage: "Table of Contents",
@@ -960,15 +1501,15 @@ var messages3 = (0, import_react_intl6.defineMessages)({
960
1501
  });
961
1502
 
962
1503
  // src/extensions/toc/toc-settings.tsx
963
- var import_button4 = require("@kopexa/button");
1504
+ var import_button5 = require("@kopexa/button");
964
1505
  var import_dialog4 = require("@kopexa/dialog");
965
- var import_icons4 = require("@kopexa/icons");
1506
+ var import_icons5 = require("@kopexa/icons");
966
1507
  var import_label4 = require("@kopexa/label");
967
1508
  var import_select2 = require("@kopexa/select");
968
1509
  var import_switch = require("@kopexa/switch");
969
- var import_react11 = require("react");
970
- var import_react_intl7 = require("react-intl");
971
- var import_jsx_runtime5 = require("react/jsx-runtime");
1510
+ var import_react15 = require("react");
1511
+ var import_react_intl9 = require("react-intl");
1512
+ var import_jsx_runtime7 = require("react/jsx-runtime");
972
1513
  var HEADING_LEVELS = [
973
1514
  { value: "1", label: "H1" },
974
1515
  { value: "2", label: "H2" },
@@ -978,15 +1519,15 @@ var HEADING_LEVELS = [
978
1519
  { value: "6", label: "H6" }
979
1520
  ];
980
1521
  function TocSettings({ editor, attrs, getPos }) {
981
- const intl = (0, import_react_intl7.useIntl)();
982
- const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
983
- const [localAttrs, setLocalAttrs] = (0, import_react11.useState)(attrs);
984
- (0, import_react11.useEffect)(() => {
1522
+ const intl = (0, import_react_intl9.useIntl)();
1523
+ const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
1524
+ const [localAttrs, setLocalAttrs] = (0, import_react15.useState)(attrs);
1525
+ (0, import_react15.useEffect)(() => {
985
1526
  if (isOpen) {
986
1527
  setLocalAttrs(attrs);
987
1528
  }
988
1529
  }, [isOpen, attrs]);
989
- const handleSave = (0, import_react11.useCallback)(() => {
1530
+ const handleSave = (0, import_react15.useCallback)(() => {
990
1531
  const pos = getPos();
991
1532
  if (pos === void 0) return;
992
1533
  editor.view.dispatch(
@@ -994,11 +1535,11 @@ function TocSettings({ editor, attrs, getPos }) {
994
1535
  );
995
1536
  setIsOpen(false);
996
1537
  }, [editor, localAttrs, getPos]);
997
- const handleCancel = (0, import_react11.useCallback)(() => {
1538
+ const handleCancel = (0, import_react15.useCallback)(() => {
998
1539
  setLocalAttrs(attrs);
999
1540
  setIsOpen(false);
1000
1541
  }, [attrs]);
1001
- const handleMinLevelChange = (0, import_react11.useCallback)((value) => {
1542
+ const handleMinLevelChange = (0, import_react15.useCallback)((value) => {
1002
1543
  const minLevel = Number.parseInt(String(value), 10);
1003
1544
  setLocalAttrs((prev) => ({
1004
1545
  ...prev,
@@ -1007,7 +1548,7 @@ function TocSettings({ editor, attrs, getPos }) {
1007
1548
  maxLevel: Math.max(prev.maxLevel, minLevel)
1008
1549
  }));
1009
1550
  }, []);
1010
- const handleMaxLevelChange = (0, import_react11.useCallback)((value) => {
1551
+ const handleMaxLevelChange = (0, import_react15.useCallback)((value) => {
1011
1552
  const maxLevel = Number.parseInt(String(value), 10);
1012
1553
  setLocalAttrs((prev) => ({
1013
1554
  ...prev,
@@ -1016,10 +1557,10 @@ function TocSettings({ editor, attrs, getPos }) {
1016
1557
  minLevel: Math.min(prev.minLevel, maxLevel)
1017
1558
  }));
1018
1559
  }, []);
1019
- const handleNumberedChange = (0, import_react11.useCallback)((checked) => {
1560
+ const handleNumberedChange = (0, import_react15.useCallback)((checked) => {
1020
1561
  setLocalAttrs((prev) => ({ ...prev, numbered: checked }));
1021
1562
  }, []);
1022
- const handleStyleChange = (0, import_react11.useCallback)((value) => {
1563
+ const handleStyleChange = (0, import_react15.useCallback)((value) => {
1023
1564
  setLocalAttrs((prev) => ({
1024
1565
  ...prev,
1025
1566
  style: String(value)
@@ -1028,36 +1569,36 @@ function TocSettings({ editor, attrs, getPos }) {
1028
1569
  if (!editor.isEditable) {
1029
1570
  return null;
1030
1571
  }
1031
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1032
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1033
- import_button4.IconButton,
1572
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1573
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1574
+ import_button5.IconButton,
1034
1575
  {
1035
1576
  size: "sm",
1036
1577
  variant: "ghost",
1037
- "aria-label": intl.formatMessage(messages3.settings),
1578
+ "aria-label": intl.formatMessage(messages4.settings),
1038
1579
  onClick: (e) => {
1039
1580
  e.stopPropagation();
1040
1581
  e.preventDefault();
1041
1582
  setIsOpen(true);
1042
1583
  },
1043
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons4.SettingsIcon, { className: "size-3.5" })
1584
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons5.SettingsIcon, { className: "size-3.5" })
1044
1585
  }
1045
1586
  ),
1046
- /* @__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: [
1047
- /* @__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) }) }),
1048
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_dialog4.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4", children: [
1049
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
1050
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1051
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.min_level) }),
1052
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1587
+ /* @__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: [
1588
+ /* @__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) }) }),
1589
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_dialog4.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
1590
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
1591
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1592
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.min_level) }),
1593
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1053
1594
  import_select2.Select,
1054
1595
  {
1055
1596
  size: "sm",
1056
1597
  value: String(localAttrs.minLevel),
1057
1598
  onValueChange: handleMinLevelChange,
1058
1599
  children: [
1059
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Value, {}) }),
1060
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1600
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1601
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1061
1602
  import_select2.Select.Item,
1062
1603
  {
1063
1604
  value: level.value,
@@ -1070,17 +1611,17 @@ function TocSettings({ editor, attrs, getPos }) {
1070
1611
  }
1071
1612
  )
1072
1613
  ] }),
1073
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1074
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.max_level) }),
1075
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1614
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1615
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.max_level) }),
1616
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1076
1617
  import_select2.Select,
1077
1618
  {
1078
1619
  size: "sm",
1079
1620
  value: String(localAttrs.maxLevel),
1080
1621
  onValueChange: handleMaxLevelChange,
1081
1622
  children: [
1082
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Value, {}) }),
1083
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1623
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1624
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Content, { children: HEADING_LEVELS.map((level) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1084
1625
  import_select2.Select.Item,
1085
1626
  {
1086
1627
  value: level.value,
@@ -1094,12 +1635,12 @@ function TocSettings({ editor, attrs, getPos }) {
1094
1635
  )
1095
1636
  ] })
1096
1637
  ] }),
1097
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1098
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-0.5", children: [
1099
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.numbered) }),
1100
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages3.numbered_hint) })
1638
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
1639
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-0.5", children: [
1640
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.numbered) }),
1641
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-xs text-muted-foreground", children: intl.formatMessage(messages4.numbered_hint) })
1101
1642
  ] }),
1102
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1643
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1103
1644
  import_switch.Switch,
1104
1645
  {
1105
1646
  size: "sm",
@@ -1108,36 +1649,36 @@ function TocSettings({ editor, attrs, getPos }) {
1108
1649
  }
1109
1650
  )
1110
1651
  ] }),
1111
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
1112
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages3.style) }),
1113
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1652
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
1653
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_label4.Label, { className: "text-sm", children: intl.formatMessage(messages4.style) }),
1654
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1114
1655
  import_select2.Select,
1115
1656
  {
1116
1657
  size: "sm",
1117
1658
  value: localAttrs.style,
1118
1659
  onValueChange: handleStyleChange,
1119
1660
  children: [
1120
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Value, {}) }),
1121
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_select2.Select.Content, { children: [
1122
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Item, { value: "default", children: intl.formatMessage(messages3.style_default) }),
1123
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Item, { value: "flat", children: intl.formatMessage(messages3.style_flat) }),
1124
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_select2.Select.Item, { value: "compact", children: intl.formatMessage(messages3.style_compact) })
1661
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Value, {}) }),
1662
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_select2.Select.Content, { children: [
1663
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "default", children: intl.formatMessage(messages4.style_default) }),
1664
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "flat", children: intl.formatMessage(messages4.style_flat) }),
1665
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_select2.Select.Item, { value: "compact", children: intl.formatMessage(messages4.style_compact) })
1125
1666
  ] })
1126
1667
  ]
1127
1668
  }
1128
1669
  )
1129
1670
  ] })
1130
1671
  ] }) }),
1131
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_dialog4.Dialog.Footer, { children: [
1132
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button4.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages3.cancel) }),
1133
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_button4.Button, { onClick: handleSave, children: intl.formatMessage(messages3.save) })
1672
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_dialog4.Dialog.Footer, { children: [
1673
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages4.cancel) }),
1674
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_button5.Button, { onClick: handleSave, children: intl.formatMessage(messages4.save) })
1134
1675
  ] })
1135
1676
  ] }) })
1136
1677
  ] });
1137
1678
  }
1138
1679
 
1139
1680
  // src/extensions/toc/toc-view.tsx
1140
- var import_jsx_runtime6 = require("react/jsx-runtime");
1681
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1141
1682
  function generateHeadingNumbers(headings, minLevel) {
1142
1683
  const counters = [0, 0, 0, 0, 0, 0];
1143
1684
  return headings.map((heading) => {
@@ -1159,8 +1700,8 @@ function generateHeadingNumbers(headings, minLevel) {
1159
1700
  });
1160
1701
  }
1161
1702
  function TocNodeView({ editor, node, getPos }) {
1162
- const [headings, setHeadings] = (0, import_react13.useState)([]);
1163
- const intl = (0, import_react_intl8.useIntl)();
1703
+ const [headings, setHeadings] = (0, import_react17.useState)([]);
1704
+ const intl = (0, import_react_intl10.useIntl)();
1164
1705
  const attrs = node.attrs;
1165
1706
  const {
1166
1707
  minLevel = 1,
@@ -1168,8 +1709,8 @@ function TocNodeView({ editor, node, getPos }) {
1168
1709
  numbered = false,
1169
1710
  style = "default"
1170
1711
  } = attrs;
1171
- const styles = (0, import_react13.useMemo)(() => (0, import_theme2.toc)({ style }), [style]);
1172
- const updateHeadings = (0, import_react13.useCallback)(() => {
1712
+ const styles = (0, import_react17.useMemo)(() => (0, import_theme3.toc)({ style }), [style]);
1713
+ const updateHeadings = (0, import_react17.useCallback)(() => {
1173
1714
  const items = [];
1174
1715
  const { doc } = editor.state;
1175
1716
  doc.descendants((docNode, pos) => {
@@ -1189,14 +1730,14 @@ function TocNodeView({ editor, node, getPos }) {
1189
1730
  const numberedHeadings = generateHeadingNumbers(items, minLevel);
1190
1731
  setHeadings(numberedHeadings);
1191
1732
  }, [editor, minLevel, maxLevel]);
1192
- (0, import_react13.useEffect)(() => {
1733
+ (0, import_react17.useEffect)(() => {
1193
1734
  updateHeadings();
1194
1735
  editor.on("update", updateHeadings);
1195
1736
  return () => {
1196
1737
  editor.off("update", updateHeadings);
1197
1738
  };
1198
1739
  }, [editor, updateHeadings]);
1199
- const handleClick = (0, import_react13.useCallback)(
1740
+ const handleClick = (0, import_react17.useCallback)(
1200
1741
  (pos, id) => {
1201
1742
  var _a;
1202
1743
  editor.chain().focus().setTextSelection(pos).run();
@@ -1217,13 +1758,13 @@ function TocNodeView({ editor, node, getPos }) {
1217
1758
  const getIndent = (level) => {
1218
1759
  return (level - minLevel) * 16;
1219
1760
  };
1220
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react12.NodeViewWrapper, { className: styles.root(), "data-type": "toc", children: [
1221
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles.header(), children: [
1222
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: styles.headerContent(), children: [
1223
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons5.ListIcon, { className: styles.headerIcon() }),
1224
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles.headerTitle(), children: intl.formatMessage(messages3.title) })
1761
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react16.NodeViewWrapper, { className: styles.root(), "data-type": "toc", children: [
1762
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: styles.header(), children: [
1763
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: styles.headerContent(), children: [
1764
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons6.ListIcon, { className: styles.headerIcon() }),
1765
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: styles.headerTitle(), children: intl.formatMessage(messages4.title) })
1225
1766
  ] }),
1226
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: styles.headerActions(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1767
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: styles.headerActions(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1227
1768
  TocSettings,
1228
1769
  {
1229
1770
  editor,
@@ -1232,7 +1773,7 @@ function TocNodeView({ editor, node, getPos }) {
1232
1773
  }
1233
1774
  ) })
1234
1775
  ] }),
1235
- 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)(
1776
+ 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)(
1236
1777
  "li",
1237
1778
  {
1238
1779
  className: styles.item(),
@@ -1240,14 +1781,14 @@ function TocNodeView({ editor, node, getPos }) {
1240
1781
  paddingLeft: `${getIndent(heading.level)}px`
1241
1782
  },
1242
1783
  children: [
1243
- numbered && heading.number && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: styles.itemNumber(), children: heading.number }),
1244
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1784
+ numbered && heading.number && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: styles.itemNumber(), children: heading.number }),
1785
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1245
1786
  "button",
1246
1787
  {
1247
1788
  type: "button",
1248
1789
  onClick: () => handleClick(heading.pos, heading.id),
1249
1790
  className: styles.itemButton(),
1250
- children: heading.text || intl.formatMessage(messages3.empty_heading)
1791
+ children: heading.text || intl.formatMessage(messages4.empty_heading)
1251
1792
  }
1252
1793
  )
1253
1794
  ]
@@ -1258,7 +1799,7 @@ function TocNodeView({ editor, node, getPos }) {
1258
1799
  }
1259
1800
 
1260
1801
  // src/extensions/toc/index.ts
1261
- var TocNode = import_core4.Node.create({
1802
+ var TocNode = import_core5.Node.create({
1262
1803
  name: "tableOfContentsNode",
1263
1804
  group: "block",
1264
1805
  atom: true,
@@ -1310,13 +1851,13 @@ var TocNode = import_core4.Node.create({
1310
1851
  renderHTML({ HTMLAttributes }) {
1311
1852
  return [
1312
1853
  "div",
1313
- (0, import_core4.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1854
+ (0, import_core5.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, {
1314
1855
  "data-type": "toc"
1315
1856
  })
1316
1857
  ];
1317
1858
  },
1318
1859
  addNodeView() {
1319
- return (0, import_react14.ReactNodeViewRenderer)(TocNodeView);
1860
+ return (0, import_react18.ReactNodeViewRenderer)(TocNodeView);
1320
1861
  },
1321
1862
  addCommands() {
1322
1863
  return {
@@ -1347,6 +1888,7 @@ var TocNode = import_core4.Node.create({
1347
1888
  var import_extension_code = require("@kopexa/extension-code");
1348
1889
  var import_extension_controlref = require("@kopexa/extension-controlref");
1349
1890
  var import_extension_table = require("@kopexa/extension-table");
1891
+ var import_extension_file_handler = require("@tiptap/extension-file-handler");
1350
1892
  var import_extension_highlight = require("@tiptap/extension-highlight");
1351
1893
  var import_extension_invisible_characters = __toESM(require("@tiptap/extension-invisible-characters"));
1352
1894
  var import_extension_list = require("@tiptap/extension-list");
@@ -1358,14 +1900,14 @@ var import_extension_text_style = require("@tiptap/extension-text-style");
1358
1900
  var import_extension_typography = require("@tiptap/extension-typography");
1359
1901
  var import_extension_unique_id = require("@tiptap/extension-unique-id");
1360
1902
  var import_extensions = require("@tiptap/extensions");
1361
- var import_react18 = require("@tiptap/react");
1903
+ var import_react22 = require("@tiptap/react");
1362
1904
  var import_starter_kit = require("@tiptap/starter-kit");
1363
- var import_react19 = require("react");
1905
+ var import_react23 = require("react");
1364
1906
 
1365
1907
  // src/extensions/link/index.ts
1366
1908
  var import_extension_link = __toESM(require("@tiptap/extension-link"));
1367
1909
  var import_state = require("@tiptap/pm/state");
1368
- var import_react15 = require("@tiptap/react");
1910
+ var import_react19 = require("@tiptap/react");
1369
1911
  var Link = import_extension_link.default.extend({
1370
1912
  inclusive: false,
1371
1913
  parseHTML() {
@@ -1393,7 +1935,7 @@ var Link = import_extension_link.default.extend({
1393
1935
  const { schema, doc, tr } = view.state;
1394
1936
  let range;
1395
1937
  if (schema.marks.link) {
1396
- range = (0, import_react15.getMarkRange)(doc.resolve(pos), schema.marks.link);
1938
+ range = (0, import_react19.getMarkRange)(doc.resolve(pos), schema.marks.link);
1397
1939
  }
1398
1940
  if (!range) {
1399
1941
  return;
@@ -1420,8 +1962,8 @@ var Link = import_extension_link.default.extend({
1420
1962
  // src/extensions/selection/index.ts
1421
1963
  var import_state2 = require("@tiptap/pm/state");
1422
1964
  var import_view = require("@tiptap/pm/view");
1423
- var import_react16 = require("@tiptap/react");
1424
- var Selection = import_react16.Extension.create({
1965
+ var import_react20 = require("@tiptap/react");
1966
+ var Selection = import_react20.Extension.create({
1425
1967
  name: "selection",
1426
1968
  addProseMirrorPlugins() {
1427
1969
  const { editor } = this;
@@ -1436,7 +1978,7 @@ var Selection = import_react16.Extension.create({
1436
1978
  if (editor.isFocused === true || !editor.isEditable) {
1437
1979
  return null;
1438
1980
  }
1439
- if ((0, import_react16.isNodeSelection)(state.selection)) {
1981
+ if ((0, import_react20.isNodeSelection)(state.selection)) {
1440
1982
  return null;
1441
1983
  }
1442
1984
  return import_view.DecorationSet.create(state.doc, [
@@ -1453,7 +1995,7 @@ var Selection = import_react16.Extension.create({
1453
1995
 
1454
1996
  // src/extensions/trailing-node/index.ts
1455
1997
  var import_state3 = require("@tiptap/pm/state");
1456
- var import_react17 = require("@tiptap/react");
1998
+ var import_react21 = require("@tiptap/react");
1457
1999
  function nodeEqualsType({
1458
2000
  types,
1459
2001
  node
@@ -1464,7 +2006,7 @@ function nodeEqualsType({
1464
2006
  }
1465
2007
  return node.type === types;
1466
2008
  }
1467
- var TrailingNode = import_react17.Extension.create({
2009
+ var TrailingNode = import_react21.Extension.create({
1468
2010
  name: "trailingNode",
1469
2011
  addOptions() {
1470
2012
  return {
@@ -1510,7 +2052,7 @@ var TrailingNode = import_react17.Extension.create({
1510
2052
  });
1511
2053
 
1512
2054
  // src/extensions/ui-state/index.ts
1513
- var import_core5 = require("@tiptap/core");
2055
+ var import_core6 = require("@tiptap/core");
1514
2056
  var defaultUiState = {
1515
2057
  aiGenerationIsSelection: false,
1516
2058
  aiGenerationIsLoading: false,
@@ -1520,7 +2062,7 @@ var defaultUiState = {
1520
2062
  lockDragHandle: false,
1521
2063
  isDragging: false
1522
2064
  };
1523
- var UiState = import_core5.Extension.create({
2065
+ var UiState = import_core6.Extension.create({
1524
2066
  name: "uiState",
1525
2067
  addStorage() {
1526
2068
  return {
@@ -1735,9 +2277,12 @@ var useCreateEditor = ({
1735
2277
  onChange,
1736
2278
  enableControls = false,
1737
2279
  controlResolver,
2280
+ fileHandler: fileHandlerProp,
1738
2281
  ...options
1739
2282
  }) => {
1740
- const editor = (0, import_react18.useEditor)({
2283
+ const fileHandlerFromContext = useEditorFile();
2284
+ const fileHandler = fileHandlerProp != null ? fileHandlerProp : fileHandlerFromContext;
2285
+ const editor = (0, import_react22.useEditor)({
1741
2286
  editorProps: {
1742
2287
  attributes: {
1743
2288
  autocomplete: "off",
@@ -1752,7 +2297,8 @@ var useCreateEditor = ({
1752
2297
  editable,
1753
2298
  placeholder,
1754
2299
  enableControls,
1755
- controlResolver
2300
+ controlResolver,
2301
+ fileHandler
1756
2302
  }),
1757
2303
  editable,
1758
2304
  onUpdate: ({ editor: editor2 }) => {
@@ -1761,7 +2307,7 @@ var useCreateEditor = ({
1761
2307
  content: safeParseContent(content),
1762
2308
  ...options
1763
2309
  });
1764
- (0, import_react19.useEffect)(() => {
2310
+ (0, import_react23.useEffect)(() => {
1765
2311
  if (editor && editor.isEditable !== editable) {
1766
2312
  editor.setEditable(editable);
1767
2313
  }
@@ -1772,7 +2318,8 @@ function getExtensions({
1772
2318
  editable,
1773
2319
  placeholder,
1774
2320
  enableControls = false,
1775
- controlResolver
2321
+ controlResolver,
2322
+ fileHandler
1776
2323
  }) {
1777
2324
  const extensions = [
1778
2325
  import_starter_kit.StarterKit.configure({
@@ -1824,6 +2371,8 @@ function getExtensions({
1824
2371
  CalloutNode,
1825
2372
  MathBlock,
1826
2373
  InlineMath,
2374
+ // Image support - always include for display
2375
+ ImageNode,
1827
2376
  import_extensions.Placeholder.configure({
1828
2377
  placeholder,
1829
2378
  emptyNodeClass: "is-empty with-slash"
@@ -1832,23 +2381,103 @@ function getExtensions({
1832
2381
  if (enableControls) {
1833
2382
  extensions.push(import_extension_controlref.ControlKit.configure({ resolver: controlResolver }));
1834
2383
  }
2384
+ if (fileHandler) {
2385
+ extensions.push(
2386
+ import_extension_file_handler.FileHandler.configure({
2387
+ allowedMimeTypes: [
2388
+ "image/jpeg",
2389
+ "image/png",
2390
+ "image/gif",
2391
+ "image/webp",
2392
+ "image/svg+xml"
2393
+ ],
2394
+ onDrop: (editor, files, pos) => {
2395
+ for (const file of files) {
2396
+ handleFileUpload(editor, file, fileHandler, pos);
2397
+ }
2398
+ },
2399
+ onPaste: (editor, files) => {
2400
+ for (const file of files) {
2401
+ handleFileUpload(editor, file, fileHandler);
2402
+ }
2403
+ }
2404
+ })
2405
+ );
2406
+ }
1835
2407
  return extensions;
1836
2408
  }
2409
+ async function handleFileUpload(editor, file, fileHandler, pos) {
2410
+ if (!editor) return;
2411
+ const tempId = `uploading-${Date.now()}-${Math.random().toString(36).slice(2)}`;
2412
+ const insertPos = pos != null ? pos : editor.state.selection.anchor;
2413
+ editor.chain().focus().insertContentAt(insertPos, {
2414
+ type: "image",
2415
+ attrs: {
2416
+ src: tempId,
2417
+ uploadState: "uploading",
2418
+ uploadProgress: 0
2419
+ }
2420
+ }).run();
2421
+ try {
2422
+ const ref = await fileHandler.upload(file, (percent) => {
2423
+ editor.state.doc.descendants((node, nodePos) => {
2424
+ if (node.type.name === "image" && node.attrs.src === tempId) {
2425
+ editor.view.dispatch(
2426
+ editor.state.tr.setNodeMarkup(nodePos, void 0, {
2427
+ ...node.attrs,
2428
+ uploadProgress: percent
2429
+ })
2430
+ );
2431
+ return false;
2432
+ }
2433
+ return true;
2434
+ });
2435
+ });
2436
+ editor.state.doc.descendants((node, nodePos) => {
2437
+ if (node.type.name === "image" && node.attrs.src === tempId) {
2438
+ editor.view.dispatch(
2439
+ editor.state.tr.setNodeMarkup(nodePos, void 0, {
2440
+ src: ref,
2441
+ uploadState: null,
2442
+ uploadProgress: null
2443
+ })
2444
+ );
2445
+ return false;
2446
+ }
2447
+ return true;
2448
+ });
2449
+ } catch (error) {
2450
+ editor.state.doc.descendants((node, nodePos) => {
2451
+ if (node.type.name === "image" && node.attrs.src === tempId) {
2452
+ editor.view.dispatch(
2453
+ editor.state.tr.setNodeMarkup(nodePos, void 0, {
2454
+ ...node.attrs,
2455
+ uploadState: "error",
2456
+ uploadProgress: null
2457
+ })
2458
+ );
2459
+ return false;
2460
+ }
2461
+ return true;
2462
+ });
2463
+ console.error("[FileHandler] Upload failed:", error);
2464
+ }
2465
+ }
1837
2466
 
1838
2467
  // src/presets/basic/index.tsx
1839
- var import_theme5 = require("@kopexa/theme");
1840
- var import_react47 = require("@tiptap/react");
1841
- var import_react48 = require("react");
2468
+ var import_theme6 = require("@kopexa/theme");
2469
+ var import_react51 = require("@tiptap/react");
2470
+ var import_react52 = require("react");
1842
2471
 
1843
2472
  // src/context/editor-context.ts
1844
2473
  var import_react_utils = require("@kopexa/react-utils");
1845
2474
  var [EditorUIProvider, useEditorUIContext] = (0, import_react_utils.createContext)();
1846
2475
 
1847
2476
  // src/hooks/use-ui-editor-state.ts
1848
- var import_react20 = require("@tiptap/react");
2477
+ var import_react24 = require("@tiptap/react");
1849
2478
  function useUiEditorState(editor) {
1850
2479
  var _a;
1851
- return (_a = (0, import_react20.useEditorState)({
2480
+ return (_a = (0, import_react24.useEditorState)({
1852
2481
  editor,
1853
2482
  selector: ({ editor: editor2 }) => {
1854
2483
  if (!editor2) return defaultUiState;
@@ -1869,23 +2498,23 @@ var import_toolbar3 = require("@kopexa/toolbar");
1869
2498
  var import_menus = require("@tiptap/react/menus");
1870
2499
 
1871
2500
  // src/ui/link-popover/link-popover.tsx
1872
- var import_button5 = require("@kopexa/button");
1873
- var import_icons7 = require("@kopexa/icons");
2501
+ var import_button6 = require("@kopexa/button");
2502
+ var import_icons8 = require("@kopexa/icons");
1874
2503
  var import_input2 = require("@kopexa/input");
1875
2504
  var import_popover = require("@kopexa/popover");
1876
2505
  var import_toolbar = require("@kopexa/toolbar");
1877
- var import_react23 = require("react");
2506
+ var import_react27 = require("react");
1878
2507
 
1879
2508
  // src/hooks/use-tiptap-editor.ts
1880
- var import_react21 = require("@tiptap/react");
1881
- var import_react22 = require("react");
2509
+ var import_react25 = require("@tiptap/react");
2510
+ var import_react26 = require("react");
1882
2511
  function useTiptapEditor(providedEditor) {
1883
- const { editor: coreEditor } = (0, import_react21.useCurrentEditor)();
1884
- const mainEditor = (0, import_react22.useMemo)(
2512
+ const { editor: coreEditor } = (0, import_react25.useCurrentEditor)();
2513
+ const mainEditor = (0, import_react26.useMemo)(
1885
2514
  () => providedEditor || coreEditor,
1886
2515
  [providedEditor, coreEditor]
1887
2516
  );
1888
- const editorState = (0, import_react21.useEditorState)({
2517
+ const editorState = (0, import_react25.useEditorState)({
1889
2518
  editor: mainEditor,
1890
2519
  selector(context) {
1891
2520
  if (!context.editor) {
@@ -1907,7 +2536,7 @@ function useTiptapEditor(providedEditor) {
1907
2536
 
1908
2537
  // src/ui/link-popover/use-link-popover.ts
1909
2538
  var import_editor_utils = require("@kopexa/editor-utils");
1910
- var import_icons6 = require("@kopexa/icons");
2539
+ var import_icons7 = require("@kopexa/icons");
1911
2540
  var React = __toESM(require("react"));
1912
2541
 
1913
2542
  // src/utils/index.ts
@@ -2126,15 +2755,15 @@ function useLinkPopover(config) {
2126
2755
  canSet,
2127
2756
  isActive,
2128
2757
  label: "Link",
2129
- Icon: import_icons6.LinkIcon,
2758
+ Icon: import_icons7.LinkIcon,
2130
2759
  ...linkHandler
2131
2760
  };
2132
2761
  }
2133
2762
 
2134
2763
  // src/ui/link-popover/link-popover.tsx
2135
- var import_jsx_runtime7 = require("react/jsx-runtime");
2764
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2136
2765
  var LinkButton = ({ className, children, ...props }) => {
2137
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2766
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2138
2767
  import_toolbar.ToolbarButton,
2139
2768
  {
2140
2769
  type: "button",
@@ -2146,7 +2775,7 @@ var LinkButton = ({ className, children, ...props }) => {
2146
2775
  title: "Link",
2147
2776
  isIconOnly: !children,
2148
2777
  ...props,
2149
- children: children || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.LinkIcon, {})
2778
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.LinkIcon, {})
2150
2779
  }
2151
2780
  );
2152
2781
  };
@@ -2159,8 +2788,8 @@ var LinkMain = ({
2159
2788
  isActive,
2160
2789
  onSave
2161
2790
  }) => {
2162
- const [isEditing, setIsEditing] = (0, import_react23.useState)(!isActive || !url);
2163
- (0, import_react23.useEffect)(() => {
2791
+ const [isEditing, setIsEditing] = (0, import_react27.useState)(!isActive || !url);
2792
+ (0, import_react27.useEffect)(() => {
2164
2793
  setIsEditing(!isActive || !url);
2165
2794
  }, [isActive, url]);
2166
2795
  const handleKeyDown = (event) => {
@@ -2183,8 +2812,8 @@ var LinkMain = ({
2183
2812
  setIsEditing(true);
2184
2813
  };
2185
2814
  if (isEditing) {
2186
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2187
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2815
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2816
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2188
2817
  import_input2.Input,
2189
2818
  {
2190
2819
  type: "url",
@@ -2199,8 +2828,8 @@ var LinkMain = ({
2199
2828
  autoFocus: true
2200
2829
  }
2201
2830
  ),
2202
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2203
- import_button5.IconButton,
2831
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2832
+ import_button6.IconButton,
2204
2833
  {
2205
2834
  type: "button",
2206
2835
  size: "sm",
@@ -2208,13 +2837,13 @@ var LinkMain = ({
2208
2837
  onClick: handleSave,
2209
2838
  "aria-label": "Save link",
2210
2839
  disabled: !url,
2211
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.CheckIcon, { className: "size-4" })
2840
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.CheckIcon, { className: "size-4" })
2212
2841
  }
2213
2842
  )
2214
2843
  ] });
2215
2844
  }
2216
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2217
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2845
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1 min-w-[280px]", children: [
2846
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2218
2847
  "a",
2219
2848
  {
2220
2849
  href: url,
@@ -2228,38 +2857,38 @@ var LinkMain = ({
2228
2857
  children: url
2229
2858
  }
2230
2859
  ),
2231
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
2232
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2233
- import_button5.IconButton,
2860
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
2861
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2862
+ import_button6.IconButton,
2234
2863
  {
2235
2864
  type: "button",
2236
2865
  size: "sm",
2237
2866
  variant: "ghost",
2238
2867
  onClick: openLink,
2239
2868
  "aria-label": "Open link in new tab",
2240
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.ExternalLinkIcon, { className: "size-4" })
2869
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.ExternalLinkIcon, { className: "size-4" })
2241
2870
  }
2242
2871
  ),
2243
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2244
- import_button5.IconButton,
2872
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2873
+ import_button6.IconButton,
2245
2874
  {
2246
2875
  type: "button",
2247
2876
  size: "sm",
2248
2877
  variant: "ghost",
2249
2878
  onClick: handleEdit,
2250
2879
  "aria-label": "Edit link",
2251
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.EditIcon, { className: "size-4" })
2880
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.EditIcon, { className: "size-4" })
2252
2881
  }
2253
2882
  ),
2254
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2255
- import_button5.IconButton,
2883
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2884
+ import_button6.IconButton,
2256
2885
  {
2257
2886
  type: "button",
2258
2887
  size: "sm",
2259
2888
  variant: "ghost",
2260
2889
  onClick: removeLink,
2261
2890
  "aria-label": "Remove link",
2262
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_icons7.TrashIcon, { className: "size-4" })
2891
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_icons8.TrashIcon, { className: "size-4" })
2263
2892
  }
2264
2893
  )
2265
2894
  ] })
@@ -2276,7 +2905,7 @@ function LinkPopover({
2276
2905
  ...buttonProps
2277
2906
  }) {
2278
2907
  const { editor } = useTiptapEditor(providedEditor);
2279
- const [isOpen, setIsOpen] = (0, import_react23.useState)(false);
2908
+ const [isOpen, setIsOpen] = (0, import_react27.useState)(false);
2280
2909
  const {
2281
2910
  isVisible,
2282
2911
  canSet,
@@ -2292,18 +2921,18 @@ function LinkPopover({
2292
2921
  hideWhenUnavailable,
2293
2922
  onSetLink
2294
2923
  });
2295
- const handleOnOpenChange = (0, import_react23.useCallback)(
2924
+ const handleOnOpenChange = (0, import_react27.useCallback)(
2296
2925
  (nextIsOpen) => {
2297
2926
  setIsOpen(nextIsOpen);
2298
2927
  onOpenChange == null ? void 0 : onOpenChange(nextIsOpen);
2299
2928
  },
2300
2929
  [onOpenChange]
2301
2930
  );
2302
- const handleSetLink = (0, import_react23.useCallback)(() => {
2931
+ const handleSetLink = (0, import_react27.useCallback)(() => {
2303
2932
  setLink();
2304
2933
  setIsOpen(false);
2305
2934
  }, [setLink]);
2306
- const handleClick = (0, import_react23.useCallback)(
2935
+ const handleClick = (0, import_react27.useCallback)(
2307
2936
  (event) => {
2308
2937
  onClick == null ? void 0 : onClick(event);
2309
2938
  if (event.defaultPrevented) return;
@@ -2311,7 +2940,7 @@ function LinkPopover({
2311
2940
  },
2312
2941
  [onClick, isOpen]
2313
2942
  );
2314
- (0, import_react23.useEffect)(() => {
2943
+ (0, import_react27.useEffect)(() => {
2315
2944
  if (autoOpenOnLinkActive && isActive) {
2316
2945
  setIsOpen(true);
2317
2946
  }
@@ -2319,17 +2948,17 @@ function LinkPopover({
2319
2948
  if (!isVisible) {
2320
2949
  return null;
2321
2950
  }
2322
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2951
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2323
2952
  import_popover.Popover.Root,
2324
2953
  {
2325
2954
  open: isOpen,
2326
2955
  onOpenChange: handleOnOpenChange,
2327
2956
  spacing: "dense",
2328
2957
  children: [
2329
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2958
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2330
2959
  import_popover.Popover.Trigger,
2331
2960
  {
2332
- render: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2961
+ render: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2333
2962
  LinkButton,
2334
2963
  {
2335
2964
  "data-disabled": !canSet,
@@ -2343,7 +2972,7 @@ function LinkPopover({
2343
2972
  )
2344
2973
  }
2345
2974
  ),
2346
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2975
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2347
2976
  LinkMain,
2348
2977
  {
2349
2978
  url,
@@ -2363,19 +2992,19 @@ LinkButton.displayName = "LinkButton";
2363
2992
 
2364
2993
  // src/ui/mark-button/index.tsx
2365
2994
  var import_editor_utils2 = require("@kopexa/editor-utils");
2366
- var import_icons8 = require("@kopexa/icons");
2995
+ var import_icons9 = require("@kopexa/icons");
2367
2996
  var import_toolbar2 = require("@kopexa/toolbar");
2368
- var import_react24 = require("@tiptap/react");
2369
- var import_react25 = require("react");
2370
- var import_jsx_runtime8 = require("react/jsx-runtime");
2997
+ var import_react28 = require("@tiptap/react");
2998
+ var import_react29 = require("react");
2999
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2371
3000
  var markIcons = {
2372
- bold: import_icons8.BoldIcon,
2373
- italic: import_icons8.ItalicIcon,
2374
- underline: import_icons8.UnderlineIcon,
2375
- strike: import_icons8.StrikeIcon,
2376
- code: import_icons8.CodeIcon,
2377
- superscript: import_icons8.SuperscriptIcon,
2378
- subscript: import_icons8.SubscriptIcon
3001
+ bold: import_icons9.BoldIcon,
3002
+ italic: import_icons9.ItalicIcon,
3003
+ underline: import_icons9.UnderlineIcon,
3004
+ strike: import_icons9.StrikeIcon,
3005
+ code: import_icons9.CodeIcon,
3006
+ superscript: import_icons9.SuperscriptIcon,
3007
+ subscript: import_icons9.SubscriptIcon
2379
3008
  };
2380
3009
  var markShortcutKeys = {
2381
3010
  bold: "mod+b",
@@ -2413,7 +3042,7 @@ function shouldShowMarkButton(params) {
2413
3042
  return false;
2414
3043
  }
2415
3044
  if (hideWhenUnavailable) {
2416
- if ((0, import_react24.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
3045
+ if ((0, import_react28.isNodeSelection)(editor.state.selection) || !canToggleMark(editor, type)) {
2417
3046
  return false;
2418
3047
  }
2419
3048
  }
@@ -2458,7 +3087,7 @@ var MarkButton = ({
2458
3087
  shortcutKey,
2459
3088
  formattedName
2460
3089
  } = useMarkState(editor, type, disabled);
2461
- const handleClick = (0, import_react25.useCallback)(
3090
+ const handleClick = (0, import_react29.useCallback)(
2462
3091
  (e) => {
2463
3092
  onClick == null ? void 0 : onClick(e);
2464
3093
  if (!e.defaultPrevented && !isDisabled && editor) {
@@ -2467,7 +3096,7 @@ var MarkButton = ({
2467
3096
  },
2468
3097
  [onClick, isDisabled, editor, type]
2469
3098
  );
2470
- const show = (0, import_react25.useMemo)(() => {
3099
+ const show = (0, import_react29.useMemo)(() => {
2471
3100
  return shouldShowMarkButton({
2472
3101
  editor,
2473
3102
  type,
@@ -2478,7 +3107,7 @@ var MarkButton = ({
2478
3107
  if (!show || !editor || !editor.isEditable) {
2479
3108
  return null;
2480
3109
  }
2481
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3110
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2482
3111
  import_toolbar2.ToolbarButton,
2483
3112
  {
2484
3113
  type: "button",
@@ -2496,18 +3125,18 @@ var MarkButton = ({
2496
3125
  onClick: handleClick,
2497
3126
  isIconOnly: true,
2498
3127
  ...buttonProps,
2499
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, {})
3128
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, {})
2500
3129
  }
2501
3130
  );
2502
3131
  };
2503
3132
 
2504
3133
  // src/ui/bubble-menu/index.tsx
2505
- var import_jsx_runtime9 = require("react/jsx-runtime");
3134
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2506
3135
  function BubbleMenu({ editor }) {
2507
3136
  if (!editor) {
2508
3137
  return null;
2509
3138
  }
2510
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
3139
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2511
3140
  import_menus.BubbleMenu,
2512
3141
  {
2513
3142
  editor,
@@ -2525,15 +3154,15 @@ function BubbleMenu({ editor }) {
2525
3154
  offset: 8
2526
3155
  },
2527
3156
  className: "rounded-lg border bg-background shadow-md",
2528
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
2529
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_toolbar3.ToolbarGroup, { children: [
2530
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "bold" }),
2531
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "italic" }),
2532
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "strike" }),
2533
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkButton, { type: "code" })
3157
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_toolbar3.Toolbar, { radius: "md", border: "none", className: "p-1", children: [
3158
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_toolbar3.ToolbarGroup, { children: [
3159
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "bold" }),
3160
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "italic" }),
3161
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "strike" }),
3162
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MarkButton, { type: "code" })
2534
3163
  ] }),
2535
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_toolbar3.ToolbarSeparator, {}),
2536
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
3164
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toolbar3.ToolbarSeparator, {}),
3165
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toolbar3.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LinkPopover, { autoOpenOnLinkActive: false }) })
2537
3166
  ] })
2538
3167
  }
2539
3168
  );
@@ -2545,7 +3174,7 @@ var React3 = __toESM(require("react"));
2545
3174
 
2546
3175
  // src/hooks/use-floating-toolbar-visibility.ts
2547
3176
  var import_state4 = require("@tiptap/pm/state");
2548
- var import_react26 = require("@tiptap/react");
3177
+ var import_react30 = require("@tiptap/react");
2549
3178
  var React2 = __toESM(require("react"));
2550
3179
  var HIDE_FLOATING_META = "hideFloatingToolbar";
2551
3180
  var selectNodeAndHideFloating = (editor, pos) => {
@@ -2643,41 +3272,41 @@ function useScrollToHash(config = {}) {
2643
3272
  }
2644
3273
 
2645
3274
  // src/ui/link-bubble/index.tsx
2646
- var import_button6 = require("@kopexa/button");
2647
- var import_icons9 = require("@kopexa/icons");
3275
+ var import_button7 = require("@kopexa/button");
3276
+ var import_icons10 = require("@kopexa/icons");
2648
3277
  var import_input3 = require("@kopexa/input");
2649
3278
  var import_menus2 = require("@tiptap/react/menus");
2650
- var import_react27 = require("react");
2651
- var import_jsx_runtime10 = require("react/jsx-runtime");
3279
+ var import_react31 = require("react");
3280
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2652
3281
  function LinkBubble({ editor }) {
2653
- const [isEditing, setIsEditing] = (0, import_react27.useState)(false);
2654
- const [url, setUrl] = (0, import_react27.useState)("");
2655
- const getCurrentUrl = (0, import_react27.useCallback)(() => {
3282
+ const [isEditing, setIsEditing] = (0, import_react31.useState)(false);
3283
+ const [url, setUrl] = (0, import_react31.useState)("");
3284
+ const getCurrentUrl = (0, import_react31.useCallback)(() => {
2656
3285
  if (!editor) return "";
2657
3286
  const attrs = editor.getAttributes("link");
2658
3287
  return attrs.href || "";
2659
3288
  }, [editor]);
2660
- (0, import_react27.useEffect)(() => {
3289
+ (0, import_react31.useEffect)(() => {
2661
3290
  const isLinkActive2 = editor == null ? void 0 : editor.isActive("link");
2662
3291
  if (isLinkActive2) {
2663
3292
  setUrl(getCurrentUrl());
2664
3293
  setIsEditing(false);
2665
3294
  }
2666
3295
  }, [editor, getCurrentUrl]);
2667
- const handleOpenLink = (0, import_react27.useCallback)(() => {
3296
+ const handleOpenLink = (0, import_react31.useCallback)(() => {
2668
3297
  const href = getCurrentUrl();
2669
3298
  if (href) {
2670
3299
  window.open(href, "_blank", "noopener,noreferrer");
2671
3300
  }
2672
3301
  }, [getCurrentUrl]);
2673
- const handleRemoveLink = (0, import_react27.useCallback)(() => {
3302
+ const handleRemoveLink = (0, import_react31.useCallback)(() => {
2674
3303
  editor == null ? void 0 : editor.chain().focus().unsetLink().run();
2675
3304
  }, [editor]);
2676
- const handleEdit = (0, import_react27.useCallback)(() => {
3305
+ const handleEdit = (0, import_react31.useCallback)(() => {
2677
3306
  setUrl(getCurrentUrl());
2678
3307
  setIsEditing(true);
2679
3308
  }, [getCurrentUrl]);
2680
- const handleSave = (0, import_react27.useCallback)(() => {
3309
+ const handleSave = (0, import_react31.useCallback)(() => {
2681
3310
  if (url) {
2682
3311
  editor == null ? void 0 : editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
2683
3312
  } else {
@@ -2685,7 +3314,7 @@ function LinkBubble({ editor }) {
2685
3314
  }
2686
3315
  setIsEditing(false);
2687
3316
  }, [editor, url]);
2688
- const handleKeyDown = (0, import_react27.useCallback)(
3317
+ const handleKeyDown = (0, import_react31.useCallback)(
2689
3318
  (e) => {
2690
3319
  if (e.key === "Enter") {
2691
3320
  e.preventDefault();
@@ -2701,7 +3330,7 @@ function LinkBubble({ editor }) {
2701
3330
  if (!editor) {
2702
3331
  return null;
2703
3332
  }
2704
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3333
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2705
3334
  import_menus2.BubbleMenu,
2706
3335
  {
2707
3336
  editor,
@@ -2714,8 +3343,8 @@ function LinkBubble({ editor }) {
2714
3343
  offset: 8
2715
3344
  },
2716
3345
  className: "rounded-lg border bg-background shadow-md",
2717
- 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: [
2718
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3346
+ 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: [
3347
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2719
3348
  import_input3.Input,
2720
3349
  {
2721
3350
  type: "url",
@@ -2727,19 +3356,19 @@ function LinkBubble({ editor }) {
2727
3356
  autoFocus: true
2728
3357
  }
2729
3358
  ),
2730
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2731
- import_button6.IconButton,
3359
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3360
+ import_button7.IconButton,
2732
3361
  {
2733
3362
  type: "button",
2734
3363
  size: "sm",
2735
3364
  variant: "ghost",
2736
3365
  onClick: handleSave,
2737
3366
  "aria-label": "Save link",
2738
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.EditIcon, { className: "size-4" })
3367
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.EditIcon, { className: "size-4" })
2739
3368
  }
2740
3369
  )
2741
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2742
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3370
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
3371
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2743
3372
  "a",
2744
3373
  {
2745
3374
  href: getCurrentUrl(),
@@ -2753,38 +3382,38 @@ function LinkBubble({ editor }) {
2753
3382
  children: getCurrentUrl()
2754
3383
  }
2755
3384
  ),
2756
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
2757
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2758
- import_button6.IconButton,
3385
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-0.5 border-l pl-1 ml-1", children: [
3386
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3387
+ import_button7.IconButton,
2759
3388
  {
2760
3389
  type: "button",
2761
3390
  size: "sm",
2762
3391
  variant: "ghost",
2763
3392
  onClick: handleOpenLink,
2764
3393
  "aria-label": "Open link in new tab",
2765
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.ExternalLinkIcon, { className: "size-4" })
3394
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.ExternalLinkIcon, { className: "size-4" })
2766
3395
  }
2767
3396
  ),
2768
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2769
- import_button6.IconButton,
3397
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3398
+ import_button7.IconButton,
2770
3399
  {
2771
3400
  type: "button",
2772
3401
  size: "sm",
2773
3402
  variant: "ghost",
2774
3403
  onClick: handleEdit,
2775
3404
  "aria-label": "Edit link",
2776
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.EditIcon, { className: "size-4" })
3405
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.EditIcon, { className: "size-4" })
2777
3406
  }
2778
3407
  ),
2779
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2780
- import_button6.IconButton,
3408
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3409
+ import_button7.IconButton,
2781
3410
  {
2782
3411
  type: "button",
2783
3412
  size: "sm",
2784
3413
  variant: "ghost",
2785
3414
  onClick: handleRemoveLink,
2786
3415
  "aria-label": "Remove link",
2787
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons9.TrashIcon, { className: "size-4" })
3416
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons10.TrashIcon, { className: "size-4" })
2788
3417
  }
2789
3418
  )
2790
3419
  ] })
@@ -2794,30 +3423,30 @@ function LinkBubble({ editor }) {
2794
3423
  }
2795
3424
 
2796
3425
  // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
2797
- var import_button7 = require("@kopexa/button");
3426
+ var import_button8 = require("@kopexa/button");
2798
3427
  var import_editor_utils6 = require("@kopexa/editor-utils");
2799
3428
  var import_separator = require("@kopexa/separator");
2800
- var import_theme3 = require("@kopexa/theme");
3429
+ var import_theme4 = require("@kopexa/theme");
2801
3430
  var React8 = __toESM(require("react"));
2802
3431
 
2803
3432
  // src/ui/suggestion-menu/suggestion-menu.tsx
2804
- var import_react29 = require("@floating-ui/react");
3433
+ var import_react33 = require("@floating-ui/react");
2805
3434
  var import_state5 = require("@tiptap/pm/state");
2806
3435
  var import_suggestion = require("@tiptap/suggestion");
2807
3436
  var React6 = __toESM(require("react"));
2808
3437
 
2809
3438
  // src/hooks/use-floating-element.ts
2810
- var import_react28 = require("@floating-ui/react");
3439
+ var import_react32 = require("@floating-ui/react");
2811
3440
  var React4 = __toESM(require("react"));
2812
3441
  function useFloatingElement(show, referencePos, zIndex, options) {
2813
3442
  const { dismissOptions, ...floatingOptions } = options || {};
2814
- const { refs, update, context, floatingStyles } = (0, import_react28.useFloating)({
3443
+ const { refs, update, context, floatingStyles } = (0, import_react32.useFloating)({
2815
3444
  open: show,
2816
3445
  ...floatingOptions
2817
3446
  });
2818
- const { isMounted, styles } = (0, import_react28.useTransitionStyles)(context);
2819
- const dismiss = (0, import_react28.useDismiss)(context, dismissOptions);
2820
- const { getReferenceProps, getFloatingProps } = (0, import_react28.useInteractions)([dismiss]);
3447
+ const { isMounted, styles } = (0, import_react32.useTransitionStyles)(context);
3448
+ const dismiss = (0, import_react32.useDismiss)(context, dismissOptions);
3449
+ const { getReferenceProps, getFloatingProps } = (0, import_react32.useInteractions)([dismiss]);
2821
3450
  React4.useEffect(() => {
2822
3451
  update();
2823
3452
  }, [referencePos, update]);
@@ -3025,7 +3654,7 @@ function filterSuggestionItems(items, query) {
3025
3654
  }
3026
3655
 
3027
3656
  // src/ui/suggestion-menu/suggestion-menu.tsx
3028
- var import_jsx_runtime11 = require("react/jsx-runtime");
3657
+ var import_jsx_runtime13 = require("react/jsx-runtime");
3029
3658
  var SuggestionMenu = ({
3030
3659
  editor: providedEditor,
3031
3660
  floatingOptions,
@@ -3051,13 +3680,13 @@ var SuggestionMenu = ({
3051
3680
  {
3052
3681
  placement: "bottom-start",
3053
3682
  middleware: [
3054
- (0, import_react29.offset)(10),
3055
- (0, import_react29.flip)({
3683
+ (0, import_react33.offset)(10),
3684
+ (0, import_react33.flip)({
3056
3685
  mainAxis: true,
3057
3686
  crossAxis: false
3058
3687
  }),
3059
- (0, import_react29.shift)(),
3060
- (0, import_react29.size)({
3688
+ (0, import_react33.shift)(),
3689
+ (0, import_react33.size)({
3061
3690
  apply({ availableHeight, elements }) {
3062
3691
  if (elements.floating) {
3063
3692
  const maxHeightValue = maxHeight ? Math.min(maxHeight, availableHeight) : availableHeight;
@@ -3196,7 +3825,7 @@ var SuggestionMenu = ({
3196
3825
  if (!isMounted || !show || !editor) {
3197
3826
  return null;
3198
3827
  }
3199
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3828
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3200
3829
  "div",
3201
3830
  {
3202
3831
  ref,
@@ -3218,14 +3847,14 @@ var SuggestionMenu = ({
3218
3847
 
3219
3848
  // src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
3220
3849
  var import_editor_utils5 = require("@kopexa/editor-utils");
3221
- var import_icons11 = require("@kopexa/icons");
3850
+ var import_icons12 = require("@kopexa/icons");
3222
3851
  var React7 = __toESM(require("react"));
3223
3852
 
3224
3853
  // src/ui/table-button/use-table.ts
3225
3854
  var import_editor_utils4 = require("@kopexa/editor-utils");
3226
- var import_icons10 = require("@kopexa/icons");
3227
- var import_react30 = require("@tiptap/react");
3228
- var import_react31 = require("react");
3855
+ var import_icons11 = require("@kopexa/icons");
3856
+ var import_react34 = require("@tiptap/react");
3857
+ var import_react35 = require("react");
3229
3858
  function canToggle(editor) {
3230
3859
  if (!editor || !editor.isEditable) return false;
3231
3860
  if (!(0, import_editor_utils4.isNodeInSchema)("table", editor) || (0, import_editor_utils4.isNodeTypeSelected)(editor, ["image"])) {
@@ -3256,7 +3885,7 @@ function shouldShowButton(props) {
3256
3885
  if (!editor || !editor.isEditable) return false;
3257
3886
  if (!(0, import_editor_utils4.isNodeInSchema)("table", editor)) return false;
3258
3887
  if (hideWhenUnavailable) {
3259
- if ((0, import_react30.isNodeSelection)(editor.state.selection) || !canToggle) {
3888
+ if ((0, import_react34.isNodeSelection)(editor.state.selection) || !canToggle) {
3260
3889
  return false;
3261
3890
  }
3262
3891
  }
@@ -3269,10 +3898,10 @@ function useTableBlock(config) {
3269
3898
  onToggled
3270
3899
  } = config || {};
3271
3900
  const { editor } = useTiptapEditor(providedEditor);
3272
- const [isVisible, setIsVisible] = (0, import_react31.useState)(true);
3901
+ const [isVisible, setIsVisible] = (0, import_react35.useState)(true);
3273
3902
  const canToggleState = canToggle(editor);
3274
3903
  const isActive = (editor == null ? void 0 : editor.isActive("table")) || false;
3275
- (0, import_react31.useEffect)(() => {
3904
+ (0, import_react35.useEffect)(() => {
3276
3905
  if (!editor) return;
3277
3906
  const handleSelectionUpdate = () => {
3278
3907
  setIsVisible(shouldShowButton({ editor, hideWhenUnavailable }));
@@ -3283,7 +3912,7 @@ function useTableBlock(config) {
3283
3912
  editor.off("selectionUpdate", handleSelectionUpdate);
3284
3913
  };
3285
3914
  }, [editor, hideWhenUnavailable]);
3286
- const handleToggle = (0, import_react31.useCallback)(() => {
3915
+ const handleToggle = (0, import_react35.useCallback)(() => {
3287
3916
  if (!editor) return false;
3288
3917
  const success = toggleTable(editor);
3289
3918
  if (success) {
@@ -3298,7 +3927,7 @@ function useTableBlock(config) {
3298
3927
  canToggle: canToggleState,
3299
3928
  label: "Table",
3300
3929
  // shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
3301
- Icon: import_icons10.TableIcon
3930
+ Icon: import_icons11.TableIcon
3302
3931
  };
3303
3932
  }
3304
3933
 
@@ -3309,14 +3938,14 @@ var texts = {
3309
3938
  title: "Continue Writing",
3310
3939
  subtext: "Continue writing from the current position",
3311
3940
  keywords: ["continue", "write", "continue writing", "ai"],
3312
- badge: import_icons11.AiSparklesIcon,
3941
+ badge: import_icons12.AiSparklesIcon,
3313
3942
  group: "AI"
3314
3943
  },
3315
3944
  ai_ask_button: {
3316
3945
  title: "Ask AI",
3317
3946
  subtext: "Ask AI to generate content",
3318
3947
  keywords: ["ai", "ask", "generate"],
3319
- badge: import_icons11.AiSparklesIcon,
3948
+ badge: import_icons12.AiSparklesIcon,
3320
3949
  group: "AI"
3321
3950
  },
3322
3951
  // Style
@@ -3324,63 +3953,63 @@ var texts = {
3324
3953
  title: "Text",
3325
3954
  subtext: "Regular text paragraph",
3326
3955
  keywords: ["p", "paragraph", "text"],
3327
- badge: import_icons11.TypeIcon,
3956
+ badge: import_icons12.TypeIcon,
3328
3957
  group: "Style"
3329
3958
  },
3330
3959
  heading_1: {
3331
3960
  title: "Heading 1",
3332
3961
  subtext: "Top-level heading",
3333
3962
  keywords: ["h", "heading1", "h1"],
3334
- badge: import_icons11.HeadingOneIcon,
3963
+ badge: import_icons12.HeadingOneIcon,
3335
3964
  group: "Style"
3336
3965
  },
3337
3966
  heading_2: {
3338
3967
  title: "Heading 2",
3339
3968
  subtext: "Key section heading",
3340
3969
  keywords: ["h2", "heading2", "subheading"],
3341
- badge: import_icons11.HeadingTwoIcon,
3970
+ badge: import_icons12.HeadingTwoIcon,
3342
3971
  group: "Style"
3343
3972
  },
3344
3973
  heading_3: {
3345
3974
  title: "Heading 3",
3346
3975
  subtext: "Subsection and group heading",
3347
3976
  keywords: ["h3", "heading3", "subheading"],
3348
- badge: import_icons11.HeadingThreeIcon,
3977
+ badge: import_icons12.HeadingThreeIcon,
3349
3978
  group: "Style"
3350
3979
  },
3351
3980
  bullet_list: {
3352
3981
  title: "Bullet List",
3353
3982
  subtext: "List with unordered items",
3354
3983
  keywords: ["ul", "li", "list", "bulletlist", "bullet list"],
3355
- badge: import_icons11.ListIcon,
3984
+ badge: import_icons12.ListIcon,
3356
3985
  group: "Style"
3357
3986
  },
3358
3987
  ordered_list: {
3359
3988
  title: "Numbered List",
3360
3989
  subtext: "List with ordered items",
3361
3990
  keywords: ["ol", "li", "list", "numberedlist", "numbered list"],
3362
- badge: import_icons11.ListOrderedIcon,
3991
+ badge: import_icons12.ListOrderedIcon,
3363
3992
  group: "Style"
3364
3993
  },
3365
3994
  task_list: {
3366
3995
  title: "To-do list",
3367
3996
  subtext: "List with tasks",
3368
3997
  keywords: ["tasklist", "task list", "todo", "checklist"],
3369
- badge: import_icons11.ListTodoIcon,
3998
+ badge: import_icons12.ListTodoIcon,
3370
3999
  group: "Style"
3371
4000
  },
3372
4001
  quote: {
3373
4002
  title: "Blockquote",
3374
4003
  subtext: "Blockquote block",
3375
4004
  keywords: ["quote", "blockquote"],
3376
- badge: import_icons11.BlockquoteIcon,
4005
+ badge: import_icons12.BlockquoteIcon,
3377
4006
  group: "Style"
3378
4007
  },
3379
4008
  code_block: {
3380
4009
  title: "Code Block",
3381
4010
  subtext: "Code block with syntax highlighting",
3382
4011
  keywords: ["code", "pre"],
3383
- badge: import_icons11.CodeBlockIcon,
4012
+ badge: import_icons12.CodeBlockIcon,
3384
4013
  group: "Style"
3385
4014
  },
3386
4015
  // Insert
@@ -3402,49 +4031,49 @@ var texts = {
3402
4031
  title: "Control",
3403
4032
  subtext: "Insert a control block",
3404
4033
  keywords: ["control"],
3405
- badge: import_icons11.ControlsIcon,
4034
+ badge: import_icons12.ControlsIcon,
3406
4035
  group: "Insert"
3407
4036
  },
3408
4037
  divider: {
3409
4038
  title: "Separator",
3410
4039
  subtext: "Horizontal line to separate content",
3411
4040
  keywords: ["hr", "horizontalRule", "line", "separator"],
3412
- badge: import_icons11.MinusIcon,
4041
+ badge: import_icons12.MinusIcon,
3413
4042
  group: "Insert"
3414
4043
  },
3415
4044
  table: {
3416
4045
  title: "Table",
3417
4046
  subtext: "Insert a table",
3418
4047
  keywords: ["table", "grid", "spreadsheet"],
3419
- badge: import_icons11.TableIcon,
4048
+ badge: import_icons12.TableIcon,
3420
4049
  group: "Insert"
3421
4050
  },
3422
4051
  table_of_contents: {
3423
4052
  title: "Table of Contents",
3424
4053
  subtext: "Auto-generated list of headings",
3425
4054
  keywords: ["toc", "table of contents", "index", "navigation", "headings"],
3426
- badge: import_icons11.TableOfContentsIcon,
4055
+ badge: import_icons12.TableOfContentsIcon,
3427
4056
  group: "Insert"
3428
4057
  },
3429
4058
  callout: {
3430
4059
  title: "Callout",
3431
4060
  subtext: "Highlighted block for important information",
3432
4061
  keywords: ["callout", "info", "warning", "alert", "note", "tip"],
3433
- badge: import_icons11.InfoIcon,
4062
+ badge: import_icons12.InfoIcon,
3434
4063
  group: "Insert"
3435
4064
  },
3436
4065
  callout_warning: {
3437
4066
  title: "Warning",
3438
4067
  subtext: "Warning callout block",
3439
4068
  keywords: ["warning", "caution", "attention"],
3440
- badge: import_icons11.AlertIcon,
4069
+ badge: import_icons12.AlertIcon,
3441
4070
  group: "Insert"
3442
4071
  },
3443
4072
  math: {
3444
4073
  title: "Formula",
3445
4074
  subtext: "LaTeX math formula block",
3446
4075
  keywords: ["math", "latex", "formula", "equation", "katex"],
3447
- badge: import_icons11.TypeIcon,
4076
+ badge: import_icons12.TypeIcon,
3448
4077
  group: "Insert"
3449
4078
  },
3450
4079
  // Upload
@@ -3460,7 +4089,7 @@ var texts = {
3460
4089
  "media",
3461
4090
  "url"
3462
4091
  ],
3463
- badge: import_icons11.ImageIcon,
4092
+ badge: import_icons12.ImageIcon,
3464
4093
  group: "Upload"
3465
4094
  }
3466
4095
  };
@@ -3624,9 +4253,7 @@ Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT R
3624
4253
  image: {
3625
4254
  check: (editor) => (0, import_editor_utils5.isNodeInSchema)("image", editor),
3626
4255
  action: ({ editor }) => {
3627
- editor.chain().focus().insertContent({
3628
- type: "imageUpload"
3629
- }).run();
4256
+ editor.chain().focus().setImage({ src: "" }).run();
3630
4257
  }
3631
4258
  }
3632
4259
  };
@@ -3687,11 +4314,11 @@ function useSlashDropdownMenu(config) {
3687
4314
  }
3688
4315
 
3689
4316
  // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
3690
- var import_jsx_runtime12 = require("react/jsx-runtime");
4317
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3691
4318
  var SlashDropdownMenu = (props) => {
3692
4319
  const { config, ...restProps } = props;
3693
4320
  const { getSlashMenuItems } = useSlashDropdownMenu(config);
3694
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4321
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3695
4322
  SuggestionMenu,
3696
4323
  {
3697
4324
  char: "/",
@@ -3701,7 +4328,7 @@ var SlashDropdownMenu = (props) => {
3701
4328
  selector: "tiptap-slash-dropdown-menu",
3702
4329
  items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor), query),
3703
4330
  ...restProps,
3704
- children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { ...props2, config })
4331
+ children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(List, { ...props2, config })
3705
4332
  }
3706
4333
  );
3707
4334
  };
@@ -3721,13 +4348,13 @@ var Item = (props) => {
3721
4348
  }
3722
4349
  }, [isSelected]);
3723
4350
  const BadgeIcon = item.badge;
3724
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3725
- import_button7.Button,
4351
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4352
+ import_button8.Button,
3726
4353
  {
3727
4354
  ref: itemRef,
3728
4355
  variant: "ghost",
3729
4356
  color: "default",
3730
- startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BadgeIcon, {}),
4357
+ startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BadgeIcon, {}),
3731
4358
  "data-active-state": isSelected ? "on" : "off",
3732
4359
  onClick: onSelect,
3733
4360
  fullWidth: true,
@@ -3742,14 +4369,14 @@ var List = ({
3742
4369
  onSelect,
3743
4370
  config
3744
4371
  }) => {
3745
- const styles = (0, import_theme3.slashDropdownMenu)();
4372
+ const styles = (0, import_theme4.slashDropdownMenu)();
3746
4373
  const renderedItems = React8.useMemo(() => {
3747
4374
  const rendered = [];
3748
4375
  const showGroups = (config == null ? void 0 : config.showGroups) !== false;
3749
4376
  if (!showGroups) {
3750
4377
  items.forEach((item, index) => {
3751
4378
  rendered.push(
3752
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4379
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3753
4380
  Item,
3754
4381
  {
3755
4382
  item,
@@ -3774,7 +4401,7 @@ var List = ({
3774
4401
  Object.entries(groups).forEach(([groupLabel, groupData], groupIndex) => {
3775
4402
  if (groupIndex > 0) {
3776
4403
  rendered.push(
3777
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4404
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3778
4405
  import_separator.Separator,
3779
4406
  {
3780
4407
  orientation: "horizontal"
@@ -3785,7 +4412,7 @@ var List = ({
3785
4412
  }
3786
4413
  const groupItems = groupData.items.map((item, itemIndex) => {
3787
4414
  const originalIndex = groupData.indices[itemIndex];
3788
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4415
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3789
4416
  Item,
3790
4417
  {
3791
4418
  item,
@@ -3797,13 +4424,13 @@ var List = ({
3797
4424
  });
3798
4425
  if (groupLabel) {
3799
4426
  rendered.push(
3800
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4427
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3801
4428
  "div",
3802
4429
  {
3803
4430
  className: styles.cardItemGroup(),
3804
4431
  children: [
3805
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
3806
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.cardGroup(), children: groupItems })
4432
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
4433
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.cardGroup(), children: groupItems })
3807
4434
  ]
3808
4435
  },
3809
4436
  `group-${groupIndex}-${groupLabel}`
@@ -3818,24 +4445,24 @@ var List = ({
3818
4445
  if (!renderedItems.length) {
3819
4446
  return null;
3820
4447
  }
3821
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4448
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3822
4449
  "div",
3823
4450
  {
3824
4451
  className: styles.card(),
3825
4452
  style: {
3826
4453
  maxHeight: "var(--suggestion-menu-max-height)"
3827
4454
  },
3828
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: styles.body(), children: renderedItems })
4455
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: styles.body(), children: renderedItems })
3829
4456
  }
3830
4457
  );
3831
4458
  };
3832
4459
 
3833
4460
  // src/presets/basic/editor-header.tsx
3834
- var import_icons23 = require("@kopexa/icons");
4461
+ var import_icons24 = require("@kopexa/icons");
3835
4462
  var import_popover3 = require("@kopexa/popover");
3836
4463
  var import_toolbar10 = require("@kopexa/toolbar");
3837
4464
  var import_use_is_mobile2 = require("@kopexa/use-is-mobile");
3838
- var import_react46 = require("react");
4465
+ var import_react50 = require("react");
3839
4466
 
3840
4467
  // src/hooks/use-cursor-visibility.ts
3841
4468
  var React10 = __toESM(require("react"));
@@ -3945,7 +4572,7 @@ var React12 = __toESM(require("react"));
3945
4572
 
3946
4573
  // src/ui/blockquote-button/use-blockquote.ts
3947
4574
  var import_editor_utils7 = require("@kopexa/editor-utils");
3948
- var import_icons12 = require("@kopexa/icons");
4575
+ var import_icons13 = require("@kopexa/icons");
3949
4576
  var import_state6 = require("@tiptap/pm/state");
3950
4577
  var React11 = __toESM(require("react"));
3951
4578
  var BLOCKQUOTE_SHORTCUT_KEY = "mod+shift+b";
@@ -4053,12 +4680,12 @@ function useBlockquote(config) {
4053
4680
  canToggle: canToggle3,
4054
4681
  label: "Blockquote",
4055
4682
  shortcutKeys: BLOCKQUOTE_SHORTCUT_KEY,
4056
- Icon: import_icons12.BlockquoteIcon
4683
+ Icon: import_icons13.BlockquoteIcon
4057
4684
  };
4058
4685
  }
4059
4686
 
4060
4687
  // src/ui/blockquote-button/blockquote-button.tsx
4061
- var import_jsx_runtime13 = require("react/jsx-runtime");
4688
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4062
4689
  var BlockquoteButton = ({
4063
4690
  editor: providedEditor,
4064
4691
  text,
@@ -4094,7 +4721,7 @@ var BlockquoteButton = ({
4094
4721
  if (!isVisible) {
4095
4722
  return null;
4096
4723
  }
4097
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4724
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4098
4725
  import_toolbar4.ToolbarButton,
4099
4726
  {
4100
4727
  type: "button",
@@ -4111,22 +4738,22 @@ var BlockquoteButton = ({
4111
4738
  onClick: handleClick,
4112
4739
  isIconOnly: !text && !children,
4113
4740
  ...buttonProps,
4114
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
4115
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, {}),
4116
- text && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: text })
4741
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
4742
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, {}),
4743
+ text && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: text })
4117
4744
  ] })
4118
4745
  }
4119
4746
  );
4120
4747
  };
4121
4748
 
4122
4749
  // src/ui/codeblock-button/code-block-button.tsx
4123
- var import_icons14 = require("@kopexa/icons");
4750
+ var import_icons15 = require("@kopexa/icons");
4124
4751
  var import_toolbar5 = require("@kopexa/toolbar");
4125
- var import_react32 = require("react");
4752
+ var import_react36 = require("react");
4126
4753
 
4127
4754
  // src/ui/codeblock-button/use-code-block.ts
4128
4755
  var import_editor_utils8 = require("@kopexa/editor-utils");
4129
- var import_icons13 = require("@kopexa/icons");
4756
+ var import_icons14 = require("@kopexa/icons");
4130
4757
  var import_state7 = require("@tiptap/pm/state");
4131
4758
  var React13 = __toESM(require("react"));
4132
4759
  var CODE_BLOCK_SHORTCUT_KEY = "mod+alt+c";
@@ -4234,12 +4861,12 @@ function useCodeBlock(config) {
4234
4861
  canToggle: canToggleState,
4235
4862
  label: "Code Block",
4236
4863
  shortcutKeys: CODE_BLOCK_SHORTCUT_KEY,
4237
- Icon: import_icons13.CodeblockIcon
4864
+ Icon: import_icons14.CodeblockIcon
4238
4865
  };
4239
4866
  }
4240
4867
 
4241
4868
  // src/ui/codeblock-button/code-block-button.tsx
4242
- var import_jsx_runtime14 = require("react/jsx-runtime");
4869
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4243
4870
  var CodeBlockButton = ({
4244
4871
  editor: providedEditor,
4245
4872
  text,
@@ -4256,7 +4883,7 @@ var CodeBlockButton = ({
4256
4883
  hideWhenUnavailable,
4257
4884
  onToggled
4258
4885
  });
4259
- const handleClick = (0, import_react32.useCallback)(
4886
+ const handleClick = (0, import_react36.useCallback)(
4260
4887
  (event) => {
4261
4888
  onClick == null ? void 0 : onClick(event);
4262
4889
  if (event.defaultPrevented) return;
@@ -4267,7 +4894,7 @@ var CodeBlockButton = ({
4267
4894
  if (!isVisible) {
4268
4895
  return null;
4269
4896
  }
4270
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4897
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4271
4898
  import_toolbar5.ToolbarButton,
4272
4899
  {
4273
4900
  type: "button",
@@ -4284,26 +4911,26 @@ var CodeBlockButton = ({
4284
4911
  onClick: handleClick,
4285
4912
  isIconOnly: true,
4286
4913
  ...buttonProps,
4287
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons14.CodeblockIcon, {})
4914
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons15.CodeblockIcon, {})
4288
4915
  }
4289
4916
  );
4290
4917
  };
4291
4918
 
4292
4919
  // src/ui/color-highlight-popover/color-highlight-popover.tsx
4293
- var import_button8 = require("@kopexa/button");
4294
- var import_icons16 = require("@kopexa/icons");
4920
+ var import_button9 = require("@kopexa/button");
4921
+ var import_icons17 = require("@kopexa/icons");
4295
4922
  var import_popover2 = require("@kopexa/popover");
4296
4923
  var import_toolbar7 = require("@kopexa/toolbar");
4297
- var import_react34 = require("react");
4924
+ var import_react38 = require("react");
4298
4925
 
4299
4926
  // src/ui/color-highlight-button/color-highlight-button.tsx
4300
- var import_theme4 = require("@kopexa/theme");
4927
+ var import_theme5 = require("@kopexa/theme");
4301
4928
  var import_toolbar6 = require("@kopexa/toolbar");
4302
- var import_react33 = require("react");
4929
+ var import_react37 = require("react");
4303
4930
 
4304
4931
  // src/ui/color-highlight-button/use-color-highlight.ts
4305
4932
  var import_editor_utils9 = require("@kopexa/editor-utils");
4306
- var import_icons15 = require("@kopexa/icons");
4933
+ var import_icons16 = require("@kopexa/icons");
4307
4934
  var import_use_is_mobile = require("@kopexa/use-is-mobile");
4308
4935
  var React14 = __toESM(require("react"));
4309
4936
  var import_react_hotkeys_hook = require("react-hotkeys-hook");
@@ -4460,12 +5087,12 @@ function useColorHighlight(config) {
4460
5087
  canColorHighlight: canColorHighlightState,
4461
5088
  label: label || `Highlight`,
4462
5089
  shortcutKeys: COLOR_HIGHLIGHT_SHORTCUT_KEY,
4463
- Icon: import_icons15.HighlighterIcon
5090
+ Icon: import_icons16.HighlighterIcon
4464
5091
  };
4465
5092
  }
4466
5093
 
4467
5094
  // src/ui/color-highlight-button/color-highlight-button.tsx
4468
- var import_jsx_runtime15 = require("react/jsx-runtime");
5095
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4469
5096
  var ColorHighlightButton = ({
4470
5097
  editor: providedEditor,
4471
5098
  highlightColor,
@@ -4494,7 +5121,7 @@ var ColorHighlightButton = ({
4494
5121
  hideWhenUnavailable,
4495
5122
  onApplied
4496
5123
  });
4497
- const handleClick = (0, import_react33.useCallback)(
5124
+ const handleClick = (0, import_react37.useCallback)(
4498
5125
  (event) => {
4499
5126
  onClick == null ? void 0 : onClick(event);
4500
5127
  if (event.defaultPrevented) return;
@@ -4502,7 +5129,7 @@ var ColorHighlightButton = ({
4502
5129
  },
4503
5130
  [handleColorHighlight, onClick]
4504
5131
  );
4505
- const buttonStyle = (0, import_react33.useMemo)(
5132
+ const buttonStyle = (0, import_react37.useMemo)(
4506
5133
  () => ({
4507
5134
  ...style,
4508
5135
  "--highlight-color": highlightColor
@@ -4512,8 +5139,8 @@ var ColorHighlightButton = ({
4512
5139
  if (!isVisible) {
4513
5140
  return null;
4514
5141
  }
4515
- const styles = (0, import_theme4.colorHighlightButton)();
4516
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5142
+ const styles = (0, import_theme5.colorHighlightButton)();
5143
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4517
5144
  import_toolbar6.ToolbarButton,
4518
5145
  {
4519
5146
  type: "button",
@@ -4532,15 +5159,15 @@ var ColorHighlightButton = ({
4532
5159
  isIconOnly: true,
4533
5160
  ...buttonProps,
4534
5161
  children: [
4535
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5162
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4536
5163
  "span",
4537
5164
  {
4538
5165
  "data-active-state": isActive ? "on" : "off",
4539
5166
  className: styles.mark()
4540
5167
  }
4541
5168
  ),
4542
- children || /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
4543
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5169
+ children || /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
5170
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4544
5171
  "span",
4545
5172
  {
4546
5173
  style: { "--highlight-color": highlightColor }
@@ -4554,13 +5181,13 @@ var ColorHighlightButton = ({
4554
5181
  };
4555
5182
 
4556
5183
  // src/ui/color-highlight-popover/color-highlight-popover.tsx
4557
- var import_jsx_runtime16 = require("react/jsx-runtime");
5184
+ var import_jsx_runtime18 = require("react/jsx-runtime");
4558
5185
  var ColorHighlightPopoverButton = ({
4559
5186
  className,
4560
5187
  children,
4561
5188
  ...props
4562
- }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4563
- import_button8.IconButton,
5189
+ }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5190
+ import_button9.IconButton,
4564
5191
  {
4565
5192
  type: "button",
4566
5193
  className,
@@ -4571,7 +5198,7 @@ var ColorHighlightPopoverButton = ({
4571
5198
  tooltip: "Highlight",
4572
5199
  isIconOnly: !children,
4573
5200
  ...props,
4574
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons16.HighlighterIcon, {})
5201
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons17.HighlighterIcon, {})
4575
5202
  }
4576
5203
  );
4577
5204
  function ColorHighlightPopoverContent({
@@ -4585,8 +5212,8 @@ function ColorHighlightPopoverContent({
4585
5212
  ])
4586
5213
  }) {
4587
5214
  const { handleRemoveHighlight } = useColorHighlight({ editor });
4588
- const containerRef = (0, import_react34.useRef)(null);
4589
- const menuItems = (0, import_react34.useMemo)(
5215
+ const containerRef = (0, import_react38.useRef)(null);
5216
+ const menuItems = (0, import_react38.useMemo)(
4590
5217
  () => [...colors, { label: "Remove highlight", value: "none" }],
4591
5218
  [colors]
4592
5219
  );
@@ -4604,13 +5231,13 @@ function ColorHighlightPopoverContent({
4604
5231
  },
4605
5232
  autoSelectFirstItem: false
4606
5233
  });
4607
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, className: "flex gap-1 items-center", children: [
4608
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5234
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: containerRef, className: "flex gap-1 items-center", children: [
5235
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4609
5236
  "div",
4610
5237
  {
4611
5238
  className: "flex items-center gap-1 outline-none",
4612
5239
  "data-orientation": "horizontal",
4613
- children: colors.map((color, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5240
+ children: colors.map((color, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4614
5241
  ColorHighlightButton,
4615
5242
  {
4616
5243
  editor,
@@ -4623,9 +5250,9 @@ function ColorHighlightPopoverContent({
4623
5250
  ))
4624
5251
  }
4625
5252
  ),
4626
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_toolbar7.ToolbarSeparator, { orientation: "vertical" }),
4627
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4628
- import_button8.IconButton,
5253
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_toolbar7.ToolbarSeparator, { orientation: "vertical" }),
5254
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5255
+ import_button9.IconButton,
4629
5256
  {
4630
5257
  onClick: handleRemoveHighlight,
4631
5258
  "aria-label": "Remove highlight",
@@ -4635,7 +5262,7 @@ function ColorHighlightPopoverContent({
4635
5262
  variant: "ghost",
4636
5263
  color: "default",
4637
5264
  "data-highlighted": selectedIndex === colors.length,
4638
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_icons16.BanIcon, {})
5265
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons17.BanIcon, {})
4639
5266
  }
4640
5267
  ) })
4641
5268
  ] });
@@ -4654,18 +5281,18 @@ function ColorHighlightPopover({
4654
5281
  ...props
4655
5282
  }) {
4656
5283
  const { editor } = useTiptapEditor(providedEditor);
4657
- const [isOpen, setIsOpen] = (0, import_react34.useState)(false);
5284
+ const [isOpen, setIsOpen] = (0, import_react38.useState)(false);
4658
5285
  const { isVisible, canColorHighlight: canColorHighlight2, isActive, label } = useColorHighlight({
4659
5286
  editor,
4660
5287
  hideWhenUnavailable,
4661
5288
  onApplied
4662
5289
  });
4663
5290
  if (!isVisible) return null;
4664
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_popover2.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
4665
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5291
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_popover2.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
5292
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4666
5293
  import_popover2.Popover.Trigger,
4667
5294
  {
4668
- render: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5295
+ render: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4669
5296
  ColorHighlightPopoverButton,
4670
5297
  {
4671
5298
  disabled: !canColorHighlight2,
@@ -4679,26 +5306,26 @@ function ColorHighlightPopover({
4679
5306
  )
4680
5307
  }
4681
5308
  ),
4682
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_popover2.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
5309
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_popover2.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
4683
5310
  ] });
4684
5311
  }
4685
5312
 
4686
5313
  // src/ui/heading-dropdown-menu/index.tsx
4687
- var import_button10 = require("@kopexa/button");
5314
+ var import_button11 = require("@kopexa/button");
4688
5315
  var import_dropdown_menu = require("@kopexa/dropdown-menu");
4689
5316
  var import_editor_utils11 = require("@kopexa/editor-utils");
4690
- var import_icons18 = require("@kopexa/icons");
4691
- var import_react36 = require("@tiptap/react");
5317
+ var import_icons19 = require("@kopexa/icons");
5318
+ var import_react40 = require("@tiptap/react");
4692
5319
  var React16 = __toESM(require("react"));
4693
5320
 
4694
5321
  // src/ui/heading-button/index.tsx
4695
- var import_button9 = require("@kopexa/button");
5322
+ var import_button10 = require("@kopexa/button");
4696
5323
  var import_editor_utils10 = require("@kopexa/editor-utils");
4697
- var import_icons17 = require("@kopexa/icons");
5324
+ var import_icons18 = require("@kopexa/icons");
4698
5325
  var React15 = __toESM(require("react"));
4699
5326
 
4700
5327
  // src/ui/heading-button/utils.ts
4701
- var import_react35 = require("@tiptap/react");
5328
+ var import_react39 = require("@tiptap/react");
4702
5329
  var headingShortcutKeys = {
4703
5330
  1: "Ctrl-Alt-1",
4704
5331
  2: "Ctrl-Alt-2",
@@ -4739,7 +5366,7 @@ function shouldShowHeadingButton(params) {
4739
5366
  return false;
4740
5367
  }
4741
5368
  if (hideWhenUnavailable) {
4742
- if ((0, import_react35.isNodeSelection)(editor.state.selection)) {
5369
+ if ((0, import_react39.isNodeSelection)(editor.state.selection)) {
4743
5370
  return false;
4744
5371
  }
4745
5372
  }
@@ -4750,14 +5377,14 @@ function getFormattedHeadingName(level) {
4750
5377
  }
4751
5378
 
4752
5379
  // src/ui/heading-button/index.tsx
4753
- var import_jsx_runtime17 = require("react/jsx-runtime");
5380
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4754
5381
  var headingIcons = {
4755
- 1: import_icons17.HeadingOneIcon,
4756
- 2: import_icons17.HeadingTwoIcon,
4757
- 3: import_icons17.HeadingThreeIcon,
4758
- 4: import_icons17.HeadingFourIcon,
4759
- 5: import_icons17.HeadingFiveIcon,
4760
- 6: import_icons17.HeadingSixIcon
5382
+ 1: import_icons18.HeadingOneIcon,
5383
+ 2: import_icons18.HeadingTwoIcon,
5384
+ 3: import_icons18.HeadingThreeIcon,
5385
+ 4: import_icons18.HeadingFourIcon,
5386
+ 5: import_icons18.HeadingFiveIcon,
5387
+ 6: import_icons18.HeadingSixIcon
4761
5388
  };
4762
5389
  function useHeadingState(editor, level, disabled = false) {
4763
5390
  const headingInSchema = (0, import_editor_utils10.isNodeInSchema)("heading", editor);
@@ -4816,8 +5443,8 @@ var HeadingButton = ({
4816
5443
  if (!show || !editor || !editor.isEditable) {
4817
5444
  return null;
4818
5445
  }
4819
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4820
- import_button9.Button,
5446
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5447
+ import_button10.Button,
4821
5448
  {
4822
5449
  type: "button",
4823
5450
  className: className.trim(),
@@ -4832,7 +5459,7 @@ var HeadingButton = ({
4832
5459
  tooltip: formattedName,
4833
5460
  shortcutKeys: shortcutKey,
4834
5461
  onClick: handleClick,
4835
- startContent: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, {}),
5462
+ startContent: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, {}),
4836
5463
  ...buttonProps,
4837
5464
  ref,
4838
5465
  children: children || text
@@ -4841,7 +5468,7 @@ var HeadingButton = ({
4841
5468
  };
4842
5469
 
4843
5470
  // src/ui/heading-dropdown-menu/index.tsx
4844
- var import_jsx_runtime18 = require("react/jsx-runtime");
5471
+ var import_jsx_runtime20 = require("react/jsx-runtime");
4845
5472
  function HeadingDropdownMenu({
4846
5473
  editor: providedEditor,
4847
5474
  levels = [1, 2, 3, 4, 5, 6],
@@ -4861,13 +5488,13 @@ function HeadingDropdownMenu({
4861
5488
  [onOpenChange]
4862
5489
  );
4863
5490
  const getActiveIcon = React16.useCallback(() => {
4864
- if (!editor) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons18.HeadingIcon, {});
5491
+ if (!editor) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.HeadingIcon, {});
4865
5492
  const activeLevel = levels.find(
4866
5493
  (level) => editor.isActive("heading", { level })
4867
5494
  );
4868
- if (!activeLevel) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons18.HeadingIcon, {});
5495
+ if (!activeLevel) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.HeadingIcon, {});
4869
5496
  const ActiveIcon = headingIcons[activeLevel];
4870
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ActiveIcon, {});
5497
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActiveIcon, {});
4871
5498
  }, [editor, levels]);
4872
5499
  const canToggleAnyHeading = React16.useCallback(() => {
4873
5500
  if (!editor) return false;
@@ -4882,7 +5509,7 @@ function HeadingDropdownMenu({
4882
5509
  return false;
4883
5510
  }
4884
5511
  if (hideWhenUnavailable) {
4885
- if ((0, import_react36.isNodeSelection)(editor.state.selection) || !canToggleAnyHeading()) {
5512
+ if ((0, import_react40.isNodeSelection)(editor.state.selection) || !canToggleAnyHeading()) {
4886
5513
  return false;
4887
5514
  }
4888
5515
  }
@@ -4891,9 +5518,9 @@ function HeadingDropdownMenu({
4891
5518
  if (!show || !editor || !editor.isEditable) {
4892
5519
  return null;
4893
5520
  }
4894
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_dropdown_menu.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
4895
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_dropdown_menu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4896
- import_button10.Button,
5521
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_dropdown_menu.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5522
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5523
+ import_button11.Button,
4897
5524
  {
4898
5525
  type: "button",
4899
5526
  disabled: isDisabled,
@@ -4905,12 +5532,12 @@ function HeadingDropdownMenu({
4905
5532
  "aria-label": "Format text as heading",
4906
5533
  "aria-pressed": isAnyHeadingActive,
4907
5534
  tooltip: "Heading",
4908
- endContent: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons18.ChevronDownIcon, {}),
5535
+ endContent: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons19.ChevronDownIcon, {}),
4909
5536
  ...props,
4910
5537
  children: getActiveIcon()
4911
5538
  }
4912
5539
  ) }),
4913
- /* @__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)(
5540
+ /* @__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)(
4914
5541
  HeadingButton,
4915
5542
  {
4916
5543
  editor,
@@ -4925,35 +5552,35 @@ function HeadingDropdownMenu({
4925
5552
  }
4926
5553
 
4927
5554
  // src/ui/list-dropdown-menu/index.tsx
4928
- var import_button12 = require("@kopexa/button");
5555
+ var import_button13 = require("@kopexa/button");
4929
5556
  var import_dropdown_menu2 = require("@kopexa/dropdown-menu");
4930
5557
  var import_editor_utils13 = require("@kopexa/editor-utils");
4931
- var import_icons20 = require("@kopexa/icons");
4932
- var import_react39 = require("@tiptap/react");
4933
- var import_react40 = require("react");
5558
+ var import_icons21 = require("@kopexa/icons");
5559
+ var import_react43 = require("@tiptap/react");
5560
+ var import_react44 = require("react");
4934
5561
 
4935
5562
  // src/ui/list-button/index.tsx
4936
- var import_button11 = require("@kopexa/button");
5563
+ var import_button12 = require("@kopexa/button");
4937
5564
  var import_editor_utils12 = require("@kopexa/editor-utils");
4938
- var import_icons19 = require("@kopexa/icons");
4939
- var import_react37 = require("@tiptap/react");
4940
- var import_react38 = require("react");
4941
- var import_jsx_runtime19 = require("react/jsx-runtime");
5565
+ var import_icons20 = require("@kopexa/icons");
5566
+ var import_react41 = require("@tiptap/react");
5567
+ var import_react42 = require("react");
5568
+ var import_jsx_runtime21 = require("react/jsx-runtime");
4942
5569
  var listOptions = [
4943
5570
  {
4944
5571
  label: "Bullet List",
4945
5572
  type: "bulletList",
4946
- icon: import_icons19.ListIcon
5573
+ icon: import_icons20.ListIcon
4947
5574
  },
4948
5575
  {
4949
5576
  label: "Ordered List",
4950
5577
  type: "orderedList",
4951
- icon: import_icons19.ListOrderedIcon
5578
+ icon: import_icons20.ListOrderedIcon
4952
5579
  },
4953
5580
  {
4954
5581
  label: "Task List",
4955
5582
  type: "taskList",
4956
- icon: import_icons19.ListTodoIcon
5583
+ icon: import_icons20.ListTodoIcon
4957
5584
  }
4958
5585
  ];
4959
5586
  var listShortcutKeys = {
@@ -5012,7 +5639,7 @@ function shouldShowListButton(params) {
5012
5639
  return false;
5013
5640
  }
5014
5641
  if (hideWhenUnavailable) {
5015
- if ((0, import_react37.isNodeSelection)(editor.state.selection) || !canToggleList(editor, type)) {
5642
+ if ((0, import_react41.isNodeSelection)(editor.state.selection) || !canToggleList(editor, type)) {
5016
5643
  return false;
5017
5644
  }
5018
5645
  }
@@ -5046,8 +5673,8 @@ var ListButton = ({
5046
5673
  editor,
5047
5674
  type
5048
5675
  );
5049
- const Icon = (listOption == null ? void 0 : listOption.icon) || import_icons19.ListIcon;
5050
- const handleClick = (0, import_react38.useCallback)(
5676
+ const Icon = (listOption == null ? void 0 : listOption.icon) || import_icons20.ListIcon;
5677
+ const handleClick = (0, import_react42.useCallback)(
5051
5678
  (e) => {
5052
5679
  onClick == null ? void 0 : onClick(e);
5053
5680
  if (!e.defaultPrevented && editor) {
@@ -5056,7 +5683,7 @@ var ListButton = ({
5056
5683
  },
5057
5684
  [onClick, editor, type]
5058
5685
  );
5059
- const show = (0, import_react38.useMemo)(() => {
5686
+ const show = (0, import_react42.useMemo)(() => {
5060
5687
  return shouldShowListButton({
5061
5688
  editor,
5062
5689
  type,
@@ -5067,8 +5694,8 @@ var ListButton = ({
5067
5694
  if (!show || !editor || !editor.isEditable) {
5068
5695
  return null;
5069
5696
  }
5070
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
5071
- import_button11.Button,
5697
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5698
+ import_button12.Button,
5072
5699
  {
5073
5700
  type: "button",
5074
5701
  className: className.trim(),
@@ -5081,7 +5708,7 @@ var ListButton = ({
5081
5708
  tooltip: (listOption == null ? void 0 : listOption.label) || type,
5082
5709
  shortcutKeys: shortcutKey,
5083
5710
  onClick: handleClick,
5084
- startContent: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, {}),
5711
+ startContent: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, {}),
5085
5712
  ...buttonProps,
5086
5713
  ref,
5087
5714
  children: children || text
@@ -5090,7 +5717,7 @@ var ListButton = ({
5090
5717
  };
5091
5718
 
5092
5719
  // src/ui/list-dropdown-menu/index.tsx
5093
- var import_jsx_runtime20 = require("react/jsx-runtime");
5720
+ var import_jsx_runtime22 = require("react/jsx-runtime");
5094
5721
  function canToggleAnyList(editor, listTypes) {
5095
5722
  if (!editor) return false;
5096
5723
  return listTypes.some((type) => canToggleList(editor, type));
@@ -5110,24 +5737,24 @@ function shouldShowListDropdown(params) {
5110
5737
  return false;
5111
5738
  }
5112
5739
  if (hideWhenUnavailable) {
5113
- if ((0, import_react39.isNodeSelection)(editor.state.selection) || !canToggleAny) {
5740
+ if ((0, import_react43.isNodeSelection)(editor.state.selection) || !canToggleAny) {
5114
5741
  return false;
5115
5742
  }
5116
5743
  }
5117
5744
  return true;
5118
5745
  }
5119
5746
  function useListDropdownState(editor, availableTypes) {
5120
- const [isOpen, setIsOpen] = (0, import_react40.useState)(false);
5747
+ const [isOpen, setIsOpen] = (0, import_react44.useState)(false);
5121
5748
  const listInSchema = availableTypes.some(
5122
5749
  (type) => (0, import_editor_utils13.isNodeInSchema)(type, editor)
5123
5750
  );
5124
- const filteredLists = (0, import_react40.useMemo)(
5751
+ const filteredLists = (0, import_react44.useMemo)(
5125
5752
  () => getFilteredListOptions(availableTypes),
5126
5753
  [availableTypes]
5127
5754
  );
5128
5755
  const canToggleAny = canToggleAnyList(editor, availableTypes);
5129
5756
  const isAnyActive = isAnyListActive(editor, availableTypes);
5130
- const handleOpenChange = (0, import_react40.useCallback)(
5757
+ const handleOpenChange = (0, import_react44.useCallback)(
5131
5758
  (open, callback) => {
5132
5759
  setIsOpen(open);
5133
5760
  callback == null ? void 0 : callback(open);
@@ -5145,11 +5772,11 @@ function useListDropdownState(editor, availableTypes) {
5145
5772
  };
5146
5773
  }
5147
5774
  function useActiveListIcon(editor, filteredLists) {
5148
- return (0, import_react40.useCallback)(() => {
5775
+ return (0, import_react44.useCallback)(() => {
5149
5776
  const activeOption = filteredLists.find(
5150
5777
  (option) => isListActive(editor, option.type)
5151
5778
  );
5152
- return activeOption ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(activeOption.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons20.ListIcon, {});
5779
+ return activeOption ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(activeOption.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons21.ListIcon, {});
5153
5780
  }, [editor, filteredLists]);
5154
5781
  }
5155
5782
  function ListDropdownMenu({
@@ -5169,7 +5796,7 @@ function ListDropdownMenu({
5169
5796
  handleOpenChange
5170
5797
  } = useListDropdownState(editor, types);
5171
5798
  const getActiveIcon = useActiveListIcon(editor, filteredLists);
5172
- const show = (0, import_react40.useMemo)(() => {
5799
+ const show = (0, import_react44.useMemo)(() => {
5173
5800
  return shouldShowListDropdown({
5174
5801
  editor,
5175
5802
  listTypes: types,
@@ -5178,16 +5805,16 @@ function ListDropdownMenu({
5178
5805
  canToggleAny
5179
5806
  });
5180
5807
  }, [editor, types, hideWhenUnavailable, listInSchema, canToggleAny]);
5181
- const handleOnOpenChange = (0, import_react40.useCallback)(
5808
+ const handleOnOpenChange = (0, import_react44.useCallback)(
5182
5809
  (open) => handleOpenChange(open, onOpenChange),
5183
5810
  [handleOpenChange, onOpenChange]
5184
5811
  );
5185
5812
  if (!show || !editor || !editor.isEditable) {
5186
5813
  return null;
5187
5814
  }
5188
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_dropdown_menu2.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5189
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_dropdown_menu2.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
5190
- import_button12.Button,
5815
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_dropdown_menu2.DropdownMenu.Root, { open: isOpen, onOpenChange: handleOnOpenChange, children: [
5816
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_dropdown_menu2.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5817
+ import_button13.Button,
5191
5818
  {
5192
5819
  type: "button",
5193
5820
  variant: "ghost",
@@ -5196,12 +5823,12 @@ function ListDropdownMenu({
5196
5823
  tabIndex: -1,
5197
5824
  "aria-label": "List options",
5198
5825
  tooltip: "List",
5199
- endContent: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons20.ChevronDownIcon, {}),
5826
+ endContent: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons21.ChevronDownIcon, {}),
5200
5827
  ...props,
5201
5828
  children: getActiveIcon()
5202
5829
  }
5203
5830
  ) }),
5204
- /* @__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)(
5831
+ /* @__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)(
5205
5832
  ListButton,
5206
5833
  {
5207
5834
  editor,
@@ -5218,8 +5845,8 @@ function ListDropdownMenu({
5218
5845
 
5219
5846
  // src/ui/table-button/index.tsx
5220
5847
  var import_toolbar8 = require("@kopexa/toolbar");
5221
- var import_react41 = require("react");
5222
- var import_jsx_runtime21 = require("react/jsx-runtime");
5848
+ var import_react45 = require("react");
5849
+ var import_jsx_runtime23 = require("react/jsx-runtime");
5223
5850
  var TableButton = ({
5224
5851
  editor: providedEditor,
5225
5852
  text,
@@ -5243,7 +5870,7 @@ var TableButton = ({
5243
5870
  hideWhenUnavailable,
5244
5871
  onToggled
5245
5872
  });
5246
- const handleClick = (0, import_react41.useCallback)(
5873
+ const handleClick = (0, import_react45.useCallback)(
5247
5874
  (event) => {
5248
5875
  onClick == null ? void 0 : onClick(event);
5249
5876
  if (event.defaultPrevented) return;
@@ -5254,7 +5881,7 @@ var TableButton = ({
5254
5881
  if (!isVisible) {
5255
5882
  return null;
5256
5883
  }
5257
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
5884
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5258
5885
  import_toolbar8.ToolbarButton,
5259
5886
  {
5260
5887
  type: "button",
@@ -5270,22 +5897,22 @@ var TableButton = ({
5270
5897
  onClick: handleClick,
5271
5898
  isIconOnly: !text && !children,
5272
5899
  ...buttonProps,
5273
- children: children || /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
5274
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, {}),
5275
- text && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: text })
5900
+ children: children || /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
5901
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, {}),
5902
+ text && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: text })
5276
5903
  ] })
5277
5904
  }
5278
5905
  );
5279
5906
  };
5280
5907
 
5281
5908
  // src/ui/text-align-button/text-align-button.tsx
5282
- var import_button13 = require("@kopexa/button");
5283
- var import_react43 = require("react");
5909
+ var import_button14 = require("@kopexa/button");
5910
+ var import_react47 = require("react");
5284
5911
 
5285
5912
  // src/ui/text-align-button/use-text-align.ts
5286
5913
  var import_editor_utils14 = require("@kopexa/editor-utils");
5287
- var import_icons21 = require("@kopexa/icons");
5288
- var import_react42 = require("react");
5914
+ var import_icons22 = require("@kopexa/icons");
5915
+ var import_react46 = require("react");
5289
5916
  var TEXT_ALIGN_SHORTCUT_KEYS = {
5290
5917
  left: "mod+shift+l",
5291
5918
  center: "mod+shift+e",
@@ -5293,10 +5920,10 @@ var TEXT_ALIGN_SHORTCUT_KEYS = {
5293
5920
  justify: "mod+shift+j"
5294
5921
  };
5295
5922
  var textAlignIcons = {
5296
- left: import_icons21.AlignLeftIcon,
5297
- center: import_icons21.AlignCenterIcon,
5298
- right: import_icons21.AlignRightIcon,
5299
- justify: import_icons21.AlignJustifyIcon
5923
+ left: import_icons22.AlignLeftIcon,
5924
+ center: import_icons22.AlignCenterIcon,
5925
+ right: import_icons22.AlignRightIcon,
5926
+ justify: import_icons22.AlignJustifyIcon
5300
5927
  };
5301
5928
  var textAlignLabels = {
5302
5929
  left: "Align left",
@@ -5343,10 +5970,10 @@ function useTextAlign(config) {
5343
5970
  onAligned
5344
5971
  } = config;
5345
5972
  const { editor } = useTiptapEditor(providedEditor);
5346
- const [isVisible, setIsVisible] = (0, import_react42.useState)(true);
5973
+ const [isVisible, setIsVisible] = (0, import_react46.useState)(true);
5347
5974
  const canAlign = canSetTextAlign(editor, align);
5348
5975
  const isActive = isTextAlignActive(editor, align);
5349
- (0, import_react42.useEffect)(() => {
5976
+ (0, import_react46.useEffect)(() => {
5350
5977
  if (!editor) return;
5351
5978
  const handleSelectionUpdate = () => {
5352
5979
  setIsVisible(shouldShowButton5({ editor, align, hideWhenUnavailable }));
@@ -5357,7 +5984,7 @@ function useTextAlign(config) {
5357
5984
  editor.off("selectionUpdate", handleSelectionUpdate);
5358
5985
  };
5359
5986
  }, [editor, hideWhenUnavailable, align]);
5360
- const handleTextAlign = (0, import_react42.useCallback)(() => {
5987
+ const handleTextAlign = (0, import_react46.useCallback)(() => {
5361
5988
  if (!editor) return false;
5362
5989
  const success = setTextAlign(editor, align);
5363
5990
  if (success) {
@@ -5377,7 +6004,7 @@ function useTextAlign(config) {
5377
6004
  }
5378
6005
 
5379
6006
  // src/ui/text-align-button/text-align-button.tsx
5380
- var import_jsx_runtime22 = require("react/jsx-runtime");
6007
+ var import_jsx_runtime24 = require("react/jsx-runtime");
5381
6008
  var TextAlignButton = ({
5382
6009
  editor: providedEditor,
5383
6010
  align,
@@ -5404,7 +6031,7 @@ var TextAlignButton = ({
5404
6031
  hideWhenUnavailable,
5405
6032
  onAligned
5406
6033
  });
5407
- const handleClick = (0, import_react43.useCallback)(
6034
+ const handleClick = (0, import_react47.useCallback)(
5408
6035
  (e) => {
5409
6036
  onClick == null ? void 0 : onClick(e);
5410
6037
  if (e.defaultPrevented) return;
@@ -5415,8 +6042,8 @@ var TextAlignButton = ({
5415
6042
  if (!isVisible) {
5416
6043
  return null;
5417
6044
  }
5418
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5419
- import_button13.IconButton,
6045
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6046
+ import_button14.IconButton,
5420
6047
  {
5421
6048
  type: "button",
5422
6049
  disabled: canAlign,
@@ -5431,19 +6058,19 @@ var TextAlignButton = ({
5431
6058
  shortcutKeys,
5432
6059
  onClick: handleClick,
5433
6060
  ...buttonProps,
5434
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, {})
6061
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, {})
5435
6062
  }
5436
6063
  );
5437
6064
  };
5438
6065
 
5439
6066
  // src/ui/undo-redo-button/undo-redo-button.tsx
5440
6067
  var import_toolbar9 = require("@kopexa/toolbar");
5441
- var import_react45 = require("react");
6068
+ var import_react49 = require("react");
5442
6069
 
5443
6070
  // src/ui/undo-redo-button/use-undo-redo.ts
5444
6071
  var import_editor_utils15 = require("@kopexa/editor-utils");
5445
- var import_icons22 = require("@kopexa/icons");
5446
- var import_react44 = require("react");
6072
+ var import_icons23 = require("@kopexa/icons");
6073
+ var import_react48 = require("react");
5447
6074
  var UNDO_REDO_SHORTCUT_KEYS = {
5448
6075
  undo: "mod+z",
5449
6076
  redo: "mod+shift+z"
@@ -5453,8 +6080,8 @@ var historyActionLabels = {
5453
6080
  redo: "Redo"
5454
6081
  };
5455
6082
  var historyIcons = {
5456
- undo: import_icons22.UndoIcon,
5457
- redo: import_icons22.RedoIcon
6083
+ undo: import_icons23.UndoIcon,
6084
+ redo: import_icons23.RedoIcon
5458
6085
  };
5459
6086
  function canExecuteUndoRedoAction(editor, action) {
5460
6087
  if (!editor || !editor.isEditable) return false;
@@ -5483,9 +6110,9 @@ function useUndoRedo(config) {
5483
6110
  onExecuted
5484
6111
  } = config;
5485
6112
  const { editor } = useTiptapEditor(providedEditor);
5486
- const [isVisible, setIsVisible] = (0, import_react44.useState)(true);
6113
+ const [isVisible, setIsVisible] = (0, import_react48.useState)(true);
5487
6114
  const canExecute = canExecuteUndoRedoAction(editor, action);
5488
- (0, import_react44.useEffect)(() => {
6115
+ (0, import_react48.useEffect)(() => {
5489
6116
  if (!editor) return;
5490
6117
  const handleUpdate = () => {
5491
6118
  setIsVisible(shouldShowButton6({ editor, hideWhenUnavailable, action }));
@@ -5496,7 +6123,7 @@ function useUndoRedo(config) {
5496
6123
  editor.off("transaction", handleUpdate);
5497
6124
  };
5498
6125
  }, [editor, hideWhenUnavailable, action]);
5499
- const handleAction = (0, import_react44.useCallback)(() => {
6126
+ const handleAction = (0, import_react48.useCallback)(() => {
5500
6127
  if (!editor) return false;
5501
6128
  const success = executeUndoRedoAction(editor, action);
5502
6129
  if (success) {
@@ -5515,7 +6142,7 @@ function useUndoRedo(config) {
5515
6142
  }
5516
6143
 
5517
6144
  // src/ui/undo-redo-button/undo-redo-button.tsx
5518
- var import_jsx_runtime23 = require("react/jsx-runtime");
6145
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5519
6146
  var UndoRedoButton = ({
5520
6147
  editor: providedEditor,
5521
6148
  action,
@@ -5534,7 +6161,7 @@ var UndoRedoButton = ({
5534
6161
  hideWhenUnavailable,
5535
6162
  onExecuted
5536
6163
  });
5537
- const handleClick = (0, import_react45.useCallback)(
6164
+ const handleClick = (0, import_react49.useCallback)(
5538
6165
  (event) => {
5539
6166
  onClick == null ? void 0 : onClick(event);
5540
6167
  if (event.defaultPrevented) return;
@@ -5545,7 +6172,7 @@ var UndoRedoButton = ({
5545
6172
  if (!isVisible) {
5546
6173
  return null;
5547
6174
  }
5548
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
6175
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5549
6176
  import_toolbar9.ToolbarButton,
5550
6177
  {
5551
6178
  type: "button",
@@ -5560,13 +6187,13 @@ var UndoRedoButton = ({
5560
6187
  onClick: handleClick,
5561
6188
  isIconOnly: true,
5562
6189
  ...buttonProps,
5563
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, {})
6190
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, {})
5564
6191
  }
5565
6192
  );
5566
6193
  };
5567
6194
 
5568
6195
  // src/presets/basic/editor-header.tsx
5569
- var import_jsx_runtime24 = require("react/jsx-runtime");
6196
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5570
6197
  var EditorHeader = ({
5571
6198
  editor: providedEditor,
5572
6199
  variant
@@ -5576,7 +6203,7 @@ var EditorHeader = ({
5576
6203
  const isMobile = (0, import_use_is_mobile2.useIsMobile)();
5577
6204
  const windowSize = useWindowSize();
5578
6205
  const { styles } = useEditorUIContext();
5579
- const toolbarRef = (0, import_react46.useRef)(null);
6206
+ const toolbarRef = (0, import_react50.useRef)(null);
5580
6207
  const bodyRect = useCursorVisibility({
5581
6208
  editor,
5582
6209
  overlayHeight: (_b = (_a = toolbarRef.current) == null ? void 0 : _a.getBoundingClientRect().height) != null ? _b : 0
@@ -5585,7 +6212,7 @@ var EditorHeader = ({
5585
6212
  return null;
5586
6213
  }
5587
6214
  const ToolbarContent = variant === "comment" ? CommentToolbarContent : variant === "field" ? FieldToolbarContent : MainToolbarContent;
5588
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: styles.toolbarContainer(), "data-slot": "editor-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6215
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: styles.toolbarContainer(), "data-slot": "editor-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5589
6216
  import_toolbar10.Toolbar,
5590
6217
  {
5591
6218
  sticky: true,
@@ -5595,54 +6222,54 @@ var EditorHeader = ({
5595
6222
  bottom: `calc(100% - ${windowSize.height - bodyRect.y}px)`
5596
6223
  } : {},
5597
6224
  className: styles.toolbar(),
5598
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ToolbarContent, {})
6225
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ToolbarContent, {})
5599
6226
  }
5600
6227
  ) });
5601
6228
  };
5602
- var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
5603
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5604
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UndoRedoButton, { action: "undo" }),
5605
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UndoRedoButton, { action: "redo" })
6229
+ var MainToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6230
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6231
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UndoRedoButton, { action: "undo" }),
6232
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UndoRedoButton, { action: "redo" })
5606
6233
  ] }),
5607
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5608
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5609
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(HeadingDropdownMenu, { levels: [1, 2, 3, 4] }),
5610
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"] }),
5611
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BlockquoteButton, {}),
5612
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CodeBlockButton, {})
6234
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6235
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6236
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(HeadingDropdownMenu, { levels: [1, 2, 3, 4] }),
6237
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"] }),
6238
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BlockquoteButton, {}),
6239
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CodeBlockButton, {})
5613
6240
  ] }),
5614
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5615
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5616
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "bold" }),
5617
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "italic" }),
5618
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "strike" }),
5619
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "code" }),
5620
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "underline" }),
5621
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ColorHighlightPopover, {}),
5622
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LinkPopover, {})
6241
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6242
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6243
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6244
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6245
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6246
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "code" }),
6247
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "underline" }),
6248
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ColorHighlightPopover, {}),
6249
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {})
5623
6250
  ] }),
5624
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5625
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableButton, {}) }),
5626
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MoreOptions, { hideWhenUnavailable: true })
6251
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6252
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableButton, {}) }),
6253
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MoreOptions, { hideWhenUnavailable: true })
5627
6254
  ] });
5628
- var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
5629
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5630
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "bold" }),
5631
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "italic" }),
5632
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "strike" }),
5633
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "code" })
6255
+ var CommentToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6256
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6257
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6258
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6259
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6260
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "code" })
5634
6261
  ] }),
5635
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5636
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5637
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LinkPopover, {}),
5638
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
6262
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6263
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6264
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {}),
6265
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ListDropdownMenu, { types: ["bulletList", "orderedList"] })
5639
6266
  ] })
5640
6267
  ] });
5641
- var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5642
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "bold" }),
5643
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "italic" }),
5644
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "strike" }),
5645
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LinkPopover, {})
6268
+ var FieldToolbarContent = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6269
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "bold" }),
6270
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "italic" }),
6271
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "strike" }),
6272
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LinkPopover, {})
5646
6273
  ] });
5647
6274
  function MoreOptions({
5648
6275
  editor: providedEditor,
@@ -5650,8 +6277,8 @@ function MoreOptions({
5650
6277
  ...props
5651
6278
  }) {
5652
6279
  const { editor } = useTiptapEditor(providedEditor);
5653
- const [show, setShow] = (0, import_react46.useState)(false);
5654
- (0, import_react46.useEffect)(() => {
6280
+ const [show, setShow] = (0, import_react50.useState)(false);
6281
+ (0, import_react50.useEffect)(() => {
5655
6282
  if (!editor) return;
5656
6283
  const handleSelectionUpdate = () => {
5657
6284
  setShow(
@@ -5670,13 +6297,13 @@ function MoreOptions({
5670
6297
  if (!show || !editor || !editor.isEditable) {
5671
6298
  return null;
5672
6299
  }
5673
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
5674
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5675
- /* @__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: [
5676
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6300
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
6301
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6302
+ /* @__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: [
6303
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5677
6304
  import_popover3.Popover.Trigger,
5678
6305
  {
5679
- render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6306
+ render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5680
6307
  import_toolbar10.ToolbarButton,
5681
6308
  {
5682
6309
  type: "button",
@@ -5688,29 +6315,29 @@ function MoreOptions({
5688
6315
  title: "More options",
5689
6316
  isIconOnly: true,
5690
6317
  ...props,
5691
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons23.MoreVerticalIcon, {})
6318
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons24.MoreVerticalIcon, {})
5692
6319
  }
5693
6320
  )
5694
6321
  }
5695
6322
  ),
5696
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6323
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5697
6324
  import_popover3.Popover.Content,
5698
6325
  {
5699
6326
  side: "top",
5700
6327
  align: "end",
5701
6328
  alignOffset: 4,
5702
6329
  sideOffset: 4,
5703
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.Toolbar, { children: [
5704
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5705
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "superscript" }),
5706
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MarkButton, { type: "subscript" })
6330
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.Toolbar, { children: [
6331
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6332
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "superscript" }),
6333
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(MarkButton, { type: "subscript" })
5707
6334
  ] }),
5708
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_toolbar10.ToolbarSeparator, {}),
5709
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_toolbar10.ToolbarGroup, { children: [
5710
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "left" }),
5711
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "center" }),
5712
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "right" }),
5713
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TextAlignButton, { align: "justify" })
6335
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_toolbar10.ToolbarSeparator, {}),
6336
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_toolbar10.ToolbarGroup, { children: [
6337
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "left" }),
6338
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "center" }),
6339
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "right" }),
6340
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TextAlignButton, { align: "justify" })
5714
6341
  ] })
5715
6342
  ] })
5716
6343
  }
@@ -5742,7 +6369,7 @@ function shouldShowMoreOptions(params) {
5742
6369
  }
5743
6370
 
5744
6371
  // src/presets/basic/index.tsx
5745
- var import_jsx_runtime25 = require("react/jsx-runtime");
6372
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5746
6373
  var BasicEditor = ({
5747
6374
  variant,
5748
6375
  bordered,
@@ -5750,28 +6377,28 @@ var BasicEditor = ({
5750
6377
  ...options
5751
6378
  }) => {
5752
6379
  const editor = useCreateEditor({ content, ...options });
5753
- const styles = (0, import_theme5.editorBasic)({ variant, bordered });
6380
+ const styles = (0, import_theme6.editorBasic)({ variant, bordered });
5754
6381
  if (!editor) {
5755
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LoadingSpinner, {});
6382
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LoadingSpinner, {});
5756
6383
  }
5757
6384
  const isBottomToolbar = variant === "field";
5758
- 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: [
5759
- !isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditorHeader, { editor, variant }),
5760
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditorContentArea, { variant }),
5761
- isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditorHeader, { editor, variant })
6385
+ 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: [
6386
+ !isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorHeader, { editor, variant }),
6387
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorContentArea, { variant }),
6388
+ isBottomToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(EditorHeader, { editor, variant })
5762
6389
  ] }) }) });
5763
6390
  };
5764
6391
  var EditorContentArea = ({ variant }) => {
5765
- const styles = (0, import_theme5.editorBasic)({ variant });
5766
- const { editor } = (0, import_react48.useContext)(import_react47.EditorContext);
6392
+ const styles = (0, import_theme6.editorBasic)({ variant });
6393
+ const { editor } = (0, import_react52.useContext)(import_react51.EditorContext);
5767
6394
  const { isDragging } = useUiEditorState(editor);
5768
6395
  useScrollToHash();
5769
6396
  if (!editor) {
5770
6397
  return null;
5771
6398
  }
5772
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: styles.wrapper(), children: [
5773
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5774
- import_react47.EditorContent,
6399
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: styles.wrapper(), children: [
6400
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
6401
+ import_react51.EditorContent,
5775
6402
  {
5776
6403
  editor,
5777
6404
  role: "presentation",
@@ -5779,17 +6406,17 @@ var EditorContentArea = ({ variant }) => {
5779
6406
  style: {
5780
6407
  cursor: isDragging ? "grabbing" : "auto"
5781
6408
  },
5782
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SlashDropdownMenu, {})
6409
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SlashDropdownMenu, {})
5783
6410
  }
5784
6411
  ),
5785
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BubbleMenu, { editor }),
5786
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LinkBubble, { editor })
6412
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BubbleMenu, { editor }),
6413
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LinkBubble, { editor })
5787
6414
  ] });
5788
6415
  };
5789
6416
  function LoadingSpinner({ text = "Connecting..." }) {
5790
- const styles = (0, import_theme5.editorSpinner)();
5791
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: styles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: styles.content(), children: [
5792
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
6417
+ const styles = (0, import_theme6.editorSpinner)();
6418
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: styles.content(), children: [
6419
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5793
6420
  "svg",
5794
6421
  {
5795
6422
  className: styles.svg(),
@@ -5797,9 +6424,9 @@ function LoadingSpinner({ text = "Connecting..." }) {
5797
6424
  fill: "none",
5798
6425
  viewBox: "0 0 24 24",
5799
6426
  children: [
5800
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("title", { children: "Loading Spinner" }),
5801
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { className: styles.circle(), cx: "12", cy: "12", r: "10" }),
5802
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
6427
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("title", { children: "Loading Spinner" }),
6428
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("circle", { className: styles.circle(), cx: "12", cy: "12", r: "10" }),
6429
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5803
6430
  "path",
5804
6431
  {
5805
6432
  className: styles.path(),
@@ -5809,13 +6436,15 @@ function LoadingSpinner({ text = "Connecting..." }) {
5809
6436
  ]
5810
6437
  }
5811
6438
  ),
5812
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: styles.text(), children: text })
6439
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: styles.text(), children: text })
5813
6440
  ] }) });
5814
6441
  }
5815
6442
  // Annotate the CommonJS export names for ESM import in node:
5816
6443
  0 && (module.exports = {
5817
6444
  CalloutNode,
5818
6445
  Editor,
6446
+ EditorFileProvider,
6447
+ ImageNode,
5819
6448
  InlineMath,
5820
6449
  MathBlock,
5821
6450
  TocNode,
@@ -5823,5 +6452,7 @@ function LoadingSpinner({ text = "Connecting..." }) {
5823
6452
  getExtensions,
5824
6453
  handleImageUpload,
5825
6454
  isAllowedUri,
5826
- sanitizeUrl
6455
+ sanitizeUrl,
6456
+ useEditorFile,
6457
+ useEditorFileRequired
5827
6458
  });