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