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

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