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