@ryzeup/richtexteditor 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +531 -495
- package/dist/index.js +5 -5
- package/dist/index.umd.js +4 -4
- package/dist/richtexteditor.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var d in
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var d of
|
|
10
|
-
|
|
1
|
+
var dt = Object.defineProperty, ut = Object.defineProperties;
|
|
2
|
+
var mt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var xe = Object.getOwnPropertySymbols;
|
|
4
|
+
var gt = Object.prototype.hasOwnProperty, ft = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Le = (r, i, d) => i in r ? dt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[i] = d, ae = (r, i) => {
|
|
6
|
+
for (var d in i || (i = {}))
|
|
7
|
+
gt.call(i, d) && Le(r, d, i[d]);
|
|
8
|
+
if (xe)
|
|
9
|
+
for (var d of xe(i))
|
|
10
|
+
ft.call(i, d) && Le(r, d, i[d]);
|
|
11
11
|
return r;
|
|
12
|
-
}, oe = (r,
|
|
13
|
-
import * as
|
|
14
|
-
import o, { useRef as P, useState as
|
|
15
|
-
import { createPortal as
|
|
16
|
-
window.React =
|
|
17
|
-
var
|
|
12
|
+
}, oe = (r, i) => ut(r, mt(i));
|
|
13
|
+
import * as ht from "react";
|
|
14
|
+
import o, { useRef as P, useState as A, useEffect as I } from "react";
|
|
15
|
+
import { createPortal as pt } from "react-dom";
|
|
16
|
+
window.React = ht;
|
|
17
|
+
var ke = {
|
|
18
18
|
color: void 0,
|
|
19
19
|
size: void 0,
|
|
20
20
|
className: void 0,
|
|
21
21
|
style: void 0,
|
|
22
22
|
attr: void 0
|
|
23
|
-
}, Se = o.createContext && /* @__PURE__ */ o.createContext(
|
|
24
|
-
function
|
|
23
|
+
}, Se = o.createContext && /* @__PURE__ */ o.createContext(ke), vt = ["attr", "size", "title"];
|
|
24
|
+
function yt(r, i) {
|
|
25
25
|
if (r == null) return {};
|
|
26
|
-
var d =
|
|
26
|
+
var d = Et(r, i), u, f;
|
|
27
27
|
if (Object.getOwnPropertySymbols) {
|
|
28
|
-
var
|
|
29
|
-
for (
|
|
30
|
-
u =
|
|
28
|
+
var w = Object.getOwnPropertySymbols(r);
|
|
29
|
+
for (f = 0; f < w.length; f++)
|
|
30
|
+
u = w[f], !(i.indexOf(u) >= 0) && Object.prototype.propertyIsEnumerable.call(r, u) && (d[u] = r[u]);
|
|
31
31
|
}
|
|
32
32
|
return d;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function Et(r, i) {
|
|
35
35
|
if (r == null) return {};
|
|
36
36
|
var d = {};
|
|
37
37
|
for (var u in r)
|
|
38
38
|
if (Object.prototype.hasOwnProperty.call(r, u)) {
|
|
39
|
-
if (
|
|
39
|
+
if (i.indexOf(u) >= 0) continue;
|
|
40
40
|
d[u] = r[u];
|
|
41
41
|
}
|
|
42
42
|
return d;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
46
|
-
for (var
|
|
47
|
-
var d = arguments[
|
|
44
|
+
function Q() {
|
|
45
|
+
return Q = Object.assign ? Object.assign.bind() : function(r) {
|
|
46
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
47
|
+
var d = arguments[i];
|
|
48
48
|
for (var u in d)
|
|
49
49
|
Object.prototype.hasOwnProperty.call(d, u) && (r[u] = d[u]);
|
|
50
50
|
}
|
|
51
51
|
return r;
|
|
52
|
-
},
|
|
52
|
+
}, Q.apply(this, arguments);
|
|
53
53
|
}
|
|
54
|
-
function Me(r,
|
|
54
|
+
function Me(r, i) {
|
|
55
55
|
var d = Object.keys(r);
|
|
56
56
|
if (Object.getOwnPropertySymbols) {
|
|
57
57
|
var u = Object.getOwnPropertySymbols(r);
|
|
58
|
-
|
|
59
|
-
return Object.getOwnPropertyDescriptor(r,
|
|
58
|
+
i && (u = u.filter(function(f) {
|
|
59
|
+
return Object.getOwnPropertyDescriptor(r, f).enumerable;
|
|
60
60
|
})), d.push.apply(d, u);
|
|
61
61
|
}
|
|
62
62
|
return d;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
for (var
|
|
66
|
-
var d = arguments[
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
function J(r) {
|
|
65
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
66
|
+
var d = arguments[i] != null ? arguments[i] : {};
|
|
67
|
+
i % 2 ? Me(Object(d), !0).forEach(function(u) {
|
|
68
|
+
wt(r, u, d[u]);
|
|
69
69
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) : Me(Object(d)).forEach(function(u) {
|
|
70
70
|
Object.defineProperty(r, u, Object.getOwnPropertyDescriptor(d, u));
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
return r;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return
|
|
75
|
+
function wt(r, i, d) {
|
|
76
|
+
return i = Ct(i), i in r ? Object.defineProperty(r, i, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : r[i] = d, r;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
var
|
|
80
|
-
return typeof
|
|
78
|
+
function Ct(r) {
|
|
79
|
+
var i = bt(r, "string");
|
|
80
|
+
return typeof i == "symbol" ? i : i + "";
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function bt(r, i) {
|
|
83
83
|
if (typeof r != "object" || !r) return r;
|
|
84
84
|
var d = r[Symbol.toPrimitive];
|
|
85
85
|
if (d !== void 0) {
|
|
86
|
-
var u = d.call(r,
|
|
86
|
+
var u = d.call(r, i);
|
|
87
87
|
if (typeof u != "object") return u;
|
|
88
88
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
89
89
|
}
|
|
90
|
-
return (
|
|
90
|
+
return (i === "string" ? String : Number)(r);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
return r && r.map((
|
|
92
|
+
function Ne(r) {
|
|
93
|
+
return r && r.map((i, d) => /* @__PURE__ */ o.createElement(i.tag, J({
|
|
94
94
|
key: d
|
|
95
|
-
},
|
|
95
|
+
}, i.attr), Ne(i.child)));
|
|
96
96
|
}
|
|
97
97
|
function z(r) {
|
|
98
|
-
return (
|
|
99
|
-
attr:
|
|
100
|
-
},
|
|
98
|
+
return (i) => /* @__PURE__ */ o.createElement(Rt, Q({
|
|
99
|
+
attr: J({}, r.attr)
|
|
100
|
+
}, i), Ne(r.child));
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
var
|
|
102
|
+
function Rt(r) {
|
|
103
|
+
var i = (d) => {
|
|
104
104
|
var {
|
|
105
105
|
attr: u,
|
|
106
|
-
size:
|
|
107
|
-
title:
|
|
108
|
-
} = r,
|
|
109
|
-
return d.className && (
|
|
106
|
+
size: f,
|
|
107
|
+
title: w
|
|
108
|
+
} = r, R = yt(r, vt), b = f || d.size || "1em", p;
|
|
109
|
+
return d.className && (p = d.className), r.className && (p = (p ? p + " " : "") + r.className), /* @__PURE__ */ o.createElement("svg", Q({
|
|
110
110
|
stroke: "currentColor",
|
|
111
111
|
fill: "currentColor",
|
|
112
112
|
strokeWidth: "0"
|
|
113
|
-
}, d.attr, u,
|
|
114
|
-
className:
|
|
115
|
-
style:
|
|
113
|
+
}, d.attr, u, R, {
|
|
114
|
+
className: p,
|
|
115
|
+
style: J(J({
|
|
116
116
|
color: r.color || d.color
|
|
117
117
|
}, d.style), r.style),
|
|
118
|
-
height:
|
|
119
|
-
width:
|
|
118
|
+
height: b,
|
|
119
|
+
width: b,
|
|
120
120
|
xmlns: "http://www.w3.org/2000/svg"
|
|
121
|
-
}),
|
|
121
|
+
}), w && /* @__PURE__ */ o.createElement("title", null, w), r.children);
|
|
122
122
|
};
|
|
123
|
-
return Se !== void 0 ? /* @__PURE__ */ o.createElement(Se.Consumer, null, (d) =>
|
|
123
|
+
return Se !== void 0 ? /* @__PURE__ */ o.createElement(Se.Consumer, null, (d) => i(d)) : i(ke);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function xt(r) {
|
|
126
126
|
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z" }, child: [] }] })(r);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Lt(r) {
|
|
129
129
|
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z" }, child: [] }] })(r);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function St(r) {
|
|
132
132
|
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z" }, child: [] }] })(r);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Mt(r) {
|
|
135
135
|
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z" }, child: [] }] })(r);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function At(r) {
|
|
138
138
|
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function zt(r) {
|
|
141
141
|
return z({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z" }, child: [] }] })(r);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function kt(r) {
|
|
144
144
|
return z({ attr: { viewBox: "0 0 544 512" }, child: [{ tag: "path", attr: { d: "M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z" }, child: [] }] })(r);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Nt(r) {
|
|
147
147
|
return z({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z" }, child: [] }] })(r);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Tt(r) {
|
|
150
150
|
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z" }, child: [] }] })(r);
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Dt(r) {
|
|
153
153
|
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Ot(r) {
|
|
156
156
|
return z({ attr: { viewBox: "0 0 496 512" }, child: [{ tag: "path", attr: { d: "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z" }, child: [] }] })(r);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Ht(r) {
|
|
159
159
|
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z" }, child: [] }] })(r);
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function _t(r) {
|
|
162
162
|
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function jt(r) {
|
|
165
165
|
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z" }, child: [] }] })(r);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function Ft(r) {
|
|
168
168
|
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z" }, child: [] }] })(r);
|
|
169
169
|
}
|
|
170
|
-
const
|
|
170
|
+
const Pt = [
|
|
171
171
|
"😀",
|
|
172
172
|
"😁",
|
|
173
173
|
"😂",
|
|
@@ -279,57 +279,57 @@ const _t = [
|
|
|
279
279
|
"👏",
|
|
280
280
|
"🫶",
|
|
281
281
|
"👐"
|
|
282
|
-
],
|
|
282
|
+
], It = ({
|
|
283
283
|
exec: r,
|
|
284
|
-
saveSelection:
|
|
284
|
+
saveSelection: i,
|
|
285
285
|
handleFileChange: d,
|
|
286
286
|
handleFontSizeChange: u,
|
|
287
|
-
handleFontFamilyChange:
|
|
287
|
+
handleFontFamilyChange: f,
|
|
288
288
|
// insertListBlock,
|
|
289
|
-
insertEmoji:
|
|
290
|
-
handleLink:
|
|
291
|
-
removeFormatting:
|
|
292
|
-
visibleActions:
|
|
289
|
+
insertEmoji: w,
|
|
290
|
+
handleLink: R,
|
|
291
|
+
removeFormatting: b,
|
|
292
|
+
visibleActions: p,
|
|
293
293
|
className: O,
|
|
294
|
-
style:
|
|
294
|
+
style: j
|
|
295
295
|
}) => {
|
|
296
|
-
var
|
|
297
|
-
const
|
|
296
|
+
var U, D;
|
|
297
|
+
const k = P(null), _ = P(null), L = P(null), [K, W] = A(!1), [q, B] = A({
|
|
298
298
|
x: 0,
|
|
299
299
|
y: 0
|
|
300
300
|
});
|
|
301
301
|
I(() => {
|
|
302
|
-
const
|
|
303
|
-
!
|
|
302
|
+
const m = (C) => {
|
|
303
|
+
!C.target.closest(".rte-emoji-popup") && !C.target.closest("button[title='Emoji']") && W(!1);
|
|
304
304
|
};
|
|
305
|
-
return document.addEventListener("mousedown",
|
|
305
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
306
306
|
}, []);
|
|
307
|
-
const F = (
|
|
307
|
+
const F = (m) => {
|
|
308
308
|
var H;
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
switch (
|
|
309
|
+
m.preventDefault();
|
|
310
|
+
const C = m.currentTarget.dataset.command;
|
|
311
|
+
if (C)
|
|
312
|
+
switch (C) {
|
|
313
313
|
case "bold":
|
|
314
314
|
case "italic":
|
|
315
315
|
case "underline":
|
|
316
316
|
case "insertUnorderedList":
|
|
317
317
|
case "insertOrderedList":
|
|
318
318
|
case "removeFormat":
|
|
319
|
-
r(
|
|
319
|
+
r(C);
|
|
320
320
|
break;
|
|
321
321
|
case "insertImage": {
|
|
322
|
-
(H =
|
|
322
|
+
(H = k.current) == null || H.click();
|
|
323
323
|
break;
|
|
324
324
|
}
|
|
325
325
|
default:
|
|
326
|
-
console.warn("Unknown command:",
|
|
326
|
+
console.warn("Unknown command:", C);
|
|
327
327
|
}
|
|
328
|
-
},
|
|
329
|
-
r("foreColor",
|
|
330
|
-
},
|
|
331
|
-
r("backColor",
|
|
332
|
-
}, [
|
|
328
|
+
}, G = (m) => {
|
|
329
|
+
r("foreColor", m.target.value);
|
|
330
|
+
}, ee = (m) => {
|
|
331
|
+
r("backColor", m.target.value);
|
|
332
|
+
}, [M, N] = A({
|
|
333
333
|
bold: !1,
|
|
334
334
|
italic: !1,
|
|
335
335
|
underline: !1,
|
|
@@ -347,8 +347,8 @@ const _t = [
|
|
|
347
347
|
highlight: !1
|
|
348
348
|
});
|
|
349
349
|
return I(() => {
|
|
350
|
-
const
|
|
351
|
-
|
|
350
|
+
const m = () => {
|
|
351
|
+
N({
|
|
352
352
|
bold: document.queryCommandState("bold"),
|
|
353
353
|
italic: document.queryCommandState("italic"),
|
|
354
354
|
underline: document.queryCommandState("underline"),
|
|
@@ -366,117 +366,117 @@ const _t = [
|
|
|
366
366
|
highlight: document.queryCommandState("backColor")
|
|
367
367
|
});
|
|
368
368
|
};
|
|
369
|
-
return document.addEventListener("selectionchange",
|
|
369
|
+
return document.addEventListener("selectionchange", m), () => document.removeEventListener("selectionchange", m);
|
|
370
370
|
}, []), /* @__PURE__ */ o.createElement("div", {
|
|
371
371
|
className: `rte-toolbar ${O || ""}`,
|
|
372
|
-
style:
|
|
373
|
-
},
|
|
372
|
+
style: j
|
|
373
|
+
}, p.bold && /* @__PURE__ */ o.createElement("button", {
|
|
374
374
|
"data-command": "bold",
|
|
375
375
|
title: "Bold",
|
|
376
376
|
onMouseDown: F,
|
|
377
|
-
className:
|
|
378
|
-
}, /* @__PURE__ */ o.createElement(
|
|
377
|
+
className: M.bold ? "rte-active" : ""
|
|
378
|
+
}, /* @__PURE__ */ o.createElement(zt, null)), p.italic && /* @__PURE__ */ o.createElement("button", {
|
|
379
379
|
"data-command": "italic",
|
|
380
380
|
title: "Italic",
|
|
381
381
|
onMouseDown: F,
|
|
382
|
-
className:
|
|
383
|
-
}, /* @__PURE__ */ o.createElement(
|
|
382
|
+
className: M.italic ? "rte-active" : ""
|
|
383
|
+
}, /* @__PURE__ */ o.createElement(Nt, null)), p.underline && /* @__PURE__ */ o.createElement("button", {
|
|
384
384
|
"data-command": "underline",
|
|
385
385
|
title: "Underline",
|
|
386
386
|
onMouseDown: F,
|
|
387
|
-
className:
|
|
388
|
-
}, /* @__PURE__ */ o.createElement(
|
|
387
|
+
className: M.underline ? "rte-active" : ""
|
|
388
|
+
}, /* @__PURE__ */ o.createElement(_t, null)), p.unorderedList && /* @__PURE__ */ o.createElement("button", {
|
|
389
389
|
"data-command": "insertUnorderedList",
|
|
390
390
|
onMouseDown: F,
|
|
391
391
|
title: "UnorderedList",
|
|
392
|
-
className:
|
|
393
|
-
}, /* @__PURE__ */ o.createElement(
|
|
392
|
+
className: M.unorderedList ? "rte-active" : ""
|
|
393
|
+
}, /* @__PURE__ */ o.createElement(Dt, null)), p.orderedList && /* @__PURE__ */ o.createElement("button", {
|
|
394
394
|
"data-command": "insertOrderedList",
|
|
395
395
|
title: "OrderedList",
|
|
396
396
|
onMouseDown: F,
|
|
397
|
-
className:
|
|
398
|
-
}, /* @__PURE__ */ o.createElement(
|
|
397
|
+
className: M.orderedList ? "rte-active" : ""
|
|
398
|
+
}, /* @__PURE__ */ o.createElement(Mt, null)), p.link && /* @__PURE__ */ o.createElement("button", {
|
|
399
399
|
"data-command": "createLink",
|
|
400
400
|
title: "Link",
|
|
401
|
-
onClick:
|
|
402
|
-
className:
|
|
403
|
-
}, /* @__PURE__ */ o.createElement(
|
|
401
|
+
onClick: R,
|
|
402
|
+
className: M.link ? "rte-active" : ""
|
|
403
|
+
}, /* @__PURE__ */ o.createElement(Tt, null)), p.removeFormat && /* @__PURE__ */ o.createElement("button", {
|
|
404
404
|
"data-command": "Remove format",
|
|
405
405
|
title: "removeFormat",
|
|
406
|
-
onMouseDown: (
|
|
407
|
-
|
|
406
|
+
onMouseDown: (m) => {
|
|
407
|
+
m.preventDefault(), i(), b();
|
|
408
408
|
},
|
|
409
|
-
className:
|
|
410
|
-
}, /* @__PURE__ */ o.createElement(
|
|
409
|
+
className: M.removeFormat ? "rte-active" : ""
|
|
410
|
+
}, /* @__PURE__ */ o.createElement(Ft, null)), p.image && /* @__PURE__ */ o.createElement("button", {
|
|
411
411
|
"data-command": "insertImage",
|
|
412
412
|
title: "Image",
|
|
413
413
|
onMouseDown: F,
|
|
414
|
-
className:
|
|
415
|
-
}, /* @__PURE__ */ o.createElement(
|
|
414
|
+
className: M.image ? "rte-active" : ""
|
|
415
|
+
}, /* @__PURE__ */ o.createElement(St, null)), /* @__PURE__ */ o.createElement("input", {
|
|
416
416
|
type: "file",
|
|
417
417
|
accept: "image/*",
|
|
418
|
-
ref:
|
|
418
|
+
ref: k,
|
|
419
419
|
style: {
|
|
420
420
|
display: "none"
|
|
421
421
|
},
|
|
422
422
|
onChange: d
|
|
423
|
-
}),
|
|
423
|
+
}), p.emoji && /* @__PURE__ */ o.createElement("div", {
|
|
424
424
|
style: {
|
|
425
425
|
position: "relative"
|
|
426
426
|
}
|
|
427
427
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
428
428
|
title: "Emoji",
|
|
429
|
-
onMouseDown: (
|
|
430
|
-
|
|
431
|
-
const
|
|
429
|
+
onMouseDown: (m) => {
|
|
430
|
+
m.preventDefault(), i();
|
|
431
|
+
const C = m.currentTarget.getBoundingClientRect();
|
|
432
432
|
B({
|
|
433
|
-
x:
|
|
434
|
-
y:
|
|
433
|
+
x: C.left,
|
|
434
|
+
y: C.bottom + 8
|
|
435
435
|
// small spacing
|
|
436
|
-
}),
|
|
436
|
+
}), W((H) => !H);
|
|
437
437
|
},
|
|
438
|
-
className:
|
|
439
|
-
}, /* @__PURE__ */ o.createElement(
|
|
438
|
+
className: M.emoji ? "rte-active" : ""
|
|
439
|
+
}, /* @__PURE__ */ o.createElement(Ot, null)), K && /* @__PURE__ */ pt(/* @__PURE__ */ o.createElement("div", {
|
|
440
440
|
className: "rte-emoji-popup",
|
|
441
441
|
style: {
|
|
442
442
|
top: q.y,
|
|
443
443
|
left: q.x
|
|
444
444
|
}
|
|
445
|
-
},
|
|
446
|
-
key:
|
|
445
|
+
}, Pt.map((m, C) => /* @__PURE__ */ o.createElement("span", {
|
|
446
|
+
key: C,
|
|
447
447
|
style: {
|
|
448
448
|
fontSize: "20px",
|
|
449
449
|
cursor: "pointer",
|
|
450
450
|
textAlign: "center"
|
|
451
451
|
},
|
|
452
452
|
onMouseDown: (H) => {
|
|
453
|
-
H.preventDefault(),
|
|
453
|
+
H.preventDefault(), w(m), W(!1);
|
|
454
454
|
}
|
|
455
|
-
},
|
|
455
|
+
}, m))), document.body)), p.color && /* @__PURE__ */ o.createElement("div", {
|
|
456
456
|
style: {
|
|
457
457
|
position: "relative"
|
|
458
458
|
}
|
|
459
459
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
460
460
|
title: "Text Color",
|
|
461
|
-
onMouseDown: (
|
|
462
|
-
var
|
|
463
|
-
|
|
461
|
+
onMouseDown: (m) => {
|
|
462
|
+
var C;
|
|
463
|
+
m.preventDefault(), i(), (C = _.current) == null || C.click();
|
|
464
464
|
},
|
|
465
465
|
style: {
|
|
466
466
|
display: "flex",
|
|
467
467
|
alignItems: "center",
|
|
468
468
|
justifyContent: "center",
|
|
469
|
-
color: ((
|
|
469
|
+
color: ((U = _.current) == null ? void 0 : U.value) || "#000",
|
|
470
470
|
fontSize: "18px"
|
|
471
471
|
},
|
|
472
|
-
className:
|
|
473
|
-
}, /* @__PURE__ */ o.createElement(
|
|
474
|
-
ref:
|
|
472
|
+
className: M.color ? "rte-active" : ""
|
|
473
|
+
}, /* @__PURE__ */ o.createElement(jt, null)), /* @__PURE__ */ o.createElement("input", {
|
|
474
|
+
ref: _,
|
|
475
475
|
type: "color",
|
|
476
476
|
defaultValue: "#000000",
|
|
477
|
-
onChange: (
|
|
478
|
-
var
|
|
479
|
-
|
|
477
|
+
onChange: (m) => {
|
|
478
|
+
var C;
|
|
479
|
+
G(m), ((C = m.target.parentElement) == null ? void 0 : C.querySelector("button")).style.color = m.target.value;
|
|
480
480
|
},
|
|
481
481
|
style: {
|
|
482
482
|
position: "absolute",
|
|
@@ -485,30 +485,30 @@ const _t = [
|
|
|
485
485
|
height: 0,
|
|
486
486
|
pointerEvents: "none"
|
|
487
487
|
}
|
|
488
|
-
})),
|
|
488
|
+
})), p.highlight && /* @__PURE__ */ o.createElement("div", {
|
|
489
489
|
style: {
|
|
490
490
|
position: "relative"
|
|
491
491
|
}
|
|
492
492
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
493
493
|
title: "Highlight",
|
|
494
|
-
onMouseDown: (
|
|
495
|
-
var
|
|
496
|
-
|
|
494
|
+
onMouseDown: (m) => {
|
|
495
|
+
var C;
|
|
496
|
+
m.preventDefault(), i(), (C = L.current) == null || C.click();
|
|
497
497
|
},
|
|
498
498
|
style: {
|
|
499
499
|
display: "flex",
|
|
500
500
|
alignItems: "center",
|
|
501
501
|
justifyContent: "center",
|
|
502
|
-
color: ((
|
|
502
|
+
color: ((D = L.current) == null ? void 0 : D.value) || "#000",
|
|
503
503
|
fontSize: "18px"
|
|
504
504
|
},
|
|
505
|
-
className:
|
|
506
|
-
}, /* @__PURE__ */ o.createElement(
|
|
505
|
+
className: M.highlight ? "rte-active" : ""
|
|
506
|
+
}, /* @__PURE__ */ o.createElement(kt, null)), /* @__PURE__ */ o.createElement("input", {
|
|
507
507
|
ref: L,
|
|
508
508
|
type: "color",
|
|
509
|
-
onChange: (
|
|
510
|
-
var
|
|
511
|
-
|
|
509
|
+
onChange: (m) => {
|
|
510
|
+
var C;
|
|
511
|
+
ee(m), ((C = m.target.parentElement) == null ? void 0 : C.querySelector("button")).style.color = m.target.value;
|
|
512
512
|
},
|
|
513
513
|
defaultValue: "#000000",
|
|
514
514
|
style: {
|
|
@@ -518,31 +518,31 @@ const _t = [
|
|
|
518
518
|
height: 0,
|
|
519
519
|
pointerEvents: "none"
|
|
520
520
|
}
|
|
521
|
-
})),
|
|
521
|
+
})), p.align && /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("button", {
|
|
522
522
|
title: "Align Left",
|
|
523
|
-
onMouseDown: (
|
|
523
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
524
524
|
onClick: () => r("justifyLeft"),
|
|
525
|
-
className:
|
|
526
|
-
}, /* @__PURE__ */ o.createElement(
|
|
525
|
+
className: M.alignLeft ? "rte-active" : ""
|
|
526
|
+
}, /* @__PURE__ */ o.createElement(At, null)), /* @__PURE__ */ o.createElement("button", {
|
|
527
527
|
title: "Align Center",
|
|
528
|
-
onMouseDown: (
|
|
528
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
529
529
|
onClick: () => r("justifyCenter"),
|
|
530
|
-
className:
|
|
531
|
-
}, /* @__PURE__ */ o.createElement(
|
|
530
|
+
className: M.alignCenter ? "rte-active" : ""
|
|
531
|
+
}, /* @__PURE__ */ o.createElement(xt, null)), /* @__PURE__ */ o.createElement("button", {
|
|
532
532
|
title: "Align Right",
|
|
533
|
-
onMouseDown: (
|
|
533
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
534
534
|
onClick: () => r("justifyRight"),
|
|
535
|
-
className:
|
|
536
|
-
}, /* @__PURE__ */ o.createElement(
|
|
535
|
+
className: M.alignRight ? "rte-active" : ""
|
|
536
|
+
}, /* @__PURE__ */ o.createElement(Lt, null))), p.table && /* @__PURE__ */ o.createElement("button", {
|
|
537
537
|
title: "Insert Table",
|
|
538
|
-
onMouseDown: (
|
|
538
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
539
539
|
onClick: () => r("insertTable"),
|
|
540
|
-
className:
|
|
541
|
-
}, /* @__PURE__ */ o.createElement(
|
|
540
|
+
className: M.table ? "rte-active" : ""
|
|
541
|
+
}, /* @__PURE__ */ o.createElement(Ht, null)), p.fontFamily && /* @__PURE__ */ o.createElement("select", {
|
|
542
542
|
className: "rte-dropdown",
|
|
543
543
|
defaultValue: "",
|
|
544
|
-
onMouseDown: () =>
|
|
545
|
-
onChange:
|
|
544
|
+
onMouseDown: () => i(),
|
|
545
|
+
onChange: f
|
|
546
546
|
}, /* @__PURE__ */ o.createElement("option", {
|
|
547
547
|
value: "",
|
|
548
548
|
disabled: !0
|
|
@@ -556,62 +556,59 @@ const _t = [
|
|
|
556
556
|
value: "Courier New"
|
|
557
557
|
}, "Courier New"), /* @__PURE__ */ o.createElement("option", {
|
|
558
558
|
value: "Verdana"
|
|
559
|
-
}, "Verdana")),
|
|
560
|
-
className: "rte-dropdown",
|
|
559
|
+
}, "Verdana")), p.fontSize && /* @__PURE__ */ o.createElement("select", {
|
|
560
|
+
className: "rte-dropdown rte-fontsize-dropdown",
|
|
561
561
|
defaultValue: "",
|
|
562
|
-
onMouseDown: () =>
|
|
562
|
+
onMouseDown: () => i(),
|
|
563
563
|
onChange: u
|
|
564
564
|
}, /* @__PURE__ */ o.createElement("option", {
|
|
565
565
|
value: "",
|
|
566
566
|
disabled: !0
|
|
567
|
-
}, "Font Size"),
|
|
568
|
-
|
|
569
|
-
},
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
value: "5"
|
|
575
|
-
}, "Large")));
|
|
576
|
-
}, Pt = ({
|
|
567
|
+
}, "Font Size"), Array.from({
|
|
568
|
+
length: 16
|
|
569
|
+
}, (m, C) => 10 + C).map((m) => /* @__PURE__ */ o.createElement("option", {
|
|
570
|
+
key: m,
|
|
571
|
+
value: m
|
|
572
|
+
}, m, "px"))));
|
|
573
|
+
}, Bt = ({
|
|
577
574
|
show: r,
|
|
578
|
-
position:
|
|
575
|
+
position: i,
|
|
579
576
|
filtered: d,
|
|
580
577
|
insertMention: u,
|
|
581
|
-
onClose:
|
|
582
|
-
query:
|
|
578
|
+
onClose: f,
|
|
579
|
+
query: w
|
|
583
580
|
}) => {
|
|
584
|
-
const
|
|
581
|
+
const R = P(null);
|
|
585
582
|
return I(() => {
|
|
586
|
-
const
|
|
587
|
-
|
|
583
|
+
const b = (p) => {
|
|
584
|
+
R.current && !R.current.contains(p.target) && f();
|
|
588
585
|
};
|
|
589
|
-
return r && document.addEventListener("mousedown",
|
|
590
|
-
document.removeEventListener("mousedown",
|
|
586
|
+
return r && document.addEventListener("mousedown", b), () => {
|
|
587
|
+
document.removeEventListener("mousedown", b);
|
|
591
588
|
};
|
|
592
|
-
}, [r,
|
|
593
|
-
ref:
|
|
589
|
+
}, [r, f]), r ? /* @__PURE__ */ o.createElement("ul", {
|
|
590
|
+
ref: R,
|
|
594
591
|
className: "rte-popup",
|
|
595
592
|
style: {
|
|
596
|
-
top:
|
|
597
|
-
left:
|
|
593
|
+
top: i.y,
|
|
594
|
+
left: i.x
|
|
598
595
|
}
|
|
599
596
|
}, d.length > 0 ? d.map(({
|
|
600
|
-
name:
|
|
601
|
-
value:
|
|
597
|
+
name: b,
|
|
598
|
+
value: p
|
|
602
599
|
}) => {
|
|
603
|
-
const O =
|
|
604
|
-
let
|
|
605
|
-
if (
|
|
606
|
-
const L =
|
|
607
|
-
|
|
600
|
+
const O = b.toLowerCase(), j = w.toLowerCase(), k = O.indexOf(j);
|
|
601
|
+
let _ = b;
|
|
602
|
+
if (k !== -1 && w.length > 0) {
|
|
603
|
+
const L = k + w.length;
|
|
604
|
+
_ = b.substring(0, k) + `<span class="rte-highlight">${b.substring(k, L)}</span>` + b.substring(L);
|
|
608
605
|
}
|
|
609
606
|
return /* @__PURE__ */ o.createElement("li", {
|
|
610
|
-
key:
|
|
607
|
+
key: p,
|
|
611
608
|
onMouseDown: (L) => {
|
|
612
609
|
L.preventDefault(), u({
|
|
613
|
-
name:
|
|
614
|
-
value:
|
|
610
|
+
name: b,
|
|
611
|
+
value: p
|
|
615
612
|
});
|
|
616
613
|
},
|
|
617
614
|
style: {
|
|
@@ -620,7 +617,7 @@ const _t = [
|
|
|
620
617
|
fontSize: "14px"
|
|
621
618
|
},
|
|
622
619
|
dangerouslySetInnerHTML: {
|
|
623
|
-
__html:
|
|
620
|
+
__html: _
|
|
624
621
|
},
|
|
625
622
|
onMouseEnter: (L) => L.currentTarget.style.background = "#f0f0f0",
|
|
626
623
|
onMouseLeave: (L) => L.currentTarget.style.background = "#fff"
|
|
@@ -632,81 +629,81 @@ const _t = [
|
|
|
632
629
|
}
|
|
633
630
|
}, "No matches")) : null;
|
|
634
631
|
};
|
|
635
|
-
function
|
|
632
|
+
function Ae(r) {
|
|
636
633
|
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Minus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z" }, child: [] }] }] }] })(r);
|
|
637
634
|
}
|
|
638
|
-
function
|
|
635
|
+
function Z(r) {
|
|
639
636
|
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Plus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z" }, child: [] }] }] }] })(r);
|
|
640
637
|
}
|
|
641
|
-
const
|
|
638
|
+
const qt = ({
|
|
642
639
|
visible: r,
|
|
643
|
-
x:
|
|
640
|
+
x: i,
|
|
644
641
|
y: d,
|
|
645
642
|
onAction: u,
|
|
646
|
-
onClose:
|
|
643
|
+
onClose: f
|
|
647
644
|
}) => {
|
|
648
645
|
if (!r) return null;
|
|
649
|
-
const
|
|
646
|
+
const w = {
|
|
650
647
|
top: d,
|
|
651
|
-
left:
|
|
648
|
+
left: i
|
|
652
649
|
};
|
|
653
650
|
return /* @__PURE__ */ o.createElement("div", {
|
|
654
|
-
style:
|
|
651
|
+
style: w,
|
|
655
652
|
className: "rte-table-menu",
|
|
656
|
-
onMouseLeave:
|
|
653
|
+
onMouseLeave: f
|
|
657
654
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
658
655
|
onClick: () => u("insertRowAbove")
|
|
659
|
-
}, /* @__PURE__ */ o.createElement(
|
|
656
|
+
}, /* @__PURE__ */ o.createElement(Z, null), " Insert row above"), /* @__PURE__ */ o.createElement("button", {
|
|
660
657
|
onClick: () => u("insertRowBelow")
|
|
661
|
-
}, /* @__PURE__ */ o.createElement(
|
|
658
|
+
}, /* @__PURE__ */ o.createElement(Z, null), " Insert row below"), /* @__PURE__ */ o.createElement("button", {
|
|
662
659
|
onClick: () => u("insertColLeft")
|
|
663
|
-
}, /* @__PURE__ */ o.createElement(
|
|
660
|
+
}, /* @__PURE__ */ o.createElement(Z, null), " Insert col left"), /* @__PURE__ */ o.createElement("button", {
|
|
664
661
|
onClick: () => u("insertColRight")
|
|
665
|
-
}, /* @__PURE__ */ o.createElement(
|
|
662
|
+
}, /* @__PURE__ */ o.createElement(Z, null), " Insert col right"), /* @__PURE__ */ o.createElement("button", {
|
|
666
663
|
onClick: () => u("deleteRow")
|
|
667
|
-
}, /* @__PURE__ */ o.createElement(
|
|
664
|
+
}, /* @__PURE__ */ o.createElement(Ae, null), " Delete row"), /* @__PURE__ */ o.createElement("button", {
|
|
668
665
|
onClick: () => u("deleteCol")
|
|
669
|
-
}, /* @__PURE__ */ o.createElement(
|
|
670
|
-
},
|
|
666
|
+
}, /* @__PURE__ */ o.createElement(Ae, null), " Delete column"));
|
|
667
|
+
}, Ut = ({
|
|
671
668
|
html: r,
|
|
672
|
-
className:
|
|
669
|
+
className: i,
|
|
673
670
|
style: d
|
|
674
671
|
}) => {
|
|
675
|
-
const u = (
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
const
|
|
680
|
-
|
|
672
|
+
const u = (w) => {
|
|
673
|
+
const R = w.target;
|
|
674
|
+
if (R.tagName === "A") {
|
|
675
|
+
w.preventDefault();
|
|
676
|
+
const b = R.href;
|
|
677
|
+
b && window.open(b, "_blank", "noopener,noreferrer");
|
|
681
678
|
}
|
|
682
|
-
},
|
|
683
|
-
let
|
|
684
|
-
return
|
|
679
|
+
}, f = (w) => {
|
|
680
|
+
let R = w.replace(/{{\s*(.*?)\s*}}/g, (b, p) => `<span style="color: blue">${p}</span>`);
|
|
681
|
+
return R = R.replace(/#arrayData/g, ""), R = R.replace(/\/arrayData/g, ""), R;
|
|
685
682
|
};
|
|
686
683
|
return /* @__PURE__ */ o.createElement("div", {
|
|
687
|
-
className: `rte-preview ${
|
|
684
|
+
className: `rte-preview ${i || ""}`,
|
|
688
685
|
style: d,
|
|
689
686
|
onClick: u,
|
|
690
687
|
dangerouslySetInnerHTML: {
|
|
691
|
-
__html:
|
|
688
|
+
__html: f(r)
|
|
692
689
|
}
|
|
693
690
|
});
|
|
694
|
-
},
|
|
691
|
+
}, Vt = ({
|
|
695
692
|
visible: r,
|
|
696
|
-
linkData:
|
|
693
|
+
linkData: i,
|
|
697
694
|
onClose: d,
|
|
698
695
|
onInsert: u
|
|
699
696
|
}) => {
|
|
700
|
-
const [
|
|
697
|
+
const [f, w] = A(""), [R, b] = A(""), [p, O] = A(""), [j, k] = A("_self");
|
|
701
698
|
if (I(() => {
|
|
702
|
-
r ? (
|
|
703
|
-
}, [r,
|
|
704
|
-
const
|
|
699
|
+
r ? (w(i.url || ""), b(i.text || ""), O(i.title || ""), k(i.target || "_self")) : (w(""), b(""), O(""), k("_self"));
|
|
700
|
+
}, [r, i]), !r) return null;
|
|
701
|
+
const _ = () => {
|
|
705
702
|
u({
|
|
706
|
-
url:
|
|
707
|
-
text:
|
|
708
|
-
title:
|
|
709
|
-
target:
|
|
703
|
+
url: f,
|
|
704
|
+
text: R,
|
|
705
|
+
title: p,
|
|
706
|
+
target: j
|
|
710
707
|
});
|
|
711
708
|
};
|
|
712
709
|
return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
|
|
@@ -716,28 +713,28 @@ const It = ({
|
|
|
716
713
|
className: "rte-link-modal"
|
|
717
714
|
}, /* @__PURE__ */ o.createElement("h4", {
|
|
718
715
|
className: "rte-link-modal__title"
|
|
719
|
-
},
|
|
716
|
+
}, f ? "Edit Link" : "Insert Link"), /* @__PURE__ */ o.createElement("input", {
|
|
720
717
|
type: "text",
|
|
721
718
|
className: "rte-link-modal__input",
|
|
722
719
|
placeholder: "URL",
|
|
723
|
-
value:
|
|
724
|
-
onChange: (L) =>
|
|
720
|
+
value: f,
|
|
721
|
+
onChange: (L) => w(L.target.value)
|
|
725
722
|
}), /* @__PURE__ */ o.createElement("input", {
|
|
726
723
|
type: "text",
|
|
727
724
|
className: "rte-link-modal__input",
|
|
728
725
|
placeholder: "Text to Display",
|
|
729
|
-
value:
|
|
730
|
-
onChange: (L) =>
|
|
726
|
+
value: R,
|
|
727
|
+
onChange: (L) => b(L.target.value)
|
|
731
728
|
}), /* @__PURE__ */ o.createElement("input", {
|
|
732
729
|
type: "text",
|
|
733
730
|
className: "rte-link-modal__input",
|
|
734
731
|
placeholder: "Title",
|
|
735
|
-
value:
|
|
732
|
+
value: p,
|
|
736
733
|
onChange: (L) => O(L.target.value)
|
|
737
734
|
}), /* @__PURE__ */ o.createElement("select", {
|
|
738
735
|
className: "rte-link-modal__select",
|
|
739
|
-
value:
|
|
740
|
-
onChange: (L) =>
|
|
736
|
+
value: j,
|
|
737
|
+
onChange: (L) => k(L.target.value)
|
|
741
738
|
}, /* @__PURE__ */ o.createElement("option", {
|
|
742
739
|
value: "_self"
|
|
743
740
|
}, "Same tab"), /* @__PURE__ */ o.createElement("option", {
|
|
@@ -749,15 +746,15 @@ const It = ({
|
|
|
749
746
|
onClick: d
|
|
750
747
|
}, "Cancel"), /* @__PURE__ */ o.createElement("button", {
|
|
751
748
|
className: "rte-link-modal__btn rte-link-modal__btn--ok",
|
|
752
|
-
onClick:
|
|
749
|
+
onClick: _
|
|
753
750
|
}, "OK"))));
|
|
754
751
|
};
|
|
755
|
-
function
|
|
756
|
-
return Array.from(new Map(r.map((
|
|
752
|
+
function ze(r) {
|
|
753
|
+
return Array.from(new Map(r.map((i) => [i.value, i])).values());
|
|
757
754
|
}
|
|
758
|
-
const
|
|
755
|
+
const Xt = ({
|
|
759
756
|
atSuggestions: r = [],
|
|
760
|
-
showOutput:
|
|
757
|
+
showOutput: i = !1,
|
|
761
758
|
showPreview: d = !1,
|
|
762
759
|
toolbarConfig: u = {
|
|
763
760
|
link: !1,
|
|
@@ -769,27 +766,27 @@ const Wt = ({
|
|
|
769
766
|
fontSize: !1,
|
|
770
767
|
highlight: !1
|
|
771
768
|
},
|
|
772
|
-
classNames:
|
|
773
|
-
styles:
|
|
774
|
-
handleGetHtml:
|
|
769
|
+
classNames: f = {},
|
|
770
|
+
styles: w = {},
|
|
771
|
+
handleGetHtml: R = () => {
|
|
775
772
|
},
|
|
776
|
-
onChange:
|
|
773
|
+
onChange: b = () => {
|
|
777
774
|
},
|
|
778
|
-
value:
|
|
775
|
+
value: p,
|
|
779
776
|
onMentionSelect: O = () => {
|
|
780
777
|
},
|
|
781
|
-
handleAddAttributes:
|
|
778
|
+
handleAddAttributes: j = () => {
|
|
782
779
|
}
|
|
783
780
|
}) => {
|
|
784
|
-
var he, pe, ve,
|
|
785
|
-
const
|
|
781
|
+
var he, pe, ve, ye, Ee, we, Ce, be;
|
|
782
|
+
const k = P(null), [_, L] = A(p != null && p.length ? p : " "), [K, W] = A(""), [q, B] = A(!1), [F, G] = A({
|
|
786
783
|
x: 0,
|
|
787
784
|
y: 0
|
|
788
|
-
}), [
|
|
785
|
+
}), [ee, M] = A([]), N = P(null), U = P(null), [D, m] = A({
|
|
789
786
|
visible: !1,
|
|
790
787
|
x: 0,
|
|
791
788
|
y: 0
|
|
792
|
-
}), [
|
|
789
|
+
}), [C, H] = A(!1), X = P(null), [Te, le] = A({
|
|
793
790
|
url: "",
|
|
794
791
|
text: "",
|
|
795
792
|
title: "",
|
|
@@ -805,57 +802,58 @@ const Wt = ({
|
|
|
805
802
|
link: (he = u.link) != null ? he : !1,
|
|
806
803
|
image: (pe = u.image) != null ? pe : !1,
|
|
807
804
|
emoji: (ve = u.emoji) != null ? ve : !1,
|
|
808
|
-
table: (
|
|
809
|
-
color: (
|
|
805
|
+
table: (ye = u.table) != null ? ye : !1,
|
|
806
|
+
color: (Ee = u.color) != null ? Ee : !1,
|
|
810
807
|
fontFamily: (we = u.fontFamily) != null ? we : !1,
|
|
811
808
|
fontSize: (Ce = u.fontSize) != null ? Ce : !1,
|
|
812
809
|
highlight: (be = u.fontSize) != null ? be : !1
|
|
813
|
-
}, [Oe, ce] =
|
|
814
|
-
const e = He();
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
810
|
+
}, [Oe, ce] = A(""), [ie, te] = A([]), T = () => k.current, S = () => {
|
|
811
|
+
const e = He(), t = /^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());
|
|
812
|
+
let n = e;
|
|
813
|
+
t || (n = `<div style="font-size:12px">${e}</div>`), W(n), R == null || R(n);
|
|
814
|
+
const a = ot(e);
|
|
815
|
+
b(a);
|
|
816
|
+
const s = $e(), l = ze(s);
|
|
817
|
+
JSON.stringify(l) !== JSON.stringify(ie) && (te(l), O(l));
|
|
820
818
|
}, He = () => {
|
|
821
|
-
const e =
|
|
822
|
-
if (!e) return
|
|
819
|
+
const e = T();
|
|
820
|
+
if (!e) return _;
|
|
823
821
|
const t = e.cloneNode(!0);
|
|
824
822
|
t.querySelectorAll("table div").forEach((a) => a.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight"));
|
|
825
823
|
let n = t.innerHTML;
|
|
826
|
-
return n =
|
|
827
|
-
},
|
|
824
|
+
return n = _e(n), n;
|
|
825
|
+
}, _e = (e) => e.replace(/<tbody[^>]*>/g, "<tbody>{{#arrayData}}").replace(/<\/tbody>/g, "{{/arrayData}}</tbody>"), V = () => {
|
|
828
826
|
const e = window.getSelection();
|
|
829
827
|
if (!e || e.rangeCount === 0) return;
|
|
830
828
|
const t = document.getElementById("rte-editor-body");
|
|
831
829
|
if (!t) return;
|
|
832
830
|
const n = e.getRangeAt(0);
|
|
833
|
-
t.contains(n.startContainer) && (
|
|
834
|
-
},
|
|
831
|
+
t.contains(n.startContainer) && (N.current = n.cloneRange());
|
|
832
|
+
}, $ = () => {
|
|
835
833
|
const e = window.getSelection();
|
|
836
|
-
!e || !
|
|
834
|
+
!e || !N.current || (e.removeAllRanges(), e.addRange(N.current));
|
|
837
835
|
}, se = (e, t) => {
|
|
838
836
|
const n = window.getSelection();
|
|
839
|
-
n && n.rangeCount > 0 && (
|
|
837
|
+
n && n.rangeCount > 0 && (N.current = n.getRangeAt(0)), $(), document.execCommand(e, !1, t), S();
|
|
840
838
|
};
|
|
841
839
|
I(() => {
|
|
842
|
-
const e =
|
|
843
|
-
if (!e || !
|
|
844
|
-
const t =
|
|
845
|
-
e.innerHTML = t,
|
|
840
|
+
const e = T();
|
|
841
|
+
if (!e || !p) return;
|
|
842
|
+
const t = je(p);
|
|
843
|
+
e.innerHTML = t, S();
|
|
846
844
|
}, []);
|
|
847
|
-
const
|
|
845
|
+
const je = (e) => e.replace(/<span[^>]*data-hidden-table-start[^>]*>.*?<\/span>/g, "").replace(/<span[^>]*data-hidden-table-end[^>]*>.*?<\/span>/g, "").replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, "");
|
|
848
846
|
I(() => () => {
|
|
849
847
|
document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
|
|
850
848
|
}, []), I(() => {
|
|
851
|
-
|
|
852
|
-
|
|
849
|
+
j && j((e) => {
|
|
850
|
+
Ve(e);
|
|
853
851
|
});
|
|
854
852
|
}, []), I(() => {
|
|
855
|
-
const e =
|
|
853
|
+
const e = T();
|
|
856
854
|
if (!e) return;
|
|
857
855
|
e.querySelectorAll("table").forEach((n) => {
|
|
858
|
-
ge(n), n.querySelectorAll("th, td").forEach((s) =>
|
|
856
|
+
ge(n), n.querySelectorAll("th, td").forEach((s) => Y(s));
|
|
859
857
|
});
|
|
860
858
|
}, []);
|
|
861
859
|
const de = (e) => {
|
|
@@ -872,8 +870,8 @@ const Wt = ({
|
|
|
872
870
|
if (e.querySelector("[data-hidden-array-start]")) return;
|
|
873
871
|
const a = `{{#arrayData${n > 1 ? n : ""}}}`, s = `{{/arrayData${n > 1 ? n : ""}}}`, l = document.createElement("span");
|
|
874
872
|
l.textContent = a, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
|
|
875
|
-
const
|
|
876
|
-
|
|
873
|
+
const c = document.createElement("span");
|
|
874
|
+
c.textContent = s, c.style.display = "none", c.setAttribute("data-hidden-array-end", "true"), e.appendChild(c);
|
|
877
875
|
}, ue = (e) => {
|
|
878
876
|
var v;
|
|
879
877
|
const t = window.getSelection();
|
|
@@ -881,27 +879,27 @@ const Wt = ({
|
|
|
881
879
|
const n = t.getRangeAt(0), a = de(n.startContainer);
|
|
882
880
|
let s, l;
|
|
883
881
|
if (a) {
|
|
884
|
-
let
|
|
885
|
-
|
|
882
|
+
let h = a.querySelector(e);
|
|
883
|
+
h || (h = document.createElement(e), h.style.margin = "0", h.style.paddingLeft = "20px", a.appendChild(h)), l = h, s = document.createElement("li"), s.textContent = "", l.appendChild(s);
|
|
886
884
|
} else {
|
|
887
885
|
document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
|
|
888
|
-
const
|
|
889
|
-
if (l =
|
|
886
|
+
const h = T();
|
|
887
|
+
if (l = h == null ? void 0 : h.querySelector(`${e}:last-child`), !l) return;
|
|
890
888
|
s = l.querySelector("li:last-child");
|
|
891
889
|
}
|
|
892
890
|
Pe(l);
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
},
|
|
891
|
+
const c = document.createRange();
|
|
892
|
+
c.setStart(s, 0), c.collapse(!0), t.removeAllRanges(), t.addRange(c), (v = T()) == null || v.focus(), S();
|
|
893
|
+
}, ne = (e, t) => {
|
|
896
894
|
e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : e.startsWith("justify") ? ct(e) : se(e, t), e === "insertTable" && Qe();
|
|
897
895
|
}, Ie = (e) => {
|
|
898
896
|
const t = document.createElement("span");
|
|
899
897
|
t.textContent = "", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
|
|
900
898
|
const n = t.getBoundingClientRect();
|
|
901
|
-
t.remove(),
|
|
899
|
+
t.remove(), G({
|
|
902
900
|
x: n.left,
|
|
903
901
|
y: n.bottom + window.scrollY
|
|
904
|
-
}),
|
|
902
|
+
}), M(r || []), B(!0), U.current = e.cloneRange();
|
|
905
903
|
}, Be = () => {
|
|
906
904
|
const e = window.getSelection();
|
|
907
905
|
if (!e || e.rangeCount === 0) return null;
|
|
@@ -911,10 +909,10 @@ const Wt = ({
|
|
|
911
909
|
let a = t;
|
|
912
910
|
for (a.nodeType !== Node.TEXT_NODE && (a.childNodes && a.childNodes[n] ? a = a.childNodes[n] : a = t.previousSibling); a; ) {
|
|
913
911
|
if (a.nodeType === Node.TEXT_NODE) {
|
|
914
|
-
const s = a.textContent || "", l = a === t ? n : s.length,
|
|
915
|
-
if (
|
|
912
|
+
const s = a.textContent || "", l = a === t ? n : s.length, c = s.lastIndexOf("@", l - 1);
|
|
913
|
+
if (c !== -1) {
|
|
916
914
|
const v = document.createRange();
|
|
917
|
-
return v.setStart(a,
|
|
915
|
+
return v.setStart(a, c), v.setEnd(a, l), v;
|
|
918
916
|
}
|
|
919
917
|
}
|
|
920
918
|
a = a.previousSibling;
|
|
@@ -925,81 +923,81 @@ const Wt = ({
|
|
|
925
923
|
const t = window.getSelection();
|
|
926
924
|
if (!t) return;
|
|
927
925
|
const n = Be();
|
|
928
|
-
n ? (t.removeAllRanges(), t.addRange(n)) :
|
|
926
|
+
n ? (t.removeAllRanges(), t.addRange(n)) : U.current && (t.removeAllRanges(), t.addRange(U.current));
|
|
929
927
|
const a = document.createElement("span");
|
|
930
|
-
a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.
|
|
928
|
+
a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.setAttribute("data-mention", e.value || e.name || "");
|
|
931
929
|
try {
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
|
|
930
|
+
const c = t.rangeCount ? t.getRangeAt(0) : null;
|
|
931
|
+
if (c)
|
|
932
|
+
c.deleteContents(), c.insertNode(a);
|
|
935
933
|
else {
|
|
936
|
-
const
|
|
937
|
-
|
|
934
|
+
const E = document.createRange(), g = T();
|
|
935
|
+
E.selectNodeContents(g), E.collapse(!1), E.insertNode(a);
|
|
938
936
|
}
|
|
939
937
|
const v = document.createTextNode(" ");
|
|
940
938
|
a.after(v);
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
} catch (
|
|
944
|
-
console.error("insertMention error:",
|
|
939
|
+
const h = document.createRange();
|
|
940
|
+
h.setStartAfter(v), h.collapse(!0), t.removeAllRanges(), t.addRange(h);
|
|
941
|
+
} catch (c) {
|
|
942
|
+
console.error("insertMention error:", c);
|
|
945
943
|
}
|
|
946
|
-
let s =
|
|
947
|
-
|
|
948
|
-
},
|
|
949
|
-
const t =
|
|
944
|
+
let s = ze([...ie, e]);
|
|
945
|
+
te(s), O(s), B(!1), (l = T()) == null || l.focus(), S();
|
|
946
|
+
}, Ue = (e) => {
|
|
947
|
+
const t = T();
|
|
950
948
|
if (!t) return;
|
|
951
949
|
let n = null;
|
|
952
|
-
|
|
950
|
+
N.current && t.contains(N.current.startContainer) ? n = N.current.cloneRange() : (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1));
|
|
953
951
|
const a = window.getSelection();
|
|
954
952
|
if (!a) return;
|
|
955
953
|
a.removeAllRanges(), a.addRange(n);
|
|
956
954
|
const s = document.createElement("span");
|
|
957
|
-
s.textContent = `{{${e.name}}}`, s.style.display = "inline", s.
|
|
955
|
+
s.textContent = `{{${e.name}}}`, s.style.display = "inline", s.setAttribute("data-mention", e.value || e.name), n.insertNode(s);
|
|
958
956
|
const l = document.createTextNode(" ");
|
|
959
957
|
s.after(l);
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
},
|
|
963
|
-
e.forEach((t) =>
|
|
958
|
+
const c = document.createRange();
|
|
959
|
+
c.setStartAfter(l), c.collapse(!0), a.removeAllRanges(), a.addRange(c), N.current = c.cloneRange(), t.focus();
|
|
960
|
+
}, Ve = (e) => {
|
|
961
|
+
e.forEach((t) => Ue(t)), te((t) => {
|
|
964
962
|
const n = [...t, ...e], a = Array.from(new Map(n.map((s) => [s.name, s])).values());
|
|
965
963
|
return O(a), a;
|
|
966
|
-
}),
|
|
964
|
+
}), S();
|
|
967
965
|
}, $e = () => {
|
|
968
|
-
const e =
|
|
966
|
+
const e = T();
|
|
969
967
|
if (!e) return [];
|
|
970
968
|
const t = e.querySelectorAll("span[data-mention]"), n = [];
|
|
971
969
|
return t.forEach((a) => {
|
|
972
|
-
const s = a.getAttribute("data-mention") || "",
|
|
973
|
-
|
|
974
|
-
name:
|
|
970
|
+
const s = a.getAttribute("data-mention") || "", c = (a.textContent || "").match(/{{(.+?)}}/);
|
|
971
|
+
c && n.push({
|
|
972
|
+
name: c[1],
|
|
975
973
|
value: s
|
|
976
974
|
});
|
|
977
975
|
}), n;
|
|
978
976
|
}, We = (e) => {
|
|
979
977
|
var n, a, s;
|
|
980
978
|
const t = e.key.toLowerCase();
|
|
981
|
-
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(),
|
|
982
|
-
const l = window.getSelection(),
|
|
983
|
-
if (!
|
|
984
|
-
if (((n =
|
|
979
|
+
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), ne(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
|
|
980
|
+
const l = window.getSelection(), c = l != null && l.anchorNode ? de(l.anchorNode) : null;
|
|
981
|
+
if (!c) return;
|
|
982
|
+
if (((n = c.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
|
|
985
983
|
e.preventDefault();
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
988
|
-
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
const
|
|
992
|
-
|
|
984
|
+
const h = c.parentElement, E = h == null ? void 0 : h.closest("li");
|
|
985
|
+
if (E) {
|
|
986
|
+
h == null || h.removeChild(c);
|
|
987
|
+
const g = document.createElement("p");
|
|
988
|
+
g.innerHTML = "<br />", (a = E.parentElement) == null || a.insertBefore(g, E.nextSibling);
|
|
989
|
+
const y = document.createRange();
|
|
990
|
+
y.setStart(g, 0), y.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(y);
|
|
993
991
|
} else {
|
|
994
|
-
const
|
|
995
|
-
if (
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
const
|
|
999
|
-
|
|
992
|
+
const g = c.closest("ul, ol");
|
|
993
|
+
if (g) {
|
|
994
|
+
const y = document.createElement("p");
|
|
995
|
+
y.innerHTML = "<br />", (s = g.parentElement) == null || s.insertBefore(y, g.nextSibling), g.removeChild(c);
|
|
996
|
+
const x = document.createRange();
|
|
997
|
+
x.setStart(y, 0), x.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(x);
|
|
1000
998
|
}
|
|
1001
999
|
}
|
|
1002
|
-
|
|
1000
|
+
S();
|
|
1003
1001
|
}
|
|
1004
1002
|
}
|
|
1005
1003
|
}, Ke = (e) => {
|
|
@@ -1010,7 +1008,7 @@ const Wt = ({
|
|
|
1010
1008
|
if (Xe(a))
|
|
1011
1009
|
return;
|
|
1012
1010
|
setTimeout(() => {
|
|
1013
|
-
Ie(n.getRangeAt(0)), ce(""),
|
|
1011
|
+
Ie(n.getRangeAt(0)), ce(""), M(r), B(!0);
|
|
1014
1012
|
}, 0);
|
|
1015
1013
|
return;
|
|
1016
1014
|
}
|
|
@@ -1027,7 +1025,7 @@ const Wt = ({
|
|
|
1027
1025
|
}
|
|
1028
1026
|
return !1;
|
|
1029
1027
|
}, me = () => {
|
|
1030
|
-
if (
|
|
1028
|
+
if (S(), !q) return;
|
|
1031
1029
|
const e = window.getSelection();
|
|
1032
1030
|
if (!e || !e.anchorNode) return;
|
|
1033
1031
|
const n = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
|
|
@@ -1038,64 +1036,70 @@ const Wt = ({
|
|
|
1038
1036
|
const a = n[1].toLowerCase();
|
|
1039
1037
|
ce(a);
|
|
1040
1038
|
const s = r.filter((l) => l.name.toLowerCase().includes(a));
|
|
1041
|
-
|
|
1039
|
+
M(s);
|
|
1042
1040
|
}, Ye = (e) => {
|
|
1043
1041
|
var a;
|
|
1044
1042
|
const t = (a = e.target.files) == null ? void 0 : a[0];
|
|
1045
1043
|
if (!t) return;
|
|
1046
1044
|
const n = new FileReader();
|
|
1047
1045
|
n.onload = (s) => {
|
|
1048
|
-
var
|
|
1049
|
-
const l = (
|
|
1050
|
-
|
|
1051
|
-
const
|
|
1052
|
-
let v =
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1055
|
-
const
|
|
1056
|
-
if (!v || !
|
|
1057
|
-
|
|
1046
|
+
var x;
|
|
1047
|
+
const l = (x = s.target) == null ? void 0 : x.result;
|
|
1048
|
+
$();
|
|
1049
|
+
const c = window.getSelection();
|
|
1050
|
+
let v = c && c.rangeCount ? c.getRangeAt(0) : null;
|
|
1051
|
+
const h = document.createElement("img");
|
|
1052
|
+
h.src = l, h.alt = t.name || "image", h.className = "rte-inserted-image", h.contentEditable = "true";
|
|
1053
|
+
const E = T();
|
|
1054
|
+
if (!v || !E) {
|
|
1055
|
+
E == null || E.appendChild(h);
|
|
1058
1056
|
const Re = document.createTextNode(" ");
|
|
1059
|
-
|
|
1057
|
+
E == null || E.appendChild(Re);
|
|
1060
1058
|
const re = document.createRange();
|
|
1061
|
-
re.setStartAfter(Re), re.collapse(!0),
|
|
1059
|
+
re.setStartAfter(Re), re.collapse(!0), c == null || c.removeAllRanges(), c == null || c.addRange(re), E == null || E.focus(), S(), e.target.value = "";
|
|
1062
1060
|
return;
|
|
1063
1061
|
}
|
|
1064
|
-
v.deleteContents(), v.insertNode(
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1062
|
+
v.deleteContents(), v.insertNode(h);
|
|
1063
|
+
const g = document.createTextNode(" ");
|
|
1064
|
+
h.after(g);
|
|
1065
|
+
const y = document.createRange();
|
|
1066
|
+
y.setStartAfter(g), y.collapse(!0), c.removeAllRanges(), c.addRange(y), E.focus(), S(), e.target.value = "";
|
|
1069
1067
|
}, n.readAsDataURL(t);
|
|
1070
1068
|
}, Ze = (e) => {
|
|
1071
1069
|
var s;
|
|
1072
|
-
|
|
1070
|
+
$();
|
|
1073
1071
|
const t = window.getSelection();
|
|
1074
1072
|
if (!(t != null && t.rangeCount)) return;
|
|
1075
1073
|
const n = t.getRangeAt(0), a = document.createTextNode(e);
|
|
1076
|
-
n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s =
|
|
1074
|
+
n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = T()) == null || s.focus(), S();
|
|
1077
1075
|
}, Qe = () => {
|
|
1078
|
-
|
|
1076
|
+
var E;
|
|
1077
|
+
$();
|
|
1079
1078
|
const e = document.createElement("table");
|
|
1080
|
-
e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative",
|
|
1079
|
+
e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative", f.table && e.classList.add(f.table);
|
|
1081
1080
|
const t = document.createElement("thead");
|
|
1082
|
-
|
|
1081
|
+
f.thead && t.classList.add(f.thead);
|
|
1083
1082
|
const n = document.createElement("tbody");
|
|
1084
|
-
|
|
1083
|
+
f.tbody && n.classList.add(f.tbody);
|
|
1085
1084
|
const a = document.createElement("tr");
|
|
1086
|
-
|
|
1085
|
+
f.tr && a.classList.add(f.tr);
|
|
1087
1086
|
const s = document.createElement("tr");
|
|
1088
|
-
|
|
1089
|
-
for (let
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1087
|
+
f.tr && s.classList.add(f.tr);
|
|
1088
|
+
for (let g = 0; g < 2; g++) {
|
|
1089
|
+
const y = document.createElement("th");
|
|
1090
|
+
y.textContent = `Header ${g + 1}`, y.style.border = "1px solid #999", y.style.padding = "4px", y.style.position = "relative", y.style.backgroundColor = "lightgray", f.th && y.classList.add(f.th);
|
|
1091
|
+
const x = document.createElement("td");
|
|
1092
|
+
x.textContent = `Row 1 Col ${g + 1}`, x.style.border = "1px solid #999", x.style.padding = "4px", x.style.position = "relative", x.style.backgroundColor = "#fff", f.td && x.classList.add(f.td), Y(y), Y(x), a.appendChild(y), s.appendChild(x);
|
|
1094
1093
|
}
|
|
1095
1094
|
t.appendChild(a), n.appendChild(s), e.appendChild(t), e.appendChild(n), ge(e);
|
|
1096
1095
|
const l = window.getSelection();
|
|
1097
1096
|
if (!(l != null && l.rangeCount)) return;
|
|
1098
|
-
l.getRangeAt(0)
|
|
1097
|
+
const c = l.getRangeAt(0);
|
|
1098
|
+
c.collapse(!1), c.insertNode(e);
|
|
1099
|
+
const v = document.createElement("p");
|
|
1100
|
+
v.innerHTML = "<br/>", e.after(v);
|
|
1101
|
+
const h = document.createRange();
|
|
1102
|
+
h.setStart(v, 0), h.collapse(!0), l.removeAllRanges(), l.addRange(h), (E = T()) == null || E.focus(), S();
|
|
1099
1103
|
}, ge = (e) => {
|
|
1100
1104
|
const t = document.createElement("div");
|
|
1101
1105
|
Object.assign(t.style, {
|
|
@@ -1108,21 +1112,21 @@ const Wt = ({
|
|
|
1108
1112
|
cursor: "nwse-resize",
|
|
1109
1113
|
zIndex: "20",
|
|
1110
1114
|
borderRadius: "2px"
|
|
1111
|
-
});
|
|
1115
|
+
}), t.style.userSelect = "none", t.contentEditable = "false";
|
|
1112
1116
|
let n = 0, a = 0, s = 0, l = 0;
|
|
1113
|
-
t.addEventListener("mousedown", (
|
|
1114
|
-
|
|
1117
|
+
t.addEventListener("mousedown", (c) => {
|
|
1118
|
+
c.preventDefault(), n = c.clientX, a = c.clientY;
|
|
1115
1119
|
const v = e.getBoundingClientRect();
|
|
1116
1120
|
s = v.width, l = v.height;
|
|
1117
|
-
const
|
|
1118
|
-
const
|
|
1119
|
-
e.style.width = `${
|
|
1120
|
-
},
|
|
1121
|
-
document.removeEventListener("mousemove",
|
|
1121
|
+
const h = (g) => {
|
|
1122
|
+
const y = Math.max(100, s + (g.clientX - n)), x = Math.max(60, l + (g.clientY - a));
|
|
1123
|
+
e.style.width = `${y}px`, e.style.height = `${x}px`, S();
|
|
1124
|
+
}, E = () => {
|
|
1125
|
+
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", E), S();
|
|
1122
1126
|
};
|
|
1123
|
-
document.addEventListener("mousemove",
|
|
1127
|
+
document.addEventListener("mousemove", h), document.addEventListener("mouseup", E);
|
|
1124
1128
|
}), e.appendChild(t);
|
|
1125
|
-
},
|
|
1129
|
+
}, Y = (e) => {
|
|
1126
1130
|
const t = document.createElement("div"), n = document.createElement("div");
|
|
1127
1131
|
Object.assign(t.style, {
|
|
1128
1132
|
position: "absolute",
|
|
@@ -1132,8 +1136,13 @@ const Wt = ({
|
|
|
1132
1136
|
height: "100%",
|
|
1133
1137
|
cursor: "col-resize",
|
|
1134
1138
|
background: "rgba(0,0,0,0.15)",
|
|
1135
|
-
zIndex: "10"
|
|
1136
|
-
|
|
1139
|
+
zIndex: "10",
|
|
1140
|
+
userSelect: "none",
|
|
1141
|
+
WebkitUserSelect: "none",
|
|
1142
|
+
MozUserSelect: "none",
|
|
1143
|
+
msUserSelect: "none",
|
|
1144
|
+
pointerEvents: "auto"
|
|
1145
|
+
}), t.contentEditable = "false", Object.assign(n.style, {
|
|
1137
1146
|
position: "absolute",
|
|
1138
1147
|
bottom: "0",
|
|
1139
1148
|
left: "0",
|
|
@@ -1141,27 +1150,32 @@ const Wt = ({
|
|
|
1141
1150
|
height: "6px",
|
|
1142
1151
|
cursor: "row-resize",
|
|
1143
1152
|
background: "rgba(0,0,0,0.15)",
|
|
1144
|
-
zIndex: "10"
|
|
1145
|
-
|
|
1153
|
+
zIndex: "10",
|
|
1154
|
+
userSelect: "none",
|
|
1155
|
+
WebkitUserSelect: "none",
|
|
1156
|
+
MozUserSelect: "none",
|
|
1157
|
+
msUserSelect: "none",
|
|
1158
|
+
pointerEvents: "auto"
|
|
1159
|
+
}), n.contentEditable = "false", Je(e, t, n), e.appendChild(t), e.appendChild(n);
|
|
1146
1160
|
}, Je = (e, t, n) => {
|
|
1147
|
-
let a = 0, s = 0, l = 0,
|
|
1148
|
-
t.addEventListener("mousedown", (
|
|
1149
|
-
|
|
1150
|
-
}), n.addEventListener("mousedown", (
|
|
1151
|
-
|
|
1161
|
+
let a = 0, s = 0, l = 0, c = 0;
|
|
1162
|
+
t.addEventListener("mousedown", (g) => {
|
|
1163
|
+
g.preventDefault(), a = g.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", E);
|
|
1164
|
+
}), n.addEventListener("mousedown", (g) => {
|
|
1165
|
+
g.preventDefault(), s = g.clientY, c = e.offsetHeight, document.addEventListener("mousemove", h), document.addEventListener("mouseup", E);
|
|
1152
1166
|
});
|
|
1153
|
-
const v = (
|
|
1154
|
-
const
|
|
1155
|
-
e.style.width = `${Math.max(30,
|
|
1156
|
-
},
|
|
1157
|
-
const
|
|
1158
|
-
e.style.height = `${Math.max(20,
|
|
1159
|
-
},
|
|
1160
|
-
document.removeEventListener("mousemove", v), document.removeEventListener("mousemove",
|
|
1167
|
+
const v = (g) => {
|
|
1168
|
+
const y = l + (g.clientX - a);
|
|
1169
|
+
e.style.width = `${Math.max(30, y)}px`, S();
|
|
1170
|
+
}, h = (g) => {
|
|
1171
|
+
const y = c + (g.clientY - s);
|
|
1172
|
+
e.style.height = `${Math.max(20, y)}px`, S();
|
|
1173
|
+
}, E = () => {
|
|
1174
|
+
document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", E), S();
|
|
1161
1175
|
};
|
|
1162
1176
|
}, Ge = (e) => {
|
|
1163
1177
|
const n = e.target.closest("td, th");
|
|
1164
|
-
n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"),
|
|
1178
|
+
n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), m({
|
|
1165
1179
|
visible: !0,
|
|
1166
1180
|
x: e.clientX,
|
|
1167
1181
|
y: e.clientY,
|
|
@@ -1170,37 +1184,37 @@ const Wt = ({
|
|
|
1170
1184
|
}, fe = () => {
|
|
1171
1185
|
document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
|
|
1172
1186
|
}, et = (e) => {
|
|
1173
|
-
if (!
|
|
1174
|
-
const t =
|
|
1175
|
-
const
|
|
1176
|
-
return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText,
|
|
1187
|
+
if (!D.cell) return;
|
|
1188
|
+
const t = D.cell.closest("table"), n = D.cell.cellIndex, a = D.cell.parentElement.rowIndex, s = (l) => {
|
|
1189
|
+
const c = l.tagName.toLowerCase(), v = document.createElement(c);
|
|
1190
|
+
return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText, Y(v), v;
|
|
1177
1191
|
};
|
|
1178
1192
|
switch (e) {
|
|
1179
1193
|
case "insertRowAbove": {
|
|
1180
|
-
const l = t.rows[a],
|
|
1194
|
+
const l = t.rows[a], c = t.insertRow(a);
|
|
1181
1195
|
Array.from(l.cells).forEach((v) => {
|
|
1182
|
-
|
|
1196
|
+
c.appendChild(s(v));
|
|
1183
1197
|
});
|
|
1184
1198
|
break;
|
|
1185
1199
|
}
|
|
1186
1200
|
case "insertRowBelow": {
|
|
1187
|
-
const l = t.rows[a],
|
|
1201
|
+
const l = t.rows[a], c = t.insertRow(a + 1);
|
|
1188
1202
|
Array.from(l.cells).forEach((v) => {
|
|
1189
|
-
|
|
1203
|
+
c.appendChild(s(v));
|
|
1190
1204
|
});
|
|
1191
1205
|
break;
|
|
1192
1206
|
}
|
|
1193
1207
|
case "insertColLeft": {
|
|
1194
1208
|
Array.from(t.rows).forEach((l) => {
|
|
1195
|
-
const
|
|
1196
|
-
l.insertBefore(s(
|
|
1209
|
+
const c = l.cells[n];
|
|
1210
|
+
l.insertBefore(s(c), c);
|
|
1197
1211
|
});
|
|
1198
1212
|
break;
|
|
1199
1213
|
}
|
|
1200
1214
|
case "insertColRight": {
|
|
1201
1215
|
Array.from(t.rows).forEach((l) => {
|
|
1202
|
-
const
|
|
1203
|
-
l.insertBefore(s(
|
|
1216
|
+
const c = l.cells[n];
|
|
1217
|
+
l.insertBefore(s(c), c.nextSibling);
|
|
1204
1218
|
});
|
|
1205
1219
|
break;
|
|
1206
1220
|
}
|
|
@@ -1213,11 +1227,11 @@ const Wt = ({
|
|
|
1213
1227
|
});
|
|
1214
1228
|
break;
|
|
1215
1229
|
}
|
|
1216
|
-
|
|
1230
|
+
S(), m(oe(ae({}, D), {
|
|
1217
1231
|
visible: !1
|
|
1218
1232
|
})), fe();
|
|
1219
1233
|
}, tt = () => {
|
|
1220
|
-
|
|
1234
|
+
V(), X.current = N.current, le({
|
|
1221
1235
|
url: "",
|
|
1222
1236
|
text: "",
|
|
1223
1237
|
title: "",
|
|
@@ -1235,8 +1249,8 @@ const Wt = ({
|
|
|
1235
1249
|
s.deleteContents(), s.insertNode(a);
|
|
1236
1250
|
const l = document.createTextNode(" ");
|
|
1237
1251
|
a.after(l);
|
|
1238
|
-
const
|
|
1239
|
-
|
|
1252
|
+
const c = document.createRange();
|
|
1253
|
+
c.setStartAfter(l), c.collapse(!0), t.removeAllRanges(), t.addRange(c), H(!1), S();
|
|
1240
1254
|
}, rt = (e) => {
|
|
1241
1255
|
const t = e.target;
|
|
1242
1256
|
if (t.tagName === "A") {
|
|
@@ -1255,37 +1269,37 @@ const Wt = ({
|
|
|
1255
1269
|
}), H(!0);
|
|
1256
1270
|
}
|
|
1257
1271
|
}, at = () => {
|
|
1258
|
-
const e =
|
|
1272
|
+
const e = T();
|
|
1259
1273
|
if (!e) return;
|
|
1260
1274
|
const t = window.getSelection();
|
|
1261
|
-
if ((!t || t.rangeCount === 0) &&
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1275
|
+
if ((!t || t.rangeCount === 0) && N.current) {
|
|
1276
|
+
const g = window.getSelection();
|
|
1277
|
+
g == null || g.removeAllRanges(), g == null || g.addRange(N.current);
|
|
1264
1278
|
}
|
|
1265
1279
|
const n = window.getSelection();
|
|
1266
1280
|
if (!n || n.rangeCount === 0) return;
|
|
1267
1281
|
const a = n.getRangeAt(0);
|
|
1268
|
-
|
|
1282
|
+
$(), document.execCommand("removeFormat", !1);
|
|
1269
1283
|
const s = a.cloneContents(), l = document.createElement("div");
|
|
1270
1284
|
l.appendChild(s);
|
|
1271
|
-
const
|
|
1272
|
-
for (;
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1285
|
+
const c = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), v = [];
|
|
1286
|
+
for (; c.nextNode(); ) {
|
|
1287
|
+
const g = c.currentNode, y = g.tagName.toUpperCase(), x = g.getAttribute && g.getAttribute("data-mention") !== null;
|
|
1288
|
+
y !== "A" && !x && v.push(g);
|
|
1275
1289
|
}
|
|
1276
|
-
for (let
|
|
1277
|
-
const
|
|
1278
|
-
if (
|
|
1279
|
-
for (;
|
|
1280
|
-
|
|
1290
|
+
for (let g = v.length - 1; g >= 0; g--) {
|
|
1291
|
+
const y = v[g], x = y.parentNode;
|
|
1292
|
+
if (x) {
|
|
1293
|
+
for (; y.firstChild; ) x.insertBefore(y.firstChild, y);
|
|
1294
|
+
x.removeChild(y);
|
|
1281
1295
|
}
|
|
1282
1296
|
}
|
|
1283
|
-
l.querySelectorAll("[style]").forEach((
|
|
1284
|
-
const
|
|
1285
|
-
for (; l.firstChild; )
|
|
1286
|
-
a.insertNode(
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1297
|
+
l.querySelectorAll("[style]").forEach((g) => g.removeAttribute("style")), a.deleteContents();
|
|
1298
|
+
const h = document.createDocumentFragment();
|
|
1299
|
+
for (; l.firstChild; ) h.appendChild(l.firstChild);
|
|
1300
|
+
a.insertNode(h);
|
|
1301
|
+
const E = document.createRange();
|
|
1302
|
+
E.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), E.collapse(!0), n.removeAllRanges(), n.addRange(E), e.normalize(), S();
|
|
1289
1303
|
}, ot = (e) => {
|
|
1290
1304
|
var a;
|
|
1291
1305
|
let t = e;
|
|
@@ -1309,8 +1323,8 @@ const Wt = ({
|
|
|
1309
1323
|
if (!e || e.rangeCount === 0) return [];
|
|
1310
1324
|
const t = e.getRangeAt(0), n = t.commonAncestorContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
|
|
1311
1325
|
return Array.from(a.querySelectorAll("td, th")).filter((l) => {
|
|
1312
|
-
const
|
|
1313
|
-
return
|
|
1326
|
+
const c = document.createRange();
|
|
1327
|
+
return c.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, c) < 0 && t.compareBoundaryPoints(Range.START_TO_END, c) > 0;
|
|
1314
1328
|
});
|
|
1315
1329
|
}
|
|
1316
1330
|
function ct(e) {
|
|
@@ -1322,78 +1336,100 @@ const Wt = ({
|
|
|
1322
1336
|
let n = "left";
|
|
1323
1337
|
e === "justifyCenter" && (n = "center"), e === "justifyRight" && (n = "right"), t.forEach((a) => {
|
|
1324
1338
|
a.style.textAlign = n;
|
|
1325
|
-
}),
|
|
1339
|
+
}), S();
|
|
1326
1340
|
}
|
|
1341
|
+
const it = (e) => {
|
|
1342
|
+
const t = e.clipboardData.items;
|
|
1343
|
+
for (let n = 0; n < t.length; n++) {
|
|
1344
|
+
const a = t[n];
|
|
1345
|
+
if (a.kind === "file" && a.type.startsWith("image/")) {
|
|
1346
|
+
e.preventDefault();
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
a.kind === "string" && a.getAsString((s) => {
|
|
1350
|
+
/<img\s/i.test(s) && e.preventDefault();
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
}, st = (e) => {
|
|
1354
|
+
$();
|
|
1355
|
+
const t = window.getSelection();
|
|
1356
|
+
if (!t || !t.rangeCount) return;
|
|
1357
|
+
const n = t.getRangeAt(0), a = document.createElement("span");
|
|
1358
|
+
a.style.fontSize = `${e}px`, a.appendChild(n.extractContents()), n.insertNode(a);
|
|
1359
|
+
const s = document.createRange();
|
|
1360
|
+
s.setStartAfter(a), s.collapse(!0), t.removeAllRanges(), t.addRange(s), S();
|
|
1361
|
+
};
|
|
1327
1362
|
return /* @__PURE__ */ o.createElement("div", {
|
|
1328
|
-
className: `rte-wrapper ${(
|
|
1329
|
-
style:
|
|
1363
|
+
className: `rte-wrapper ${(f == null ? void 0 : f.wrapper) || ""}`,
|
|
1364
|
+
style: w.wrapper
|
|
1330
1365
|
}, /* @__PURE__ */ o.createElement("div", {
|
|
1331
1366
|
style: {
|
|
1332
1367
|
flex: 1
|
|
1333
1368
|
}
|
|
1334
|
-
}, /* @__PURE__ */ o.createElement(
|
|
1335
|
-
exec:
|
|
1336
|
-
saveSelection:
|
|
1369
|
+
}, /* @__PURE__ */ o.createElement(It, {
|
|
1370
|
+
exec: ne,
|
|
1371
|
+
saveSelection: V,
|
|
1337
1372
|
handleFileChange: Ye,
|
|
1338
|
-
handleFontSizeChange: (e) =>
|
|
1339
|
-
handleFontFamilyChange: (e) =>
|
|
1373
|
+
handleFontSizeChange: (e) => st(e.target.value),
|
|
1374
|
+
handleFontFamilyChange: (e) => ne("fontName", e.target.value),
|
|
1340
1375
|
insertEmoji: Ze,
|
|
1341
1376
|
handleLink: tt,
|
|
1342
1377
|
removeFormatting: at,
|
|
1343
1378
|
visibleActions: De,
|
|
1344
|
-
className:
|
|
1345
|
-
style:
|
|
1379
|
+
className: f.toolbar,
|
|
1380
|
+
style: w.toolbar
|
|
1346
1381
|
}), /* @__PURE__ */ o.createElement("div", {
|
|
1347
|
-
ref:
|
|
1382
|
+
ref: k,
|
|
1348
1383
|
id: "rte-editor-body",
|
|
1349
|
-
className: `rte-editor ${(
|
|
1350
|
-
style:
|
|
1384
|
+
className: `rte-editor ${(f == null ? void 0 : f.editor) || ""}`,
|
|
1385
|
+
style: w.editor,
|
|
1351
1386
|
contentEditable: !0,
|
|
1352
1387
|
suppressContentEditableWarning: !0,
|
|
1353
|
-
|
|
1354
|
-
|
|
1388
|
+
onPaste: it,
|
|
1389
|
+
onKeyUp: V,
|
|
1390
|
+
onMouseUp: V,
|
|
1355
1391
|
onInput: () => {
|
|
1356
|
-
me(),
|
|
1392
|
+
me(), V();
|
|
1357
1393
|
},
|
|
1358
1394
|
onKeyDown: We,
|
|
1359
1395
|
onBeforeInput: Ke,
|
|
1360
1396
|
onContextMenu: Ge,
|
|
1361
1397
|
onClick: (e) => {
|
|
1362
|
-
rt(e),
|
|
1398
|
+
rt(e), V();
|
|
1363
1399
|
}
|
|
1364
|
-
}), /* @__PURE__ */ o.createElement(
|
|
1400
|
+
}), /* @__PURE__ */ o.createElement(Bt, {
|
|
1365
1401
|
show: q,
|
|
1366
1402
|
position: F,
|
|
1367
|
-
filtered:
|
|
1403
|
+
filtered: ee,
|
|
1368
1404
|
insertMention: qe,
|
|
1369
1405
|
onClose: () => B(!1),
|
|
1370
1406
|
query: Oe
|
|
1371
|
-
}),
|
|
1372
|
-
className: `rte-output ${(
|
|
1373
|
-
style:
|
|
1374
|
-
}, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, K)), /* @__PURE__ */ o.createElement(
|
|
1375
|
-
visible:
|
|
1376
|
-
x:
|
|
1377
|
-
y:
|
|
1407
|
+
}), i && /* @__PURE__ */ o.createElement("div", {
|
|
1408
|
+
className: `rte-output ${(f == null ? void 0 : f.output) || ""}`,
|
|
1409
|
+
style: w.output
|
|
1410
|
+
}, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, K)), /* @__PURE__ */ o.createElement(qt, {
|
|
1411
|
+
visible: D.visible,
|
|
1412
|
+
x: D.x,
|
|
1413
|
+
y: D.y,
|
|
1378
1414
|
onAction: et,
|
|
1379
1415
|
onClose: () => {
|
|
1380
|
-
|
|
1416
|
+
m(oe(ae({}, D), {
|
|
1381
1417
|
visible: !1
|
|
1382
1418
|
})), fe();
|
|
1383
1419
|
}
|
|
1384
|
-
}), /* @__PURE__ */ o.createElement(
|
|
1385
|
-
visible:
|
|
1420
|
+
}), /* @__PURE__ */ o.createElement(Vt, {
|
|
1421
|
+
visible: C,
|
|
1386
1422
|
linkData: Te,
|
|
1387
1423
|
onClose: () => H(!1),
|
|
1388
1424
|
onInsert: nt
|
|
1389
|
-
})), d ? /* @__PURE__ */ o.createElement(
|
|
1390
|
-
className:
|
|
1391
|
-
style:
|
|
1425
|
+
})), d ? /* @__PURE__ */ o.createElement(Ut, {
|
|
1426
|
+
className: f.preview,
|
|
1427
|
+
style: w.preview,
|
|
1392
1428
|
html: K
|
|
1393
1429
|
}) : null);
|
|
1394
1430
|
};
|
|
1395
1431
|
export {
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1432
|
+
Xt as RichTextEditor,
|
|
1433
|
+
Ut as RtePreview,
|
|
1434
|
+
It as RteToolbar
|
|
1399
1435
|
};
|