@npm-questionpro/wick-ui-editor 2.7.0 → 2.8.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,18 +1,18 @@
1
- import { A as J, C as Q, D as ue, E as fe, M as he, O as ve, S as pe, T as X, _ as Y, a as Z, b as ge, c as me, d as be, f as Ce, g as G, h as V, i as ee, j as ke, k as _e, l as te, m as z, n as L, o as oe, r as ie, s as Ae, t as R, u as we, v as re, w as ne, x as Ie, y as ye } from "../../sanitize-BZ0U7q7z.js";
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
2
  import { EditorContent as Te, useEditor as Se, useEditorState as g } from "@tiptap/react";
3
- import d, { useCallback as D, useRef as xe, useState as O } from "react";
3
+ import u, { useCallback as B, useRef as xe, useState as O } from "react";
4
4
  import Fe from "@tiptap/extension-image";
5
5
  import { TaskItem as He, TaskList as Le } from "@tiptap/extension-list";
6
6
  import Re from "@tiptap/extension-subscript";
7
7
  import Ee from "@tiptap/extension-superscript";
8
8
  import { TableKit as Ne } from "@tiptap/extension-table";
9
9
  import ze from "@tiptap/extension-text-align";
10
- import { BackgroundColor as De, Color as Be, FontFamily as Pe, FontSize as Oe, LineHeight as Me, TextStyle as $e } from "@tiptap/extension-text-style";
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
11
  import qe from "@tiptap/starter-kit";
12
12
  import { Fragment as N, jsx as e, jsxs as p } from "react/jsx-runtime";
13
- import { Menu as C } from "@base-ui/react/menu";
14
- import { Dialog as I } from "@base-ui/react/dialog";
15
- import { Switch as le } from "@base-ui/react/switch";
13
+ import { Menu as w } from "@base-ui/react/menu";
14
+ import { Dialog as y } from "@base-ui/react/dialog";
15
+ import { Switch as re } from "@base-ui/react/switch";
16
16
  var Ue = [
17
17
  qe.configure({ link: {
18
18
  openOnClick: !1,
@@ -28,7 +28,7 @@ var Ue = [
28
28
  "file",
29
29
  "mailto"
30
30
  ], n = i.protocol.replace(":", "");
31
- if (r.includes(n) || !t.protocols.map((c) => typeof c == "string" ? c : c.scheme).includes(n)) return !1;
31
+ if (r.includes(n) || !t.protocols.map((d) => typeof d == "string" ? d : d.scheme).includes(n)) return !1;
32
32
  const s = ["example-phishing.com", "malicious-site.net"], l = i.hostname;
33
33
  return !s.includes(l);
34
34
  } catch {
@@ -52,8 +52,8 @@ var Ue = [
52
52
  De,
53
53
  Le,
54
54
  He,
55
- Me,
56
55
  Oe,
56
+ Me,
57
57
  Pe,
58
58
  Fe.configure({
59
59
  resize: {
@@ -63,7 +63,7 @@ var Ue = [
63
63
  inline: !0
64
64
  }),
65
65
  Ne.configure({ table: { resizable: !0 } })
66
- ], M = d.createContext(null), We = ({ editor: o, children: t, customFonts: i, defaultValues: r, isHtml: n, setIsHtml: s, htmlSourceEnabled: l }) => /* @__PURE__ */ e(M.Provider, {
66
+ ], $ = u.createContext(null), We = ({ editor: o, children: t, customFonts: i, defaultValues: r, isHtml: n, setIsHtml: s, htmlSourceEnabled: l }) => /* @__PURE__ */ e($.Provider, {
67
67
  value: {
68
68
  editor: o,
69
69
  customFonts: i,
@@ -73,15 +73,15 @@ var Ue = [
73
73
  htmlSourceEnabled: l
74
74
  },
75
75
  children: t
76
- }), f = () => {
77
- const o = d.useContext(M);
76
+ }), v = () => {
77
+ const o = u.useContext($);
78
78
  if (!o) throw new Error("useToolbar must be used within a ToolbarProvider");
79
79
  return o;
80
- }, je = "_dropdown_sx3z9_1", Ke = "_dropdownItem_sx3z9_17", Je = "_dropdownPositioner_sx3z9_29", $ = {
80
+ }, je = "_dropdown_sx3z9_1", Ke = "_dropdownItem_sx3z9_17", Je = "_dropdownPositioner_sx3z9_29", q = {
81
81
  dropdown: je,
82
82
  dropdownItem: Ke,
83
83
  dropdownPositioner: Je
84
- }, Qe = "_item_wqnwe_1", Xe = { item: Qe }, u = d.forwardRef(function({ Icon: t, children: i, ...r }, n) {
84
+ }, Qe = "_item_wqnwe_1", Xe = { item: Qe }, f = u.forwardRef(function({ Icon: t, children: i, ...r }, n) {
85
85
  return /* @__PURE__ */ p("button", {
86
86
  ref: n,
87
87
  ...r,
@@ -92,44 +92,44 @@ var Ue = [
92
92
  i
93
93
  ]
94
94
  });
95
- }), q = d.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
95
+ }), ae = u.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
96
96
  ref: i,
97
- className: $.dropdown,
97
+ className: q.dropdown,
98
98
  ...t,
99
99
  children: o
100
100
  }));
101
- q.displayName = "DropdownPopup";
102
- var U = d.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
101
+ ae.displayName = "DropdownPopup";
102
+ var se = u.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
103
103
  ref: i,
104
- className: $.dropdownItem,
104
+ className: q.dropdownItem,
105
105
  ...t,
106
106
  children: o
107
107
  }));
108
- U.displayName = "DropdownItem";
109
- function W({ trigger: o, triggerTitle: t, active: i, items: r, align: n = "start", direction: s = "inline" }) {
110
- return /* @__PURE__ */ p(C.Root, { children: [/* @__PURE__ */ e(C.Trigger, {
111
- render: /* @__PURE__ */ e(u, {}),
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, {}),
112
112
  "data-active": i,
113
113
  title: t,
114
114
  children: o
115
- }), /* @__PURE__ */ e(C.Portal, { children: /* @__PURE__ */ e(C.Positioner, {
115
+ }), /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ e(w.Positioner, {
116
116
  align: n,
117
117
  sideOffset: 4,
118
- className: $.dropdownPositioner,
119
- children: /* @__PURE__ */ e(C.Popup, {
120
- render: /* @__PURE__ */ e(q, {}),
118
+ className: q.dropdownPositioner,
119
+ children: /* @__PURE__ */ e(w.Popup, {
120
+ render: /* @__PURE__ */ e(ae, {}),
121
121
  "data-inline": s === "inline" ? !0 : void 0,
122
122
  "data-block": s === "block" ? !0 : void 0,
123
123
  finalFocus: !1,
124
- children: r.map((l) => s === "block" ? /* @__PURE__ */ e(C.Item, {
125
- render: /* @__PURE__ */ e(U, {}),
124
+ children: r.map((l) => s === "block" ? /* @__PURE__ */ e(w.Item, {
125
+ render: /* @__PURE__ */ e(se, {}),
126
126
  title: l.tooltip,
127
127
  "data-active": l.active,
128
128
  style: l.style,
129
129
  onClick: l.event,
130
130
  children: l.icon ?? l.label
131
- }, l.id) : /* @__PURE__ */ e(C.Item, {
132
- render: /* @__PURE__ */ e(u, {}),
131
+ }, l.id) : /* @__PURE__ */ e(w.Item, {
132
+ render: /* @__PURE__ */ e(f, {}),
133
133
  "data-active": l.active,
134
134
  title: l.tooltip,
135
135
  onClick: l.event,
@@ -139,7 +139,7 @@ function W({ trigger: o, triggerTitle: t, active: i, items: r, align: n = "start
139
139
  }) })] });
140
140
  }
141
141
  var Ye = () => {
142
- const { editor: o } = f(), t = g({
142
+ const { editor: o } = v(), t = g({
143
143
  editor: o,
144
144
  selector: (r) => ({
145
145
  isParagraph: r.editor?.isActive("paragraph"),
@@ -152,49 +152,49 @@ var Ye = () => {
152
152
  }), i = [
153
153
  {
154
154
  id: "paragraph",
155
- icon: /* @__PURE__ */ e(X, {}),
155
+ icon: /* @__PURE__ */ e(J, {}),
156
156
  event: () => o.chain().focus().setParagraph().run(),
157
157
  tooltip: "Paragraph",
158
158
  active: t.isParagraph
159
159
  },
160
160
  {
161
161
  id: "h1",
162
- icon: /* @__PURE__ */ e(V, {}),
162
+ icon: /* @__PURE__ */ e(Z, {}),
163
163
  event: () => o.chain().focus().setHeading({ level: 1 }).run(),
164
164
  tooltip: "Heading 1",
165
165
  active: t.isH1
166
166
  },
167
167
  {
168
168
  id: "h2",
169
- icon: /* @__PURE__ */ e(G, {}),
169
+ icon: /* @__PURE__ */ e(Y, {}),
170
170
  event: () => o.chain().focus().setHeading({ level: 2 }).run(),
171
171
  tooltip: "Heading 2",
172
172
  active: t.isH2
173
173
  },
174
174
  {
175
175
  id: "h3",
176
- icon: /* @__PURE__ */ e(Y, {}),
176
+ icon: /* @__PURE__ */ e(Q, {}),
177
177
  event: () => o.chain().focus().setHeading({ level: 3 }).run(),
178
178
  tooltip: "Heading 3",
179
179
  active: t.isH3
180
180
  },
181
181
  {
182
182
  id: "h4",
183
- icon: /* @__PURE__ */ e(re, {}),
183
+ icon: /* @__PURE__ */ e(oe, {}),
184
184
  event: () => o.chain().focus().setHeading({ level: 4 }).run(),
185
185
  tooltip: "Heading 4",
186
186
  active: t.isH4
187
187
  }
188
188
  ];
189
- return /* @__PURE__ */ e(W, {
190
- trigger: t.isH1 ? /* @__PURE__ */ e(V, {}) : t.isH2 ? /* @__PURE__ */ e(G, {}) : t.isH3 ? /* @__PURE__ */ e(Y, {}) : t.isH4 ? /* @__PURE__ */ e(re, {}) : /* @__PURE__ */ e(X, {}),
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, {}),
191
191
  triggerTitle: "Block Style",
192
192
  active: t.isHeading,
193
193
  items: i
194
194
  });
195
195
  }, Ze = () => {
196
- const { editor: o } = f();
197
- return /* @__PURE__ */ e(u, {
196
+ const { editor: o } = v();
197
+ return /* @__PURE__ */ e(f, {
198
198
  title: "Bold",
199
199
  "data-active": g({
200
200
  editor: o,
@@ -206,13 +206,13 @@ var Ye = () => {
206
206
  children: /* @__PURE__ */ e(me, {})
207
207
  });
208
208
  }, Ge = () => {
209
- const { editor: o } = f();
209
+ const { editor: o } = v();
210
210
  return /* @__PURE__ */ e(N, { children: [{
211
211
  id: "clear",
212
212
  icon: /* @__PURE__ */ e(we, {}),
213
213
  event: () => o.chain().focus().clearNodes().unsetAllMarks().run(),
214
214
  tooltip: "Clear Formatting"
215
- }].map((t) => /* @__PURE__ */ e(u, {
215
+ }].map((t) => /* @__PURE__ */ e(f, {
216
216
  title: t.tooltip,
217
217
  onClick: (i) => {
218
218
  i.preventDefault(), t.event();
@@ -220,8 +220,8 @@ var Ye = () => {
220
220
  children: t.icon
221
221
  }, t.id)) });
222
222
  }, Ve = () => {
223
- const { editor: o } = f();
224
- return /* @__PURE__ */ e(u, {
223
+ const { editor: o } = v();
224
+ return /* @__PURE__ */ e(f, {
225
225
  "data-active": g({
226
226
  editor: o,
227
227
  selector: (t) => ({ code: t.editor.isActive("code") })
@@ -233,8 +233,8 @@ var Ye = () => {
233
233
  children: /* @__PURE__ */ e(Ce, {})
234
234
  });
235
235
  }, et = () => {
236
- const { editor: o } = f();
237
- return /* @__PURE__ */ e(u, {
236
+ const { editor: o } = v();
237
+ return /* @__PURE__ */ e(f, {
238
238
  title: "Italic",
239
239
  "data-active": g({
240
240
  editor: o,
@@ -243,10 +243,10 @@ var Ye = () => {
243
243
  onClick: (t) => {
244
244
  t.preventDefault(), o.chain().focus().toggleItalic().run();
245
245
  },
246
- children: /* @__PURE__ */ e(Ie, {})
246
+ children: /* @__PURE__ */ e(ye, {})
247
247
  });
248
248
  }, tt = () => {
249
- const { editor: o } = f(), t = g({
249
+ const { editor: o } = v(), t = g({
250
250
  editor: o,
251
251
  selector: (r) => ({
252
252
  isUl: r.editor?.isActive("bulletList"),
@@ -257,35 +257,35 @@ var Ye = () => {
257
257
  }), i = [
258
258
  {
259
259
  id: "ul",
260
- icon: /* @__PURE__ */ e(Q, {}),
260
+ icon: /* @__PURE__ */ e(K, {}),
261
261
  event: () => o.chain().focus().toggleBulletList().run(),
262
262
  tooltip: "Bulleted List",
263
263
  active: t.isUl
264
264
  },
265
265
  {
266
266
  id: "ol",
267
- icon: /* @__PURE__ */ e(ne, {}),
267
+ icon: /* @__PURE__ */ e(ie, {}),
268
268
  event: () => o.chain().focus().toggleOrderedList().run(),
269
269
  tooltip: "Numbered List",
270
270
  active: t.isOl
271
271
  },
272
272
  {
273
273
  id: "todo",
274
- icon: /* @__PURE__ */ e(te, {}),
274
+ icon: /* @__PURE__ */ e(V, {}),
275
275
  event: () => o.chain().focus().toggleTaskList().run(),
276
276
  tooltip: "To-Do List",
277
277
  active: t.isTodo
278
278
  }
279
279
  ];
280
- return /* @__PURE__ */ e(W, {
281
- trigger: t.isOl ? /* @__PURE__ */ e(ne, {}) : t.isTodo ? /* @__PURE__ */ e(te, {}) : /* @__PURE__ */ e(Q, {}),
280
+ return /* @__PURE__ */ e(z, {
281
+ trigger: t.isOl ? /* @__PURE__ */ e(ie, {}) : t.isTodo ? /* @__PURE__ */ e(V, {}) : /* @__PURE__ */ e(K, {}),
282
282
  triggerTitle: "List Style",
283
283
  active: t.isList,
284
284
  items: i
285
285
  });
286
286
  }, ot = () => {
287
- const { editor: o } = f();
288
- return /* @__PURE__ */ e(u, {
287
+ const { editor: o } = v();
288
+ return /* @__PURE__ */ e(f, {
289
289
  title: "strikethrough",
290
290
  "data-active": g({
291
291
  editor: o,
@@ -297,8 +297,8 @@ var Ye = () => {
297
297
  children: /* @__PURE__ */ e(ue, {})
298
298
  });
299
299
  }, it = () => {
300
- const { editor: o } = f();
301
- return /* @__PURE__ */ e(u, {
300
+ const { editor: o } = v();
301
+ return /* @__PURE__ */ e(f, {
302
302
  title: "Subscript",
303
303
  "data-active": g({
304
304
  editor: o,
@@ -307,11 +307,11 @@ var Ye = () => {
307
307
  onClick: (t) => {
308
308
  t.preventDefault(), o.chain().focus().toggleSubscript().run();
309
309
  },
310
- children: /* @__PURE__ */ e(ve, {})
310
+ children: /* @__PURE__ */ e(he, {})
311
311
  });
312
312
  }, rt = () => {
313
- const { editor: o } = f();
314
- return /* @__PURE__ */ e(u, {
313
+ const { editor: o } = v();
314
+ return /* @__PURE__ */ e(f, {
315
315
  title: "Superscript",
316
316
  "data-active": g({
317
317
  editor: o,
@@ -323,11 +323,11 @@ var Ye = () => {
323
323
  children: /* @__PURE__ */ e(_e, {})
324
324
  });
325
325
  }, nt = () => {
326
- const { editor: o, defaultValues: t } = f(), i = g({
326
+ const { editor: o, defaultValues: t } = v(), i = g({
327
327
  editor: o,
328
328
  selector: ({ editor: n }) => ({ textColor: n.getAttributes("textStyle").color })
329
- }), r = d.useRef(null);
330
- return /* @__PURE__ */ p(u, {
329
+ }), r = u.useRef(null);
330
+ return /* @__PURE__ */ p(f, {
331
331
  title: "Text Color",
332
332
  onClick: () => r.current?.click(),
333
333
  children: [/* @__PURE__ */ e(ke, { style: { color: i.textColor } }), /* @__PURE__ */ e("input", {
@@ -338,8 +338,8 @@ var Ye = () => {
338
338
  })]
339
339
  });
340
340
  }, lt = () => {
341
- const { editor: o } = f();
342
- return /* @__PURE__ */ e(u, {
341
+ const { editor: o } = v();
342
+ return /* @__PURE__ */ e(f, {
343
343
  title: "Underline",
344
344
  "data-active": g({
345
345
  editor: o,
@@ -348,14 +348,14 @@ var Ye = () => {
348
348
  onClick: (t) => {
349
349
  t.preventDefault(), o.chain().focus().toggleUnderline().run();
350
350
  },
351
- children: /* @__PURE__ */ e(he, {})
351
+ children: /* @__PURE__ */ e(ve, {})
352
352
  });
353
353
  }, at = () => {
354
- const { editor: o, defaultValues: t } = f(), i = g({
354
+ const { editor: o, defaultValues: t } = v(), i = g({
355
355
  editor: o,
356
356
  selector: ({ editor: n }) => ({ bgColor: n.getAttributes("textStyle").backgroundColor })
357
- }), r = d.useRef(null);
358
- return /* @__PURE__ */ p(u, {
357
+ }), r = u.useRef(null);
358
+ return /* @__PURE__ */ p(f, {
359
359
  title: "Background Color",
360
360
  onClick: () => r.current?.click(),
361
361
  children: [/* @__PURE__ */ e(Ae, { style: { color: i.bgColor } }), /* @__PURE__ */ e("input", {
@@ -366,8 +366,8 @@ var Ye = () => {
366
366
  })]
367
367
  });
368
368
  }, st = () => {
369
- const { editor: o } = f();
370
- return /* @__PURE__ */ e(u, {
369
+ const { editor: o } = v();
370
+ return /* @__PURE__ */ e(f, {
371
371
  title: "quote",
372
372
  "data-active": g({
373
373
  editor: o,
@@ -380,18 +380,18 @@ var Ye = () => {
380
380
  });
381
381
  };
382
382
  function ct() {
383
- const { isHtml: o, setIsHtml: t, htmlSourceEnabled: i } = f();
384
- return i ? /* @__PURE__ */ e(u, {
383
+ const { isHtml: o, setIsHtml: t, htmlSourceEnabled: i } = v();
384
+ return i ? /* @__PURE__ */ e(f, {
385
385
  title: "HTML source",
386
386
  "data-active": o,
387
387
  onClick: (r) => {
388
388
  r.preventDefault(), t(!o);
389
389
  },
390
- children: /* @__PURE__ */ e(ye, {})
390
+ children: /* @__PURE__ */ e(Ie, {})
391
391
  }) : null;
392
392
  }
393
393
  var dt = () => {
394
- const { editor: o } = f(), t = g({
394
+ const { editor: o } = v(), t = g({
395
395
  editor: o,
396
396
  selector: (r) => ({
397
397
  isLeft: r.editor?.isActive({ textAlign: "left" }),
@@ -403,46 +403,46 @@ var dt = () => {
403
403
  }), i = [
404
404
  {
405
405
  id: "left",
406
- icon: /* @__PURE__ */ e(Z, {}),
406
+ icon: /* @__PURE__ */ e(X, {}),
407
407
  event: () => o.chain().focus().setTextAlign("left").run(),
408
408
  tooltip: "Align Left",
409
409
  active: t.isLeft
410
410
  },
411
411
  {
412
412
  id: "center",
413
- icon: /* @__PURE__ */ e(ie, {}),
413
+ icon: /* @__PURE__ */ e(te, {}),
414
414
  event: () => o.chain().focus().setTextAlign("center").run(),
415
415
  tooltip: "Align Center",
416
416
  active: t.isCenter
417
417
  },
418
418
  {
419
419
  id: "right",
420
- icon: /* @__PURE__ */ e(oe, {}),
420
+ icon: /* @__PURE__ */ e(ee, {}),
421
421
  event: () => o.chain().focus().setTextAlign("right").run(),
422
422
  tooltip: "Align Right",
423
423
  active: t.isRight
424
424
  },
425
425
  {
426
426
  id: "justify",
427
- icon: /* @__PURE__ */ e(ee, {}),
427
+ icon: /* @__PURE__ */ e(G, {}),
428
428
  event: () => o.chain().focus().setTextAlign("justify").run(),
429
429
  tooltip: "Justify",
430
430
  active: t.isJustify
431
431
  }
432
432
  ];
433
- return /* @__PURE__ */ e(W, {
434
- trigger: t.isCenter ? /* @__PURE__ */ e(ie, {}) : t.isRight ? /* @__PURE__ */ e(oe, {}) : t.isJustify ? /* @__PURE__ */ e(ee, {}) : /* @__PURE__ */ e(Z, {}),
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, {}),
435
435
  triggerTitle: "Text Alignment",
436
436
  active: t.isAligned,
437
437
  items: i
438
438
  });
439
- }, ut = "_wuContentEditor_1v4bi_4", ft = "_selectedCell_1v4bi_1", ht = "_tableWrapper_1v4bi_1", vt = "_wuContentEditorRoot_1v4bi_4", pt = "_wuContentEditorToolbar_1v4bi_18", gt = "_fontSize_1v4bi_39", mt = "_wuContentEditorTable_1v4bi_57", F = {
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
440
  wuContentEditor: ut,
441
441
  selectedCell: ft,
442
442
  "column-resize-handle": "_column-resize-handle_1v4bi_1",
443
- tableWrapper: ht,
443
+ tableWrapper: vt,
444
444
  "resize-cursor": "_resize-cursor_1v4bi_1",
445
- wuContentEditorRoot: vt,
445
+ wuContentEditorRoot: ht,
446
446
  wuContentEditorToolbar: pt,
447
447
  fontSize: gt,
448
448
  wuContentEditorTable: mt
@@ -451,26 +451,26 @@ var dt = () => {
451
451
  "E",
452
452
  "+",
453
453
  "-"
454
- ], ae = 1, Ct = () => {
455
- const { editor: o, defaultValues: t } = f(), [i, r] = O(t?.fontSize ?? 16), n = g({
454
+ ], ne = 1, Ct = () => {
455
+ const { editor: o, defaultValues: t } = v(), [i, r] = O(t?.fontSize ?? 16), n = g({
456
456
  editor: o,
457
- selector: (h) => ({ fontSize: h.editor.getAttributes("textStyle").fontSize })
458
- }), s = (h) => {
459
- o.chain().focus().setFontSize(h + "px").run();
460
- }, l = (h) => {
461
- const a = Math.max(ae, h);
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
462
  r(a), s(a);
463
- }, c = (h) => {
464
- bt.includes(h.key) ? h.preventDefault() : h.key === "Enter" && s(i);
463
+ }, d = (c) => {
464
+ bt.includes(c.key) ? c.preventDefault() : c.key === "Enter" && s(i);
465
465
  };
466
- return d.useEffect(() => {
466
+ return u.useEffect(() => {
467
467
  r(Number(n.fontSize?.replace("px", "")) || (t?.fontSize ?? 16));
468
468
  }, [n.fontSize, t?.fontSize]), /* @__PURE__ */ p("div", {
469
469
  className: F.fontSize,
470
470
  children: [
471
- /* @__PURE__ */ e(u, {
471
+ /* @__PURE__ */ e(f, {
472
472
  onClick: () => l(i - 1),
473
- disabled: i <= ae,
473
+ disabled: i <= ne,
474
474
  children: "−"
475
475
  }),
476
476
  /* @__PURE__ */ e("input", {
@@ -478,11 +478,11 @@ var dt = () => {
478
478
  inputMode: "numeric",
479
479
  pattern: "[0-9]*",
480
480
  value: i,
481
- onKeyDown: c,
482
- onChange: (h) => r(h.target.valueAsNumber),
481
+ onKeyDown: d,
482
+ onChange: (c) => r(c.target.valueAsNumber),
483
483
  onBlur: () => s(i)
484
484
  }),
485
- /* @__PURE__ */ e(u, {
485
+ /* @__PURE__ */ e(f, {
486
486
  onClick: () => l(i + 1),
487
487
  disabled: i >= 128,
488
488
  children: "+"
@@ -490,7 +490,7 @@ var dt = () => {
490
490
  ]
491
491
  });
492
492
  }, kt = () => {
493
- const { editor: o, customFonts: t, defaultValues: i } = f(), r = g({
493
+ const { editor: o, customFonts: t, defaultValues: i } = v(), r = g({
494
494
  editor: o,
495
495
  selector: (c) => ({ currentFontFamily: c.editor.getAttributes("textStyle").fontFamily || "" })
496
496
  }), n = [
@@ -501,32 +501,30 @@ var dt = () => {
501
501
  "Montserrat",
502
502
  ...t || []
503
503
  ], [s, l] = O(r.currentFontFamily || i?.fontFamily || n[0]);
504
- return d.useEffect(() => {
504
+ u.useEffect(() => {
505
505
  l(r.currentFontFamily?.replace(/"/g, "") || i?.fontFamily || n[0]);
506
- }, [r.currentFontFamily]), /* @__PURE__ */ p(C.Root, { children: [/* @__PURE__ */ e(C.Trigger, {
507
- "data-active": s !== (i?.fontFamily ?? n[0]),
508
- style: { fontFamily: s },
509
- title: s || "Font Family",
510
- render: /* @__PURE__ */ e(u, {}),
511
- children: s?.[0]
512
- }), /* @__PURE__ */ e(C.Portal, { children: /* @__PURE__ */ e(C.Positioner, {
513
- align: "start",
514
- sideOffset: 4,
515
- children: /* @__PURE__ */ e(C.Popup, {
516
- render: /* @__PURE__ */ e(q, {}),
517
- "data-block": !0,
518
- finalFocus: !1,
519
- children: n.map((c) => /* @__PURE__ */ e(C.Item, {
520
- title: c,
521
- render: /* @__PURE__ */ e(U, {}),
522
- onClick: () => {
523
- o.chain().focus().setFontFamily(c).run(), l(c);
524
- },
525
- children: c
526
- }, c))
527
- })
528
- }) })] });
529
- }, _t = "_button_583n5_1", At = { button: _t }, ce = d.forwardRef(function({ children: t, variant: i, color: r, icon: n, ...s }, l) {
506
+ }, [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 },
513
+ event: () => {
514
+ o.chain().focus().setFontFamily(c).run(), l(c);
515
+ }
516
+ }));
517
+ return /* @__PURE__ */ e(z, {
518
+ trigger: /* @__PURE__ */ e("span", {
519
+ style: { fontFamily: s },
520
+ children: s?.[0]
521
+ }),
522
+ triggerTitle: s || "Font Family",
523
+ active: s !== (i?.fontFamily ?? n[0]),
524
+ items: d,
525
+ direction: "block"
526
+ });
527
+ }, _t = "_button_583n5_1", At = { button: _t }, ce = u.forwardRef(function({ children: t, variant: i, color: r, icon: n, ...s }, l) {
530
528
  return /* @__PURE__ */ p("button", {
531
529
  ref: l,
532
530
  className: At.button,
@@ -535,28 +533,28 @@ var dt = () => {
535
533
  ...s,
536
534
  children: [n, t]
537
535
  });
538
- }), wt = "_dialog_vbrv2_1", It = "_backdrop_vbrv2_27", yt = "_content_vbrv2_46", Tt = "_footer_vbrv2_52", St = "_close_vbrv2_59", x = {
536
+ }), wt = "_dialog_vbrv2_1", yt = "_backdrop_vbrv2_27", It = "_content_vbrv2_46", Tt = "_footer_vbrv2_52", St = "_close_vbrv2_59", x = {
539
537
  dialog: wt,
540
- backdrop: It,
541
- content: yt,
538
+ backdrop: yt,
539
+ content: It,
542
540
  footer: Tt,
543
541
  close: St
544
542
  };
545
- function j({ Trigger: o, children: t, maxWidth: i, onOpenChange: r, footer: n }) {
546
- const s = d.useContext(M), l = d.useCallback((c) => {
547
- s?.editor.setEditable(!c, !1), r?.(c);
543
+ 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);
548
546
  }, [s, r]);
549
- return /* @__PURE__ */ p(I.Root, {
547
+ return /* @__PURE__ */ p(y.Root, {
550
548
  modal: !0,
551
549
  onOpenChange: l,
552
550
  children: [/* @__PURE__ */ e("span", {
553
- onClick: (c) => c.stopPropagation(),
554
- children: /* @__PURE__ */ e(I.Trigger, { render: o })
555
- }), /* @__PURE__ */ p(I.Portal, { children: [/* @__PURE__ */ e(I.Backdrop, { className: x.backdrop }), /* @__PURE__ */ p(I.Popup, {
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, {
556
554
  className: x.dialog,
557
555
  style: i ? { maxWidth: i } : void 0,
558
556
  children: [
559
- /* @__PURE__ */ e(I.Close, {
557
+ /* @__PURE__ */ e(y.Close, {
560
558
  className: x.close,
561
559
  "aria-label": "Close",
562
560
  children: /* @__PURE__ */ e(be, {
@@ -577,7 +575,7 @@ function j({ Trigger: o, children: t, maxWidth: i, onOpenChange: r, footer: n })
577
575
  });
578
576
  }
579
577
  function H({ children: o, variant: t, color: i, icon: r, ...n }) {
580
- return /* @__PURE__ */ e(I.Close, {
578
+ return /* @__PURE__ */ e(y.Close, {
581
579
  render: /* @__PURE__ */ e(ce, {
582
580
  variant: t,
583
581
  color: i,
@@ -587,40 +585,40 @@ function H({ children: o, variant: t, color: i, icon: r, ...n }) {
587
585
  children: o
588
586
  });
589
587
  }
590
- var xt = "_group_56lao_1", Ft = "_label_56lao_8", Ht = "_input_56lao_14", B = {
588
+ var xt = "_group_56lao_1", Ft = "_label_56lao_8", Ht = "_input_56lao_14", P = {
591
589
  group: xt,
592
590
  label: Ft,
593
591
  input: Ht
594
592
  };
595
593
  function E({ label: o, id: t, ...i }) {
596
594
  return /* @__PURE__ */ p("div", {
597
- className: B.group,
595
+ className: P.group,
598
596
  children: [o && /* @__PURE__ */ e("label", {
599
- className: B.label,
597
+ className: P.label,
600
598
  htmlFor: t,
601
599
  children: o
602
600
  }), /* @__PURE__ */ e("input", {
603
601
  id: t,
604
- className: B.input,
602
+ className: P.input,
605
603
  ...i
606
604
  })]
607
605
  });
608
606
  }
609
607
  var Lt = () => {
610
- const { editor: o } = f(), t = g({
608
+ const { editor: o } = v(), t = g({
611
609
  editor: o,
612
- selector: (c) => ({
613
- isImage: c.editor?.isActive("image"),
614
- imageAttrs: c.editor?.getAttributes("image")
610
+ selector: (d) => ({
611
+ isImage: d.editor?.isActive("image"),
612
+ imageAttrs: d.editor?.getAttributes("image")
615
613
  })
616
- }), [i, r] = d.useState(t.imageAttrs.src || ""), [n, s] = d.useState(t.imageAttrs.alt || ""), l = () => {
614
+ }), [i, r] = u.useState(t.imageAttrs.src || ""), [n, s] = u.useState(t.imageAttrs.alt || ""), l = () => {
617
615
  o.chain().focus().setImage({
618
616
  src: i,
619
617
  alt: n
620
618
  }).run();
621
619
  };
622
- return /* @__PURE__ */ p(j, {
623
- Trigger: /* @__PURE__ */ e(u, {
620
+ return /* @__PURE__ */ p(U, {
621
+ Trigger: /* @__PURE__ */ e(f, {
624
622
  title: "Image",
625
623
  "data-active": t.isImage,
626
624
  children: /* @__PURE__ */ e(ge, {})
@@ -638,23 +636,23 @@ var Lt = () => {
638
636
  label: "Image URL",
639
637
  type: "url",
640
638
  value: i,
641
- onChange: (c) => r(c.target.value),
639
+ onChange: (d) => r(d.target.value),
642
640
  required: !0
643
641
  }), /* @__PURE__ */ e(E, {
644
642
  label: "Alt Text",
645
643
  type: "text",
646
644
  value: n,
647
- onChange: (c) => s(c.target.value)
645
+ onChange: (d) => s(d.target.value)
648
646
  })]
649
647
  });
650
648
  }, Rt = () => {
651
- const { editor: o } = f(), t = g({
649
+ const { editor: o } = v(), t = g({
652
650
  editor: o,
653
651
  selector: (a) => ({
654
652
  isLink: a.editor?.isActive("link"),
655
653
  linkAttrs: a.editor?.getAttributes("link")
656
654
  })
657
- }), [i, r] = d.useState(t.linkAttrs.href || ""), [n, s] = d.useState(t.linkAttrs.alt || ""), l = (a) => !a || a.startsWith("http://") || a.startsWith("https://") ? a : `https://${a}`, c = () => {
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 = () => {
658
656
  const a = l(i);
659
657
  o.chain().focus().insertContent({
660
658
  type: "text",
@@ -664,40 +662,40 @@ var Lt = () => {
664
662
  attrs: { href: a }
665
663
  }]
666
664
  }).run();
667
- }, h = () => {
668
- const a = o.getAttributes("link"), { from: m, to: A, $from: S } = o.state.selection;
665
+ }, c = () => {
666
+ const a = o.getAttributes("link"), { from: m, to: _, $from: S } = o.state.selection;
669
667
  let b;
670
- if (m !== A) b = o.state.doc.textBetween(m, A);
668
+ if (m !== _) b = o.state.doc.textBetween(m, _);
671
669
  else {
672
- const y = S.parent.textContent, T = S.parentOffset;
673
- let w = T, k = T;
674
- for (; w > 0 && !/\s/.test(y[w - 1]); ) w--;
675
- for (; k < y.length && !/\s/.test(y[k]); ) k++;
676
- if (b = y.slice(w, k), b) {
677
- const _ = S.start();
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) {
675
+ const k = S.start();
678
676
  o.commands.setTextSelection({
679
- from: _ + w,
680
- to: _ + k
677
+ from: k + A,
678
+ to: k + C
681
679
  });
682
680
  }
683
681
  }
684
682
  r(a.href || ""), s(b || a.alt || "");
685
683
  };
686
- return /* @__PURE__ */ p(j, {
687
- Trigger: /* @__PURE__ */ e(u, {
684
+ return /* @__PURE__ */ p(U, {
685
+ Trigger: /* @__PURE__ */ e(f, {
688
686
  title: "Link",
689
687
  "data-active": t.isLink,
690
688
  children: /* @__PURE__ */ e(pe, {})
691
689
  }),
692
690
  maxWidth: "400px",
693
- onOpenChange: (a) => a && h(),
691
+ onOpenChange: (a) => a && c(),
694
692
  footer: /* @__PURE__ */ p(N, { children: [t.isLink && /* @__PURE__ */ e(H, {
695
693
  color: "error",
696
694
  variant: "secondary",
697
695
  onClick: () => o.chain().focus().unsetLink().run(),
698
696
  children: "Remove"
699
697
  }), /* @__PURE__ */ e(H, {
700
- onClick: c,
698
+ onClick: d,
701
699
  disabled: !i,
702
700
  children: "Save"
703
701
  })] }),
@@ -714,36 +712,36 @@ var Lt = () => {
714
712
  onChange: (a) => s(a.target.value)
715
713
  })]
716
714
  });
717
- }, Et = "_label_1kiov_1", Nt = "_root_1kiov_11", zt = "_thumb_1kiov_44", P = {
715
+ }, Et = "_label_1kiov_1", Nt = "_root_1kiov_11", zt = "_thumb_1kiov_44", M = {
718
716
  label: Et,
719
717
  root: Nt,
720
718
  thumb: zt
721
719
  };
722
720
  function Dt({ checked: o, onCheckedChange: t, label: i }) {
723
721
  return /* @__PURE__ */ p("label", {
724
- className: P.label,
725
- children: [/* @__PURE__ */ e("span", { children: i }), /* @__PURE__ */ e(le.Root, {
726
- className: P.root,
722
+ className: M.label,
723
+ children: [/* @__PURE__ */ e("span", { children: i }), /* @__PURE__ */ e(re.Root, {
724
+ className: M.root,
727
725
  checked: o,
728
726
  onCheckedChange: t,
729
- children: /* @__PURE__ */ e(le.Thumb, { className: P.thumb })
727
+ children: /* @__PURE__ */ e(re.Thumb, { className: M.thumb })
730
728
  })]
731
729
  });
732
730
  }
733
731
  var Bt = () => {
734
- const { editor: o } = f(), t = g({
732
+ const { editor: o } = v(), t = g({
735
733
  editor: o,
736
734
  selector: (a) => ({
737
735
  isTable: a.editor.isActive("table"),
738
736
  tableAttrs: a.editor.getAttributes("table")
739
737
  })
740
- }), [i, r] = O(!1), n = xe(null), s = D((a) => {
738
+ }), [i, r] = O(!1), n = xe(null), s = B((a) => {
741
739
  n.current && clearTimeout(n.current), n.current = setTimeout(a, 100);
742
740
  }, []);
743
- d.useEffect(() => () => {
741
+ u.useEffect(() => () => {
744
742
  n.current && clearTimeout(n.current);
745
743
  }, []);
746
- const l = D(() => {
744
+ const l = B(() => {
747
745
  s(() => o.chain().focus().insertTable({
748
746
  rows: 2,
749
747
  cols: 4,
@@ -753,9 +751,9 @@ var Bt = () => {
753
751
  o,
754
752
  i,
755
753
  s
756
- ]), c = D(() => {
754
+ ]), d = B(() => {
757
755
  r((a) => !a), s(() => o.chain().focus().toggleHeaderRow().run());
758
- }, [o, s]), h = [
756
+ }, [o, s]), c = [
759
757
  {
760
758
  text: "Column left",
761
759
  icon: /* @__PURE__ */ e(L, {}),
@@ -778,48 +776,48 @@ var Bt = () => {
778
776
  },
779
777
  {
780
778
  text: "Delete Column",
781
- icon: /* @__PURE__ */ e(z, {}),
779
+ icon: /* @__PURE__ */ e(D, {}),
782
780
  event: () => o.chain().focus().deleteColumn().run()
783
781
  },
784
782
  {
785
783
  text: "Delete Row",
786
- icon: /* @__PURE__ */ e(z, {}),
784
+ icon: /* @__PURE__ */ e(D, {}),
787
785
  event: () => o.chain().focus().deleteRow().run()
788
786
  }
789
787
  ];
790
- return t.isTable ? /* @__PURE__ */ p(j, {
791
- Trigger: /* @__PURE__ */ e(u, {
788
+ return t.isTable ? /* @__PURE__ */ p(U, {
789
+ Trigger: /* @__PURE__ */ e(f, {
792
790
  title: "Table",
793
791
  "data-active": t.isTable,
794
- children: /* @__PURE__ */ e(J, {})
792
+ children: /* @__PURE__ */ e(j, {})
795
793
  }),
796
794
  maxWidth: "320px",
797
795
  footer: /* @__PURE__ */ e(H, {
798
796
  variant: "secondary",
799
797
  color: "error",
800
- icon: /* @__PURE__ */ e(z, {}),
798
+ icon: /* @__PURE__ */ e(D, {}),
801
799
  onClick: () => o.chain().focus().deleteTable().run(),
802
800
  children: "Delete Table"
803
801
  }),
804
802
  children: [/* @__PURE__ */ e(Dt, {
805
803
  checked: i,
806
- onCheckedChange: c,
804
+ onCheckedChange: d,
807
805
  label: "Title Row"
808
806
  }), /* @__PURE__ */ e("div", {
809
807
  className: F.wuContentEditorTable,
810
- children: h.map(({ text: a, icon: m, event: A }) => /* @__PURE__ */ e(ce, {
811
- onClick: A,
808
+ children: c.map(({ text: a, icon: m, event: _ }) => /* @__PURE__ */ e(ce, {
809
+ onClick: _,
812
810
  variant: "secondary",
813
811
  icon: m,
814
812
  children: a
815
813
  }, a))
816
814
  })]
817
- }) : /* @__PURE__ */ e(u, {
815
+ }) : /* @__PURE__ */ e(f, {
818
816
  title: "Table",
819
817
  onClick: l,
820
- children: /* @__PURE__ */ e(J, {})
818
+ children: /* @__PURE__ */ e(j, {})
821
819
  });
822
- }, se = {
820
+ }, le = {
823
821
  block: /* @__PURE__ */ e(Ye, {}),
824
822
  fontFamily: /* @__PURE__ */ e(kt, {}),
825
823
  fontSize: /* @__PURE__ */ e(Ct, {}),
@@ -873,8 +871,8 @@ var Bt = () => {
873
871
  "|",
874
872
  "html",
875
873
  "clear"
876
- ], Ot = (o) => {
877
- const { editor: t, customFonts: i, defaultValues: r, children: n, items: s = Pt, isHtml: l, setIsHtml: c, htmlSourceEnabled: h, ...a } = o;
874
+ ], Mt = (o) => {
875
+ const { editor: t, customFonts: i, defaultValues: r, children: n, items: s = Pt, isHtml: l, setIsHtml: d, htmlSourceEnabled: c, ...a } = o;
878
876
  return /* @__PURE__ */ e("div", {
879
877
  ...a,
880
878
  children: /* @__PURE__ */ p(We, {
@@ -882,60 +880,60 @@ var Bt = () => {
882
880
  customFonts: i,
883
881
  defaultValues: r,
884
882
  isHtml: l,
885
- setIsHtml: c,
886
- htmlSourceEnabled: h,
887
- children: [s.map((m, A) => /* @__PURE__ */ e(N, { children: l && m !== "html" ? /* @__PURE__ */ e("span", {
883
+ setIsHtml: d,
884
+ htmlSourceEnabled: c,
885
+ children: [s.map((m, _) => /* @__PURE__ */ e(N, { children: l && m !== "html" ? /* @__PURE__ */ e("span", {
888
886
  style: {
889
887
  pointerEvents: "none",
890
888
  opacity: 0.4
891
889
  },
892
- children: se[m]
893
- }) : se[m] }, m + A)), n]
890
+ children: le[m]
891
+ }) : le[m] }, m + _)), n]
894
892
  })
895
893
  });
896
894
  };
897
- function Mt(...o) {
895
+ function Ot(...o) {
898
896
  return o.filter(Boolean).join(" ");
899
897
  }
900
- function oo({ defaultValue: o, onUpdate: t, className: i, toolbarPosition: r = "top", customToolbarChildren: n, toolbarItems: s, hideToolbar: l, readonly: c, autoFocus: h, customFonts: a, htmlSource: m, isHtml: A, setIsHtml: S, defaultValues: b, ...y }) {
901
- const [T, w] = d.useState((A ?? !1) && !!m);
902
- d.useEffect(() => {
903
- 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`.');
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);
900
+ u.useEffect(() => {
901
+ 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`.');
904
902
  }, []);
905
- const k = d.useRef(o || ""), _ = Se({
906
- editable: !c,
907
- autofocus: h ? "end" : !1,
903
+ const C = u.useRef(o || ""), k = Se({
904
+ editable: !d,
905
+ autofocus: c ? "end" : !1,
908
906
  extensions: Ue,
909
907
  content: R(o || ""),
910
- onUpdate: ({ editor: v }) => {
911
- t && t(R(v.getHTML()));
908
+ onUpdate: ({ editor: h }) => {
909
+ t && t(R(h.getHTML()));
912
910
  }
913
911
  });
914
- d.useEffect(() => {
915
- if (!_ || !b) return;
916
- const v = _.chain();
917
- 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();
918
- }, [_]);
919
- const de = (v) => {
920
- v ? k.current = _?.getHTML() ?? "" : _?.commands.setContent(R(k.current)), t && t(R(k.current)), w(v), S?.(v);
912
+ u.useEffect(() => {
913
+ 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();
916
+ }, [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);
921
919
  };
922
920
  return /* @__PURE__ */ p("div", {
923
- className: Mt(F.wuContentEditorRoot, i),
921
+ className: Ot(F.wuContentEditorRoot, i),
924
922
  "data-position": r,
925
923
  "data-slot": "wu-content-editor-root",
926
- onClick: (v) => {
927
- if ((v.ctrlKey || v.metaKey) && v.target instanceof HTMLElement) {
928
- const K = v.target.closest("a");
929
- if (K?.href) {
930
- window.open(K.href, "_blank", "noopener,noreferrer");
924
+ onClick: (h) => {
925
+ if ((h.ctrlKey || h.metaKey) && h.target instanceof HTMLElement) {
926
+ const W = h.target.closest("a");
927
+ if (W?.href) {
928
+ window.open(W.href, "_blank", "noopener,noreferrer");
931
929
  return;
932
930
  }
933
931
  }
934
- T || _?.chain().focus().run();
932
+ T || k?.chain().focus().run();
935
933
  },
936
- ...y,
937
- children: [!l && /* @__PURE__ */ e(Ot, {
938
- editor: _,
934
+ ...I,
935
+ children: [!l && /* @__PURE__ */ e(Mt, {
936
+ editor: k,
939
937
  customFonts: a,
940
938
  defaultValues: b,
941
939
  className: F.wuContentEditorToolbar,
@@ -946,13 +944,13 @@ function oo({ defaultValue: o, onUpdate: t, className: i, toolbarPosition: r = "
946
944
  "data-slot": "wu-content-editor-toolbar",
947
945
  children: n
948
946
  }), T && m ? /* @__PURE__ */ e(m, {
949
- defaultValue: k.current,
950
- onUpdate: (v) => {
951
- k.current = v ?? "", t && t(v ?? "");
947
+ defaultValue: C.current,
948
+ onUpdate: (h) => {
949
+ C.current = h ?? "", t && t(h ?? "");
952
950
  },
953
- readonly: c
951
+ readonly: d
954
952
  }) : /* @__PURE__ */ e(Te, {
955
- editor: _,
953
+ editor: k,
956
954
  className: F.wuContentEditor,
957
955
  "data-slot": "wu-content-editor"
958
956
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm-questionpro/wick-ui-editor",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
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",
@@ -99,8 +99,8 @@
99
99
  "vite-plugin-dts": "^4.5.4",
100
100
  "vitest": "^4.1.8",
101
101
  "@npm-questionpro/wick-ui-eslint-config": "1.0.0",
102
- "@wick-ui/tsconfig": "1.0.0",
103
- "@npm-questionpro/wick-ui-lib": "2.7.0"
102
+ "@npm-questionpro/wick-ui-lib": "2.8.0",
103
+ "@wick-ui/tsconfig": "1.0.0"
104
104
  },
105
105
  "scripts": {
106
106
  "build": "tsc --noEmit && vite build && tsc -p tsconfig.types.json && tsc-alias -p tsconfig.types.json",