@npm-questionpro/wick-ui-editor 0.13.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as v, Fragment as F } from "react/jsx-runtime";
|
|
2
2
|
import { useEditorState as p, useEditor as V, EditorContent as X } from "@tiptap/react";
|
|
3
3
|
import Y from "clsx";
|
|
4
|
-
import
|
|
4
|
+
import h, { useState as I, useRef as Z, useCallback as B } from "react";
|
|
5
5
|
import Q from "@tiptap/extension-image";
|
|
6
6
|
import { TaskList as tt, TaskItem as et } from "@tiptap/extension-list";
|
|
7
7
|
import ot from "@tiptap/extension-subscript";
|
|
8
8
|
import nt from "@tiptap/extension-superscript";
|
|
9
9
|
import { TableKit as it } from "@tiptap/extension-table";
|
|
10
10
|
import rt from "@tiptap/extension-text-align";
|
|
11
|
-
import { TextStyle as st, Color as ct, BackgroundColor as lt, LineHeight as at, FontSize as
|
|
11
|
+
import { TextStyle as st, Color as ct, BackgroundColor as lt, LineHeight as at, FontSize as ut, FontFamily as dt } from "@tiptap/extension-text-style";
|
|
12
12
|
import mt from "@tiptap/starter-kit";
|
|
13
|
-
import { WuIcon as
|
|
14
|
-
import { DropdownMenu as
|
|
15
|
-
import
|
|
16
|
-
const
|
|
17
|
-
wuContentEditor:
|
|
13
|
+
import { WuIcon as f, WuModal as D, WuModalHeader as H, WuModalContent as z, WuInput as L, WuModalFooter as R, WuModalClose as x, WuToggle as ht, WuButton as q } from "@npm-questionpro/wick-ui-lib";
|
|
14
|
+
import { DropdownMenu as j, DropdownMenuTrigger as $, DropdownMenuContent as K, DropdownMenuItem as U } from "@radix-ui/react-dropdown-menu";
|
|
15
|
+
import ft from "dompurify";
|
|
16
|
+
const gt = "_wuContentEditor_1kzbo_8", pt = "_wuContentEditorTable_1kzbo_1", wt = "_wuContentEditorContainer_1kzbo_8", Ct = "_wuContentEditorToolbar_1kzbo_80", vt = "_wuContentEditorAction_1kzbo_107", bt = "_wuContentEditorDropdown_1kzbo_133", At = "_wuContentEditorDropdownItem_1kzbo_146", kt = "_wuContentEditorFontSize_1kzbo_157", Et = "_wuContentEditorModal_1kzbo_171", yt = "_wuCodeEditor_1kzbo_175", Tt = "_wuFormatCode_1kzbo_185", St = "_wuCodeEditorPreview_1kzbo_198", xt = "_wuCodeEditorInput_1kzbo_213", a = {
|
|
17
|
+
wuContentEditor: gt,
|
|
18
18
|
wuContentEditorTable: pt,
|
|
19
19
|
wuContentEditorContainer: wt,
|
|
20
20
|
wuContentEditorToolbar: Ct,
|
|
@@ -24,41 +24,42 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
24
24
|
wuContentEditorFontSize: kt,
|
|
25
25
|
wuContentEditorModal: Et,
|
|
26
26
|
wuCodeEditor: yt,
|
|
27
|
-
|
|
27
|
+
wuFormatCode: Tt,
|
|
28
|
+
wuCodeEditorPreview: St,
|
|
28
29
|
wuCodeEditorInput: xt
|
|
29
|
-
},
|
|
30
|
+
}, Ft = [
|
|
30
31
|
mt.configure({
|
|
31
32
|
link: {
|
|
32
33
|
openOnClick: !1,
|
|
33
34
|
autolink: !0,
|
|
34
35
|
defaultProtocol: "https",
|
|
35
36
|
protocols: ["http", "https"],
|
|
36
|
-
isAllowedUri: (t,
|
|
37
|
+
isAllowedUri: (t, o) => {
|
|
37
38
|
try {
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
39
|
+
const n = t.includes(":") ? new URL(t) : new URL(`${o.defaultProtocol}://${t}`);
|
|
40
|
+
if (!o.defaultValidate(n.href))
|
|
40
41
|
return !1;
|
|
41
|
-
const i = ["ftp", "file", "mailto"],
|
|
42
|
-
if (i.includes(
|
|
43
|
-
(
|
|
44
|
-
).includes(
|
|
42
|
+
const i = ["ftp", "file", "mailto"], s = n.protocol.replace(":", "");
|
|
43
|
+
if (i.includes(s) || !o.protocols.map(
|
|
44
|
+
(r) => typeof r == "string" ? r : r.scheme
|
|
45
|
+
).includes(s))
|
|
45
46
|
return !1;
|
|
46
|
-
const
|
|
47
|
+
const u = [
|
|
47
48
|
"example-phishing.com",
|
|
48
49
|
"malicious-site.net"
|
|
49
|
-
], c =
|
|
50
|
-
return !
|
|
50
|
+
], c = n.hostname;
|
|
51
|
+
return !u.includes(c);
|
|
51
52
|
} catch {
|
|
52
53
|
return !1;
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
56
|
shouldAutoLink: (t) => {
|
|
56
57
|
try {
|
|
57
|
-
const
|
|
58
|
+
const o = t.includes(":") ? new URL(t) : new URL(`https://${t}`), n = [
|
|
58
59
|
"example-no-autolink.com",
|
|
59
60
|
"another-no-autolink.com"
|
|
60
|
-
], i =
|
|
61
|
-
return !
|
|
61
|
+
], i = o.hostname;
|
|
62
|
+
return !n.includes(i);
|
|
62
63
|
} catch {
|
|
63
64
|
return !1;
|
|
64
65
|
}
|
|
@@ -76,8 +77,8 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
76
77
|
tt,
|
|
77
78
|
et,
|
|
78
79
|
at,
|
|
79
|
-
dt,
|
|
80
80
|
ut,
|
|
81
|
+
dt,
|
|
81
82
|
Q.configure({
|
|
82
83
|
resize: {
|
|
83
84
|
enabled: !0,
|
|
@@ -88,44 +89,46 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
88
89
|
it.configure({
|
|
89
90
|
table: { resizable: !0 }
|
|
90
91
|
})
|
|
91
|
-
], J =
|
|
92
|
+
], J = h.createContext(
|
|
92
93
|
null
|
|
93
|
-
),
|
|
94
|
+
), Lt = ({
|
|
94
95
|
editor: t,
|
|
95
|
-
children:
|
|
96
|
-
customFonts:
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
children: o,
|
|
97
|
+
customFonts: n,
|
|
98
|
+
isHtml: i,
|
|
99
|
+
setIsHtml: s
|
|
100
|
+
}) => /* @__PURE__ */ e(J.Provider, { value: { editor: t, customFonts: n, isHtml: i, setIsHtml: s }, children: o }), g = () => {
|
|
101
|
+
const t = h.useContext(J);
|
|
99
102
|
if (!t)
|
|
100
103
|
throw new Error("useToolbar must be used within a ToolbarProvider");
|
|
101
104
|
return t;
|
|
102
|
-
},
|
|
103
|
-
var
|
|
104
|
-
const [
|
|
105
|
-
|
|
105
|
+
}, M = ({ action: t, defaultValue: o }) => {
|
|
106
|
+
var s;
|
|
107
|
+
const [n, i] = h.useState(
|
|
108
|
+
o || t.items.find((l) => l.active) || t.items[0]
|
|
106
109
|
);
|
|
107
|
-
return
|
|
110
|
+
return h.useEffect(() => {
|
|
108
111
|
i(
|
|
109
|
-
|
|
112
|
+
o || t.items.find((l) => l.active) || t.items[0]
|
|
110
113
|
);
|
|
111
|
-
}, [t,
|
|
114
|
+
}, [t, o]), /* @__PURE__ */ v(j, { children: [
|
|
112
115
|
/* @__PURE__ */ e(
|
|
113
116
|
$,
|
|
114
117
|
{
|
|
115
118
|
className: a.wuContentEditorAction,
|
|
116
119
|
"data-active": t.active,
|
|
117
|
-
children: /* @__PURE__ */ e(
|
|
120
|
+
children: /* @__PURE__ */ e(f, { icon: n.icon })
|
|
118
121
|
}
|
|
119
122
|
),
|
|
120
123
|
/* @__PURE__ */ e(
|
|
121
|
-
|
|
124
|
+
K,
|
|
122
125
|
{
|
|
123
126
|
align: "start",
|
|
124
127
|
onCloseAutoFocus: (l) => l.preventDefault(),
|
|
125
128
|
className: a.wuContentEditorDropdown,
|
|
126
129
|
"data-inline": !0,
|
|
127
|
-
children: (
|
|
128
|
-
|
|
130
|
+
children: (s = t.items) == null ? void 0 : s.map((l) => /* @__PURE__ */ e(
|
|
131
|
+
U,
|
|
129
132
|
{
|
|
130
133
|
onClick: () => {
|
|
131
134
|
l.event(), i(l);
|
|
@@ -136,7 +139,7 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
136
139
|
{
|
|
137
140
|
className: a.wuContentEditorAction,
|
|
138
141
|
"data-active": l.active,
|
|
139
|
-
children: /* @__PURE__ */ e(
|
|
142
|
+
children: /* @__PURE__ */ e(f, { icon: l.icon })
|
|
140
143
|
}
|
|
141
144
|
)
|
|
142
145
|
},
|
|
@@ -145,75 +148,75 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
145
148
|
}
|
|
146
149
|
)
|
|
147
150
|
] });
|
|
148
|
-
},
|
|
149
|
-
const { editor: t } = g(),
|
|
151
|
+
}, _t = () => {
|
|
152
|
+
const { editor: t } = g(), o = p({
|
|
150
153
|
editor: t,
|
|
151
154
|
selector: (i) => {
|
|
152
|
-
var
|
|
155
|
+
var s, l, u, c, r, d, w;
|
|
153
156
|
return {
|
|
154
|
-
isLeft: (
|
|
157
|
+
isLeft: (s = i.editor) == null ? void 0 : s.isActive({ textAlign: "left" }),
|
|
155
158
|
isCenter: (l = i.editor) == null ? void 0 : l.isActive({ textAlign: "center" }),
|
|
156
|
-
isRight: (
|
|
159
|
+
isRight: (u = i.editor) == null ? void 0 : u.isActive({ textAlign: "right" }),
|
|
157
160
|
isJustify: (c = i.editor) == null ? void 0 : c.isActive({ textAlign: "justify" }),
|
|
158
|
-
isAligned: ((
|
|
161
|
+
isAligned: ((r = i.editor) == null ? void 0 : r.isActive({ textAlign: "center" })) || ((d = i.editor) == null ? void 0 : d.isActive({ textAlign: "right" })) || ((w = i.editor) == null ? void 0 : w.isActive({ textAlign: "justify" }))
|
|
159
162
|
};
|
|
160
163
|
}
|
|
161
|
-
}),
|
|
164
|
+
}), n = [
|
|
162
165
|
{
|
|
163
166
|
id: "left",
|
|
164
167
|
icon: "wm-format-align-left",
|
|
165
168
|
event: () => t.chain().focus().setTextAlign("left").run(),
|
|
166
169
|
tooltip: "Align Left",
|
|
167
|
-
active:
|
|
170
|
+
active: o.isLeft
|
|
168
171
|
},
|
|
169
172
|
{
|
|
170
173
|
id: "center",
|
|
171
174
|
icon: "wm-format-align-center",
|
|
172
175
|
event: () => t.chain().focus().setTextAlign("center").run(),
|
|
173
176
|
tooltip: "Align Center",
|
|
174
|
-
active:
|
|
177
|
+
active: o.isCenter
|
|
175
178
|
},
|
|
176
179
|
{
|
|
177
180
|
id: "right",
|
|
178
181
|
icon: "wm-format-align-right",
|
|
179
182
|
event: () => t.chain().focus().setTextAlign("right").run(),
|
|
180
183
|
tooltip: "Align Right",
|
|
181
|
-
active:
|
|
184
|
+
active: o.isRight
|
|
182
185
|
},
|
|
183
186
|
{
|
|
184
187
|
id: "justify",
|
|
185
188
|
icon: "wm-format-align-justify",
|
|
186
189
|
event: () => t.chain().focus().setTextAlign("justify").run(),
|
|
187
190
|
tooltip: "Justify",
|
|
188
|
-
active:
|
|
191
|
+
active: o.isJustify
|
|
189
192
|
}
|
|
190
193
|
];
|
|
191
194
|
return /* @__PURE__ */ e(
|
|
192
|
-
|
|
195
|
+
M,
|
|
193
196
|
{
|
|
194
197
|
action: {
|
|
195
198
|
id: "style",
|
|
196
|
-
active:
|
|
199
|
+
active: o.isAligned,
|
|
197
200
|
icon: "wm-format-paragraph",
|
|
198
|
-
items:
|
|
201
|
+
items: n
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
);
|
|
202
205
|
}, Nt = () => {
|
|
203
|
-
const { editor: t } = g(),
|
|
206
|
+
const { editor: t } = g(), o = p({
|
|
204
207
|
editor: t,
|
|
205
|
-
selector: ({ editor:
|
|
206
|
-
bgColor:
|
|
208
|
+
selector: ({ editor: n }) => ({
|
|
209
|
+
bgColor: n.getAttributes("textStyle").backgroundColor
|
|
207
210
|
})
|
|
208
211
|
});
|
|
209
|
-
return /* @__PURE__ */
|
|
212
|
+
return /* @__PURE__ */ v(
|
|
210
213
|
"label",
|
|
211
214
|
{
|
|
212
215
|
className: a.wuContentEditorAction,
|
|
213
216
|
htmlFor: "bg-color",
|
|
214
217
|
title: "Background Color",
|
|
215
218
|
children: [
|
|
216
|
-
/* @__PURE__ */ e(
|
|
219
|
+
/* @__PURE__ */ e(f, { icon: "wm-border-color", style: { color: o.bgColor } }),
|
|
217
220
|
/* @__PURE__ */ e(
|
|
218
221
|
"input",
|
|
219
222
|
{
|
|
@@ -221,77 +224,77 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
221
224
|
id: "bg-color",
|
|
222
225
|
name: "bg-color",
|
|
223
226
|
defaultValue: "#fff",
|
|
224
|
-
onChange: (
|
|
227
|
+
onChange: (n) => t.chain().focus().setBackgroundColor(n.target.value).run()
|
|
225
228
|
}
|
|
226
229
|
)
|
|
227
230
|
]
|
|
228
231
|
}
|
|
229
232
|
);
|
|
230
|
-
},
|
|
231
|
-
const { editor: t } = g(),
|
|
233
|
+
}, It = () => {
|
|
234
|
+
const { editor: t } = g(), o = p({
|
|
232
235
|
editor: t,
|
|
233
236
|
selector: (i) => {
|
|
234
|
-
var
|
|
237
|
+
var s, l, u, c, r, d;
|
|
235
238
|
return {
|
|
236
|
-
isParagraph: (
|
|
239
|
+
isParagraph: (s = i.editor) == null ? void 0 : s.isActive("paragraph"),
|
|
237
240
|
isH1: (l = i.editor) == null ? void 0 : l.isActive("heading", { level: 1 }),
|
|
238
|
-
isH2: (
|
|
241
|
+
isH2: (u = i.editor) == null ? void 0 : u.isActive("heading", { level: 2 }),
|
|
239
242
|
isH3: (c = i.editor) == null ? void 0 : c.isActive("heading", { level: 3 }),
|
|
240
|
-
isH4: (
|
|
241
|
-
isStyle: (
|
|
243
|
+
isH4: (r = i.editor) == null ? void 0 : r.isActive("heading", { level: 4 }),
|
|
244
|
+
isStyle: (d = i.editor) == null ? void 0 : d.isActive("heading")
|
|
242
245
|
};
|
|
243
246
|
}
|
|
244
|
-
}),
|
|
247
|
+
}), n = [
|
|
245
248
|
{
|
|
246
249
|
id: "paragraph",
|
|
247
250
|
icon: "wm-format-paragraph",
|
|
248
251
|
event: () => t.chain().focus().setParagraph().run(),
|
|
249
|
-
active:
|
|
252
|
+
active: o.isParagraph
|
|
250
253
|
},
|
|
251
254
|
{
|
|
252
255
|
id: "h1",
|
|
253
256
|
icon: "wm-format-h1",
|
|
254
257
|
event: () => t.chain().focus().setHeading({ level: 1 }).run(),
|
|
255
|
-
active:
|
|
258
|
+
active: o.isH1
|
|
256
259
|
},
|
|
257
260
|
{
|
|
258
261
|
id: "h2",
|
|
259
262
|
icon: "wm-format-h2",
|
|
260
263
|
event: () => t.chain().focus().setHeading({ level: 2 }).run(),
|
|
261
|
-
active:
|
|
264
|
+
active: o.isH2
|
|
262
265
|
},
|
|
263
266
|
{
|
|
264
267
|
id: "h3",
|
|
265
268
|
icon: "wm-format-h3",
|
|
266
269
|
event: () => t.chain().focus().setHeading({ level: 3 }).run(),
|
|
267
|
-
active:
|
|
270
|
+
active: o.isH3
|
|
268
271
|
},
|
|
269
272
|
{
|
|
270
273
|
id: "h4",
|
|
271
274
|
icon: "wm-format-h4",
|
|
272
275
|
event: () => t.chain().focus().setHeading({ level: 4 }).run(),
|
|
273
|
-
active:
|
|
276
|
+
active: o.isH4
|
|
274
277
|
}
|
|
275
278
|
];
|
|
276
279
|
return /* @__PURE__ */ e(
|
|
277
|
-
|
|
280
|
+
M,
|
|
278
281
|
{
|
|
279
282
|
action: {
|
|
280
283
|
id: "style",
|
|
281
|
-
active:
|
|
284
|
+
active: o.isStyle,
|
|
282
285
|
icon: "wm-format-paragraph",
|
|
283
|
-
items:
|
|
286
|
+
items: n
|
|
284
287
|
},
|
|
285
|
-
defaultValue:
|
|
288
|
+
defaultValue: n.find((i) => i.active)
|
|
286
289
|
}
|
|
287
290
|
);
|
|
288
|
-
},
|
|
289
|
-
const { editor: t } = g(),
|
|
291
|
+
}, Dt = () => {
|
|
292
|
+
const { editor: t } = g(), o = p({
|
|
290
293
|
editor: t,
|
|
291
|
-
selector: (
|
|
294
|
+
selector: (n) => {
|
|
292
295
|
var i;
|
|
293
296
|
return {
|
|
294
|
-
blockquote: (i =
|
|
297
|
+
blockquote: (i = n.editor) == null ? void 0 : i.isActive("blockquote")
|
|
295
298
|
};
|
|
296
299
|
}
|
|
297
300
|
});
|
|
@@ -300,20 +303,20 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
300
303
|
{
|
|
301
304
|
title: "quote",
|
|
302
305
|
className: a.wuContentEditorAction,
|
|
303
|
-
"data-active":
|
|
304
|
-
onClick: (
|
|
305
|
-
|
|
306
|
+
"data-active": o.blockquote,
|
|
307
|
+
onClick: (n) => {
|
|
308
|
+
n.preventDefault(), t.chain().focus().toggleBlockquote().run();
|
|
306
309
|
},
|
|
307
|
-
children: /* @__PURE__ */ e(
|
|
310
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-format-quote" })
|
|
308
311
|
}
|
|
309
312
|
);
|
|
310
|
-
},
|
|
311
|
-
const { editor: t } = g(),
|
|
313
|
+
}, Ht = () => {
|
|
314
|
+
const { editor: t } = g(), o = p({
|
|
312
315
|
editor: t,
|
|
313
|
-
selector: (
|
|
316
|
+
selector: (n) => {
|
|
314
317
|
var i;
|
|
315
318
|
return {
|
|
316
|
-
bold: (i =
|
|
319
|
+
bold: (i = n.editor) == null ? void 0 : i.isActive("bold")
|
|
317
320
|
};
|
|
318
321
|
}
|
|
319
322
|
});
|
|
@@ -322,173 +325,173 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
322
325
|
{
|
|
323
326
|
title: "Bold",
|
|
324
327
|
className: a.wuContentEditorAction,
|
|
325
|
-
"data-active":
|
|
326
|
-
onClick: (
|
|
327
|
-
|
|
328
|
+
"data-active": o.bold,
|
|
329
|
+
onClick: (n) => {
|
|
330
|
+
n.preventDefault(), t.chain().focus().toggleBold().run();
|
|
328
331
|
},
|
|
329
|
-
children: /* @__PURE__ */ e(
|
|
332
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-format-bold" })
|
|
330
333
|
}
|
|
331
334
|
);
|
|
332
|
-
},
|
|
335
|
+
}, zt = () => {
|
|
333
336
|
const { editor: t } = g();
|
|
334
|
-
return /* @__PURE__ */ e(
|
|
337
|
+
return /* @__PURE__ */ e(F, { children: [
|
|
335
338
|
{
|
|
336
339
|
id: "clear",
|
|
337
340
|
icon: "wm-format-clear",
|
|
338
341
|
event: () => t.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
339
342
|
tooltip: "Clear Formatting"
|
|
340
343
|
}
|
|
341
|
-
].map((
|
|
344
|
+
].map((n) => /* @__PURE__ */ e(
|
|
342
345
|
"button",
|
|
343
346
|
{
|
|
344
|
-
title:
|
|
347
|
+
title: n.tooltip,
|
|
345
348
|
className: a.wuContentEditorAction,
|
|
346
349
|
onClick: (i) => {
|
|
347
|
-
i.preventDefault(),
|
|
350
|
+
i.preventDefault(), n.event();
|
|
348
351
|
},
|
|
349
|
-
children: /* @__PURE__ */ e(
|
|
352
|
+
children: /* @__PURE__ */ e(f, { icon: n.icon })
|
|
350
353
|
},
|
|
351
|
-
|
|
354
|
+
n.id
|
|
352
355
|
)) });
|
|
353
356
|
}, Rt = () => {
|
|
354
|
-
const { editor: t } = g(),
|
|
357
|
+
const { editor: t } = g(), o = p({
|
|
355
358
|
editor: t,
|
|
356
|
-
selector: (
|
|
357
|
-
code:
|
|
359
|
+
selector: (n) => ({
|
|
360
|
+
code: n.editor.isActive("code")
|
|
358
361
|
})
|
|
359
362
|
});
|
|
360
363
|
return /* @__PURE__ */ e(
|
|
361
364
|
"button",
|
|
362
365
|
{
|
|
363
366
|
className: a.wuContentEditorAction,
|
|
364
|
-
"data-active":
|
|
367
|
+
"data-active": o.code,
|
|
365
368
|
title: "Code line",
|
|
366
|
-
onMouseDown: (
|
|
367
|
-
|
|
369
|
+
onMouseDown: (n) => {
|
|
370
|
+
n.preventDefault(), t.chain().focus().toggleCode().run();
|
|
368
371
|
},
|
|
369
|
-
children: /* @__PURE__ */ e(
|
|
372
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-code" })
|
|
370
373
|
}
|
|
371
374
|
);
|
|
372
375
|
}, Mt = () => {
|
|
373
|
-
const { editor: t } = g(),
|
|
376
|
+
const { editor: t } = g(), o = p({
|
|
374
377
|
editor: t,
|
|
375
378
|
selector: (c) => {
|
|
376
|
-
var
|
|
379
|
+
var r, d;
|
|
377
380
|
return {
|
|
378
|
-
isImage: (
|
|
379
|
-
imageAttrs: (
|
|
381
|
+
isImage: (r = c.editor) == null ? void 0 : r.isActive("image"),
|
|
382
|
+
imageAttrs: (d = c.editor) == null ? void 0 : d.getAttributes("image")
|
|
380
383
|
};
|
|
381
384
|
}
|
|
382
|
-
}), [
|
|
383
|
-
t.chain().focus().setImage({ src:
|
|
385
|
+
}), [n, i] = h.useState(o.imageAttrs.src || ""), [s, l] = h.useState(o.imageAttrs.alt || ""), u = () => {
|
|
386
|
+
t.chain().focus().setImage({ src: n, alt: s }).run();
|
|
384
387
|
};
|
|
385
|
-
return /* @__PURE__ */
|
|
386
|
-
|
|
388
|
+
return /* @__PURE__ */ v(
|
|
389
|
+
D,
|
|
387
390
|
{
|
|
388
391
|
Trigger: /* @__PURE__ */ e(
|
|
389
392
|
"button",
|
|
390
393
|
{
|
|
391
394
|
className: a.wuContentEditorAction,
|
|
392
|
-
"data-active":
|
|
393
|
-
children: /* @__PURE__ */ e(
|
|
395
|
+
"data-active": o.isImage,
|
|
396
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-image" })
|
|
394
397
|
}
|
|
395
398
|
),
|
|
396
399
|
maxWidth: "400px",
|
|
397
400
|
children: [
|
|
398
|
-
/* @__PURE__ */ e(
|
|
399
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ e(H, { style: { display: "none" } }),
|
|
402
|
+
/* @__PURE__ */ v(z, { className: a.wuContentEditorModal, children: [
|
|
400
403
|
/* @__PURE__ */ e(
|
|
401
|
-
|
|
404
|
+
L,
|
|
402
405
|
{
|
|
403
406
|
Label: "Image URL",
|
|
404
407
|
type: "url",
|
|
405
|
-
value:
|
|
408
|
+
value: n,
|
|
406
409
|
onChange: (c) => i(c.target.value),
|
|
407
410
|
required: !0
|
|
408
411
|
}
|
|
409
412
|
),
|
|
410
413
|
/* @__PURE__ */ e(
|
|
411
|
-
|
|
414
|
+
L,
|
|
412
415
|
{
|
|
413
416
|
Label: "Alt Text",
|
|
414
417
|
type: "text",
|
|
415
|
-
value:
|
|
418
|
+
value: s,
|
|
416
419
|
onChange: (c) => l(c.target.value)
|
|
417
420
|
}
|
|
418
421
|
)
|
|
419
422
|
] }),
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
/* @__PURE__ */ e(
|
|
422
|
-
/* @__PURE__ */ e(
|
|
423
|
+
/* @__PURE__ */ v(R, { children: [
|
|
424
|
+
/* @__PURE__ */ e(x, { variant: "secondary", children: "Cancel" }),
|
|
425
|
+
/* @__PURE__ */ e(x, { onClick: u, disabled: !n, children: "Save" })
|
|
423
426
|
] })
|
|
424
427
|
]
|
|
425
428
|
}
|
|
426
429
|
);
|
|
427
|
-
},
|
|
428
|
-
const { editor: t } = g(),
|
|
430
|
+
}, Ot = () => {
|
|
431
|
+
const { editor: t } = g(), o = p({
|
|
429
432
|
editor: t,
|
|
430
|
-
selector: (
|
|
431
|
-
var
|
|
433
|
+
selector: (r) => {
|
|
434
|
+
var d, w;
|
|
432
435
|
return {
|
|
433
|
-
isLink: (
|
|
434
|
-
linkAttrs: (w =
|
|
436
|
+
isLink: (d = r.editor) == null ? void 0 : d.isActive("link"),
|
|
437
|
+
linkAttrs: (w = r.editor) == null ? void 0 : w.getAttributes("link")
|
|
435
438
|
};
|
|
436
439
|
}
|
|
437
|
-
}), [
|
|
440
|
+
}), [n, i] = h.useState(o.linkAttrs.href || ""), [s, l] = h.useState(o.linkAttrs.alt || ""), u = () => {
|
|
438
441
|
t.chain().focus().insertContent({
|
|
439
442
|
type: "text",
|
|
440
|
-
text:
|
|
441
|
-
marks: [{ type: "link", attrs: { href:
|
|
443
|
+
text: s || n,
|
|
444
|
+
marks: [{ type: "link", attrs: { href: n } }]
|
|
442
445
|
}).run();
|
|
443
446
|
}, c = () => {
|
|
444
|
-
const { $from:
|
|
445
|
-
let
|
|
446
|
-
for (;
|
|
447
|
-
|
|
448
|
-
for (; A <
|
|
447
|
+
const { $from: r } = t.state.selection, d = r.parent.textContent, w = r.parentOffset;
|
|
448
|
+
let k = w, A = w;
|
|
449
|
+
for (; k > 0 && !/\s/.test(d[k - 1]); )
|
|
450
|
+
k--;
|
|
451
|
+
for (; A < d.length && !/\s/.test(d[A]); )
|
|
449
452
|
A++;
|
|
450
|
-
const
|
|
451
|
-
t.commands.setTextSelection({ from:
|
|
453
|
+
const y = r.start(), E = y + k, b = y + A, C = d.slice(k, A);
|
|
454
|
+
t.commands.setTextSelection({ from: E, to: b }), i(o.linkAttrs.href || ""), l(C || o.linkAttrs.alt || "");
|
|
452
455
|
};
|
|
453
|
-
return /* @__PURE__ */
|
|
454
|
-
|
|
456
|
+
return /* @__PURE__ */ v(
|
|
457
|
+
D,
|
|
455
458
|
{
|
|
456
459
|
Trigger: /* @__PURE__ */ e(
|
|
457
460
|
"button",
|
|
458
461
|
{
|
|
459
462
|
className: a.wuContentEditorAction,
|
|
460
|
-
"data-active":
|
|
461
|
-
children: /* @__PURE__ */ e(
|
|
463
|
+
"data-active": o.isLink,
|
|
464
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-link" })
|
|
462
465
|
}
|
|
463
466
|
),
|
|
464
467
|
maxWidth: "400px",
|
|
465
|
-
onOpenChange: (
|
|
468
|
+
onOpenChange: (r) => r && c(),
|
|
466
469
|
children: [
|
|
467
|
-
/* @__PURE__ */ e(
|
|
468
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ e(H, { style: { display: "none" } }),
|
|
471
|
+
/* @__PURE__ */ v(z, { className: a.wuContentEditorModal, children: [
|
|
469
472
|
/* @__PURE__ */ e(
|
|
470
|
-
|
|
473
|
+
L,
|
|
471
474
|
{
|
|
472
475
|
Label: "Link",
|
|
473
476
|
type: "url",
|
|
474
|
-
value:
|
|
475
|
-
onChange: (
|
|
477
|
+
value: n,
|
|
478
|
+
onChange: (r) => i(r.target.value),
|
|
476
479
|
required: !0
|
|
477
480
|
}
|
|
478
481
|
),
|
|
479
482
|
/* @__PURE__ */ e(
|
|
480
|
-
|
|
483
|
+
L,
|
|
481
484
|
{
|
|
482
485
|
Label: "Text to display",
|
|
483
486
|
type: "text",
|
|
484
|
-
value:
|
|
485
|
-
onChange: (
|
|
487
|
+
value: s,
|
|
488
|
+
onChange: (r) => l(r.target.value)
|
|
486
489
|
}
|
|
487
490
|
)
|
|
488
491
|
] }),
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
|
|
491
|
-
|
|
492
|
+
/* @__PURE__ */ v(R, { children: [
|
|
493
|
+
o.isLink && /* @__PURE__ */ e(
|
|
494
|
+
x,
|
|
492
495
|
{
|
|
493
496
|
color: "error",
|
|
494
497
|
onClick: () => t.chain().focus().unsetLink().run(),
|
|
@@ -496,24 +499,24 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
496
499
|
children: "Remove"
|
|
497
500
|
}
|
|
498
501
|
),
|
|
499
|
-
/* @__PURE__ */ e(
|
|
502
|
+
/* @__PURE__ */ e(x, { onClick: u, disabled: !n, children: "Save" })
|
|
500
503
|
] })
|
|
501
504
|
]
|
|
502
505
|
}
|
|
503
506
|
);
|
|
504
|
-
},
|
|
505
|
-
const { editor: t } = g(),
|
|
507
|
+
}, Bt = () => {
|
|
508
|
+
const { editor: t } = g(), o = p({
|
|
506
509
|
editor: t,
|
|
507
|
-
selector: (
|
|
508
|
-
isTable:
|
|
509
|
-
tableAttrs:
|
|
510
|
+
selector: (r) => ({
|
|
511
|
+
isTable: r.editor.isActive("table"),
|
|
512
|
+
tableAttrs: r.editor.getAttributes("table")
|
|
510
513
|
})
|
|
511
|
-
}), [
|
|
512
|
-
|
|
513
|
-
t.chain().focus().insertTable({ rows: 2, cols: 4, withHeaderRow:
|
|
514
|
+
}), [n, i] = I(!1), s = Z(null), l = B(() => {
|
|
515
|
+
s.current = setTimeout(() => {
|
|
516
|
+
t.chain().focus().insertTable({ rows: 2, cols: 4, withHeaderRow: n }).run();
|
|
514
517
|
}, 100);
|
|
515
|
-
}, [t,
|
|
516
|
-
i((
|
|
518
|
+
}, [t, n]), u = B(() => {
|
|
519
|
+
i((r) => !r), s.current = setTimeout(() => {
|
|
517
520
|
t.chain().focus().toggleHeaderRow().run();
|
|
518
521
|
}, 100);
|
|
519
522
|
}, [t]), c = [
|
|
@@ -548,43 +551,43 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
548
551
|
event: () => t.chain().focus().deleteRow().run()
|
|
549
552
|
}
|
|
550
553
|
];
|
|
551
|
-
return
|
|
552
|
-
|
|
554
|
+
return o.isTable ? /* @__PURE__ */ v(
|
|
555
|
+
D,
|
|
553
556
|
{
|
|
554
557
|
Trigger: /* @__PURE__ */ e(
|
|
555
558
|
"button",
|
|
556
559
|
{
|
|
557
560
|
className: a.wuContentEditorAction,
|
|
558
|
-
"data-active":
|
|
559
|
-
children: /* @__PURE__ */ e(
|
|
561
|
+
"data-active": o.isTable,
|
|
562
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-table" })
|
|
560
563
|
}
|
|
561
564
|
),
|
|
562
565
|
maxWidth: "320px",
|
|
563
566
|
children: [
|
|
564
|
-
/* @__PURE__ */ e(
|
|
565
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ e(H, { style: { display: "none" } }),
|
|
568
|
+
/* @__PURE__ */ v(z, { className: a.wuContentEditorModal, children: [
|
|
566
569
|
/* @__PURE__ */ e(
|
|
567
570
|
ht,
|
|
568
571
|
{
|
|
569
|
-
checked:
|
|
570
|
-
onClick:
|
|
572
|
+
checked: n,
|
|
573
|
+
onClick: u,
|
|
571
574
|
Label: "Title Row",
|
|
572
575
|
labelPosition: "left"
|
|
573
576
|
}
|
|
574
577
|
),
|
|
575
|
-
/* @__PURE__ */ e("div", { className: a.wuContentEditorTable, children: c.map(({ text:
|
|
578
|
+
/* @__PURE__ */ e("div", { className: a.wuContentEditorTable, children: c.map(({ text: r, icon: d, event: w }) => /* @__PURE__ */ e(
|
|
576
579
|
q,
|
|
577
580
|
{
|
|
578
581
|
onClick: w,
|
|
579
582
|
variant: "secondary",
|
|
580
|
-
Icon: /* @__PURE__ */ e(
|
|
581
|
-
children:
|
|
583
|
+
Icon: /* @__PURE__ */ e(f, { icon: d }),
|
|
584
|
+
children: r
|
|
582
585
|
},
|
|
583
|
-
|
|
586
|
+
r
|
|
584
587
|
)) })
|
|
585
588
|
] }),
|
|
586
|
-
/* @__PURE__ */ e(
|
|
587
|
-
|
|
589
|
+
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
|
|
590
|
+
x,
|
|
588
591
|
{
|
|
589
592
|
onClick: () => t.chain().focus().deleteTable().run(),
|
|
590
593
|
variant: "outline",
|
|
@@ -601,14 +604,14 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
601
604
|
{
|
|
602
605
|
onClick: l,
|
|
603
606
|
className: a.wuContentEditorAction,
|
|
604
|
-
children: /* @__PURE__ */ e(
|
|
607
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-table" })
|
|
605
608
|
}
|
|
606
609
|
);
|
|
607
|
-
},
|
|
608
|
-
const { editor: t, customFonts:
|
|
610
|
+
}, Pt = () => {
|
|
611
|
+
const { editor: t, customFonts: o } = g(), n = p({
|
|
609
612
|
editor: t,
|
|
610
|
-
selector: (
|
|
611
|
-
currentFontFamily:
|
|
613
|
+
selector: (u) => ({
|
|
614
|
+
currentFontFamily: u.editor.getAttributes("textStyle").fontFamily || ""
|
|
612
615
|
})
|
|
613
616
|
}), i = [
|
|
614
617
|
"Fira Sans",
|
|
@@ -616,55 +619,55 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
616
619
|
"Poppins",
|
|
617
620
|
"JetBrains Mono",
|
|
618
621
|
"Montserrat",
|
|
619
|
-
...
|
|
620
|
-
], [
|
|
621
|
-
|
|
622
|
+
...o || []
|
|
623
|
+
], [s, l] = I(
|
|
624
|
+
n.currentFontFamily || i[0]
|
|
622
625
|
);
|
|
623
|
-
return
|
|
624
|
-
var
|
|
626
|
+
return h.useEffect(() => {
|
|
627
|
+
var u;
|
|
625
628
|
l(
|
|
626
|
-
((
|
|
629
|
+
((u = n.currentFontFamily) == null ? void 0 : u.replace(/"/g, "")) || i[0]
|
|
627
630
|
);
|
|
628
|
-
}, [
|
|
631
|
+
}, [n.currentFontFamily]), /* @__PURE__ */ v(j, { children: [
|
|
629
632
|
/* @__PURE__ */ e(
|
|
630
633
|
$,
|
|
631
634
|
{
|
|
632
635
|
className: a.wuContentEditorAction,
|
|
633
|
-
"data-active":
|
|
634
|
-
style: { fontFamily:
|
|
635
|
-
title:
|
|
636
|
-
children:
|
|
636
|
+
"data-active": s !== "Fira Sans",
|
|
637
|
+
style: { fontFamily: s },
|
|
638
|
+
title: s || "Font Family",
|
|
639
|
+
children: s == null ? void 0 : s[0]
|
|
637
640
|
}
|
|
638
641
|
),
|
|
639
642
|
/* @__PURE__ */ e(
|
|
640
|
-
|
|
643
|
+
K,
|
|
641
644
|
{
|
|
642
645
|
align: "start",
|
|
643
646
|
className: a.wuContentEditorDropdown,
|
|
644
647
|
"data-block": !0,
|
|
645
|
-
onCloseAutoFocus: (
|
|
646
|
-
children: i.map((
|
|
647
|
-
|
|
648
|
+
onCloseAutoFocus: (u) => u.preventDefault(),
|
|
649
|
+
children: i.map((u) => /* @__PURE__ */ e(
|
|
650
|
+
U,
|
|
648
651
|
{
|
|
649
|
-
title:
|
|
652
|
+
title: u,
|
|
650
653
|
className: a.wuContentEditorDropdownItem,
|
|
651
654
|
onSelect: () => {
|
|
652
|
-
t.chain().focus().setFontFamily(
|
|
655
|
+
t.chain().focus().setFontFamily(u).run(), l(u);
|
|
653
656
|
},
|
|
654
|
-
children:
|
|
657
|
+
children: u
|
|
655
658
|
},
|
|
656
|
-
|
|
659
|
+
u
|
|
657
660
|
))
|
|
658
661
|
}
|
|
659
662
|
)
|
|
660
663
|
] });
|
|
661
|
-
},
|
|
662
|
-
const { editor: t } = g(),
|
|
664
|
+
}, Wt = () => {
|
|
665
|
+
const { editor: t } = g(), o = p({
|
|
663
666
|
editor: t,
|
|
664
|
-
selector: (
|
|
667
|
+
selector: (n) => {
|
|
665
668
|
var i;
|
|
666
669
|
return {
|
|
667
|
-
italic: (i =
|
|
670
|
+
italic: (i = n.editor) == null ? void 0 : i.isActive("italic")
|
|
668
671
|
};
|
|
669
672
|
}
|
|
670
673
|
});
|
|
@@ -673,83 +676,83 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
673
676
|
{
|
|
674
677
|
title: "Italic",
|
|
675
678
|
className: a.wuContentEditorAction,
|
|
676
|
-
"data-active":
|
|
677
|
-
onClick: (
|
|
678
|
-
|
|
679
|
+
"data-active": o.italic,
|
|
680
|
+
onClick: (n) => {
|
|
681
|
+
n.preventDefault(), t.chain().focus().toggleItalic().run();
|
|
679
682
|
},
|
|
680
|
-
children: /* @__PURE__ */ e(
|
|
683
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-format-italic" })
|
|
681
684
|
}
|
|
682
685
|
);
|
|
683
|
-
},
|
|
684
|
-
const { editor: t } = g(),
|
|
686
|
+
}, qt = () => {
|
|
687
|
+
const { editor: t } = g(), o = p({
|
|
685
688
|
editor: t,
|
|
686
689
|
selector: (i) => {
|
|
687
|
-
var
|
|
690
|
+
var s, l, u, c, r, d;
|
|
688
691
|
return {
|
|
689
|
-
isUl: (
|
|
692
|
+
isUl: (s = i.editor) == null ? void 0 : s.isActive("bulletList"),
|
|
690
693
|
isOl: (l = i.editor) == null ? void 0 : l.isActive("orderedList"),
|
|
691
|
-
isTodo: (
|
|
692
|
-
isList: ((c = i.editor) == null ? void 0 : c.isActive("bulletList")) || ((
|
|
694
|
+
isTodo: (u = i.editor) == null ? void 0 : u.isActive("taskList"),
|
|
695
|
+
isList: ((c = i.editor) == null ? void 0 : c.isActive("bulletList")) || ((r = i.editor) == null ? void 0 : r.isActive("orderedList")) || ((d = i.editor) == null ? void 0 : d.isActive("taskList"))
|
|
693
696
|
};
|
|
694
697
|
}
|
|
695
|
-
}),
|
|
698
|
+
}), n = [
|
|
696
699
|
{
|
|
697
700
|
id: "ul",
|
|
698
701
|
icon: "wm-format-list-bulleted",
|
|
699
702
|
event: () => t.chain().focus().toggleBulletList().run(),
|
|
700
|
-
active:
|
|
703
|
+
active: o.isUl,
|
|
701
704
|
tooltip: "Bulleted List"
|
|
702
705
|
},
|
|
703
706
|
{
|
|
704
707
|
id: "ol",
|
|
705
708
|
icon: "wm-format-list-numbered",
|
|
706
709
|
event: () => t.chain().focus().toggleOrderedList().run(),
|
|
707
|
-
active:
|
|
710
|
+
active: o.isOl,
|
|
708
711
|
tooltip: "Numbered List"
|
|
709
712
|
},
|
|
710
713
|
{
|
|
711
714
|
id: "todo",
|
|
712
715
|
icon: "wm-checklist",
|
|
713
716
|
event: () => t.chain().focus().toggleTaskList().run(),
|
|
714
|
-
active:
|
|
717
|
+
active: o.isTodo,
|
|
715
718
|
tooltip: "To-Do List"
|
|
716
719
|
}
|
|
717
720
|
];
|
|
718
721
|
return /* @__PURE__ */ e(
|
|
719
|
-
|
|
722
|
+
M,
|
|
720
723
|
{
|
|
721
724
|
action: {
|
|
722
725
|
id: "style",
|
|
723
|
-
active:
|
|
726
|
+
active: o.isList,
|
|
724
727
|
icon: "wm-format-paragraph",
|
|
725
|
-
items:
|
|
728
|
+
items: n
|
|
726
729
|
}
|
|
727
730
|
}
|
|
728
731
|
);
|
|
729
|
-
},
|
|
730
|
-
const { editor: t } = g(), [
|
|
732
|
+
}, jt = ["e", "E", "+", "-"], P = 1, $t = () => {
|
|
733
|
+
const { editor: t } = g(), [o, n] = I(16), i = p({
|
|
731
734
|
editor: t,
|
|
732
735
|
selector: (c) => ({
|
|
733
736
|
fontSize: c.editor.getAttributes("textStyle").fontSize
|
|
734
737
|
})
|
|
735
|
-
}),
|
|
738
|
+
}), s = (c) => {
|
|
736
739
|
t.chain().focus().setFontSize(c + "px").run();
|
|
737
740
|
}, l = (c) => {
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
},
|
|
741
|
-
|
|
741
|
+
const r = Math.max(P, c);
|
|
742
|
+
n(r), s(r);
|
|
743
|
+
}, u = (c) => {
|
|
744
|
+
jt.includes(c.key) ? c.preventDefault() : c.key === "Enter" && s(o);
|
|
742
745
|
};
|
|
743
|
-
return
|
|
746
|
+
return h.useEffect(() => {
|
|
744
747
|
var c;
|
|
745
|
-
|
|
746
|
-
}, [i.fontSize]), /* @__PURE__ */
|
|
748
|
+
n(Number((c = i.fontSize) == null ? void 0 : c.replace("px", "")) || 16);
|
|
749
|
+
}, [i.fontSize]), /* @__PURE__ */ v("div", { className: a.wuContentEditorFontSize, children: [
|
|
747
750
|
/* @__PURE__ */ e(
|
|
748
751
|
"button",
|
|
749
752
|
{
|
|
750
753
|
className: a.wuContentEditorAction,
|
|
751
|
-
onClick: () => l(
|
|
752
|
-
disabled:
|
|
754
|
+
onClick: () => l(o - 1),
|
|
755
|
+
disabled: o <= P,
|
|
753
756
|
children: "−"
|
|
754
757
|
}
|
|
755
758
|
),
|
|
@@ -759,29 +762,29 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
759
762
|
type: "number",
|
|
760
763
|
inputMode: "numeric",
|
|
761
764
|
pattern: "[0-9]*",
|
|
762
|
-
value:
|
|
763
|
-
onKeyDown:
|
|
764
|
-
onChange: (c) =>
|
|
765
|
-
onBlur: () =>
|
|
765
|
+
value: o,
|
|
766
|
+
onKeyDown: u,
|
|
767
|
+
onChange: (c) => n(c.target.valueAsNumber),
|
|
768
|
+
onBlur: () => s(o)
|
|
766
769
|
}
|
|
767
770
|
),
|
|
768
771
|
/* @__PURE__ */ e(
|
|
769
772
|
"button",
|
|
770
773
|
{
|
|
771
774
|
className: a.wuContentEditorAction,
|
|
772
|
-
onClick: () => l(
|
|
773
|
-
disabled:
|
|
775
|
+
onClick: () => l(o + 1),
|
|
776
|
+
disabled: o >= 128,
|
|
774
777
|
children: "+"
|
|
775
778
|
}
|
|
776
779
|
)
|
|
777
780
|
] });
|
|
778
|
-
},
|
|
779
|
-
const { editor: t } = g(),
|
|
781
|
+
}, Kt = () => {
|
|
782
|
+
const { editor: t } = g(), o = p({
|
|
780
783
|
editor: t,
|
|
781
|
-
selector: (
|
|
784
|
+
selector: (n) => {
|
|
782
785
|
var i;
|
|
783
786
|
return {
|
|
784
|
-
strikethrough: (i =
|
|
787
|
+
strikethrough: (i = n.editor) == null ? void 0 : i.isActive("strike")
|
|
785
788
|
};
|
|
786
789
|
}
|
|
787
790
|
});
|
|
@@ -790,20 +793,20 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
790
793
|
{
|
|
791
794
|
title: "strikethrough",
|
|
792
795
|
className: a.wuContentEditorAction,
|
|
793
|
-
"data-active":
|
|
794
|
-
onClick: (
|
|
795
|
-
|
|
796
|
+
"data-active": o.strikethrough,
|
|
797
|
+
onClick: (n) => {
|
|
798
|
+
n.preventDefault(), t.chain().focus().toggleStrike().run();
|
|
796
799
|
},
|
|
797
|
-
children: /* @__PURE__ */ e(
|
|
800
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-format-strikethrough" })
|
|
798
801
|
}
|
|
799
802
|
);
|
|
800
|
-
},
|
|
801
|
-
const { editor: t } = g(),
|
|
803
|
+
}, Ut = () => {
|
|
804
|
+
const { editor: t } = g(), o = p({
|
|
802
805
|
editor: t,
|
|
803
|
-
selector: (
|
|
806
|
+
selector: (n) => {
|
|
804
807
|
var i;
|
|
805
808
|
return {
|
|
806
|
-
subscript: (i =
|
|
809
|
+
subscript: (i = n.editor) == null ? void 0 : i.isActive("subscript")
|
|
807
810
|
};
|
|
808
811
|
}
|
|
809
812
|
});
|
|
@@ -812,20 +815,20 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
812
815
|
{
|
|
813
816
|
title: "Subscript",
|
|
814
817
|
className: a.wuContentEditorAction,
|
|
815
|
-
"data-active":
|
|
816
|
-
onClick: (
|
|
817
|
-
|
|
818
|
+
"data-active": o.subscript,
|
|
819
|
+
onClick: (n) => {
|
|
820
|
+
n.preventDefault(), t.chain().focus().toggleSubscript().run();
|
|
818
821
|
},
|
|
819
|
-
children: /* @__PURE__ */ e(
|
|
822
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-subscript" })
|
|
820
823
|
}
|
|
821
824
|
);
|
|
822
|
-
},
|
|
823
|
-
const { editor: t } = g(),
|
|
825
|
+
}, Jt = () => {
|
|
826
|
+
const { editor: t } = g(), o = p({
|
|
824
827
|
editor: t,
|
|
825
|
-
selector: (
|
|
828
|
+
selector: (n) => {
|
|
826
829
|
var i;
|
|
827
830
|
return {
|
|
828
|
-
superscript: (i =
|
|
831
|
+
superscript: (i = n.editor) == null ? void 0 : i.isActive("superscript")
|
|
829
832
|
};
|
|
830
833
|
}
|
|
831
834
|
});
|
|
@@ -834,21 +837,21 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
834
837
|
{
|
|
835
838
|
title: "Superscript",
|
|
836
839
|
className: a.wuContentEditorAction,
|
|
837
|
-
"data-active":
|
|
838
|
-
onClick: (
|
|
839
|
-
|
|
840
|
+
"data-active": o.superscript,
|
|
841
|
+
onClick: (n) => {
|
|
842
|
+
n.preventDefault(), t.chain().focus().toggleSuperscript().run();
|
|
840
843
|
},
|
|
841
|
-
children: /* @__PURE__ */ e(
|
|
844
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-superscript" })
|
|
842
845
|
}
|
|
843
846
|
);
|
|
844
|
-
},
|
|
845
|
-
const { editor: t } = g(),
|
|
847
|
+
}, Gt = () => {
|
|
848
|
+
const { editor: t } = g(), o = p({
|
|
846
849
|
editor: t,
|
|
847
|
-
selector: ({ editor:
|
|
848
|
-
textColor:
|
|
850
|
+
selector: ({ editor: n }) => ({
|
|
851
|
+
textColor: n.getAttributes("textStyle").color
|
|
849
852
|
})
|
|
850
853
|
});
|
|
851
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ v(
|
|
852
855
|
"label",
|
|
853
856
|
{
|
|
854
857
|
className: a.wuContentEditorAction,
|
|
@@ -856,11 +859,11 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
856
859
|
title: "Text Color",
|
|
857
860
|
children: [
|
|
858
861
|
/* @__PURE__ */ e(
|
|
859
|
-
|
|
862
|
+
f,
|
|
860
863
|
{
|
|
861
864
|
icon: "wm-format-color-text",
|
|
862
865
|
className: a.bgColorCursorPointer,
|
|
863
|
-
style: { color:
|
|
866
|
+
style: { color: o.textColor }
|
|
864
867
|
}
|
|
865
868
|
),
|
|
866
869
|
/* @__PURE__ */ e(
|
|
@@ -870,19 +873,19 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
870
873
|
className: a.bgColorHiddenInput,
|
|
871
874
|
id: "text-color",
|
|
872
875
|
defaultValue: "#545E6B",
|
|
873
|
-
onChange: (
|
|
876
|
+
onChange: (n) => t.chain().focus().setColor(n.target.value).run()
|
|
874
877
|
}
|
|
875
878
|
)
|
|
876
879
|
]
|
|
877
880
|
}
|
|
878
881
|
);
|
|
879
|
-
},
|
|
880
|
-
const { editor: t } = g(),
|
|
882
|
+
}, Vt = () => {
|
|
883
|
+
const { editor: t } = g(), o = p({
|
|
881
884
|
editor: t,
|
|
882
|
-
selector: (
|
|
885
|
+
selector: (n) => {
|
|
883
886
|
var i;
|
|
884
887
|
return {
|
|
885
|
-
underline: (i =
|
|
888
|
+
underline: (i = n.editor) == null ? void 0 : i.isActive("underline")
|
|
886
889
|
};
|
|
887
890
|
}
|
|
888
891
|
});
|
|
@@ -891,33 +894,49 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
891
894
|
{
|
|
892
895
|
title: "Underline",
|
|
893
896
|
className: a.wuContentEditorAction,
|
|
894
|
-
"data-active":
|
|
895
|
-
onClick: (
|
|
896
|
-
|
|
897
|
+
"data-active": o.underline,
|
|
898
|
+
onClick: (n) => {
|
|
899
|
+
n.preventDefault(), t.chain().focus().toggleUnderline().run();
|
|
900
|
+
},
|
|
901
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-format-underlined" })
|
|
902
|
+
}
|
|
903
|
+
);
|
|
904
|
+
};
|
|
905
|
+
function Xt() {
|
|
906
|
+
const { isHtml: t, setIsHtml: o } = g();
|
|
907
|
+
return /* @__PURE__ */ e(
|
|
908
|
+
"button",
|
|
909
|
+
{
|
|
910
|
+
title: "HTML source",
|
|
911
|
+
className: a.wuContentEditorAction,
|
|
912
|
+
"data-active": t,
|
|
913
|
+
onClick: (n) => {
|
|
914
|
+
n.preventDefault(), o(!t);
|
|
897
915
|
},
|
|
898
|
-
children: /* @__PURE__ */ e(
|
|
916
|
+
children: /* @__PURE__ */ e(f, { icon: "wm-html" })
|
|
899
917
|
}
|
|
900
918
|
);
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
919
|
+
}
|
|
920
|
+
const W = {
|
|
921
|
+
block: /* @__PURE__ */ e(It, {}),
|
|
922
|
+
fontFamily: /* @__PURE__ */ e(Pt, {}),
|
|
923
|
+
fontSize: /* @__PURE__ */ e($t, {}),
|
|
924
|
+
bold: /* @__PURE__ */ e(Ht, {}),
|
|
925
|
+
italic: /* @__PURE__ */ e(Wt, {}),
|
|
926
|
+
underline: /* @__PURE__ */ e(Vt, {}),
|
|
927
|
+
strike: /* @__PURE__ */ e(Kt, {}),
|
|
928
|
+
color: /* @__PURE__ */ e(Gt, {}),
|
|
910
929
|
bgColor: /* @__PURE__ */ e(Nt, {}),
|
|
911
|
-
list: /* @__PURE__ */ e(
|
|
912
|
-
alignment: /* @__PURE__ */ e(
|
|
930
|
+
list: /* @__PURE__ */ e(qt, {}),
|
|
931
|
+
alignment: /* @__PURE__ */ e(_t, {}),
|
|
913
932
|
image: /* @__PURE__ */ e(Mt, {}),
|
|
914
|
-
link: /* @__PURE__ */ e(
|
|
915
|
-
table: /* @__PURE__ */ e(
|
|
916
|
-
blockquote: /* @__PURE__ */ e(
|
|
917
|
-
superscript: /* @__PURE__ */ e(
|
|
918
|
-
subscript: /* @__PURE__ */ e(
|
|
933
|
+
link: /* @__PURE__ */ e(Ot, {}),
|
|
934
|
+
table: /* @__PURE__ */ e(Bt, {}),
|
|
935
|
+
blockquote: /* @__PURE__ */ e(Dt, {}),
|
|
936
|
+
superscript: /* @__PURE__ */ e(Jt, {}),
|
|
937
|
+
subscript: /* @__PURE__ */ e(Ut, {}),
|
|
919
938
|
codeline: /* @__PURE__ */ e(Rt, {}),
|
|
920
|
-
clear: /* @__PURE__ */ e(
|
|
939
|
+
clear: /* @__PURE__ */ e(zt, {}),
|
|
921
940
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
922
941
|
"|": /* @__PURE__ */ e(
|
|
923
942
|
"div",
|
|
@@ -928,8 +947,9 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
928
947
|
background: "rgb(var(--wu-gray-40))"
|
|
929
948
|
}
|
|
930
949
|
}
|
|
931
|
-
)
|
|
932
|
-
|
|
950
|
+
),
|
|
951
|
+
html: /* @__PURE__ */ e(Xt, {})
|
|
952
|
+
}, Yt = [
|
|
933
953
|
"block",
|
|
934
954
|
"fontFamily",
|
|
935
955
|
"|",
|
|
@@ -955,15 +975,33 @@ const ft = "_wuContentEditor_1kxiu_8", pt = "_wuContentEditorTable_1kxiu_1", wt
|
|
|
955
975
|
"subscript",
|
|
956
976
|
"codeline",
|
|
957
977
|
"|",
|
|
978
|
+
"html",
|
|
958
979
|
"clear"
|
|
959
|
-
],
|
|
960
|
-
const {
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
i
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
980
|
+
], Zt = (t) => {
|
|
981
|
+
const {
|
|
982
|
+
editor: o,
|
|
983
|
+
customFonts: n,
|
|
984
|
+
children: i,
|
|
985
|
+
items: s = Yt,
|
|
986
|
+
isHtml: l,
|
|
987
|
+
setIsHtml: u,
|
|
988
|
+
...c
|
|
989
|
+
} = t;
|
|
990
|
+
return /* @__PURE__ */ e("div", { ...c, children: /* @__PURE__ */ v(
|
|
991
|
+
Lt,
|
|
992
|
+
{
|
|
993
|
+
editor: o,
|
|
994
|
+
customFonts: n,
|
|
995
|
+
isHtml: l,
|
|
996
|
+
setIsHtml: u,
|
|
997
|
+
children: [
|
|
998
|
+
s.map((r, d) => /* @__PURE__ */ e(F, { children: l && r !== "html" ? /* @__PURE__ */ e("span", { style: { pointerEvents: "none", opacity: 0.4 }, children: W[r] }) : W[r] }, r + d)),
|
|
999
|
+
i
|
|
1000
|
+
]
|
|
1001
|
+
}
|
|
1002
|
+
) });
|
|
1003
|
+
}, O = ft();
|
|
1004
|
+
O.setConfig({
|
|
967
1005
|
USE_PROFILES: { html: !0 },
|
|
968
1006
|
ALLOWED_TAGS: [
|
|
969
1007
|
"div",
|
|
@@ -1015,179 +1053,176 @@ B.setConfig({
|
|
|
1015
1053
|
],
|
|
1016
1054
|
ALLOW_DATA_ATTR: !0
|
|
1017
1055
|
});
|
|
1018
|
-
|
|
1019
|
-
if (
|
|
1020
|
-
const
|
|
1021
|
-
(
|
|
1056
|
+
O.addHook("uponSanitizeAttribute", (t, o) => {
|
|
1057
|
+
if (o.attrName === "style") {
|
|
1058
|
+
const n = o.attrValue.toLowerCase();
|
|
1059
|
+
(n.includes("expression") || n.includes("javascript:") || n.includes("url(")) && (o.keepAttr = !1);
|
|
1022
1060
|
}
|
|
1023
1061
|
});
|
|
1024
|
-
function
|
|
1025
|
-
return t ?
|
|
1062
|
+
function S(t) {
|
|
1063
|
+
return t ? O.sanitize(t) : "";
|
|
1026
1064
|
}
|
|
1027
|
-
let
|
|
1028
|
-
function
|
|
1029
|
-
return
|
|
1065
|
+
let N = null;
|
|
1066
|
+
function Qt() {
|
|
1067
|
+
return N || (N = import("shiki").then(
|
|
1030
1068
|
({ createHighlighter: t }) => t({
|
|
1031
1069
|
themes: ["github-light"],
|
|
1032
1070
|
langs: ["html"]
|
|
1033
1071
|
})
|
|
1034
|
-
)),
|
|
1072
|
+
)), N;
|
|
1035
1073
|
}
|
|
1036
|
-
function
|
|
1074
|
+
function te({
|
|
1037
1075
|
defaultValue: t,
|
|
1038
|
-
onUpdate:
|
|
1039
|
-
readonly:
|
|
1076
|
+
onUpdate: o,
|
|
1077
|
+
readonly: n
|
|
1040
1078
|
}) {
|
|
1041
|
-
const [i,
|
|
1042
|
-
async (
|
|
1079
|
+
const [i, s] = h.useState(t || ""), [l, u] = h.useState(""), [c, r] = h.useState(!1), [d, w] = h.useState(!1), k = h.useRef(!1), A = h.useCallback(
|
|
1080
|
+
async (C) => {
|
|
1043
1081
|
try {
|
|
1044
|
-
const [{ format:
|
|
1045
|
-
import("../../standalone-
|
|
1046
|
-
import("../../html-
|
|
1047
|
-
]),
|
|
1082
|
+
const [{ format: m }, { default: T }] = await Promise.all([
|
|
1083
|
+
import("../../standalone-uA6N_bR1.js"),
|
|
1084
|
+
import("../../html-asrO2y6j.js")
|
|
1085
|
+
]), _ = await m(C, {
|
|
1048
1086
|
parser: "html",
|
|
1049
|
-
plugins: [
|
|
1087
|
+
plugins: [T],
|
|
1050
1088
|
htmlWhitespaceSensitivity: "css",
|
|
1051
1089
|
printWidth: 80
|
|
1052
1090
|
});
|
|
1053
|
-
return
|
|
1054
|
-
} catch (
|
|
1055
|
-
return console.error("Format error:",
|
|
1091
|
+
return r(!1), _;
|
|
1092
|
+
} catch (m) {
|
|
1093
|
+
return console.error("Format error:", m), r(!0), C;
|
|
1056
1094
|
}
|
|
1057
1095
|
},
|
|
1058
1096
|
[]
|
|
1059
|
-
),
|
|
1060
|
-
|
|
1061
|
-
const
|
|
1097
|
+
), y = h.useCallback((C) => {
|
|
1098
|
+
Qt().then((m) => {
|
|
1099
|
+
const T = m.codeToHtml(C || " ", {
|
|
1062
1100
|
lang: "html",
|
|
1063
1101
|
theme: "github-light"
|
|
1064
1102
|
});
|
|
1065
|
-
|
|
1066
|
-
}).catch((
|
|
1103
|
+
u(T);
|
|
1104
|
+
}).catch((m) => console.error("Highlight error:", m));
|
|
1067
1105
|
}, []);
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
}, [i,
|
|
1071
|
-
|
|
1106
|
+
h.useEffect(() => {
|
|
1107
|
+
y(i), o == null || o(S(i));
|
|
1108
|
+
}, [i, y, o]), h.useEffect(() => {
|
|
1109
|
+
k.current || !t || (k.current = !0, A(t).then(s));
|
|
1072
1110
|
}, [t, A]);
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1077
|
-
},
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
b.preventDefault();
|
|
1084
|
-
const C = b.currentTarget, k = C.selectionStart, N = C.selectionEnd, G = i.substring(0, k) + " " + i.substring(N);
|
|
1085
|
-
r(G), requestAnimationFrame(() => {
|
|
1086
|
-
C.selectionStart = k + 2, C.selectionEnd = k + 2;
|
|
1111
|
+
const E = async (C) => {
|
|
1112
|
+
C.preventDefault(), w(!0);
|
|
1113
|
+
const m = await A(i);
|
|
1114
|
+
s(m), w(!1);
|
|
1115
|
+
}, b = (C) => {
|
|
1116
|
+
if (C.key === "Tab") {
|
|
1117
|
+
C.preventDefault();
|
|
1118
|
+
const m = C.currentTarget, T = m.selectionStart, _ = m.selectionEnd, G = i.substring(0, T) + " " + i.substring(_);
|
|
1119
|
+
s(G), requestAnimationFrame(() => {
|
|
1120
|
+
m.selectionStart = T + 2, m.selectionEnd = T + 2;
|
|
1087
1121
|
});
|
|
1088
1122
|
}
|
|
1089
1123
|
};
|
|
1090
|
-
return /* @__PURE__ */
|
|
1091
|
-
/* @__PURE__ */
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
className: a.wuCodeEditorInput,
|
|
1120
|
-
disabled: o
|
|
1121
|
-
}
|
|
1122
|
-
)
|
|
1123
|
-
] }) })
|
|
1124
|
-
] });
|
|
1124
|
+
return /* @__PURE__ */ e(F, { children: d ? /* @__PURE__ */ e(F, { children: "Formatting..." }) : /* @__PURE__ */ e("div", { className: a.wuContentEditor, children: /* @__PURE__ */ v("div", { className: a.wuCodeEditor, children: [
|
|
1125
|
+
/* @__PURE__ */ e(
|
|
1126
|
+
q,
|
|
1127
|
+
{
|
|
1128
|
+
variant: "iconOnly",
|
|
1129
|
+
Icon: /* @__PURE__ */ e(f, { icon: "wm-data-object" }),
|
|
1130
|
+
onClick: E,
|
|
1131
|
+
className: a.wuFormatCode,
|
|
1132
|
+
style: { color: c ? "red" : "" }
|
|
1133
|
+
}
|
|
1134
|
+
),
|
|
1135
|
+
/* @__PURE__ */ e(
|
|
1136
|
+
"div",
|
|
1137
|
+
{
|
|
1138
|
+
dangerouslySetInnerHTML: { __html: l },
|
|
1139
|
+
className: a.wuCodeEditorPreview
|
|
1140
|
+
}
|
|
1141
|
+
),
|
|
1142
|
+
/* @__PURE__ */ e(
|
|
1143
|
+
"textarea",
|
|
1144
|
+
{
|
|
1145
|
+
value: i,
|
|
1146
|
+
onChange: (C) => s(C.target.value),
|
|
1147
|
+
onKeyDown: b,
|
|
1148
|
+
className: a.wuCodeEditorInput,
|
|
1149
|
+
disabled: n
|
|
1150
|
+
}
|
|
1151
|
+
)
|
|
1152
|
+
] }) }) });
|
|
1125
1153
|
}
|
|
1126
|
-
function
|
|
1154
|
+
function pe({
|
|
1127
1155
|
defaultValue: t,
|
|
1128
|
-
onUpdate:
|
|
1129
|
-
className:
|
|
1156
|
+
onUpdate: o,
|
|
1157
|
+
className: n,
|
|
1130
1158
|
toolbarPosition: i = "top",
|
|
1131
|
-
customToolbarChildren:
|
|
1159
|
+
customToolbarChildren: s,
|
|
1132
1160
|
toolbarItems: l,
|
|
1133
|
-
hideToolbar:
|
|
1161
|
+
hideToolbar: u,
|
|
1134
1162
|
readonly: c,
|
|
1135
|
-
customFonts:
|
|
1136
|
-
isHtml:
|
|
1137
|
-
|
|
1163
|
+
customFonts: r,
|
|
1164
|
+
isHtml: d,
|
|
1165
|
+
setIsHtml: w,
|
|
1166
|
+
...k
|
|
1138
1167
|
}) {
|
|
1139
|
-
const
|
|
1168
|
+
const [A, y] = h.useState(d ?? !1), E = h.useRef(t || ""), b = V({
|
|
1140
1169
|
editable: !c,
|
|
1141
|
-
extensions:
|
|
1142
|
-
content:
|
|
1143
|
-
onUpdate: ({ editor:
|
|
1144
|
-
|
|
1170
|
+
extensions: Ft,
|
|
1171
|
+
content: S(t || ""),
|
|
1172
|
+
onUpdate: ({ editor: m }) => {
|
|
1173
|
+
o && o(S(m.getHTML()));
|
|
1145
1174
|
}
|
|
1146
|
-
})
|
|
1147
|
-
|
|
1175
|
+
}), C = (m) => {
|
|
1176
|
+
m ? E.current = (b == null ? void 0 : b.getHTML()) ?? "" : b == null || b.commands.setContent(S(E.current)), o && o(S(E.current)), y(m), w == null || w(m);
|
|
1177
|
+
};
|
|
1178
|
+
return /* @__PURE__ */ v(
|
|
1148
1179
|
"div",
|
|
1149
1180
|
{
|
|
1150
|
-
className: Y(a.wuContentEditorContainer,
|
|
1181
|
+
className: Y(a.wuContentEditorContainer, n),
|
|
1151
1182
|
"data-position": i,
|
|
1152
1183
|
"data-slot": "wu-content-editor-container",
|
|
1153
1184
|
onClick: () => {
|
|
1154
|
-
|
|
1185
|
+
A || b == null || b.chain().focus().run();
|
|
1155
1186
|
},
|
|
1156
|
-
...
|
|
1157
|
-
children:
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
defaultValue: t,
|
|
1161
|
-
onUpdate: n,
|
|
1162
|
-
"data-position": i,
|
|
1163
|
-
"data-slot": "wu-content-editor-toolbar",
|
|
1164
|
-
readonly: c
|
|
1165
|
-
}
|
|
1166
|
-
) : /* @__PURE__ */ f(y, { children: [
|
|
1167
|
-
!d && /* @__PURE__ */ e(
|
|
1168
|
-
Yt,
|
|
1187
|
+
...k,
|
|
1188
|
+
children: [
|
|
1189
|
+
!u && /* @__PURE__ */ e(
|
|
1190
|
+
Zt,
|
|
1169
1191
|
{
|
|
1170
|
-
editor:
|
|
1171
|
-
customFonts:
|
|
1192
|
+
editor: b,
|
|
1193
|
+
customFonts: r,
|
|
1172
1194
|
className: a.wuContentEditorToolbar,
|
|
1173
1195
|
items: l,
|
|
1196
|
+
isHtml: A,
|
|
1197
|
+
setIsHtml: C,
|
|
1174
1198
|
"data-slot": "wu-content-editor-toolbar",
|
|
1175
1199
|
"data-position": i,
|
|
1176
|
-
children:
|
|
1200
|
+
children: s
|
|
1177
1201
|
}
|
|
1178
1202
|
),
|
|
1179
|
-
/* @__PURE__ */ e(
|
|
1203
|
+
A ? /* @__PURE__ */ e(
|
|
1204
|
+
te,
|
|
1205
|
+
{
|
|
1206
|
+
defaultValue: E.current,
|
|
1207
|
+
onUpdate: (m) => {
|
|
1208
|
+
E.current = m ?? "", o && o(m ?? "");
|
|
1209
|
+
},
|
|
1210
|
+
"data-position": i,
|
|
1211
|
+
"data-slot": "wu-content-editor",
|
|
1212
|
+
readonly: c
|
|
1213
|
+
}
|
|
1214
|
+
) : /* @__PURE__ */ e(
|
|
1180
1215
|
X,
|
|
1181
1216
|
{
|
|
1182
|
-
editor:
|
|
1217
|
+
editor: b,
|
|
1183
1218
|
className: a.wuContentEditor,
|
|
1184
1219
|
"data-slot": "wu-content-editor"
|
|
1185
1220
|
}
|
|
1186
1221
|
)
|
|
1187
|
-
]
|
|
1222
|
+
]
|
|
1188
1223
|
}
|
|
1189
1224
|
);
|
|
1190
1225
|
}
|
|
1191
1226
|
export {
|
|
1192
|
-
|
|
1227
|
+
pe as WuContentEditor
|
|
1193
1228
|
};
|