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