@npm-questionpro/wick-ui-editor 2.0.0-next.29 → 2.0.0-next.31

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.
@@ -1,20 +1,20 @@
1
- import { A as j, C as K, D as ce, E as de, M as ue, O as he, S as fe, T as J, _ as Q, a as V, b as ve, c as pe, d as ge, f as me, g as X, h as Y, i as Z, j as be, k as ke, l as G, m as N, n as L, o as ee, r as te, s as Ce, t as R, u as _e, v as oe, w as ie, x as Ae, y as we } from "../../sanitize-BZ0U7q7z.js";
2
- import { EditorContent as Ie, useEditor as Te, useEditorState as v } from "@tiptap/react";
3
- import f, { useCallback as D, useRef as ye, useState as P } from "react";
4
- import Se from "@tiptap/extension-image";
5
- import { TaskItem as xe, TaskList as He } from "@tiptap/extension-list";
6
- import Le from "@tiptap/extension-subscript";
7
- import Re from "@tiptap/extension-superscript";
8
- import { TableKit as Fe } from "@tiptap/extension-table";
9
- import Ee from "@tiptap/extension-text-align";
10
- import { BackgroundColor as Ne, Color as De, FontFamily as Be, FontSize as ze, LineHeight as Pe, TextStyle as Oe } from "@tiptap/extension-text-style";
11
- import Me from "@tiptap/starter-kit";
12
- import { Fragment as E, jsx as e, jsxs as h } from "react/jsx-runtime";
1
+ import { A as K, C as J, D as de, E as ue, M as he, O as fe, S as ve, T as Q, _ as V, a as X, b as pe, c as ge, d as me, f as be, g as Y, h as Z, i as G, j as ke, k as Ce, l as ee, m as D, n as R, o as te, r as oe, s as _e, t as F, u as Ae, v as ie, w as re, x as we, y as Ie } from "../../sanitize-BZ0U7q7z.js";
2
+ import { EditorContent as Te, useEditor as ye, useEditorState as v } from "@tiptap/react";
3
+ import f, { useCallback as B, useRef as Se, useState as O } from "react";
4
+ import xe from "@tiptap/extension-image";
5
+ import { TaskItem as He, TaskList as Le } from "@tiptap/extension-list";
6
+ import Re from "@tiptap/extension-subscript";
7
+ import Fe from "@tiptap/extension-superscript";
8
+ import { TableKit as Ee } from "@tiptap/extension-table";
9
+ import Ne from "@tiptap/extension-text-align";
10
+ import { BackgroundColor as De, Color as Be, FontFamily as ze, FontSize as Pe, LineHeight as Oe, TextStyle as Me } from "@tiptap/extension-text-style";
11
+ import qe from "@tiptap/starter-kit";
12
+ import { Fragment as N, jsx as e, jsxs as h } from "react/jsx-runtime";
13
13
  import { Menu as g } from "@base-ui/react/menu";
14
14
  import { Dialog as w } from "@base-ui/react/dialog";
15
- import { Switch as re } from "@base-ui/react/switch";
16
- var qe = [
17
- Me.configure({ link: {
15
+ import { Switch as ne } from "@base-ui/react/switch";
16
+ var $e = [
17
+ qe.configure({ link: {
18
18
  openOnClick: !1,
19
19
  autolink: !0,
20
20
  defaultProtocol: "https",
@@ -27,10 +27,10 @@ var qe = [
27
27
  "ftp",
28
28
  "file",
29
29
  "mailto"
30
- ], l = i.protocol.replace(":", "");
31
- if (r.includes(l) || !t.protocols.map((s) => typeof s == "string" ? s : s.scheme).includes(l)) return !1;
32
- const c = ["example-phishing.com", "malicious-site.net"], a = i.hostname;
33
- return !c.includes(a);
30
+ ], n = i.protocol.replace(":", "");
31
+ if (r.includes(n) || !t.protocols.map((s) => typeof s == "string" ? s : s.scheme).includes(n)) return !1;
32
+ const c = ["example-phishing.com", "malicious-site.net"], l = i.hostname;
33
+ return !c.includes(l);
34
34
  } catch {
35
35
  return !1;
36
36
  }
@@ -44,98 +44,98 @@ var qe = [
44
44
  }
45
45
  }
46
46
  } }),
47
- Ee.configure({ types: ["heading", "paragraph"] }),
47
+ Ne.configure({ types: ["heading", "paragraph"] }),
48
+ Fe,
48
49
  Re,
49
- Le,
50
- Oe,
50
+ Me,
51
+ Be,
51
52
  De,
52
- Ne,
53
+ Le,
53
54
  He,
54
- xe,
55
+ Oe,
55
56
  Pe,
56
57
  ze,
57
- Be,
58
- Se.configure({
58
+ xe.configure({
59
59
  resize: {
60
60
  enabled: !0,
61
61
  alwaysPreserveAspectRatio: !0
62
62
  },
63
63
  inline: !0
64
64
  }),
65
- Fe.configure({ table: { resizable: !0 } })
66
- ], O = f.createContext(null), $e = ({ editor: o, children: t, customFonts: i, isHtml: r, setIsHtml: l, htmlSourceEnabled: c }) => /* @__PURE__ */ e(O.Provider, {
65
+ Ee.configure({ table: { resizable: !0 } })
66
+ ], M = f.createContext(null), Ue = ({ editor: o, children: t, customFonts: i, isHtml: r, setIsHtml: n, htmlSourceEnabled: c }) => /* @__PURE__ */ e(M.Provider, {
67
67
  value: {
68
68
  editor: o,
69
69
  customFonts: i,
70
70
  isHtml: r,
71
- setIsHtml: l,
71
+ setIsHtml: n,
72
72
  htmlSourceEnabled: c
73
73
  },
74
74
  children: t
75
75
  }), u = () => {
76
- const o = f.useContext(O);
76
+ const o = f.useContext(M);
77
77
  if (!o) throw new Error("useToolbar must be used within a ToolbarProvider");
78
78
  return o;
79
- }, Ue = "_dropdown_k3z4n_1", We = "_dropdownItem_k3z4n_17", ae = {
80
- dropdown: Ue,
81
- dropdownItem: We
82
- }, je = "_item_wqnwe_1", Ke = { item: je }, d = f.forwardRef(function({ Icon: t, children: i, ...r }, l) {
79
+ }, We = "_dropdown_k3z4n_1", je = "_dropdownItem_k3z4n_17", se = {
80
+ dropdown: We,
81
+ dropdownItem: je
82
+ }, Ke = "_item_wqnwe_1", Je = { item: Ke }, d = f.forwardRef(function({ Icon: t, children: i, ...r }, n) {
83
83
  return /* @__PURE__ */ h("button", {
84
- ref: l,
84
+ ref: n,
85
85
  ...r,
86
- className: Ke.item,
86
+ className: Je.item,
87
87
  children: [
88
88
  t,
89
89
  " ",
90
90
  i
91
91
  ]
92
92
  });
93
- }), M = f.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
93
+ }), q = f.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
94
94
  ref: i,
95
- className: ae.dropdown,
95
+ className: se.dropdown,
96
96
  ...t,
97
97
  children: o
98
98
  }));
99
- M.displayName = "DropdownPopup";
100
- var q = f.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
99
+ q.displayName = "DropdownPopup";
100
+ var $ = f.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
101
101
  ref: i,
102
- className: ae.dropdownItem,
102
+ className: se.dropdownItem,
103
103
  ...t,
104
104
  children: o
105
105
  }));
106
- q.displayName = "DropdownItem";
107
- function $({ trigger: o, triggerTitle: t, active: i, items: r, align: l = "start", direction: c = "inline" }) {
106
+ $.displayName = "DropdownItem";
107
+ function U({ trigger: o, triggerTitle: t, active: i, items: r, align: n = "start", direction: c = "inline" }) {
108
108
  return /* @__PURE__ */ h(g.Root, { children: [/* @__PURE__ */ e(g.Trigger, {
109
109
  render: /* @__PURE__ */ e(d, {}),
110
110
  "data-active": i,
111
111
  title: t,
112
112
  children: o
113
113
  }), /* @__PURE__ */ e(g.Portal, { children: /* @__PURE__ */ e(g.Positioner, {
114
- align: l,
114
+ align: n,
115
115
  sideOffset: 4,
116
116
  children: /* @__PURE__ */ e(g.Popup, {
117
- render: /* @__PURE__ */ e(M, {}),
117
+ render: /* @__PURE__ */ e(q, {}),
118
118
  "data-inline": c === "inline" ? !0 : void 0,
119
119
  "data-block": c === "block" ? !0 : void 0,
120
120
  finalFocus: !1,
121
- children: r.map((a) => c === "block" ? /* @__PURE__ */ e(g.Item, {
122
- render: /* @__PURE__ */ e(q, {}),
123
- title: a.tooltip,
124
- "data-active": a.active,
125
- style: a.style,
126
- onClick: a.event,
127
- children: a.icon ?? a.label
128
- }, a.id) : /* @__PURE__ */ e(g.Item, {
121
+ children: r.map((l) => c === "block" ? /* @__PURE__ */ e(g.Item, {
122
+ render: /* @__PURE__ */ e($, {}),
123
+ title: l.tooltip,
124
+ "data-active": l.active,
125
+ style: l.style,
126
+ onClick: l.event,
127
+ children: l.icon ?? l.label
128
+ }, l.id) : /* @__PURE__ */ e(g.Item, {
129
129
  render: /* @__PURE__ */ e(d, {}),
130
- "data-active": a.active,
131
- title: a.tooltip,
132
- onClick: a.event,
133
- children: a.icon ?? a.label
134
- }, a.id))
130
+ "data-active": l.active,
131
+ title: l.tooltip,
132
+ onClick: l.event,
133
+ children: l.icon ?? l.label
134
+ }, l.id))
135
135
  })
136
136
  }) })] });
137
137
  }
138
- var Je = () => {
138
+ var Qe = () => {
139
139
  const { editor: o } = u(), t = v({
140
140
  editor: o,
141
141
  selector: (r) => ({
@@ -149,47 +149,47 @@ var Je = () => {
149
149
  }), i = [
150
150
  {
151
151
  id: "paragraph",
152
- icon: /* @__PURE__ */ e(J, {}),
152
+ icon: /* @__PURE__ */ e(Q, {}),
153
153
  event: () => o.chain().focus().setParagraph().run(),
154
154
  tooltip: "Paragraph",
155
155
  active: t.isParagraph
156
156
  },
157
157
  {
158
158
  id: "h1",
159
- icon: /* @__PURE__ */ e(Y, {}),
159
+ icon: /* @__PURE__ */ e(Z, {}),
160
160
  event: () => o.chain().focus().setHeading({ level: 1 }).run(),
161
161
  tooltip: "Heading 1",
162
162
  active: t.isH1
163
163
  },
164
164
  {
165
165
  id: "h2",
166
- icon: /* @__PURE__ */ e(X, {}),
166
+ icon: /* @__PURE__ */ e(Y, {}),
167
167
  event: () => o.chain().focus().setHeading({ level: 2 }).run(),
168
168
  tooltip: "Heading 2",
169
169
  active: t.isH2
170
170
  },
171
171
  {
172
172
  id: "h3",
173
- icon: /* @__PURE__ */ e(Q, {}),
173
+ icon: /* @__PURE__ */ e(V, {}),
174
174
  event: () => o.chain().focus().setHeading({ level: 3 }).run(),
175
175
  tooltip: "Heading 3",
176
176
  active: t.isH3
177
177
  },
178
178
  {
179
179
  id: "h4",
180
- icon: /* @__PURE__ */ e(oe, {}),
180
+ icon: /* @__PURE__ */ e(ie, {}),
181
181
  event: () => o.chain().focus().setHeading({ level: 4 }).run(),
182
182
  tooltip: "Heading 4",
183
183
  active: t.isH4
184
184
  }
185
185
  ];
186
- return /* @__PURE__ */ e($, {
187
- trigger: t.isH1 ? /* @__PURE__ */ e(Y, {}) : t.isH2 ? /* @__PURE__ */ e(X, {}) : t.isH3 ? /* @__PURE__ */ e(Q, {}) : t.isH4 ? /* @__PURE__ */ e(oe, {}) : /* @__PURE__ */ e(J, {}),
186
+ return /* @__PURE__ */ e(U, {
187
+ trigger: t.isH1 ? /* @__PURE__ */ e(Z, {}) : t.isH2 ? /* @__PURE__ */ e(Y, {}) : t.isH3 ? /* @__PURE__ */ e(V, {}) : t.isH4 ? /* @__PURE__ */ e(ie, {}) : /* @__PURE__ */ e(Q, {}),
188
188
  triggerTitle: "Block Style",
189
189
  active: t.isHeading,
190
190
  items: i
191
191
  });
192
- }, Qe = () => {
192
+ }, Ve = () => {
193
193
  const { editor: o } = u();
194
194
  return /* @__PURE__ */ e(d, {
195
195
  title: "Bold",
@@ -200,13 +200,13 @@ var Je = () => {
200
200
  onClick: (t) => {
201
201
  t.preventDefault(), o.chain().focus().toggleBold().run();
202
202
  },
203
- children: /* @__PURE__ */ e(pe, {})
203
+ children: /* @__PURE__ */ e(ge, {})
204
204
  });
205
- }, Ve = () => {
205
+ }, Xe = () => {
206
206
  const { editor: o } = u();
207
- return /* @__PURE__ */ e(E, { children: [{
207
+ return /* @__PURE__ */ e(N, { children: [{
208
208
  id: "clear",
209
- icon: /* @__PURE__ */ e(_e, {}),
209
+ icon: /* @__PURE__ */ e(Ae, {}),
210
210
  event: () => o.chain().focus().clearNodes().unsetAllMarks().run(),
211
211
  tooltip: "Clear Formatting"
212
212
  }].map((t) => /* @__PURE__ */ e(d, {
@@ -216,7 +216,7 @@ var Je = () => {
216
216
  },
217
217
  children: t.icon
218
218
  }, t.id)) });
219
- }, Xe = () => {
219
+ }, Ye = () => {
220
220
  const { editor: o } = u();
221
221
  return /* @__PURE__ */ e(d, {
222
222
  "data-active": v({
@@ -227,9 +227,9 @@ var Je = () => {
227
227
  onMouseDown: (t) => {
228
228
  t.preventDefault(), o.chain().focus().toggleCode().run();
229
229
  },
230
- children: /* @__PURE__ */ e(me, {})
230
+ children: /* @__PURE__ */ e(be, {})
231
231
  });
232
- }, Ye = () => {
232
+ }, Ze = () => {
233
233
  const { editor: o } = u();
234
234
  return /* @__PURE__ */ e(d, {
235
235
  title: "Italic",
@@ -240,9 +240,9 @@ var Je = () => {
240
240
  onClick: (t) => {
241
241
  t.preventDefault(), o.chain().focus().toggleItalic().run();
242
242
  },
243
- children: /* @__PURE__ */ e(Ae, {})
243
+ children: /* @__PURE__ */ e(we, {})
244
244
  });
245
- }, Ze = () => {
245
+ }, Ge = () => {
246
246
  const { editor: o } = u(), t = v({
247
247
  editor: o,
248
248
  selector: (r) => ({
@@ -254,33 +254,33 @@ var Je = () => {
254
254
  }), i = [
255
255
  {
256
256
  id: "ul",
257
- icon: /* @__PURE__ */ e(K, {}),
257
+ icon: /* @__PURE__ */ e(J, {}),
258
258
  event: () => o.chain().focus().toggleBulletList().run(),
259
259
  tooltip: "Bulleted List",
260
260
  active: t.isUl
261
261
  },
262
262
  {
263
263
  id: "ol",
264
- icon: /* @__PURE__ */ e(ie, {}),
264
+ icon: /* @__PURE__ */ e(re, {}),
265
265
  event: () => o.chain().focus().toggleOrderedList().run(),
266
266
  tooltip: "Numbered List",
267
267
  active: t.isOl
268
268
  },
269
269
  {
270
270
  id: "todo",
271
- icon: /* @__PURE__ */ e(G, {}),
271
+ icon: /* @__PURE__ */ e(ee, {}),
272
272
  event: () => o.chain().focus().toggleTaskList().run(),
273
273
  tooltip: "To-Do List",
274
274
  active: t.isTodo
275
275
  }
276
276
  ];
277
- return /* @__PURE__ */ e($, {
278
- trigger: t.isOl ? /* @__PURE__ */ e(ie, {}) : t.isTodo ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e(K, {}),
277
+ return /* @__PURE__ */ e(U, {
278
+ trigger: t.isOl ? /* @__PURE__ */ e(re, {}) : t.isTodo ? /* @__PURE__ */ e(ee, {}) : /* @__PURE__ */ e(J, {}),
279
279
  triggerTitle: "List Style",
280
280
  active: t.isList,
281
281
  items: i
282
282
  });
283
- }, Ge = () => {
283
+ }, et = () => {
284
284
  const { editor: o } = u();
285
285
  return /* @__PURE__ */ e(d, {
286
286
  title: "strikethrough",
@@ -291,9 +291,9 @@ var Je = () => {
291
291
  onClick: (t) => {
292
292
  t.preventDefault(), o.chain().focus().toggleStrike().run();
293
293
  },
294
- children: /* @__PURE__ */ e(ce, {})
294
+ children: /* @__PURE__ */ e(de, {})
295
295
  });
296
- }, et = () => {
296
+ }, tt = () => {
297
297
  const { editor: o } = u();
298
298
  return /* @__PURE__ */ e(d, {
299
299
  title: "Subscript",
@@ -304,9 +304,9 @@ var Je = () => {
304
304
  onClick: (t) => {
305
305
  t.preventDefault(), o.chain().focus().toggleSubscript().run();
306
306
  },
307
- children: /* @__PURE__ */ e(he, {})
307
+ children: /* @__PURE__ */ e(fe, {})
308
308
  });
309
- }, tt = () => {
309
+ }, ot = () => {
310
310
  const { editor: o } = u();
311
311
  return /* @__PURE__ */ e(d, {
312
312
  title: "Superscript",
@@ -317,9 +317,9 @@ var Je = () => {
317
317
  onClick: (t) => {
318
318
  t.preventDefault(), o.chain().focus().toggleSuperscript().run();
319
319
  },
320
- children: /* @__PURE__ */ e(ke, {})
320
+ children: /* @__PURE__ */ e(Ce, {})
321
321
  });
322
- }, ot = () => {
322
+ }, it = () => {
323
323
  const { editor: o } = u(), t = v({
324
324
  editor: o,
325
325
  selector: ({ editor: r }) => ({ textColor: r.getAttributes("textStyle").color })
@@ -327,14 +327,14 @@ var Je = () => {
327
327
  return /* @__PURE__ */ h(d, {
328
328
  title: "Text Color",
329
329
  onClick: () => i.current?.click(),
330
- children: [/* @__PURE__ */ e(be, { style: { color: t.textColor } }), /* @__PURE__ */ e("input", {
330
+ children: [/* @__PURE__ */ e(ke, { style: { color: t.textColor } }), /* @__PURE__ */ e("input", {
331
331
  ref: i,
332
332
  type: "color",
333
333
  defaultValue: "#545E6B",
334
334
  onChange: (r) => o.chain().focus().setColor(r.target.value).run()
335
335
  })]
336
336
  });
337
- }, it = () => {
337
+ }, rt = () => {
338
338
  const { editor: o } = u();
339
339
  return /* @__PURE__ */ e(d, {
340
340
  title: "Underline",
@@ -345,9 +345,9 @@ var Je = () => {
345
345
  onClick: (t) => {
346
346
  t.preventDefault(), o.chain().focus().toggleUnderline().run();
347
347
  },
348
- children: /* @__PURE__ */ e(ue, {})
348
+ children: /* @__PURE__ */ e(he, {})
349
349
  });
350
- }, rt = () => {
350
+ }, nt = () => {
351
351
  const { editor: o } = u(), t = v({
352
352
  editor: o,
353
353
  selector: ({ editor: r }) => ({ bgColor: r.getAttributes("textStyle").backgroundColor })
@@ -355,14 +355,14 @@ var Je = () => {
355
355
  return /* @__PURE__ */ h(d, {
356
356
  title: "Background Color",
357
357
  onClick: () => i.current?.click(),
358
- children: [/* @__PURE__ */ e(Ce, { style: { color: t.bgColor } }), /* @__PURE__ */ e("input", {
358
+ children: [/* @__PURE__ */ e(_e, { style: { color: t.bgColor } }), /* @__PURE__ */ e("input", {
359
359
  ref: i,
360
360
  type: "color",
361
361
  defaultValue: "#fff",
362
362
  onChange: (r) => o.chain().focus().setBackgroundColor(r.target.value).run()
363
363
  })]
364
364
  });
365
- }, nt = () => {
365
+ }, lt = () => {
366
366
  const { editor: o } = u();
367
367
  return /* @__PURE__ */ e(d, {
368
368
  title: "quote",
@@ -373,10 +373,10 @@ var Je = () => {
373
373
  onClick: (t) => {
374
374
  t.preventDefault(), o.chain().focus().toggleBlockquote().run();
375
375
  },
376
- children: /* @__PURE__ */ e(de, {})
376
+ children: /* @__PURE__ */ e(ue, {})
377
377
  });
378
378
  };
379
- function lt() {
379
+ function at() {
380
380
  const { isHtml: o, setIsHtml: t, htmlSourceEnabled: i } = u();
381
381
  return i ? /* @__PURE__ */ e(d, {
382
382
  title: "HTML source",
@@ -384,10 +384,10 @@ function lt() {
384
384
  onClick: (r) => {
385
385
  r.preventDefault(), t(!o);
386
386
  },
387
- children: /* @__PURE__ */ e(we, {})
387
+ children: /* @__PURE__ */ e(Ie, {})
388
388
  }) : null;
389
389
  }
390
- var at = () => {
390
+ var st = () => {
391
391
  const { editor: o } = u(), t = v({
392
392
  editor: o,
393
393
  selector: (r) => ({
@@ -400,74 +400,74 @@ var at = () => {
400
400
  }), i = [
401
401
  {
402
402
  id: "left",
403
- icon: /* @__PURE__ */ e(V, {}),
403
+ icon: /* @__PURE__ */ e(X, {}),
404
404
  event: () => o.chain().focus().setTextAlign("left").run(),
405
405
  tooltip: "Align Left",
406
406
  active: t.isLeft
407
407
  },
408
408
  {
409
409
  id: "center",
410
- icon: /* @__PURE__ */ e(te, {}),
410
+ icon: /* @__PURE__ */ e(oe, {}),
411
411
  event: () => o.chain().focus().setTextAlign("center").run(),
412
412
  tooltip: "Align Center",
413
413
  active: t.isCenter
414
414
  },
415
415
  {
416
416
  id: "right",
417
- icon: /* @__PURE__ */ e(ee, {}),
417
+ icon: /* @__PURE__ */ e(te, {}),
418
418
  event: () => o.chain().focus().setTextAlign("right").run(),
419
419
  tooltip: "Align Right",
420
420
  active: t.isRight
421
421
  },
422
422
  {
423
423
  id: "justify",
424
- icon: /* @__PURE__ */ e(Z, {}),
424
+ icon: /* @__PURE__ */ e(G, {}),
425
425
  event: () => o.chain().focus().setTextAlign("justify").run(),
426
426
  tooltip: "Justify",
427
427
  active: t.isJustify
428
428
  }
429
429
  ];
430
- return /* @__PURE__ */ e($, {
431
- trigger: t.isCenter ? /* @__PURE__ */ e(te, {}) : t.isRight ? /* @__PURE__ */ e(ee, {}) : t.isJustify ? /* @__PURE__ */ e(Z, {}) : /* @__PURE__ */ e(V, {}),
430
+ return /* @__PURE__ */ e(U, {
431
+ trigger: t.isCenter ? /* @__PURE__ */ e(oe, {}) : t.isRight ? /* @__PURE__ */ e(te, {}) : t.isJustify ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e(X, {}),
432
432
  triggerTitle: "Text Alignment",
433
433
  active: t.isAligned,
434
434
  items: i
435
435
  });
436
- }, st = "_wuContentEditor_1w25e_3", ct = "_selectedCell_1w25e_1", dt = "_tableWrapper_1w25e_1", ut = "_wuContentEditorRoot_1w25e_3", ht = "_wuContentEditorToolbar_1w25e_17", ft = "_fontSize_1w25e_38", vt = "_wuContentEditorTable_1w25e_56", x = {
437
- wuContentEditor: st,
438
- selectedCell: ct,
436
+ }, ct = "_wuContentEditor_1w25e_3", dt = "_selectedCell_1w25e_1", ut = "_tableWrapper_1w25e_1", ht = "_wuContentEditorRoot_1w25e_3", ft = "_wuContentEditorToolbar_1w25e_17", vt = "_fontSize_1w25e_38", pt = "_wuContentEditorTable_1w25e_56", S = {
437
+ wuContentEditor: ct,
438
+ selectedCell: dt,
439
439
  "column-resize-handle": "_column-resize-handle_1w25e_1",
440
- tableWrapper: dt,
440
+ tableWrapper: ut,
441
441
  "resize-cursor": "_resize-cursor_1w25e_1",
442
- wuContentEditorRoot: ut,
443
- wuContentEditorToolbar: ht,
444
- fontSize: ft,
445
- wuContentEditorTable: vt
446
- }, pt = [
442
+ wuContentEditorRoot: ht,
443
+ wuContentEditorToolbar: ft,
444
+ fontSize: vt,
445
+ wuContentEditorTable: pt
446
+ }, gt = [
447
447
  "e",
448
448
  "E",
449
449
  "+",
450
450
  "-"
451
- ], ne = 1, gt = () => {
452
- const { editor: o } = u(), [t, i] = P(16), r = v({
451
+ ], le = 1, mt = () => {
452
+ const { editor: o } = u(), [t, i] = O(16), r = v({
453
453
  editor: o,
454
454
  selector: (s) => ({ fontSize: s.editor.getAttributes("textStyle").fontSize })
455
- }), l = (s) => {
455
+ }), n = (s) => {
456
456
  o.chain().focus().setFontSize(s + "px").run();
457
457
  }, c = (s) => {
458
- const b = Math.max(ne, s);
459
- i(b), l(b);
460
- }, a = (s) => {
461
- pt.includes(s.key) ? s.preventDefault() : s.key === "Enter" && l(t);
458
+ const C = Math.max(le, s);
459
+ i(C), n(C);
460
+ }, l = (s) => {
461
+ gt.includes(s.key) ? s.preventDefault() : s.key === "Enter" && n(t);
462
462
  };
463
463
  return f.useEffect(() => {
464
464
  i(Number(r.fontSize?.replace("px", "")) || 16);
465
465
  }, [r.fontSize]), /* @__PURE__ */ h("div", {
466
- className: x.fontSize,
466
+ className: S.fontSize,
467
467
  children: [
468
468
  /* @__PURE__ */ e(d, {
469
469
  onClick: () => c(t - 1),
470
- disabled: t <= ne,
470
+ disabled: t <= le,
471
471
  children: "−"
472
472
  }),
473
473
  /* @__PURE__ */ e("input", {
@@ -475,9 +475,9 @@ var at = () => {
475
475
  inputMode: "numeric",
476
476
  pattern: "[0-9]*",
477
477
  value: t,
478
- onKeyDown: a,
478
+ onKeyDown: l,
479
479
  onChange: (s) => i(s.target.valueAsNumber),
480
- onBlur: () => l(t)
480
+ onBlur: () => n(t)
481
481
  }),
482
482
  /* @__PURE__ */ e(d, {
483
483
  onClick: () => c(t + 1),
@@ -486,10 +486,10 @@ var at = () => {
486
486
  })
487
487
  ]
488
488
  });
489
- }, mt = () => {
489
+ }, bt = () => {
490
490
  const { editor: o, customFonts: t } = u(), i = v({
491
491
  editor: o,
492
- selector: (a) => ({ currentFontFamily: a.editor.getAttributes("textStyle").fontFamily || "" })
492
+ selector: (l) => ({ currentFontFamily: l.editor.getAttributes("textStyle").fontFamily || "" })
493
493
  }), r = [
494
494
  "Fira Sans",
495
495
  "Inter",
@@ -497,250 +497,250 @@ var at = () => {
497
497
  "JetBrains Mono",
498
498
  "Montserrat",
499
499
  ...t || []
500
- ], [l, c] = P(i.currentFontFamily || r[0]);
500
+ ], [n, c] = O(i.currentFontFamily || r[0]);
501
501
  return f.useEffect(() => {
502
502
  c(i.currentFontFamily?.replace(/"/g, "") || r[0]);
503
503
  }, [i.currentFontFamily]), /* @__PURE__ */ h(g.Root, { children: [/* @__PURE__ */ e(g.Trigger, {
504
- "data-active": l !== "Fira Sans",
505
- style: { fontFamily: l },
506
- title: l || "Font Family",
504
+ "data-active": n !== "Fira Sans",
505
+ style: { fontFamily: n },
506
+ title: n || "Font Family",
507
507
  render: /* @__PURE__ */ e(d, {}),
508
- children: l?.[0]
508
+ children: n?.[0]
509
509
  }), /* @__PURE__ */ e(g.Portal, { children: /* @__PURE__ */ e(g.Positioner, {
510
510
  align: "start",
511
511
  sideOffset: 4,
512
512
  children: /* @__PURE__ */ e(g.Popup, {
513
- render: /* @__PURE__ */ e(M, {}),
513
+ render: /* @__PURE__ */ e(q, {}),
514
514
  "data-block": !0,
515
515
  finalFocus: !1,
516
- children: r.map((a) => /* @__PURE__ */ e(g.Item, {
517
- title: a,
518
- render: /* @__PURE__ */ e(q, {}),
516
+ children: r.map((l) => /* @__PURE__ */ e(g.Item, {
517
+ title: l,
518
+ render: /* @__PURE__ */ e($, {}),
519
519
  onClick: () => {
520
- o.chain().focus().setFontFamily(a).run(), c(a);
520
+ o.chain().focus().setFontFamily(l).run(), c(l);
521
521
  },
522
- children: a
523
- }, a))
522
+ children: l
523
+ }, l))
524
524
  })
525
525
  }) })] });
526
- }, bt = "_button_583n5_1", kt = { button: bt }, se = f.forwardRef(function({ children: t, variant: i, color: r, icon: l, ...c }, a) {
526
+ }, kt = "_button_583n5_1", Ct = { button: kt }, ce = f.forwardRef(function({ children: t, variant: i, color: r, icon: n, ...c }, l) {
527
527
  return /* @__PURE__ */ h("button", {
528
- ref: a,
529
- className: kt.button,
528
+ ref: l,
529
+ className: Ct.button,
530
530
  "data-variant": i,
531
531
  "data-color": r,
532
532
  ...c,
533
- children: [l, t]
533
+ children: [n, t]
534
534
  });
535
- }), Ct = "_dialog_1k05x_1", _t = "_backdrop_1k05x_27", At = "_content_1k05x_46", wt = "_footer_1k05x_52", It = "_close_1k05x_59", S = {
536
- dialog: Ct,
537
- backdrop: _t,
538
- content: At,
539
- footer: wt,
540
- close: It
535
+ }), _t = "_dialog_1k05x_1", At = "_backdrop_1k05x_27", wt = "_content_1k05x_46", It = "_footer_1k05x_52", Tt = "_close_1k05x_59", y = {
536
+ dialog: _t,
537
+ backdrop: At,
538
+ content: wt,
539
+ footer: It,
540
+ close: Tt
541
541
  };
542
- function U({ Trigger: o, children: t, maxWidth: i, onOpenChange: r, footer: l }) {
543
- const c = f.useContext(O), a = f.useCallback((s) => {
542
+ function W({ Trigger: o, children: t, maxWidth: i, onOpenChange: r, footer: n }) {
543
+ const c = f.useContext(M), l = f.useCallback((s) => {
544
544
  c?.editor.setEditable(!s, !1), r?.(s);
545
545
  }, [c, r]);
546
546
  return /* @__PURE__ */ h(w.Root, {
547
547
  modal: !0,
548
- onOpenChange: a,
548
+ onOpenChange: l,
549
549
  children: [/* @__PURE__ */ e("span", {
550
550
  onClick: (s) => s.stopPropagation(),
551
551
  children: /* @__PURE__ */ e(w.Trigger, { render: o })
552
- }), /* @__PURE__ */ h(w.Portal, { children: [/* @__PURE__ */ e(w.Backdrop, { className: S.backdrop }), /* @__PURE__ */ h(w.Popup, {
553
- className: S.dialog,
552
+ }), /* @__PURE__ */ h(w.Portal, { children: [/* @__PURE__ */ e(w.Backdrop, { className: y.backdrop }), /* @__PURE__ */ h(w.Popup, {
553
+ className: y.dialog,
554
554
  style: i ? { maxWidth: i } : void 0,
555
555
  children: [
556
556
  /* @__PURE__ */ e(w.Close, {
557
- className: S.close,
557
+ className: y.close,
558
558
  "aria-label": "Close",
559
- children: /* @__PURE__ */ e(ge, {
559
+ children: /* @__PURE__ */ e(me, {
560
560
  width: 10,
561
561
  height: 10
562
562
  })
563
563
  }),
564
564
  /* @__PURE__ */ e("div", {
565
- className: S.content,
565
+ className: y.content,
566
566
  children: t
567
567
  }),
568
- l && /* @__PURE__ */ e("footer", {
569
- className: S.footer,
570
- children: l
568
+ n && /* @__PURE__ */ e("footer", {
569
+ className: y.footer,
570
+ children: n
571
571
  })
572
572
  ]
573
573
  })] })]
574
574
  });
575
575
  }
576
- function H({ children: o, variant: t, color: i, icon: r, ...l }) {
576
+ function x({ children: o, variant: t, color: i, icon: r, ...n }) {
577
577
  return /* @__PURE__ */ e(w.Close, {
578
- render: /* @__PURE__ */ e(se, {
578
+ render: /* @__PURE__ */ e(ce, {
579
579
  variant: t,
580
580
  color: i,
581
581
  icon: r
582
582
  }),
583
- ...l,
583
+ ...n,
584
584
  children: o
585
585
  });
586
586
  }
587
- var Tt = "_group_56lao_1", yt = "_label_56lao_8", St = "_input_56lao_14", B = {
588
- group: Tt,
589
- label: yt,
590
- input: St
587
+ var yt = "_group_56lao_1", St = "_label_56lao_8", xt = "_input_56lao_14", z = {
588
+ group: yt,
589
+ label: St,
590
+ input: xt
591
591
  };
592
- function F({ label: o, id: t, ...i }) {
592
+ function E({ label: o, id: t, ...i }) {
593
593
  return /* @__PURE__ */ h("div", {
594
- className: B.group,
594
+ className: z.group,
595
595
  children: [o && /* @__PURE__ */ e("label", {
596
- className: B.label,
596
+ className: z.label,
597
597
  htmlFor: t,
598
598
  children: o
599
599
  }), /* @__PURE__ */ e("input", {
600
600
  id: t,
601
- className: B.input,
601
+ className: z.input,
602
602
  ...i
603
603
  })]
604
604
  });
605
605
  }
606
- var xt = () => {
606
+ var Ht = () => {
607
607
  const { editor: o } = u(), t = v({
608
608
  editor: o,
609
609
  selector: (s) => ({
610
610
  isImage: s.editor?.isActive("image"),
611
611
  imageAttrs: s.editor?.getAttributes("image")
612
612
  })
613
- }), [i, r] = f.useState(t.imageAttrs.src || ""), [l, c] = f.useState(t.imageAttrs.alt || ""), a = () => {
613
+ }), [i, r] = f.useState(t.imageAttrs.src || ""), [n, c] = f.useState(t.imageAttrs.alt || ""), l = () => {
614
614
  o.chain().focus().setImage({
615
615
  src: i,
616
- alt: l
616
+ alt: n
617
617
  }).run();
618
618
  };
619
- return /* @__PURE__ */ h(U, {
619
+ return /* @__PURE__ */ h(W, {
620
620
  Trigger: /* @__PURE__ */ e(d, {
621
621
  title: "Image",
622
622
  "data-active": t.isImage,
623
- children: /* @__PURE__ */ e(ve, {})
623
+ children: /* @__PURE__ */ e(pe, {})
624
624
  }),
625
625
  maxWidth: "400px",
626
- footer: /* @__PURE__ */ h(E, { children: [/* @__PURE__ */ e(H, {
626
+ footer: /* @__PURE__ */ h(N, { children: [/* @__PURE__ */ e(x, {
627
627
  variant: "secondary",
628
628
  children: "Cancel"
629
- }), /* @__PURE__ */ e(H, {
630
- onClick: a,
629
+ }), /* @__PURE__ */ e(x, {
630
+ onClick: l,
631
631
  disabled: !i,
632
632
  children: "Save"
633
633
  })] }),
634
- children: [/* @__PURE__ */ e(F, {
634
+ children: [/* @__PURE__ */ e(E, {
635
635
  label: "Image URL",
636
636
  type: "url",
637
637
  value: i,
638
638
  onChange: (s) => r(s.target.value),
639
639
  required: !0
640
- }), /* @__PURE__ */ e(F, {
640
+ }), /* @__PURE__ */ e(E, {
641
641
  label: "Alt Text",
642
642
  type: "text",
643
- value: l,
643
+ value: n,
644
644
  onChange: (s) => c(s.target.value)
645
645
  })]
646
646
  });
647
- }, Ht = () => {
647
+ }, Lt = () => {
648
648
  const { editor: o } = u(), t = v({
649
649
  editor: o,
650
- selector: (n) => ({
651
- isLink: n.editor?.isActive("link"),
652
- linkAttrs: n.editor?.getAttributes("link")
650
+ selector: (a) => ({
651
+ isLink: a.editor?.isActive("link"),
652
+ linkAttrs: a.editor?.getAttributes("link")
653
653
  })
654
- }), [i, r] = f.useState(t.linkAttrs.href || ""), [l, c] = f.useState(t.linkAttrs.alt || ""), a = (n) => !n || n.startsWith("http://") || n.startsWith("https://") ? n : `https://${n}`, s = () => {
655
- const n = a(i);
654
+ }), [i, r] = f.useState(t.linkAttrs.href || ""), [n, c] = f.useState(t.linkAttrs.alt || ""), l = (a) => !a || a.startsWith("http://") || a.startsWith("https://") ? a : `https://${a}`, s = () => {
655
+ const a = l(i);
656
656
  o.chain().focus().insertContent({
657
657
  type: "text",
658
- text: l || n,
658
+ text: n || a,
659
659
  marks: [{
660
660
  type: "link",
661
- attrs: { href: n }
661
+ attrs: { href: a }
662
662
  }]
663
663
  }).run();
664
- }, b = () => {
665
- const n = o.getAttributes("link"), { from: k, to: I, $from: y } = o.state.selection;
666
- let C;
667
- if (k !== I) C = o.state.doc.textBetween(k, I);
664
+ }, C = () => {
665
+ const a = o.getAttributes("link"), { from: m, to: A, $from: T } = o.state.selection;
666
+ let I;
667
+ if (m !== A) I = o.state.doc.textBetween(m, A);
668
668
  else {
669
- const T = y.parent.textContent, _ = y.parentOffset;
670
- let m = _, A = _;
671
- for (; m > 0 && !/\s/.test(T[m - 1]); ) m--;
672
- for (; A < T.length && !/\s/.test(T[A]); ) A++;
673
- if (C = T.slice(m, A), C) {
674
- const p = y.start();
669
+ const _ = T.parent.textContent, H = T.parentOffset;
670
+ let b = H, k = H;
671
+ for (; b > 0 && !/\s/.test(_[b - 1]); ) b--;
672
+ for (; k < _.length && !/\s/.test(_[k]); ) k++;
673
+ if (I = _.slice(b, k), I) {
674
+ const L = T.start();
675
675
  o.commands.setTextSelection({
676
- from: p + m,
677
- to: p + A
676
+ from: L + b,
677
+ to: L + k
678
678
  });
679
679
  }
680
680
  }
681
- r(n.href || ""), c(C || n.alt || "");
681
+ r(a.href || ""), c(I || a.alt || "");
682
682
  };
683
- return /* @__PURE__ */ h(U, {
683
+ return /* @__PURE__ */ h(W, {
684
684
  Trigger: /* @__PURE__ */ e(d, {
685
685
  title: "Link",
686
686
  "data-active": t.isLink,
687
- children: /* @__PURE__ */ e(fe, {})
687
+ children: /* @__PURE__ */ e(ve, {})
688
688
  }),
689
689
  maxWidth: "400px",
690
- onOpenChange: (n) => n && b(),
691
- footer: /* @__PURE__ */ h(E, { children: [t.isLink && /* @__PURE__ */ e(H, {
690
+ onOpenChange: (a) => a && C(),
691
+ footer: /* @__PURE__ */ h(N, { children: [t.isLink && /* @__PURE__ */ e(x, {
692
692
  color: "error",
693
693
  variant: "secondary",
694
694
  onClick: () => o.chain().focus().unsetLink().run(),
695
695
  children: "Remove"
696
- }), /* @__PURE__ */ e(H, {
696
+ }), /* @__PURE__ */ e(x, {
697
697
  onClick: s,
698
698
  disabled: !i,
699
699
  children: "Save"
700
700
  })] }),
701
- children: [/* @__PURE__ */ e(F, {
701
+ children: [/* @__PURE__ */ e(E, {
702
702
  label: "Link",
703
703
  type: "url",
704
704
  value: i,
705
- onChange: (n) => r(n.target.value),
705
+ onChange: (a) => r(a.target.value),
706
706
  required: !0
707
- }), /* @__PURE__ */ e(F, {
707
+ }), /* @__PURE__ */ e(E, {
708
708
  label: "Text to display",
709
709
  type: "text",
710
- value: l,
711
- onChange: (n) => c(n.target.value)
710
+ value: n,
711
+ onChange: (a) => c(a.target.value)
712
712
  })]
713
713
  });
714
- }, Lt = "_label_1kiov_1", Rt = "_root_1kiov_11", Ft = "_thumb_1kiov_44", z = {
715
- label: Lt,
716
- root: Rt,
717
- thumb: Ft
714
+ }, Rt = "_label_1kiov_1", Ft = "_root_1kiov_11", Et = "_thumb_1kiov_44", P = {
715
+ label: Rt,
716
+ root: Ft,
717
+ thumb: Et
718
718
  };
719
- function Et({ checked: o, onCheckedChange: t, label: i }) {
719
+ function Nt({ checked: o, onCheckedChange: t, label: i }) {
720
720
  return /* @__PURE__ */ h("label", {
721
- className: z.label,
722
- children: [/* @__PURE__ */ e("span", { children: i }), /* @__PURE__ */ e(re.Root, {
723
- className: z.root,
721
+ className: P.label,
722
+ children: [/* @__PURE__ */ e("span", { children: i }), /* @__PURE__ */ e(ne.Root, {
723
+ className: P.root,
724
724
  checked: o,
725
725
  onCheckedChange: t,
726
- children: /* @__PURE__ */ e(re.Thumb, { className: z.thumb })
726
+ children: /* @__PURE__ */ e(ne.Thumb, { className: P.thumb })
727
727
  })]
728
728
  });
729
729
  }
730
- var Nt = () => {
730
+ var Dt = () => {
731
731
  const { editor: o } = u(), t = v({
732
732
  editor: o,
733
- selector: (n) => ({
734
- isTable: n.editor.isActive("table"),
735
- tableAttrs: n.editor.getAttributes("table")
733
+ selector: (a) => ({
734
+ isTable: a.editor.isActive("table"),
735
+ tableAttrs: a.editor.getAttributes("table")
736
736
  })
737
- }), [i, r] = P(!1), l = ye(null), c = D((n) => {
738
- l.current && clearTimeout(l.current), l.current = setTimeout(n, 100);
737
+ }), [i, r] = O(!1), n = Se(null), c = B((a) => {
738
+ n.current && clearTimeout(n.current), n.current = setTimeout(a, 100);
739
739
  }, []);
740
740
  f.useEffect(() => () => {
741
- l.current && clearTimeout(l.current);
741
+ n.current && clearTimeout(n.current);
742
742
  }, []);
743
- const a = D(() => {
743
+ const l = B(() => {
744
744
  c(() => o.chain().focus().insertTable({
745
745
  rows: 2,
746
746
  cols: 4,
@@ -750,99 +750,99 @@ var Nt = () => {
750
750
  o,
751
751
  i,
752
752
  c
753
- ]), s = D(() => {
754
- r((n) => !n), c(() => o.chain().focus().toggleHeaderRow().run());
755
- }, [o, c]), b = [
753
+ ]), s = B(() => {
754
+ r((a) => !a), c(() => o.chain().focus().toggleHeaderRow().run());
755
+ }, [o, c]), C = [
756
756
  {
757
757
  text: "Column left",
758
- icon: /* @__PURE__ */ e(L, {}),
758
+ icon: /* @__PURE__ */ e(R, {}),
759
759
  event: () => o.chain().focus().addColumnBefore().run()
760
760
  },
761
761
  {
762
762
  text: "Row above",
763
- icon: /* @__PURE__ */ e(L, {}),
763
+ icon: /* @__PURE__ */ e(R, {}),
764
764
  event: () => o.chain().focus().addRowBefore().run()
765
765
  },
766
766
  {
767
767
  text: "Column right",
768
- icon: /* @__PURE__ */ e(L, {}),
768
+ icon: /* @__PURE__ */ e(R, {}),
769
769
  event: () => o.chain().focus().addColumnAfter().run()
770
770
  },
771
771
  {
772
772
  text: "Row below",
773
- icon: /* @__PURE__ */ e(L, {}),
773
+ icon: /* @__PURE__ */ e(R, {}),
774
774
  event: () => o.chain().focus().addRowAfter().run()
775
775
  },
776
776
  {
777
777
  text: "Delete Column",
778
- icon: /* @__PURE__ */ e(N, {}),
778
+ icon: /* @__PURE__ */ e(D, {}),
779
779
  event: () => o.chain().focus().deleteColumn().run()
780
780
  },
781
781
  {
782
782
  text: "Delete Row",
783
- icon: /* @__PURE__ */ e(N, {}),
783
+ icon: /* @__PURE__ */ e(D, {}),
784
784
  event: () => o.chain().focus().deleteRow().run()
785
785
  }
786
786
  ];
787
- return t.isTable ? /* @__PURE__ */ h(U, {
787
+ return t.isTable ? /* @__PURE__ */ h(W, {
788
788
  Trigger: /* @__PURE__ */ e(d, {
789
789
  title: "Table",
790
790
  "data-active": t.isTable,
791
- children: /* @__PURE__ */ e(j, {})
791
+ children: /* @__PURE__ */ e(K, {})
792
792
  }),
793
793
  maxWidth: "320px",
794
- footer: /* @__PURE__ */ e(H, {
794
+ footer: /* @__PURE__ */ e(x, {
795
795
  variant: "secondary",
796
796
  color: "error",
797
- icon: /* @__PURE__ */ e(N, {}),
797
+ icon: /* @__PURE__ */ e(D, {}),
798
798
  onClick: () => o.chain().focus().deleteTable().run(),
799
799
  children: "Delete Table"
800
800
  }),
801
- children: [/* @__PURE__ */ e(Et, {
801
+ children: [/* @__PURE__ */ e(Nt, {
802
802
  checked: i,
803
803
  onCheckedChange: s,
804
804
  label: "Title Row"
805
805
  }), /* @__PURE__ */ e("div", {
806
- className: x.wuContentEditorTable,
807
- children: b.map(({ text: n, icon: k, event: I }) => /* @__PURE__ */ e(se, {
808
- onClick: I,
806
+ className: S.wuContentEditorTable,
807
+ children: C.map(({ text: a, icon: m, event: A }) => /* @__PURE__ */ e(ce, {
808
+ onClick: A,
809
809
  variant: "secondary",
810
- icon: k,
811
- children: n
812
- }, n))
810
+ icon: m,
811
+ children: a
812
+ }, a))
813
813
  })]
814
814
  }) : /* @__PURE__ */ e(d, {
815
815
  title: "Table",
816
- onClick: a,
817
- children: /* @__PURE__ */ e(j, {})
816
+ onClick: l,
817
+ children: /* @__PURE__ */ e(K, {})
818
818
  });
819
- }, le = {
820
- block: /* @__PURE__ */ e(Je, {}),
821
- fontFamily: /* @__PURE__ */ e(mt, {}),
822
- fontSize: /* @__PURE__ */ e(gt, {}),
823
- bold: /* @__PURE__ */ e(Qe, {}),
824
- italic: /* @__PURE__ */ e(Ye, {}),
825
- underline: /* @__PURE__ */ e(it, {}),
826
- strike: /* @__PURE__ */ e(Ge, {}),
827
- color: /* @__PURE__ */ e(ot, {}),
828
- bgColor: /* @__PURE__ */ e(rt, {}),
829
- list: /* @__PURE__ */ e(Ze, {}),
830
- alignment: /* @__PURE__ */ e(at, {}),
831
- image: /* @__PURE__ */ e(xt, {}),
832
- link: /* @__PURE__ */ e(Ht, {}),
833
- table: /* @__PURE__ */ e(Nt, {}),
834
- blockquote: /* @__PURE__ */ e(nt, {}),
835
- superscript: /* @__PURE__ */ e(tt, {}),
836
- subscript: /* @__PURE__ */ e(et, {}),
837
- codeline: /* @__PURE__ */ e(Xe, {}),
838
- clear: /* @__PURE__ */ e(Ve, {}),
819
+ }, ae = {
820
+ block: /* @__PURE__ */ e(Qe, {}),
821
+ fontFamily: /* @__PURE__ */ e(bt, {}),
822
+ fontSize: /* @__PURE__ */ e(mt, {}),
823
+ bold: /* @__PURE__ */ e(Ve, {}),
824
+ italic: /* @__PURE__ */ e(Ze, {}),
825
+ underline: /* @__PURE__ */ e(rt, {}),
826
+ strike: /* @__PURE__ */ e(et, {}),
827
+ color: /* @__PURE__ */ e(it, {}),
828
+ bgColor: /* @__PURE__ */ e(nt, {}),
829
+ list: /* @__PURE__ */ e(Ge, {}),
830
+ alignment: /* @__PURE__ */ e(st, {}),
831
+ image: /* @__PURE__ */ e(Ht, {}),
832
+ link: /* @__PURE__ */ e(Lt, {}),
833
+ table: /* @__PURE__ */ e(Dt, {}),
834
+ blockquote: /* @__PURE__ */ e(lt, {}),
835
+ superscript: /* @__PURE__ */ e(ot, {}),
836
+ subscript: /* @__PURE__ */ e(tt, {}),
837
+ codeline: /* @__PURE__ */ e(Ye, {}),
838
+ clear: /* @__PURE__ */ e(Xe, {}),
839
839
  "|": /* @__PURE__ */ e("div", { style: {
840
840
  height: 16,
841
841
  width: 1,
842
842
  background: "var(--we-border)"
843
843
  } }),
844
- html: /* @__PURE__ */ e(lt, {})
845
- }, Dt = [
844
+ html: /* @__PURE__ */ e(at, {})
845
+ }, Bt = [
846
846
  "block",
847
847
  "fontFamily",
848
848
  "|",
@@ -870,80 +870,81 @@ var Nt = () => {
870
870
  "|",
871
871
  "html",
872
872
  "clear"
873
- ], Bt = (o) => {
874
- const { editor: t, customFonts: i, children: r, items: l = Dt, isHtml: c, setIsHtml: a, htmlSourceEnabled: s, ...b } = o;
873
+ ], zt = (o) => {
874
+ const { editor: t, customFonts: i, children: r, items: n = Bt, isHtml: c, setIsHtml: l, htmlSourceEnabled: s, ...C } = o;
875
875
  return /* @__PURE__ */ e("div", {
876
- ...b,
877
- children: /* @__PURE__ */ h($e, {
876
+ ...C,
877
+ children: /* @__PURE__ */ h(Ue, {
878
878
  editor: t,
879
879
  customFonts: i,
880
880
  isHtml: c,
881
- setIsHtml: a,
881
+ setIsHtml: l,
882
882
  htmlSourceEnabled: s,
883
- children: [l.map((n, k) => /* @__PURE__ */ e(E, { children: c && n !== "html" ? /* @__PURE__ */ e("span", {
883
+ children: [n.map((a, m) => /* @__PURE__ */ e(N, { children: c && a !== "html" ? /* @__PURE__ */ e("span", {
884
884
  style: {
885
885
  pointerEvents: "none",
886
886
  opacity: 0.4
887
887
  },
888
- children: le[n]
889
- }) : le[n] }, n + k)), r]
888
+ children: ae[a]
889
+ }) : ae[a] }, a + m)), r]
890
890
  })
891
891
  });
892
892
  };
893
- function zt(...o) {
893
+ function Pt(...o) {
894
894
  return o.filter(Boolean).join(" ");
895
895
  }
896
- function Gt({ defaultValue: o, onUpdate: t, className: i, toolbarPosition: r = "top", customToolbarChildren: l, toolbarItems: c, hideToolbar: a, readonly: s, customFonts: b, htmlSource: n, isHtml: k, setIsHtml: I, ...y }) {
897
- const [C, T] = f.useState((k ?? !1) && !!n);
898
- process.env.NODE_ENV !== "production" && k && !n && console.warn('[WuContentEditor]: `isHtml` has no effect without an `htmlSource` component. Import {WuHtmlSource} from "@npm-questionpro/wick-ui-editor/html" and pass it as `htmlSource`.');
899
- const _ = f.useRef(o || ""), m = Te({
896
+ function eo({ defaultValue: o, onUpdate: t, className: i, toolbarPosition: r = "top", customToolbarChildren: n, toolbarItems: c, hideToolbar: l, readonly: s, autoFocus: C, customFonts: a, htmlSource: m, isHtml: A, setIsHtml: T, ...I }) {
897
+ const [_, H] = f.useState((A ?? !1) && !!m);
898
+ process.env.NODE_ENV !== "production" && A && !m && console.warn('[WuContentEditor]: `isHtml` has no effect without an `htmlSource` component. Import {WuHtmlSource} from "@npm-questionpro/wick-ui-editor/html" and pass it as `htmlSource`.');
899
+ const b = f.useRef(o || ""), k = ye({
900
900
  editable: !s,
901
- extensions: qe,
902
- content: R(o || ""),
901
+ autofocus: C ? "end" : !1,
902
+ extensions: $e,
903
+ content: F(o || ""),
903
904
  onUpdate: ({ editor: p }) => {
904
- t && t(R(p.getHTML()));
905
+ t && t(F(p.getHTML()));
905
906
  }
906
- }), A = (p) => {
907
- p ? _.current = m?.getHTML() ?? "" : m?.commands.setContent(R(_.current)), t && t(R(_.current)), T(p), I?.(p);
907
+ }), L = (p) => {
908
+ p ? b.current = k?.getHTML() ?? "" : k?.commands.setContent(F(b.current)), t && t(F(b.current)), H(p), T?.(p);
908
909
  };
909
910
  return /* @__PURE__ */ h("div", {
910
- className: zt(x.wuContentEditorRoot, i),
911
+ className: Pt(S.wuContentEditorRoot, i),
911
912
  "data-position": r,
912
913
  "data-slot": "wu-content-editor-root",
913
914
  onClick: (p) => {
914
915
  if ((p.ctrlKey || p.metaKey) && p.target instanceof HTMLElement) {
915
- const W = p.target.closest("a");
916
- if (W?.href) {
917
- window.open(W.href, "_blank", "noopener,noreferrer");
916
+ const j = p.target.closest("a");
917
+ if (j?.href) {
918
+ window.open(j.href, "_blank", "noopener,noreferrer");
918
919
  return;
919
920
  }
920
921
  }
921
- C || m?.chain().focus().run();
922
+ _ || k?.chain().focus().run();
922
923
  },
923
- ...y,
924
- children: [!a && /* @__PURE__ */ e(Bt, {
925
- editor: m,
926
- customFonts: b,
927
- className: x.wuContentEditorToolbar,
924
+ ...I,
925
+ children: [!l && /* @__PURE__ */ e(zt, {
926
+ editor: k,
927
+ customFonts: a,
928
+ className: S.wuContentEditorToolbar,
928
929
  items: c,
929
- isHtml: C,
930
- setIsHtml: A,
931
- htmlSourceEnabled: !!n,
930
+ isHtml: _,
931
+ setIsHtml: L,
932
+ htmlSourceEnabled: !!m,
932
933
  "data-slot": "wu-content-editor-toolbar",
933
- children: l
934
- }), C && n ? /* @__PURE__ */ e(n, {
935
- defaultValue: _.current,
934
+ children: n
935
+ }), _ && m ? /* @__PURE__ */ e(m, {
936
+ defaultValue: b.current,
936
937
  onUpdate: (p) => {
937
- _.current = p ?? "", t && t(p ?? "");
938
+ b.current = p ?? "", t && t(p ?? "");
938
939
  },
939
940
  readonly: s
940
- }) : /* @__PURE__ */ e(Ie, {
941
- editor: m,
942
- className: x.wuContentEditor,
941
+ }) : /* @__PURE__ */ e(Te, {
942
+ editor: k,
943
+ className: S.wuContentEditor,
943
944
  "data-slot": "wu-content-editor"
944
945
  })]
945
946
  });
946
947
  }
947
948
  export {
948
- Gt as WuContentEditor
949
+ eo as WuContentEditor
949
950
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm-questionpro/wick-ui-editor",
3
- "version": "2.0.0-next.29",
3
+ "version": "2.0.0-next.31",
4
4
  "description": "Wick Editor is a powerful and intuitive content editing component built with React. It provides a rich set of features for creating and managing content, making it ideal for applications that require dynamic and interactive content creation.",
5
5
  "keywords": [
6
6
  "react",
@@ -97,7 +97,7 @@
97
97
  "vite-bundle-analyzer": "^0.22.3",
98
98
  "vite-plugin-dts": "^4.5.4",
99
99
  "vitest": "^4.1.8",
100
- "@npm-questionpro/wick-ui-lib": "2.0.0-next.29",
100
+ "@npm-questionpro/wick-ui-lib": "2.0.0-next.31",
101
101
  "@npm-questionpro/wick-ui-eslint-config": "1.0.0",
102
102
  "@wick-ui/tsconfig": "1.0.0"
103
103
  },