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