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