@npm-questionpro/wick-ui-editor 2.0.0-next.24 → 2.0.0-next.25

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