@ryzeup/richtexteditor 1.0.27 → 1.0.29
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 +464 -445
- package/dist/index.js +2 -2
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var vt = Object.defineProperty, yt = Object.defineProperties;
|
|
2
|
+
var Et = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var ke = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var ze = (r, s, u) => s in r ?
|
|
4
|
+
var wt = Object.prototype.hasOwnProperty, Ct = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ze = (r, s, u) => s in r ? vt(r, s, { enumerable: !0, configurable: !0, writable: !0, value: u }) : r[s] = u, ce = (r, s) => {
|
|
6
6
|
for (var u in s || (s = {}))
|
|
7
|
-
|
|
7
|
+
wt.call(s, u) && ze(r, u, s[u]);
|
|
8
8
|
if (ke)
|
|
9
9
|
for (var u of ke(s))
|
|
10
|
-
|
|
10
|
+
Ct.call(s, u) && ze(r, u, s[u]);
|
|
11
11
|
return r;
|
|
12
|
-
}, se = (r, s) =>
|
|
13
|
-
import * as
|
|
12
|
+
}, se = (r, s) => yt(r, Et(s));
|
|
13
|
+
import * as bt from "react";
|
|
14
14
|
import i, { useRef as W, useState as D, useEffect as U } from "react";
|
|
15
|
-
import { createPortal as
|
|
16
|
-
window.React =
|
|
15
|
+
import { createPortal as Lt } from "react-dom";
|
|
16
|
+
window.React = bt;
|
|
17
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
|
-
}, De = i.createContext && /* @__PURE__ */ i.createContext(je),
|
|
24
|
-
function
|
|
23
|
+
}, De = i.createContext && /* @__PURE__ */ i.createContext(je), xt = ["attr", "size", "title"];
|
|
24
|
+
function Rt(r, s) {
|
|
25
25
|
if (r == null) return {};
|
|
26
|
-
var u =
|
|
26
|
+
var u = St(r, s), g, p;
|
|
27
27
|
if (Object.getOwnPropertySymbols) {
|
|
28
|
-
var
|
|
29
|
-
for (p = 0; p <
|
|
30
|
-
g =
|
|
28
|
+
var M = Object.getOwnPropertySymbols(r);
|
|
29
|
+
for (p = 0; p < M.length; p++)
|
|
30
|
+
g = M[p], !(s.indexOf(g) >= 0) && Object.prototype.propertyIsEnumerable.call(r, g) && (u[g] = r[g]);
|
|
31
31
|
}
|
|
32
32
|
return u;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function St(r, s) {
|
|
35
35
|
if (r == null) return {};
|
|
36
36
|
var u = {};
|
|
37
37
|
for (var g in r)
|
|
@@ -41,15 +41,15 @@ function Rt(r, s) {
|
|
|
41
41
|
}
|
|
42
42
|
return u;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
44
|
+
function te() {
|
|
45
|
+
return te = Object.assign ? Object.assign.bind() : function(r) {
|
|
46
46
|
for (var s = 1; s < arguments.length; s++) {
|
|
47
47
|
var u = arguments[s];
|
|
48
48
|
for (var g in u)
|
|
49
49
|
Object.prototype.hasOwnProperty.call(u, g) && (r[g] = u[g]);
|
|
50
50
|
}
|
|
51
51
|
return r;
|
|
52
|
-
},
|
|
52
|
+
}, te.apply(this, arguments);
|
|
53
53
|
}
|
|
54
54
|
function He(r, s) {
|
|
55
55
|
var u = Object.keys(r);
|
|
@@ -61,25 +61,25 @@ function He(r, s) {
|
|
|
61
61
|
}
|
|
62
62
|
return u;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function ne(r) {
|
|
65
65
|
for (var s = 1; s < arguments.length; s++) {
|
|
66
66
|
var u = arguments[s] != null ? arguments[s] : {};
|
|
67
67
|
s % 2 ? He(Object(u), !0).forEach(function(g) {
|
|
68
|
-
|
|
68
|
+
Mt(r, g, u[g]);
|
|
69
69
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(u)) : He(Object(u)).forEach(function(g) {
|
|
70
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 Mt(r, s, u) {
|
|
76
|
+
return s = Tt(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 Tt(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
84
|
var u = r[Symbol.toPrimitive];
|
|
85
85
|
if (u !== void 0) {
|
|
@@ -90,93 +90,93 @@ function Tt(r, s) {
|
|
|
90
90
|
return (s === "string" ? String : Number)(r);
|
|
91
91
|
}
|
|
92
92
|
function Fe(r) {
|
|
93
|
-
return r && r.map((s, u) => /* @__PURE__ */ i.createElement(s.tag,
|
|
93
|
+
return r && r.map((s, u) => /* @__PURE__ */ i.createElement(s.tag, ne({
|
|
94
94
|
key: u
|
|
95
95
|
}, s.attr), Fe(s.child)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return (s) => /* @__PURE__ */ i.createElement(
|
|
99
|
-
attr:
|
|
97
|
+
function k(r) {
|
|
98
|
+
return (s) => /* @__PURE__ */ i.createElement(Nt, te({
|
|
99
|
+
attr: ne({}, r.attr)
|
|
100
100
|
}, s), Fe(r.child));
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function Nt(r) {
|
|
103
103
|
var s = (u) => {
|
|
104
104
|
var {
|
|
105
105
|
attr: g,
|
|
106
106
|
size: p,
|
|
107
|
-
title:
|
|
108
|
-
} = r,
|
|
109
|
-
return u.className && (
|
|
107
|
+
title: M
|
|
108
|
+
} = r, L = Rt(r, xt), T = p || u.size || "1em", y;
|
|
109
|
+
return u.className && (y = u.className), r.className && (y = (y ? y + " " : "") + r.className), /* @__PURE__ */ i.createElement("svg", te({
|
|
110
110
|
stroke: "currentColor",
|
|
111
111
|
fill: "currentColor",
|
|
112
112
|
strokeWidth: "0"
|
|
113
|
-
}, u.attr, g,
|
|
114
|
-
className:
|
|
115
|
-
style:
|
|
113
|
+
}, u.attr, g, L, {
|
|
114
|
+
className: y,
|
|
115
|
+
style: ne(ne({
|
|
116
116
|
color: r.color || u.color
|
|
117
117
|
}, u.style), r.style),
|
|
118
118
|
height: T,
|
|
119
119
|
width: T,
|
|
120
120
|
xmlns: "http://www.w3.org/2000/svg"
|
|
121
|
-
}),
|
|
121
|
+
}), M && /* @__PURE__ */ i.createElement("title", null, M), r.children);
|
|
122
122
|
};
|
|
123
123
|
return De !== void 0 ? /* @__PURE__ */ i.createElement(De.Consumer, null, (u) => s(u)) : s(je);
|
|
124
124
|
}
|
|
125
|
-
function Nt(r) {
|
|
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
|
-
}
|
|
128
125
|
function kt(r) {
|
|
129
|
-
return
|
|
126
|
+
return k({ 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);
|
|
130
127
|
}
|
|
131
128
|
function zt(r) {
|
|
132
|
-
return
|
|
129
|
+
return k({ 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);
|
|
133
130
|
}
|
|
134
131
|
function Dt(r) {
|
|
135
|
-
return
|
|
132
|
+
return k({ 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);
|
|
136
133
|
}
|
|
137
134
|
function Ht(r) {
|
|
138
|
-
return
|
|
135
|
+
return k({ 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);
|
|
139
136
|
}
|
|
140
137
|
function Ot(r) {
|
|
141
|
-
return
|
|
138
|
+
return k({ 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);
|
|
142
139
|
}
|
|
143
140
|
function _t(r) {
|
|
144
|
-
return
|
|
141
|
+
return k({ 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);
|
|
145
142
|
}
|
|
146
143
|
function jt(r) {
|
|
147
|
-
return
|
|
144
|
+
return k({ 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);
|
|
148
145
|
}
|
|
149
146
|
function Ft(r) {
|
|
150
|
-
return
|
|
147
|
+
return k({ 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);
|
|
151
148
|
}
|
|
152
149
|
function It(r) {
|
|
153
|
-
return
|
|
150
|
+
return k({ 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);
|
|
154
151
|
}
|
|
155
152
|
function Pt(r) {
|
|
156
|
-
return
|
|
153
|
+
return k({ 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);
|
|
157
154
|
}
|
|
158
155
|
function qt(r) {
|
|
159
|
-
return
|
|
156
|
+
return k({ 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);
|
|
160
157
|
}
|
|
161
158
|
function Bt(r) {
|
|
162
|
-
return
|
|
159
|
+
return k({ 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
161
|
function Vt(r) {
|
|
165
|
-
return
|
|
162
|
+
return k({ 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);
|
|
166
163
|
}
|
|
167
164
|
function Ut(r) {
|
|
168
|
-
return
|
|
165
|
+
return k({ 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);
|
|
169
166
|
}
|
|
170
167
|
function $t(r) {
|
|
171
|
-
return
|
|
168
|
+
return k({ 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);
|
|
172
169
|
}
|
|
173
170
|
function Wt(r) {
|
|
174
|
-
return
|
|
171
|
+
return k({ 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);
|
|
175
172
|
}
|
|
176
173
|
function Zt(r) {
|
|
177
|
-
return
|
|
174
|
+
return k({ 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);
|
|
178
175
|
}
|
|
179
|
-
|
|
176
|
+
function Xt(r) {
|
|
177
|
+
return k({ 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);
|
|
178
|
+
}
|
|
179
|
+
const Kt = [
|
|
180
180
|
"😀",
|
|
181
181
|
"😁",
|
|
182
182
|
"😂",
|
|
@@ -288,37 +288,37 @@ const Xt = [
|
|
|
288
288
|
"👏",
|
|
289
289
|
"🫶",
|
|
290
290
|
"👐"
|
|
291
|
-
],
|
|
291
|
+
], Yt = ({
|
|
292
292
|
exec: r,
|
|
293
293
|
saveSelection: s,
|
|
294
294
|
handleFileChange: u,
|
|
295
295
|
handleFontSizeChange: g,
|
|
296
296
|
handleFontFamilyChange: p,
|
|
297
297
|
// insertListBlock,
|
|
298
|
-
insertEmoji:
|
|
299
|
-
handleLink:
|
|
298
|
+
insertEmoji: M,
|
|
299
|
+
handleLink: L,
|
|
300
300
|
removeFormatting: T,
|
|
301
|
-
visibleActions:
|
|
302
|
-
className:
|
|
303
|
-
style:
|
|
301
|
+
visibleActions: y,
|
|
302
|
+
className: S,
|
|
303
|
+
style: C
|
|
304
304
|
}) => {
|
|
305
305
|
var X, B;
|
|
306
|
-
const
|
|
306
|
+
const x = W(null), P = W(null), N = W(null), [_, j] = D(!1), [H, F] = D({
|
|
307
307
|
x: 0,
|
|
308
308
|
y: 0
|
|
309
309
|
});
|
|
310
310
|
U(() => {
|
|
311
|
-
const f = (
|
|
312
|
-
!
|
|
311
|
+
const f = (b) => {
|
|
312
|
+
!b.target.closest(".rte-emoji-popup") && !b.target.closest("button[title='Emoji']") && j(!1);
|
|
313
313
|
};
|
|
314
314
|
return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
|
|
315
315
|
}, []);
|
|
316
|
-
const
|
|
316
|
+
const z = (f) => {
|
|
317
317
|
var V;
|
|
318
318
|
f.preventDefault();
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
switch (
|
|
319
|
+
const b = f.currentTarget.dataset.command;
|
|
320
|
+
if (b)
|
|
321
|
+
switch (b) {
|
|
322
322
|
case "bold":
|
|
323
323
|
case "italic":
|
|
324
324
|
case "underline":
|
|
@@ -327,20 +327,20 @@ const Xt = [
|
|
|
327
327
|
case "insertOrderedList":
|
|
328
328
|
case "insertStaticOrderedList":
|
|
329
329
|
case "removeFormat":
|
|
330
|
-
r(
|
|
330
|
+
r(b);
|
|
331
331
|
break;
|
|
332
332
|
case "insertImage": {
|
|
333
|
-
(V =
|
|
333
|
+
(V = x.current) == null || V.click();
|
|
334
334
|
break;
|
|
335
335
|
}
|
|
336
336
|
default:
|
|
337
|
-
console.warn("Unknown command:",
|
|
337
|
+
console.warn("Unknown command:", b);
|
|
338
338
|
}
|
|
339
339
|
}, $ = (f) => {
|
|
340
340
|
r("foreColor", f.target.value);
|
|
341
341
|
}, Z = (f) => {
|
|
342
342
|
r("backColor", f.target.value);
|
|
343
|
-
}, [
|
|
343
|
+
}, [R, I] = D({
|
|
344
344
|
bold: !1,
|
|
345
345
|
italic: !1,
|
|
346
346
|
underline: !1,
|
|
@@ -359,7 +359,7 @@ const Xt = [
|
|
|
359
359
|
});
|
|
360
360
|
return U(() => {
|
|
361
361
|
const f = () => {
|
|
362
|
-
|
|
362
|
+
I({
|
|
363
363
|
bold: document.queryCommandState("bold"),
|
|
364
364
|
italic: document.queryCommandState("italic"),
|
|
365
365
|
underline: document.queryCommandState("underline"),
|
|
@@ -379,72 +379,72 @@ const Xt = [
|
|
|
379
379
|
};
|
|
380
380
|
return document.addEventListener("selectionchange", f), () => document.removeEventListener("selectionchange", f);
|
|
381
381
|
}, []), /* @__PURE__ */ i.createElement("div", {
|
|
382
|
-
className: `rte-toolbar ${
|
|
383
|
-
style:
|
|
384
|
-
},
|
|
382
|
+
className: `rte-toolbar ${S || ""}`,
|
|
383
|
+
style: C
|
|
384
|
+
}, y.bold && /* @__PURE__ */ i.createElement("button", {
|
|
385
385
|
"data-command": "bold",
|
|
386
386
|
title: "Bold",
|
|
387
|
-
onMouseDown:
|
|
388
|
-
className:
|
|
389
|
-
}, /* @__PURE__ */ i.createElement(
|
|
387
|
+
onMouseDown: z,
|
|
388
|
+
className: R.bold ? "rte-active" : ""
|
|
389
|
+
}, /* @__PURE__ */ i.createElement(_t, null)), y.italic && /* @__PURE__ */ i.createElement("button", {
|
|
390
390
|
"data-command": "italic",
|
|
391
391
|
title: "Italic",
|
|
392
|
-
onMouseDown:
|
|
393
|
-
className:
|
|
394
|
-
}, /* @__PURE__ */ i.createElement(
|
|
392
|
+
onMouseDown: z,
|
|
393
|
+
className: R.italic ? "rte-active" : ""
|
|
394
|
+
}, /* @__PURE__ */ i.createElement(Ft, null)), y.underline && /* @__PURE__ */ i.createElement("button", {
|
|
395
395
|
"data-command": "underline",
|
|
396
396
|
title: "Underline",
|
|
397
|
-
onMouseDown:
|
|
398
|
-
className:
|
|
399
|
-
}, /* @__PURE__ */ i.createElement(
|
|
397
|
+
onMouseDown: z,
|
|
398
|
+
className: R.underline ? "rte-active" : ""
|
|
399
|
+
}, /* @__PURE__ */ i.createElement(Bt, null)), y.unorderedList && /* @__PURE__ */ i.createElement("button", {
|
|
400
400
|
"data-command": "insertUnorderedList",
|
|
401
|
-
onMouseDown:
|
|
401
|
+
onMouseDown: z,
|
|
402
402
|
title: "UnorderedList",
|
|
403
|
-
className:
|
|
404
|
-
}, /* @__PURE__ */ i.createElement(
|
|
403
|
+
className: R.unorderedList ? "rte-active" : ""
|
|
404
|
+
}, /* @__PURE__ */ i.createElement(Ut, null)), y.staticUnorderedList && /* @__PURE__ */ i.createElement("button", {
|
|
405
405
|
"data-command": "insertStaticUnorderedList",
|
|
406
|
-
onMouseDown:
|
|
406
|
+
onMouseDown: z,
|
|
407
407
|
title: "StaticUnorderedList",
|
|
408
|
-
className:
|
|
409
|
-
}, /* @__PURE__ */ i.createElement(
|
|
408
|
+
className: R.unorderedList ? "rte-active" : ""
|
|
409
|
+
}, /* @__PURE__ */ i.createElement(Pt, null)), y.orderedList && /* @__PURE__ */ i.createElement("button", {
|
|
410
410
|
"data-command": "insertOrderedList",
|
|
411
411
|
title: "OrderedList",
|
|
412
|
-
onMouseDown:
|
|
413
|
-
className:
|
|
412
|
+
onMouseDown: z,
|
|
413
|
+
className: R.orderedList ? "rte-active" : "",
|
|
414
414
|
style: {
|
|
415
415
|
fontSize: "medium"
|
|
416
416
|
}
|
|
417
|
-
}, /* @__PURE__ */ i.createElement(
|
|
417
|
+
}, /* @__PURE__ */ i.createElement(Vt, null)), y.staticOrderedList && /* @__PURE__ */ i.createElement("button", {
|
|
418
418
|
"data-command": "insertStaticOrderedList",
|
|
419
419
|
title: "StaticOrderedList",
|
|
420
|
-
onMouseDown:
|
|
421
|
-
className:
|
|
422
|
-
}, /* @__PURE__ */ i.createElement(
|
|
420
|
+
onMouseDown: z,
|
|
421
|
+
className: R.orderedList ? "rte-active" : ""
|
|
422
|
+
}, /* @__PURE__ */ i.createElement(Ht, null)), y.link && /* @__PURE__ */ i.createElement("button", {
|
|
423
423
|
"data-command": "createLink",
|
|
424
424
|
title: "Link",
|
|
425
|
-
onClick:
|
|
426
|
-
className:
|
|
427
|
-
}, /* @__PURE__ */ i.createElement(
|
|
425
|
+
onClick: L,
|
|
426
|
+
className: R.link ? "rte-active" : ""
|
|
427
|
+
}, /* @__PURE__ */ i.createElement(It, null)), y.removeFormat && /* @__PURE__ */ i.createElement("button", {
|
|
428
428
|
"data-command": "Remove format",
|
|
429
429
|
title: "removeFormat",
|
|
430
430
|
onMouseDown: (f) => {
|
|
431
431
|
f.preventDefault(), s(), T();
|
|
432
432
|
},
|
|
433
|
-
className:
|
|
434
|
-
}, /* @__PURE__ */ i.createElement(
|
|
433
|
+
className: R.removeFormat ? "rte-active" : ""
|
|
434
|
+
}, /* @__PURE__ */ i.createElement(Xt, null)), y.image && /* @__PURE__ */ i.createElement("button", {
|
|
435
435
|
"data-command": "insertImage",
|
|
436
436
|
title: "Image",
|
|
437
|
-
onMouseDown:
|
|
438
|
-
className:
|
|
439
|
-
}, /* @__PURE__ */ i.createElement(
|
|
437
|
+
onMouseDown: z,
|
|
438
|
+
className: R.image ? "rte-active" : ""
|
|
439
|
+
}, /* @__PURE__ */ i.createElement(Dt, null)), /* @__PURE__ */ i.createElement("input", {
|
|
440
440
|
type: "file",
|
|
441
441
|
accept: "image/*",
|
|
442
|
-
ref:
|
|
442
|
+
ref: x,
|
|
443
443
|
style: {
|
|
444
444
|
display: "none"
|
|
445
445
|
},
|
|
446
446
|
onChange: u
|
|
447
|
-
}),
|
|
447
|
+
}), y.emoji && /* @__PURE__ */ i.createElement("div", {
|
|
448
448
|
style: {
|
|
449
449
|
position: "relative"
|
|
450
450
|
}
|
|
@@ -452,55 +452,55 @@ const Xt = [
|
|
|
452
452
|
title: "Emoji",
|
|
453
453
|
onMouseDown: (f) => {
|
|
454
454
|
f.preventDefault(), s();
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
x:
|
|
458
|
-
y:
|
|
455
|
+
const b = f.currentTarget.getBoundingClientRect();
|
|
456
|
+
F({
|
|
457
|
+
x: b.left,
|
|
458
|
+
y: b.bottom + 8
|
|
459
459
|
// small spacing
|
|
460
460
|
}), j((V) => !V);
|
|
461
461
|
},
|
|
462
|
-
className:
|
|
463
|
-
}, /* @__PURE__ */ i.createElement(
|
|
462
|
+
className: R.emoji ? "rte-active" : ""
|
|
463
|
+
}, /* @__PURE__ */ i.createElement(qt, null)), _ && /* @__PURE__ */ Lt(/* @__PURE__ */ i.createElement("div", {
|
|
464
464
|
className: "rte-emoji-popup",
|
|
465
465
|
style: {
|
|
466
|
-
top:
|
|
467
|
-
left:
|
|
466
|
+
top: H.y,
|
|
467
|
+
left: H.x
|
|
468
468
|
}
|
|
469
|
-
},
|
|
470
|
-
key:
|
|
469
|
+
}, Kt.map((f, b) => /* @__PURE__ */ i.createElement("span", {
|
|
470
|
+
key: b,
|
|
471
471
|
style: {
|
|
472
472
|
fontSize: "20px",
|
|
473
473
|
cursor: "pointer",
|
|
474
474
|
textAlign: "center"
|
|
475
475
|
},
|
|
476
476
|
onMouseDown: (V) => {
|
|
477
|
-
V.preventDefault(),
|
|
477
|
+
V.preventDefault(), M(f), j(!1);
|
|
478
478
|
}
|
|
479
|
-
}, f))), document.body)),
|
|
479
|
+
}, f))), document.body)), y.color && /* @__PURE__ */ i.createElement("div", {
|
|
480
480
|
style: {
|
|
481
481
|
position: "relative"
|
|
482
482
|
}
|
|
483
483
|
}, /* @__PURE__ */ i.createElement("button", {
|
|
484
484
|
title: "Text Color",
|
|
485
485
|
onMouseDown: (f) => {
|
|
486
|
-
var
|
|
487
|
-
f.preventDefault(), s(), (
|
|
486
|
+
var b;
|
|
487
|
+
f.preventDefault(), s(), (b = P.current) == null || b.click();
|
|
488
488
|
},
|
|
489
489
|
style: {
|
|
490
490
|
display: "flex",
|
|
491
491
|
alignItems: "center",
|
|
492
492
|
justifyContent: "center",
|
|
493
|
-
color: ((X =
|
|
493
|
+
color: ((X = P.current) == null ? void 0 : X.value) || "#000",
|
|
494
494
|
fontSize: "18px"
|
|
495
495
|
},
|
|
496
|
-
className:
|
|
497
|
-
}, /* @__PURE__ */ i.createElement(
|
|
498
|
-
ref:
|
|
496
|
+
className: R.color ? "rte-active" : ""
|
|
497
|
+
}, /* @__PURE__ */ i.createElement(Zt, null)), /* @__PURE__ */ i.createElement("input", {
|
|
498
|
+
ref: P,
|
|
499
499
|
type: "color",
|
|
500
500
|
defaultValue: "#000000",
|
|
501
501
|
onChange: (f) => {
|
|
502
|
-
var
|
|
503
|
-
$(f), ((
|
|
502
|
+
var b;
|
|
503
|
+
$(f), ((b = f.target.parentElement) == null ? void 0 : b.querySelector("button")).style.color = f.target.value;
|
|
504
504
|
},
|
|
505
505
|
style: {
|
|
506
506
|
position: "absolute",
|
|
@@ -509,30 +509,30 @@ const Xt = [
|
|
|
509
509
|
height: 0,
|
|
510
510
|
pointerEvents: "none"
|
|
511
511
|
}
|
|
512
|
-
})),
|
|
512
|
+
})), y.highlight && /* @__PURE__ */ i.createElement("div", {
|
|
513
513
|
style: {
|
|
514
514
|
position: "relative"
|
|
515
515
|
}
|
|
516
516
|
}, /* @__PURE__ */ i.createElement("button", {
|
|
517
517
|
title: "Highlight",
|
|
518
518
|
onMouseDown: (f) => {
|
|
519
|
-
var
|
|
520
|
-
f.preventDefault(), s(), (
|
|
519
|
+
var b;
|
|
520
|
+
f.preventDefault(), s(), (b = N.current) == null || b.click();
|
|
521
521
|
},
|
|
522
522
|
style: {
|
|
523
523
|
display: "flex",
|
|
524
524
|
alignItems: "center",
|
|
525
525
|
justifyContent: "center",
|
|
526
|
-
color: ((B =
|
|
526
|
+
color: ((B = N.current) == null ? void 0 : B.value) || "#000",
|
|
527
527
|
fontSize: "18px"
|
|
528
528
|
},
|
|
529
|
-
className:
|
|
530
|
-
}, /* @__PURE__ */ i.createElement(
|
|
531
|
-
ref:
|
|
529
|
+
className: R.highlight ? "rte-active" : ""
|
|
530
|
+
}, /* @__PURE__ */ i.createElement(jt, null)), /* @__PURE__ */ i.createElement("input", {
|
|
531
|
+
ref: N,
|
|
532
532
|
type: "color",
|
|
533
533
|
onChange: (f) => {
|
|
534
|
-
var
|
|
535
|
-
Z(f), ((
|
|
534
|
+
var b;
|
|
535
|
+
Z(f), ((b = f.target.parentElement) == null ? void 0 : b.querySelector("button")).style.color = f.target.value;
|
|
536
536
|
},
|
|
537
537
|
defaultValue: "#000000",
|
|
538
538
|
style: {
|
|
@@ -542,38 +542,38 @@ const Xt = [
|
|
|
542
542
|
height: 0,
|
|
543
543
|
pointerEvents: "none"
|
|
544
544
|
}
|
|
545
|
-
})),
|
|
545
|
+
})), y.align && /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("button", {
|
|
546
546
|
title: "Align Left",
|
|
547
547
|
onMouseDown: (f) => f.preventDefault(),
|
|
548
548
|
onClick: () => r("justifyLeft"),
|
|
549
|
-
className:
|
|
550
|
-
}, /* @__PURE__ */ i.createElement(
|
|
549
|
+
className: R.alignLeft ? "rte-active" : ""
|
|
550
|
+
}, /* @__PURE__ */ i.createElement(Ot, null)), /* @__PURE__ */ i.createElement("button", {
|
|
551
551
|
title: "Align Center",
|
|
552
552
|
onMouseDown: (f) => f.preventDefault(),
|
|
553
553
|
onClick: () => r("justifyCenter"),
|
|
554
|
-
className:
|
|
555
|
-
}, /* @__PURE__ */ i.createElement(
|
|
554
|
+
className: R.alignCenter ? "rte-active" : ""
|
|
555
|
+
}, /* @__PURE__ */ i.createElement(kt, null)), /* @__PURE__ */ i.createElement("button", {
|
|
556
556
|
title: "Align Right",
|
|
557
557
|
onMouseDown: (f) => f.preventDefault(),
|
|
558
558
|
onClick: () => r("justifyRight"),
|
|
559
|
-
className:
|
|
560
|
-
}, /* @__PURE__ */ i.createElement(
|
|
559
|
+
className: R.alignRight ? "rte-active" : ""
|
|
560
|
+
}, /* @__PURE__ */ i.createElement(zt, null))), y.table && /* @__PURE__ */ i.createElement("button", {
|
|
561
561
|
title: "Insert Dynamic Table",
|
|
562
562
|
onMouseDown: (f) => f.preventDefault(),
|
|
563
563
|
onClick: () => r("insertTable"),
|
|
564
|
-
className:
|
|
564
|
+
className: R.table ? "rte-active" : "",
|
|
565
565
|
style: {
|
|
566
566
|
fontSize: "medium"
|
|
567
567
|
}
|
|
568
|
-
}, /* @__PURE__ */ i.createElement(
|
|
568
|
+
}, /* @__PURE__ */ i.createElement($t, null)), y.table && /* @__PURE__ */ i.createElement("button", {
|
|
569
569
|
title: "Insert Static Table",
|
|
570
570
|
onMouseDown: (f) => f.preventDefault(),
|
|
571
571
|
onClick: () => r("insertStaticTable"),
|
|
572
|
-
className:
|
|
572
|
+
className: R.table ? "rte-active" : "",
|
|
573
573
|
style: {
|
|
574
574
|
fontSize: "medium"
|
|
575
575
|
}
|
|
576
|
-
}, /* @__PURE__ */ i.createElement(
|
|
576
|
+
}, /* @__PURE__ */ i.createElement(Wt, null)), y.fontFamily && /* @__PURE__ */ i.createElement("select", {
|
|
577
577
|
className: "rte-dropdown",
|
|
578
578
|
defaultValue: "",
|
|
579
579
|
onMouseDown: () => s(),
|
|
@@ -591,7 +591,7 @@ const Xt = [
|
|
|
591
591
|
value: "Courier New"
|
|
592
592
|
}, "Courier New"), /* @__PURE__ */ i.createElement("option", {
|
|
593
593
|
value: "Verdana"
|
|
594
|
-
}, "Verdana")),
|
|
594
|
+
}, "Verdana")), y.fontSize && /* @__PURE__ */ i.createElement("select", {
|
|
595
595
|
className: "rte-dropdown rte-fontsize-dropdown",
|
|
596
596
|
defaultValue: "",
|
|
597
597
|
onMouseDown: () => s(),
|
|
@@ -601,80 +601,80 @@ const Xt = [
|
|
|
601
601
|
disabled: !0
|
|
602
602
|
}, "Font Size"), Array.from({
|
|
603
603
|
length: 16
|
|
604
|
-
}, (f,
|
|
604
|
+
}, (f, b) => 10 + b).map((f) => /* @__PURE__ */ i.createElement("option", {
|
|
605
605
|
key: f,
|
|
606
606
|
value: f
|
|
607
607
|
}, f, "px"))));
|
|
608
|
-
},
|
|
608
|
+
}, Qt = ({
|
|
609
609
|
show: r,
|
|
610
610
|
position: s,
|
|
611
611
|
filtered: u,
|
|
612
612
|
insertMention: g,
|
|
613
613
|
onClose: p,
|
|
614
|
-
query:
|
|
614
|
+
query: M
|
|
615
615
|
}) => {
|
|
616
|
-
const
|
|
616
|
+
const L = W(null), [T, y] = D(0);
|
|
617
617
|
return U(() => {
|
|
618
|
-
r &&
|
|
618
|
+
r && y(0);
|
|
619
619
|
}, [r]), U(() => {
|
|
620
|
-
const
|
|
621
|
-
|
|
620
|
+
const S = (C) => {
|
|
621
|
+
L.current && !L.current.contains(C.target) && p();
|
|
622
622
|
};
|
|
623
|
-
return r && document.addEventListener("mousedown",
|
|
624
|
-
document.removeEventListener("mousedown",
|
|
623
|
+
return r && document.addEventListener("mousedown", S), () => {
|
|
624
|
+
document.removeEventListener("mousedown", S);
|
|
625
625
|
};
|
|
626
626
|
}, [r, p]), U(() => {
|
|
627
627
|
if (!r) return;
|
|
628
|
-
const
|
|
629
|
-
if (!(!r || u.length === 0) && (
|
|
630
|
-
|
|
631
|
-
const
|
|
632
|
-
|
|
628
|
+
const S = (C) => {
|
|
629
|
+
if (!(!r || u.length === 0) && (C.key === "ArrowDown" && (C.preventDefault(), y((x) => Math.min(x + 1, u.length - 1))), C.key === "ArrowUp" && (C.preventDefault(), y((x) => Math.max(x - 1, 0))), C.key === "Enter")) {
|
|
630
|
+
C.preventDefault();
|
|
631
|
+
const x = u[T];
|
|
632
|
+
x && g(x);
|
|
633
633
|
}
|
|
634
634
|
};
|
|
635
|
-
return window.addEventListener("keydown",
|
|
635
|
+
return window.addEventListener("keydown", S), () => window.removeEventListener("keydown", S);
|
|
636
636
|
}, [r, u, T]), U(() => {
|
|
637
|
-
if (!
|
|
638
|
-
const
|
|
639
|
-
|
|
637
|
+
if (!L.current) return;
|
|
638
|
+
const C = L.current.querySelectorAll("li")[T];
|
|
639
|
+
C && C.scrollIntoView({
|
|
640
640
|
block: "nearest",
|
|
641
641
|
behavior: "smooth"
|
|
642
642
|
});
|
|
643
643
|
}, [T]), r ? /* @__PURE__ */ i.createElement("ul", {
|
|
644
|
-
ref:
|
|
644
|
+
ref: L,
|
|
645
645
|
className: "rte-popup",
|
|
646
646
|
style: {
|
|
647
647
|
top: s.y,
|
|
648
648
|
left: s.x
|
|
649
649
|
}
|
|
650
650
|
}, u.length > 0 ? u.map(({
|
|
651
|
-
name:
|
|
652
|
-
value:
|
|
653
|
-
},
|
|
654
|
-
const
|
|
655
|
-
let j =
|
|
656
|
-
if (
|
|
657
|
-
const
|
|
658
|
-
j =
|
|
651
|
+
name: S,
|
|
652
|
+
value: C
|
|
653
|
+
}, x) => {
|
|
654
|
+
const P = S.toLowerCase(), N = M.toLowerCase(), _ = P.indexOf(N);
|
|
655
|
+
let j = S;
|
|
656
|
+
if (_ !== -1 && M.length > 0) {
|
|
657
|
+
const H = _ + M.length;
|
|
658
|
+
j = S.substring(0, _) + `<span class="rte-highlight">${S.substring(_, H)}</span>` + S.substring(H);
|
|
659
659
|
}
|
|
660
660
|
return /* @__PURE__ */ i.createElement("li", {
|
|
661
|
-
key:
|
|
662
|
-
onMouseDown: (
|
|
663
|
-
|
|
664
|
-
name:
|
|
665
|
-
value:
|
|
661
|
+
key: C,
|
|
662
|
+
onMouseDown: (H) => {
|
|
663
|
+
H.preventDefault(), g({
|
|
664
|
+
name: S,
|
|
665
|
+
value: C
|
|
666
666
|
});
|
|
667
667
|
},
|
|
668
668
|
style: {
|
|
669
669
|
padding: "6px 12px",
|
|
670
670
|
cursor: "pointer",
|
|
671
671
|
fontSize: "14px",
|
|
672
|
-
background:
|
|
672
|
+
background: x === T ? "#dce8ff" : "white"
|
|
673
673
|
},
|
|
674
674
|
dangerouslySetInnerHTML: {
|
|
675
675
|
__html: j
|
|
676
676
|
},
|
|
677
|
-
onMouseEnter: () =>
|
|
677
|
+
onMouseEnter: () => y(x)
|
|
678
678
|
});
|
|
679
679
|
}) : /* @__PURE__ */ i.createElement("li", {
|
|
680
680
|
style: {
|
|
@@ -684,12 +684,12 @@ const Xt = [
|
|
|
684
684
|
}, "No matches")) : null;
|
|
685
685
|
};
|
|
686
686
|
function Oe(r) {
|
|
687
|
-
return
|
|
687
|
+
return k({ 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);
|
|
688
688
|
}
|
|
689
|
-
function
|
|
690
|
-
return
|
|
689
|
+
function ee(r) {
|
|
690
|
+
return k({ 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);
|
|
691
691
|
}
|
|
692
|
-
const
|
|
692
|
+
const Jt = ({
|
|
693
693
|
visible: r,
|
|
694
694
|
x: s,
|
|
695
695
|
y: u,
|
|
@@ -697,106 +697,106 @@ const Qt = ({
|
|
|
697
697
|
onClose: p
|
|
698
698
|
}) => {
|
|
699
699
|
if (!r) return null;
|
|
700
|
-
const
|
|
700
|
+
const M = {
|
|
701
701
|
top: u,
|
|
702
702
|
left: s
|
|
703
703
|
};
|
|
704
704
|
return /* @__PURE__ */ i.createElement("div", {
|
|
705
|
-
style:
|
|
705
|
+
style: M,
|
|
706
706
|
className: "rte-table-menu",
|
|
707
707
|
onMouseLeave: p
|
|
708
708
|
}, /* @__PURE__ */ i.createElement("button", {
|
|
709
709
|
onClick: () => g("insertRowAbove")
|
|
710
|
-
}, /* @__PURE__ */ i.createElement(
|
|
710
|
+
}, /* @__PURE__ */ i.createElement(ee, null), " Insert row above"), /* @__PURE__ */ i.createElement("button", {
|
|
711
711
|
onClick: () => g("insertRowBelow")
|
|
712
|
-
}, /* @__PURE__ */ i.createElement(
|
|
712
|
+
}, /* @__PURE__ */ i.createElement(ee, null), " Insert row below"), /* @__PURE__ */ i.createElement("button", {
|
|
713
713
|
onClick: () => g("insertColLeft")
|
|
714
|
-
}, /* @__PURE__ */ i.createElement(
|
|
714
|
+
}, /* @__PURE__ */ i.createElement(ee, null), " Insert col left"), /* @__PURE__ */ i.createElement("button", {
|
|
715
715
|
onClick: () => g("insertColRight")
|
|
716
|
-
}, /* @__PURE__ */ i.createElement(
|
|
716
|
+
}, /* @__PURE__ */ i.createElement(ee, null), " Insert col right"), /* @__PURE__ */ i.createElement("button", {
|
|
717
717
|
onClick: () => g("deleteRow")
|
|
718
718
|
}, /* @__PURE__ */ i.createElement(Oe, null), " Delete row"), /* @__PURE__ */ i.createElement("button", {
|
|
719
719
|
onClick: () => g("deleteCol")
|
|
720
720
|
}, /* @__PURE__ */ i.createElement(Oe, null), " Delete column"));
|
|
721
|
-
},
|
|
721
|
+
}, Gt = ({
|
|
722
722
|
html: r,
|
|
723
723
|
className: s,
|
|
724
724
|
style: u
|
|
725
725
|
}) => {
|
|
726
|
-
const g = (
|
|
727
|
-
const
|
|
728
|
-
if (
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
|
|
726
|
+
const g = (L) => {
|
|
727
|
+
const T = L.target;
|
|
728
|
+
if (T.tagName === "A") {
|
|
729
|
+
L.preventDefault();
|
|
730
|
+
const y = T.href;
|
|
731
|
+
y && window.open(y, "_blank", "noopener,noreferrer");
|
|
732
732
|
}
|
|
733
|
-
}, p = (
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
const
|
|
737
|
-
for (;
|
|
738
|
-
const
|
|
739
|
-
|
|
733
|
+
}, p = (L) => L === "rgb(0, 0, 0)" || L === "rgba(0, 0, 0, 1)" || L === "#000" || L === "#000000" || L === "black", M = (L) => {
|
|
734
|
+
const T = document.createElement("div");
|
|
735
|
+
T.innerHTML = L;
|
|
736
|
+
const y = document.createTreeWalker(T, NodeFilter.SHOW_TEXT, null), S = [];
|
|
737
|
+
for (; y.nextNode(); ) {
|
|
738
|
+
const C = y.currentNode;
|
|
739
|
+
C.nodeValue && /{{\s*[\s\S]*?\s*}}/.test(C.nodeValue) && S.push(C);
|
|
740
740
|
}
|
|
741
|
-
return
|
|
742
|
-
var
|
|
743
|
-
const x =
|
|
744
|
-
if (!
|
|
745
|
-
let
|
|
746
|
-
for (;
|
|
747
|
-
if (
|
|
748
|
-
|
|
741
|
+
return S.forEach((C) => {
|
|
742
|
+
var F;
|
|
743
|
+
const x = C.nodeValue || "", P = C.parentElement;
|
|
744
|
+
if (!P) return;
|
|
745
|
+
let N = P, _ = !1;
|
|
746
|
+
for (; N; ) {
|
|
747
|
+
if (N.tagName === "FONT" && N.getAttribute("color")) {
|
|
748
|
+
_ = !0;
|
|
749
749
|
break;
|
|
750
750
|
}
|
|
751
|
-
const z = (
|
|
752
|
-
if (z && z
|
|
753
|
-
|
|
751
|
+
const z = (F = N.style) == null ? void 0 : F.color;
|
|
752
|
+
if (z && !p(z)) {
|
|
753
|
+
_ = !0;
|
|
754
754
|
break;
|
|
755
755
|
}
|
|
756
|
-
const
|
|
757
|
-
if (
|
|
758
|
-
|
|
756
|
+
const $ = window.getComputedStyle(N);
|
|
757
|
+
if ($.color && !p($.color)) {
|
|
758
|
+
_ = !0;
|
|
759
759
|
break;
|
|
760
760
|
}
|
|
761
|
-
|
|
761
|
+
N = N.parentElement;
|
|
762
762
|
}
|
|
763
|
-
const
|
|
764
|
-
let
|
|
765
|
-
x.replace(/{{\s*([\s\S]*?)\s*}}/g, (z,
|
|
766
|
-
if (
|
|
767
|
-
|
|
763
|
+
const j = document.createDocumentFragment();
|
|
764
|
+
let H = 0;
|
|
765
|
+
x.replace(/{{\s*([\s\S]*?)\s*}}/g, (z, $, Z) => {
|
|
766
|
+
if (Z > H && j.appendChild(document.createTextNode(x.slice(H, Z))), _)
|
|
767
|
+
j.appendChild(document.createTextNode(z));
|
|
768
768
|
else {
|
|
769
|
-
const
|
|
770
|
-
|
|
769
|
+
const R = document.createElement("span");
|
|
770
|
+
R.style.color = "blue", R.textContent = z, j.appendChild(R);
|
|
771
771
|
}
|
|
772
|
-
return
|
|
773
|
-
}),
|
|
774
|
-
}),
|
|
772
|
+
return H = Z + z.length, z;
|
|
773
|
+
}), H < x.length && j.appendChild(document.createTextNode(x.slice(H))), P.replaceChild(j, C);
|
|
774
|
+
}), T.innerHTML = T.innerHTML.replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, ""), T.innerHTML;
|
|
775
775
|
};
|
|
776
776
|
return /* @__PURE__ */ i.createElement("div", {
|
|
777
777
|
className: `rte-preview ${s || ""}`,
|
|
778
778
|
style: u,
|
|
779
779
|
onClick: g,
|
|
780
780
|
dangerouslySetInnerHTML: {
|
|
781
|
-
__html:
|
|
781
|
+
__html: M(r)
|
|
782
782
|
}
|
|
783
783
|
});
|
|
784
|
-
},
|
|
784
|
+
}, en = ({
|
|
785
785
|
visible: r,
|
|
786
786
|
linkData: s,
|
|
787
787
|
onClose: u,
|
|
788
788
|
onInsert: g
|
|
789
789
|
}) => {
|
|
790
|
-
const [p,
|
|
790
|
+
const [p, M] = D(""), [L, T] = D(""), [y, S] = D(""), [C, x] = D("_self");
|
|
791
791
|
if (U(() => {
|
|
792
|
-
r ? (
|
|
792
|
+
r ? (M(s.url || ""), T(s.text || ""), S(s.title || ""), x(s.target || "_self")) : (M(""), T(""), S(""), x("_self"));
|
|
793
793
|
}, [r, s]), !r) return null;
|
|
794
|
-
const
|
|
794
|
+
const P = () => {
|
|
795
795
|
g({
|
|
796
796
|
url: p,
|
|
797
|
-
text:
|
|
798
|
-
title:
|
|
799
|
-
target:
|
|
797
|
+
text: L,
|
|
798
|
+
title: y,
|
|
799
|
+
target: C
|
|
800
800
|
});
|
|
801
801
|
};
|
|
802
802
|
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("div", {
|
|
@@ -811,23 +811,23 @@ const Qt = ({
|
|
|
811
811
|
className: "rte-link-modal__input",
|
|
812
812
|
placeholder: "URL",
|
|
813
813
|
value: p,
|
|
814
|
-
onChange: (
|
|
814
|
+
onChange: (N) => M(N.target.value)
|
|
815
815
|
}), /* @__PURE__ */ i.createElement("input", {
|
|
816
816
|
type: "text",
|
|
817
817
|
className: "rte-link-modal__input",
|
|
818
818
|
placeholder: "Text to Display",
|
|
819
|
-
value:
|
|
820
|
-
onChange: (
|
|
819
|
+
value: L,
|
|
820
|
+
onChange: (N) => T(N.target.value)
|
|
821
821
|
}), /* @__PURE__ */ i.createElement("input", {
|
|
822
822
|
type: "text",
|
|
823
823
|
className: "rte-link-modal__input",
|
|
824
824
|
placeholder: "Title",
|
|
825
|
-
value:
|
|
826
|
-
onChange: (
|
|
825
|
+
value: y,
|
|
826
|
+
onChange: (N) => S(N.target.value)
|
|
827
827
|
}), /* @__PURE__ */ i.createElement("select", {
|
|
828
828
|
className: "rte-link-modal__select",
|
|
829
|
-
value:
|
|
830
|
-
onChange: (
|
|
829
|
+
value: C,
|
|
830
|
+
onChange: (N) => x(N.target.value)
|
|
831
831
|
}, /* @__PURE__ */ i.createElement("option", {
|
|
832
832
|
value: "_self"
|
|
833
833
|
}, "Same tab"), /* @__PURE__ */ i.createElement("option", {
|
|
@@ -839,7 +839,7 @@ const Qt = ({
|
|
|
839
839
|
onClick: u
|
|
840
840
|
}, "Cancel"), /* @__PURE__ */ i.createElement("button", {
|
|
841
841
|
className: "rte-link-modal__btn rte-link-modal__btn--ok",
|
|
842
|
-
onClick:
|
|
842
|
+
onClick: P
|
|
843
843
|
}, "OK"))));
|
|
844
844
|
};
|
|
845
845
|
function _e(r) {
|
|
@@ -851,7 +851,7 @@ function _e(r) {
|
|
|
851
851
|
value: g
|
|
852
852
|
}));
|
|
853
853
|
}
|
|
854
|
-
const
|
|
854
|
+
const an = ({
|
|
855
855
|
atSuggestions: r = [],
|
|
856
856
|
showOutput: s = !1,
|
|
857
857
|
showPreview: u = !1,
|
|
@@ -870,26 +870,26 @@ const rn = ({
|
|
|
870
870
|
staticOrderedList: !1
|
|
871
871
|
},
|
|
872
872
|
classNames: p = {},
|
|
873
|
-
styles:
|
|
874
|
-
handleGetHtml:
|
|
873
|
+
styles: M = {},
|
|
874
|
+
handleGetHtml: L = () => {
|
|
875
875
|
},
|
|
876
876
|
onChange: T = () => {
|
|
877
877
|
},
|
|
878
|
-
value:
|
|
879
|
-
onMentionSelect:
|
|
878
|
+
value: y,
|
|
879
|
+
onMentionSelect: S = () => {
|
|
880
880
|
},
|
|
881
|
-
handleAddAttributes:
|
|
881
|
+
handleAddAttributes: C = () => {
|
|
882
882
|
}
|
|
883
883
|
}) => {
|
|
884
884
|
var Ee, we, Ce, be, Le, xe, Re, Se, Me, Te, Ae, Ne;
|
|
885
|
-
const
|
|
885
|
+
const x = W(null), [P, N] = D(y != null && y.length ? y : " "), [_, j] = D(""), [H, F] = D(!1), [z, $] = D({
|
|
886
886
|
x: 0,
|
|
887
887
|
y: 0
|
|
888
|
-
}), [Z,
|
|
888
|
+
}), [Z, R] = D([]), I = W(null), X = W(null), [B, f] = D({
|
|
889
889
|
visible: !1,
|
|
890
890
|
x: 0,
|
|
891
891
|
y: 0
|
|
892
|
-
}), [
|
|
892
|
+
}), [b, V] = D(!1), G = W(null), [Ie, de] = D({
|
|
893
893
|
url: "",
|
|
894
894
|
text: "",
|
|
895
895
|
title: "",
|
|
@@ -912,21 +912,21 @@ const rn = ({
|
|
|
912
912
|
fontFamily: (Te = g.fontFamily) != null ? Te : !1,
|
|
913
913
|
fontSize: (Ae = g.fontSize) != null ? Ae : !1,
|
|
914
914
|
highlight: (Ne = g.fontSize) != null ? Ne : !1
|
|
915
|
-
}, [qe,
|
|
915
|
+
}, [qe, re] = D(""), [ue, ae] = D([]), q = () => x.current, A = () => {
|
|
916
916
|
const e = Be(), t = /^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());
|
|
917
917
|
let n = e;
|
|
918
|
-
t || (n = `<div style="font-size:12px">${e}</div>`), n = n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g, (o,
|
|
919
|
-
if (/list-type=["']static["']/.test(
|
|
920
|
-
const m = `<${
|
|
921
|
-
return `${m}${c}${
|
|
922
|
-
}), j(n),
|
|
918
|
+
t || (n = `<div style="font-size:12px">${e}</div>`), n = n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g, (o, v, E) => {
|
|
919
|
+
if (/list-type=["']static["']/.test(E) || o.includes("data-hidden-array-start") || o.includes("data-hidden-array-end")) return o;
|
|
920
|
+
const m = `<${v}${E}>`, c = '<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>', h = '<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>', w = `</${v}>`, O = o.replace(new RegExp(`^${m}`), "").replace(new RegExp(`${w}$`), "");
|
|
921
|
+
return `${m}${c}${O}${h}${w}`;
|
|
922
|
+
}), j(n), L == null || L(n);
|
|
923
923
|
const a = ct(e);
|
|
924
924
|
T(a);
|
|
925
925
|
const d = Ye(), l = _e(d);
|
|
926
|
-
JSON.stringify(l) !== JSON.stringify(ue) && (
|
|
926
|
+
JSON.stringify(l) !== JSON.stringify(ue) && (ae(l), S(l));
|
|
927
927
|
}, Be = () => {
|
|
928
928
|
const e = q();
|
|
929
|
-
if (!e) return
|
|
929
|
+
if (!e) return P;
|
|
930
930
|
const t = e.cloneNode(!0);
|
|
931
931
|
t.querySelectorAll("table div").forEach((a) => a.remove()), t.querySelectorAll("table").forEach((a) => {
|
|
932
932
|
a.removeAttribute("data-has-resize-handle");
|
|
@@ -944,32 +944,32 @@ const rn = ({
|
|
|
944
944
|
const t = document.getElementById("rte-editor-body");
|
|
945
945
|
if (!t) return;
|
|
946
946
|
const n = e.getRangeAt(0);
|
|
947
|
-
t.contains(n.startContainer) && (
|
|
947
|
+
t.contains(n.startContainer) && (I.current = n.cloneRange());
|
|
948
948
|
}, Y = () => {
|
|
949
949
|
const e = window.getSelection();
|
|
950
|
-
!e || !
|
|
950
|
+
!e || !I.current || (e.removeAllRanges(), e.addRange(I.current));
|
|
951
951
|
}, me = (e, t) => {
|
|
952
952
|
const n = window.getSelection();
|
|
953
|
-
n && n.rangeCount > 0 && (
|
|
953
|
+
n && n.rangeCount > 0 && (I.current = n.getRangeAt(0)), Y(), document.execCommand(e, !1, t), A();
|
|
954
954
|
};
|
|
955
955
|
U(() => {
|
|
956
956
|
const e = q();
|
|
957
|
-
if (!e || !
|
|
958
|
-
const t = Ue(
|
|
957
|
+
if (!e || !y) return;
|
|
958
|
+
const t = Ue(y);
|
|
959
959
|
e.innerHTML = t, A();
|
|
960
960
|
}, []);
|
|
961
961
|
const Ue = (e) => e.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g, (t) => t.replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, ""));
|
|
962
962
|
U(() => () => {
|
|
963
963
|
document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
|
|
964
964
|
}, []), U(() => {
|
|
965
|
-
|
|
965
|
+
C && C((e) => {
|
|
966
966
|
Ke(e);
|
|
967
967
|
});
|
|
968
968
|
}, []), U(() => {
|
|
969
969
|
const e = q();
|
|
970
970
|
if (!e) return;
|
|
971
971
|
e.querySelectorAll("table").forEach((n) => {
|
|
972
|
-
n.hasAttribute("data-has-resize-handle") || (
|
|
972
|
+
n.hasAttribute("data-has-resize-handle") || (ie(n), n.querySelectorAll("th, td").forEach((d) => Q(d)));
|
|
973
973
|
});
|
|
974
974
|
}, []);
|
|
975
975
|
const ge = (e) => {
|
|
@@ -982,7 +982,7 @@ const rn = ({
|
|
|
982
982
|
if (!(n != null && n.rangeCount)) return;
|
|
983
983
|
const a = n.getRangeAt(0), d = ge(a.startContainer);
|
|
984
984
|
let l, o;
|
|
985
|
-
const
|
|
985
|
+
const v = t === "insertStaticUnorderedList" || t === "insertStaticOrderedList";
|
|
986
986
|
if (d) {
|
|
987
987
|
let c = d.querySelector(e);
|
|
988
988
|
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);
|
|
@@ -990,11 +990,11 @@ const rn = ({
|
|
|
990
990
|
document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
|
|
991
991
|
const c = q();
|
|
992
992
|
if (o = c == null ? void 0 : c.querySelector(`${e}:last-child`), !o) return;
|
|
993
|
-
|
|
993
|
+
v && o.setAttribute("list-type", "static"), l = o.querySelector("li:last-child");
|
|
994
994
|
}
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
},
|
|
995
|
+
const E = document.createRange();
|
|
996
|
+
E.setStart(l, 0), E.collapse(!0), n.removeAllRanges(), n.addRange(E), (m = q()) == null || m.focus(), A();
|
|
997
|
+
}, oe = (e, t) => {
|
|
998
998
|
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");
|
|
999
999
|
}, $e = (e) => {
|
|
1000
1000
|
const t = document.createElement("span");
|
|
@@ -1003,7 +1003,7 @@ const rn = ({
|
|
|
1003
1003
|
t.remove(), $({
|
|
1004
1004
|
x: n.left,
|
|
1005
1005
|
y: n.bottom + window.scrollY
|
|
1006
|
-
}),
|
|
1006
|
+
}), R(r || []), F(!0), X.current = e.cloneRange();
|
|
1007
1007
|
}, We = () => {
|
|
1008
1008
|
const e = window.getSelection();
|
|
1009
1009
|
if (!e || e.rangeCount === 0) return null;
|
|
@@ -1015,8 +1015,8 @@ const rn = ({
|
|
|
1015
1015
|
if (a.nodeType === Node.TEXT_NODE) {
|
|
1016
1016
|
const d = a.textContent || "", l = a === t ? n : d.length, o = d.lastIndexOf("@", l - 1);
|
|
1017
1017
|
if (o !== -1) {
|
|
1018
|
-
const
|
|
1019
|
-
return
|
|
1018
|
+
const v = document.createRange();
|
|
1019
|
+
return v.setStart(a, o), v.setEnd(a, l), v;
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
a = a.previousSibling;
|
|
@@ -1038,20 +1038,20 @@ const rn = ({
|
|
|
1038
1038
|
const m = document.createRange(), c = q();
|
|
1039
1039
|
m.selectNodeContents(c), m.collapse(!1), m.insertNode(a);
|
|
1040
1040
|
}
|
|
1041
|
-
const
|
|
1042
|
-
a.after(
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1041
|
+
const v = document.createTextNode("");
|
|
1042
|
+
a.after(v);
|
|
1043
|
+
const E = document.createRange();
|
|
1044
|
+
E.setStartAfter(v), E.collapse(!0), t.removeAllRanges(), t.addRange(E);
|
|
1045
1045
|
} catch (o) {
|
|
1046
1046
|
console.error("insertMention error:", o);
|
|
1047
1047
|
}
|
|
1048
1048
|
let d = _e([...ue, e]);
|
|
1049
|
-
|
|
1049
|
+
ae(d), S(d), F(!1), (l = q()) == null || l.focus(), A();
|
|
1050
1050
|
}, Xe = (e) => {
|
|
1051
1051
|
const t = q();
|
|
1052
1052
|
if (!t) return;
|
|
1053
1053
|
let n = null;
|
|
1054
|
-
|
|
1054
|
+
I.current && t.contains(I.current.startContainer) ? n = I.current.cloneRange() : (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1));
|
|
1055
1055
|
const a = window.getSelection();
|
|
1056
1056
|
if (!a) return;
|
|
1057
1057
|
a.removeAllRanges(), a.addRange(n);
|
|
@@ -1060,11 +1060,11 @@ const rn = ({
|
|
|
1060
1060
|
const l = document.createTextNode(" ");
|
|
1061
1061
|
d.after(l);
|
|
1062
1062
|
const o = document.createRange();
|
|
1063
|
-
o.setStartAfter(l), o.collapse(!0), a.removeAllRanges(), a.addRange(o),
|
|
1063
|
+
o.setStartAfter(l), o.collapse(!0), a.removeAllRanges(), a.addRange(o), I.current = o.cloneRange(), t.focus();
|
|
1064
1064
|
}, Ke = (e) => {
|
|
1065
|
-
e.forEach((t) => Xe(t)),
|
|
1065
|
+
e.forEach((t) => Xe(t)), ae((t) => {
|
|
1066
1066
|
const n = [...t, ...e], a = Array.from(new Map(n.map((d) => [d.name, d])).values());
|
|
1067
|
-
return
|
|
1067
|
+
return S(a), a;
|
|
1068
1068
|
}), A();
|
|
1069
1069
|
}, Ye = () => {
|
|
1070
1070
|
const e = q();
|
|
@@ -1080,25 +1080,25 @@ const rn = ({
|
|
|
1080
1080
|
}, Qe = (e) => {
|
|
1081
1081
|
var n, a, d;
|
|
1082
1082
|
const t = e.key.toLowerCase();
|
|
1083
|
-
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(),
|
|
1083
|
+
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), oe(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
|
|
1084
1084
|
const l = window.getSelection(), o = l != null && l.anchorNode ? ge(l.anchorNode) : null;
|
|
1085
1085
|
if (!o) return;
|
|
1086
1086
|
if (((n = o.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
|
|
1087
1087
|
e.preventDefault();
|
|
1088
|
-
const
|
|
1088
|
+
const E = o.parentElement, m = E == null ? void 0 : E.closest("li");
|
|
1089
1089
|
if (m) {
|
|
1090
|
-
|
|
1090
|
+
E == null || E.removeChild(o);
|
|
1091
1091
|
const c = document.createElement("p");
|
|
1092
1092
|
c.innerHTML = "<br />", (a = m.parentElement) == null || a.insertBefore(c, m.nextSibling);
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1093
|
+
const h = document.createRange();
|
|
1094
|
+
h.setStart(c, 0), h.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(h);
|
|
1095
1095
|
} else {
|
|
1096
1096
|
const c = o.closest("ul, ol");
|
|
1097
1097
|
if (c) {
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1098
|
+
const h = document.createElement("p");
|
|
1099
|
+
h.innerHTML = "<br />", (d = c.parentElement) == null || d.insertBefore(h, c.nextSibling), c.removeChild(o);
|
|
1100
|
+
const w = document.createRange();
|
|
1101
|
+
w.setStart(h, 0), w.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(w);
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
1104
|
A();
|
|
@@ -1120,18 +1120,18 @@ const rn = ({
|
|
|
1120
1120
|
const n = window.getSelection();
|
|
1121
1121
|
if (!(n != null && n.rangeCount)) return;
|
|
1122
1122
|
const a = n.anchorNode;
|
|
1123
|
-
if (
|
|
1123
|
+
if (le(a))
|
|
1124
1124
|
return;
|
|
1125
1125
|
setTimeout(() => {
|
|
1126
|
-
$e(n.getRangeAt(0)),
|
|
1126
|
+
$e(n.getRangeAt(0)), re(""), R(r), F(!0);
|
|
1127
1127
|
}, 0);
|
|
1128
1128
|
return;
|
|
1129
1129
|
}
|
|
1130
|
-
if (
|
|
1130
|
+
if (H) {
|
|
1131
1131
|
setTimeout(() => he(), 0);
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
|
-
},
|
|
1134
|
+
}, le = (e) => {
|
|
1135
1135
|
if (!e) return !1;
|
|
1136
1136
|
let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
1137
1137
|
for (; t; ) {
|
|
@@ -1143,48 +1143,48 @@ const rn = ({
|
|
|
1143
1143
|
A();
|
|
1144
1144
|
const e = window.getSelection();
|
|
1145
1145
|
if (!e || !e.anchorNode) return;
|
|
1146
|
-
if (
|
|
1147
|
-
|
|
1146
|
+
if (le(e.anchorNode)) {
|
|
1147
|
+
F(!1);
|
|
1148
1148
|
return;
|
|
1149
1149
|
}
|
|
1150
1150
|
let t = e.anchorNode.textContent || "";
|
|
1151
1151
|
t = t.replace(/\u00A0/g, " ");
|
|
1152
1152
|
const n = t.match(/@([^\n]*)$/);
|
|
1153
1153
|
if (!n) {
|
|
1154
|
-
|
|
1154
|
+
F(!1);
|
|
1155
1155
|
return;
|
|
1156
1156
|
}
|
|
1157
1157
|
const a = n[1].trim().toLowerCase();
|
|
1158
|
-
|
|
1158
|
+
re(a);
|
|
1159
1159
|
const d = r.filter((l) => l.name.toLowerCase().includes(a));
|
|
1160
|
-
d.length > 0 ? (
|
|
1160
|
+
d.length > 0 ? (R(d), F(!0)) : F(!1);
|
|
1161
1161
|
}, Ge = (e) => {
|
|
1162
1162
|
var a;
|
|
1163
1163
|
const t = (a = e.target.files) == null ? void 0 : a[0];
|
|
1164
1164
|
if (!t) return;
|
|
1165
1165
|
const n = new FileReader();
|
|
1166
1166
|
n.onload = (d) => {
|
|
1167
|
-
var
|
|
1168
|
-
const l = (
|
|
1167
|
+
var w;
|
|
1168
|
+
const l = (w = d.target) == null ? void 0 : w.result;
|
|
1169
1169
|
Y();
|
|
1170
1170
|
const o = window.getSelection();
|
|
1171
|
-
let
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1171
|
+
let v = o && o.rangeCount ? o.getRangeAt(0) : null;
|
|
1172
|
+
const E = document.createElement("img");
|
|
1173
|
+
E.src = l, E.alt = t.name || "image", E.className = "rte-inserted-image", E.contentEditable = "true";
|
|
1174
1174
|
const m = q();
|
|
1175
|
-
if (!
|
|
1176
|
-
m == null || m.appendChild(
|
|
1177
|
-
const
|
|
1178
|
-
m == null || m.appendChild(
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1175
|
+
if (!v || !m) {
|
|
1176
|
+
m == null || m.appendChild(E);
|
|
1177
|
+
const O = document.createTextNode(" ");
|
|
1178
|
+
m == null || m.appendChild(O);
|
|
1179
|
+
const J = document.createRange();
|
|
1180
|
+
J.setStartAfter(O), J.collapse(!0), o == null || o.removeAllRanges(), o == null || o.addRange(J), m == null || m.focus(), A(), e.target.value = "";
|
|
1181
1181
|
return;
|
|
1182
1182
|
}
|
|
1183
|
-
|
|
1183
|
+
v.deleteContents(), v.insertNode(E);
|
|
1184
1184
|
const c = document.createTextNode(" ");
|
|
1185
|
-
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1185
|
+
E.after(c);
|
|
1186
|
+
const h = document.createRange();
|
|
1187
|
+
h.setStartAfter(c), h.collapse(!0), o.removeAllRanges(), o.addRange(h), m.focus(), A(), e.target.value = "";
|
|
1188
1188
|
}, n.readAsDataURL(t);
|
|
1189
1189
|
}, et = (e) => {
|
|
1190
1190
|
var d;
|
|
@@ -1195,7 +1195,7 @@ const rn = ({
|
|
|
1195
1195
|
n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (d = q()) == null || d.focus(), A();
|
|
1196
1196
|
}, pe = (e) => {
|
|
1197
1197
|
var c;
|
|
1198
|
-
|
|
1198
|
+
ht(), Y();
|
|
1199
1199
|
const t = document.createElement("table");
|
|
1200
1200
|
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);
|
|
1201
1201
|
const n = document.createElement("thead");
|
|
@@ -1206,22 +1206,22 @@ const rn = ({
|
|
|
1206
1206
|
p.tr && d.classList.add(p.tr);
|
|
1207
1207
|
const l = document.createElement("tr");
|
|
1208
1208
|
p.tr && l.classList.add(p.tr);
|
|
1209
|
-
for (let
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1209
|
+
for (let h = 0; h < 2; h++) {
|
|
1210
|
+
const w = document.createElement("th");
|
|
1211
|
+
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);
|
|
1212
|
+
const O = document.createElement("td");
|
|
1213
|
+
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), Q(w), Q(O), d.appendChild(w), l.appendChild(O);
|
|
1214
1214
|
}
|
|
1215
|
-
n.appendChild(d), a.appendChild(l), t.appendChild(n), t.appendChild(a),
|
|
1215
|
+
n.appendChild(d), a.appendChild(l), t.appendChild(n), t.appendChild(a), ie(t);
|
|
1216
1216
|
const o = window.getSelection();
|
|
1217
1217
|
if (!(o != null && o.rangeCount)) return;
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1218
|
+
const v = o.getRangeAt(0);
|
|
1219
|
+
v.collapse(!1), v.insertNode(t);
|
|
1220
|
+
const E = document.createElement("p");
|
|
1221
|
+
E.innerHTML = "<br/>", t.after(E);
|
|
1222
1222
|
const m = document.createRange();
|
|
1223
|
-
m.setStart(
|
|
1224
|
-
},
|
|
1223
|
+
m.setStart(E, 0), m.collapse(!0), o.removeAllRanges(), o.addRange(m), (c = q()) == null || c.focus(), A();
|
|
1224
|
+
}, ie = (e) => {
|
|
1225
1225
|
if (e.dataset.hasResizeHandle === "true") return;
|
|
1226
1226
|
const t = document.createElement("div");
|
|
1227
1227
|
Object.assign(t.style, {
|
|
@@ -1238,15 +1238,15 @@ const rn = ({
|
|
|
1238
1238
|
let n = 0, a = 0, d = 0, l = 0;
|
|
1239
1239
|
t.addEventListener("mousedown", (o) => {
|
|
1240
1240
|
o.preventDefault(), n = o.clientX, a = o.clientY;
|
|
1241
|
-
const
|
|
1242
|
-
d =
|
|
1243
|
-
const
|
|
1244
|
-
const
|
|
1245
|
-
e.style.width = `${
|
|
1241
|
+
const v = e.getBoundingClientRect();
|
|
1242
|
+
d = v.width, l = v.height;
|
|
1243
|
+
const E = (c) => {
|
|
1244
|
+
const h = Math.max(100, d + (c.clientX - n)), w = Math.max(20, l + (c.clientY - a));
|
|
1245
|
+
e.style.width = `${h}px`, e.style.height = `${w}px`, A();
|
|
1246
1246
|
}, m = () => {
|
|
1247
|
-
document.removeEventListener("mousemove",
|
|
1247
|
+
document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", m), A();
|
|
1248
1248
|
};
|
|
1249
|
-
document.addEventListener("mousemove",
|
|
1249
|
+
document.addEventListener("mousemove", E), document.addEventListener("mouseup", m);
|
|
1250
1250
|
}), e.appendChild(t);
|
|
1251
1251
|
}, Q = (e) => {
|
|
1252
1252
|
const t = document.createElement("div"), n = document.createElement("div");
|
|
@@ -1278,18 +1278,18 @@ const rn = ({
|
|
|
1278
1278
|
}, tt = (e, t, n) => {
|
|
1279
1279
|
let a = 0, d = 0, l = 0, o = 0;
|
|
1280
1280
|
t.addEventListener("mousedown", (c) => {
|
|
1281
|
-
c.preventDefault(), a = c.clientX, l = e.offsetWidth, document.addEventListener("mousemove",
|
|
1281
|
+
c.preventDefault(), a = c.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", m);
|
|
1282
1282
|
}), n.addEventListener("mousedown", (c) => {
|
|
1283
|
-
c.preventDefault(), d = c.clientY, o = e.offsetHeight, document.addEventListener("mousemove",
|
|
1283
|
+
c.preventDefault(), d = c.clientY, o = e.offsetHeight, document.addEventListener("mousemove", E), document.addEventListener("mouseup", m);
|
|
1284
1284
|
});
|
|
1285
|
-
const
|
|
1286
|
-
const
|
|
1287
|
-
e.style.width = `${Math.max(30,
|
|
1288
|
-
},
|
|
1289
|
-
const
|
|
1290
|
-
e.style.height = `${Math.max(20,
|
|
1285
|
+
const v = (c) => {
|
|
1286
|
+
const h = l + (c.clientX - a);
|
|
1287
|
+
e.style.width = `${Math.max(30, h)}px`, A();
|
|
1288
|
+
}, E = (c) => {
|
|
1289
|
+
const h = o + (c.clientY - d);
|
|
1290
|
+
e.style.height = `${Math.max(20, h)}px`, A();
|
|
1291
1291
|
}, m = () => {
|
|
1292
|
-
document.removeEventListener("mousemove",
|
|
1292
|
+
document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", m), A();
|
|
1293
1293
|
};
|
|
1294
1294
|
}, nt = (e) => {
|
|
1295
1295
|
const n = e.target.closest("td, th");
|
|
@@ -1304,21 +1304,21 @@ const rn = ({
|
|
|
1304
1304
|
}, rt = (e) => {
|
|
1305
1305
|
if (!B.cell) return;
|
|
1306
1306
|
const t = B.cell.closest("table"), n = B.cell.cellIndex, a = B.cell.parentElement.rowIndex, d = (l) => {
|
|
1307
|
-
const o = l.tagName.toLowerCase(),
|
|
1308
|
-
return
|
|
1307
|
+
const o = l.tagName.toLowerCase(), v = document.createElement(o);
|
|
1308
|
+
return v.textContent = "", v.style.cssText = l.style.cssText, Q(v), v;
|
|
1309
1309
|
};
|
|
1310
1310
|
switch (e) {
|
|
1311
1311
|
case "insertRowAbove": {
|
|
1312
1312
|
const l = t.rows[a], o = t.insertRow(a);
|
|
1313
|
-
Array.from(l.cells).forEach((
|
|
1314
|
-
o.appendChild(d(
|
|
1313
|
+
Array.from(l.cells).forEach((v) => {
|
|
1314
|
+
o.appendChild(d(v));
|
|
1315
1315
|
});
|
|
1316
1316
|
break;
|
|
1317
1317
|
}
|
|
1318
1318
|
case "insertRowBelow": {
|
|
1319
1319
|
const l = t.rows[a], o = t.insertRow(a + 1);
|
|
1320
|
-
Array.from(l.cells).forEach((
|
|
1321
|
-
o.appendChild(d(
|
|
1320
|
+
Array.from(l.cells).forEach((v) => {
|
|
1321
|
+
o.appendChild(d(v));
|
|
1322
1322
|
});
|
|
1323
1323
|
break;
|
|
1324
1324
|
}
|
|
@@ -1349,7 +1349,7 @@ const rn = ({
|
|
|
1349
1349
|
visible: !1
|
|
1350
1350
|
})), ve();
|
|
1351
1351
|
}, at = () => {
|
|
1352
|
-
K(),
|
|
1352
|
+
K(), G.current = I.current, de({
|
|
1353
1353
|
url: "",
|
|
1354
1354
|
text: "",
|
|
1355
1355
|
title: "",
|
|
@@ -1357,8 +1357,8 @@ const rn = ({
|
|
|
1357
1357
|
}), V(!0);
|
|
1358
1358
|
}, ot = (e) => {
|
|
1359
1359
|
const t = window.getSelection();
|
|
1360
|
-
if (!t || !
|
|
1361
|
-
t.removeAllRanges(), t.addRange(
|
|
1360
|
+
if (!t || !G.current) return;
|
|
1361
|
+
t.removeAllRanges(), t.addRange(G.current);
|
|
1362
1362
|
let n = e.url.trim();
|
|
1363
1363
|
/^https?:\/\//i.test(n) || (n = "https://" + n);
|
|
1364
1364
|
const a = document.createElement("a");
|
|
@@ -1379,7 +1379,7 @@ const rn = ({
|
|
|
1379
1379
|
}
|
|
1380
1380
|
e.preventDefault();
|
|
1381
1381
|
const a = document.createRange();
|
|
1382
|
-
a.selectNode(n),
|
|
1382
|
+
a.selectNode(n), G.current = a, de({
|
|
1383
1383
|
url: n.href,
|
|
1384
1384
|
text: n.textContent || n.href,
|
|
1385
1385
|
title: n.title,
|
|
@@ -1390,9 +1390,9 @@ const rn = ({
|
|
|
1390
1390
|
const e = q();
|
|
1391
1391
|
if (!e) return;
|
|
1392
1392
|
const t = window.getSelection();
|
|
1393
|
-
if ((!t || t.rangeCount === 0) &&
|
|
1393
|
+
if ((!t || t.rangeCount === 0) && I.current) {
|
|
1394
1394
|
const c = window.getSelection();
|
|
1395
|
-
c == null || c.removeAllRanges(), c == null || c.addRange(
|
|
1395
|
+
c == null || c.removeAllRanges(), c == null || c.addRange(I.current);
|
|
1396
1396
|
}
|
|
1397
1397
|
const n = window.getSelection();
|
|
1398
1398
|
if (!n || n.rangeCount === 0) return;
|
|
@@ -1400,22 +1400,22 @@ const rn = ({
|
|
|
1400
1400
|
Y(), document.execCommand("removeFormat", !1);
|
|
1401
1401
|
const d = a.cloneContents(), l = document.createElement("div");
|
|
1402
1402
|
l.appendChild(d);
|
|
1403
|
-
const o = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null),
|
|
1403
|
+
const o = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), v = [];
|
|
1404
1404
|
for (; o.nextNode(); ) {
|
|
1405
|
-
const c = o.currentNode,
|
|
1406
|
-
|
|
1405
|
+
const c = o.currentNode, h = c.tagName.toUpperCase(), w = c.getAttribute && c.getAttribute("data-mention") !== null;
|
|
1406
|
+
h !== "A" && !w && v.push(c);
|
|
1407
1407
|
}
|
|
1408
|
-
for (let c =
|
|
1409
|
-
const
|
|
1410
|
-
if (
|
|
1411
|
-
for (;
|
|
1412
|
-
|
|
1408
|
+
for (let c = v.length - 1; c >= 0; c--) {
|
|
1409
|
+
const h = v[c], w = h.parentNode;
|
|
1410
|
+
if (w) {
|
|
1411
|
+
for (; h.firstChild; ) w.insertBefore(h.firstChild, h);
|
|
1412
|
+
w.removeChild(h);
|
|
1413
1413
|
}
|
|
1414
1414
|
}
|
|
1415
1415
|
l.querySelectorAll("[style]").forEach((c) => c.removeAttribute("style")), a.deleteContents();
|
|
1416
|
-
const
|
|
1417
|
-
for (; l.firstChild; )
|
|
1418
|
-
a.insertNode(
|
|
1416
|
+
const E = document.createDocumentFragment();
|
|
1417
|
+
for (; l.firstChild; ) E.appendChild(l.firstChild);
|
|
1418
|
+
a.insertNode(E);
|
|
1419
1419
|
const m = document.createRange();
|
|
1420
1420
|
m.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), m.collapse(!0), n.removeAllRanges(), n.addRange(m), e.normalize(), A();
|
|
1421
1421
|
}, ct = (e) => {
|
|
@@ -1442,8 +1442,8 @@ const rn = ({
|
|
|
1442
1442
|
const t = e.getRangeAt(0);
|
|
1443
1443
|
if (t.collapsed) {
|
|
1444
1444
|
let l = t.startContainer, o = l.nodeType === Node.ELEMENT_NODE ? l : l.parentElement;
|
|
1445
|
-
const
|
|
1446
|
-
return
|
|
1445
|
+
const v = o == null ? void 0 : o.closest("td, th");
|
|
1446
|
+
return v ? [v] : [];
|
|
1447
1447
|
}
|
|
1448
1448
|
const n = t.commonAncestorContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
|
|
1449
1449
|
return Array.from(a.querySelectorAll("td, th")).filter((l) => {
|
|
@@ -1462,47 +1462,66 @@ const rn = ({
|
|
|
1462
1462
|
a.style.textAlign = n;
|
|
1463
1463
|
}), A();
|
|
1464
1464
|
}
|
|
1465
|
-
const ut = (
|
|
1466
|
-
e.
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
if (
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1465
|
+
const ut = () => {
|
|
1466
|
+
const e = window.getSelection();
|
|
1467
|
+
if (!e || !e.anchorNode) return !1;
|
|
1468
|
+
let t = e.anchorNode.nodeType === Node.ELEMENT_NODE ? e.anchorNode : e.anchorNode.parentElement;
|
|
1469
|
+
for (; t; ) {
|
|
1470
|
+
if (t.tagName === "TABLE") return !0;
|
|
1471
|
+
t = t.parentElement;
|
|
1472
|
+
}
|
|
1473
|
+
return !1;
|
|
1474
|
+
}, mt = (e) => {
|
|
1475
|
+
if (ut()) {
|
|
1476
|
+
e.preventDefault();
|
|
1477
|
+
const m = e.clipboardData.getData("text/plain");
|
|
1478
|
+
if (!m) return;
|
|
1479
|
+
const c = window.getSelection();
|
|
1480
|
+
if (!c || !c.rangeCount) return;
|
|
1481
|
+
const h = c.getRangeAt(0);
|
|
1482
|
+
h.deleteContents();
|
|
1483
|
+
const w = m.split(/\r?\n/);
|
|
1484
|
+
w.forEach((O, J) => {
|
|
1485
|
+
h.insertNode(document.createTextNode(O)), J < w.length - 1 && h.insertNode(document.createElement("br"));
|
|
1486
|
+
}), h.collapse(!1), c.removeAllRanges(), c.addRange(h), A();
|
|
1487
|
+
return;
|
|
1475
1488
|
}
|
|
1476
|
-
const
|
|
1477
|
-
if (!
|
|
1489
|
+
const t = e.clipboardData.getData("text/html") || "";
|
|
1490
|
+
if (!t) return;
|
|
1491
|
+
const n = document.createElement("div");
|
|
1492
|
+
if (n.innerHTML = t, n.querySelector("img")) {
|
|
1493
|
+
e.preventDefault();
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1496
|
+
e.preventDefault();
|
|
1478
1497
|
const a = document.createElement("div");
|
|
1479
|
-
a.innerHTML =
|
|
1498
|
+
a.innerHTML = t;
|
|
1480
1499
|
const d = (m) => {
|
|
1481
|
-
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) => {
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1500
|
+
m.hasAttribute("data-has-resize-handle") || (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) => {
|
|
1501
|
+
const h = c;
|
|
1502
|
+
h.style.border = "1px solid #999", h.style.padding = "4px", h.style.position = "relative", h.style.backgroundColor = "lightgray", h.style.height = "20px";
|
|
1484
1503
|
}), m.querySelectorAll("td").forEach((c) => {
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
});
|
|
1504
|
+
const h = c;
|
|
1505
|
+
h.style.border = "1px solid #999", h.style.padding = "4px", h.style.position = "relative", h.style.backgroundColor = "#fff", h.style.height = "20px";
|
|
1506
|
+
}));
|
|
1488
1507
|
};
|
|
1489
1508
|
a.querySelectorAll("table").forEach((m) => d(m));
|
|
1490
1509
|
const l = window.getSelection();
|
|
1491
1510
|
if (!l || !l.rangeCount) return;
|
|
1492
1511
|
const o = l.getRangeAt(0);
|
|
1493
1512
|
o.deleteContents();
|
|
1494
|
-
const
|
|
1495
|
-
for (; a.firstChild; )
|
|
1496
|
-
o.insertNode(
|
|
1497
|
-
const
|
|
1498
|
-
|
|
1513
|
+
const v = document.createDocumentFragment();
|
|
1514
|
+
for (; a.firstChild; ) v.appendChild(a.firstChild);
|
|
1515
|
+
o.insertNode(v), o.collapse(!1), l.removeAllRanges(), l.addRange(o);
|
|
1516
|
+
const E = x.current;
|
|
1517
|
+
E && (E.querySelectorAll("table").forEach((m) => {
|
|
1499
1518
|
const c = m;
|
|
1500
|
-
c.hasAttribute("data-has-resize-handle") || (
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1519
|
+
c.hasAttribute("data-has-resize-handle") || (ie(c), c.querySelectorAll("th, td").forEach((h) => {
|
|
1520
|
+
const w = h;
|
|
1521
|
+
w.dataset.hasResizeHandles || Q(w);
|
|
1503
1522
|
}));
|
|
1504
1523
|
}), A());
|
|
1505
|
-
},
|
|
1524
|
+
}, gt = (e) => {
|
|
1506
1525
|
Y();
|
|
1507
1526
|
const t = window.getSelection();
|
|
1508
1527
|
if (!t || !t.rangeCount) return;
|
|
@@ -1510,11 +1529,11 @@ const rn = ({
|
|
|
1510
1529
|
a.style.fontSize = `${e}px`, a.appendChild(n.extractContents()), n.insertNode(a);
|
|
1511
1530
|
const d = document.createRange();
|
|
1512
1531
|
d.setStartAfter(a), d.collapse(!0), t.removeAllRanges(), t.addRange(d), A();
|
|
1513
|
-
},
|
|
1532
|
+
}, ft = () => {
|
|
1514
1533
|
const e = window.getSelection();
|
|
1515
1534
|
if (!e || !e.anchorNode) return null;
|
|
1516
1535
|
const t = e.anchorNode;
|
|
1517
|
-
if (
|
|
1536
|
+
if (le(t) || t.nodeType !== Node.TEXT_NODE) return null;
|
|
1518
1537
|
const n = t.textContent || "", a = e.anchorOffset, d = n.lastIndexOf("@", a - 1);
|
|
1519
1538
|
if (d === -1) return null;
|
|
1520
1539
|
const l = n.substring(d + 1, a);
|
|
@@ -1525,7 +1544,7 @@ const rn = ({
|
|
|
1525
1544
|
query: l
|
|
1526
1545
|
};
|
|
1527
1546
|
}, ye = () => {
|
|
1528
|
-
const e =
|
|
1547
|
+
const e = ft();
|
|
1529
1548
|
if (!e) return;
|
|
1530
1549
|
const {
|
|
1531
1550
|
range: t,
|
|
@@ -1536,58 +1555,58 @@ const rn = ({
|
|
|
1536
1555
|
a.remove(), $({
|
|
1537
1556
|
x: d.left,
|
|
1538
1557
|
y: d.bottom + window.scrollY
|
|
1539
|
-
}),
|
|
1558
|
+
}), re(n.toLowerCase());
|
|
1540
1559
|
const l = r.filter((o) => o.name.toLowerCase().includes(n.toLowerCase()));
|
|
1541
|
-
|
|
1560
|
+
R(l), F(!0), X.current = t.cloneRange();
|
|
1542
1561
|
};
|
|
1543
|
-
function
|
|
1544
|
-
const e =
|
|
1562
|
+
function ht() {
|
|
1563
|
+
const e = x.current;
|
|
1545
1564
|
if (!e) return;
|
|
1546
1565
|
const t = window.getSelection();
|
|
1547
1566
|
if (!t || t.rangeCount > 0 && e.contains(t.anchorNode))
|
|
1548
1567
|
return;
|
|
1549
1568
|
const n = document.createRange();
|
|
1550
|
-
n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n),
|
|
1569
|
+
n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n), I.current = n.cloneRange();
|
|
1551
1570
|
}
|
|
1552
|
-
const
|
|
1571
|
+
const pt = (e) => {
|
|
1553
1572
|
const t = e.target;
|
|
1554
|
-
if (!t || !(t.textContent || "").match(/{{([\s\S]+?)}}/) || !
|
|
1573
|
+
if (!t || !(t.textContent || "").match(/{{([\s\S]+?)}}/) || !x.current) return;
|
|
1555
1574
|
let l = t.firstChild;
|
|
1556
1575
|
if ((!l || l.nodeType !== Node.TEXT_NODE) && (l = t.childNodes[0]), !l || l.nodeType !== Node.TEXT_NODE) return;
|
|
1557
|
-
const o = l.textContent || "",
|
|
1558
|
-
if (
|
|
1576
|
+
const o = l.textContent || "", v = o.indexOf("{{"), E = o.indexOf("}}");
|
|
1577
|
+
if (v === -1 || E === -1) return;
|
|
1559
1578
|
const m = window.getSelection();
|
|
1560
1579
|
if (!m) return;
|
|
1561
1580
|
const c = document.createRange();
|
|
1562
|
-
c.setStart(l,
|
|
1581
|
+
c.setStart(l, v), c.setEnd(l, E + 2), m.removeAllRanges(), m.addRange(c);
|
|
1563
1582
|
};
|
|
1564
1583
|
return /* @__PURE__ */ i.createElement("div", {
|
|
1565
1584
|
className: `rte-wrapper ${(p == null ? void 0 : p.wrapper) || ""}`,
|
|
1566
|
-
style:
|
|
1585
|
+
style: M.wrapper
|
|
1567
1586
|
}, /* @__PURE__ */ i.createElement("div", {
|
|
1568
1587
|
style: {
|
|
1569
1588
|
flex: 1
|
|
1570
1589
|
}
|
|
1571
|
-
}, /* @__PURE__ */ i.createElement(
|
|
1572
|
-
exec:
|
|
1590
|
+
}, /* @__PURE__ */ i.createElement(Yt, {
|
|
1591
|
+
exec: oe,
|
|
1573
1592
|
saveSelection: K,
|
|
1574
1593
|
handleFileChange: Ge,
|
|
1575
|
-
handleFontSizeChange: (e) =>
|
|
1576
|
-
handleFontFamilyChange: (e) =>
|
|
1594
|
+
handleFontSizeChange: (e) => gt(e.target.value),
|
|
1595
|
+
handleFontFamilyChange: (e) => oe("fontName", e.target.value),
|
|
1577
1596
|
insertEmoji: et,
|
|
1578
1597
|
handleLink: at,
|
|
1579
1598
|
removeFormatting: it,
|
|
1580
1599
|
visibleActions: Pe,
|
|
1581
1600
|
className: p.toolbar,
|
|
1582
|
-
style:
|
|
1601
|
+
style: M.toolbar
|
|
1583
1602
|
}), /* @__PURE__ */ i.createElement("div", {
|
|
1584
|
-
ref:
|
|
1603
|
+
ref: x,
|
|
1585
1604
|
id: "rte-editor-body",
|
|
1586
1605
|
className: `rte-editor ${(p == null ? void 0 : p.editor) || ""}`,
|
|
1587
|
-
style:
|
|
1606
|
+
style: M.editor,
|
|
1588
1607
|
contentEditable: !0,
|
|
1589
1608
|
suppressContentEditableWarning: !0,
|
|
1590
|
-
onPaste:
|
|
1609
|
+
onPaste: mt,
|
|
1591
1610
|
onKeyUp: () => {
|
|
1592
1611
|
K(), ye();
|
|
1593
1612
|
},
|
|
@@ -1601,18 +1620,18 @@ const rn = ({
|
|
|
1601
1620
|
onClick: (e) => {
|
|
1602
1621
|
lt(e), K(), ye();
|
|
1603
1622
|
},
|
|
1604
|
-
onDoubleClick:
|
|
1605
|
-
}), /* @__PURE__ */ i.createElement(
|
|
1606
|
-
show:
|
|
1607
|
-
position:
|
|
1623
|
+
onDoubleClick: pt
|
|
1624
|
+
}), /* @__PURE__ */ i.createElement(Qt, {
|
|
1625
|
+
show: H,
|
|
1626
|
+
position: z,
|
|
1608
1627
|
filtered: Z,
|
|
1609
1628
|
insertMention: Ze,
|
|
1610
|
-
onClose: () =>
|
|
1629
|
+
onClose: () => F(!1),
|
|
1611
1630
|
query: qe
|
|
1612
1631
|
}), s && /* @__PURE__ */ i.createElement("div", {
|
|
1613
1632
|
className: `rte-output ${(p == null ? void 0 : p.output) || ""}`,
|
|
1614
|
-
style:
|
|
1615
|
-
}, /* @__PURE__ */ i.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ i.createElement("p", null,
|
|
1633
|
+
style: M.output
|
|
1634
|
+
}, /* @__PURE__ */ i.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ i.createElement("p", null, _)), /* @__PURE__ */ i.createElement(Jt, {
|
|
1616
1635
|
visible: B.visible,
|
|
1617
1636
|
x: B.x,
|
|
1618
1637
|
y: B.y,
|
|
@@ -1622,19 +1641,19 @@ const rn = ({
|
|
|
1622
1641
|
visible: !1
|
|
1623
1642
|
})), ve();
|
|
1624
1643
|
}
|
|
1625
|
-
}), /* @__PURE__ */ i.createElement(
|
|
1626
|
-
visible:
|
|
1644
|
+
}), /* @__PURE__ */ i.createElement(en, {
|
|
1645
|
+
visible: b,
|
|
1627
1646
|
linkData: Ie,
|
|
1628
1647
|
onClose: () => V(!1),
|
|
1629
1648
|
onInsert: ot
|
|
1630
|
-
})), u ? /* @__PURE__ */ i.createElement(
|
|
1649
|
+
})), u ? /* @__PURE__ */ i.createElement(Gt, {
|
|
1631
1650
|
className: p.preview,
|
|
1632
|
-
style:
|
|
1633
|
-
html:
|
|
1651
|
+
style: M.preview,
|
|
1652
|
+
html: _
|
|
1634
1653
|
}) : null);
|
|
1635
1654
|
};
|
|
1636
1655
|
export {
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1656
|
+
an as RichTextEditor,
|
|
1657
|
+
Gt as RtePreview,
|
|
1658
|
+
Yt as RteToolbar
|
|
1640
1659
|
};
|