@npm-questionpro/wick-ui-editor 2.11.0 → 2.13.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.
@@ -1,20 +1,20 @@
1
- import { A as j, C as K, D as ue, E as fe, M as ve, O as he, S as pe, T as J, _ as Q, a as X, b as ge, c as me, d as be, f as Ce, g as Y, h as Z, i as G, j as ke, k as _e, l as V, m as D, n as L, o as ee, r as te, s as Ae, t as R, u as we, v as oe, w as ie, x as ye, y as Ie } from "../../sanitize-BZ0U7q7z.js";
2
- import { EditorContent as Te, useEditor as Se, useEditorState as g } from "@tiptap/react";
3
- import u, { useCallback as B, useRef as xe, useState as O } from "react";
4
- import Fe 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 Ee from "@tiptap/extension-superscript";
8
- import { TableKit as Ne } from "@tiptap/extension-table";
9
- import ze from "@tiptap/extension-text-align";
10
- import { BackgroundColor as De, Color as Be, FontFamily as Pe, FontSize as Me, LineHeight as Oe, TextStyle as $e } from "@tiptap/extension-text-style";
11
- import qe from "@tiptap/starter-kit";
12
- import { Fragment as N, jsx as e, jsxs as p } from "react/jsx-runtime";
13
- import { Menu as w } from "@base-ui/react/menu";
14
- import { Dialog as y } from "@base-ui/react/dialog";
1
+ import { A as fe, C as j, D as ve, E as pe, O as ge, S as K, T as me, _ as Z, a as J, b as be, c as Y, d as Ce, g as G, h as Q, i as X, j as ae, k as V, l as ke, m as ee, n as L, o as te, p as P, r as oe, s as _e, t as z, u as Ae, v as Te, w as ie, x as we, y as ye } from "../../sanitize-BBFSRhAk.js";
2
+ import { EditorContent as Ie, useEditor as Se, useEditorState as g } from "@tiptap/react";
3
+ import u, { useCallback as B, useRef as xe, useState as M } from "react";
4
+ import He from "@tiptap/extension-image";
5
+ import { TaskItem as Fe, TaskList as Le } from "@tiptap/extension-list";
6
+ import ze from "@tiptap/extension-subscript";
7
+ import Re 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 Pe, Color as Be, FontFamily as De, FontSize as qe, LineHeight as Me, TextStyle as Oe } from "@tiptap/extension-text-style";
11
+ import $e from "@tiptap/starter-kit";
12
+ import { Fragment as E, jsx as e, jsxs as p } from "react/jsx-runtime";
13
+ import { Menu as T } from "@base-ui/react/menu";
14
+ import { Dialog as w } from "@base-ui/react/dialog";
15
15
  import { Switch as re } from "@base-ui/react/switch";
16
16
  var Ue = [
17
- qe.configure({ link: {
17
+ $e.configure({ link: {
18
18
  openOnClick: !1,
19
19
  autolink: !0,
20
20
  defaultProtocol: "https",
@@ -28,9 +28,9 @@ var Ue = [
28
28
  "file",
29
29
  "mailto"
30
30
  ], n = i.protocol.replace(":", "");
31
- if (r.includes(n) || !t.protocols.map((d) => typeof d == "string" ? d : d.scheme).includes(n)) return !1;
32
- const s = ["example-phishing.com", "malicious-site.net"], l = i.hostname;
33
- return !s.includes(l);
31
+ if (r.includes(n) || !t.protocols.map((c) => typeof c == "string" ? c : c.scheme).includes(n)) return !1;
32
+ const l = ["example-phishing.com", "malicious-site.net"], a = i.hostname;
33
+ return !l.includes(a);
34
34
  } catch {
35
35
  return !1;
36
36
  }
@@ -44,102 +44,111 @@ var Ue = [
44
44
  }
45
45
  }
46
46
  } }),
47
- ze.configure({ types: ["heading", "paragraph"] }),
48
- Ee,
49
- Re,
50
- $e,
47
+ Ne.configure({ types: [
48
+ "heading",
49
+ "paragraph",
50
+ "listItem",
51
+ "taskItem"
52
+ ] }),
53
+ Re.extend({ excludes: "subscript" }),
54
+ ze.extend({ excludes: "superscript" }),
55
+ Oe,
51
56
  Be,
52
- De,
57
+ Pe,
53
58
  Le,
54
- He,
55
- Oe,
59
+ Fe,
56
60
  Me,
57
- Pe,
58
- Fe.configure({
61
+ qe,
62
+ De,
63
+ He.configure({
59
64
  resize: {
60
65
  enabled: !0,
61
66
  alwaysPreserveAspectRatio: !0
62
67
  },
63
68
  inline: !0
64
69
  }),
65
- Ne.configure({ table: { resizable: !0 } })
66
- ], $ = u.createContext(null), We = ({ editor: o, children: t, customFonts: i, defaultValues: r, isHtml: n, setIsHtml: s, htmlSourceEnabled: l }) => /* @__PURE__ */ e($.Provider, {
70
+ Ee.configure({ table: { resizable: !0 } })
71
+ ], O = u.createContext(null), We = ({ editor: o, children: t, customFonts: i, defaultValues: r, isHtml: n, setIsHtml: l, htmlSourceEnabled: a }) => /* @__PURE__ */ e(O.Provider, {
67
72
  value: {
68
73
  editor: o,
69
74
  customFonts: i,
70
75
  defaultValues: r,
71
76
  isHtml: n,
72
- setIsHtml: s,
73
- htmlSourceEnabled: l
77
+ setIsHtml: l,
78
+ htmlSourceEnabled: a
74
79
  },
75
80
  children: t
76
- }), v = () => {
77
- const o = u.useContext($);
81
+ }), f = () => {
82
+ const o = u.useContext(O);
78
83
  if (!o) throw new Error("useToolbar must be used within a ToolbarProvider");
79
84
  return o;
80
- }, je = "_dropdown_sx3z9_1", Ke = "_dropdownItem_sx3z9_17", Je = "_dropdownPositioner_sx3z9_29", q = {
85
+ }, je = "_dropdown_sx3z9_1", Ke = "_dropdownItem_sx3z9_17", Ze = "_dropdownPositioner_sx3z9_29", $ = {
81
86
  dropdown: je,
82
87
  dropdownItem: Ke,
83
- dropdownPositioner: Je
84
- }, Qe = "_item_wqnwe_1", Xe = { item: Qe }, f = u.forwardRef(function({ Icon: t, children: i, ...r }, n) {
85
- return /* @__PURE__ */ p("button", {
86
- ref: n,
87
- ...r,
88
- className: Xe.item,
89
- children: [
90
- t,
91
- " ",
92
- i
93
- ]
88
+ dropdownPositioner: Ze
89
+ }, Je = "_item_wqnwe_1", Ye = { item: Je }, h = u.forwardRef(function({ Icon: t, children: i, title: r, ...n }, l) {
90
+ return /* @__PURE__ */ e(ae, {
91
+ content: r,
92
+ children: /* @__PURE__ */ p("button", {
93
+ ref: l,
94
+ "aria-label": r,
95
+ ...n,
96
+ className: Ye.item,
97
+ children: [
98
+ t,
99
+ " ",
100
+ i
101
+ ]
102
+ })
94
103
  });
95
- }), ae = u.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
104
+ }), se = u.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
96
105
  ref: i,
97
- className: q.dropdown,
106
+ className: $.dropdown,
98
107
  ...t,
99
108
  children: o
100
109
  }));
101
- ae.displayName = "DropdownPopup";
102
- var se = u.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
110
+ se.displayName = "DropdownPopup";
111
+ var ce = u.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
103
112
  ref: i,
104
- className: q.dropdownItem,
113
+ className: $.dropdownItem,
105
114
  ...t,
106
115
  children: o
107
116
  }));
108
- se.displayName = "DropdownItem";
109
- function z({ trigger: o, triggerTitle: t, active: i, items: r, align: n = "start", direction: s = "inline" }) {
110
- return /* @__PURE__ */ p(w.Root, { children: [/* @__PURE__ */ e(w.Trigger, {
111
- render: /* @__PURE__ */ e(f, {}),
117
+ ce.displayName = "DropdownItem";
118
+ function N({ trigger: o, triggerTitle: t, active: i, items: r, align: n = "start", direction: l = "inline" }) {
119
+ return /* @__PURE__ */ p(T.Root, { children: [/* @__PURE__ */ e(T.Trigger, {
120
+ render: /* @__PURE__ */ e(h, {}),
112
121
  "data-active": i,
113
122
  title: t,
114
123
  children: o
115
- }), /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ e(w.Positioner, {
124
+ }), /* @__PURE__ */ e(T.Portal, { children: /* @__PURE__ */ e(T.Positioner, {
116
125
  align: n,
117
126
  sideOffset: 4,
118
- className: q.dropdownPositioner,
119
- children: /* @__PURE__ */ e(w.Popup, {
120
- render: /* @__PURE__ */ e(ae, {}),
121
- "data-inline": s === "inline" ? !0 : void 0,
122
- "data-block": s === "block" ? !0 : void 0,
127
+ className: $.dropdownPositioner,
128
+ children: /* @__PURE__ */ e(T.Popup, {
129
+ render: /* @__PURE__ */ e(se, {}),
130
+ "data-inline": l === "inline" ? !0 : void 0,
131
+ "data-block": l === "block" ? !0 : void 0,
123
132
  finalFocus: !1,
124
- children: r.map((l) => s === "block" ? /* @__PURE__ */ e(w.Item, {
125
- render: /* @__PURE__ */ e(se, {}),
126
- title: l.tooltip,
127
- "data-active": l.active,
128
- style: l.style,
129
- onClick: l.event,
130
- children: l.icon ?? l.label
131
- }, l.id) : /* @__PURE__ */ e(w.Item, {
132
- render: /* @__PURE__ */ e(f, {}),
133
- "data-active": l.active,
134
- title: l.tooltip,
135
- onClick: l.event,
136
- children: l.icon ?? l.label
137
- }, l.id))
133
+ children: r.map((a) => l === "block" ? /* @__PURE__ */ e(T.Item, {
134
+ render: /* @__PURE__ */ e(ce, {}),
135
+ title: a.tooltip,
136
+ "data-active": a.active,
137
+ style: a.style,
138
+ onClick: a.event,
139
+ children: a.icon ?? a.label
140
+ }, a.id) : /* @__PURE__ */ e(T.Item, {
141
+ render: /* @__PURE__ */ e(h, {}),
142
+ "data-active": a.active,
143
+ title: a.tooltip,
144
+ onClick: a.event,
145
+ children: a.icon ?? a.label
146
+ }, a.id))
138
147
  })
139
148
  }) })] });
140
149
  }
141
- var Ye = () => {
142
- const { editor: o } = v(), t = g({
150
+ var Ge = () => {
151
+ const { editor: o } = f(), t = g({
143
152
  editor: o,
144
153
  selector: (r) => ({
145
154
  isParagraph: r.editor?.isActive("paragraph"),
@@ -152,49 +161,49 @@ var Ye = () => {
152
161
  }), i = [
153
162
  {
154
163
  id: "paragraph",
155
- icon: /* @__PURE__ */ e(J, {}),
164
+ icon: /* @__PURE__ */ e(ie, {}),
156
165
  event: () => o.chain().focus().setParagraph().run(),
157
166
  tooltip: "Paragraph",
158
167
  active: t.isParagraph
159
168
  },
160
169
  {
161
170
  id: "h1",
162
- icon: /* @__PURE__ */ e(Z, {}),
171
+ icon: /* @__PURE__ */ e(ee, {}),
163
172
  event: () => o.chain().focus().setHeading({ level: 1 }).run(),
164
173
  tooltip: "Heading 1",
165
174
  active: t.isH1
166
175
  },
167
176
  {
168
177
  id: "h2",
169
- icon: /* @__PURE__ */ e(Y, {}),
178
+ icon: /* @__PURE__ */ e(Q, {}),
170
179
  event: () => o.chain().focus().setHeading({ level: 2 }).run(),
171
180
  tooltip: "Heading 2",
172
181
  active: t.isH2
173
182
  },
174
183
  {
175
184
  id: "h3",
176
- icon: /* @__PURE__ */ e(Q, {}),
185
+ icon: /* @__PURE__ */ e(G, {}),
177
186
  event: () => o.chain().focus().setHeading({ level: 3 }).run(),
178
187
  tooltip: "Heading 3",
179
188
  active: t.isH3
180
189
  },
181
190
  {
182
191
  id: "h4",
183
- icon: /* @__PURE__ */ e(oe, {}),
192
+ icon: /* @__PURE__ */ e(Z, {}),
184
193
  event: () => o.chain().focus().setHeading({ level: 4 }).run(),
185
194
  tooltip: "Heading 4",
186
195
  active: t.isH4
187
196
  }
188
197
  ];
189
- return /* @__PURE__ */ e(z, {
190
- trigger: t.isH1 ? /* @__PURE__ */ e(Z, {}) : t.isH2 ? /* @__PURE__ */ e(Y, {}) : t.isH3 ? /* @__PURE__ */ e(Q, {}) : t.isH4 ? /* @__PURE__ */ e(oe, {}) : /* @__PURE__ */ e(J, {}),
198
+ return /* @__PURE__ */ e(N, {
199
+ trigger: t.isH1 ? /* @__PURE__ */ e(ee, {}) : t.isH2 ? /* @__PURE__ */ e(Q, {}) : t.isH3 ? /* @__PURE__ */ e(G, {}) : t.isH4 ? /* @__PURE__ */ e(Z, {}) : /* @__PURE__ */ e(ie, {}),
191
200
  triggerTitle: "Block Style",
192
201
  active: t.isHeading,
193
202
  items: i
194
203
  });
195
- }, Ze = () => {
196
- const { editor: o } = v();
197
- return /* @__PURE__ */ e(f, {
204
+ }, Qe = () => {
205
+ const { editor: o } = f();
206
+ return /* @__PURE__ */ e(h, {
198
207
  title: "Bold",
199
208
  "data-active": g({
200
209
  editor: o,
@@ -203,16 +212,16 @@ var Ye = () => {
203
212
  onClick: (t) => {
204
213
  t.preventDefault(), o.chain().focus().toggleBold().run();
205
214
  },
206
- children: /* @__PURE__ */ e(me, {})
215
+ children: /* @__PURE__ */ e(_e, {})
207
216
  });
208
- }, Ge = () => {
209
- const { editor: o } = v();
210
- return /* @__PURE__ */ e(N, { children: [{
217
+ }, Xe = () => {
218
+ const { editor: o } = f();
219
+ return /* @__PURE__ */ e(E, { children: [{
211
220
  id: "clear",
212
- icon: /* @__PURE__ */ e(we, {}),
221
+ icon: /* @__PURE__ */ e(ke, {}),
213
222
  event: () => o.chain().focus().clearNodes().unsetAllMarks().run(),
214
223
  tooltip: "Clear Formatting"
215
- }].map((t) => /* @__PURE__ */ e(f, {
224
+ }].map((t) => /* @__PURE__ */ e(h, {
216
225
  title: t.tooltip,
217
226
  onClick: (i) => {
218
227
  i.preventDefault(), t.event();
@@ -220,8 +229,8 @@ var Ye = () => {
220
229
  children: t.icon
221
230
  }, t.id)) });
222
231
  }, Ve = () => {
223
- const { editor: o } = v();
224
- return /* @__PURE__ */ e(f, {
232
+ const { editor: o } = f();
233
+ return /* @__PURE__ */ e(h, {
225
234
  "data-active": g({
226
235
  editor: o,
227
236
  selector: (t) => ({ code: t.editor.isActive("code") })
@@ -233,8 +242,8 @@ var Ye = () => {
233
242
  children: /* @__PURE__ */ e(Ce, {})
234
243
  });
235
244
  }, et = () => {
236
- const { editor: o } = v();
237
- return /* @__PURE__ */ e(f, {
245
+ const { editor: o } = f();
246
+ return /* @__PURE__ */ e(h, {
238
247
  title: "Italic",
239
248
  "data-active": g({
240
249
  editor: o,
@@ -243,10 +252,10 @@ var Ye = () => {
243
252
  onClick: (t) => {
244
253
  t.preventDefault(), o.chain().focus().toggleItalic().run();
245
254
  },
246
- children: /* @__PURE__ */ e(ye, {})
255
+ children: /* @__PURE__ */ e(be, {})
247
256
  });
248
257
  }, tt = () => {
249
- const { editor: o } = v(), t = g({
258
+ const { editor: o } = f(), t = g({
250
259
  editor: o,
251
260
  selector: (r) => ({
252
261
  isUl: r.editor?.isActive("bulletList"),
@@ -264,28 +273,28 @@ var Ye = () => {
264
273
  },
265
274
  {
266
275
  id: "ol",
267
- icon: /* @__PURE__ */ e(ie, {}),
276
+ icon: /* @__PURE__ */ e(j, {}),
268
277
  event: () => o.chain().focus().toggleOrderedList().run(),
269
278
  tooltip: "Numbered List",
270
279
  active: t.isOl
271
280
  },
272
281
  {
273
282
  id: "todo",
274
- icon: /* @__PURE__ */ e(V, {}),
283
+ icon: /* @__PURE__ */ e(Y, {}),
275
284
  event: () => o.chain().focus().toggleTaskList().run(),
276
285
  tooltip: "To-Do List",
277
286
  active: t.isTodo
278
287
  }
279
288
  ];
280
- return /* @__PURE__ */ e(z, {
281
- trigger: t.isOl ? /* @__PURE__ */ e(ie, {}) : t.isTodo ? /* @__PURE__ */ e(V, {}) : /* @__PURE__ */ e(K, {}),
289
+ return /* @__PURE__ */ e(N, {
290
+ trigger: t.isOl ? /* @__PURE__ */ e(j, {}) : t.isTodo ? /* @__PURE__ */ e(Y, {}) : /* @__PURE__ */ e(K, {}),
282
291
  triggerTitle: "List Style",
283
292
  active: t.isList,
284
293
  items: i
285
294
  });
286
295
  }, ot = () => {
287
- const { editor: o } = v();
288
- return /* @__PURE__ */ e(f, {
296
+ const { editor: o } = f();
297
+ return /* @__PURE__ */ e(h, {
289
298
  title: "strikethrough",
290
299
  "data-active": g({
291
300
  editor: o,
@@ -294,11 +303,11 @@ var Ye = () => {
294
303
  onClick: (t) => {
295
304
  t.preventDefault(), o.chain().focus().toggleStrike().run();
296
305
  },
297
- children: /* @__PURE__ */ e(ue, {})
306
+ children: /* @__PURE__ */ e(pe, {})
298
307
  });
299
308
  }, it = () => {
300
- const { editor: o } = v();
301
- return /* @__PURE__ */ e(f, {
309
+ const { editor: o } = f();
310
+ return /* @__PURE__ */ e(h, {
302
311
  title: "Subscript",
303
312
  "data-active": g({
304
313
  editor: o,
@@ -307,11 +316,11 @@ var Ye = () => {
307
316
  onClick: (t) => {
308
317
  t.preventDefault(), o.chain().focus().toggleSubscript().run();
309
318
  },
310
- children: /* @__PURE__ */ e(he, {})
319
+ children: /* @__PURE__ */ e(ve, {})
311
320
  });
312
321
  }, rt = () => {
313
- const { editor: o } = v();
314
- return /* @__PURE__ */ e(f, {
322
+ const { editor: o } = f();
323
+ return /* @__PURE__ */ e(h, {
315
324
  title: "Superscript",
316
325
  "data-active": g({
317
326
  editor: o,
@@ -320,26 +329,45 @@ var Ye = () => {
320
329
  onClick: (t) => {
321
330
  t.preventDefault(), o.chain().focus().toggleSuperscript().run();
322
331
  },
323
- children: /* @__PURE__ */ e(_e, {})
332
+ children: /* @__PURE__ */ e(ge, {})
324
333
  });
325
- }, nt = () => {
326
- const { editor: o, defaultValues: t } = v(), i = g({
334
+ }, de = ({ glyphPath: o, barPath: t, barColor: i, ...r }) => /* @__PURE__ */ p("svg", {
335
+ xmlns: "http://www.w3.org/2000/svg",
336
+ viewBox: "0 -960 960 960",
337
+ width: "1em",
338
+ height: "1em",
339
+ "aria-hidden": "true",
340
+ focusable: "false",
341
+ ...r,
342
+ children: [/* @__PURE__ */ e("path", {
343
+ d: o,
344
+ fill: "currentColor"
345
+ }), /* @__PURE__ */ e("path", {
346
+ d: t,
347
+ fill: i || "currentColor"
348
+ })]
349
+ }), nt = "M287-286q-32 0-50.5-26t-7.5-56l165-460q7-20 24-32t38-12h48q21 0 38 12t24 32l167 464q11 29-6.5 53.5T678-286q-20 0-36-12t-22-31l-30-93H376l-32 95q-6 18-21.5 29.5T287-286ZM412-530h138l-68-212h-4l-66 212Z", lt = "M101 0Q79 0 63.5-15.5T48-53v-100q0-22 15.5-37.5T101-206h758q22 0 37.5 15.5T912-153v100q0 22-15.5 37.5T859 0H101Z", at = () => {
350
+ const { editor: o, defaultValues: t } = f(), i = g({
327
351
  editor: o,
328
352
  selector: ({ editor: n }) => ({ textColor: n.getAttributes("textStyle").color })
329
353
  }), r = u.useRef(null);
330
- return /* @__PURE__ */ p(f, {
354
+ return /* @__PURE__ */ p(h, {
331
355
  title: "Text Color",
332
356
  onClick: () => r.current?.click(),
333
- children: [/* @__PURE__ */ e(ke, { style: { color: i.textColor } }), /* @__PURE__ */ e("input", {
357
+ children: [/* @__PURE__ */ e(de, {
358
+ glyphPath: nt,
359
+ barPath: lt,
360
+ barColor: i.textColor
361
+ }), /* @__PURE__ */ e("input", {
334
362
  ref: r,
335
363
  type: "color",
336
364
  defaultValue: t?.color ?? "#545E6B",
337
365
  onChange: (n) => o.chain().focus().setColor(n.target.value).run()
338
366
  })]
339
367
  });
340
- }, lt = () => {
341
- const { editor: o } = v();
342
- return /* @__PURE__ */ e(f, {
368
+ }, st = () => {
369
+ const { editor: o } = f();
370
+ return /* @__PURE__ */ e(h, {
343
371
  title: "Underline",
344
372
  "data-active": g({
345
373
  editor: o,
@@ -348,26 +376,30 @@ var Ye = () => {
348
376
  onClick: (t) => {
349
377
  t.preventDefault(), o.chain().focus().toggleUnderline().run();
350
378
  },
351
- children: /* @__PURE__ */ e(ve, {})
379
+ children: /* @__PURE__ */ e(fe, {})
352
380
  });
353
- }, at = () => {
354
- const { editor: o, defaultValues: t } = v(), i = g({
381
+ }, ct = "M123-299v-150q0-11 4-20t12-17l453-451q12-11 26.5-17t29.5-6q15 0 30 5.5t26 17.5l110 111q11 12 17 26.5t6 29.5q0 15-6 29.5T814-714L363-261q-8 8-17 11.5t-20 3.5H176q-22 0-37.5-15.5T123-299ZM647-694l76-76-76-76-76 76 76 76Z", dt = "M178 46q-44 0-75-30.5T72-60q0-45 30.5-75.5T178-166h604q44 0 75 30.5T888-60q0 45-30.5 75.5T782 46H178Z", ut = () => {
382
+ const { editor: o, defaultValues: t } = f(), i = g({
355
383
  editor: o,
356
384
  selector: ({ editor: n }) => ({ bgColor: n.getAttributes("textStyle").backgroundColor })
357
385
  }), r = u.useRef(null);
358
- return /* @__PURE__ */ p(f, {
386
+ return /* @__PURE__ */ p(h, {
359
387
  title: "Background Color",
360
388
  onClick: () => r.current?.click(),
361
- children: [/* @__PURE__ */ e(Ae, { style: { color: i.bgColor } }), /* @__PURE__ */ e("input", {
389
+ children: [/* @__PURE__ */ e(de, {
390
+ glyphPath: ct,
391
+ barPath: dt,
392
+ barColor: i.bgColor
393
+ }), /* @__PURE__ */ e("input", {
362
394
  ref: r,
363
395
  type: "color",
364
396
  defaultValue: t?.bgColor ?? "#fff",
365
397
  onChange: (n) => o.chain().focus().setBackgroundColor(n.target.value).run()
366
398
  })]
367
399
  });
368
- }, st = () => {
369
- const { editor: o } = v();
370
- return /* @__PURE__ */ e(f, {
400
+ }, ht = () => {
401
+ const { editor: o } = f();
402
+ return /* @__PURE__ */ e(h, {
371
403
  title: "quote",
372
404
  "data-active": g({
373
405
  editor: o,
@@ -376,22 +408,22 @@ var Ye = () => {
376
408
  onClick: (t) => {
377
409
  t.preventDefault(), o.chain().focus().toggleBlockquote().run();
378
410
  },
379
- children: /* @__PURE__ */ e(fe, {})
411
+ children: /* @__PURE__ */ e(me, {})
380
412
  });
381
413
  };
382
- function ct() {
383
- const { isHtml: o, setIsHtml: t, htmlSourceEnabled: i } = v();
384
- return i ? /* @__PURE__ */ e(f, {
414
+ function ft() {
415
+ const { isHtml: o, setIsHtml: t, htmlSourceEnabled: i } = f();
416
+ return i ? /* @__PURE__ */ e(h, {
385
417
  title: "HTML source",
386
418
  "data-active": o,
387
419
  onClick: (r) => {
388
420
  r.preventDefault(), t(!o);
389
421
  },
390
- children: /* @__PURE__ */ e(Ie, {})
422
+ children: /* @__PURE__ */ e(Te, {})
391
423
  }) : null;
392
424
  }
393
- var dt = () => {
394
- const { editor: o } = v(), t = g({
425
+ var vt = () => {
426
+ const { editor: o } = f(), t = g({
395
427
  editor: o,
396
428
  selector: (r) => ({
397
429
  isLeft: r.editor?.isActive({ textAlign: "left" }),
@@ -403,73 +435,74 @@ var dt = () => {
403
435
  }), i = [
404
436
  {
405
437
  id: "left",
406
- icon: /* @__PURE__ */ e(X, {}),
438
+ icon: /* @__PURE__ */ e(J, {}),
407
439
  event: () => o.chain().focus().setTextAlign("left").run(),
408
440
  tooltip: "Align Left",
409
441
  active: t.isLeft
410
442
  },
411
443
  {
412
444
  id: "center",
413
- icon: /* @__PURE__ */ e(te, {}),
445
+ icon: /* @__PURE__ */ e(oe, {}),
414
446
  event: () => o.chain().focus().setTextAlign("center").run(),
415
447
  tooltip: "Align Center",
416
448
  active: t.isCenter
417
449
  },
418
450
  {
419
451
  id: "right",
420
- icon: /* @__PURE__ */ e(ee, {}),
452
+ icon: /* @__PURE__ */ e(te, {}),
421
453
  event: () => o.chain().focus().setTextAlign("right").run(),
422
454
  tooltip: "Align Right",
423
455
  active: t.isRight
424
456
  },
425
457
  {
426
458
  id: "justify",
427
- icon: /* @__PURE__ */ e(G, {}),
459
+ icon: /* @__PURE__ */ e(X, {}),
428
460
  event: () => o.chain().focus().setTextAlign("justify").run(),
429
461
  tooltip: "Justify",
430
462
  active: t.isJustify
431
463
  }
432
464
  ];
433
- return /* @__PURE__ */ e(z, {
434
- trigger: t.isCenter ? /* @__PURE__ */ e(te, {}) : t.isRight ? /* @__PURE__ */ e(ee, {}) : t.isJustify ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e(X, {}),
465
+ return /* @__PURE__ */ e(N, {
466
+ trigger: t.isCenter ? /* @__PURE__ */ e(oe, {}) : t.isRight ? /* @__PURE__ */ e(te, {}) : t.isJustify ? /* @__PURE__ */ e(X, {}) : /* @__PURE__ */ e(J, {}),
435
467
  triggerTitle: "Text Alignment",
436
468
  active: t.isAligned,
437
469
  items: i
438
470
  });
439
- }, ut = "_wuContentEditor_1v4bi_4", ft = "_selectedCell_1v4bi_1", vt = "_tableWrapper_1v4bi_1", ht = "_wuContentEditorRoot_1v4bi_4", pt = "_wuContentEditorToolbar_1v4bi_18", gt = "_fontSize_1v4bi_39", mt = "_wuContentEditorTable_1v4bi_57", F = {
440
- wuContentEditor: ut,
441
- selectedCell: ft,
442
- "column-resize-handle": "_column-resize-handle_1v4bi_1",
443
- tableWrapper: vt,
444
- "resize-cursor": "_resize-cursor_1v4bi_1",
445
- wuContentEditorRoot: ht,
446
- wuContentEditorToolbar: pt,
447
- fontSize: gt,
448
- wuContentEditorTable: mt
449
- }, bt = [
471
+ }, pt = "_wuContentEditor_ufzk4_4", gt = "_selectedCell_ufzk4_1", mt = "_tableWrapper_ufzk4_1", bt = "_wuContentEditorRoot_ufzk4_4", Ct = "_wuContentEditorToolbar_ufzk4_19", kt = "_fontSize_ufzk4_41", _t = "_wuContentEditorTable_ufzk4_59", H = {
472
+ wuContentEditor: pt,
473
+ selectedCell: gt,
474
+ "column-resize-handle": "_column-resize-handle_ufzk4_1",
475
+ tableWrapper: mt,
476
+ "resize-cursor": "_resize-cursor_ufzk4_1",
477
+ wuContentEditorRoot: bt,
478
+ wuContentEditorToolbar: Ct,
479
+ fontSize: kt,
480
+ wuContentEditorTable: _t
481
+ }, At = [
450
482
  "e",
451
483
  "E",
452
484
  "+",
453
485
  "-"
454
- ], ne = 1, Ct = () => {
455
- const { editor: o, defaultValues: t } = v(), [i, r] = O(t?.fontSize ?? 16), n = g({
486
+ ], ne = 1, Tt = () => {
487
+ const { editor: o, defaultValues: t } = f(), [i, r] = M(t?.fontSize ?? 16), n = g({
456
488
  editor: o,
457
- selector: (c) => ({ fontSize: c.editor.getAttributes("textStyle").fontSize })
458
- }), s = (c) => {
459
- o.chain().focus().setFontSize(c + "px").run();
460
- }, l = (c) => {
461
- const a = Math.max(ne, c);
462
- r(a), s(a);
463
- }, d = (c) => {
464
- bt.includes(c.key) ? c.preventDefault() : c.key === "Enter" && s(i);
489
+ selector: (d) => ({ fontSize: d.editor.getAttributes("textStyle").fontSize })
490
+ }), l = (d) => {
491
+ o.chain().focus().setFontSize(d + "px").run();
492
+ }, a = (d) => {
493
+ const s = Math.max(ne, d);
494
+ r(s), l(s);
495
+ }, c = (d) => {
496
+ At.includes(d.key) ? d.preventDefault() : d.key === "Enter" && l(i);
465
497
  };
466
498
  return u.useEffect(() => {
467
499
  r(Number(n.fontSize?.replace("px", "")) || (t?.fontSize ?? 16));
468
500
  }, [n.fontSize, t?.fontSize]), /* @__PURE__ */ p("div", {
469
- className: F.fontSize,
501
+ className: H.fontSize,
470
502
  children: [
471
- /* @__PURE__ */ e(f, {
472
- onClick: () => l(i - 1),
503
+ /* @__PURE__ */ e(h, {
504
+ title: "Decrease Font Size",
505
+ onClick: () => a(i - 1),
473
506
  disabled: i <= ne,
474
507
  children: "−"
475
508
  }),
@@ -478,21 +511,22 @@ var dt = () => {
478
511
  inputMode: "numeric",
479
512
  pattern: "[0-9]*",
480
513
  value: i,
481
- onKeyDown: d,
482
- onChange: (c) => r(c.target.valueAsNumber),
483
- onBlur: () => s(i)
514
+ onKeyDown: c,
515
+ onChange: (d) => r(d.target.valueAsNumber),
516
+ onBlur: () => l(i)
484
517
  }),
485
- /* @__PURE__ */ e(f, {
486
- onClick: () => l(i + 1),
518
+ /* @__PURE__ */ e(h, {
519
+ title: "Increase Font Size",
520
+ onClick: () => a(i + 1),
487
521
  disabled: i >= 128,
488
522
  children: "+"
489
523
  })
490
524
  ]
491
525
  });
492
- }, kt = () => {
493
- const { editor: o, customFonts: t, defaultValues: i } = v(), r = g({
526
+ }, wt = () => {
527
+ const { editor: o, customFonts: t, defaultValues: i } = f(), r = g({
494
528
  editor: o,
495
- selector: (c) => ({ currentFontFamily: c.editor.getAttributes("textStyle").fontFamily || "" })
529
+ selector: (d) => ({ currentFontFamily: d.editor.getAttributes("textStyle").fontFamily || "" })
496
530
  }), n = [
497
531
  "Fira Sans",
498
532
  "Inter",
@@ -500,64 +534,68 @@ var dt = () => {
500
534
  "JetBrains Mono",
501
535
  "Montserrat",
502
536
  ...t || []
503
- ], [s, l] = O(r.currentFontFamily || i?.fontFamily || n[0]);
537
+ ], [l, a] = M(r.currentFontFamily || i?.fontFamily || n[0]);
504
538
  u.useEffect(() => {
505
- l(r.currentFontFamily?.replace(/"/g, "") || i?.fontFamily || n[0]);
539
+ a(r.currentFontFamily?.replace(/"/g, "") || i?.fontFamily || n[0]);
506
540
  }, [r.currentFontFamily]);
507
- const d = n.map((c) => ({
508
- id: c,
509
- label: c,
510
- tooltip: c,
511
- active: c === s,
512
- style: { fontFamily: c },
541
+ const c = n.map((d) => ({
542
+ id: d,
543
+ label: d,
544
+ tooltip: d,
545
+ active: d === l,
546
+ style: { fontFamily: d },
513
547
  event: () => {
514
- o.chain().focus().setFontFamily(c).run(), l(c);
548
+ o.chain().focus().setFontFamily(d).run(), a(d);
515
549
  }
516
550
  }));
517
- return /* @__PURE__ */ e(z, {
551
+ return /* @__PURE__ */ e(N, {
518
552
  trigger: /* @__PURE__ */ e("span", {
519
- style: { fontFamily: s },
520
- children: s?.[0]
553
+ style: { fontFamily: l },
554
+ children: l?.[0]
521
555
  }),
522
- triggerTitle: s || "Font Family",
523
- active: s !== (i?.fontFamily ?? n[0]),
524
- items: d,
556
+ triggerTitle: l || "Font Family",
557
+ active: l !== (i?.fontFamily ?? n[0]),
558
+ items: c,
525
559
  direction: "block"
526
560
  });
527
- }, _t = "_button_583n5_1", At = { button: _t }, ce = u.forwardRef(function({ children: t, variant: i, color: r, icon: n, ...s }, l) {
528
- return /* @__PURE__ */ p("button", {
529
- ref: l,
530
- className: At.button,
531
- "data-variant": i,
532
- "data-color": r,
533
- ...s,
534
- children: [n, t]
561
+ }, yt = "_button_583n5_1", It = { button: yt }, ue = u.forwardRef(function({ children: t, variant: i, color: r, icon: n, title: l, ...a }, c) {
562
+ return /* @__PURE__ */ e(ae, {
563
+ content: l,
564
+ children: /* @__PURE__ */ p("button", {
565
+ ref: c,
566
+ className: It.button,
567
+ "data-variant": i,
568
+ "data-color": r,
569
+ "aria-label": l,
570
+ ...a,
571
+ children: [n, t]
572
+ })
535
573
  });
536
- }), wt = "_dialog_vbrv2_1", yt = "_backdrop_vbrv2_27", It = "_content_vbrv2_46", Tt = "_footer_vbrv2_52", St = "_close_vbrv2_59", x = {
537
- dialog: wt,
538
- backdrop: yt,
539
- content: It,
540
- footer: Tt,
541
- close: St
574
+ }), St = "_dialog_vbrv2_1", xt = "_backdrop_vbrv2_27", Ht = "_content_vbrv2_46", Ft = "_footer_vbrv2_52", Lt = "_close_vbrv2_59", x = {
575
+ dialog: St,
576
+ backdrop: xt,
577
+ content: Ht,
578
+ footer: Ft,
579
+ close: Lt
542
580
  };
543
581
  function U({ Trigger: o, children: t, maxWidth: i, onOpenChange: r, footer: n }) {
544
- const s = u.useContext($), l = u.useCallback((d) => {
545
- s?.editor.setEditable(!d, !1), r?.(d);
546
- }, [s, r]);
547
- return /* @__PURE__ */ p(y.Root, {
582
+ const l = u.useContext(O), a = u.useCallback((c) => {
583
+ l?.editor.setEditable(!c, !1), r?.(c);
584
+ }, [l, r]);
585
+ return /* @__PURE__ */ p(w.Root, {
548
586
  modal: !0,
549
- onOpenChange: l,
587
+ onOpenChange: a,
550
588
  children: [/* @__PURE__ */ e("span", {
551
- onClick: (d) => d.stopPropagation(),
552
- children: /* @__PURE__ */ e(y.Trigger, { render: o })
553
- }), /* @__PURE__ */ p(y.Portal, { children: [/* @__PURE__ */ e(y.Backdrop, { className: x.backdrop }), /* @__PURE__ */ p(y.Popup, {
589
+ onClick: (c) => c.stopPropagation(),
590
+ children: /* @__PURE__ */ e(w.Trigger, { render: o })
591
+ }), /* @__PURE__ */ p(w.Portal, { children: [/* @__PURE__ */ e(w.Backdrop, { className: x.backdrop }), /* @__PURE__ */ p(w.Popup, {
554
592
  className: x.dialog,
555
593
  style: i ? { maxWidth: i } : void 0,
556
594
  children: [
557
- /* @__PURE__ */ e(y.Close, {
595
+ /* @__PURE__ */ e(w.Close, {
558
596
  className: x.close,
559
597
  "aria-label": "Close",
560
- children: /* @__PURE__ */ e(be, {
598
+ children: /* @__PURE__ */ e(Ae, {
561
599
  width: 10,
562
600
  height: 10
563
601
  })
@@ -574,9 +612,9 @@ function U({ Trigger: o, children: t, maxWidth: i, onOpenChange: r, footer: n })
574
612
  })] })]
575
613
  });
576
614
  }
577
- function H({ children: o, variant: t, color: i, icon: r, ...n }) {
578
- return /* @__PURE__ */ e(y.Close, {
579
- render: /* @__PURE__ */ e(ce, {
615
+ function F({ children: o, variant: t, color: i, icon: r, ...n }) {
616
+ return /* @__PURE__ */ e(w.Close, {
617
+ render: /* @__PURE__ */ e(ue, {
580
618
  variant: t,
581
619
  color: i,
582
620
  icon: r
@@ -585,93 +623,93 @@ function H({ children: o, variant: t, color: i, icon: r, ...n }) {
585
623
  children: o
586
624
  });
587
625
  }
588
- var xt = "_group_56lao_1", Ft = "_label_56lao_8", Ht = "_input_56lao_14", P = {
589
- group: xt,
590
- label: Ft,
591
- input: Ht
626
+ var zt = "_group_56lao_1", Rt = "_label_56lao_8", Et = "_input_56lao_14", D = {
627
+ group: zt,
628
+ label: Rt,
629
+ input: Et
592
630
  };
593
- function E({ label: o, id: t, ...i }) {
631
+ function R({ label: o, id: t, ...i }) {
594
632
  return /* @__PURE__ */ p("div", {
595
- className: P.group,
633
+ className: D.group,
596
634
  children: [o && /* @__PURE__ */ e("label", {
597
- className: P.label,
635
+ className: D.label,
598
636
  htmlFor: t,
599
637
  children: o
600
638
  }), /* @__PURE__ */ e("input", {
601
639
  id: t,
602
- className: P.input,
640
+ className: D.input,
603
641
  ...i
604
642
  })]
605
643
  });
606
644
  }
607
- var Lt = () => {
608
- const { editor: o } = v(), t = g({
645
+ var Nt = () => {
646
+ const { editor: o } = f(), t = g({
609
647
  editor: o,
610
- selector: (d) => ({
611
- isImage: d.editor?.isActive("image"),
612
- imageAttrs: d.editor?.getAttributes("image")
648
+ selector: (c) => ({
649
+ isImage: c.editor?.isActive("image"),
650
+ imageAttrs: c.editor?.getAttributes("image")
613
651
  })
614
- }), [i, r] = u.useState(t.imageAttrs.src || ""), [n, s] = u.useState(t.imageAttrs.alt || ""), l = () => {
652
+ }), [i, r] = u.useState(t.imageAttrs.src || ""), [n, l] = u.useState(t.imageAttrs.alt || ""), a = () => {
615
653
  o.chain().focus().setImage({
616
654
  src: i,
617
655
  alt: n
618
656
  }).run();
619
657
  };
620
658
  return /* @__PURE__ */ p(U, {
621
- Trigger: /* @__PURE__ */ e(f, {
659
+ Trigger: /* @__PURE__ */ e(h, {
622
660
  title: "Image",
623
661
  "data-active": t.isImage,
624
- children: /* @__PURE__ */ e(ge, {})
662
+ children: /* @__PURE__ */ e(ye, {})
625
663
  }),
626
664
  maxWidth: "400px",
627
- footer: /* @__PURE__ */ p(N, { children: [/* @__PURE__ */ e(H, {
665
+ footer: /* @__PURE__ */ p(E, { children: [/* @__PURE__ */ e(F, {
628
666
  variant: "secondary",
629
667
  children: "Cancel"
630
- }), /* @__PURE__ */ e(H, {
631
- onClick: l,
668
+ }), /* @__PURE__ */ e(F, {
669
+ onClick: a,
632
670
  disabled: !i,
633
671
  children: "Save"
634
672
  })] }),
635
- children: [/* @__PURE__ */ e(E, {
673
+ children: [/* @__PURE__ */ e(R, {
636
674
  label: "Image URL",
637
675
  type: "url",
638
676
  value: i,
639
- onChange: (d) => r(d.target.value),
677
+ onChange: (c) => r(c.target.value),
640
678
  required: !0
641
- }), /* @__PURE__ */ e(E, {
679
+ }), /* @__PURE__ */ e(R, {
642
680
  label: "Alt Text",
643
681
  type: "text",
644
682
  value: n,
645
- onChange: (d) => s(d.target.value)
683
+ onChange: (c) => l(c.target.value)
646
684
  })]
647
685
  });
648
- }, Rt = () => {
649
- const { editor: o } = v(), t = g({
686
+ }, Pt = () => {
687
+ const { editor: o } = f(), t = g({
650
688
  editor: o,
651
- selector: (a) => ({
652
- isLink: a.editor?.isActive("link"),
653
- linkAttrs: a.editor?.getAttributes("link")
689
+ selector: (s) => ({
690
+ isLink: s.editor?.isActive("link"),
691
+ linkAttrs: s.editor?.getAttributes("link")
654
692
  })
655
- }), [i, r] = u.useState(t.linkAttrs.href || ""), [n, s] = u.useState(t.linkAttrs.alt || ""), l = (a) => !a || a.startsWith("http://") || a.startsWith("https://") ? a : `https://${a}`, d = () => {
656
- const a = l(i);
693
+ }), [i, r] = u.useState(t.linkAttrs.href || ""), [n, l] = u.useState(t.linkAttrs.alt || ""), a = (s) => !s || s.startsWith("http://") || s.startsWith("https://") ? s : `https://${s}`, c = () => {
694
+ const s = a(i);
657
695
  o.chain().focus().insertContent({
658
696
  type: "text",
659
- text: n || a,
697
+ text: n || s,
660
698
  marks: [{
661
699
  type: "link",
662
- attrs: { href: a }
700
+ attrs: { href: s }
663
701
  }]
664
702
  }).run();
665
- }, c = () => {
666
- const a = o.getAttributes("link"), { from: m, to: _, $from: S } = o.state.selection;
703
+ }, d = () => {
704
+ const s = o.getAttributes("link"), { from: m, to: _, $from: S } = o.state.selection;
667
705
  let b;
668
706
  if (m !== _) b = o.state.doc.textBetween(m, _);
669
707
  else {
670
- const I = S.parent.textContent, T = S.parentOffset;
671
- let A = T, C = T;
672
- for (; A > 0 && !/\s/.test(I[A - 1]); ) A--;
673
- for (; C < I.length && !/\s/.test(I[C]); ) C++;
674
- if (b = I.slice(A, C), b) {
708
+ const y = S.parent.textContent, I = S.parentOffset;
709
+ let A = I, C = I;
710
+ for (; A > 0 && !/\s/.test(y[A - 1]); ) A--;
711
+ for (; C < y.length && !/\s/.test(y[C]); ) C++;
712
+ if (b = y.slice(A, C), b) {
675
713
  const k = S.start();
676
714
  o.commands.setTextSelection({
677
715
  from: k + A,
@@ -679,70 +717,70 @@ var Lt = () => {
679
717
  });
680
718
  }
681
719
  }
682
- r(a.href || ""), s(b || a.alt || "");
720
+ r(s.href || ""), l(b || s.alt || "");
683
721
  };
684
722
  return /* @__PURE__ */ p(U, {
685
- Trigger: /* @__PURE__ */ e(f, {
723
+ Trigger: /* @__PURE__ */ e(h, {
686
724
  title: "Link",
687
725
  "data-active": t.isLink,
688
- children: /* @__PURE__ */ e(pe, {})
726
+ children: /* @__PURE__ */ e(we, {})
689
727
  }),
690
728
  maxWidth: "400px",
691
- onOpenChange: (a) => a && c(),
692
- footer: /* @__PURE__ */ p(N, { children: [t.isLink && /* @__PURE__ */ e(H, {
729
+ onOpenChange: (s) => s && d(),
730
+ footer: /* @__PURE__ */ p(E, { children: [t.isLink && /* @__PURE__ */ e(F, {
693
731
  color: "error",
694
732
  variant: "secondary",
695
733
  onClick: () => o.chain().focus().unsetLink().run(),
696
734
  children: "Remove"
697
- }), /* @__PURE__ */ e(H, {
698
- onClick: d,
735
+ }), /* @__PURE__ */ e(F, {
736
+ onClick: c,
699
737
  disabled: !i,
700
738
  children: "Save"
701
739
  })] }),
702
- children: [/* @__PURE__ */ e(E, {
740
+ children: [/* @__PURE__ */ e(R, {
703
741
  label: "Link",
704
742
  type: "url",
705
743
  value: i,
706
- onChange: (a) => r(a.target.value),
744
+ onChange: (s) => r(s.target.value),
707
745
  required: !0
708
- }), /* @__PURE__ */ e(E, {
746
+ }), /* @__PURE__ */ e(R, {
709
747
  label: "Text to display",
710
748
  type: "text",
711
749
  value: n,
712
- onChange: (a) => s(a.target.value)
750
+ onChange: (s) => l(s.target.value)
713
751
  })]
714
752
  });
715
- }, Et = "_label_1kiov_1", Nt = "_root_1kiov_11", zt = "_thumb_1kiov_44", M = {
716
- label: Et,
717
- root: Nt,
718
- thumb: zt
753
+ }, Bt = "_label_1kiov_1", Dt = "_root_1kiov_11", qt = "_thumb_1kiov_44", q = {
754
+ label: Bt,
755
+ root: Dt,
756
+ thumb: qt
719
757
  };
720
- function Dt({ checked: o, onCheckedChange: t, label: i }) {
758
+ function Mt({ checked: o, onCheckedChange: t, label: i }) {
721
759
  return /* @__PURE__ */ p("label", {
722
- className: M.label,
760
+ className: q.label,
723
761
  children: [/* @__PURE__ */ e("span", { children: i }), /* @__PURE__ */ e(re.Root, {
724
- className: M.root,
762
+ className: q.root,
725
763
  checked: o,
726
764
  onCheckedChange: t,
727
- children: /* @__PURE__ */ e(re.Thumb, { className: M.thumb })
765
+ children: /* @__PURE__ */ e(re.Thumb, { className: q.thumb })
728
766
  })]
729
767
  });
730
768
  }
731
- var Bt = () => {
732
- const { editor: o } = v(), t = g({
769
+ var Ot = () => {
770
+ const { editor: o } = f(), t = g({
733
771
  editor: o,
734
- selector: (a) => ({
735
- isTable: a.editor.isActive("table"),
736
- tableAttrs: a.editor.getAttributes("table")
772
+ selector: (s) => ({
773
+ isTable: s.editor.isActive("table"),
774
+ tableAttrs: s.editor.getAttributes("table")
737
775
  })
738
- }), [i, r] = O(!1), n = xe(null), s = B((a) => {
739
- n.current && clearTimeout(n.current), n.current = setTimeout(a, 100);
776
+ }), [i, r] = M(!1), n = xe(null), l = B((s) => {
777
+ n.current && clearTimeout(n.current), n.current = setTimeout(s, 100);
740
778
  }, []);
741
779
  u.useEffect(() => () => {
742
780
  n.current && clearTimeout(n.current);
743
781
  }, []);
744
- const l = B(() => {
745
- s(() => o.chain().focus().insertTable({
782
+ const a = B(() => {
783
+ l(() => o.chain().focus().insertTable({
746
784
  rows: 2,
747
785
  cols: 4,
748
786
  withHeaderRow: i
@@ -750,10 +788,10 @@ var Bt = () => {
750
788
  }, [
751
789
  o,
752
790
  i,
753
- s
754
- ]), d = B(() => {
755
- r((a) => !a), s(() => o.chain().focus().toggleHeaderRow().run());
756
- }, [o, s]), c = [
791
+ l
792
+ ]), c = B(() => {
793
+ r((s) => !s), l(() => o.chain().focus().toggleHeaderRow().run());
794
+ }, [o, l]), d = [
757
795
  {
758
796
  text: "Column left",
759
797
  icon: /* @__PURE__ */ e(L, {}),
@@ -776,74 +814,75 @@ var Bt = () => {
776
814
  },
777
815
  {
778
816
  text: "Delete Column",
779
- icon: /* @__PURE__ */ e(D, {}),
817
+ icon: /* @__PURE__ */ e(P, {}),
780
818
  event: () => o.chain().focus().deleteColumn().run()
781
819
  },
782
820
  {
783
821
  text: "Delete Row",
784
- icon: /* @__PURE__ */ e(D, {}),
822
+ icon: /* @__PURE__ */ e(P, {}),
785
823
  event: () => o.chain().focus().deleteRow().run()
786
824
  }
787
825
  ];
788
826
  return t.isTable ? /* @__PURE__ */ p(U, {
789
- Trigger: /* @__PURE__ */ e(f, {
827
+ Trigger: /* @__PURE__ */ e(h, {
790
828
  title: "Table",
791
829
  "data-active": t.isTable,
792
- children: /* @__PURE__ */ e(j, {})
830
+ children: /* @__PURE__ */ e(V, {})
793
831
  }),
794
832
  maxWidth: "320px",
795
- footer: /* @__PURE__ */ e(H, {
833
+ footer: /* @__PURE__ */ e(F, {
796
834
  variant: "secondary",
797
835
  color: "error",
798
- icon: /* @__PURE__ */ e(D, {}),
836
+ icon: /* @__PURE__ */ e(P, {}),
799
837
  onClick: () => o.chain().focus().deleteTable().run(),
800
838
  children: "Delete Table"
801
839
  }),
802
- children: [/* @__PURE__ */ e(Dt, {
840
+ children: [/* @__PURE__ */ e(Mt, {
803
841
  checked: i,
804
- onCheckedChange: d,
842
+ onCheckedChange: c,
805
843
  label: "Title Row"
806
844
  }), /* @__PURE__ */ e("div", {
807
- className: F.wuContentEditorTable,
808
- children: c.map(({ text: a, icon: m, event: _ }) => /* @__PURE__ */ e(ce, {
845
+ className: H.wuContentEditorTable,
846
+ children: d.map(({ text: s, icon: m, event: _ }) => /* @__PURE__ */ e(ue, {
847
+ title: s,
809
848
  onClick: _,
810
849
  variant: "secondary",
811
850
  icon: m,
812
- children: a
813
- }, a))
851
+ children: s
852
+ }, s))
814
853
  })]
815
- }) : /* @__PURE__ */ e(f, {
854
+ }) : /* @__PURE__ */ e(h, {
816
855
  title: "Table",
817
- onClick: l,
818
- children: /* @__PURE__ */ e(j, {})
856
+ onClick: a,
857
+ children: /* @__PURE__ */ e(V, {})
819
858
  });
820
859
  }, le = {
821
- block: /* @__PURE__ */ e(Ye, {}),
822
- fontFamily: /* @__PURE__ */ e(kt, {}),
823
- fontSize: /* @__PURE__ */ e(Ct, {}),
824
- bold: /* @__PURE__ */ e(Ze, {}),
860
+ block: /* @__PURE__ */ e(Ge, {}),
861
+ fontFamily: /* @__PURE__ */ e(wt, {}),
862
+ fontSize: /* @__PURE__ */ e(Tt, {}),
863
+ bold: /* @__PURE__ */ e(Qe, {}),
825
864
  italic: /* @__PURE__ */ e(et, {}),
826
- underline: /* @__PURE__ */ e(lt, {}),
865
+ underline: /* @__PURE__ */ e(st, {}),
827
866
  strike: /* @__PURE__ */ e(ot, {}),
828
- color: /* @__PURE__ */ e(nt, {}),
829
- bgColor: /* @__PURE__ */ e(at, {}),
867
+ color: /* @__PURE__ */ e(at, {}),
868
+ bgColor: /* @__PURE__ */ e(ut, {}),
830
869
  list: /* @__PURE__ */ e(tt, {}),
831
- alignment: /* @__PURE__ */ e(dt, {}),
832
- image: /* @__PURE__ */ e(Lt, {}),
833
- link: /* @__PURE__ */ e(Rt, {}),
834
- table: /* @__PURE__ */ e(Bt, {}),
835
- blockquote: /* @__PURE__ */ e(st, {}),
870
+ alignment: /* @__PURE__ */ e(vt, {}),
871
+ image: /* @__PURE__ */ e(Nt, {}),
872
+ link: /* @__PURE__ */ e(Pt, {}),
873
+ table: /* @__PURE__ */ e(Ot, {}),
874
+ blockquote: /* @__PURE__ */ e(ht, {}),
836
875
  superscript: /* @__PURE__ */ e(rt, {}),
837
876
  subscript: /* @__PURE__ */ e(it, {}),
838
877
  codeline: /* @__PURE__ */ e(Ve, {}),
839
- clear: /* @__PURE__ */ e(Ge, {}),
878
+ clear: /* @__PURE__ */ e(Xe, {}),
840
879
  "|": /* @__PURE__ */ e("div", { style: {
841
880
  height: 16,
842
881
  width: 1,
843
882
  background: "var(--we-border)"
844
883
  } }),
845
- html: /* @__PURE__ */ e(ct, {})
846
- }, Pt = [
884
+ html: /* @__PURE__ */ e(ft, {})
885
+ }, $t = [
847
886
  "block",
848
887
  "fontFamily",
849
888
  "|",
@@ -871,18 +910,18 @@ var Bt = () => {
871
910
  "|",
872
911
  "html",
873
912
  "clear"
874
- ], Mt = (o) => {
875
- const { editor: t, customFonts: i, defaultValues: r, children: n, items: s = Pt, isHtml: l, setIsHtml: d, htmlSourceEnabled: c, ...a } = o;
913
+ ], Ut = (o) => {
914
+ const { editor: t, customFonts: i, defaultValues: r, children: n, items: l = $t, isHtml: a, setIsHtml: c, htmlSourceEnabled: d, ...s } = o;
876
915
  return /* @__PURE__ */ e("div", {
877
- ...a,
916
+ ...s,
878
917
  children: /* @__PURE__ */ p(We, {
879
918
  editor: t,
880
919
  customFonts: i,
881
920
  defaultValues: r,
882
- isHtml: l,
883
- setIsHtml: d,
884
- htmlSourceEnabled: c,
885
- children: [s.map((m, _) => /* @__PURE__ */ e(N, { children: l && m !== "html" ? /* @__PURE__ */ e("span", {
921
+ isHtml: a,
922
+ setIsHtml: c,
923
+ htmlSourceEnabled: d,
924
+ children: [l.map((m, _) => /* @__PURE__ */ e(E, { children: a && m !== "html" ? /* @__PURE__ */ e("span", {
886
925
  style: {
887
926
  pointerEvents: "none",
888
927
  opacity: 0.4
@@ -892,70 +931,70 @@ var Bt = () => {
892
931
  })
893
932
  });
894
933
  };
895
- function Ot(...o) {
934
+ function Wt(...o) {
896
935
  return o.filter(Boolean).join(" ");
897
936
  }
898
- function oo({ defaultValue: o, onUpdate: t, className: i, toolbarPosition: r = "top", customToolbarChildren: n, toolbarItems: s, hideToolbar: l, readonly: d, autoFocus: c, customFonts: a, htmlSource: m, isHtml: _, setIsHtml: S, defaultValues: b, ...I }) {
899
- const [T, A] = u.useState((_ ?? !1) && !!m);
937
+ function lo({ defaultValue: o, onUpdate: t, className: i, toolbarPosition: r = "top", customToolbarChildren: n, toolbarItems: l, hideToolbar: a, readonly: c, autoFocus: d, customFonts: s, htmlSource: m, isHtml: _, setIsHtml: S, defaultValues: b, ...y }) {
938
+ const [I, A] = u.useState((_ ?? !1) && !!m);
900
939
  u.useEffect(() => {
901
940
  process.env.NODE_ENV !== "production" && _ && !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`.');
902
941
  }, []);
903
942
  const C = u.useRef(o || ""), k = Se({
904
- editable: !d,
905
- autofocus: c ? "end" : !1,
943
+ editable: !c,
944
+ autofocus: d ? "end" : !1,
906
945
  extensions: Ue,
907
- content: R(o || ""),
908
- onUpdate: ({ editor: h }) => {
909
- t && t(R(h.getHTML()));
946
+ content: z(o || ""),
947
+ onUpdate: ({ editor: v }) => {
948
+ t && t(z(v.getHTML()));
910
949
  }
911
950
  });
912
951
  u.useEffect(() => {
913
952
  if (!k || !b) return;
914
- const h = k.chain();
915
- b.fontFamily && h.setFontFamily(b.fontFamily), b.fontSize && h.setFontSize(`${b.fontSize}px`), b.color && h.setColor(b.color), b.bgColor && h.setBackgroundColor(b.bgColor), h.run();
953
+ const v = k.chain();
954
+ b.fontFamily && v.setFontFamily(b.fontFamily), b.fontSize && v.setFontSize(`${b.fontSize}px`), b.color && v.setColor(b.color), b.bgColor && v.setBackgroundColor(b.bgColor), v.run();
916
955
  }, [k]);
917
- const de = (h) => {
918
- h ? C.current = k?.getHTML() ?? "" : k?.commands.setContent(R(C.current)), t && t(R(C.current)), A(h), S?.(h);
956
+ const he = (v) => {
957
+ v ? C.current = k?.getHTML() ?? "" : k?.commands.setContent(z(C.current)), t && t(z(C.current)), A(v), S?.(v);
919
958
  };
920
959
  return /* @__PURE__ */ p("div", {
921
- className: Ot(F.wuContentEditorRoot, i),
960
+ className: Wt(H.wuContentEditorRoot, i),
922
961
  "data-position": r,
923
962
  "data-slot": "wu-content-editor-root",
924
- onClick: (h) => {
925
- if ((h.ctrlKey || h.metaKey) && h.target instanceof HTMLElement) {
926
- const W = h.target.closest("a");
963
+ onClick: (v) => {
964
+ if ((v.ctrlKey || v.metaKey) && v.target instanceof HTMLElement) {
965
+ const W = v.target.closest("a");
927
966
  if (W?.href) {
928
967
  window.open(W.href, "_blank", "noopener,noreferrer");
929
968
  return;
930
969
  }
931
970
  }
932
- T || k?.chain().focus().run();
971
+ I || k?.chain().focus().run();
933
972
  },
934
- ...I,
935
- children: [!l && /* @__PURE__ */ e(Mt, {
973
+ ...y,
974
+ children: [!a && /* @__PURE__ */ e(Ut, {
936
975
  editor: k,
937
- customFonts: a,
976
+ customFonts: s,
938
977
  defaultValues: b,
939
- className: F.wuContentEditorToolbar,
940
- items: s,
941
- isHtml: T,
942
- setIsHtml: de,
978
+ className: H.wuContentEditorToolbar,
979
+ items: l,
980
+ isHtml: I,
981
+ setIsHtml: he,
943
982
  htmlSourceEnabled: !!m,
944
983
  "data-slot": "wu-content-editor-toolbar",
945
984
  children: n
946
- }), T && m ? /* @__PURE__ */ e(m, {
985
+ }), I && m ? /* @__PURE__ */ e(m, {
947
986
  defaultValue: C.current,
948
- onUpdate: (h) => {
949
- C.current = h ?? "", t && t(h ?? "");
987
+ onUpdate: (v) => {
988
+ C.current = v ?? "", t && t(v ?? "");
950
989
  },
951
- readonly: d
952
- }) : /* @__PURE__ */ e(Te, {
990
+ readonly: c
991
+ }) : /* @__PURE__ */ e(Ie, {
953
992
  editor: k,
954
- className: F.wuContentEditor,
993
+ className: H.wuContentEditor,
955
994
  "data-slot": "wu-content-editor"
956
995
  })]
957
996
  });
958
997
  }
959
998
  export {
960
- oo as WuContentEditor
999
+ lo as WuContentEditor
961
1000
  };