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