@ryzeup/richtexteditor 1.0.17 → 1.0.19
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/index.es.js +600 -562
- package/dist/index.js +5 -5
- package/dist/index.umd.js +4 -4
- package/dist/richtexteditor.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var d in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var d of
|
|
10
|
-
|
|
1
|
+
var dt = Object.defineProperty, ut = Object.defineProperties;
|
|
2
|
+
var mt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var xe = Object.getOwnPropertySymbols;
|
|
4
|
+
var gt = Object.prototype.hasOwnProperty, ft = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Le = (r, i, d) => i in r ? dt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[i] = d, ae = (r, i) => {
|
|
6
|
+
for (var d in i || (i = {}))
|
|
7
|
+
gt.call(i, d) && Le(r, d, i[d]);
|
|
8
|
+
if (xe)
|
|
9
|
+
for (var d of xe(i))
|
|
10
|
+
ft.call(i, d) && Le(r, d, i[d]);
|
|
11
11
|
return r;
|
|
12
|
-
}, oe = (r,
|
|
13
|
-
import * as
|
|
14
|
-
import o, { useRef as P, useState as
|
|
15
|
-
import { createPortal as
|
|
16
|
-
window.React =
|
|
12
|
+
}, oe = (r, i) => ut(r, mt(i));
|
|
13
|
+
import * as ht from "react";
|
|
14
|
+
import o, { useRef as P, useState as A, useEffect as I } from "react";
|
|
15
|
+
import { createPortal as pt } from "react-dom";
|
|
16
|
+
window.React = ht;
|
|
17
17
|
var ke = {
|
|
18
18
|
color: void 0,
|
|
19
19
|
size: void 0,
|
|
20
20
|
className: void 0,
|
|
21
21
|
style: void 0,
|
|
22
22
|
attr: void 0
|
|
23
|
-
},
|
|
24
|
-
function
|
|
23
|
+
}, Se = o.createContext && /* @__PURE__ */ o.createContext(ke), vt = ["attr", "size", "title"];
|
|
24
|
+
function yt(r, i) {
|
|
25
25
|
if (r == null) return {};
|
|
26
|
-
var d =
|
|
26
|
+
var d = Et(r, i), u, f;
|
|
27
27
|
if (Object.getOwnPropertySymbols) {
|
|
28
|
-
var
|
|
29
|
-
for (
|
|
30
|
-
u =
|
|
28
|
+
var w = Object.getOwnPropertySymbols(r);
|
|
29
|
+
for (f = 0; f < w.length; f++)
|
|
30
|
+
u = w[f], !(i.indexOf(u) >= 0) && Object.prototype.propertyIsEnumerable.call(r, u) && (d[u] = r[u]);
|
|
31
31
|
}
|
|
32
32
|
return d;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function Et(r, i) {
|
|
35
35
|
if (r == null) return {};
|
|
36
36
|
var d = {};
|
|
37
37
|
for (var u in r)
|
|
38
38
|
if (Object.prototype.hasOwnProperty.call(r, u)) {
|
|
39
|
-
if (
|
|
39
|
+
if (i.indexOf(u) >= 0) continue;
|
|
40
40
|
d[u] = r[u];
|
|
41
41
|
}
|
|
42
42
|
return d;
|
|
43
43
|
}
|
|
44
44
|
function Q() {
|
|
45
45
|
return Q = Object.assign ? Object.assign.bind() : function(r) {
|
|
46
|
-
for (var
|
|
47
|
-
var d = arguments[
|
|
46
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
47
|
+
var d = arguments[i];
|
|
48
48
|
for (var u in d)
|
|
49
49
|
Object.prototype.hasOwnProperty.call(d, u) && (r[u] = d[u]);
|
|
50
50
|
}
|
|
51
51
|
return r;
|
|
52
52
|
}, Q.apply(this, arguments);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Me(r, i) {
|
|
55
55
|
var d = Object.keys(r);
|
|
56
56
|
if (Object.getOwnPropertySymbols) {
|
|
57
57
|
var u = Object.getOwnPropertySymbols(r);
|
|
58
|
-
|
|
59
|
-
return Object.getOwnPropertyDescriptor(r,
|
|
58
|
+
i && (u = u.filter(function(f) {
|
|
59
|
+
return Object.getOwnPropertyDescriptor(r, f).enumerable;
|
|
60
60
|
})), d.push.apply(d, u);
|
|
61
61
|
}
|
|
62
62
|
return d;
|
|
63
63
|
}
|
|
64
64
|
function J(r) {
|
|
65
|
-
for (var
|
|
66
|
-
var d = arguments[
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) :
|
|
65
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
66
|
+
var d = arguments[i] != null ? arguments[i] : {};
|
|
67
|
+
i % 2 ? Me(Object(d), !0).forEach(function(u) {
|
|
68
|
+
wt(r, u, d[u]);
|
|
69
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) : Me(Object(d)).forEach(function(u) {
|
|
70
70
|
Object.defineProperty(r, u, Object.getOwnPropertyDescriptor(d, u));
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
return r;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
75
|
+
function wt(r, i, d) {
|
|
76
|
+
return i = Ct(i), i in r ? Object.defineProperty(r, i, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : r[i] = d, r;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
var
|
|
80
|
-
return typeof
|
|
78
|
+
function Ct(r) {
|
|
79
|
+
var i = bt(r, "string");
|
|
80
|
+
return typeof i == "symbol" ? i : i + "";
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function bt(r, i) {
|
|
83
83
|
if (typeof r != "object" || !r) return r;
|
|
84
84
|
var d = r[Symbol.toPrimitive];
|
|
85
85
|
if (d !== void 0) {
|
|
86
|
-
var u = d.call(r,
|
|
86
|
+
var u = d.call(r, i);
|
|
87
87
|
if (typeof u != "object") return u;
|
|
88
88
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
89
89
|
}
|
|
90
|
-
return (
|
|
90
|
+
return (i === "string" ? String : Number)(r);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
return r && r.map((
|
|
92
|
+
function Ne(r) {
|
|
93
|
+
return r && r.map((i, d) => /* @__PURE__ */ o.createElement(i.tag, J({
|
|
94
94
|
key: d
|
|
95
|
-
},
|
|
95
|
+
}, i.attr), Ne(i.child)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return (
|
|
97
|
+
function z(r) {
|
|
98
|
+
return (i) => /* @__PURE__ */ o.createElement(Rt, Q({
|
|
99
99
|
attr: J({}, r.attr)
|
|
100
|
-
},
|
|
100
|
+
}, i), Ne(r.child));
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
var
|
|
102
|
+
function Rt(r) {
|
|
103
|
+
var i = (d) => {
|
|
104
104
|
var {
|
|
105
105
|
attr: u,
|
|
106
|
-
size:
|
|
107
|
-
title:
|
|
108
|
-
} = r,
|
|
109
|
-
return d.className && (
|
|
106
|
+
size: f,
|
|
107
|
+
title: w
|
|
108
|
+
} = r, R = yt(r, vt), b = f || d.size || "1em", p;
|
|
109
|
+
return d.className && (p = d.className), r.className && (p = (p ? p + " " : "") + r.className), /* @__PURE__ */ o.createElement("svg", Q({
|
|
110
110
|
stroke: "currentColor",
|
|
111
111
|
fill: "currentColor",
|
|
112
112
|
strokeWidth: "0"
|
|
113
|
-
}, d.attr, u,
|
|
114
|
-
className:
|
|
113
|
+
}, d.attr, u, R, {
|
|
114
|
+
className: p,
|
|
115
115
|
style: J(J({
|
|
116
116
|
color: r.color || d.color
|
|
117
117
|
}, d.style), r.style),
|
|
118
118
|
height: b,
|
|
119
119
|
width: b,
|
|
120
120
|
xmlns: "http://www.w3.org/2000/svg"
|
|
121
|
-
}),
|
|
121
|
+
}), w && /* @__PURE__ */ o.createElement("title", null, w), r.children);
|
|
122
122
|
};
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
function Ct(r) {
|
|
126
|
-
return A({ 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: [] }] })(r);
|
|
127
|
-
}
|
|
128
|
-
function bt(r) {
|
|
129
|
-
return A({ 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: [] }] })(r);
|
|
130
|
-
}
|
|
131
|
-
function Rt(r) {
|
|
132
|
-
return A({ 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: [] }] })(r);
|
|
123
|
+
return Se !== void 0 ? /* @__PURE__ */ o.createElement(Se.Consumer, null, (d) => i(d)) : i(ke);
|
|
133
124
|
}
|
|
134
125
|
function xt(r) {
|
|
135
|
-
return
|
|
126
|
+
return z({ 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: [] }] })(r);
|
|
136
127
|
}
|
|
137
128
|
function Lt(r) {
|
|
138
|
-
return
|
|
129
|
+
return z({ 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: [] }] })(r);
|
|
139
130
|
}
|
|
140
131
|
function St(r) {
|
|
141
|
-
return
|
|
132
|
+
return z({ 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: [] }] })(r);
|
|
142
133
|
}
|
|
143
134
|
function Mt(r) {
|
|
144
|
-
return
|
|
135
|
+
return z({ 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: [] }] })(r);
|
|
145
136
|
}
|
|
146
137
|
function At(r) {
|
|
147
|
-
return
|
|
138
|
+
return z({ 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: [] }] })(r);
|
|
148
139
|
}
|
|
149
140
|
function zt(r) {
|
|
150
|
-
return
|
|
151
|
-
}
|
|
152
|
-
function Nt(r) {
|
|
153
|
-
return A({ 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: [] }] })(r);
|
|
141
|
+
return z({ 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: [] }] })(r);
|
|
154
142
|
}
|
|
155
143
|
function kt(r) {
|
|
156
|
-
return
|
|
144
|
+
return z({ 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: [] }] })(r);
|
|
145
|
+
}
|
|
146
|
+
function Nt(r) {
|
|
147
|
+
return z({ 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: [] }] })(r);
|
|
157
148
|
}
|
|
158
149
|
function Tt(r) {
|
|
159
|
-
return
|
|
150
|
+
return z({ 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: [] }] })(r);
|
|
160
151
|
}
|
|
161
152
|
function Dt(r) {
|
|
162
|
-
return
|
|
153
|
+
return z({ 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: [] }] })(r);
|
|
163
154
|
}
|
|
164
155
|
function Ot(r) {
|
|
165
|
-
return
|
|
156
|
+
return z({ 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: [] }] })(r);
|
|
166
157
|
}
|
|
167
158
|
function Ht(r) {
|
|
168
|
-
return
|
|
159
|
+
return z({ 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: [] }] })(r);
|
|
160
|
+
}
|
|
161
|
+
function _t(r) {
|
|
162
|
+
return z({ 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: [] }] })(r);
|
|
163
|
+
}
|
|
164
|
+
function jt(r) {
|
|
165
|
+
return z({ 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: [] }] })(r);
|
|
169
166
|
}
|
|
170
|
-
|
|
167
|
+
function Ft(r) {
|
|
168
|
+
return z({ 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: [] }] })(r);
|
|
169
|
+
}
|
|
170
|
+
const Pt = [
|
|
171
171
|
"😀",
|
|
172
172
|
"😁",
|
|
173
173
|
"😂",
|
|
@@ -279,57 +279,57 @@ const jt = [
|
|
|
279
279
|
"👏",
|
|
280
280
|
"🫶",
|
|
281
281
|
"👐"
|
|
282
|
-
],
|
|
282
|
+
], It = ({
|
|
283
283
|
exec: r,
|
|
284
|
-
saveSelection:
|
|
284
|
+
saveSelection: i,
|
|
285
285
|
handleFileChange: d,
|
|
286
286
|
handleFontSizeChange: u,
|
|
287
|
-
handleFontFamilyChange:
|
|
287
|
+
handleFontFamilyChange: f,
|
|
288
288
|
// insertListBlock,
|
|
289
|
-
insertEmoji:
|
|
290
|
-
handleLink:
|
|
289
|
+
insertEmoji: w,
|
|
290
|
+
handleLink: R,
|
|
291
291
|
removeFormatting: b,
|
|
292
|
-
visibleActions:
|
|
292
|
+
visibleActions: p,
|
|
293
293
|
className: O,
|
|
294
|
-
style:
|
|
294
|
+
style: j
|
|
295
295
|
}) => {
|
|
296
|
-
var
|
|
297
|
-
const
|
|
296
|
+
var U, D;
|
|
297
|
+
const k = P(null), _ = P(null), L = P(null), [K, W] = A(!1), [q, B] = A({
|
|
298
298
|
x: 0,
|
|
299
299
|
y: 0
|
|
300
300
|
});
|
|
301
|
-
|
|
302
|
-
const
|
|
303
|
-
!
|
|
301
|
+
I(() => {
|
|
302
|
+
const m = (C) => {
|
|
303
|
+
!C.target.closest(".rte-emoji-popup") && !C.target.closest("button[title='Emoji']") && W(!1);
|
|
304
304
|
};
|
|
305
|
-
return document.addEventListener("mousedown",
|
|
305
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
306
306
|
}, []);
|
|
307
|
-
const F = (
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
switch (
|
|
307
|
+
const F = (m) => {
|
|
308
|
+
var H;
|
|
309
|
+
m.preventDefault();
|
|
310
|
+
const C = m.currentTarget.dataset.command;
|
|
311
|
+
if (C)
|
|
312
|
+
switch (C) {
|
|
313
313
|
case "bold":
|
|
314
314
|
case "italic":
|
|
315
315
|
case "underline":
|
|
316
316
|
case "insertUnorderedList":
|
|
317
317
|
case "insertOrderedList":
|
|
318
318
|
case "removeFormat":
|
|
319
|
-
r(
|
|
319
|
+
r(C);
|
|
320
320
|
break;
|
|
321
321
|
case "insertImage": {
|
|
322
|
-
(
|
|
322
|
+
(H = k.current) == null || H.click();
|
|
323
323
|
break;
|
|
324
324
|
}
|
|
325
325
|
default:
|
|
326
|
-
console.warn("Unknown command:",
|
|
326
|
+
console.warn("Unknown command:", C);
|
|
327
327
|
}
|
|
328
|
-
},
|
|
329
|
-
r("foreColor",
|
|
330
|
-
},
|
|
331
|
-
r("backColor",
|
|
332
|
-
}, [
|
|
328
|
+
}, G = (m) => {
|
|
329
|
+
r("foreColor", m.target.value);
|
|
330
|
+
}, ee = (m) => {
|
|
331
|
+
r("backColor", m.target.value);
|
|
332
|
+
}, [M, N] = A({
|
|
333
333
|
bold: !1,
|
|
334
334
|
italic: !1,
|
|
335
335
|
underline: !1,
|
|
@@ -346,9 +346,9 @@ const jt = [
|
|
|
346
346
|
color: !1,
|
|
347
347
|
highlight: !1
|
|
348
348
|
});
|
|
349
|
-
return
|
|
350
|
-
const
|
|
351
|
-
|
|
349
|
+
return I(() => {
|
|
350
|
+
const m = () => {
|
|
351
|
+
N({
|
|
352
352
|
bold: document.queryCommandState("bold"),
|
|
353
353
|
italic: document.queryCommandState("italic"),
|
|
354
354
|
underline: document.queryCommandState("underline"),
|
|
@@ -366,117 +366,117 @@ const jt = [
|
|
|
366
366
|
highlight: document.queryCommandState("backColor")
|
|
367
367
|
});
|
|
368
368
|
};
|
|
369
|
-
return document.addEventListener("selectionchange",
|
|
369
|
+
return document.addEventListener("selectionchange", m), () => document.removeEventListener("selectionchange", m);
|
|
370
370
|
}, []), /* @__PURE__ */ o.createElement("div", {
|
|
371
371
|
className: `rte-toolbar ${O || ""}`,
|
|
372
|
-
style:
|
|
373
|
-
},
|
|
372
|
+
style: j
|
|
373
|
+
}, p.bold && /* @__PURE__ */ o.createElement("button", {
|
|
374
374
|
"data-command": "bold",
|
|
375
375
|
title: "Bold",
|
|
376
376
|
onMouseDown: F,
|
|
377
|
-
className:
|
|
378
|
-
}, /* @__PURE__ */ o.createElement(
|
|
377
|
+
className: M.bold ? "rte-active" : ""
|
|
378
|
+
}, /* @__PURE__ */ o.createElement(zt, null)), p.italic && /* @__PURE__ */ o.createElement("button", {
|
|
379
379
|
"data-command": "italic",
|
|
380
380
|
title: "Italic",
|
|
381
381
|
onMouseDown: F,
|
|
382
|
-
className:
|
|
383
|
-
}, /* @__PURE__ */ o.createElement(
|
|
382
|
+
className: M.italic ? "rte-active" : ""
|
|
383
|
+
}, /* @__PURE__ */ o.createElement(Nt, null)), p.underline && /* @__PURE__ */ o.createElement("button", {
|
|
384
384
|
"data-command": "underline",
|
|
385
385
|
title: "Underline",
|
|
386
386
|
onMouseDown: F,
|
|
387
|
-
className:
|
|
388
|
-
}, /* @__PURE__ */ o.createElement(
|
|
387
|
+
className: M.underline ? "rte-active" : ""
|
|
388
|
+
}, /* @__PURE__ */ o.createElement(_t, null)), p.unorderedList && /* @__PURE__ */ o.createElement("button", {
|
|
389
389
|
"data-command": "insertUnorderedList",
|
|
390
390
|
onMouseDown: F,
|
|
391
391
|
title: "UnorderedList",
|
|
392
|
-
className:
|
|
393
|
-
}, /* @__PURE__ */ o.createElement(
|
|
392
|
+
className: M.unorderedList ? "rte-active" : ""
|
|
393
|
+
}, /* @__PURE__ */ o.createElement(Dt, null)), p.orderedList && /* @__PURE__ */ o.createElement("button", {
|
|
394
394
|
"data-command": "insertOrderedList",
|
|
395
395
|
title: "OrderedList",
|
|
396
396
|
onMouseDown: F,
|
|
397
|
-
className:
|
|
398
|
-
}, /* @__PURE__ */ o.createElement(
|
|
397
|
+
className: M.orderedList ? "rte-active" : ""
|
|
398
|
+
}, /* @__PURE__ */ o.createElement(Mt, null)), p.link && /* @__PURE__ */ o.createElement("button", {
|
|
399
399
|
"data-command": "createLink",
|
|
400
400
|
title: "Link",
|
|
401
|
-
onClick:
|
|
402
|
-
className:
|
|
403
|
-
}, /* @__PURE__ */ o.createElement(
|
|
401
|
+
onClick: R,
|
|
402
|
+
className: M.link ? "rte-active" : ""
|
|
403
|
+
}, /* @__PURE__ */ o.createElement(Tt, null)), p.removeFormat && /* @__PURE__ */ o.createElement("button", {
|
|
404
404
|
"data-command": "Remove format",
|
|
405
405
|
title: "removeFormat",
|
|
406
|
-
onMouseDown: (
|
|
407
|
-
|
|
406
|
+
onMouseDown: (m) => {
|
|
407
|
+
m.preventDefault(), i(), b();
|
|
408
408
|
},
|
|
409
|
-
className:
|
|
410
|
-
}, /* @__PURE__ */ o.createElement(
|
|
409
|
+
className: M.removeFormat ? "rte-active" : ""
|
|
410
|
+
}, /* @__PURE__ */ o.createElement(Ft, null)), p.image && /* @__PURE__ */ o.createElement("button", {
|
|
411
411
|
"data-command": "insertImage",
|
|
412
412
|
title: "Image",
|
|
413
413
|
onMouseDown: F,
|
|
414
|
-
className:
|
|
415
|
-
}, /* @__PURE__ */ o.createElement(
|
|
414
|
+
className: M.image ? "rte-active" : ""
|
|
415
|
+
}, /* @__PURE__ */ o.createElement(St, null)), /* @__PURE__ */ o.createElement("input", {
|
|
416
416
|
type: "file",
|
|
417
417
|
accept: "image/*",
|
|
418
|
-
ref:
|
|
418
|
+
ref: k,
|
|
419
419
|
style: {
|
|
420
420
|
display: "none"
|
|
421
421
|
},
|
|
422
422
|
onChange: d
|
|
423
|
-
}),
|
|
423
|
+
}), p.emoji && /* @__PURE__ */ o.createElement("div", {
|
|
424
424
|
style: {
|
|
425
425
|
position: "relative"
|
|
426
426
|
}
|
|
427
427
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
428
428
|
title: "Emoji",
|
|
429
|
-
onMouseDown: (
|
|
430
|
-
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
x:
|
|
434
|
-
y:
|
|
429
|
+
onMouseDown: (m) => {
|
|
430
|
+
m.preventDefault(), i();
|
|
431
|
+
const C = m.currentTarget.getBoundingClientRect();
|
|
432
|
+
B({
|
|
433
|
+
x: C.left,
|
|
434
|
+
y: C.bottom + 8
|
|
435
435
|
// small spacing
|
|
436
|
-
}),
|
|
436
|
+
}), W((H) => !H);
|
|
437
437
|
},
|
|
438
|
-
className:
|
|
439
|
-
}, /* @__PURE__ */ o.createElement(
|
|
438
|
+
className: M.emoji ? "rte-active" : ""
|
|
439
|
+
}, /* @__PURE__ */ o.createElement(Ot, null)), K && /* @__PURE__ */ pt(/* @__PURE__ */ o.createElement("div", {
|
|
440
440
|
className: "rte-emoji-popup",
|
|
441
441
|
style: {
|
|
442
442
|
top: q.y,
|
|
443
443
|
left: q.x
|
|
444
444
|
}
|
|
445
|
-
},
|
|
446
|
-
key:
|
|
445
|
+
}, Pt.map((m, C) => /* @__PURE__ */ o.createElement("span", {
|
|
446
|
+
key: C,
|
|
447
447
|
style: {
|
|
448
448
|
fontSize: "20px",
|
|
449
449
|
cursor: "pointer",
|
|
450
450
|
textAlign: "center"
|
|
451
451
|
},
|
|
452
|
-
onMouseDown: (
|
|
453
|
-
|
|
452
|
+
onMouseDown: (H) => {
|
|
453
|
+
H.preventDefault(), w(m), W(!1);
|
|
454
454
|
}
|
|
455
|
-
},
|
|
455
|
+
}, m))), document.body)), p.color && /* @__PURE__ */ o.createElement("div", {
|
|
456
456
|
style: {
|
|
457
457
|
position: "relative"
|
|
458
458
|
}
|
|
459
459
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
460
460
|
title: "Text Color",
|
|
461
|
-
onMouseDown: (
|
|
462
|
-
var
|
|
463
|
-
|
|
461
|
+
onMouseDown: (m) => {
|
|
462
|
+
var C;
|
|
463
|
+
m.preventDefault(), i(), (C = _.current) == null || C.click();
|
|
464
464
|
},
|
|
465
465
|
style: {
|
|
466
466
|
display: "flex",
|
|
467
467
|
alignItems: "center",
|
|
468
468
|
justifyContent: "center",
|
|
469
|
-
color: ((
|
|
469
|
+
color: ((U = _.current) == null ? void 0 : U.value) || "#000",
|
|
470
470
|
fontSize: "18px"
|
|
471
471
|
},
|
|
472
|
-
className:
|
|
473
|
-
}, /* @__PURE__ */ o.createElement(
|
|
474
|
-
ref:
|
|
472
|
+
className: M.color ? "rte-active" : ""
|
|
473
|
+
}, /* @__PURE__ */ o.createElement(jt, null)), /* @__PURE__ */ o.createElement("input", {
|
|
474
|
+
ref: _,
|
|
475
475
|
type: "color",
|
|
476
476
|
defaultValue: "#000000",
|
|
477
|
-
onChange: (
|
|
478
|
-
var
|
|
479
|
-
|
|
477
|
+
onChange: (m) => {
|
|
478
|
+
var C;
|
|
479
|
+
G(m), ((C = m.target.parentElement) == null ? void 0 : C.querySelector("button")).style.color = m.target.value;
|
|
480
480
|
},
|
|
481
481
|
style: {
|
|
482
482
|
position: "absolute",
|
|
@@ -485,30 +485,30 @@ const jt = [
|
|
|
485
485
|
height: 0,
|
|
486
486
|
pointerEvents: "none"
|
|
487
487
|
}
|
|
488
|
-
})),
|
|
488
|
+
})), p.highlight && /* @__PURE__ */ o.createElement("div", {
|
|
489
489
|
style: {
|
|
490
490
|
position: "relative"
|
|
491
491
|
}
|
|
492
492
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
493
493
|
title: "Highlight",
|
|
494
|
-
onMouseDown: (
|
|
495
|
-
var
|
|
496
|
-
|
|
494
|
+
onMouseDown: (m) => {
|
|
495
|
+
var C;
|
|
496
|
+
m.preventDefault(), i(), (C = L.current) == null || C.click();
|
|
497
497
|
},
|
|
498
498
|
style: {
|
|
499
499
|
display: "flex",
|
|
500
500
|
alignItems: "center",
|
|
501
501
|
justifyContent: "center",
|
|
502
|
-
color: ((
|
|
502
|
+
color: ((D = L.current) == null ? void 0 : D.value) || "#000",
|
|
503
503
|
fontSize: "18px"
|
|
504
504
|
},
|
|
505
|
-
className:
|
|
506
|
-
}, /* @__PURE__ */ o.createElement(
|
|
507
|
-
ref:
|
|
505
|
+
className: M.highlight ? "rte-active" : ""
|
|
506
|
+
}, /* @__PURE__ */ o.createElement(kt, null)), /* @__PURE__ */ o.createElement("input", {
|
|
507
|
+
ref: L,
|
|
508
508
|
type: "color",
|
|
509
|
-
onChange: (
|
|
510
|
-
var
|
|
511
|
-
|
|
509
|
+
onChange: (m) => {
|
|
510
|
+
var C;
|
|
511
|
+
ee(m), ((C = m.target.parentElement) == null ? void 0 : C.querySelector("button")).style.color = m.target.value;
|
|
512
512
|
},
|
|
513
513
|
defaultValue: "#000000",
|
|
514
514
|
style: {
|
|
@@ -518,31 +518,31 @@ const jt = [
|
|
|
518
518
|
height: 0,
|
|
519
519
|
pointerEvents: "none"
|
|
520
520
|
}
|
|
521
|
-
})),
|
|
521
|
+
})), p.align && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("button", {
|
|
522
522
|
title: "Align Left",
|
|
523
|
-
onMouseDown: (
|
|
523
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
524
524
|
onClick: () => r("justifyLeft"),
|
|
525
|
-
className:
|
|
526
|
-
}, /* @__PURE__ */ o.createElement(
|
|
525
|
+
className: M.alignLeft ? "rte-active" : ""
|
|
526
|
+
}, /* @__PURE__ */ o.createElement(At, null)), /* @__PURE__ */ o.createElement("button", {
|
|
527
527
|
title: "Align Center",
|
|
528
|
-
onMouseDown: (
|
|
528
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
529
529
|
onClick: () => r("justifyCenter"),
|
|
530
|
-
className:
|
|
531
|
-
}, /* @__PURE__ */ o.createElement(
|
|
530
|
+
className: M.alignCenter ? "rte-active" : ""
|
|
531
|
+
}, /* @__PURE__ */ o.createElement(xt, null)), /* @__PURE__ */ o.createElement("button", {
|
|
532
532
|
title: "Align Right",
|
|
533
|
-
onMouseDown: (
|
|
533
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
534
534
|
onClick: () => r("justifyRight"),
|
|
535
|
-
className:
|
|
536
|
-
}, /* @__PURE__ */ o.createElement(
|
|
535
|
+
className: M.alignRight ? "rte-active" : ""
|
|
536
|
+
}, /* @__PURE__ */ o.createElement(Lt, null))), p.table && /* @__PURE__ */ o.createElement("button", {
|
|
537
537
|
title: "Insert Table",
|
|
538
|
-
onMouseDown: (
|
|
538
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
539
539
|
onClick: () => r("insertTable"),
|
|
540
|
-
className:
|
|
541
|
-
}, /* @__PURE__ */ o.createElement(
|
|
540
|
+
className: M.table ? "rte-active" : ""
|
|
541
|
+
}, /* @__PURE__ */ o.createElement(Ht, null)), p.fontFamily && /* @__PURE__ */ o.createElement("select", {
|
|
542
542
|
className: "rte-dropdown",
|
|
543
543
|
defaultValue: "",
|
|
544
|
-
onMouseDown: () =>
|
|
545
|
-
onChange:
|
|
544
|
+
onMouseDown: () => i(),
|
|
545
|
+
onChange: f
|
|
546
546
|
}, /* @__PURE__ */ o.createElement("option", {
|
|
547
547
|
value: "",
|
|
548
548
|
disabled: !0
|
|
@@ -556,62 +556,59 @@ const jt = [
|
|
|
556
556
|
value: "Courier New"
|
|
557
557
|
}, "Courier New"), /* @__PURE__ */ o.createElement("option", {
|
|
558
558
|
value: "Verdana"
|
|
559
|
-
}, "Verdana")),
|
|
560
|
-
className: "rte-dropdown",
|
|
559
|
+
}, "Verdana")), p.fontSize && /* @__PURE__ */ o.createElement("select", {
|
|
560
|
+
className: "rte-dropdown rte-fontsize-dropdown",
|
|
561
561
|
defaultValue: "",
|
|
562
|
-
onMouseDown: () =>
|
|
562
|
+
onMouseDown: () => i(),
|
|
563
563
|
onChange: u
|
|
564
564
|
}, /* @__PURE__ */ o.createElement("option", {
|
|
565
565
|
value: "",
|
|
566
566
|
disabled: !0
|
|
567
|
-
}, "Font Size"),
|
|
568
|
-
|
|
569
|
-
},
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
value: "5"
|
|
575
|
-
}, "Large")));
|
|
576
|
-
}, Ft = ({
|
|
567
|
+
}, "Font Size"), Array.from({
|
|
568
|
+
length: 16
|
|
569
|
+
}, (m, C) => 10 + C).map((m) => /* @__PURE__ */ o.createElement("option", {
|
|
570
|
+
key: m,
|
|
571
|
+
value: m
|
|
572
|
+
}, m, "px"))));
|
|
573
|
+
}, Bt = ({
|
|
577
574
|
show: r,
|
|
578
|
-
position:
|
|
575
|
+
position: i,
|
|
579
576
|
filtered: d,
|
|
580
577
|
insertMention: u,
|
|
581
|
-
onClose:
|
|
582
|
-
query:
|
|
578
|
+
onClose: f,
|
|
579
|
+
query: w
|
|
583
580
|
}) => {
|
|
584
|
-
const
|
|
585
|
-
return
|
|
586
|
-
const b = (
|
|
587
|
-
|
|
581
|
+
const R = P(null);
|
|
582
|
+
return I(() => {
|
|
583
|
+
const b = (p) => {
|
|
584
|
+
R.current && !R.current.contains(p.target) && f();
|
|
588
585
|
};
|
|
589
586
|
return r && document.addEventListener("mousedown", b), () => {
|
|
590
587
|
document.removeEventListener("mousedown", b);
|
|
591
588
|
};
|
|
592
|
-
}, [r,
|
|
593
|
-
ref:
|
|
589
|
+
}, [r, f]), r ? /* @__PURE__ */ o.createElement("ul", {
|
|
590
|
+
ref: R,
|
|
594
591
|
className: "rte-popup",
|
|
595
592
|
style: {
|
|
596
|
-
top:
|
|
597
|
-
left:
|
|
593
|
+
top: i.y,
|
|
594
|
+
left: i.x
|
|
598
595
|
}
|
|
599
596
|
}, d.length > 0 ? d.map(({
|
|
600
597
|
name: b,
|
|
601
|
-
value:
|
|
598
|
+
value: p
|
|
602
599
|
}) => {
|
|
603
|
-
const O = b.toLowerCase(),
|
|
604
|
-
let
|
|
605
|
-
if (
|
|
606
|
-
const
|
|
607
|
-
|
|
600
|
+
const O = b.toLowerCase(), j = w.toLowerCase(), k = O.indexOf(j);
|
|
601
|
+
let _ = b;
|
|
602
|
+
if (k !== -1 && w.length > 0) {
|
|
603
|
+
const L = k + w.length;
|
|
604
|
+
_ = b.substring(0, k) + `<span class="rte-highlight">${b.substring(k, L)}</span>` + b.substring(L);
|
|
608
605
|
}
|
|
609
606
|
return /* @__PURE__ */ o.createElement("li", {
|
|
610
|
-
key:
|
|
611
|
-
onMouseDown: (
|
|
612
|
-
|
|
607
|
+
key: p,
|
|
608
|
+
onMouseDown: (L) => {
|
|
609
|
+
L.preventDefault(), u({
|
|
613
610
|
name: b,
|
|
614
|
-
value:
|
|
611
|
+
value: p
|
|
615
612
|
});
|
|
616
613
|
},
|
|
617
614
|
style: {
|
|
@@ -620,10 +617,10 @@ const jt = [
|
|
|
620
617
|
fontSize: "14px"
|
|
621
618
|
},
|
|
622
619
|
dangerouslySetInnerHTML: {
|
|
623
|
-
__html:
|
|
620
|
+
__html: _
|
|
624
621
|
},
|
|
625
|
-
onMouseEnter: (
|
|
626
|
-
onMouseLeave: (
|
|
622
|
+
onMouseEnter: (L) => L.currentTarget.style.background = "#f0f0f0",
|
|
623
|
+
onMouseLeave: (L) => L.currentTarget.style.background = "#fff"
|
|
627
624
|
});
|
|
628
625
|
}) : /* @__PURE__ */ o.createElement("li", {
|
|
629
626
|
style: {
|
|
@@ -632,28 +629,28 @@ const jt = [
|
|
|
632
629
|
}
|
|
633
630
|
}, "No matches")) : null;
|
|
634
631
|
};
|
|
635
|
-
function
|
|
636
|
-
return
|
|
632
|
+
function Ae(r) {
|
|
633
|
+
return z({ 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: [] }] }] }] })(r);
|
|
637
634
|
}
|
|
638
635
|
function Z(r) {
|
|
639
|
-
return
|
|
636
|
+
return z({ 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: [] }] }] }] })(r);
|
|
640
637
|
}
|
|
641
|
-
const
|
|
638
|
+
const qt = ({
|
|
642
639
|
visible: r,
|
|
643
|
-
x:
|
|
640
|
+
x: i,
|
|
644
641
|
y: d,
|
|
645
642
|
onAction: u,
|
|
646
|
-
onClose:
|
|
643
|
+
onClose: f
|
|
647
644
|
}) => {
|
|
648
645
|
if (!r) return null;
|
|
649
|
-
const
|
|
646
|
+
const w = {
|
|
650
647
|
top: d,
|
|
651
|
-
left:
|
|
648
|
+
left: i
|
|
652
649
|
};
|
|
653
650
|
return /* @__PURE__ */ o.createElement("div", {
|
|
654
|
-
style:
|
|
651
|
+
style: w,
|
|
655
652
|
className: "rte-table-menu",
|
|
656
|
-
onMouseLeave:
|
|
653
|
+
onMouseLeave: f
|
|
657
654
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
658
655
|
onClick: () => u("insertRowAbove")
|
|
659
656
|
}, /* @__PURE__ */ o.createElement(Z, null), " Insert row above"), /* @__PURE__ */ o.createElement("button", {
|
|
@@ -664,46 +661,49 @@ const Pt = ({
|
|
|
664
661
|
onClick: () => u("insertColRight")
|
|
665
662
|
}, /* @__PURE__ */ o.createElement(Z, null), " Insert col right"), /* @__PURE__ */ o.createElement("button", {
|
|
666
663
|
onClick: () => u("deleteRow")
|
|
667
|
-
}, /* @__PURE__ */ o.createElement(
|
|
664
|
+
}, /* @__PURE__ */ o.createElement(Ae, null), " Delete row"), /* @__PURE__ */ o.createElement("button", {
|
|
668
665
|
onClick: () => u("deleteCol")
|
|
669
|
-
}, /* @__PURE__ */ o.createElement(
|
|
670
|
-
},
|
|
666
|
+
}, /* @__PURE__ */ o.createElement(Ae, null), " Delete column"));
|
|
667
|
+
}, Ut = ({
|
|
671
668
|
html: r,
|
|
672
|
-
className:
|
|
669
|
+
className: i,
|
|
673
670
|
style: d
|
|
674
671
|
}) => {
|
|
675
|
-
const u = (
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
const b =
|
|
672
|
+
const u = (w) => {
|
|
673
|
+
const R = w.target;
|
|
674
|
+
if (R.tagName === "A") {
|
|
675
|
+
w.preventDefault();
|
|
676
|
+
const b = R.href;
|
|
680
677
|
b && window.open(b, "_blank", "noopener,noreferrer");
|
|
681
678
|
}
|
|
682
|
-
},
|
|
679
|
+
}, f = (w) => {
|
|
680
|
+
let R = w.replace(/{{\s*(.*?)\s*}}/g, (b, p) => `<span style="color: blue">${p}</span>`);
|
|
681
|
+
return R = R.replace(/#arrayData/g, ""), R = R.replace(/\/arrayData/g, ""), R;
|
|
682
|
+
};
|
|
683
683
|
return /* @__PURE__ */ o.createElement("div", {
|
|
684
|
-
className: `rte-preview ${
|
|
684
|
+
className: `rte-preview ${i || ""}`,
|
|
685
685
|
style: d,
|
|
686
686
|
onClick: u,
|
|
687
687
|
dangerouslySetInnerHTML: {
|
|
688
|
-
__html:
|
|
688
|
+
__html: f(r)
|
|
689
689
|
}
|
|
690
690
|
});
|
|
691
|
-
},
|
|
691
|
+
}, Vt = ({
|
|
692
692
|
visible: r,
|
|
693
|
-
linkData:
|
|
693
|
+
linkData: i,
|
|
694
694
|
onClose: d,
|
|
695
695
|
onInsert: u
|
|
696
696
|
}) => {
|
|
697
|
-
const [
|
|
698
|
-
if (
|
|
699
|
-
r ? (
|
|
700
|
-
}, [r,
|
|
701
|
-
const
|
|
697
|
+
const [f, w] = A(""), [R, b] = A(""), [p, O] = A(""), [j, k] = A("_self");
|
|
698
|
+
if (I(() => {
|
|
699
|
+
r ? (w(i.url || ""), b(i.text || ""), O(i.title || ""), k(i.target || "_self")) : (w(""), b(""), O(""), k("_self"));
|
|
700
|
+
}, [r, i]), !r) return null;
|
|
701
|
+
const _ = () => {
|
|
702
702
|
u({
|
|
703
|
-
url:
|
|
704
|
-
text:
|
|
705
|
-
title:
|
|
706
|
-
target:
|
|
703
|
+
url: f,
|
|
704
|
+
text: R,
|
|
705
|
+
title: p,
|
|
706
|
+
target: j
|
|
707
707
|
});
|
|
708
708
|
};
|
|
709
709
|
return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
|
|
@@ -713,28 +713,28 @@ const Pt = ({
|
|
|
713
713
|
className: "rte-link-modal"
|
|
714
714
|
}, /* @__PURE__ */ o.createElement("h4", {
|
|
715
715
|
className: "rte-link-modal__title"
|
|
716
|
-
},
|
|
716
|
+
}, f ? "Edit Link" : "Insert Link"), /* @__PURE__ */ o.createElement("input", {
|
|
717
717
|
type: "text",
|
|
718
718
|
className: "rte-link-modal__input",
|
|
719
719
|
placeholder: "URL",
|
|
720
|
-
value:
|
|
721
|
-
onChange: (
|
|
720
|
+
value: f,
|
|
721
|
+
onChange: (L) => w(L.target.value)
|
|
722
722
|
}), /* @__PURE__ */ o.createElement("input", {
|
|
723
723
|
type: "text",
|
|
724
724
|
className: "rte-link-modal__input",
|
|
725
725
|
placeholder: "Text to Display",
|
|
726
|
-
value:
|
|
727
|
-
onChange: (
|
|
726
|
+
value: R,
|
|
727
|
+
onChange: (L) => b(L.target.value)
|
|
728
728
|
}), /* @__PURE__ */ o.createElement("input", {
|
|
729
729
|
type: "text",
|
|
730
730
|
className: "rte-link-modal__input",
|
|
731
731
|
placeholder: "Title",
|
|
732
|
-
value:
|
|
733
|
-
onChange: (
|
|
732
|
+
value: p,
|
|
733
|
+
onChange: (L) => O(L.target.value)
|
|
734
734
|
}), /* @__PURE__ */ o.createElement("select", {
|
|
735
735
|
className: "rte-link-modal__select",
|
|
736
|
-
value:
|
|
737
|
-
onChange: (
|
|
736
|
+
value: j,
|
|
737
|
+
onChange: (L) => k(L.target.value)
|
|
738
738
|
}, /* @__PURE__ */ o.createElement("option", {
|
|
739
739
|
value: "_self"
|
|
740
740
|
}, "Same tab"), /* @__PURE__ */ o.createElement("option", {
|
|
@@ -746,15 +746,15 @@ const Pt = ({
|
|
|
746
746
|
onClick: d
|
|
747
747
|
}, "Cancel"), /* @__PURE__ */ o.createElement("button", {
|
|
748
748
|
className: "rte-link-modal__btn rte-link-modal__btn--ok",
|
|
749
|
-
onClick:
|
|
749
|
+
onClick: _
|
|
750
750
|
}, "OK"))));
|
|
751
751
|
};
|
|
752
|
-
function
|
|
753
|
-
return Array.from(new Map(r.map((
|
|
752
|
+
function ze(r) {
|
|
753
|
+
return Array.from(new Map(r.map((i) => [i.value, i])).values());
|
|
754
754
|
}
|
|
755
|
-
const
|
|
755
|
+
const Xt = ({
|
|
756
756
|
atSuggestions: r = [],
|
|
757
|
-
showOutput:
|
|
757
|
+
showOutput: i = !1,
|
|
758
758
|
showPreview: d = !1,
|
|
759
759
|
toolbarConfig: u = {
|
|
760
760
|
link: !1,
|
|
@@ -766,32 +766,32 @@ const $t = ({
|
|
|
766
766
|
fontSize: !1,
|
|
767
767
|
highlight: !1
|
|
768
768
|
},
|
|
769
|
-
classNames:
|
|
770
|
-
styles:
|
|
771
|
-
handleGetHtml:
|
|
769
|
+
classNames: f = {},
|
|
770
|
+
styles: w = {},
|
|
771
|
+
handleGetHtml: R = () => {
|
|
772
772
|
},
|
|
773
773
|
onChange: b = () => {
|
|
774
774
|
},
|
|
775
|
-
value:
|
|
775
|
+
value: p,
|
|
776
776
|
onMentionSelect: O = () => {
|
|
777
777
|
},
|
|
778
|
-
handleAddAttributes:
|
|
778
|
+
handleAddAttributes: j = () => {
|
|
779
779
|
}
|
|
780
780
|
}) => {
|
|
781
|
-
var pe, ve,
|
|
782
|
-
const
|
|
781
|
+
var he, pe, ve, ye, Ee, we, Ce, be;
|
|
782
|
+
const k = P(null), [_, L] = A(p != null && p.length ? p : " "), [K, W] = A(""), [q, B] = A(!1), [F, G] = A({
|
|
783
783
|
x: 0,
|
|
784
784
|
y: 0
|
|
785
|
-
}), [
|
|
785
|
+
}), [ee, M] = A([]), N = P(null), U = P(null), [D, m] = A({
|
|
786
786
|
visible: !1,
|
|
787
787
|
x: 0,
|
|
788
788
|
y: 0
|
|
789
|
-
}), [
|
|
789
|
+
}), [C, H] = A(!1), X = P(null), [Te, le] = A({
|
|
790
790
|
url: "",
|
|
791
791
|
text: "",
|
|
792
792
|
title: "",
|
|
793
793
|
target: "_self"
|
|
794
|
-
}),
|
|
794
|
+
}), De = {
|
|
795
795
|
bold: !0,
|
|
796
796
|
italic: !0,
|
|
797
797
|
underline: !0,
|
|
@@ -799,46 +799,58 @@ const $t = ({
|
|
|
799
799
|
unorderedList: !0,
|
|
800
800
|
orderedList: !0,
|
|
801
801
|
align: !0,
|
|
802
|
-
link: (
|
|
803
|
-
image: (
|
|
804
|
-
emoji: (
|
|
802
|
+
link: (he = u.link) != null ? he : !1,
|
|
803
|
+
image: (pe = u.image) != null ? pe : !1,
|
|
804
|
+
emoji: (ve = u.emoji) != null ? ve : !1,
|
|
805
805
|
table: (ye = u.table) != null ? ye : !1,
|
|
806
|
-
color: (
|
|
807
|
-
fontFamily: (
|
|
808
|
-
fontSize: (
|
|
809
|
-
highlight: (
|
|
810
|
-
}, [
|
|
811
|
-
const e =
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
806
|
+
color: (Ee = u.color) != null ? Ee : !1,
|
|
807
|
+
fontFamily: (we = u.fontFamily) != null ? we : !1,
|
|
808
|
+
fontSize: (Ce = u.fontSize) != null ? Ce : !1,
|
|
809
|
+
highlight: (be = u.fontSize) != null ? be : !1
|
|
810
|
+
}, [Oe, ce] = A(""), [ie, te] = A([]), T = () => k.current, S = () => {
|
|
811
|
+
const e = He(), t = /^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());
|
|
812
|
+
let n = e;
|
|
813
|
+
t || (n = `<div style="font-size:12px">${e}</div>`), W(n), R == null || R(n);
|
|
814
|
+
const a = ot(e);
|
|
815
|
+
b(a);
|
|
816
|
+
const s = $e(), l = ze(s);
|
|
817
|
+
JSON.stringify(l) !== JSON.stringify(ie) && (te(l), O(l));
|
|
818
|
+
}, He = () => {
|
|
819
|
+
const e = T();
|
|
820
|
+
if (!e) return _;
|
|
821
|
+
const t = e.cloneNode(!0);
|
|
822
|
+
t.querySelectorAll("table div").forEach((a) => a.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight"));
|
|
823
|
+
let n = t.innerHTML;
|
|
824
|
+
return n = _e(n), n;
|
|
825
|
+
}, _e = (e) => e.replace(/<tbody[^>]*>/g, "<tbody>{{#arrayData}}").replace(/<\/tbody>/g, "{{/arrayData}}</tbody>"), V = () => {
|
|
818
826
|
const e = window.getSelection();
|
|
819
827
|
if (!e || e.rangeCount === 0) return;
|
|
820
828
|
const t = document.getElementById("rte-editor-body");
|
|
821
829
|
if (!t) return;
|
|
822
830
|
const n = e.getRangeAt(0);
|
|
823
|
-
t.contains(n.startContainer) && (
|
|
824
|
-
},
|
|
831
|
+
t.contains(n.startContainer) && (N.current = n.cloneRange());
|
|
832
|
+
}, $ = () => {
|
|
825
833
|
const e = window.getSelection();
|
|
826
|
-
!e || !
|
|
834
|
+
!e || !N.current || (e.removeAllRanges(), e.addRange(N.current));
|
|
827
835
|
}, se = (e, t) => {
|
|
828
836
|
const n = window.getSelection();
|
|
829
|
-
n && n.rangeCount > 0 && (
|
|
837
|
+
n && n.rangeCount > 0 && (N.current = n.getRangeAt(0)), $(), document.execCommand(e, !1, t), S();
|
|
830
838
|
};
|
|
831
|
-
|
|
832
|
-
const e =
|
|
833
|
-
|
|
834
|
-
|
|
839
|
+
I(() => {
|
|
840
|
+
const e = T();
|
|
841
|
+
if (!e || !p) return;
|
|
842
|
+
const t = je(p);
|
|
843
|
+
e.innerHTML = t, S();
|
|
844
|
+
}, []);
|
|
845
|
+
const je = (e) => e.replace(/<span[^>]*data-hidden-table-start[^>]*>.*?<\/span>/g, "").replace(/<span[^>]*data-hidden-table-end[^>]*>.*?<\/span>/g, "").replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, "");
|
|
846
|
+
I(() => () => {
|
|
835
847
|
document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
|
|
836
|
-
}, []),
|
|
837
|
-
|
|
838
|
-
|
|
848
|
+
}, []), I(() => {
|
|
849
|
+
j && j((e) => {
|
|
850
|
+
Ve(e);
|
|
839
851
|
});
|
|
840
|
-
}, []),
|
|
841
|
-
const e =
|
|
852
|
+
}, []), I(() => {
|
|
853
|
+
const e = T();
|
|
842
854
|
if (!e) return;
|
|
843
855
|
e.querySelectorAll("table").forEach((n) => {
|
|
844
856
|
ge(n), n.querySelectorAll("th, td").forEach((s) => Y(s));
|
|
@@ -848,18 +860,18 @@ const $t = ({
|
|
|
848
860
|
for (; e && e.nodeName !== "LI"; )
|
|
849
861
|
e = e.parentNode;
|
|
850
862
|
return e;
|
|
851
|
-
},
|
|
863
|
+
}, Fe = (e) => {
|
|
852
864
|
let t = 0, n = e.parentElement;
|
|
853
865
|
for (; n; )
|
|
854
866
|
(n.tagName === "UL" || n.tagName === "OL") && t++, n = n.parentElement;
|
|
855
867
|
return t;
|
|
856
|
-
},
|
|
857
|
-
const t = e.querySelector("li"), n = t ?
|
|
868
|
+
}, Pe = (e) => {
|
|
869
|
+
const t = e.querySelector("li"), n = t ? Fe(t) : 1;
|
|
858
870
|
if (e.querySelector("[data-hidden-array-start]")) return;
|
|
859
871
|
const a = `{{#arrayData${n > 1 ? n : ""}}}`, s = `{{/arrayData${n > 1 ? n : ""}}}`, l = document.createElement("span");
|
|
860
872
|
l.textContent = a, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
|
|
861
|
-
const
|
|
862
|
-
|
|
873
|
+
const c = document.createElement("span");
|
|
874
|
+
c.textContent = s, c.style.display = "none", c.setAttribute("data-hidden-array-end", "true"), e.appendChild(c);
|
|
863
875
|
}, ue = (e) => {
|
|
864
876
|
var v;
|
|
865
877
|
const t = window.getSelection();
|
|
@@ -867,28 +879,28 @@ const $t = ({
|
|
|
867
879
|
const n = t.getRangeAt(0), a = de(n.startContainer);
|
|
868
880
|
let s, l;
|
|
869
881
|
if (a) {
|
|
870
|
-
let
|
|
871
|
-
|
|
882
|
+
let h = a.querySelector(e);
|
|
883
|
+
h || (h = document.createElement(e), h.style.margin = "0", h.style.paddingLeft = "20px", a.appendChild(h)), l = h, s = document.createElement("li"), s.textContent = "", l.appendChild(s);
|
|
872
884
|
} else {
|
|
873
885
|
document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
|
|
874
|
-
const
|
|
875
|
-
if (l =
|
|
886
|
+
const h = T();
|
|
887
|
+
if (l = h == null ? void 0 : h.querySelector(`${e}:last-child`), !l) return;
|
|
876
888
|
s = l.querySelector("li:last-child");
|
|
877
889
|
}
|
|
878
|
-
|
|
879
|
-
const
|
|
880
|
-
|
|
881
|
-
},
|
|
882
|
-
e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : e.startsWith("justify") ?
|
|
883
|
-
},
|
|
890
|
+
Pe(l);
|
|
891
|
+
const c = document.createRange();
|
|
892
|
+
c.setStart(s, 0), c.collapse(!0), t.removeAllRanges(), t.addRange(c), (v = T()) == null || v.focus(), S();
|
|
893
|
+
}, ne = (e, t) => {
|
|
894
|
+
e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : e.startsWith("justify") ? ct(e) : se(e, t), e === "insertTable" && Qe();
|
|
895
|
+
}, Ie = (e) => {
|
|
884
896
|
const t = document.createElement("span");
|
|
885
897
|
t.textContent = "", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
|
|
886
898
|
const n = t.getBoundingClientRect();
|
|
887
|
-
t.remove(),
|
|
899
|
+
t.remove(), G({
|
|
888
900
|
x: n.left,
|
|
889
901
|
y: n.bottom + window.scrollY
|
|
890
|
-
}),
|
|
891
|
-
},
|
|
902
|
+
}), M(r || []), B(!0), U.current = e.cloneRange();
|
|
903
|
+
}, Be = () => {
|
|
892
904
|
const e = window.getSelection();
|
|
893
905
|
if (!e || e.rangeCount === 0) return null;
|
|
894
906
|
const t = e.anchorNode;
|
|
@@ -897,106 +909,106 @@ const $t = ({
|
|
|
897
909
|
let a = t;
|
|
898
910
|
for (a.nodeType !== Node.TEXT_NODE && (a.childNodes && a.childNodes[n] ? a = a.childNodes[n] : a = t.previousSibling); a; ) {
|
|
899
911
|
if (a.nodeType === Node.TEXT_NODE) {
|
|
900
|
-
const s = a.textContent || "", l = a === t ? n : s.length,
|
|
901
|
-
if (
|
|
912
|
+
const s = a.textContent || "", l = a === t ? n : s.length, c = s.lastIndexOf("@", l - 1);
|
|
913
|
+
if (c !== -1) {
|
|
902
914
|
const v = document.createRange();
|
|
903
|
-
return v.setStart(a,
|
|
915
|
+
return v.setStart(a, c), v.setEnd(a, l), v;
|
|
904
916
|
}
|
|
905
917
|
}
|
|
906
918
|
a = a.previousSibling;
|
|
907
919
|
}
|
|
908
920
|
return null;
|
|
909
|
-
},
|
|
921
|
+
}, qe = (e) => {
|
|
910
922
|
var l;
|
|
911
923
|
const t = window.getSelection();
|
|
912
924
|
if (!t) return;
|
|
913
|
-
const n =
|
|
914
|
-
n ? (t.removeAllRanges(), t.addRange(n)) :
|
|
925
|
+
const n = Be();
|
|
926
|
+
n ? (t.removeAllRanges(), t.addRange(n)) : U.current && (t.removeAllRanges(), t.addRange(U.current));
|
|
915
927
|
const a = document.createElement("span");
|
|
916
|
-
a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.
|
|
928
|
+
a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.setAttribute("data-mention", e.value || e.name || "");
|
|
917
929
|
try {
|
|
918
|
-
const
|
|
919
|
-
if (
|
|
920
|
-
|
|
930
|
+
const c = t.rangeCount ? t.getRangeAt(0) : null;
|
|
931
|
+
if (c)
|
|
932
|
+
c.deleteContents(), c.insertNode(a);
|
|
921
933
|
else {
|
|
922
|
-
const
|
|
923
|
-
|
|
934
|
+
const E = document.createRange(), g = T();
|
|
935
|
+
E.selectNodeContents(g), E.collapse(!1), E.insertNode(a);
|
|
924
936
|
}
|
|
925
937
|
const v = document.createTextNode(" ");
|
|
926
938
|
a.after(v);
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
} catch (
|
|
930
|
-
console.error("insertMention error:",
|
|
939
|
+
const h = document.createRange();
|
|
940
|
+
h.setStartAfter(v), h.collapse(!0), t.removeAllRanges(), t.addRange(h);
|
|
941
|
+
} catch (c) {
|
|
942
|
+
console.error("insertMention error:", c);
|
|
931
943
|
}
|
|
932
|
-
let s =
|
|
933
|
-
|
|
934
|
-
},
|
|
935
|
-
const t =
|
|
944
|
+
let s = ze([...ie, e]);
|
|
945
|
+
te(s), O(s), B(!1), (l = T()) == null || l.focus(), S();
|
|
946
|
+
}, Ue = (e) => {
|
|
947
|
+
const t = T();
|
|
936
948
|
if (!t) return;
|
|
937
949
|
let n = null;
|
|
938
|
-
|
|
950
|
+
N.current && t.contains(N.current.startContainer) ? n = N.current.cloneRange() : (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1));
|
|
939
951
|
const a = window.getSelection();
|
|
940
952
|
if (!a) return;
|
|
941
953
|
a.removeAllRanges(), a.addRange(n);
|
|
942
954
|
const s = document.createElement("span");
|
|
943
|
-
s.textContent = `{{${e.name}}}`, s.style.display = "inline", s.
|
|
955
|
+
s.textContent = `{{${e.name}}}`, s.style.display = "inline", s.setAttribute("data-mention", e.value || e.name), n.insertNode(s);
|
|
944
956
|
const l = document.createTextNode(" ");
|
|
945
957
|
s.after(l);
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
},
|
|
949
|
-
e.forEach((t) =>
|
|
958
|
+
const c = document.createRange();
|
|
959
|
+
c.setStartAfter(l), c.collapse(!0), a.removeAllRanges(), a.addRange(c), N.current = c.cloneRange(), t.focus();
|
|
960
|
+
}, Ve = (e) => {
|
|
961
|
+
e.forEach((t) => Ue(t)), te((t) => {
|
|
950
962
|
const n = [...t, ...e], a = Array.from(new Map(n.map((s) => [s.name, s])).values());
|
|
951
963
|
return O(a), a;
|
|
952
|
-
}),
|
|
953
|
-
},
|
|
954
|
-
const e =
|
|
964
|
+
}), S();
|
|
965
|
+
}, $e = () => {
|
|
966
|
+
const e = T();
|
|
955
967
|
if (!e) return [];
|
|
956
968
|
const t = e.querySelectorAll("span[data-mention]"), n = [];
|
|
957
969
|
return t.forEach((a) => {
|
|
958
|
-
const s = a.getAttribute("data-mention") || "",
|
|
959
|
-
|
|
960
|
-
name:
|
|
970
|
+
const s = a.getAttribute("data-mention") || "", c = (a.textContent || "").match(/{{(.+?)}}/);
|
|
971
|
+
c && n.push({
|
|
972
|
+
name: c[1],
|
|
961
973
|
value: s
|
|
962
974
|
});
|
|
963
975
|
}), n;
|
|
964
|
-
},
|
|
976
|
+
}, We = (e) => {
|
|
965
977
|
var n, a, s;
|
|
966
978
|
const t = e.key.toLowerCase();
|
|
967
|
-
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(),
|
|
968
|
-
const l = window.getSelection(),
|
|
969
|
-
if (!
|
|
970
|
-
if (((n =
|
|
979
|
+
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), ne(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
|
|
980
|
+
const l = window.getSelection(), c = l != null && l.anchorNode ? de(l.anchorNode) : null;
|
|
981
|
+
if (!c) return;
|
|
982
|
+
if (((n = c.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
|
|
971
983
|
e.preventDefault();
|
|
972
|
-
const
|
|
973
|
-
if (
|
|
974
|
-
|
|
975
|
-
const
|
|
976
|
-
|
|
977
|
-
const
|
|
978
|
-
|
|
984
|
+
const h = c.parentElement, E = h == null ? void 0 : h.closest("li");
|
|
985
|
+
if (E) {
|
|
986
|
+
h == null || h.removeChild(c);
|
|
987
|
+
const g = document.createElement("p");
|
|
988
|
+
g.innerHTML = "<br />", (a = E.parentElement) == null || a.insertBefore(g, E.nextSibling);
|
|
989
|
+
const y = document.createRange();
|
|
990
|
+
y.setStart(g, 0), y.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(y);
|
|
979
991
|
} else {
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
const
|
|
985
|
-
|
|
992
|
+
const g = c.closest("ul, ol");
|
|
993
|
+
if (g) {
|
|
994
|
+
const y = document.createElement("p");
|
|
995
|
+
y.innerHTML = "<br />", (s = g.parentElement) == null || s.insertBefore(y, g.nextSibling), g.removeChild(c);
|
|
996
|
+
const x = document.createRange();
|
|
997
|
+
x.setStart(y, 0), x.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(x);
|
|
986
998
|
}
|
|
987
999
|
}
|
|
988
|
-
|
|
1000
|
+
S();
|
|
989
1001
|
}
|
|
990
1002
|
}
|
|
991
|
-
},
|
|
1003
|
+
}, Ke = (e) => {
|
|
992
1004
|
if (e.data === "@") {
|
|
993
1005
|
const n = window.getSelection();
|
|
994
1006
|
if (!(n != null && n.rangeCount)) return;
|
|
995
1007
|
const a = n.anchorNode;
|
|
996
|
-
if (
|
|
1008
|
+
if (Xe(a))
|
|
997
1009
|
return;
|
|
998
1010
|
setTimeout(() => {
|
|
999
|
-
|
|
1011
|
+
Ie(n.getRangeAt(0)), ce(""), M(r), B(!0);
|
|
1000
1012
|
}, 0);
|
|
1001
1013
|
return;
|
|
1002
1014
|
}
|
|
@@ -1004,7 +1016,7 @@ const $t = ({
|
|
|
1004
1016
|
setTimeout(() => me(), 0);
|
|
1005
1017
|
return;
|
|
1006
1018
|
}
|
|
1007
|
-
},
|
|
1019
|
+
}, Xe = (e) => {
|
|
1008
1020
|
if (!e) return !1;
|
|
1009
1021
|
let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
1010
1022
|
for (; t; ) {
|
|
@@ -1013,75 +1025,81 @@ const $t = ({
|
|
|
1013
1025
|
}
|
|
1014
1026
|
return !1;
|
|
1015
1027
|
}, me = () => {
|
|
1016
|
-
if (
|
|
1028
|
+
if (S(), !q) return;
|
|
1017
1029
|
const e = window.getSelection();
|
|
1018
1030
|
if (!e || !e.anchorNode) return;
|
|
1019
1031
|
const n = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
|
|
1020
1032
|
if (!n) {
|
|
1021
|
-
|
|
1033
|
+
B(!1);
|
|
1022
1034
|
return;
|
|
1023
1035
|
}
|
|
1024
1036
|
const a = n[1].toLowerCase();
|
|
1025
1037
|
ce(a);
|
|
1026
1038
|
const s = r.filter((l) => l.name.toLowerCase().includes(a));
|
|
1027
|
-
|
|
1028
|
-
},
|
|
1039
|
+
M(s);
|
|
1040
|
+
}, Ye = (e) => {
|
|
1029
1041
|
var a;
|
|
1030
1042
|
const t = (a = e.target.files) == null ? void 0 : a[0];
|
|
1031
1043
|
if (!t) return;
|
|
1032
1044
|
const n = new FileReader();
|
|
1033
1045
|
n.onload = (s) => {
|
|
1034
|
-
var
|
|
1035
|
-
const l = (
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
let v =
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1042
|
-
if (!v || !
|
|
1043
|
-
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
+
var x;
|
|
1047
|
+
const l = (x = s.target) == null ? void 0 : x.result;
|
|
1048
|
+
$();
|
|
1049
|
+
const c = window.getSelection();
|
|
1050
|
+
let v = c && c.rangeCount ? c.getRangeAt(0) : null;
|
|
1051
|
+
const h = document.createElement("img");
|
|
1052
|
+
h.src = l, h.alt = t.name || "image", h.className = "rte-inserted-image", h.contentEditable = "true";
|
|
1053
|
+
const E = T();
|
|
1054
|
+
if (!v || !E) {
|
|
1055
|
+
E == null || E.appendChild(h);
|
|
1056
|
+
const Re = document.createTextNode(" ");
|
|
1057
|
+
E == null || E.appendChild(Re);
|
|
1046
1058
|
const re = document.createRange();
|
|
1047
|
-
re.setStartAfter(
|
|
1059
|
+
re.setStartAfter(Re), re.collapse(!0), c == null || c.removeAllRanges(), c == null || c.addRange(re), E == null || E.focus(), S(), e.target.value = "";
|
|
1048
1060
|
return;
|
|
1049
1061
|
}
|
|
1050
|
-
v.deleteContents(), v.insertNode(
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1062
|
+
v.deleteContents(), v.insertNode(h);
|
|
1063
|
+
const g = document.createTextNode(" ");
|
|
1064
|
+
h.after(g);
|
|
1065
|
+
const y = document.createRange();
|
|
1066
|
+
y.setStartAfter(g), y.collapse(!0), c.removeAllRanges(), c.addRange(y), E.focus(), S(), e.target.value = "";
|
|
1055
1067
|
}, n.readAsDataURL(t);
|
|
1056
|
-
},
|
|
1068
|
+
}, Ze = (e) => {
|
|
1057
1069
|
var s;
|
|
1058
|
-
|
|
1070
|
+
$();
|
|
1059
1071
|
const t = window.getSelection();
|
|
1060
1072
|
if (!(t != null && t.rangeCount)) return;
|
|
1061
1073
|
const n = t.getRangeAt(0), a = document.createTextNode(e);
|
|
1062
|
-
n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s =
|
|
1063
|
-
},
|
|
1064
|
-
|
|
1074
|
+
n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = T()) == null || s.focus(), S();
|
|
1075
|
+
}, Qe = () => {
|
|
1076
|
+
var E;
|
|
1077
|
+
$();
|
|
1065
1078
|
const e = document.createElement("table");
|
|
1066
|
-
e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative",
|
|
1079
|
+
e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative", f.table && e.classList.add(f.table);
|
|
1067
1080
|
const t = document.createElement("thead");
|
|
1068
|
-
|
|
1081
|
+
f.thead && t.classList.add(f.thead);
|
|
1069
1082
|
const n = document.createElement("tbody");
|
|
1070
|
-
|
|
1083
|
+
f.tbody && n.classList.add(f.tbody);
|
|
1071
1084
|
const a = document.createElement("tr");
|
|
1072
|
-
|
|
1085
|
+
f.tr && a.classList.add(f.tr);
|
|
1073
1086
|
const s = document.createElement("tr");
|
|
1074
|
-
|
|
1075
|
-
for (let
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1087
|
+
f.tr && s.classList.add(f.tr);
|
|
1088
|
+
for (let g = 0; g < 2; g++) {
|
|
1089
|
+
const y = document.createElement("th");
|
|
1090
|
+
y.textContent = `Header ${g + 1}`, y.style.border = "1px solid #999", y.style.padding = "4px", y.style.position = "relative", y.style.backgroundColor = "lightgray", f.th && y.classList.add(f.th);
|
|
1091
|
+
const x = document.createElement("td");
|
|
1092
|
+
x.textContent = `Row 1 Col ${g + 1}`, x.style.border = "1px solid #999", x.style.padding = "4px", x.style.position = "relative", x.style.backgroundColor = "#fff", f.td && x.classList.add(f.td), Y(y), Y(x), a.appendChild(y), s.appendChild(x);
|
|
1080
1093
|
}
|
|
1081
|
-
t.appendChild(a), n.appendChild(s), e.appendChild(t), e.appendChild(n),
|
|
1094
|
+
t.appendChild(a), n.appendChild(s), e.appendChild(t), e.appendChild(n), ge(e);
|
|
1082
1095
|
const l = window.getSelection();
|
|
1083
1096
|
if (!(l != null && l.rangeCount)) return;
|
|
1084
|
-
l.getRangeAt(0)
|
|
1097
|
+
const c = l.getRangeAt(0);
|
|
1098
|
+
c.collapse(!1), c.insertNode(e);
|
|
1099
|
+
const v = document.createElement("p");
|
|
1100
|
+
v.innerHTML = "<br/>", e.after(v);
|
|
1101
|
+
const h = document.createRange();
|
|
1102
|
+
h.setStart(v, 0), h.collapse(!0), l.removeAllRanges(), l.addRange(h), (E = T()) == null || E.focus(), S();
|
|
1085
1103
|
}, ge = (e) => {
|
|
1086
1104
|
const t = document.createElement("div");
|
|
1087
1105
|
Object.assign(t.style, {
|
|
@@ -1094,19 +1112,19 @@ const $t = ({
|
|
|
1094
1112
|
cursor: "nwse-resize",
|
|
1095
1113
|
zIndex: "20",
|
|
1096
1114
|
borderRadius: "2px"
|
|
1097
|
-
});
|
|
1115
|
+
}), t.style.userSelect = "none", t.contentEditable = "false";
|
|
1098
1116
|
let n = 0, a = 0, s = 0, l = 0;
|
|
1099
|
-
t.addEventListener("mousedown", (
|
|
1100
|
-
|
|
1117
|
+
t.addEventListener("mousedown", (c) => {
|
|
1118
|
+
c.preventDefault(), n = c.clientX, a = c.clientY;
|
|
1101
1119
|
const v = e.getBoundingClientRect();
|
|
1102
1120
|
s = v.width, l = v.height;
|
|
1103
|
-
const
|
|
1104
|
-
const
|
|
1105
|
-
e.style.width = `${
|
|
1106
|
-
},
|
|
1107
|
-
document.removeEventListener("mousemove",
|
|
1121
|
+
const h = (g) => {
|
|
1122
|
+
const y = Math.max(100, s + (g.clientX - n)), x = Math.max(60, l + (g.clientY - a));
|
|
1123
|
+
e.style.width = `${y}px`, e.style.height = `${x}px`, S();
|
|
1124
|
+
}, E = () => {
|
|
1125
|
+
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", E), S();
|
|
1108
1126
|
};
|
|
1109
|
-
document.addEventListener("mousemove",
|
|
1127
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", E);
|
|
1110
1128
|
}), e.appendChild(t);
|
|
1111
1129
|
}, Y = (e) => {
|
|
1112
1130
|
const t = document.createElement("div"), n = document.createElement("div");
|
|
@@ -1118,8 +1136,13 @@ const $t = ({
|
|
|
1118
1136
|
height: "100%",
|
|
1119
1137
|
cursor: "col-resize",
|
|
1120
1138
|
background: "rgba(0,0,0,0.15)",
|
|
1121
|
-
zIndex: "10"
|
|
1122
|
-
|
|
1139
|
+
zIndex: "10",
|
|
1140
|
+
userSelect: "none",
|
|
1141
|
+
WebkitUserSelect: "none",
|
|
1142
|
+
MozUserSelect: "none",
|
|
1143
|
+
msUserSelect: "none",
|
|
1144
|
+
pointerEvents: "auto"
|
|
1145
|
+
}), t.contentEditable = "false", Object.assign(n.style, {
|
|
1123
1146
|
position: "absolute",
|
|
1124
1147
|
bottom: "0",
|
|
1125
1148
|
left: "0",
|
|
@@ -1127,27 +1150,32 @@ const $t = ({
|
|
|
1127
1150
|
height: "6px",
|
|
1128
1151
|
cursor: "row-resize",
|
|
1129
1152
|
background: "rgba(0,0,0,0.15)",
|
|
1130
|
-
zIndex: "10"
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
}), n.
|
|
1137
|
-
|
|
1153
|
+
zIndex: "10",
|
|
1154
|
+
userSelect: "none",
|
|
1155
|
+
WebkitUserSelect: "none",
|
|
1156
|
+
MozUserSelect: "none",
|
|
1157
|
+
msUserSelect: "none",
|
|
1158
|
+
pointerEvents: "auto"
|
|
1159
|
+
}), n.contentEditable = "false", Je(e, t, n), e.appendChild(t), e.appendChild(n);
|
|
1160
|
+
}, Je = (e, t, n) => {
|
|
1161
|
+
let a = 0, s = 0, l = 0, c = 0;
|
|
1162
|
+
t.addEventListener("mousedown", (g) => {
|
|
1163
|
+
g.preventDefault(), a = g.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", E);
|
|
1164
|
+
}), n.addEventListener("mousedown", (g) => {
|
|
1165
|
+
g.preventDefault(), s = g.clientY, c = e.offsetHeight, document.addEventListener("mousemove", h), document.addEventListener("mouseup", E);
|
|
1138
1166
|
});
|
|
1139
|
-
const v = (
|
|
1140
|
-
const
|
|
1141
|
-
e.style.width = `${Math.max(30,
|
|
1142
|
-
},
|
|
1143
|
-
const
|
|
1144
|
-
e.style.height = `${Math.max(20,
|
|
1145
|
-
},
|
|
1146
|
-
document.removeEventListener("mousemove", v), document.removeEventListener("mousemove",
|
|
1167
|
+
const v = (g) => {
|
|
1168
|
+
const y = l + (g.clientX - a);
|
|
1169
|
+
e.style.width = `${Math.max(30, y)}px`, S();
|
|
1170
|
+
}, h = (g) => {
|
|
1171
|
+
const y = c + (g.clientY - s);
|
|
1172
|
+
e.style.height = `${Math.max(20, y)}px`, S();
|
|
1173
|
+
}, E = () => {
|
|
1174
|
+
document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", E), S();
|
|
1147
1175
|
};
|
|
1148
|
-
},
|
|
1176
|
+
}, Ge = (e) => {
|
|
1149
1177
|
const n = e.target.closest("td, th");
|
|
1150
|
-
n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"),
|
|
1178
|
+
n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), m({
|
|
1151
1179
|
visible: !0,
|
|
1152
1180
|
x: e.clientX,
|
|
1153
1181
|
y: e.clientY,
|
|
@@ -1155,38 +1183,38 @@ const $t = ({
|
|
|
1155
1183
|
}));
|
|
1156
1184
|
}, fe = () => {
|
|
1157
1185
|
document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
|
|
1158
|
-
},
|
|
1159
|
-
if (!
|
|
1160
|
-
const t =
|
|
1161
|
-
const
|
|
1186
|
+
}, et = (e) => {
|
|
1187
|
+
if (!D.cell) return;
|
|
1188
|
+
const t = D.cell.closest("table"), n = D.cell.cellIndex, a = D.cell.parentElement.rowIndex, s = (l) => {
|
|
1189
|
+
const c = l.tagName.toLowerCase(), v = document.createElement(c);
|
|
1162
1190
|
return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText, Y(v), v;
|
|
1163
1191
|
};
|
|
1164
1192
|
switch (e) {
|
|
1165
1193
|
case "insertRowAbove": {
|
|
1166
|
-
const l = t.rows[a],
|
|
1194
|
+
const l = t.rows[a], c = t.insertRow(a);
|
|
1167
1195
|
Array.from(l.cells).forEach((v) => {
|
|
1168
|
-
|
|
1196
|
+
c.appendChild(s(v));
|
|
1169
1197
|
});
|
|
1170
1198
|
break;
|
|
1171
1199
|
}
|
|
1172
1200
|
case "insertRowBelow": {
|
|
1173
|
-
const l = t.rows[a],
|
|
1201
|
+
const l = t.rows[a], c = t.insertRow(a + 1);
|
|
1174
1202
|
Array.from(l.cells).forEach((v) => {
|
|
1175
|
-
|
|
1203
|
+
c.appendChild(s(v));
|
|
1176
1204
|
});
|
|
1177
1205
|
break;
|
|
1178
1206
|
}
|
|
1179
1207
|
case "insertColLeft": {
|
|
1180
1208
|
Array.from(t.rows).forEach((l) => {
|
|
1181
|
-
const
|
|
1182
|
-
l.insertBefore(s(
|
|
1209
|
+
const c = l.cells[n];
|
|
1210
|
+
l.insertBefore(s(c), c);
|
|
1183
1211
|
});
|
|
1184
1212
|
break;
|
|
1185
1213
|
}
|
|
1186
1214
|
case "insertColRight": {
|
|
1187
1215
|
Array.from(t.rows).forEach((l) => {
|
|
1188
|
-
const
|
|
1189
|
-
l.insertBefore(s(
|
|
1216
|
+
const c = l.cells[n];
|
|
1217
|
+
l.insertBefore(s(c), c.nextSibling);
|
|
1190
1218
|
});
|
|
1191
1219
|
break;
|
|
1192
1220
|
}
|
|
@@ -1199,32 +1227,20 @@ const $t = ({
|
|
|
1199
1227
|
});
|
|
1200
1228
|
break;
|
|
1201
1229
|
}
|
|
1202
|
-
|
|
1230
|
+
S(), m(oe(ae({}, D), {
|
|
1203
1231
|
visible: !1
|
|
1204
1232
|
})), fe();
|
|
1205
|
-
},
|
|
1206
|
-
|
|
1207
|
-
if (!t || t.querySelector("[data-hidden-table-start]")) return;
|
|
1208
|
-
const n = document.createElement("span");
|
|
1209
|
-
n.textContent = "{{#arrayData}}", n.style.display = "none", n.setAttribute("data-hidden-table-start", "true"), t.insertBefore(n, t.firstChild);
|
|
1210
|
-
const a = document.createElement("span");
|
|
1211
|
-
a.textContent = "{{/arrayData}}", a.style.display = "none", a.setAttribute("data-hidden-table-end", "true"), t.appendChild(a);
|
|
1212
|
-
}, he = () => {
|
|
1213
|
-
const e = D();
|
|
1214
|
-
if (!e) return H;
|
|
1215
|
-
const t = e.cloneNode(!0);
|
|
1216
|
-
return t.querySelectorAll("table div").forEach((n) => n.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((n) => n.classList.remove("rte-cell-highlight")), t.innerHTML;
|
|
1217
|
-
}, et = () => {
|
|
1218
|
-
U(), K.current = k.current, le({
|
|
1233
|
+
}, tt = () => {
|
|
1234
|
+
V(), X.current = N.current, le({
|
|
1219
1235
|
url: "",
|
|
1220
1236
|
text: "",
|
|
1221
1237
|
title: "",
|
|
1222
1238
|
target: "_self"
|
|
1223
|
-
}),
|
|
1224
|
-
},
|
|
1239
|
+
}), H(!0);
|
|
1240
|
+
}, nt = (e) => {
|
|
1225
1241
|
const t = window.getSelection();
|
|
1226
|
-
if (!t || !
|
|
1227
|
-
t.removeAllRanges(), t.addRange(
|
|
1242
|
+
if (!t || !X.current) return;
|
|
1243
|
+
t.removeAllRanges(), t.addRange(X.current);
|
|
1228
1244
|
let n = e.url.trim();
|
|
1229
1245
|
/^https?:\/\//i.test(n) || (n = "https://" + n);
|
|
1230
1246
|
const a = document.createElement("a");
|
|
@@ -1233,9 +1249,9 @@ const $t = ({
|
|
|
1233
1249
|
s.deleteContents(), s.insertNode(a);
|
|
1234
1250
|
const l = document.createTextNode(" ");
|
|
1235
1251
|
a.after(l);
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
},
|
|
1252
|
+
const c = document.createRange();
|
|
1253
|
+
c.setStartAfter(l), c.collapse(!0), t.removeAllRanges(), t.addRange(c), H(!1), S();
|
|
1254
|
+
}, rt = (e) => {
|
|
1239
1255
|
const t = e.target;
|
|
1240
1256
|
if (t.tagName === "A") {
|
|
1241
1257
|
const n = t;
|
|
@@ -1245,46 +1261,46 @@ const $t = ({
|
|
|
1245
1261
|
}
|
|
1246
1262
|
e.preventDefault();
|
|
1247
1263
|
const a = document.createRange();
|
|
1248
|
-
a.selectNode(n),
|
|
1264
|
+
a.selectNode(n), X.current = a, le({
|
|
1249
1265
|
url: n.href,
|
|
1250
1266
|
text: n.textContent || n.href,
|
|
1251
1267
|
title: n.title,
|
|
1252
1268
|
target: n.target
|
|
1253
|
-
}),
|
|
1269
|
+
}), H(!0);
|
|
1254
1270
|
}
|
|
1255
|
-
},
|
|
1256
|
-
const e =
|
|
1271
|
+
}, at = () => {
|
|
1272
|
+
const e = T();
|
|
1257
1273
|
if (!e) return;
|
|
1258
1274
|
const t = window.getSelection();
|
|
1259
|
-
if ((!t || t.rangeCount === 0) &&
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1275
|
+
if ((!t || t.rangeCount === 0) && N.current) {
|
|
1276
|
+
const g = window.getSelection();
|
|
1277
|
+
g == null || g.removeAllRanges(), g == null || g.addRange(N.current);
|
|
1262
1278
|
}
|
|
1263
1279
|
const n = window.getSelection();
|
|
1264
1280
|
if (!n || n.rangeCount === 0) return;
|
|
1265
1281
|
const a = n.getRangeAt(0);
|
|
1266
|
-
|
|
1282
|
+
$(), document.execCommand("removeFormat", !1);
|
|
1267
1283
|
const s = a.cloneContents(), l = document.createElement("div");
|
|
1268
1284
|
l.appendChild(s);
|
|
1269
|
-
const
|
|
1270
|
-
for (;
|
|
1271
|
-
const
|
|
1272
|
-
|
|
1285
|
+
const c = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), v = [];
|
|
1286
|
+
for (; c.nextNode(); ) {
|
|
1287
|
+
const g = c.currentNode, y = g.tagName.toUpperCase(), x = g.getAttribute && g.getAttribute("data-mention") !== null;
|
|
1288
|
+
y !== "A" && !x && v.push(g);
|
|
1273
1289
|
}
|
|
1274
|
-
for (let
|
|
1275
|
-
const
|
|
1276
|
-
if (
|
|
1277
|
-
for (;
|
|
1278
|
-
|
|
1290
|
+
for (let g = v.length - 1; g >= 0; g--) {
|
|
1291
|
+
const y = v[g], x = y.parentNode;
|
|
1292
|
+
if (x) {
|
|
1293
|
+
for (; y.firstChild; ) x.insertBefore(y.firstChild, y);
|
|
1294
|
+
x.removeChild(y);
|
|
1279
1295
|
}
|
|
1280
1296
|
}
|
|
1281
|
-
l.querySelectorAll("[style]").forEach((
|
|
1282
|
-
const
|
|
1283
|
-
for (; l.firstChild; )
|
|
1284
|
-
a.insertNode(
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1287
|
-
},
|
|
1297
|
+
l.querySelectorAll("[style]").forEach((g) => g.removeAttribute("style")), a.deleteContents();
|
|
1298
|
+
const h = document.createDocumentFragment();
|
|
1299
|
+
for (; l.firstChild; ) h.appendChild(l.firstChild);
|
|
1300
|
+
a.insertNode(h);
|
|
1301
|
+
const E = document.createRange();
|
|
1302
|
+
E.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), E.collapse(!0), n.removeAllRanges(), n.addRange(E), e.normalize(), S();
|
|
1303
|
+
}, ot = (e) => {
|
|
1288
1304
|
var a;
|
|
1289
1305
|
let t = e;
|
|
1290
1306
|
t = t.replace(/{{#arrayData\d*}}/g, ""), t = t.replace(/{{\/arrayData\d*}}/g, "");
|
|
@@ -1302,17 +1318,17 @@ const $t = ({
|
|
|
1302
1318
|
|
|
1303
1319
|
`).trim()) || "";
|
|
1304
1320
|
};
|
|
1305
|
-
function
|
|
1321
|
+
function lt() {
|
|
1306
1322
|
const e = window.getSelection();
|
|
1307
1323
|
if (!e || e.rangeCount === 0) return [];
|
|
1308
1324
|
const t = e.getRangeAt(0), n = t.commonAncestorContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
|
|
1309
1325
|
return Array.from(a.querySelectorAll("td, th")).filter((l) => {
|
|
1310
|
-
const
|
|
1311
|
-
return
|
|
1326
|
+
const c = document.createRange();
|
|
1327
|
+
return c.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, c) < 0 && t.compareBoundaryPoints(Range.START_TO_END, c) > 0;
|
|
1312
1328
|
});
|
|
1313
1329
|
}
|
|
1314
|
-
function
|
|
1315
|
-
const t =
|
|
1330
|
+
function ct(e) {
|
|
1331
|
+
const t = lt();
|
|
1316
1332
|
if (t.length === 0) {
|
|
1317
1333
|
se(e);
|
|
1318
1334
|
return;
|
|
@@ -1320,78 +1336,100 @@ const $t = ({
|
|
|
1320
1336
|
let n = "left";
|
|
1321
1337
|
e === "justifyCenter" && (n = "center"), e === "justifyRight" && (n = "right"), t.forEach((a) => {
|
|
1322
1338
|
a.style.textAlign = n;
|
|
1323
|
-
}),
|
|
1339
|
+
}), S();
|
|
1324
1340
|
}
|
|
1341
|
+
const it = (e) => {
|
|
1342
|
+
const t = e.clipboardData.items;
|
|
1343
|
+
for (let n = 0; n < t.length; n++) {
|
|
1344
|
+
const a = t[n];
|
|
1345
|
+
if (a.kind === "file" && a.type.startsWith("image/")) {
|
|
1346
|
+
e.preventDefault();
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
a.kind === "string" && a.getAsString((s) => {
|
|
1350
|
+
/<img\s/i.test(s) && e.preventDefault();
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
}, st = (e) => {
|
|
1354
|
+
$();
|
|
1355
|
+
const t = window.getSelection();
|
|
1356
|
+
if (!t || !t.rangeCount) return;
|
|
1357
|
+
const n = t.getRangeAt(0), a = document.createElement("span");
|
|
1358
|
+
a.style.fontSize = `${e}px`, a.appendChild(n.extractContents()), n.insertNode(a);
|
|
1359
|
+
const s = document.createRange();
|
|
1360
|
+
s.setStartAfter(a), s.collapse(!0), t.removeAllRanges(), t.addRange(s), S();
|
|
1361
|
+
};
|
|
1325
1362
|
return /* @__PURE__ */ o.createElement("div", {
|
|
1326
|
-
className: `rte-wrapper ${(
|
|
1327
|
-
style:
|
|
1363
|
+
className: `rte-wrapper ${(f == null ? void 0 : f.wrapper) || ""}`,
|
|
1364
|
+
style: w.wrapper
|
|
1328
1365
|
}, /* @__PURE__ */ o.createElement("div", {
|
|
1329
1366
|
style: {
|
|
1330
1367
|
flex: 1
|
|
1331
1368
|
}
|
|
1332
|
-
}, /* @__PURE__ */ o.createElement(
|
|
1333
|
-
exec:
|
|
1334
|
-
saveSelection:
|
|
1335
|
-
handleFileChange:
|
|
1336
|
-
handleFontSizeChange: (e) =>
|
|
1337
|
-
handleFontFamilyChange: (e) =>
|
|
1338
|
-
insertEmoji:
|
|
1339
|
-
handleLink:
|
|
1340
|
-
removeFormatting:
|
|
1341
|
-
visibleActions:
|
|
1342
|
-
className:
|
|
1343
|
-
style:
|
|
1369
|
+
}, /* @__PURE__ */ o.createElement(It, {
|
|
1370
|
+
exec: ne,
|
|
1371
|
+
saveSelection: V,
|
|
1372
|
+
handleFileChange: Ye,
|
|
1373
|
+
handleFontSizeChange: (e) => st(e.target.value),
|
|
1374
|
+
handleFontFamilyChange: (e) => ne("fontName", e.target.value),
|
|
1375
|
+
insertEmoji: Ze,
|
|
1376
|
+
handleLink: tt,
|
|
1377
|
+
removeFormatting: at,
|
|
1378
|
+
visibleActions: De,
|
|
1379
|
+
className: f.toolbar,
|
|
1380
|
+
style: w.toolbar
|
|
1344
1381
|
}), /* @__PURE__ */ o.createElement("div", {
|
|
1345
|
-
ref:
|
|
1382
|
+
ref: k,
|
|
1346
1383
|
id: "rte-editor-body",
|
|
1347
|
-
className: `rte-editor ${(
|
|
1348
|
-
style:
|
|
1384
|
+
className: `rte-editor ${(f == null ? void 0 : f.editor) || ""}`,
|
|
1385
|
+
style: w.editor,
|
|
1349
1386
|
contentEditable: !0,
|
|
1350
1387
|
suppressContentEditableWarning: !0,
|
|
1351
|
-
|
|
1352
|
-
|
|
1388
|
+
onPaste: it,
|
|
1389
|
+
onKeyUp: V,
|
|
1390
|
+
onMouseUp: V,
|
|
1353
1391
|
onInput: () => {
|
|
1354
|
-
me(),
|
|
1392
|
+
me(), V();
|
|
1355
1393
|
},
|
|
1356
|
-
onKeyDown:
|
|
1357
|
-
onBeforeInput:
|
|
1358
|
-
onContextMenu:
|
|
1394
|
+
onKeyDown: We,
|
|
1395
|
+
onBeforeInput: Ke,
|
|
1396
|
+
onContextMenu: Ge,
|
|
1359
1397
|
onClick: (e) => {
|
|
1360
|
-
|
|
1398
|
+
rt(e), V();
|
|
1361
1399
|
}
|
|
1362
|
-
}), /* @__PURE__ */ o.createElement(
|
|
1400
|
+
}), /* @__PURE__ */ o.createElement(Bt, {
|
|
1363
1401
|
show: q,
|
|
1364
1402
|
position: F,
|
|
1365
|
-
filtered:
|
|
1366
|
-
insertMention:
|
|
1367
|
-
onClose: () =>
|
|
1368
|
-
query:
|
|
1369
|
-
}),
|
|
1370
|
-
className: `rte-output ${(
|
|
1371
|
-
style:
|
|
1372
|
-
}, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null,
|
|
1373
|
-
visible:
|
|
1374
|
-
x:
|
|
1375
|
-
y:
|
|
1376
|
-
onAction:
|
|
1403
|
+
filtered: ee,
|
|
1404
|
+
insertMention: qe,
|
|
1405
|
+
onClose: () => B(!1),
|
|
1406
|
+
query: Oe
|
|
1407
|
+
}), i && /* @__PURE__ */ o.createElement("div", {
|
|
1408
|
+
className: `rte-output ${(f == null ? void 0 : f.output) || ""}`,
|
|
1409
|
+
style: w.output
|
|
1410
|
+
}, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, K)), /* @__PURE__ */ o.createElement(qt, {
|
|
1411
|
+
visible: D.visible,
|
|
1412
|
+
x: D.x,
|
|
1413
|
+
y: D.y,
|
|
1414
|
+
onAction: et,
|
|
1377
1415
|
onClose: () => {
|
|
1378
|
-
|
|
1416
|
+
m(oe(ae({}, D), {
|
|
1379
1417
|
visible: !1
|
|
1380
1418
|
})), fe();
|
|
1381
1419
|
}
|
|
1382
|
-
}), /* @__PURE__ */ o.createElement(
|
|
1383
|
-
visible:
|
|
1384
|
-
linkData:
|
|
1385
|
-
onClose: () =>
|
|
1386
|
-
onInsert:
|
|
1387
|
-
})), d ? /* @__PURE__ */ o.createElement(
|
|
1388
|
-
className:
|
|
1389
|
-
style:
|
|
1390
|
-
html:
|
|
1420
|
+
}), /* @__PURE__ */ o.createElement(Vt, {
|
|
1421
|
+
visible: C,
|
|
1422
|
+
linkData: Te,
|
|
1423
|
+
onClose: () => H(!1),
|
|
1424
|
+
onInsert: nt
|
|
1425
|
+
})), d ? /* @__PURE__ */ o.createElement(Ut, {
|
|
1426
|
+
className: f.preview,
|
|
1427
|
+
style: w.preview,
|
|
1428
|
+
html: K
|
|
1391
1429
|
}) : null);
|
|
1392
1430
|
};
|
|
1393
1431
|
export {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1432
|
+
Xt as RichTextEditor,
|
|
1433
|
+
Ut as RtePreview,
|
|
1434
|
+
It as RteToolbar
|
|
1397
1435
|
};
|