@npm-questionpro/wick-ui-editor 2.0.0-next.30 → 2.0.0-next.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wick-ui-editor/es/index.js +313 -312
- package/package.json +2 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { EditorContent as
|
|
3
|
-
import f, { useCallback as
|
|
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
|
|
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 f, { 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 h } from "react/jsx-runtime";
|
|
13
13
|
import { Menu as g } from "@base-ui/react/menu";
|
|
14
14
|
import { Dialog as w } from "@base-ui/react/dialog";
|
|
15
|
-
import { Switch as
|
|
16
|
-
var
|
|
17
|
-
|
|
15
|
+
import { Switch as ne } from "@base-ui/react/switch";
|
|
16
|
+
var $e = [
|
|
17
|
+
qe.configure({ link: {
|
|
18
18
|
openOnClick: !1,
|
|
19
19
|
autolink: !0,
|
|
20
20
|
defaultProtocol: "https",
|
|
@@ -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
|
+
], 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);
|
|
34
34
|
} catch {
|
|
35
35
|
return !1;
|
|
36
36
|
}
|
|
@@ -44,98 +44,98 @@ var qe = [
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
} }),
|
|
47
|
-
|
|
47
|
+
Ne.configure({ types: ["heading", "paragraph"] }),
|
|
48
|
+
Fe,
|
|
48
49
|
Re,
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
Me,
|
|
51
|
+
Be,
|
|
51
52
|
De,
|
|
52
|
-
|
|
53
|
+
Le,
|
|
53
54
|
He,
|
|
54
|
-
|
|
55
|
+
Oe,
|
|
55
56
|
Pe,
|
|
56
57
|
ze,
|
|
57
|
-
|
|
58
|
-
Se.configure({
|
|
58
|
+
xe.configure({
|
|
59
59
|
resize: {
|
|
60
60
|
enabled: !0,
|
|
61
61
|
alwaysPreserveAspectRatio: !0
|
|
62
62
|
},
|
|
63
63
|
inline: !0
|
|
64
64
|
}),
|
|
65
|
-
|
|
66
|
-
],
|
|
65
|
+
Ee.configure({ table: { resizable: !0 } })
|
|
66
|
+
], M = f.createContext(null), Ue = ({ editor: o, children: t, customFonts: i, isHtml: r, setIsHtml: n, htmlSourceEnabled: c }) => /* @__PURE__ */ e(M.Provider, {
|
|
67
67
|
value: {
|
|
68
68
|
editor: o,
|
|
69
69
|
customFonts: i,
|
|
70
70
|
isHtml: r,
|
|
71
|
-
setIsHtml:
|
|
71
|
+
setIsHtml: n,
|
|
72
72
|
htmlSourceEnabled: c
|
|
73
73
|
},
|
|
74
74
|
children: t
|
|
75
75
|
}), u = () => {
|
|
76
|
-
const o = f.useContext(
|
|
76
|
+
const o = f.useContext(M);
|
|
77
77
|
if (!o) throw new Error("useToolbar must be used within a ToolbarProvider");
|
|
78
78
|
return o;
|
|
79
|
-
},
|
|
80
|
-
dropdown:
|
|
81
|
-
dropdownItem:
|
|
82
|
-
},
|
|
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 = f.forwardRef(function({ Icon: t, children: i, ...r }, n) {
|
|
83
83
|
return /* @__PURE__ */ h("button", {
|
|
84
|
-
ref:
|
|
84
|
+
ref: n,
|
|
85
85
|
...r,
|
|
86
|
-
className:
|
|
86
|
+
className: Je.item,
|
|
87
87
|
children: [
|
|
88
88
|
t,
|
|
89
89
|
" ",
|
|
90
90
|
i
|
|
91
91
|
]
|
|
92
92
|
});
|
|
93
|
-
}),
|
|
93
|
+
}), q = f.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
|
|
94
94
|
ref: i,
|
|
95
|
-
className:
|
|
95
|
+
className: se.dropdown,
|
|
96
96
|
...t,
|
|
97
97
|
children: o
|
|
98
98
|
}));
|
|
99
|
-
|
|
100
|
-
var
|
|
99
|
+
q.displayName = "DropdownPopup";
|
|
100
|
+
var $ = f.forwardRef(({ children: o, ...t }, i) => /* @__PURE__ */ e("div", {
|
|
101
101
|
ref: i,
|
|
102
|
-
className:
|
|
102
|
+
className: se.dropdownItem,
|
|
103
103
|
...t,
|
|
104
104
|
children: o
|
|
105
105
|
}));
|
|
106
|
-
|
|
107
|
-
function
|
|
106
|
+
$.displayName = "DropdownItem";
|
|
107
|
+
function U({ trigger: o, triggerTitle: t, active: i, items: r, align: n = "start", direction: c = "inline" }) {
|
|
108
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
113
|
}), /* @__PURE__ */ e(g.Portal, { children: /* @__PURE__ */ e(g.Positioner, {
|
|
114
|
-
align:
|
|
114
|
+
align: n,
|
|
115
115
|
sideOffset: 4,
|
|
116
116
|
children: /* @__PURE__ */ e(g.Popup, {
|
|
117
|
-
render: /* @__PURE__ */ e(
|
|
117
|
+
render: /* @__PURE__ */ e(q, {}),
|
|
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((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
129
|
render: /* @__PURE__ */ e(d, {}),
|
|
130
|
-
"data-active":
|
|
131
|
-
title:
|
|
132
|
-
onClick:
|
|
133
|
-
children:
|
|
134
|
-
},
|
|
130
|
+
"data-active": l.active,
|
|
131
|
+
title: l.tooltip,
|
|
132
|
+
onClick: l.event,
|
|
133
|
+
children: l.icon ?? l.label
|
|
134
|
+
}, l.id))
|
|
135
135
|
})
|
|
136
136
|
}) })] });
|
|
137
137
|
}
|
|
138
|
-
var
|
|
138
|
+
var Qe = () => {
|
|
139
139
|
const { editor: o } = u(), t = v({
|
|
140
140
|
editor: o,
|
|
141
141
|
selector: (r) => ({
|
|
@@ -149,47 +149,47 @@ var Je = () => {
|
|
|
149
149
|
}), i = [
|
|
150
150
|
{
|
|
151
151
|
id: "paragraph",
|
|
152
|
-
icon: /* @__PURE__ */ e(
|
|
152
|
+
icon: /* @__PURE__ */ e(Q, {}),
|
|
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(Z, {}),
|
|
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(Y, {}),
|
|
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(V, {}),
|
|
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(ie, {}),
|
|
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(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
188
|
triggerTitle: "Block Style",
|
|
189
189
|
active: t.isHeading,
|
|
190
190
|
items: i
|
|
191
191
|
});
|
|
192
|
-
},
|
|
192
|
+
}, Ve = () => {
|
|
193
193
|
const { editor: o } = u();
|
|
194
194
|
return /* @__PURE__ */ e(d, {
|
|
195
195
|
title: "Bold",
|
|
@@ -200,13 +200,13 @@ var Je = () => {
|
|
|
200
200
|
onClick: (t) => {
|
|
201
201
|
t.preventDefault(), o.chain().focus().toggleBold().run();
|
|
202
202
|
},
|
|
203
|
-
children: /* @__PURE__ */ e(
|
|
203
|
+
children: /* @__PURE__ */ e(ge, {})
|
|
204
204
|
});
|
|
205
|
-
},
|
|
205
|
+
}, Xe = () => {
|
|
206
206
|
const { editor: o } = u();
|
|
207
|
-
return /* @__PURE__ */ e(
|
|
207
|
+
return /* @__PURE__ */ e(N, { children: [{
|
|
208
208
|
id: "clear",
|
|
209
|
-
icon: /* @__PURE__ */ e(
|
|
209
|
+
icon: /* @__PURE__ */ e(Ae, {}),
|
|
210
210
|
event: () => o.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
211
211
|
tooltip: "Clear Formatting"
|
|
212
212
|
}].map((t) => /* @__PURE__ */ e(d, {
|
|
@@ -216,7 +216,7 @@ var Je = () => {
|
|
|
216
216
|
},
|
|
217
217
|
children: t.icon
|
|
218
218
|
}, t.id)) });
|
|
219
|
-
},
|
|
219
|
+
}, Ye = () => {
|
|
220
220
|
const { editor: o } = u();
|
|
221
221
|
return /* @__PURE__ */ e(d, {
|
|
222
222
|
"data-active": v({
|
|
@@ -227,9 +227,9 @@ var Je = () => {
|
|
|
227
227
|
onMouseDown: (t) => {
|
|
228
228
|
t.preventDefault(), o.chain().focus().toggleCode().run();
|
|
229
229
|
},
|
|
230
|
-
children: /* @__PURE__ */ e(
|
|
230
|
+
children: /* @__PURE__ */ e(be, {})
|
|
231
231
|
});
|
|
232
|
-
},
|
|
232
|
+
}, Ze = () => {
|
|
233
233
|
const { editor: o } = u();
|
|
234
234
|
return /* @__PURE__ */ e(d, {
|
|
235
235
|
title: "Italic",
|
|
@@ -240,9 +240,9 @@ var Je = () => {
|
|
|
240
240
|
onClick: (t) => {
|
|
241
241
|
t.preventDefault(), o.chain().focus().toggleItalic().run();
|
|
242
242
|
},
|
|
243
|
-
children: /* @__PURE__ */ e(
|
|
243
|
+
children: /* @__PURE__ */ e(we, {})
|
|
244
244
|
});
|
|
245
|
-
},
|
|
245
|
+
}, Ge = () => {
|
|
246
246
|
const { editor: o } = u(), t = v({
|
|
247
247
|
editor: o,
|
|
248
248
|
selector: (r) => ({
|
|
@@ -254,33 +254,33 @@ var Je = () => {
|
|
|
254
254
|
}), i = [
|
|
255
255
|
{
|
|
256
256
|
id: "ul",
|
|
257
|
-
icon: /* @__PURE__ */ e(
|
|
257
|
+
icon: /* @__PURE__ */ e(J, {}),
|
|
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(re, {}),
|
|
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(ee, {}),
|
|
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(U, {
|
|
278
|
+
trigger: t.isOl ? /* @__PURE__ */ e(re, {}) : t.isTodo ? /* @__PURE__ */ e(ee, {}) : /* @__PURE__ */ e(J, {}),
|
|
279
279
|
triggerTitle: "List Style",
|
|
280
280
|
active: t.isList,
|
|
281
281
|
items: i
|
|
282
282
|
});
|
|
283
|
-
},
|
|
283
|
+
}, et = () => {
|
|
284
284
|
const { editor: o } = u();
|
|
285
285
|
return /* @__PURE__ */ e(d, {
|
|
286
286
|
title: "strikethrough",
|
|
@@ -291,9 +291,9 @@ var Je = () => {
|
|
|
291
291
|
onClick: (t) => {
|
|
292
292
|
t.preventDefault(), o.chain().focus().toggleStrike().run();
|
|
293
293
|
},
|
|
294
|
-
children: /* @__PURE__ */ e(
|
|
294
|
+
children: /* @__PURE__ */ e(de, {})
|
|
295
295
|
});
|
|
296
|
-
},
|
|
296
|
+
}, tt = () => {
|
|
297
297
|
const { editor: o } = u();
|
|
298
298
|
return /* @__PURE__ */ e(d, {
|
|
299
299
|
title: "Subscript",
|
|
@@ -304,9 +304,9 @@ var Je = () => {
|
|
|
304
304
|
onClick: (t) => {
|
|
305
305
|
t.preventDefault(), o.chain().focus().toggleSubscript().run();
|
|
306
306
|
},
|
|
307
|
-
children: /* @__PURE__ */ e(
|
|
307
|
+
children: /* @__PURE__ */ e(fe, {})
|
|
308
308
|
});
|
|
309
|
-
},
|
|
309
|
+
}, ot = () => {
|
|
310
310
|
const { editor: o } = u();
|
|
311
311
|
return /* @__PURE__ */ e(d, {
|
|
312
312
|
title: "Superscript",
|
|
@@ -317,9 +317,9 @@ var Je = () => {
|
|
|
317
317
|
onClick: (t) => {
|
|
318
318
|
t.preventDefault(), o.chain().focus().toggleSuperscript().run();
|
|
319
319
|
},
|
|
320
|
-
children: /* @__PURE__ */ e(
|
|
320
|
+
children: /* @__PURE__ */ e(Ce, {})
|
|
321
321
|
});
|
|
322
|
-
},
|
|
322
|
+
}, it = () => {
|
|
323
323
|
const { editor: o } = u(), t = v({
|
|
324
324
|
editor: o,
|
|
325
325
|
selector: ({ editor: r }) => ({ textColor: r.getAttributes("textStyle").color })
|
|
@@ -327,14 +327,14 @@ var Je = () => {
|
|
|
327
327
|
return /* @__PURE__ */ h(d, {
|
|
328
328
|
title: "Text Color",
|
|
329
329
|
onClick: () => i.current?.click(),
|
|
330
|
-
children: [/* @__PURE__ */ e(
|
|
330
|
+
children: [/* @__PURE__ */ e(ke, { style: { color: t.textColor } }), /* @__PURE__ */ e("input", {
|
|
331
331
|
ref: i,
|
|
332
332
|
type: "color",
|
|
333
333
|
defaultValue: "#545E6B",
|
|
334
334
|
onChange: (r) => o.chain().focus().setColor(r.target.value).run()
|
|
335
335
|
})]
|
|
336
336
|
});
|
|
337
|
-
},
|
|
337
|
+
}, rt = () => {
|
|
338
338
|
const { editor: o } = u();
|
|
339
339
|
return /* @__PURE__ */ e(d, {
|
|
340
340
|
title: "Underline",
|
|
@@ -345,9 +345,9 @@ var Je = () => {
|
|
|
345
345
|
onClick: (t) => {
|
|
346
346
|
t.preventDefault(), o.chain().focus().toggleUnderline().run();
|
|
347
347
|
},
|
|
348
|
-
children: /* @__PURE__ */ e(
|
|
348
|
+
children: /* @__PURE__ */ e(he, {})
|
|
349
349
|
});
|
|
350
|
-
},
|
|
350
|
+
}, nt = () => {
|
|
351
351
|
const { editor: o } = u(), t = v({
|
|
352
352
|
editor: o,
|
|
353
353
|
selector: ({ editor: r }) => ({ bgColor: r.getAttributes("textStyle").backgroundColor })
|
|
@@ -355,14 +355,14 @@ var Je = () => {
|
|
|
355
355
|
return /* @__PURE__ */ h(d, {
|
|
356
356
|
title: "Background Color",
|
|
357
357
|
onClick: () => i.current?.click(),
|
|
358
|
-
children: [/* @__PURE__ */ e(
|
|
358
|
+
children: [/* @__PURE__ */ e(_e, { style: { color: t.bgColor } }), /* @__PURE__ */ e("input", {
|
|
359
359
|
ref: i,
|
|
360
360
|
type: "color",
|
|
361
361
|
defaultValue: "#fff",
|
|
362
362
|
onChange: (r) => o.chain().focus().setBackgroundColor(r.target.value).run()
|
|
363
363
|
})]
|
|
364
364
|
});
|
|
365
|
-
},
|
|
365
|
+
}, lt = () => {
|
|
366
366
|
const { editor: o } = u();
|
|
367
367
|
return /* @__PURE__ */ e(d, {
|
|
368
368
|
title: "quote",
|
|
@@ -373,10 +373,10 @@ var Je = () => {
|
|
|
373
373
|
onClick: (t) => {
|
|
374
374
|
t.preventDefault(), o.chain().focus().toggleBlockquote().run();
|
|
375
375
|
},
|
|
376
|
-
children: /* @__PURE__ */ e(
|
|
376
|
+
children: /* @__PURE__ */ e(ue, {})
|
|
377
377
|
});
|
|
378
378
|
};
|
|
379
|
-
function
|
|
379
|
+
function at() {
|
|
380
380
|
const { isHtml: o, setIsHtml: t, htmlSourceEnabled: i } = u();
|
|
381
381
|
return i ? /* @__PURE__ */ e(d, {
|
|
382
382
|
title: "HTML source",
|
|
@@ -384,10 +384,10 @@ function lt() {
|
|
|
384
384
|
onClick: (r) => {
|
|
385
385
|
r.preventDefault(), t(!o);
|
|
386
386
|
},
|
|
387
|
-
children: /* @__PURE__ */ e(
|
|
387
|
+
children: /* @__PURE__ */ e(Ie, {})
|
|
388
388
|
}) : null;
|
|
389
389
|
}
|
|
390
|
-
var
|
|
390
|
+
var st = () => {
|
|
391
391
|
const { editor: o } = u(), t = v({
|
|
392
392
|
editor: o,
|
|
393
393
|
selector: (r) => ({
|
|
@@ -400,74 +400,74 @@ var at = () => {
|
|
|
400
400
|
}), i = [
|
|
401
401
|
{
|
|
402
402
|
id: "left",
|
|
403
|
-
icon: /* @__PURE__ */ e(
|
|
403
|
+
icon: /* @__PURE__ */ e(X, {}),
|
|
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(oe, {}),
|
|
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(te, {}),
|
|
418
418
|
event: () => o.chain().focus().setTextAlign("right").run(),
|
|
419
419
|
tooltip: "Align Right",
|
|
420
420
|
active: t.isRight
|
|
421
421
|
},
|
|
422
422
|
{
|
|
423
423
|
id: "justify",
|
|
424
|
-
icon: /* @__PURE__ */ e(
|
|
424
|
+
icon: /* @__PURE__ */ e(G, {}),
|
|
425
425
|
event: () => o.chain().focus().setTextAlign("justify").run(),
|
|
426
426
|
tooltip: "Justify",
|
|
427
427
|
active: t.isJustify
|
|
428
428
|
}
|
|
429
429
|
];
|
|
430
|
-
return /* @__PURE__ */ e(
|
|
431
|
-
trigger: t.isCenter ? /* @__PURE__ */ e(
|
|
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
432
|
triggerTitle: "Text Alignment",
|
|
433
433
|
active: t.isAligned,
|
|
434
434
|
items: i
|
|
435
435
|
});
|
|
436
|
-
},
|
|
437
|
-
wuContentEditor:
|
|
438
|
-
selectedCell:
|
|
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
439
|
"column-resize-handle": "_column-resize-handle_1w25e_1",
|
|
440
|
-
tableWrapper:
|
|
440
|
+
tableWrapper: ut,
|
|
441
441
|
"resize-cursor": "_resize-cursor_1w25e_1",
|
|
442
|
-
wuContentEditorRoot:
|
|
443
|
-
wuContentEditorToolbar:
|
|
444
|
-
fontSize:
|
|
445
|
-
wuContentEditorTable:
|
|
446
|
-
},
|
|
442
|
+
wuContentEditorRoot: ht,
|
|
443
|
+
wuContentEditorToolbar: ft,
|
|
444
|
+
fontSize: vt,
|
|
445
|
+
wuContentEditorTable: pt
|
|
446
|
+
}, gt = [
|
|
447
447
|
"e",
|
|
448
448
|
"E",
|
|
449
449
|
"+",
|
|
450
450
|
"-"
|
|
451
|
-
],
|
|
452
|
-
const { editor: o } = u(), [t, i] =
|
|
451
|
+
], le = 1, mt = () => {
|
|
452
|
+
const { editor: o } = u(), [t, i] = O(16), r = v({
|
|
453
453
|
editor: o,
|
|
454
454
|
selector: (s) => ({ fontSize: s.editor.getAttributes("textStyle").fontSize })
|
|
455
|
-
}),
|
|
455
|
+
}), n = (s) => {
|
|
456
456
|
o.chain().focus().setFontSize(s + "px").run();
|
|
457
457
|
}, c = (s) => {
|
|
458
|
-
const
|
|
459
|
-
i(
|
|
460
|
-
},
|
|
461
|
-
|
|
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);
|
|
462
462
|
};
|
|
463
463
|
return f.useEffect(() => {
|
|
464
464
|
i(Number(r.fontSize?.replace("px", "")) || 16);
|
|
465
465
|
}, [r.fontSize]), /* @__PURE__ */ h("div", {
|
|
466
|
-
className:
|
|
466
|
+
className: S.fontSize,
|
|
467
467
|
children: [
|
|
468
468
|
/* @__PURE__ */ e(d, {
|
|
469
469
|
onClick: () => c(t - 1),
|
|
470
|
-
disabled: t <=
|
|
470
|
+
disabled: t <= le,
|
|
471
471
|
children: "−"
|
|
472
472
|
}),
|
|
473
473
|
/* @__PURE__ */ e("input", {
|
|
@@ -475,9 +475,9 @@ var at = () => {
|
|
|
475
475
|
inputMode: "numeric",
|
|
476
476
|
pattern: "[0-9]*",
|
|
477
477
|
value: t,
|
|
478
|
-
onKeyDown:
|
|
478
|
+
onKeyDown: l,
|
|
479
479
|
onChange: (s) => i(s.target.valueAsNumber),
|
|
480
|
-
onBlur: () =>
|
|
480
|
+
onBlur: () => n(t)
|
|
481
481
|
}),
|
|
482
482
|
/* @__PURE__ */ e(d, {
|
|
483
483
|
onClick: () => c(t + 1),
|
|
@@ -486,10 +486,10 @@ var at = () => {
|
|
|
486
486
|
})
|
|
487
487
|
]
|
|
488
488
|
});
|
|
489
|
-
},
|
|
489
|
+
}, bt = () => {
|
|
490
490
|
const { editor: o, customFonts: t } = u(), i = v({
|
|
491
491
|
editor: o,
|
|
492
|
-
selector: (
|
|
492
|
+
selector: (l) => ({ currentFontFamily: l.editor.getAttributes("textStyle").fontFamily || "" })
|
|
493
493
|
}), r = [
|
|
494
494
|
"Fira Sans",
|
|
495
495
|
"Inter",
|
|
@@ -497,250 +497,250 @@ var at = () => {
|
|
|
497
497
|
"JetBrains Mono",
|
|
498
498
|
"Montserrat",
|
|
499
499
|
...t || []
|
|
500
|
-
], [
|
|
500
|
+
], [n, c] = O(i.currentFontFamily || r[0]);
|
|
501
501
|
return f.useEffect(() => {
|
|
502
502
|
c(i.currentFontFamily?.replace(/"/g, "") || r[0]);
|
|
503
503
|
}, [i.currentFontFamily]), /* @__PURE__ */ h(g.Root, { children: [/* @__PURE__ */ e(g.Trigger, {
|
|
504
|
-
"data-active":
|
|
505
|
-
style: { fontFamily:
|
|
506
|
-
title:
|
|
504
|
+
"data-active": n !== "Fira Sans",
|
|
505
|
+
style: { fontFamily: n },
|
|
506
|
+
title: n || "Font Family",
|
|
507
507
|
render: /* @__PURE__ */ e(d, {}),
|
|
508
|
-
children:
|
|
508
|
+
children: n?.[0]
|
|
509
509
|
}), /* @__PURE__ */ e(g.Portal, { children: /* @__PURE__ */ e(g.Positioner, {
|
|
510
510
|
align: "start",
|
|
511
511
|
sideOffset: 4,
|
|
512
512
|
children: /* @__PURE__ */ e(g.Popup, {
|
|
513
|
-
render: /* @__PURE__ */ e(
|
|
513
|
+
render: /* @__PURE__ */ e(q, {}),
|
|
514
514
|
"data-block": !0,
|
|
515
515
|
finalFocus: !1,
|
|
516
|
-
children: r.map((
|
|
517
|
-
title:
|
|
518
|
-
render: /* @__PURE__ */ e(
|
|
516
|
+
children: r.map((l) => /* @__PURE__ */ e(g.Item, {
|
|
517
|
+
title: l,
|
|
518
|
+
render: /* @__PURE__ */ e($, {}),
|
|
519
519
|
onClick: () => {
|
|
520
|
-
o.chain().focus().setFontFamily(
|
|
520
|
+
o.chain().focus().setFontFamily(l).run(), c(l);
|
|
521
521
|
},
|
|
522
|
-
children:
|
|
523
|
-
},
|
|
522
|
+
children: l
|
|
523
|
+
}, l))
|
|
524
524
|
})
|
|
525
525
|
}) })] });
|
|
526
|
-
},
|
|
526
|
+
}, kt = "_button_583n5_1", Ct = { button: kt }, ce = f.forwardRef(function({ children: t, variant: i, color: r, icon: n, ...c }, l) {
|
|
527
527
|
return /* @__PURE__ */ h("button", {
|
|
528
|
-
ref:
|
|
529
|
-
className:
|
|
528
|
+
ref: l,
|
|
529
|
+
className: Ct.button,
|
|
530
530
|
"data-variant": i,
|
|
531
531
|
"data-color": r,
|
|
532
532
|
...c,
|
|
533
|
-
children: [
|
|
533
|
+
children: [n, t]
|
|
534
534
|
});
|
|
535
|
-
}),
|
|
536
|
-
dialog:
|
|
537
|
-
backdrop:
|
|
538
|
-
content:
|
|
539
|
-
footer:
|
|
540
|
-
close:
|
|
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
541
|
};
|
|
542
|
-
function
|
|
543
|
-
const c = f.useContext(
|
|
542
|
+
function W({ Trigger: o, children: t, maxWidth: i, onOpenChange: r, footer: n }) {
|
|
543
|
+
const c = f.useContext(M), l = f.useCallback((s) => {
|
|
544
544
|
c?.editor.setEditable(!s, !1), r?.(s);
|
|
545
545
|
}, [c, r]);
|
|
546
546
|
return /* @__PURE__ */ h(w.Root, {
|
|
547
547
|
modal: !0,
|
|
548
|
-
onOpenChange:
|
|
548
|
+
onOpenChange: l,
|
|
549
549
|
children: [/* @__PURE__ */ e("span", {
|
|
550
550
|
onClick: (s) => s.stopPropagation(),
|
|
551
551
|
children: /* @__PURE__ */ e(w.Trigger, { render: o })
|
|
552
|
-
}), /* @__PURE__ */ h(w.Portal, { children: [/* @__PURE__ */ e(w.Backdrop, { className:
|
|
553
|
-
className:
|
|
552
|
+
}), /* @__PURE__ */ h(w.Portal, { children: [/* @__PURE__ */ e(w.Backdrop, { className: y.backdrop }), /* @__PURE__ */ h(w.Popup, {
|
|
553
|
+
className: y.dialog,
|
|
554
554
|
style: i ? { maxWidth: i } : void 0,
|
|
555
555
|
children: [
|
|
556
556
|
/* @__PURE__ */ e(w.Close, {
|
|
557
|
-
className:
|
|
557
|
+
className: y.close,
|
|
558
558
|
"aria-label": "Close",
|
|
559
|
-
children: /* @__PURE__ */ e(
|
|
559
|
+
children: /* @__PURE__ */ e(me, {
|
|
560
560
|
width: 10,
|
|
561
561
|
height: 10
|
|
562
562
|
})
|
|
563
563
|
}),
|
|
564
564
|
/* @__PURE__ */ e("div", {
|
|
565
|
-
className:
|
|
565
|
+
className: y.content,
|
|
566
566
|
children: t
|
|
567
567
|
}),
|
|
568
|
-
|
|
569
|
-
className:
|
|
570
|
-
children:
|
|
568
|
+
n && /* @__PURE__ */ e("footer", {
|
|
569
|
+
className: y.footer,
|
|
570
|
+
children: n
|
|
571
571
|
})
|
|
572
572
|
]
|
|
573
573
|
})] })]
|
|
574
574
|
});
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function x({ children: o, variant: t, color: i, icon: r, ...n }) {
|
|
577
577
|
return /* @__PURE__ */ e(w.Close, {
|
|
578
|
-
render: /* @__PURE__ */ e(
|
|
578
|
+
render: /* @__PURE__ */ e(ce, {
|
|
579
579
|
variant: t,
|
|
580
580
|
color: i,
|
|
581
581
|
icon: r
|
|
582
582
|
}),
|
|
583
|
-
...
|
|
583
|
+
...n,
|
|
584
584
|
children: o
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
var
|
|
588
|
-
group:
|
|
589
|
-
label:
|
|
590
|
-
input:
|
|
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
591
|
};
|
|
592
|
-
function
|
|
592
|
+
function E({ label: o, id: t, ...i }) {
|
|
593
593
|
return /* @__PURE__ */ h("div", {
|
|
594
|
-
className:
|
|
594
|
+
className: z.group,
|
|
595
595
|
children: [o && /* @__PURE__ */ e("label", {
|
|
596
|
-
className:
|
|
596
|
+
className: z.label,
|
|
597
597
|
htmlFor: t,
|
|
598
598
|
children: o
|
|
599
599
|
}), /* @__PURE__ */ e("input", {
|
|
600
600
|
id: t,
|
|
601
|
-
className:
|
|
601
|
+
className: z.input,
|
|
602
602
|
...i
|
|
603
603
|
})]
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
|
-
var
|
|
606
|
+
var Ht = () => {
|
|
607
607
|
const { editor: o } = u(), t = v({
|
|
608
608
|
editor: o,
|
|
609
609
|
selector: (s) => ({
|
|
610
610
|
isImage: s.editor?.isActive("image"),
|
|
611
611
|
imageAttrs: s.editor?.getAttributes("image")
|
|
612
612
|
})
|
|
613
|
-
}), [i, r] = f.useState(t.imageAttrs.src || ""), [
|
|
613
|
+
}), [i, r] = f.useState(t.imageAttrs.src || ""), [n, c] = f.useState(t.imageAttrs.alt || ""), l = () => {
|
|
614
614
|
o.chain().focus().setImage({
|
|
615
615
|
src: i,
|
|
616
|
-
alt:
|
|
616
|
+
alt: n
|
|
617
617
|
}).run();
|
|
618
618
|
};
|
|
619
|
-
return /* @__PURE__ */ h(
|
|
619
|
+
return /* @__PURE__ */ h(W, {
|
|
620
620
|
Trigger: /* @__PURE__ */ e(d, {
|
|
621
621
|
title: "Image",
|
|
622
622
|
"data-active": t.isImage,
|
|
623
|
-
children: /* @__PURE__ */ e(
|
|
623
|
+
children: /* @__PURE__ */ e(pe, {})
|
|
624
624
|
}),
|
|
625
625
|
maxWidth: "400px",
|
|
626
|
-
footer: /* @__PURE__ */ h(
|
|
626
|
+
footer: /* @__PURE__ */ h(N, { children: [/* @__PURE__ */ e(x, {
|
|
627
627
|
variant: "secondary",
|
|
628
628
|
children: "Cancel"
|
|
629
|
-
}), /* @__PURE__ */ e(
|
|
630
|
-
onClick:
|
|
629
|
+
}), /* @__PURE__ */ e(x, {
|
|
630
|
+
onClick: l,
|
|
631
631
|
disabled: !i,
|
|
632
632
|
children: "Save"
|
|
633
633
|
})] }),
|
|
634
|
-
children: [/* @__PURE__ */ e(
|
|
634
|
+
children: [/* @__PURE__ */ e(E, {
|
|
635
635
|
label: "Image URL",
|
|
636
636
|
type: "url",
|
|
637
637
|
value: i,
|
|
638
638
|
onChange: (s) => r(s.target.value),
|
|
639
639
|
required: !0
|
|
640
|
-
}), /* @__PURE__ */ e(
|
|
640
|
+
}), /* @__PURE__ */ e(E, {
|
|
641
641
|
label: "Alt Text",
|
|
642
642
|
type: "text",
|
|
643
|
-
value:
|
|
643
|
+
value: n,
|
|
644
644
|
onChange: (s) => c(s.target.value)
|
|
645
645
|
})]
|
|
646
646
|
});
|
|
647
|
-
},
|
|
647
|
+
}, Lt = () => {
|
|
648
648
|
const { editor: o } = u(), t = v({
|
|
649
649
|
editor: o,
|
|
650
|
-
selector: (
|
|
651
|
-
isLink:
|
|
652
|
-
linkAttrs:
|
|
650
|
+
selector: (a) => ({
|
|
651
|
+
isLink: a.editor?.isActive("link"),
|
|
652
|
+
linkAttrs: a.editor?.getAttributes("link")
|
|
653
653
|
})
|
|
654
|
-
}), [i, r] = f.useState(t.linkAttrs.href || ""), [
|
|
655
|
-
const
|
|
654
|
+
}), [i, r] = f.useState(t.linkAttrs.href || ""), [n, c] = f.useState(t.linkAttrs.alt || ""), l = (a) => !a || a.startsWith("http://") || a.startsWith("https://") ? a : `https://${a}`, s = () => {
|
|
655
|
+
const a = l(i);
|
|
656
656
|
o.chain().focus().insertContent({
|
|
657
657
|
type: "text",
|
|
658
|
-
text:
|
|
658
|
+
text: n || a,
|
|
659
659
|
marks: [{
|
|
660
660
|
type: "link",
|
|
661
|
-
attrs: { href:
|
|
661
|
+
attrs: { href: a }
|
|
662
662
|
}]
|
|
663
663
|
}).run();
|
|
664
|
-
},
|
|
665
|
-
const
|
|
666
|
-
let
|
|
667
|
-
if (
|
|
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
668
|
else {
|
|
669
|
-
const
|
|
670
|
-
let
|
|
671
|
-
for (;
|
|
672
|
-
for (;
|
|
673
|
-
if (
|
|
674
|
-
const
|
|
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
675
|
o.commands.setTextSelection({
|
|
676
|
-
from:
|
|
677
|
-
to:
|
|
676
|
+
from: L + b,
|
|
677
|
+
to: L + k
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
r(
|
|
681
|
+
r(a.href || ""), c(I || a.alt || "");
|
|
682
682
|
};
|
|
683
|
-
return /* @__PURE__ */ h(
|
|
683
|
+
return /* @__PURE__ */ h(W, {
|
|
684
684
|
Trigger: /* @__PURE__ */ e(d, {
|
|
685
685
|
title: "Link",
|
|
686
686
|
"data-active": t.isLink,
|
|
687
|
-
children: /* @__PURE__ */ e(
|
|
687
|
+
children: /* @__PURE__ */ e(ve, {})
|
|
688
688
|
}),
|
|
689
689
|
maxWidth: "400px",
|
|
690
|
-
onOpenChange: (
|
|
691
|
-
footer: /* @__PURE__ */ h(
|
|
690
|
+
onOpenChange: (a) => a && C(),
|
|
691
|
+
footer: /* @__PURE__ */ h(N, { children: [t.isLink && /* @__PURE__ */ e(x, {
|
|
692
692
|
color: "error",
|
|
693
693
|
variant: "secondary",
|
|
694
694
|
onClick: () => o.chain().focus().unsetLink().run(),
|
|
695
695
|
children: "Remove"
|
|
696
|
-
}), /* @__PURE__ */ e(
|
|
696
|
+
}), /* @__PURE__ */ e(x, {
|
|
697
697
|
onClick: s,
|
|
698
698
|
disabled: !i,
|
|
699
699
|
children: "Save"
|
|
700
700
|
})] }),
|
|
701
|
-
children: [/* @__PURE__ */ e(
|
|
701
|
+
children: [/* @__PURE__ */ e(E, {
|
|
702
702
|
label: "Link",
|
|
703
703
|
type: "url",
|
|
704
704
|
value: i,
|
|
705
|
-
onChange: (
|
|
705
|
+
onChange: (a) => r(a.target.value),
|
|
706
706
|
required: !0
|
|
707
|
-
}), /* @__PURE__ */ e(
|
|
707
|
+
}), /* @__PURE__ */ e(E, {
|
|
708
708
|
label: "Text to display",
|
|
709
709
|
type: "text",
|
|
710
|
-
value:
|
|
711
|
-
onChange: (
|
|
710
|
+
value: n,
|
|
711
|
+
onChange: (a) => c(a.target.value)
|
|
712
712
|
})]
|
|
713
713
|
});
|
|
714
|
-
},
|
|
715
|
-
label:
|
|
716
|
-
root:
|
|
717
|
-
thumb:
|
|
714
|
+
}, Rt = "_label_1kiov_1", Ft = "_root_1kiov_11", Et = "_thumb_1kiov_44", P = {
|
|
715
|
+
label: Rt,
|
|
716
|
+
root: Ft,
|
|
717
|
+
thumb: Et
|
|
718
718
|
};
|
|
719
|
-
function
|
|
719
|
+
function Nt({ checked: o, onCheckedChange: t, label: i }) {
|
|
720
720
|
return /* @__PURE__ */ h("label", {
|
|
721
|
-
className:
|
|
722
|
-
children: [/* @__PURE__ */ e("span", { children: i }), /* @__PURE__ */ e(
|
|
723
|
-
className:
|
|
721
|
+
className: P.label,
|
|
722
|
+
children: [/* @__PURE__ */ e("span", { children: i }), /* @__PURE__ */ e(ne.Root, {
|
|
723
|
+
className: P.root,
|
|
724
724
|
checked: o,
|
|
725
725
|
onCheckedChange: t,
|
|
726
|
-
children: /* @__PURE__ */ e(
|
|
726
|
+
children: /* @__PURE__ */ e(ne.Thumb, { className: P.thumb })
|
|
727
727
|
})]
|
|
728
728
|
});
|
|
729
729
|
}
|
|
730
|
-
var
|
|
730
|
+
var Dt = () => {
|
|
731
731
|
const { editor: o } = u(), t = v({
|
|
732
732
|
editor: o,
|
|
733
|
-
selector: (
|
|
734
|
-
isTable:
|
|
735
|
-
tableAttrs:
|
|
733
|
+
selector: (a) => ({
|
|
734
|
+
isTable: a.editor.isActive("table"),
|
|
735
|
+
tableAttrs: a.editor.getAttributes("table")
|
|
736
736
|
})
|
|
737
|
-
}), [i, r] =
|
|
738
|
-
|
|
737
|
+
}), [i, r] = O(!1), n = Se(null), c = B((a) => {
|
|
738
|
+
n.current && clearTimeout(n.current), n.current = setTimeout(a, 100);
|
|
739
739
|
}, []);
|
|
740
740
|
f.useEffect(() => () => {
|
|
741
|
-
|
|
741
|
+
n.current && clearTimeout(n.current);
|
|
742
742
|
}, []);
|
|
743
|
-
const
|
|
743
|
+
const l = B(() => {
|
|
744
744
|
c(() => o.chain().focus().insertTable({
|
|
745
745
|
rows: 2,
|
|
746
746
|
cols: 4,
|
|
@@ -750,99 +750,99 @@ var Nt = () => {
|
|
|
750
750
|
o,
|
|
751
751
|
i,
|
|
752
752
|
c
|
|
753
|
-
]), s =
|
|
754
|
-
r((
|
|
755
|
-
}, [o, c]),
|
|
753
|
+
]), s = B(() => {
|
|
754
|
+
r((a) => !a), c(() => o.chain().focus().toggleHeaderRow().run());
|
|
755
|
+
}, [o, c]), C = [
|
|
756
756
|
{
|
|
757
757
|
text: "Column left",
|
|
758
|
-
icon: /* @__PURE__ */ e(
|
|
758
|
+
icon: /* @__PURE__ */ e(R, {}),
|
|
759
759
|
event: () => o.chain().focus().addColumnBefore().run()
|
|
760
760
|
},
|
|
761
761
|
{
|
|
762
762
|
text: "Row above",
|
|
763
|
-
icon: /* @__PURE__ */ e(
|
|
763
|
+
icon: /* @__PURE__ */ e(R, {}),
|
|
764
764
|
event: () => o.chain().focus().addRowBefore().run()
|
|
765
765
|
},
|
|
766
766
|
{
|
|
767
767
|
text: "Column right",
|
|
768
|
-
icon: /* @__PURE__ */ e(
|
|
768
|
+
icon: /* @__PURE__ */ e(R, {}),
|
|
769
769
|
event: () => o.chain().focus().addColumnAfter().run()
|
|
770
770
|
},
|
|
771
771
|
{
|
|
772
772
|
text: "Row below",
|
|
773
|
-
icon: /* @__PURE__ */ e(
|
|
773
|
+
icon: /* @__PURE__ */ e(R, {}),
|
|
774
774
|
event: () => o.chain().focus().addRowAfter().run()
|
|
775
775
|
},
|
|
776
776
|
{
|
|
777
777
|
text: "Delete Column",
|
|
778
|
-
icon: /* @__PURE__ */ e(
|
|
778
|
+
icon: /* @__PURE__ */ e(D, {}),
|
|
779
779
|
event: () => o.chain().focus().deleteColumn().run()
|
|
780
780
|
},
|
|
781
781
|
{
|
|
782
782
|
text: "Delete Row",
|
|
783
|
-
icon: /* @__PURE__ */ e(
|
|
783
|
+
icon: /* @__PURE__ */ e(D, {}),
|
|
784
784
|
event: () => o.chain().focus().deleteRow().run()
|
|
785
785
|
}
|
|
786
786
|
];
|
|
787
|
-
return t.isTable ? /* @__PURE__ */ h(
|
|
787
|
+
return t.isTable ? /* @__PURE__ */ h(W, {
|
|
788
788
|
Trigger: /* @__PURE__ */ e(d, {
|
|
789
789
|
title: "Table",
|
|
790
790
|
"data-active": t.isTable,
|
|
791
|
-
children: /* @__PURE__ */ e(
|
|
791
|
+
children: /* @__PURE__ */ e(K, {})
|
|
792
792
|
}),
|
|
793
793
|
maxWidth: "320px",
|
|
794
|
-
footer: /* @__PURE__ */ e(
|
|
794
|
+
footer: /* @__PURE__ */ e(x, {
|
|
795
795
|
variant: "secondary",
|
|
796
796
|
color: "error",
|
|
797
|
-
icon: /* @__PURE__ */ e(
|
|
797
|
+
icon: /* @__PURE__ */ e(D, {}),
|
|
798
798
|
onClick: () => o.chain().focus().deleteTable().run(),
|
|
799
799
|
children: "Delete Table"
|
|
800
800
|
}),
|
|
801
|
-
children: [/* @__PURE__ */ e(
|
|
801
|
+
children: [/* @__PURE__ */ e(Nt, {
|
|
802
802
|
checked: i,
|
|
803
803
|
onCheckedChange: s,
|
|
804
804
|
label: "Title Row"
|
|
805
805
|
}), /* @__PURE__ */ e("div", {
|
|
806
|
-
className:
|
|
807
|
-
children:
|
|
808
|
-
onClick:
|
|
806
|
+
className: S.wuContentEditorTable,
|
|
807
|
+
children: C.map(({ text: a, icon: m, event: A }) => /* @__PURE__ */ e(ce, {
|
|
808
|
+
onClick: A,
|
|
809
809
|
variant: "secondary",
|
|
810
|
-
icon:
|
|
811
|
-
children:
|
|
812
|
-
},
|
|
810
|
+
icon: m,
|
|
811
|
+
children: a
|
|
812
|
+
}, a))
|
|
813
813
|
})]
|
|
814
814
|
}) : /* @__PURE__ */ e(d, {
|
|
815
815
|
title: "Table",
|
|
816
|
-
onClick:
|
|
817
|
-
children: /* @__PURE__ */ e(
|
|
816
|
+
onClick: l,
|
|
817
|
+
children: /* @__PURE__ */ e(K, {})
|
|
818
818
|
});
|
|
819
|
-
},
|
|
820
|
-
block: /* @__PURE__ */ e(
|
|
821
|
-
fontFamily: /* @__PURE__ */ e(
|
|
822
|
-
fontSize: /* @__PURE__ */ e(
|
|
823
|
-
bold: /* @__PURE__ */ e(
|
|
824
|
-
italic: /* @__PURE__ */ e(
|
|
825
|
-
underline: /* @__PURE__ */ e(
|
|
826
|
-
strike: /* @__PURE__ */ e(
|
|
827
|
-
color: /* @__PURE__ */ e(
|
|
828
|
-
bgColor: /* @__PURE__ */ e(
|
|
829
|
-
list: /* @__PURE__ */ e(
|
|
830
|
-
alignment: /* @__PURE__ */ e(
|
|
831
|
-
image: /* @__PURE__ */ e(
|
|
832
|
-
link: /* @__PURE__ */ e(
|
|
833
|
-
table: /* @__PURE__ */ e(
|
|
834
|
-
blockquote: /* @__PURE__ */ e(
|
|
835
|
-
superscript: /* @__PURE__ */ e(
|
|
836
|
-
subscript: /* @__PURE__ */ e(
|
|
837
|
-
codeline: /* @__PURE__ */ e(
|
|
838
|
-
clear: /* @__PURE__ */ e(
|
|
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, {}),
|
|
839
839
|
"|": /* @__PURE__ */ e("div", { style: {
|
|
840
840
|
height: 16,
|
|
841
841
|
width: 1,
|
|
842
842
|
background: "var(--we-border)"
|
|
843
843
|
} }),
|
|
844
|
-
html: /* @__PURE__ */ e(
|
|
845
|
-
},
|
|
844
|
+
html: /* @__PURE__ */ e(at, {})
|
|
845
|
+
}, Bt = [
|
|
846
846
|
"block",
|
|
847
847
|
"fontFamily",
|
|
848
848
|
"|",
|
|
@@ -870,80 +870,81 @@ var Nt = () => {
|
|
|
870
870
|
"|",
|
|
871
871
|
"html",
|
|
872
872
|
"clear"
|
|
873
|
-
],
|
|
874
|
-
const { editor: t, customFonts: i, children: r, items:
|
|
873
|
+
], zt = (o) => {
|
|
874
|
+
const { editor: t, customFonts: i, children: r, items: n = Bt, isHtml: c, setIsHtml: l, htmlSourceEnabled: s, ...C } = o;
|
|
875
875
|
return /* @__PURE__ */ e("div", {
|
|
876
|
-
...
|
|
877
|
-
children: /* @__PURE__ */ h(
|
|
876
|
+
...C,
|
|
877
|
+
children: /* @__PURE__ */ h(Ue, {
|
|
878
878
|
editor: t,
|
|
879
879
|
customFonts: i,
|
|
880
880
|
isHtml: c,
|
|
881
|
-
setIsHtml:
|
|
881
|
+
setIsHtml: l,
|
|
882
882
|
htmlSourceEnabled: s,
|
|
883
|
-
children: [
|
|
883
|
+
children: [n.map((a, m) => /* @__PURE__ */ e(N, { children: c && a !== "html" ? /* @__PURE__ */ e("span", {
|
|
884
884
|
style: {
|
|
885
885
|
pointerEvents: "none",
|
|
886
886
|
opacity: 0.4
|
|
887
887
|
},
|
|
888
|
-
children:
|
|
889
|
-
}) :
|
|
888
|
+
children: ae[a]
|
|
889
|
+
}) : ae[a] }, a + m)), r]
|
|
890
890
|
})
|
|
891
891
|
});
|
|
892
892
|
};
|
|
893
|
-
function
|
|
893
|
+
function Pt(...o) {
|
|
894
894
|
return o.filter(Boolean).join(" ");
|
|
895
895
|
}
|
|
896
|
-
function
|
|
897
|
-
const [
|
|
898
|
-
process.env.NODE_ENV !== "production" &&
|
|
899
|
-
const
|
|
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] = f.useState((A ?? !1) && !!m);
|
|
898
|
+
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`.');
|
|
899
|
+
const b = f.useRef(o || ""), k = ye({
|
|
900
900
|
editable: !s,
|
|
901
|
-
|
|
902
|
-
|
|
901
|
+
autofocus: C ? "end" : !1,
|
|
902
|
+
extensions: $e,
|
|
903
|
+
content: F(o || ""),
|
|
903
904
|
onUpdate: ({ editor: p }) => {
|
|
904
|
-
t && t(
|
|
905
|
+
t && t(F(p.getHTML()));
|
|
905
906
|
}
|
|
906
|
-
}),
|
|
907
|
-
p ?
|
|
907
|
+
}), L = (p) => {
|
|
908
|
+
p ? b.current = k?.getHTML() ?? "" : k?.commands.setContent(F(b.current)), t && t(F(b.current)), H(p), T?.(p);
|
|
908
909
|
};
|
|
909
910
|
return /* @__PURE__ */ h("div", {
|
|
910
|
-
className:
|
|
911
|
+
className: Pt(S.wuContentEditorRoot, i),
|
|
911
912
|
"data-position": r,
|
|
912
913
|
"data-slot": "wu-content-editor-root",
|
|
913
914
|
onClick: (p) => {
|
|
914
915
|
if ((p.ctrlKey || p.metaKey) && p.target instanceof HTMLElement) {
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
window.open(
|
|
916
|
+
const j = p.target.closest("a");
|
|
917
|
+
if (j?.href) {
|
|
918
|
+
window.open(j.href, "_blank", "noopener,noreferrer");
|
|
918
919
|
return;
|
|
919
920
|
}
|
|
920
921
|
}
|
|
921
|
-
|
|
922
|
+
_ || k?.chain().focus().run();
|
|
922
923
|
},
|
|
923
|
-
...
|
|
924
|
-
children: [!
|
|
925
|
-
editor:
|
|
926
|
-
customFonts:
|
|
927
|
-
className:
|
|
924
|
+
...I,
|
|
925
|
+
children: [!l && /* @__PURE__ */ e(zt, {
|
|
926
|
+
editor: k,
|
|
927
|
+
customFonts: a,
|
|
928
|
+
className: S.wuContentEditorToolbar,
|
|
928
929
|
items: c,
|
|
929
|
-
isHtml:
|
|
930
|
-
setIsHtml:
|
|
931
|
-
htmlSourceEnabled: !!
|
|
930
|
+
isHtml: _,
|
|
931
|
+
setIsHtml: L,
|
|
932
|
+
htmlSourceEnabled: !!m,
|
|
932
933
|
"data-slot": "wu-content-editor-toolbar",
|
|
933
|
-
children:
|
|
934
|
-
}),
|
|
935
|
-
defaultValue:
|
|
934
|
+
children: n
|
|
935
|
+
}), _ && m ? /* @__PURE__ */ e(m, {
|
|
936
|
+
defaultValue: b.current,
|
|
936
937
|
onUpdate: (p) => {
|
|
937
|
-
|
|
938
|
+
b.current = p ?? "", t && t(p ?? "");
|
|
938
939
|
},
|
|
939
940
|
readonly: s
|
|
940
|
-
}) : /* @__PURE__ */ e(
|
|
941
|
-
editor:
|
|
942
|
-
className:
|
|
941
|
+
}) : /* @__PURE__ */ e(Te, {
|
|
942
|
+
editor: k,
|
|
943
|
+
className: S.wuContentEditor,
|
|
943
944
|
"data-slot": "wu-content-editor"
|
|
944
945
|
})]
|
|
945
946
|
});
|
|
946
947
|
}
|
|
947
948
|
export {
|
|
948
|
-
|
|
949
|
+
eo as WuContentEditor
|
|
949
950
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npm-questionpro/wick-ui-editor",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.32",
|
|
4
4
|
"description": "Wick Editor is a powerful and intuitive content editing component built with React. It provides a rich set of features for creating and managing content, making it ideal for applications that require dynamic and interactive content creation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"vite-bundle-analyzer": "^0.22.3",
|
|
98
98
|
"vite-plugin-dts": "^4.5.4",
|
|
99
99
|
"vitest": "^4.1.8",
|
|
100
|
-
"@npm-questionpro/wick-ui-lib": "2.0.0-next.
|
|
100
|
+
"@npm-questionpro/wick-ui-lib": "2.0.0-next.32",
|
|
101
101
|
"@npm-questionpro/wick-ui-eslint-config": "1.0.0",
|
|
102
102
|
"@wick-ui/tsconfig": "1.0.0"
|
|
103
103
|
},
|