@ryzeup/richtexteditor 1.0.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 +249 -0
- package/dist/index.es.js +1511 -0
- package/dist/index.umd.js +22 -0
- package/dist/richtexteditor.css +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +57 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1511 @@
|
|
|
1
|
+
import Y, { useRef as $, useState as O, useEffect as le } from "react";
|
|
2
|
+
var de = { exports: {} }, oe = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var be;
|
|
13
|
+
function ze() {
|
|
14
|
+
if (be) return oe;
|
|
15
|
+
be = 1;
|
|
16
|
+
var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
17
|
+
function u(c, h, g) {
|
|
18
|
+
var E = null;
|
|
19
|
+
if (g !== void 0 && (E = "" + g), h.key !== void 0 && (E = "" + h.key), "key" in h) {
|
|
20
|
+
g = {};
|
|
21
|
+
for (var y in h)
|
|
22
|
+
y !== "key" && (g[y] = h[y]);
|
|
23
|
+
} else g = h;
|
|
24
|
+
return h = g.ref, {
|
|
25
|
+
$$typeof: t,
|
|
26
|
+
type: c,
|
|
27
|
+
key: E,
|
|
28
|
+
ref: h !== void 0 ? h : null,
|
|
29
|
+
props: g
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return oe.Fragment = s, oe.jsx = u, oe.jsxs = u, oe;
|
|
33
|
+
}
|
|
34
|
+
var ae = {};
|
|
35
|
+
/**
|
|
36
|
+
* @license React
|
|
37
|
+
* react-jsx-runtime.development.js
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the MIT license found in the
|
|
42
|
+
* LICENSE file in the root directory of this source tree.
|
|
43
|
+
*/
|
|
44
|
+
var ye;
|
|
45
|
+
function Oe() {
|
|
46
|
+
return ye || (ye = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
|
+
function t(n) {
|
|
48
|
+
if (n == null) return null;
|
|
49
|
+
if (typeof n == "function")
|
|
50
|
+
return n.$$typeof === S ? null : n.displayName || n.name || null;
|
|
51
|
+
if (typeof n == "string") return n;
|
|
52
|
+
switch (n) {
|
|
53
|
+
case _:
|
|
54
|
+
return "Fragment";
|
|
55
|
+
case z:
|
|
56
|
+
return "Profiler";
|
|
57
|
+
case X:
|
|
58
|
+
return "StrictMode";
|
|
59
|
+
case J:
|
|
60
|
+
return "Suspense";
|
|
61
|
+
case pe:
|
|
62
|
+
return "SuspenseList";
|
|
63
|
+
case P:
|
|
64
|
+
return "Activity";
|
|
65
|
+
}
|
|
66
|
+
if (typeof n == "object")
|
|
67
|
+
switch (typeof n.tag == "number" && console.error(
|
|
68
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
+
), n.$$typeof) {
|
|
70
|
+
case U:
|
|
71
|
+
return "Portal";
|
|
72
|
+
case A:
|
|
73
|
+
return n.displayName || "Context";
|
|
74
|
+
case m:
|
|
75
|
+
return (n._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case G:
|
|
77
|
+
var p = n.render;
|
|
78
|
+
return n = n.displayName, n || (n = p.displayName || p.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
|
|
79
|
+
case se:
|
|
80
|
+
return p = n.displayName || null, p !== null ? p : t(n.type) || "Memo";
|
|
81
|
+
case ee:
|
|
82
|
+
p = n._payload, n = n._init;
|
|
83
|
+
try {
|
|
84
|
+
return t(n(p));
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function s(n) {
|
|
91
|
+
return "" + n;
|
|
92
|
+
}
|
|
93
|
+
function u(n) {
|
|
94
|
+
try {
|
|
95
|
+
s(n);
|
|
96
|
+
var p = !1;
|
|
97
|
+
} catch {
|
|
98
|
+
p = !0;
|
|
99
|
+
}
|
|
100
|
+
if (p) {
|
|
101
|
+
p = console;
|
|
102
|
+
var R = p.error, j = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
|
|
103
|
+
return R.call(
|
|
104
|
+
p,
|
|
105
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
+
j
|
|
107
|
+
), s(n);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function c(n) {
|
|
111
|
+
if (n === _) return "<>";
|
|
112
|
+
if (typeof n == "object" && n !== null && n.$$typeof === ee)
|
|
113
|
+
return "<...>";
|
|
114
|
+
try {
|
|
115
|
+
var p = t(n);
|
|
116
|
+
return p ? "<" + p + ">" : "<...>";
|
|
117
|
+
} catch {
|
|
118
|
+
return "<...>";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function h() {
|
|
122
|
+
var n = Z.A;
|
|
123
|
+
return n === null ? null : n.getOwner();
|
|
124
|
+
}
|
|
125
|
+
function g() {
|
|
126
|
+
return Error("react-stack-top-frame");
|
|
127
|
+
}
|
|
128
|
+
function E(n) {
|
|
129
|
+
if (V.call(n, "key")) {
|
|
130
|
+
var p = Object.getOwnPropertyDescriptor(n, "key").get;
|
|
131
|
+
if (p && p.isReactWarning) return !1;
|
|
132
|
+
}
|
|
133
|
+
return n.key !== void 0;
|
|
134
|
+
}
|
|
135
|
+
function y(n, p) {
|
|
136
|
+
function R() {
|
|
137
|
+
ie || (ie = !0, console.error(
|
|
138
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
+
p
|
|
140
|
+
));
|
|
141
|
+
}
|
|
142
|
+
R.isReactWarning = !0, Object.defineProperty(n, "key", {
|
|
143
|
+
get: R,
|
|
144
|
+
configurable: !0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function x() {
|
|
148
|
+
var n = t(this.type);
|
|
149
|
+
return ce[n] || (ce[n] = !0, console.error(
|
|
150
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
+
)), n = this.props.ref, n !== void 0 ? n : null;
|
|
152
|
+
}
|
|
153
|
+
function I(n, p, R, j, Q, ne) {
|
|
154
|
+
var k = R.ref;
|
|
155
|
+
return n = {
|
|
156
|
+
$$typeof: q,
|
|
157
|
+
type: n,
|
|
158
|
+
key: p,
|
|
159
|
+
props: R,
|
|
160
|
+
_owner: j
|
|
161
|
+
}, (k !== void 0 ? k : null) !== null ? Object.defineProperty(n, "ref", {
|
|
162
|
+
enumerable: !1,
|
|
163
|
+
get: x
|
|
164
|
+
}) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
|
|
165
|
+
configurable: !1,
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
writable: !0,
|
|
168
|
+
value: 0
|
|
169
|
+
}), Object.defineProperty(n, "_debugInfo", {
|
|
170
|
+
configurable: !1,
|
|
171
|
+
enumerable: !1,
|
|
172
|
+
writable: !0,
|
|
173
|
+
value: null
|
|
174
|
+
}), Object.defineProperty(n, "_debugStack", {
|
|
175
|
+
configurable: !1,
|
|
176
|
+
enumerable: !1,
|
|
177
|
+
writable: !0,
|
|
178
|
+
value: Q
|
|
179
|
+
}), Object.defineProperty(n, "_debugTask", {
|
|
180
|
+
configurable: !1,
|
|
181
|
+
enumerable: !1,
|
|
182
|
+
writable: !0,
|
|
183
|
+
value: ne
|
|
184
|
+
}), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
|
|
185
|
+
}
|
|
186
|
+
function B(n, p, R, j, Q, ne) {
|
|
187
|
+
var k = p.children;
|
|
188
|
+
if (k !== void 0)
|
|
189
|
+
if (j)
|
|
190
|
+
if (ge(k)) {
|
|
191
|
+
for (j = 0; j < k.length; j++)
|
|
192
|
+
N(k[j]);
|
|
193
|
+
Object.freeze && Object.freeze(k);
|
|
194
|
+
} else
|
|
195
|
+
console.error(
|
|
196
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
|
+
);
|
|
198
|
+
else N(k);
|
|
199
|
+
if (V.call(p, "key")) {
|
|
200
|
+
k = t(n);
|
|
201
|
+
var F = Object.keys(p).filter(function(ve) {
|
|
202
|
+
return ve !== "key";
|
|
203
|
+
});
|
|
204
|
+
j = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", ue[k + j] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
206
|
+
let props = %s;
|
|
207
|
+
<%s {...props} />
|
|
208
|
+
React keys must be passed directly to JSX without using spread:
|
|
209
|
+
let props = %s;
|
|
210
|
+
<%s key={someKey} {...props} />`,
|
|
211
|
+
j,
|
|
212
|
+
k,
|
|
213
|
+
F,
|
|
214
|
+
k
|
|
215
|
+
), ue[k + j] = !0);
|
|
216
|
+
}
|
|
217
|
+
if (k = null, R !== void 0 && (u(R), k = "" + R), E(p) && (u(p.key), k = "" + p.key), "key" in p) {
|
|
218
|
+
R = {};
|
|
219
|
+
for (var re in p)
|
|
220
|
+
re !== "key" && (R[re] = p[re]);
|
|
221
|
+
} else R = p;
|
|
222
|
+
return k && y(
|
|
223
|
+
R,
|
|
224
|
+
typeof n == "function" ? n.displayName || n.name || "Unknown" : n
|
|
225
|
+
), I(
|
|
226
|
+
n,
|
|
227
|
+
k,
|
|
228
|
+
R,
|
|
229
|
+
h(),
|
|
230
|
+
Q,
|
|
231
|
+
ne
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
function N(n) {
|
|
235
|
+
H(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === ee && (n._payload.status === "fulfilled" ? H(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
|
|
236
|
+
}
|
|
237
|
+
function H(n) {
|
|
238
|
+
return typeof n == "object" && n !== null && n.$$typeof === q;
|
|
239
|
+
}
|
|
240
|
+
var L = Y, q = Symbol.for("react.transitional.element"), U = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), X = Symbol.for("react.strict_mode"), z = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), A = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), J = Symbol.for("react.suspense"), pe = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), ee = Symbol.for("react.lazy"), P = Symbol.for("react.activity"), S = Symbol.for("react.client.reference"), Z = L.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, ge = Array.isArray, K = console.createTask ? console.createTask : function() {
|
|
241
|
+
return null;
|
|
242
|
+
};
|
|
243
|
+
L = {
|
|
244
|
+
react_stack_bottom_frame: function(n) {
|
|
245
|
+
return n();
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
var ie, ce = {}, te = L.react_stack_bottom_frame.bind(
|
|
249
|
+
L,
|
|
250
|
+
g
|
|
251
|
+
)(), W = K(c(g)), ue = {};
|
|
252
|
+
ae.Fragment = _, ae.jsx = function(n, p, R) {
|
|
253
|
+
var j = 1e4 > Z.recentlyCreatedOwnerStacks++;
|
|
254
|
+
return B(
|
|
255
|
+
n,
|
|
256
|
+
p,
|
|
257
|
+
R,
|
|
258
|
+
!1,
|
|
259
|
+
j ? Error("react-stack-top-frame") : te,
|
|
260
|
+
j ? K(c(n)) : W
|
|
261
|
+
);
|
|
262
|
+
}, ae.jsxs = function(n, p, R) {
|
|
263
|
+
var j = 1e4 > Z.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return B(
|
|
265
|
+
n,
|
|
266
|
+
p,
|
|
267
|
+
R,
|
|
268
|
+
!0,
|
|
269
|
+
j ? Error("react-stack-top-frame") : te,
|
|
270
|
+
j ? K(c(n)) : W
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
})()), ae;
|
|
274
|
+
}
|
|
275
|
+
var Ee;
|
|
276
|
+
function Pe() {
|
|
277
|
+
return Ee || (Ee = 1, process.env.NODE_ENV === "production" ? de.exports = ze() : de.exports = Oe()), de.exports;
|
|
278
|
+
}
|
|
279
|
+
var r = Pe(), ke = {
|
|
280
|
+
color: void 0,
|
|
281
|
+
size: void 0,
|
|
282
|
+
className: void 0,
|
|
283
|
+
style: void 0,
|
|
284
|
+
attr: void 0
|
|
285
|
+
}, Re = Y.createContext && /* @__PURE__ */ Y.createContext(ke), De = ["attr", "size", "title"];
|
|
286
|
+
function He(t, s) {
|
|
287
|
+
if (t == null) return {};
|
|
288
|
+
var u = Fe(t, s), c, h;
|
|
289
|
+
if (Object.getOwnPropertySymbols) {
|
|
290
|
+
var g = Object.getOwnPropertySymbols(t);
|
|
291
|
+
for (h = 0; h < g.length; h++)
|
|
292
|
+
c = g[h], !(s.indexOf(c) >= 0) && Object.prototype.propertyIsEnumerable.call(t, c) && (u[c] = t[c]);
|
|
293
|
+
}
|
|
294
|
+
return u;
|
|
295
|
+
}
|
|
296
|
+
function Fe(t, s) {
|
|
297
|
+
if (t == null) return {};
|
|
298
|
+
var u = {};
|
|
299
|
+
for (var c in t)
|
|
300
|
+
if (Object.prototype.hasOwnProperty.call(t, c)) {
|
|
301
|
+
if (s.indexOf(c) >= 0) continue;
|
|
302
|
+
u[c] = t[c];
|
|
303
|
+
}
|
|
304
|
+
return u;
|
|
305
|
+
}
|
|
306
|
+
function fe() {
|
|
307
|
+
return fe = Object.assign ? Object.assign.bind() : function(t) {
|
|
308
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
309
|
+
var u = arguments[s];
|
|
310
|
+
for (var c in u)
|
|
311
|
+
Object.prototype.hasOwnProperty.call(u, c) && (t[c] = u[c]);
|
|
312
|
+
}
|
|
313
|
+
return t;
|
|
314
|
+
}, fe.apply(this, arguments);
|
|
315
|
+
}
|
|
316
|
+
function Ce(t, s) {
|
|
317
|
+
var u = Object.keys(t);
|
|
318
|
+
if (Object.getOwnPropertySymbols) {
|
|
319
|
+
var c = Object.getOwnPropertySymbols(t);
|
|
320
|
+
s && (c = c.filter(function(h) {
|
|
321
|
+
return Object.getOwnPropertyDescriptor(t, h).enumerable;
|
|
322
|
+
})), u.push.apply(u, c);
|
|
323
|
+
}
|
|
324
|
+
return u;
|
|
325
|
+
}
|
|
326
|
+
function he(t) {
|
|
327
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
328
|
+
var u = arguments[s] != null ? arguments[s] : {};
|
|
329
|
+
s % 2 ? Ce(Object(u), !0).forEach(function(c) {
|
|
330
|
+
Ie(t, c, u[c]);
|
|
331
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(u)) : Ce(Object(u)).forEach(function(c) {
|
|
332
|
+
Object.defineProperty(t, c, Object.getOwnPropertyDescriptor(u, c));
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
return t;
|
|
336
|
+
}
|
|
337
|
+
function Ie(t, s, u) {
|
|
338
|
+
return s = Be(s), s in t ? Object.defineProperty(t, s, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : t[s] = u, t;
|
|
339
|
+
}
|
|
340
|
+
function Be(t) {
|
|
341
|
+
var s = Ve(t, "string");
|
|
342
|
+
return typeof s == "symbol" ? s : s + "";
|
|
343
|
+
}
|
|
344
|
+
function Ve(t, s) {
|
|
345
|
+
if (typeof t != "object" || !t) return t;
|
|
346
|
+
var u = t[Symbol.toPrimitive];
|
|
347
|
+
if (u !== void 0) {
|
|
348
|
+
var c = u.call(t, s);
|
|
349
|
+
if (typeof c != "object") return c;
|
|
350
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
351
|
+
}
|
|
352
|
+
return (s === "string" ? String : Number)(t);
|
|
353
|
+
}
|
|
354
|
+
function Le(t) {
|
|
355
|
+
return t && t.map((s, u) => /* @__PURE__ */ Y.createElement(s.tag, he({
|
|
356
|
+
key: u
|
|
357
|
+
}, s.attr), Le(s.child)));
|
|
358
|
+
}
|
|
359
|
+
function T(t) {
|
|
360
|
+
return (s) => /* @__PURE__ */ Y.createElement($e, fe({
|
|
361
|
+
attr: he({}, t.attr)
|
|
362
|
+
}, s), Le(t.child));
|
|
363
|
+
}
|
|
364
|
+
function $e(t) {
|
|
365
|
+
var s = (u) => {
|
|
366
|
+
var {
|
|
367
|
+
attr: c,
|
|
368
|
+
size: h,
|
|
369
|
+
title: g
|
|
370
|
+
} = t, E = He(t, De), y = h || u.size || "1em", x;
|
|
371
|
+
return u.className && (x = u.className), t.className && (x = (x ? x + " " : "") + t.className), /* @__PURE__ */ Y.createElement("svg", fe({
|
|
372
|
+
stroke: "currentColor",
|
|
373
|
+
fill: "currentColor",
|
|
374
|
+
strokeWidth: "0"
|
|
375
|
+
}, u.attr, c, E, {
|
|
376
|
+
className: x,
|
|
377
|
+
style: he(he({
|
|
378
|
+
color: t.color || u.color
|
|
379
|
+
}, u.style), t.style),
|
|
380
|
+
height: y,
|
|
381
|
+
width: y,
|
|
382
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
383
|
+
}), g && /* @__PURE__ */ Y.createElement("title", null, g), t.children);
|
|
384
|
+
};
|
|
385
|
+
return Re !== void 0 ? /* @__PURE__ */ Y.createElement(Re.Consumer, null, (u) => s(u)) : s(ke);
|
|
386
|
+
}
|
|
387
|
+
function Ye(t) {
|
|
388
|
+
return T({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z" }, child: [] }] })(t);
|
|
389
|
+
}
|
|
390
|
+
function Ue(t) {
|
|
391
|
+
return T({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z" }, child: [] }] })(t);
|
|
392
|
+
}
|
|
393
|
+
function We(t) {
|
|
394
|
+
return T({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z" }, child: [] }] })(t);
|
|
395
|
+
}
|
|
396
|
+
function qe(t) {
|
|
397
|
+
return T({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z" }, child: [] }] })(t);
|
|
398
|
+
}
|
|
399
|
+
function Xe(t) {
|
|
400
|
+
return T({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(t);
|
|
401
|
+
}
|
|
402
|
+
function Ge(t) {
|
|
403
|
+
return T({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z" }, child: [] }] })(t);
|
|
404
|
+
}
|
|
405
|
+
function Je(t) {
|
|
406
|
+
return T({ attr: { viewBox: "0 0 544 512" }, child: [{ tag: "path", attr: { d: "M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z" }, child: [] }] })(t);
|
|
407
|
+
}
|
|
408
|
+
function Ze(t) {
|
|
409
|
+
return T({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z" }, child: [] }] })(t);
|
|
410
|
+
}
|
|
411
|
+
function Ke(t) {
|
|
412
|
+
return T({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z" }, child: [] }] })(t);
|
|
413
|
+
}
|
|
414
|
+
function Qe(t) {
|
|
415
|
+
return T({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(t);
|
|
416
|
+
}
|
|
417
|
+
function et(t) {
|
|
418
|
+
return T({ attr: { viewBox: "0 0 496 512" }, child: [{ tag: "path", attr: { d: "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z" }, child: [] }] })(t);
|
|
419
|
+
}
|
|
420
|
+
function tt(t) {
|
|
421
|
+
return T({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z" }, child: [] }] })(t);
|
|
422
|
+
}
|
|
423
|
+
function nt(t) {
|
|
424
|
+
return T({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(t);
|
|
425
|
+
}
|
|
426
|
+
function rt(t) {
|
|
427
|
+
return T({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z" }, child: [] }] })(t);
|
|
428
|
+
}
|
|
429
|
+
function ot(t) {
|
|
430
|
+
return T({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z" }, child: [] }] })(t);
|
|
431
|
+
}
|
|
432
|
+
const at = [
|
|
433
|
+
"😀",
|
|
434
|
+
"😁",
|
|
435
|
+
"😂",
|
|
436
|
+
"🤣",
|
|
437
|
+
"😃",
|
|
438
|
+
"😄",
|
|
439
|
+
"😅",
|
|
440
|
+
"😉",
|
|
441
|
+
"😊",
|
|
442
|
+
"😍",
|
|
443
|
+
"😘",
|
|
444
|
+
"😜",
|
|
445
|
+
"😎",
|
|
446
|
+
"😢",
|
|
447
|
+
"😭",
|
|
448
|
+
"😡",
|
|
449
|
+
"🤔",
|
|
450
|
+
"🙄",
|
|
451
|
+
"😇",
|
|
452
|
+
"🥰",
|
|
453
|
+
"🤩",
|
|
454
|
+
"🤗",
|
|
455
|
+
"😴",
|
|
456
|
+
"😋",
|
|
457
|
+
"😬",
|
|
458
|
+
"🤤",
|
|
459
|
+
"😶🌫️",
|
|
460
|
+
"😷",
|
|
461
|
+
"🤕",
|
|
462
|
+
"🤑",
|
|
463
|
+
"🤠",
|
|
464
|
+
"😈",
|
|
465
|
+
"👻",
|
|
466
|
+
"💀",
|
|
467
|
+
"🤖",
|
|
468
|
+
"🐶",
|
|
469
|
+
"🐱",
|
|
470
|
+
"🐼",
|
|
471
|
+
"🐸",
|
|
472
|
+
"🦄",
|
|
473
|
+
"🐷",
|
|
474
|
+
"🐵",
|
|
475
|
+
"🐰",
|
|
476
|
+
"🐯",
|
|
477
|
+
"🦁",
|
|
478
|
+
"🐮",
|
|
479
|
+
"🌞",
|
|
480
|
+
"🌙",
|
|
481
|
+
"⭐",
|
|
482
|
+
"🌈",
|
|
483
|
+
"🔥",
|
|
484
|
+
"💧",
|
|
485
|
+
"❄️",
|
|
486
|
+
"⚡",
|
|
487
|
+
"☀️",
|
|
488
|
+
"🌸",
|
|
489
|
+
"🌹",
|
|
490
|
+
"🍎",
|
|
491
|
+
"🍕",
|
|
492
|
+
"🍩",
|
|
493
|
+
"🍔",
|
|
494
|
+
"🍟",
|
|
495
|
+
"🍇",
|
|
496
|
+
"🍉",
|
|
497
|
+
"🍓",
|
|
498
|
+
"🍒",
|
|
499
|
+
"🥭",
|
|
500
|
+
"🥑",
|
|
501
|
+
"🎉",
|
|
502
|
+
"🎂",
|
|
503
|
+
"🎁",
|
|
504
|
+
"🎈",
|
|
505
|
+
"🎶",
|
|
506
|
+
"🎵",
|
|
507
|
+
"🏆",
|
|
508
|
+
"⚽",
|
|
509
|
+
"🏀",
|
|
510
|
+
"🏸",
|
|
511
|
+
"🏏",
|
|
512
|
+
"🕹️",
|
|
513
|
+
"👋",
|
|
514
|
+
"🤚",
|
|
515
|
+
"🖐️",
|
|
516
|
+
"✋",
|
|
517
|
+
"🖖",
|
|
518
|
+
"👍",
|
|
519
|
+
"👎",
|
|
520
|
+
"👌",
|
|
521
|
+
"🤌",
|
|
522
|
+
"🤏",
|
|
523
|
+
"✊",
|
|
524
|
+
"👊",
|
|
525
|
+
"🤛",
|
|
526
|
+
"🤜",
|
|
527
|
+
"☝️",
|
|
528
|
+
"👆",
|
|
529
|
+
"👇",
|
|
530
|
+
"👈",
|
|
531
|
+
"👉",
|
|
532
|
+
"🤟",
|
|
533
|
+
"🤘",
|
|
534
|
+
"🤙",
|
|
535
|
+
"🙌",
|
|
536
|
+
"👏",
|
|
537
|
+
"🙏",
|
|
538
|
+
"✍️",
|
|
539
|
+
"💅",
|
|
540
|
+
"🤲",
|
|
541
|
+
"👏",
|
|
542
|
+
"🫶",
|
|
543
|
+
"👐"
|
|
544
|
+
], lt = ({
|
|
545
|
+
exec: t,
|
|
546
|
+
saveSelection: s,
|
|
547
|
+
handleFileChange: u,
|
|
548
|
+
handleFontSizeChange: c,
|
|
549
|
+
handleFontFamilyChange: h,
|
|
550
|
+
// insertListBlock,
|
|
551
|
+
insertEmoji: g,
|
|
552
|
+
handleLink: E,
|
|
553
|
+
removeFormatting: y,
|
|
554
|
+
visibleActions: x,
|
|
555
|
+
className: I,
|
|
556
|
+
style: B
|
|
557
|
+
}) => {
|
|
558
|
+
const N = $(null), H = $(null), L = $(null), [q, U] = O(!1);
|
|
559
|
+
le(() => {
|
|
560
|
+
const m = (A) => {
|
|
561
|
+
!A.target.closest(".rte-emoji-popup") && !A.target.closest("button[title='Emoji']") && U(!1);
|
|
562
|
+
};
|
|
563
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
564
|
+
}, []);
|
|
565
|
+
const _ = (m) => {
|
|
566
|
+
m.preventDefault();
|
|
567
|
+
const A = m.currentTarget.dataset.command;
|
|
568
|
+
if (A)
|
|
569
|
+
switch (A) {
|
|
570
|
+
case "bold":
|
|
571
|
+
case "italic":
|
|
572
|
+
case "underline":
|
|
573
|
+
case "insertUnorderedList":
|
|
574
|
+
case "insertOrderedList":
|
|
575
|
+
case "removeFormat":
|
|
576
|
+
t(A);
|
|
577
|
+
break;
|
|
578
|
+
case "insertImage": {
|
|
579
|
+
N.current?.click();
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
default:
|
|
583
|
+
console.warn("Unknown command:", A);
|
|
584
|
+
}
|
|
585
|
+
}, X = (m) => {
|
|
586
|
+
t("foreColor", m.target.value);
|
|
587
|
+
}, z = (m) => {
|
|
588
|
+
t("backColor", m.target.value);
|
|
589
|
+
};
|
|
590
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `rte-toolbar ${I || ""}`, style: B, children: [
|
|
591
|
+
x.bold && /* @__PURE__ */ r.jsx(
|
|
592
|
+
"button",
|
|
593
|
+
{
|
|
594
|
+
"data-command": "bold",
|
|
595
|
+
title: "Bold",
|
|
596
|
+
onMouseDown: _,
|
|
597
|
+
children: /* @__PURE__ */ r.jsx(Ge, {})
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
x.italic && /* @__PURE__ */ r.jsx(
|
|
601
|
+
"button",
|
|
602
|
+
{
|
|
603
|
+
"data-command": "italic",
|
|
604
|
+
title: "Italic",
|
|
605
|
+
onMouseDown: _,
|
|
606
|
+
children: /* @__PURE__ */ r.jsx(Ze, {})
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
x.underline && /* @__PURE__ */ r.jsx(
|
|
610
|
+
"button",
|
|
611
|
+
{
|
|
612
|
+
"data-command": "underline",
|
|
613
|
+
title: "Underline",
|
|
614
|
+
onMouseDown: _,
|
|
615
|
+
children: /* @__PURE__ */ r.jsx(nt, {})
|
|
616
|
+
}
|
|
617
|
+
),
|
|
618
|
+
x.unorderedList && /* @__PURE__ */ r.jsx(
|
|
619
|
+
"button",
|
|
620
|
+
{
|
|
621
|
+
"data-command": "insertUnorderedList",
|
|
622
|
+
onMouseDown: _,
|
|
623
|
+
title: "UnorderedList",
|
|
624
|
+
children: /* @__PURE__ */ r.jsx(Qe, {})
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
x.orderedList && /* @__PURE__ */ r.jsx(
|
|
628
|
+
"button",
|
|
629
|
+
{
|
|
630
|
+
"data-command": "insertOrderedList",
|
|
631
|
+
title: "OrderedList",
|
|
632
|
+
onMouseDown: _,
|
|
633
|
+
children: /* @__PURE__ */ r.jsx(qe, {})
|
|
634
|
+
}
|
|
635
|
+
),
|
|
636
|
+
x.link && /* @__PURE__ */ r.jsx("button", { "data-command": "createLink", title: "Link", onClick: E, children: /* @__PURE__ */ r.jsx(Ke, {}) }),
|
|
637
|
+
x.removeFormat && /* @__PURE__ */ r.jsx(
|
|
638
|
+
"button",
|
|
639
|
+
{
|
|
640
|
+
"data-command": "Remove format",
|
|
641
|
+
title: "removeFormat",
|
|
642
|
+
onMouseDown: (m) => {
|
|
643
|
+
m.preventDefault(), s(), y();
|
|
644
|
+
},
|
|
645
|
+
children: /* @__PURE__ */ r.jsx(ot, {})
|
|
646
|
+
}
|
|
647
|
+
),
|
|
648
|
+
x.image && /* @__PURE__ */ r.jsx(
|
|
649
|
+
"button",
|
|
650
|
+
{
|
|
651
|
+
"data-command": "insertImage",
|
|
652
|
+
title: "Image",
|
|
653
|
+
onMouseDown: _,
|
|
654
|
+
children: /* @__PURE__ */ r.jsx(We, {})
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
/* @__PURE__ */ r.jsx(
|
|
658
|
+
"input",
|
|
659
|
+
{
|
|
660
|
+
type: "file",
|
|
661
|
+
accept: "image/*",
|
|
662
|
+
ref: N,
|
|
663
|
+
style: { display: "none" },
|
|
664
|
+
onChange: u
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
x.emoji && /* @__PURE__ */ r.jsxs("div", { style: { position: "relative" }, children: [
|
|
668
|
+
/* @__PURE__ */ r.jsx(
|
|
669
|
+
"button",
|
|
670
|
+
{
|
|
671
|
+
title: "Emoji",
|
|
672
|
+
onMouseDown: (m) => {
|
|
673
|
+
m.preventDefault(), s(), U((A) => !A);
|
|
674
|
+
},
|
|
675
|
+
children: /* @__PURE__ */ r.jsx(et, {})
|
|
676
|
+
}
|
|
677
|
+
),
|
|
678
|
+
q && /* @__PURE__ */ r.jsx("div", { className: "rte-emoji-popup", children: at.map((m) => /* @__PURE__ */ r.jsx(
|
|
679
|
+
"span",
|
|
680
|
+
{
|
|
681
|
+
style: {
|
|
682
|
+
fontSize: "20px",
|
|
683
|
+
cursor: "pointer",
|
|
684
|
+
textAlign: "center"
|
|
685
|
+
},
|
|
686
|
+
onMouseDown: (A) => {
|
|
687
|
+
A.preventDefault(), g(m), U(!1);
|
|
688
|
+
},
|
|
689
|
+
children: m
|
|
690
|
+
},
|
|
691
|
+
m
|
|
692
|
+
)) })
|
|
693
|
+
] }),
|
|
694
|
+
x.color && /* @__PURE__ */ r.jsxs("div", { style: { position: "relative" }, children: [
|
|
695
|
+
/* @__PURE__ */ r.jsx(
|
|
696
|
+
"button",
|
|
697
|
+
{
|
|
698
|
+
title: "Text Color",
|
|
699
|
+
onMouseDown: (m) => {
|
|
700
|
+
m.preventDefault(), s(), H.current?.click();
|
|
701
|
+
},
|
|
702
|
+
style: {
|
|
703
|
+
display: "flex",
|
|
704
|
+
alignItems: "center",
|
|
705
|
+
justifyContent: "center",
|
|
706
|
+
color: H.current?.value || "#000",
|
|
707
|
+
fontSize: "18px"
|
|
708
|
+
},
|
|
709
|
+
children: /* @__PURE__ */ r.jsx(rt, {})
|
|
710
|
+
}
|
|
711
|
+
),
|
|
712
|
+
/* @__PURE__ */ r.jsx(
|
|
713
|
+
"input",
|
|
714
|
+
{
|
|
715
|
+
ref: H,
|
|
716
|
+
type: "color",
|
|
717
|
+
defaultValue: "#000000",
|
|
718
|
+
onChange: (m) => {
|
|
719
|
+
X(m), (m.target.parentElement?.querySelector(
|
|
720
|
+
"button"
|
|
721
|
+
)).style.color = m.target.value;
|
|
722
|
+
},
|
|
723
|
+
style: {
|
|
724
|
+
position: "absolute",
|
|
725
|
+
opacity: 0,
|
|
726
|
+
width: 0,
|
|
727
|
+
height: 0,
|
|
728
|
+
pointerEvents: "none"
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
] }),
|
|
733
|
+
x.highlight && /* @__PURE__ */ r.jsxs("div", { style: { position: "relative" }, children: [
|
|
734
|
+
/* @__PURE__ */ r.jsx(
|
|
735
|
+
"button",
|
|
736
|
+
{
|
|
737
|
+
title: "Highlight",
|
|
738
|
+
onMouseDown: (m) => {
|
|
739
|
+
m.preventDefault(), s(), L.current?.click();
|
|
740
|
+
},
|
|
741
|
+
style: {
|
|
742
|
+
display: "flex",
|
|
743
|
+
alignItems: "center",
|
|
744
|
+
justifyContent: "center",
|
|
745
|
+
color: L.current?.value || "#000",
|
|
746
|
+
fontSize: "18px"
|
|
747
|
+
},
|
|
748
|
+
children: /* @__PURE__ */ r.jsx(Je, {})
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
/* @__PURE__ */ r.jsx(
|
|
752
|
+
"input",
|
|
753
|
+
{
|
|
754
|
+
ref: L,
|
|
755
|
+
type: "color",
|
|
756
|
+
onChange: (m) => {
|
|
757
|
+
z(m), (m.target.parentElement?.querySelector(
|
|
758
|
+
"button"
|
|
759
|
+
)).style.color = m.target.value;
|
|
760
|
+
},
|
|
761
|
+
defaultValue: "#000000",
|
|
762
|
+
style: {
|
|
763
|
+
position: "absolute",
|
|
764
|
+
opacity: 0,
|
|
765
|
+
width: 0,
|
|
766
|
+
height: 0,
|
|
767
|
+
pointerEvents: "none"
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
)
|
|
771
|
+
] }),
|
|
772
|
+
x.align && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
773
|
+
/* @__PURE__ */ r.jsx(
|
|
774
|
+
"button",
|
|
775
|
+
{
|
|
776
|
+
title: "Align Left",
|
|
777
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
778
|
+
onClick: () => t("justifyLeft"),
|
|
779
|
+
children: /* @__PURE__ */ r.jsx(Xe, {})
|
|
780
|
+
}
|
|
781
|
+
),
|
|
782
|
+
/* @__PURE__ */ r.jsx(
|
|
783
|
+
"button",
|
|
784
|
+
{
|
|
785
|
+
title: "Align Center",
|
|
786
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
787
|
+
onClick: () => t("justifyCenter"),
|
|
788
|
+
children: /* @__PURE__ */ r.jsx(Ye, {})
|
|
789
|
+
}
|
|
790
|
+
),
|
|
791
|
+
/* @__PURE__ */ r.jsx(
|
|
792
|
+
"button",
|
|
793
|
+
{
|
|
794
|
+
title: "Align Right",
|
|
795
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
796
|
+
onClick: () => t("justifyRight"),
|
|
797
|
+
children: /* @__PURE__ */ r.jsx(Ue, {})
|
|
798
|
+
}
|
|
799
|
+
)
|
|
800
|
+
] }),
|
|
801
|
+
x.table && /* @__PURE__ */ r.jsx(
|
|
802
|
+
"button",
|
|
803
|
+
{
|
|
804
|
+
title: "Insert Table",
|
|
805
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
806
|
+
onClick: () => t("insertTable"),
|
|
807
|
+
children: /* @__PURE__ */ r.jsx(tt, {})
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
x.fontFamily && /* @__PURE__ */ r.jsxs(
|
|
811
|
+
"select",
|
|
812
|
+
{
|
|
813
|
+
className: "rte-dropdown",
|
|
814
|
+
defaultValue: "",
|
|
815
|
+
onMouseDown: () => s(),
|
|
816
|
+
onChange: h,
|
|
817
|
+
children: [
|
|
818
|
+
/* @__PURE__ */ r.jsx("option", { value: "", disabled: !0, children: "Font Family" }),
|
|
819
|
+
/* @__PURE__ */ r.jsx("option", { value: "Arial", children: "Arial" }),
|
|
820
|
+
/* @__PURE__ */ r.jsx("option", { value: "Georgia", children: "Georgia" }),
|
|
821
|
+
/* @__PURE__ */ r.jsx("option", { value: "Times New Roman", children: "Times New Roman" }),
|
|
822
|
+
/* @__PURE__ */ r.jsx("option", { value: "Courier New", children: "Courier New" }),
|
|
823
|
+
/* @__PURE__ */ r.jsx("option", { value: "Verdana", children: "Verdana" })
|
|
824
|
+
]
|
|
825
|
+
}
|
|
826
|
+
),
|
|
827
|
+
x.fontSize && /* @__PURE__ */ r.jsxs(
|
|
828
|
+
"select",
|
|
829
|
+
{
|
|
830
|
+
className: "rte-dropdown",
|
|
831
|
+
defaultValue: "",
|
|
832
|
+
onMouseDown: () => s(),
|
|
833
|
+
onChange: c,
|
|
834
|
+
children: [
|
|
835
|
+
/* @__PURE__ */ r.jsx("option", { value: "", disabled: !0, children: "Font Size" }),
|
|
836
|
+
/* @__PURE__ */ r.jsx("option", { value: "2", children: "Small " }),
|
|
837
|
+
/* @__PURE__ */ r.jsx("option", { value: "3", children: "Normal" }),
|
|
838
|
+
/* @__PURE__ */ r.jsx("option", { value: "4", children: "Medium" }),
|
|
839
|
+
/* @__PURE__ */ r.jsx("option", { value: "5", children: "Large" })
|
|
840
|
+
]
|
|
841
|
+
}
|
|
842
|
+
)
|
|
843
|
+
] });
|
|
844
|
+
}, st = ({
|
|
845
|
+
show: t,
|
|
846
|
+
position: s,
|
|
847
|
+
filtered: u,
|
|
848
|
+
insertMention: c,
|
|
849
|
+
onClose: h
|
|
850
|
+
}) => {
|
|
851
|
+
const g = $(null);
|
|
852
|
+
return le(() => {
|
|
853
|
+
const E = (y) => {
|
|
854
|
+
g.current && !g.current.contains(y.target) && h();
|
|
855
|
+
};
|
|
856
|
+
return t && document.addEventListener("mousedown", E), () => {
|
|
857
|
+
document.removeEventListener("mousedown", E);
|
|
858
|
+
};
|
|
859
|
+
}, [t, h]), t ? /* @__PURE__ */ r.jsx(
|
|
860
|
+
"ul",
|
|
861
|
+
{
|
|
862
|
+
ref: g,
|
|
863
|
+
className: "rte-popup",
|
|
864
|
+
style: {
|
|
865
|
+
top: s.y,
|
|
866
|
+
left: s.x
|
|
867
|
+
},
|
|
868
|
+
children: u.length > 0 ? u.map((E) => /* @__PURE__ */ r.jsx(
|
|
869
|
+
"li",
|
|
870
|
+
{
|
|
871
|
+
onMouseDown: (y) => {
|
|
872
|
+
y.preventDefault(), c(E);
|
|
873
|
+
},
|
|
874
|
+
style: {
|
|
875
|
+
padding: "6px 12px",
|
|
876
|
+
cursor: "pointer",
|
|
877
|
+
fontSize: "14px"
|
|
878
|
+
},
|
|
879
|
+
onMouseEnter: (y) => y.currentTarget.style.background = "#f0f0f0",
|
|
880
|
+
onMouseLeave: (y) => y.currentTarget.style.background = "#fff",
|
|
881
|
+
children: E.key
|
|
882
|
+
},
|
|
883
|
+
E.value
|
|
884
|
+
)) : /* @__PURE__ */ r.jsx("li", { style: { padding: "6px 12px", color: "#999" }, children: "No matches" })
|
|
885
|
+
}
|
|
886
|
+
) : null;
|
|
887
|
+
};
|
|
888
|
+
function je(t) {
|
|
889
|
+
return T({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Minus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z" }, child: [] }] }] }] })(t);
|
|
890
|
+
}
|
|
891
|
+
function me(t) {
|
|
892
|
+
return T({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Plus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z" }, child: [] }] }] }] })(t);
|
|
893
|
+
}
|
|
894
|
+
const it = ({
|
|
895
|
+
visible: t,
|
|
896
|
+
x: s,
|
|
897
|
+
y: u,
|
|
898
|
+
onAction: c,
|
|
899
|
+
onClose: h
|
|
900
|
+
}) => {
|
|
901
|
+
if (!t) return null;
|
|
902
|
+
const g = {
|
|
903
|
+
top: u,
|
|
904
|
+
left: s
|
|
905
|
+
};
|
|
906
|
+
return /* @__PURE__ */ r.jsxs("div", { style: g, className: "rte-table-menu", onMouseLeave: h, children: [
|
|
907
|
+
/* @__PURE__ */ r.jsxs("button", { onClick: () => c("insertRowAbove"), children: [
|
|
908
|
+
/* @__PURE__ */ r.jsx(me, {}),
|
|
909
|
+
" Insert row above"
|
|
910
|
+
] }),
|
|
911
|
+
/* @__PURE__ */ r.jsxs("button", { onClick: () => c("insertRowBelow"), children: [
|
|
912
|
+
/* @__PURE__ */ r.jsx(me, {}),
|
|
913
|
+
" Insert row below"
|
|
914
|
+
] }),
|
|
915
|
+
/* @__PURE__ */ r.jsxs("button", { onClick: () => c("insertColLeft"), children: [
|
|
916
|
+
/* @__PURE__ */ r.jsx(me, {}),
|
|
917
|
+
" Insert col left"
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ r.jsxs("button", { onClick: () => c("insertColRight"), children: [
|
|
920
|
+
/* @__PURE__ */ r.jsx(me, {}),
|
|
921
|
+
" Insert col right"
|
|
922
|
+
] }),
|
|
923
|
+
/* @__PURE__ */ r.jsxs("button", { onClick: () => c("deleteRow"), children: [
|
|
924
|
+
/* @__PURE__ */ r.jsx(je, {}),
|
|
925
|
+
" Delete row"
|
|
926
|
+
] }),
|
|
927
|
+
/* @__PURE__ */ r.jsxs("button", { onClick: () => c("deleteCol"), children: [
|
|
928
|
+
/* @__PURE__ */ r.jsx(je, {}),
|
|
929
|
+
" Delete column"
|
|
930
|
+
] })
|
|
931
|
+
] });
|
|
932
|
+
}, ct = ({ html: t, className: s, style: u }) => {
|
|
933
|
+
const c = (h) => {
|
|
934
|
+
const g = h.target;
|
|
935
|
+
if (g.tagName === "A") {
|
|
936
|
+
h.preventDefault();
|
|
937
|
+
const E = g.href;
|
|
938
|
+
E && window.open(E, "_blank", "noopener,noreferrer");
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
return /* @__PURE__ */ r.jsx(
|
|
942
|
+
"div",
|
|
943
|
+
{
|
|
944
|
+
className: `rte-preview ${s || ""}`,
|
|
945
|
+
style: u,
|
|
946
|
+
onClick: c,
|
|
947
|
+
dangerouslySetInnerHTML: { __html: t }
|
|
948
|
+
}
|
|
949
|
+
);
|
|
950
|
+
}, ut = ({
|
|
951
|
+
visible: t,
|
|
952
|
+
linkData: s,
|
|
953
|
+
onClose: u,
|
|
954
|
+
onInsert: c
|
|
955
|
+
}) => {
|
|
956
|
+
const [h, g] = O(""), [E, y] = O(""), [x, I] = O(""), [B, N] = O("_self");
|
|
957
|
+
if (le(() => {
|
|
958
|
+
t ? (g(s.url || ""), y(s.text || ""), I(s.title || ""), N(s.target || "_self")) : (g(""), y(""), I(""), N("_self"));
|
|
959
|
+
}, [t, s]), !t) return null;
|
|
960
|
+
const H = () => {
|
|
961
|
+
c({ url: h, text: E, title: x, target: B });
|
|
962
|
+
};
|
|
963
|
+
return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
964
|
+
/* @__PURE__ */ r.jsx("div", { className: "rte-link-modal-overlay", onClick: u }),
|
|
965
|
+
/* @__PURE__ */ r.jsxs("div", { className: "rte-link-modal", children: [
|
|
966
|
+
/* @__PURE__ */ r.jsx("h4", { className: "rte-link-modal__title", children: h ? "Edit Link" : "Insert Link" }),
|
|
967
|
+
/* @__PURE__ */ r.jsx(
|
|
968
|
+
"input",
|
|
969
|
+
{
|
|
970
|
+
type: "text",
|
|
971
|
+
className: "rte-link-modal__input",
|
|
972
|
+
placeholder: "URL",
|
|
973
|
+
value: h,
|
|
974
|
+
onChange: (L) => g(L.target.value)
|
|
975
|
+
}
|
|
976
|
+
),
|
|
977
|
+
/* @__PURE__ */ r.jsx(
|
|
978
|
+
"input",
|
|
979
|
+
{
|
|
980
|
+
type: "text",
|
|
981
|
+
className: "rte-link-modal__input",
|
|
982
|
+
placeholder: "Text to Display",
|
|
983
|
+
value: E,
|
|
984
|
+
onChange: (L) => y(L.target.value)
|
|
985
|
+
}
|
|
986
|
+
),
|
|
987
|
+
/* @__PURE__ */ r.jsx(
|
|
988
|
+
"input",
|
|
989
|
+
{
|
|
990
|
+
type: "text",
|
|
991
|
+
className: "rte-link-modal__input",
|
|
992
|
+
placeholder: "Title",
|
|
993
|
+
value: x,
|
|
994
|
+
onChange: (L) => I(L.target.value)
|
|
995
|
+
}
|
|
996
|
+
),
|
|
997
|
+
/* @__PURE__ */ r.jsxs(
|
|
998
|
+
"select",
|
|
999
|
+
{
|
|
1000
|
+
className: "rte-link-modal__select",
|
|
1001
|
+
value: B,
|
|
1002
|
+
onChange: (L) => N(L.target.value),
|
|
1003
|
+
children: [
|
|
1004
|
+
/* @__PURE__ */ r.jsx("option", { value: "_self", children: "Same tab" }),
|
|
1005
|
+
/* @__PURE__ */ r.jsx("option", { value: "_blank", children: "New tab" })
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
),
|
|
1009
|
+
/* @__PURE__ */ r.jsxs("div", { className: "rte-link-modal__actions", children: [
|
|
1010
|
+
/* @__PURE__ */ r.jsx("button", { className: "rte-link-modal__btn", onClick: u, children: "Cancel" }),
|
|
1011
|
+
/* @__PURE__ */ r.jsx(
|
|
1012
|
+
"button",
|
|
1013
|
+
{
|
|
1014
|
+
className: "rte-link-modal__btn rte-link-modal__btn--ok",
|
|
1015
|
+
onClick: H,
|
|
1016
|
+
children: "OK"
|
|
1017
|
+
}
|
|
1018
|
+
)
|
|
1019
|
+
] })
|
|
1020
|
+
] })
|
|
1021
|
+
] });
|
|
1022
|
+
}, mt = ({
|
|
1023
|
+
atSuggestions: t = [],
|
|
1024
|
+
showOutput: s = !1,
|
|
1025
|
+
showPreview: u = !1,
|
|
1026
|
+
toolbarConfig: c = {
|
|
1027
|
+
link: !1,
|
|
1028
|
+
image: !1,
|
|
1029
|
+
emoji: !1,
|
|
1030
|
+
table: !1,
|
|
1031
|
+
color: !1,
|
|
1032
|
+
fontFamily: !1,
|
|
1033
|
+
fontSize: !1,
|
|
1034
|
+
highlight: !1
|
|
1035
|
+
},
|
|
1036
|
+
classNames: h = {},
|
|
1037
|
+
styles: g = {},
|
|
1038
|
+
handleGetHtml: E = () => {
|
|
1039
|
+
}
|
|
1040
|
+
}) => {
|
|
1041
|
+
const y = $(null), [x, I] = O("<p>Always bet on Prime!</p>"), [B, N] = O(!1), [H, L] = O({ x: 0, y: 0 }), [q, U] = O([]), _ = $(null), X = $(null), [z, m] = O({ visible: !1, x: 0, y: 0 }), [A, G] = O(!1), J = $(null), [pe, se] = O({
|
|
1042
|
+
url: "",
|
|
1043
|
+
text: "",
|
|
1044
|
+
title: "",
|
|
1045
|
+
target: "_self"
|
|
1046
|
+
}), ee = {
|
|
1047
|
+
bold: !0,
|
|
1048
|
+
italic: !0,
|
|
1049
|
+
underline: !0,
|
|
1050
|
+
removeFormat: !0,
|
|
1051
|
+
unorderedList: !0,
|
|
1052
|
+
orderedList: !0,
|
|
1053
|
+
align: !0,
|
|
1054
|
+
link: c.link ?? !1,
|
|
1055
|
+
image: c.image ?? !1,
|
|
1056
|
+
emoji: c.emoji ?? !1,
|
|
1057
|
+
table: c.table ?? !1,
|
|
1058
|
+
color: c.color ?? !1,
|
|
1059
|
+
fontFamily: c.fontFamily ?? !1,
|
|
1060
|
+
fontSize: c.fontSize ?? !1,
|
|
1061
|
+
highlight: c.fontSize ?? !1
|
|
1062
|
+
}, P = () => y.current, S = () => {
|
|
1063
|
+
I(P()?.innerHTML ?? "");
|
|
1064
|
+
const e = we();
|
|
1065
|
+
E?.(e);
|
|
1066
|
+
}, Z = () => {
|
|
1067
|
+
const e = window.getSelection();
|
|
1068
|
+
e?.rangeCount && (_.current = e.getRangeAt(0));
|
|
1069
|
+
}, V = () => {
|
|
1070
|
+
const e = window.getSelection();
|
|
1071
|
+
e && _.current && (e.removeAllRanges(), e.addRange(_.current));
|
|
1072
|
+
}, ge = (e, a) => {
|
|
1073
|
+
const o = window.getSelection();
|
|
1074
|
+
o && o.rangeCount > 0 && (_.current = o.getRangeAt(0)), V(), document.execCommand(e, !1, a), S();
|
|
1075
|
+
};
|
|
1076
|
+
le(() => {
|
|
1077
|
+
const e = P();
|
|
1078
|
+
e && !e.innerHTML && (e.innerHTML = x), S();
|
|
1079
|
+
}, []), le(() => () => {
|
|
1080
|
+
document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
|
|
1081
|
+
}, []);
|
|
1082
|
+
const K = (e) => {
|
|
1083
|
+
for (; e && e.nodeName !== "LI"; )
|
|
1084
|
+
e = e.parentNode;
|
|
1085
|
+
return e;
|
|
1086
|
+
}, ie = (e) => {
|
|
1087
|
+
let a = 0, o = e.parentElement;
|
|
1088
|
+
for (; o; )
|
|
1089
|
+
(o.tagName === "UL" || o.tagName === "OL") && a++, o = o.parentElement;
|
|
1090
|
+
return a;
|
|
1091
|
+
}, ce = (e) => {
|
|
1092
|
+
const a = e.querySelector("li"), o = a ? ie(a) : 1;
|
|
1093
|
+
if (e.querySelector("[data-hidden-array-start]")) return;
|
|
1094
|
+
const l = `{{#arrayData${o > 1 ? o : ""}}}`, v = `{{/arrayData${o > 1 ? o : ""}}}`, i = document.createElement("span");
|
|
1095
|
+
i.textContent = l, i.style.display = "none", i.setAttribute("data-hidden-array-start", "true"), e.insertBefore(i, e.firstChild);
|
|
1096
|
+
const f = document.createElement("span");
|
|
1097
|
+
f.textContent = v, f.style.display = "none", f.setAttribute("data-hidden-array-end", "true"), e.appendChild(f);
|
|
1098
|
+
}, te = (e) => {
|
|
1099
|
+
const a = window.getSelection();
|
|
1100
|
+
if (!a?.rangeCount) return;
|
|
1101
|
+
const o = a.getRangeAt(0), l = K(o.startContainer);
|
|
1102
|
+
let v, i;
|
|
1103
|
+
if (l) {
|
|
1104
|
+
let d = l.querySelector(e);
|
|
1105
|
+
d || (d = document.createElement(e), d.style.margin = "0", d.style.paddingLeft = "20px", l.appendChild(d)), i = d, v = document.createElement("li"), v.textContent = "", i.appendChild(v);
|
|
1106
|
+
} else {
|
|
1107
|
+
if (document.execCommand(
|
|
1108
|
+
e === "ul" ? "insertUnorderedList" : "insertOrderedList"
|
|
1109
|
+
), i = P()?.querySelector(`${e}:last-child`), !i) return;
|
|
1110
|
+
v = i.querySelector("li:last-child");
|
|
1111
|
+
}
|
|
1112
|
+
ce(i);
|
|
1113
|
+
const f = document.createRange();
|
|
1114
|
+
f.setStart(v, 0), f.collapse(!0), a.removeAllRanges(), a.addRange(f), P()?.focus(), S();
|
|
1115
|
+
}, W = (e, a) => {
|
|
1116
|
+
e === "insertOrderedList" ? te("ol") : e === "insertUnorderedList" ? te("ul") : ge(e, a), e === "insertTable" && ne();
|
|
1117
|
+
}, ue = (e) => {
|
|
1118
|
+
const a = document.createElement("span");
|
|
1119
|
+
a.textContent = "", e.insertNode(a), e.setStartAfter(a), e.collapse(!0);
|
|
1120
|
+
const o = a.getBoundingClientRect();
|
|
1121
|
+
a.remove(), L({ x: o.left, y: o.bottom + window.scrollY }), U(t || []), N(!0), X.current = e.cloneRange();
|
|
1122
|
+
}, n = (e) => {
|
|
1123
|
+
const a = X.current;
|
|
1124
|
+
if (!a) return;
|
|
1125
|
+
const o = window.getSelection();
|
|
1126
|
+
o?.removeAllRanges(), o?.addRange(a);
|
|
1127
|
+
const l = document.createElement("span");
|
|
1128
|
+
l.textContent = `{{${e.key}}}`, l.style.color = "#007bff", l.style.display = "inline", l.contentEditable = "false", a.deleteContents(), a.insertNode(l);
|
|
1129
|
+
const v = document.createTextNode(" ");
|
|
1130
|
+
a.setStartAfter(l), a.insertNode(v);
|
|
1131
|
+
const i = document.createRange();
|
|
1132
|
+
i.setStartAfter(v), i.collapse(!0), o?.removeAllRanges(), o?.addRange(i), N(!1), P()?.focus(), S();
|
|
1133
|
+
}, p = (e) => {
|
|
1134
|
+
const a = e.key.toLowerCase();
|
|
1135
|
+
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(a) && (e.preventDefault(), W(
|
|
1136
|
+
a === "b" ? "bold" : a === "i" ? "italic" : a === "u" ? "underline" : ""
|
|
1137
|
+
)), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
|
|
1138
|
+
const o = window.getSelection(), l = o?.anchorNode ? K(o.anchorNode) : null;
|
|
1139
|
+
if (!l) return;
|
|
1140
|
+
if (l.textContent?.replace(/\u200B/g, "").trim() === "") {
|
|
1141
|
+
e.preventDefault();
|
|
1142
|
+
const i = l.parentElement, f = i?.closest("li");
|
|
1143
|
+
if (f) {
|
|
1144
|
+
i?.removeChild(l);
|
|
1145
|
+
const d = document.createElement("p");
|
|
1146
|
+
d.innerHTML = "<br />", f.parentElement?.insertBefore(d, f.nextSibling);
|
|
1147
|
+
const b = document.createRange();
|
|
1148
|
+
b.setStart(d, 0), b.collapse(!0), o?.removeAllRanges(), o?.addRange(b);
|
|
1149
|
+
} else {
|
|
1150
|
+
const d = l.closest("ul, ol");
|
|
1151
|
+
if (d) {
|
|
1152
|
+
const b = document.createElement("p");
|
|
1153
|
+
b.innerHTML = "<br />", d.parentElement?.insertBefore(b, d.nextSibling), d.removeChild(l);
|
|
1154
|
+
const C = document.createRange();
|
|
1155
|
+
C.setStart(b, 0), C.collapse(!0), o?.removeAllRanges(), o?.addRange(C);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
S();
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}, R = (e) => {
|
|
1162
|
+
if (e.data !== "@") return;
|
|
1163
|
+
e.preventDefault();
|
|
1164
|
+
const a = window.getSelection();
|
|
1165
|
+
a?.rangeCount && ue(a.getRangeAt(0));
|
|
1166
|
+
}, j = (e) => {
|
|
1167
|
+
const a = e.target.files?.[0];
|
|
1168
|
+
if (!a) return;
|
|
1169
|
+
const o = new FileReader();
|
|
1170
|
+
o.onload = (l) => {
|
|
1171
|
+
const v = l.target?.result;
|
|
1172
|
+
V();
|
|
1173
|
+
const i = window.getSelection();
|
|
1174
|
+
let f = i && i.rangeCount ? i.getRangeAt(0) : null;
|
|
1175
|
+
const d = document.createElement("img");
|
|
1176
|
+
d.src = v, d.alt = a.name || "image", d.className = "rte-inserted-image", d.contentEditable = "true";
|
|
1177
|
+
const b = P();
|
|
1178
|
+
if (!f || !b) {
|
|
1179
|
+
b?.appendChild(d);
|
|
1180
|
+
const M = document.createTextNode(" ");
|
|
1181
|
+
b?.appendChild(M);
|
|
1182
|
+
const D = document.createRange();
|
|
1183
|
+
D.setStartAfter(M), D.collapse(!0), i?.removeAllRanges(), i?.addRange(D), b?.focus(), S(), e.target.value = "";
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
f.deleteContents(), f.insertNode(d);
|
|
1187
|
+
const C = document.createTextNode(" ");
|
|
1188
|
+
d.after(C);
|
|
1189
|
+
const w = document.createRange();
|
|
1190
|
+
w.setStartAfter(C), w.collapse(!0), i.removeAllRanges(), i.addRange(w), b.focus(), S(), e.target.value = "";
|
|
1191
|
+
}, o.readAsDataURL(a);
|
|
1192
|
+
}, Q = (e) => {
|
|
1193
|
+
V();
|
|
1194
|
+
const a = window.getSelection();
|
|
1195
|
+
if (!a?.rangeCount) return;
|
|
1196
|
+
const o = a.getRangeAt(0), l = document.createTextNode(e);
|
|
1197
|
+
o.insertNode(l), o.setStartAfter(l), o.collapse(!0), a.removeAllRanges(), a.addRange(o), P()?.focus(), S();
|
|
1198
|
+
}, ne = () => {
|
|
1199
|
+
V();
|
|
1200
|
+
const e = document.createElement("table");
|
|
1201
|
+
e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative";
|
|
1202
|
+
const a = document.createElement("thead"), o = document.createElement("tbody"), l = document.createElement("tr"), v = document.createElement("tr");
|
|
1203
|
+
for (let d = 0; d < 2; d++) {
|
|
1204
|
+
const b = document.createElement("th");
|
|
1205
|
+
b.textContent = `Header ${d + 1}`, b.style.border = "1px solid #999", b.style.padding = "8px", b.style.position = "relative";
|
|
1206
|
+
const C = document.createElement("td");
|
|
1207
|
+
C.textContent = `Row 1 Col ${d + 1}`, C.style.border = "1px solid #999", C.style.padding = "8px", C.style.position = "relative", F(b), F(C), l.appendChild(b), v.appendChild(C);
|
|
1208
|
+
}
|
|
1209
|
+
a.appendChild(l), o.appendChild(v), e.appendChild(a), e.appendChild(o), Se(e), k(e);
|
|
1210
|
+
const i = window.getSelection();
|
|
1211
|
+
if (!i?.rangeCount) return;
|
|
1212
|
+
i.getRangeAt(0).insertNode(e), S();
|
|
1213
|
+
}, k = (e) => {
|
|
1214
|
+
const a = document.createElement("div");
|
|
1215
|
+
Object.assign(a.style, {
|
|
1216
|
+
position: "absolute",
|
|
1217
|
+
width: "14px",
|
|
1218
|
+
height: "14px",
|
|
1219
|
+
right: "0",
|
|
1220
|
+
bottom: "0",
|
|
1221
|
+
background: "rgba(0,0,0,0.25)",
|
|
1222
|
+
cursor: "nwse-resize",
|
|
1223
|
+
zIndex: "20",
|
|
1224
|
+
borderRadius: "2px"
|
|
1225
|
+
});
|
|
1226
|
+
let o = 0, l = 0, v = 0, i = 0;
|
|
1227
|
+
a.addEventListener("mousedown", (f) => {
|
|
1228
|
+
f.preventDefault(), o = f.clientX, l = f.clientY;
|
|
1229
|
+
const d = e.getBoundingClientRect();
|
|
1230
|
+
v = d.width, i = d.height;
|
|
1231
|
+
const b = (w) => {
|
|
1232
|
+
const M = Math.max(100, v + (w.clientX - o)), D = Math.max(60, i + (w.clientY - l));
|
|
1233
|
+
e.style.width = `${M}px`, e.style.height = `${D}px`, S();
|
|
1234
|
+
}, C = () => {
|
|
1235
|
+
document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", C), S();
|
|
1236
|
+
};
|
|
1237
|
+
document.addEventListener("mousemove", b), document.addEventListener("mouseup", C);
|
|
1238
|
+
}), e.appendChild(a);
|
|
1239
|
+
}, F = (e) => {
|
|
1240
|
+
const a = document.createElement("div"), o = document.createElement("div");
|
|
1241
|
+
Object.assign(a.style, {
|
|
1242
|
+
position: "absolute",
|
|
1243
|
+
right: "0",
|
|
1244
|
+
top: "0",
|
|
1245
|
+
width: "6px",
|
|
1246
|
+
height: "100%",
|
|
1247
|
+
cursor: "col-resize",
|
|
1248
|
+
background: "rgba(0,0,0,0.15)",
|
|
1249
|
+
zIndex: "10"
|
|
1250
|
+
}), Object.assign(o.style, {
|
|
1251
|
+
position: "absolute",
|
|
1252
|
+
bottom: "0",
|
|
1253
|
+
left: "0",
|
|
1254
|
+
width: "100%",
|
|
1255
|
+
height: "6px",
|
|
1256
|
+
cursor: "row-resize",
|
|
1257
|
+
background: "rgba(0,0,0,0.15)",
|
|
1258
|
+
zIndex: "10"
|
|
1259
|
+
}), re(e, a, o), e.appendChild(a), e.appendChild(o);
|
|
1260
|
+
}, re = (e, a, o) => {
|
|
1261
|
+
let l = 0, v = 0, i = 0, f = 0;
|
|
1262
|
+
a.addEventListener("mousedown", (w) => {
|
|
1263
|
+
w.preventDefault(), l = w.clientX, i = e.offsetWidth, document.addEventListener("mousemove", d), document.addEventListener("mouseup", C);
|
|
1264
|
+
}), o.addEventListener("mousedown", (w) => {
|
|
1265
|
+
w.preventDefault(), v = w.clientY, f = e.offsetHeight, document.addEventListener("mousemove", b), document.addEventListener("mouseup", C);
|
|
1266
|
+
});
|
|
1267
|
+
const d = (w) => {
|
|
1268
|
+
const M = i + (w.clientX - l);
|
|
1269
|
+
e.style.width = `${Math.max(30, M)}px`;
|
|
1270
|
+
}, b = (w) => {
|
|
1271
|
+
const M = f + (w.clientY - v);
|
|
1272
|
+
e.style.height = `${Math.max(20, M)}px`;
|
|
1273
|
+
}, C = () => {
|
|
1274
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", C);
|
|
1275
|
+
};
|
|
1276
|
+
}, ve = (e) => {
|
|
1277
|
+
const o = e.target.closest("td, th");
|
|
1278
|
+
o && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((l) => l.classList.remove("rte-cell-highlight")), o.classList.add("rte-cell-highlight"), m({ visible: !0, x: e.clientX, y: e.clientY, cell: o }));
|
|
1279
|
+
}, xe = () => {
|
|
1280
|
+
document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
|
|
1281
|
+
}, _e = (e) => {
|
|
1282
|
+
if (!z.cell) return;
|
|
1283
|
+
const a = z.cell.closest("table"), o = z.cell.cellIndex, l = z.cell.parentElement.rowIndex, v = (i) => {
|
|
1284
|
+
const f = i.tagName.toLowerCase(), d = document.createElement(f);
|
|
1285
|
+
return d.textContent = i.textContent || "", d.style.cssText = i.style.cssText, F(d), d;
|
|
1286
|
+
};
|
|
1287
|
+
switch (e) {
|
|
1288
|
+
case "insertRowAbove": {
|
|
1289
|
+
const i = a.rows[l], f = a.insertRow(l);
|
|
1290
|
+
Array.from(i.cells).forEach((d) => {
|
|
1291
|
+
f.appendChild(v(d));
|
|
1292
|
+
});
|
|
1293
|
+
break;
|
|
1294
|
+
}
|
|
1295
|
+
case "insertRowBelow": {
|
|
1296
|
+
const i = a.rows[l], f = a.insertRow(l + 1);
|
|
1297
|
+
Array.from(i.cells).forEach((d) => {
|
|
1298
|
+
f.appendChild(v(d));
|
|
1299
|
+
});
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
case "insertColLeft": {
|
|
1303
|
+
Array.from(a.rows).forEach((i) => {
|
|
1304
|
+
const f = i.cells[o];
|
|
1305
|
+
i.insertBefore(v(f), f);
|
|
1306
|
+
});
|
|
1307
|
+
break;
|
|
1308
|
+
}
|
|
1309
|
+
case "insertColRight": {
|
|
1310
|
+
Array.from(a.rows).forEach((i) => {
|
|
1311
|
+
const f = i.cells[o];
|
|
1312
|
+
i.insertBefore(v(f), f.nextSibling);
|
|
1313
|
+
});
|
|
1314
|
+
break;
|
|
1315
|
+
}
|
|
1316
|
+
case "deleteRow":
|
|
1317
|
+
a.rows.length > 1 && a.deleteRow(l);
|
|
1318
|
+
break;
|
|
1319
|
+
case "deleteCol":
|
|
1320
|
+
Array.from(a.rows).forEach((i) => {
|
|
1321
|
+
i.cells[o] && i.deleteCell(o);
|
|
1322
|
+
});
|
|
1323
|
+
break;
|
|
1324
|
+
}
|
|
1325
|
+
S(), m({ ...z, visible: !1 }), xe();
|
|
1326
|
+
}, Se = (e) => {
|
|
1327
|
+
const a = e.querySelector("tbody");
|
|
1328
|
+
if (!a || a.querySelector("[data-hidden-table-start]")) return;
|
|
1329
|
+
const o = document.createElement("span");
|
|
1330
|
+
o.textContent = "{{#tableData}}", o.style.display = "none", o.setAttribute("data-hidden-table-start", "true"), a.insertBefore(o, a.firstChild);
|
|
1331
|
+
const l = document.createElement("span");
|
|
1332
|
+
l.textContent = "{{/tableData}}", l.style.display = "none", l.setAttribute("data-hidden-table-end", "true"), a.appendChild(l);
|
|
1333
|
+
}, we = () => {
|
|
1334
|
+
const e = P();
|
|
1335
|
+
if (!e) return x;
|
|
1336
|
+
const a = e.cloneNode(!0);
|
|
1337
|
+
return a.querySelectorAll(".rte-cell-highlight").forEach((o) => {
|
|
1338
|
+
o.classList.remove("rte-cell-highlight");
|
|
1339
|
+
}), a.querySelectorAll("div").forEach((o) => {
|
|
1340
|
+
(o.style.cursor === "col-resize" || o.style.cursor === "row-resize" || o.style.cursor === "nwse-resize") && o.remove();
|
|
1341
|
+
}), a.innerHTML;
|
|
1342
|
+
}, Te = () => {
|
|
1343
|
+
Z(), J.current = _.current, se({ url: "", text: "", title: "", target: "_self" }), G(!0);
|
|
1344
|
+
}, Me = (e) => {
|
|
1345
|
+
const a = window.getSelection();
|
|
1346
|
+
if (!a || !J.current) return;
|
|
1347
|
+
a.removeAllRanges(), a.addRange(J.current);
|
|
1348
|
+
let o = e.url.trim();
|
|
1349
|
+
/^https?:\/\//i.test(o) || (o = "https://" + o);
|
|
1350
|
+
const l = document.createElement("a");
|
|
1351
|
+
l.href = o, l.style.cursor = "pointer", l.style.outline = "none", l.textContent = e.text || o, l.title = e.title, l.target = e.target, l.contentEditable = "true";
|
|
1352
|
+
const v = a.getRangeAt(0);
|
|
1353
|
+
v.deleteContents(), v.insertNode(l);
|
|
1354
|
+
const i = document.createTextNode(" ");
|
|
1355
|
+
l.after(i);
|
|
1356
|
+
const f = document.createRange();
|
|
1357
|
+
f.setStartAfter(i), f.collapse(!0), a.removeAllRanges(), a.addRange(f), G(!1), S();
|
|
1358
|
+
}, Ae = (e) => {
|
|
1359
|
+
const a = e.target;
|
|
1360
|
+
if (a.tagName === "A") {
|
|
1361
|
+
const o = a;
|
|
1362
|
+
if (e.ctrlKey || e.metaKey) {
|
|
1363
|
+
window.open(o.href, "_blank", "noopener,noreferrer");
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
e.preventDefault();
|
|
1367
|
+
const l = document.createRange();
|
|
1368
|
+
l.selectNode(o), J.current = l, se({
|
|
1369
|
+
url: o.href,
|
|
1370
|
+
text: o.textContent || o.href,
|
|
1371
|
+
title: o.title,
|
|
1372
|
+
target: o.target
|
|
1373
|
+
}), G(!0);
|
|
1374
|
+
}
|
|
1375
|
+
}, Ne = () => {
|
|
1376
|
+
const e = P();
|
|
1377
|
+
if (!e) return;
|
|
1378
|
+
const a = window.getSelection();
|
|
1379
|
+
if ((!a || a.rangeCount === 0) && _.current) {
|
|
1380
|
+
const w = window.getSelection();
|
|
1381
|
+
w?.removeAllRanges(), w?.addRange(_.current);
|
|
1382
|
+
}
|
|
1383
|
+
const o = window.getSelection();
|
|
1384
|
+
if (!o || o.rangeCount === 0) return;
|
|
1385
|
+
const l = o.getRangeAt(0);
|
|
1386
|
+
V(), document.execCommand("removeFormat", !1);
|
|
1387
|
+
const v = l.cloneContents(), i = document.createElement("div");
|
|
1388
|
+
i.appendChild(v);
|
|
1389
|
+
const f = document.createTreeWalker(
|
|
1390
|
+
i,
|
|
1391
|
+
NodeFilter.SHOW_ELEMENT,
|
|
1392
|
+
null
|
|
1393
|
+
), d = [];
|
|
1394
|
+
for (; f.nextNode(); ) {
|
|
1395
|
+
const w = f.currentNode, M = w.tagName.toUpperCase(), D = w.getAttribute && w.getAttribute("data-mention") !== null;
|
|
1396
|
+
M !== "A" && !D && d.push(w);
|
|
1397
|
+
}
|
|
1398
|
+
for (let w = d.length - 1; w >= 0; w--) {
|
|
1399
|
+
const M = d[w], D = M.parentNode;
|
|
1400
|
+
if (D) {
|
|
1401
|
+
for (; M.firstChild; ) D.insertBefore(M.firstChild, M);
|
|
1402
|
+
D.removeChild(M);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
i.querySelectorAll("[style]").forEach((w) => w.removeAttribute("style")), l.deleteContents();
|
|
1406
|
+
const b = document.createDocumentFragment();
|
|
1407
|
+
for (; i.firstChild; ) b.appendChild(i.firstChild);
|
|
1408
|
+
l.insertNode(b);
|
|
1409
|
+
const C = document.createRange();
|
|
1410
|
+
C.setStartAfter(
|
|
1411
|
+
l.endContainer.nodeType === Node.TEXT_NODE ? l.endContainer : l.startContainer
|
|
1412
|
+
), C.collapse(!0), o.removeAllRanges(), o.addRange(C), e.normalize(), S();
|
|
1413
|
+
};
|
|
1414
|
+
return /* @__PURE__ */ r.jsxs(
|
|
1415
|
+
"div",
|
|
1416
|
+
{
|
|
1417
|
+
className: `rte-wrapper ${h?.wrapper || ""}`,
|
|
1418
|
+
style: g.wrapper,
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ r.jsxs("div", { style: { flex: 1 }, children: [
|
|
1421
|
+
/* @__PURE__ */ r.jsx(
|
|
1422
|
+
lt,
|
|
1423
|
+
{
|
|
1424
|
+
exec: W,
|
|
1425
|
+
saveSelection: Z,
|
|
1426
|
+
handleFileChange: j,
|
|
1427
|
+
handleFontSizeChange: (e) => W("fontSize", e.target.value),
|
|
1428
|
+
handleFontFamilyChange: (e) => W("fontName", e.target.value),
|
|
1429
|
+
insertEmoji: Q,
|
|
1430
|
+
handleLink: Te,
|
|
1431
|
+
removeFormatting: Ne,
|
|
1432
|
+
visibleActions: ee,
|
|
1433
|
+
className: h.toolbar,
|
|
1434
|
+
style: g.toolbar
|
|
1435
|
+
}
|
|
1436
|
+
),
|
|
1437
|
+
/* @__PURE__ */ r.jsx(
|
|
1438
|
+
"div",
|
|
1439
|
+
{
|
|
1440
|
+
ref: y,
|
|
1441
|
+
className: `rte-editor ${h?.editor || ""}`,
|
|
1442
|
+
style: g.editor,
|
|
1443
|
+
contentEditable: !0,
|
|
1444
|
+
suppressContentEditableWarning: !0,
|
|
1445
|
+
onInput: S,
|
|
1446
|
+
onKeyDown: p,
|
|
1447
|
+
onBeforeInput: R,
|
|
1448
|
+
onContextMenu: ve,
|
|
1449
|
+
onClick: Ae
|
|
1450
|
+
}
|
|
1451
|
+
),
|
|
1452
|
+
/* @__PURE__ */ r.jsx(
|
|
1453
|
+
st,
|
|
1454
|
+
{
|
|
1455
|
+
show: B,
|
|
1456
|
+
position: H,
|
|
1457
|
+
filtered: q,
|
|
1458
|
+
insertMention: n,
|
|
1459
|
+
onClose: () => N(!1)
|
|
1460
|
+
}
|
|
1461
|
+
),
|
|
1462
|
+
s && /* @__PURE__ */ r.jsxs(
|
|
1463
|
+
"div",
|
|
1464
|
+
{
|
|
1465
|
+
className: `rte-output ${h?.output || ""}`,
|
|
1466
|
+
style: g.output,
|
|
1467
|
+
children: [
|
|
1468
|
+
/* @__PURE__ */ r.jsx("h4", { children: "Output HTML:" }),
|
|
1469
|
+
/* @__PURE__ */ r.jsx("p", { children: x })
|
|
1470
|
+
]
|
|
1471
|
+
}
|
|
1472
|
+
),
|
|
1473
|
+
/* @__PURE__ */ r.jsx(
|
|
1474
|
+
it,
|
|
1475
|
+
{
|
|
1476
|
+
visible: z.visible,
|
|
1477
|
+
x: z.x,
|
|
1478
|
+
y: z.y,
|
|
1479
|
+
onAction: _e,
|
|
1480
|
+
onClose: () => {
|
|
1481
|
+
m({ ...z, visible: !1 }), xe();
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
),
|
|
1485
|
+
/* @__PURE__ */ r.jsx(
|
|
1486
|
+
ut,
|
|
1487
|
+
{
|
|
1488
|
+
visible: A,
|
|
1489
|
+
linkData: pe,
|
|
1490
|
+
onClose: () => G(!1),
|
|
1491
|
+
onInsert: Me
|
|
1492
|
+
}
|
|
1493
|
+
)
|
|
1494
|
+
] }),
|
|
1495
|
+
u ? /* @__PURE__ */ r.jsx(
|
|
1496
|
+
ct,
|
|
1497
|
+
{
|
|
1498
|
+
className: h.preview,
|
|
1499
|
+
style: g.preview,
|
|
1500
|
+
html: we()
|
|
1501
|
+
}
|
|
1502
|
+
) : null
|
|
1503
|
+
]
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1506
|
+
};
|
|
1507
|
+
export {
|
|
1508
|
+
mt as RichTextEditor,
|
|
1509
|
+
ct as RtePreview,
|
|
1510
|
+
lt as RteToolbar
|
|
1511
|
+
};
|