@ryzeup/richtexteditor 1.0.6 → 1.0.8
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 +636 -552
- package/dist/index.js +6 -1
- package/dist/index.umd.js +6 -1
- package/dist/richtexteditor.css +1 -1
- package/package.json +1 -1
- package/dist/vite.svg +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var Je = Object.defineProperty, Ge = Object.defineProperties;
|
|
2
|
+
var et = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ye = Object.getOwnPropertySymbols;
|
|
4
|
+
var tt = Object.prototype.hasOwnProperty, nt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ce = (t, c, s) => c in t ? Je(t, c, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[c] = s, G = (t, c) => {
|
|
6
|
+
for (var s in c || (c = {}))
|
|
7
|
+
tt.call(c, s) && Ce(t, s, c[s]);
|
|
8
|
+
if (ye)
|
|
9
|
+
for (var s of ye(c))
|
|
10
|
+
nt.call(c, s) && Ce(t, s, c[s]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
13
|
-
import * as
|
|
14
|
-
import
|
|
15
|
-
window.React =
|
|
16
|
-
var
|
|
12
|
+
}, ee = (t, c) => Ge(t, et(c));
|
|
13
|
+
import * as rt from "react";
|
|
14
|
+
import a, { useRef as _, useState as N, useEffect as B } from "react";
|
|
15
|
+
window.React = rt;
|
|
16
|
+
var Re = {
|
|
17
17
|
color: void 0,
|
|
18
18
|
size: void 0,
|
|
19
19
|
className: void 0,
|
|
20
20
|
style: void 0,
|
|
21
21
|
attr: void 0
|
|
22
|
-
},
|
|
23
|
-
function
|
|
22
|
+
}, be = a.createContext && /* @__PURE__ */ a.createContext(Re), at = ["attr", "size", "title"];
|
|
23
|
+
function ot(t, c) {
|
|
24
24
|
if (t == null) return {};
|
|
25
|
-
var
|
|
25
|
+
var s = lt(t, c), d, v;
|
|
26
26
|
if (Object.getOwnPropertySymbols) {
|
|
27
27
|
var y = Object.getOwnPropertySymbols(t);
|
|
28
28
|
for (v = 0; v < y.length; v++)
|
|
29
|
-
d = y[v], !(c.indexOf(d) >= 0) && Object.prototype.propertyIsEnumerable.call(t, d) && (
|
|
29
|
+
d = y[v], !(c.indexOf(d) >= 0) && Object.prototype.propertyIsEnumerable.call(t, d) && (s[d] = t[d]);
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return s;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function lt(t, c) {
|
|
34
34
|
if (t == null) return {};
|
|
35
|
-
var
|
|
35
|
+
var s = {};
|
|
36
36
|
for (var d in t)
|
|
37
37
|
if (Object.prototype.hasOwnProperty.call(t, d)) {
|
|
38
38
|
if (c.indexOf(d) >= 0) continue;
|
|
39
|
-
|
|
39
|
+
s[d] = t[d];
|
|
40
40
|
}
|
|
41
|
-
return
|
|
41
|
+
return s;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function X() {
|
|
44
|
+
return X = Object.assign ? Object.assign.bind() : function(t) {
|
|
45
45
|
for (var c = 1; c < arguments.length; c++) {
|
|
46
|
-
var
|
|
47
|
-
for (var d in
|
|
48
|
-
Object.prototype.hasOwnProperty.call(
|
|
46
|
+
var s = arguments[c];
|
|
47
|
+
for (var d in s)
|
|
48
|
+
Object.prototype.hasOwnProperty.call(s, d) && (t[d] = s[d]);
|
|
49
49
|
}
|
|
50
50
|
return t;
|
|
51
|
-
},
|
|
51
|
+
}, X.apply(this, arguments);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
var
|
|
53
|
+
function xe(t, c) {
|
|
54
|
+
var s = Object.keys(t);
|
|
55
55
|
if (Object.getOwnPropertySymbols) {
|
|
56
56
|
var d = Object.getOwnPropertySymbols(t);
|
|
57
57
|
c && (d = d.filter(function(v) {
|
|
58
58
|
return Object.getOwnPropertyDescriptor(t, v).enumerable;
|
|
59
|
-
})),
|
|
59
|
+
})), s.push.apply(s, d);
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return s;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Y(t) {
|
|
64
64
|
for (var c = 1; c < arguments.length; c++) {
|
|
65
|
-
var
|
|
66
|
-
c % 2 ?
|
|
67
|
-
|
|
68
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(
|
|
69
|
-
Object.defineProperty(t, d, Object.getOwnPropertyDescriptor(
|
|
65
|
+
var s = arguments[c] != null ? arguments[c] : {};
|
|
66
|
+
c % 2 ? xe(Object(s), !0).forEach(function(d) {
|
|
67
|
+
ct(t, d, s[d]);
|
|
68
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(s)) : xe(Object(s)).forEach(function(d) {
|
|
69
|
+
Object.defineProperty(t, d, Object.getOwnPropertyDescriptor(s, d));
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
return t;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return c =
|
|
74
|
+
function ct(t, c, s) {
|
|
75
|
+
return c = it(c), c in t ? Object.defineProperty(t, c, { value: s, enumerable: !0, configurable: !0, writable: !0 }) : t[c] = s, t;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
var c =
|
|
77
|
+
function it(t) {
|
|
78
|
+
var c = st(t, "string");
|
|
79
79
|
return typeof c == "symbol" ? c : c + "";
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function st(t, c) {
|
|
82
82
|
if (typeof t != "object" || !t) return t;
|
|
83
|
-
var
|
|
84
|
-
if (
|
|
85
|
-
var d =
|
|
83
|
+
var s = t[Symbol.toPrimitive];
|
|
84
|
+
if (s !== void 0) {
|
|
85
|
+
var d = s.call(t, c);
|
|
86
86
|
if (typeof d != "object") return d;
|
|
87
87
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
88
88
|
}
|
|
89
89
|
return (c === "string" ? String : Number)(t);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
return t && t.map((c,
|
|
93
|
-
key:
|
|
94
|
-
}, c.attr),
|
|
91
|
+
function Se(t) {
|
|
92
|
+
return t && t.map((c, s) => /* @__PURE__ */ a.createElement(c.tag, Y({
|
|
93
|
+
key: s
|
|
94
|
+
}, c.attr), Se(c.child)));
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return (c) => /* @__PURE__ */
|
|
98
|
-
attr:
|
|
99
|
-
}, c),
|
|
96
|
+
function S(t) {
|
|
97
|
+
return (c) => /* @__PURE__ */ a.createElement(dt, X({
|
|
98
|
+
attr: Y({}, t.attr)
|
|
99
|
+
}, c), Se(t.child));
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
var c = (
|
|
101
|
+
function dt(t) {
|
|
102
|
+
var c = (s) => {
|
|
103
103
|
var {
|
|
104
104
|
attr: d,
|
|
105
105
|
size: v,
|
|
106
106
|
title: y
|
|
107
|
-
} = t, R =
|
|
108
|
-
return
|
|
107
|
+
} = t, R = ot(t, at), L = v || s.size || "1em", E;
|
|
108
|
+
return s.className && (E = s.className), t.className && (E = (E ? E + " " : "") + t.className), /* @__PURE__ */ a.createElement("svg", X({
|
|
109
109
|
stroke: "currentColor",
|
|
110
110
|
fill: "currentColor",
|
|
111
111
|
strokeWidth: "0"
|
|
112
|
-
},
|
|
113
|
-
className:
|
|
114
|
-
style:
|
|
115
|
-
color: t.color ||
|
|
116
|
-
},
|
|
117
|
-
height:
|
|
118
|
-
width:
|
|
112
|
+
}, s.attr, d, R, {
|
|
113
|
+
className: E,
|
|
114
|
+
style: Y(Y({
|
|
115
|
+
color: t.color || s.color
|
|
116
|
+
}, s.style), t.style),
|
|
117
|
+
height: L,
|
|
118
|
+
width: L,
|
|
119
119
|
xmlns: "http://www.w3.org/2000/svg"
|
|
120
|
-
}), y && /* @__PURE__ */
|
|
120
|
+
}), y && /* @__PURE__ */ a.createElement("title", null, y), t.children);
|
|
121
121
|
};
|
|
122
|
-
return
|
|
122
|
+
return be !== void 0 ? /* @__PURE__ */ a.createElement(be.Consumer, null, (s) => c(s)) : c(Re);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
return
|
|
124
|
+
function ut(t) {
|
|
125
|
+
return S({ 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: [] }] })(t);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
return
|
|
127
|
+
function mt(t) {
|
|
128
|
+
return S({ 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: [] }] })(t);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
130
|
+
function gt(t) {
|
|
131
|
+
return S({ 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: [] }] })(t);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
return
|
|
133
|
+
function ht(t) {
|
|
134
|
+
return S({ 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: [] }] })(t);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
136
|
+
function ft(t) {
|
|
137
|
+
return S({ 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: [] }] })(t);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
return
|
|
139
|
+
function pt(t) {
|
|
140
|
+
return S({ 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: [] }] })(t);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
142
|
+
function vt(t) {
|
|
143
|
+
return S({ 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: [] }] })(t);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
return
|
|
145
|
+
function Et(t) {
|
|
146
|
+
return S({ 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: [] }] })(t);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
148
|
+
function wt(t) {
|
|
149
|
+
return S({ 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: [] }] })(t);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
151
|
+
function yt(t) {
|
|
152
|
+
return S({ 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: [] }] })(t);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
154
|
+
function Ct(t) {
|
|
155
|
+
return S({ 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: [] }] })(t);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
return
|
|
157
|
+
function bt(t) {
|
|
158
|
+
return S({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z" }, child: [] }] })(t);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
return
|
|
160
|
+
function xt(t) {
|
|
161
|
+
return S({ 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: [] }] })(t);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return
|
|
163
|
+
function Lt(t) {
|
|
164
|
+
return S({ 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: [] }] })(t);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
return
|
|
166
|
+
function Rt(t) {
|
|
167
|
+
return S({ 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: [] }] })(t);
|
|
168
168
|
}
|
|
169
|
-
const
|
|
169
|
+
const St = [
|
|
170
170
|
"😀",
|
|
171
171
|
"😁",
|
|
172
172
|
"😂",
|
|
@@ -278,144 +278,191 @@ const Et = [
|
|
|
278
278
|
"👏",
|
|
279
279
|
"🫶",
|
|
280
280
|
"👐"
|
|
281
|
-
],
|
|
281
|
+
], Mt = ({
|
|
282
282
|
exec: t,
|
|
283
283
|
saveSelection: c,
|
|
284
|
-
handleFileChange:
|
|
284
|
+
handleFileChange: s,
|
|
285
285
|
handleFontSizeChange: d,
|
|
286
286
|
handleFontFamilyChange: v,
|
|
287
287
|
// insertListBlock,
|
|
288
288
|
insertEmoji: y,
|
|
289
289
|
handleLink: R,
|
|
290
|
-
removeFormatting:
|
|
291
|
-
visibleActions:
|
|
292
|
-
className:
|
|
293
|
-
style:
|
|
290
|
+
removeFormatting: L,
|
|
291
|
+
visibleActions: E,
|
|
292
|
+
className: T,
|
|
293
|
+
style: H
|
|
294
294
|
}) => {
|
|
295
|
-
var
|
|
296
|
-
const
|
|
295
|
+
var A, P;
|
|
296
|
+
const M = _(null), D = _(null), b = _(null), [F, q] = N(!1);
|
|
297
297
|
B(() => {
|
|
298
|
-
const
|
|
299
|
-
!
|
|
298
|
+
const h = (w) => {
|
|
299
|
+
!w.target.closest(".rte-emoji-popup") && !w.target.closest("button[title='Emoji']") && q(!1);
|
|
300
300
|
};
|
|
301
|
-
return document.addEventListener("mousedown",
|
|
301
|
+
return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
|
|
302
302
|
}, []);
|
|
303
|
-
const
|
|
304
|
-
var
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
switch (
|
|
303
|
+
const j = (h) => {
|
|
304
|
+
var I;
|
|
305
|
+
h.preventDefault();
|
|
306
|
+
const w = h.currentTarget.dataset.command;
|
|
307
|
+
if (w)
|
|
308
|
+
switch (w) {
|
|
309
309
|
case "bold":
|
|
310
310
|
case "italic":
|
|
311
311
|
case "underline":
|
|
312
312
|
case "insertUnorderedList":
|
|
313
313
|
case "insertOrderedList":
|
|
314
314
|
case "removeFormat":
|
|
315
|
-
t(
|
|
315
|
+
t(w);
|
|
316
316
|
break;
|
|
317
317
|
case "insertImage": {
|
|
318
|
-
(
|
|
318
|
+
(I = M.current) == null || I.click();
|
|
319
319
|
break;
|
|
320
320
|
}
|
|
321
321
|
default:
|
|
322
|
-
console.warn("Unknown command:",
|
|
322
|
+
console.warn("Unknown command:", w);
|
|
323
323
|
}
|
|
324
|
-
},
|
|
325
|
-
t("foreColor",
|
|
326
|
-
},
|
|
327
|
-
t("backColor",
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
324
|
+
}, Z = (h) => {
|
|
325
|
+
t("foreColor", h.target.value);
|
|
326
|
+
}, V = (h) => {
|
|
327
|
+
t("backColor", h.target.value);
|
|
328
|
+
}, [x, U] = N({
|
|
329
|
+
bold: !1,
|
|
330
|
+
italic: !1,
|
|
331
|
+
underline: !1,
|
|
332
|
+
unorderedList: !1,
|
|
333
|
+
orderedList: !1,
|
|
334
|
+
alignLeft: !1,
|
|
335
|
+
alignCenter: !1,
|
|
336
|
+
alignRight: !1,
|
|
337
|
+
removeFormat: !1,
|
|
338
|
+
link: !1,
|
|
339
|
+
image: !1,
|
|
340
|
+
emoji: !1,
|
|
341
|
+
table: !1,
|
|
342
|
+
color: !1,
|
|
343
|
+
highlight: !1
|
|
344
|
+
});
|
|
345
|
+
return B(() => {
|
|
346
|
+
const h = () => {
|
|
347
|
+
U({
|
|
348
|
+
bold: document.queryCommandState("bold"),
|
|
349
|
+
italic: document.queryCommandState("italic"),
|
|
350
|
+
underline: document.queryCommandState("underline"),
|
|
351
|
+
unorderedList: document.queryCommandState("insertUnorderedList"),
|
|
352
|
+
orderedList: document.queryCommandState("insertOrderedList"),
|
|
353
|
+
alignLeft: document.queryCommandState("justifyLeft"),
|
|
354
|
+
alignCenter: document.queryCommandState("justifyCenter"),
|
|
355
|
+
alignRight: document.queryCommandState("justifyRight"),
|
|
356
|
+
removeFormat: document.queryCommandState("removeFormat"),
|
|
357
|
+
link: document.queryCommandState("createLink"),
|
|
358
|
+
image: document.queryCommandState("insertImage"),
|
|
359
|
+
emoji: document.queryCommandState("insertEmoji"),
|
|
360
|
+
table: document.queryCommandState("insertTable"),
|
|
361
|
+
color: document.queryCommandState("foreColor"),
|
|
362
|
+
highlight: document.queryCommandState("backColor")
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
return document.addEventListener("selectionchange", h), () => document.removeEventListener("selectionchange", h);
|
|
366
|
+
}, []), /* @__PURE__ */ a.createElement("div", {
|
|
367
|
+
className: `rte-toolbar ${T || ""}`,
|
|
368
|
+
style: H
|
|
369
|
+
}, E.bold && /* @__PURE__ */ a.createElement("button", {
|
|
333
370
|
"data-command": "bold",
|
|
334
371
|
title: "Bold",
|
|
335
|
-
onMouseDown:
|
|
336
|
-
|
|
372
|
+
onMouseDown: j,
|
|
373
|
+
className: x.bold ? "rte-active" : ""
|
|
374
|
+
}, /* @__PURE__ */ a.createElement(pt, null)), E.italic && /* @__PURE__ */ a.createElement("button", {
|
|
337
375
|
"data-command": "italic",
|
|
338
376
|
title: "Italic",
|
|
339
|
-
onMouseDown:
|
|
340
|
-
|
|
377
|
+
onMouseDown: j,
|
|
378
|
+
className: x.italic ? "rte-active" : ""
|
|
379
|
+
}, /* @__PURE__ */ a.createElement(Et, null)), E.underline && /* @__PURE__ */ a.createElement("button", {
|
|
341
380
|
"data-command": "underline",
|
|
342
381
|
title: "Underline",
|
|
343
|
-
onMouseDown:
|
|
344
|
-
|
|
382
|
+
onMouseDown: j,
|
|
383
|
+
className: x.underline ? "rte-active" : ""
|
|
384
|
+
}, /* @__PURE__ */ a.createElement(xt, null)), E.unorderedList && /* @__PURE__ */ a.createElement("button", {
|
|
345
385
|
"data-command": "insertUnorderedList",
|
|
346
|
-
onMouseDown:
|
|
347
|
-
title: "UnorderedList"
|
|
348
|
-
|
|
386
|
+
onMouseDown: j,
|
|
387
|
+
title: "UnorderedList",
|
|
388
|
+
className: x.unorderedList ? "rte-active" : ""
|
|
389
|
+
}, /* @__PURE__ */ a.createElement(yt, null)), E.orderedList && /* @__PURE__ */ a.createElement("button", {
|
|
349
390
|
"data-command": "insertOrderedList",
|
|
350
391
|
title: "OrderedList",
|
|
351
|
-
onMouseDown:
|
|
352
|
-
|
|
392
|
+
onMouseDown: j,
|
|
393
|
+
className: x.orderedList ? "rte-active" : ""
|
|
394
|
+
}, /* @__PURE__ */ a.createElement(ht, null)), E.link && /* @__PURE__ */ a.createElement("button", {
|
|
353
395
|
"data-command": "createLink",
|
|
354
396
|
title: "Link",
|
|
355
|
-
onClick: R
|
|
356
|
-
|
|
397
|
+
onClick: R,
|
|
398
|
+
className: x.link ? "rte-active" : ""
|
|
399
|
+
}, /* @__PURE__ */ a.createElement(wt, null)), E.removeFormat && /* @__PURE__ */ a.createElement("button", {
|
|
357
400
|
"data-command": "Remove format",
|
|
358
401
|
title: "removeFormat",
|
|
359
|
-
onMouseDown: (
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
402
|
+
onMouseDown: (h) => {
|
|
403
|
+
h.preventDefault(), c(), L();
|
|
404
|
+
},
|
|
405
|
+
className: x.removeFormat ? "rte-active" : ""
|
|
406
|
+
}, /* @__PURE__ */ a.createElement(Rt, null)), E.image && /* @__PURE__ */ a.createElement("button", {
|
|
363
407
|
"data-command": "insertImage",
|
|
364
408
|
title: "Image",
|
|
365
|
-
onMouseDown:
|
|
366
|
-
|
|
409
|
+
onMouseDown: j,
|
|
410
|
+
className: x.image ? "rte-active" : ""
|
|
411
|
+
}, /* @__PURE__ */ a.createElement(gt, null)), /* @__PURE__ */ a.createElement("input", {
|
|
367
412
|
type: "file",
|
|
368
413
|
accept: "image/*",
|
|
369
|
-
ref:
|
|
414
|
+
ref: M,
|
|
370
415
|
style: {
|
|
371
416
|
display: "none"
|
|
372
417
|
},
|
|
373
|
-
onChange:
|
|
374
|
-
}),
|
|
418
|
+
onChange: s
|
|
419
|
+
}), E.emoji && /* @__PURE__ */ a.createElement("div", {
|
|
375
420
|
style: {
|
|
376
421
|
position: "relative"
|
|
377
422
|
}
|
|
378
|
-
}, /* @__PURE__ */
|
|
423
|
+
}, /* @__PURE__ */ a.createElement("button", {
|
|
379
424
|
title: "Emoji",
|
|
380
|
-
onMouseDown: (
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
425
|
+
onMouseDown: (h) => {
|
|
426
|
+
h.preventDefault(), c(), q((w) => !w);
|
|
427
|
+
},
|
|
428
|
+
className: x.emoji ? "rte-active" : ""
|
|
429
|
+
}, /* @__PURE__ */ a.createElement(Ct, null)), F && /* @__PURE__ */ a.createElement("div", {
|
|
384
430
|
className: "rte-emoji-popup"
|
|
385
|
-
},
|
|
386
|
-
key:
|
|
431
|
+
}, St.map((h) => /* @__PURE__ */ a.createElement("span", {
|
|
432
|
+
key: h,
|
|
387
433
|
style: {
|
|
388
434
|
fontSize: "20px",
|
|
389
435
|
cursor: "pointer",
|
|
390
436
|
textAlign: "center"
|
|
391
437
|
},
|
|
392
|
-
onMouseDown: (
|
|
393
|
-
|
|
438
|
+
onMouseDown: (w) => {
|
|
439
|
+
w.preventDefault(), y(h), q(!1);
|
|
394
440
|
}
|
|
395
|
-
},
|
|
441
|
+
}, h)))), E.color && /* @__PURE__ */ a.createElement("div", {
|
|
396
442
|
style: {
|
|
397
443
|
position: "relative"
|
|
398
444
|
}
|
|
399
|
-
}, /* @__PURE__ */
|
|
445
|
+
}, /* @__PURE__ */ a.createElement("button", {
|
|
400
446
|
title: "Text Color",
|
|
401
|
-
onMouseDown: (
|
|
402
|
-
var
|
|
403
|
-
|
|
447
|
+
onMouseDown: (h) => {
|
|
448
|
+
var w;
|
|
449
|
+
h.preventDefault(), c(), (w = D.current) == null || w.click();
|
|
404
450
|
},
|
|
405
451
|
style: {
|
|
406
452
|
display: "flex",
|
|
407
453
|
alignItems: "center",
|
|
408
454
|
justifyContent: "center",
|
|
409
|
-
color: ((
|
|
455
|
+
color: ((A = D.current) == null ? void 0 : A.value) || "#000",
|
|
410
456
|
fontSize: "18px"
|
|
411
|
-
}
|
|
412
|
-
|
|
457
|
+
},
|
|
458
|
+
className: x.color ? "rte-active" : ""
|
|
459
|
+
}, /* @__PURE__ */ a.createElement(Lt, null)), /* @__PURE__ */ a.createElement("input", {
|
|
413
460
|
ref: D,
|
|
414
461
|
type: "color",
|
|
415
462
|
defaultValue: "#000000",
|
|
416
|
-
onChange: (
|
|
417
|
-
var
|
|
418
|
-
|
|
463
|
+
onChange: (h) => {
|
|
464
|
+
var w;
|
|
465
|
+
Z(h), ((w = h.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = h.target.value;
|
|
419
466
|
},
|
|
420
467
|
style: {
|
|
421
468
|
position: "absolute",
|
|
@@ -424,29 +471,30 @@ const Et = [
|
|
|
424
471
|
height: 0,
|
|
425
472
|
pointerEvents: "none"
|
|
426
473
|
}
|
|
427
|
-
})),
|
|
474
|
+
})), E.highlight && /* @__PURE__ */ a.createElement("div", {
|
|
428
475
|
style: {
|
|
429
476
|
position: "relative"
|
|
430
477
|
}
|
|
431
|
-
}, /* @__PURE__ */
|
|
478
|
+
}, /* @__PURE__ */ a.createElement("button", {
|
|
432
479
|
title: "Highlight",
|
|
433
|
-
onMouseDown: (
|
|
434
|
-
var
|
|
435
|
-
|
|
480
|
+
onMouseDown: (h) => {
|
|
481
|
+
var w;
|
|
482
|
+
h.preventDefault(), c(), (w = b.current) == null || w.click();
|
|
436
483
|
},
|
|
437
484
|
style: {
|
|
438
485
|
display: "flex",
|
|
439
486
|
alignItems: "center",
|
|
440
487
|
justifyContent: "center",
|
|
441
|
-
color: ((
|
|
488
|
+
color: ((P = b.current) == null ? void 0 : P.value) || "#000",
|
|
442
489
|
fontSize: "18px"
|
|
443
|
-
}
|
|
444
|
-
|
|
490
|
+
},
|
|
491
|
+
className: x.highlight ? "rte-active" : ""
|
|
492
|
+
}, /* @__PURE__ */ a.createElement(vt, null)), /* @__PURE__ */ a.createElement("input", {
|
|
445
493
|
ref: b,
|
|
446
494
|
type: "color",
|
|
447
|
-
onChange: (
|
|
448
|
-
var
|
|
449
|
-
|
|
495
|
+
onChange: (h) => {
|
|
496
|
+
var w;
|
|
497
|
+
V(h), ((w = h.target.parentElement) == null ? void 0 : w.querySelector("button")).style.color = h.target.value;
|
|
450
498
|
},
|
|
451
499
|
defaultValue: "#000000",
|
|
452
500
|
style: {
|
|
@@ -456,96 +504,100 @@ const Et = [
|
|
|
456
504
|
height: 0,
|
|
457
505
|
pointerEvents: "none"
|
|
458
506
|
}
|
|
459
|
-
})),
|
|
507
|
+
})), E.align && /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("button", {
|
|
460
508
|
title: "Align Left",
|
|
461
|
-
onMouseDown: (
|
|
462
|
-
onClick: () => t("justifyLeft")
|
|
463
|
-
|
|
509
|
+
onMouseDown: (h) => h.preventDefault(),
|
|
510
|
+
onClick: () => t("justifyLeft"),
|
|
511
|
+
className: x.alignLeft ? "rte-active" : ""
|
|
512
|
+
}, /* @__PURE__ */ a.createElement(ft, null)), /* @__PURE__ */ a.createElement("button", {
|
|
464
513
|
title: "Align Center",
|
|
465
|
-
onMouseDown: (
|
|
466
|
-
onClick: () => t("justifyCenter")
|
|
467
|
-
|
|
514
|
+
onMouseDown: (h) => h.preventDefault(),
|
|
515
|
+
onClick: () => t("justifyCenter"),
|
|
516
|
+
className: x.alignCenter ? "rte-active" : ""
|
|
517
|
+
}, /* @__PURE__ */ a.createElement(ut, null)), /* @__PURE__ */ a.createElement("button", {
|
|
468
518
|
title: "Align Right",
|
|
469
|
-
onMouseDown: (
|
|
470
|
-
onClick: () => t("justifyRight")
|
|
471
|
-
|
|
519
|
+
onMouseDown: (h) => h.preventDefault(),
|
|
520
|
+
onClick: () => t("justifyRight"),
|
|
521
|
+
className: x.alignRight ? "rte-active" : ""
|
|
522
|
+
}, /* @__PURE__ */ a.createElement(mt, null))), E.table && /* @__PURE__ */ a.createElement("button", {
|
|
472
523
|
title: "Insert Table",
|
|
473
|
-
onMouseDown: (
|
|
474
|
-
onClick: () => t("insertTable")
|
|
475
|
-
|
|
524
|
+
onMouseDown: (h) => h.preventDefault(),
|
|
525
|
+
onClick: () => t("insertTable"),
|
|
526
|
+
className: x.table ? "rte-active" : ""
|
|
527
|
+
}, /* @__PURE__ */ a.createElement(bt, null)), E.fontFamily && /* @__PURE__ */ a.createElement("select", {
|
|
476
528
|
className: "rte-dropdown",
|
|
477
529
|
defaultValue: "",
|
|
478
530
|
onMouseDown: () => c(),
|
|
479
531
|
onChange: v
|
|
480
|
-
}, /* @__PURE__ */
|
|
532
|
+
}, /* @__PURE__ */ a.createElement("option", {
|
|
481
533
|
value: "",
|
|
482
534
|
disabled: !0
|
|
483
|
-
}, "Font Family"), /* @__PURE__ */
|
|
535
|
+
}, "Font Family"), /* @__PURE__ */ a.createElement("option", {
|
|
484
536
|
value: "Arial"
|
|
485
|
-
}, "Arial"), /* @__PURE__ */
|
|
537
|
+
}, "Arial"), /* @__PURE__ */ a.createElement("option", {
|
|
486
538
|
value: "Georgia"
|
|
487
|
-
}, "Georgia"), /* @__PURE__ */
|
|
539
|
+
}, "Georgia"), /* @__PURE__ */ a.createElement("option", {
|
|
488
540
|
value: "Times New Roman"
|
|
489
|
-
}, "Times New Roman"), /* @__PURE__ */
|
|
541
|
+
}, "Times New Roman"), /* @__PURE__ */ a.createElement("option", {
|
|
490
542
|
value: "Courier New"
|
|
491
|
-
}, "Courier New"), /* @__PURE__ */
|
|
543
|
+
}, "Courier New"), /* @__PURE__ */ a.createElement("option", {
|
|
492
544
|
value: "Verdana"
|
|
493
|
-
}, "Verdana")),
|
|
545
|
+
}, "Verdana")), E.fontSize && /* @__PURE__ */ a.createElement("select", {
|
|
494
546
|
className: "rte-dropdown",
|
|
495
547
|
defaultValue: "",
|
|
496
548
|
onMouseDown: () => c(),
|
|
497
549
|
onChange: d
|
|
498
|
-
}, /* @__PURE__ */
|
|
550
|
+
}, /* @__PURE__ */ a.createElement("option", {
|
|
499
551
|
value: "",
|
|
500
552
|
disabled: !0
|
|
501
|
-
}, "Font Size"), /* @__PURE__ */
|
|
553
|
+
}, "Font Size"), /* @__PURE__ */ a.createElement("option", {
|
|
502
554
|
value: "2"
|
|
503
|
-
}, "Small "), /* @__PURE__ */
|
|
555
|
+
}, "Small "), /* @__PURE__ */ a.createElement("option", {
|
|
504
556
|
value: "3"
|
|
505
|
-
}, "Normal"), /* @__PURE__ */
|
|
557
|
+
}, "Normal"), /* @__PURE__ */ a.createElement("option", {
|
|
506
558
|
value: "4"
|
|
507
|
-
}, "Medium"), /* @__PURE__ */
|
|
559
|
+
}, "Medium"), /* @__PURE__ */ a.createElement("option", {
|
|
508
560
|
value: "5"
|
|
509
561
|
}, "Large")));
|
|
510
|
-
},
|
|
562
|
+
}, zt = ({
|
|
511
563
|
show: t,
|
|
512
564
|
position: c,
|
|
513
|
-
filtered:
|
|
565
|
+
filtered: s,
|
|
514
566
|
insertMention: d,
|
|
515
567
|
onClose: v,
|
|
516
568
|
query: y
|
|
517
569
|
}) => {
|
|
518
570
|
const R = _(null);
|
|
519
571
|
return B(() => {
|
|
520
|
-
const
|
|
521
|
-
R.current && !R.current.contains(
|
|
572
|
+
const L = (E) => {
|
|
573
|
+
R.current && !R.current.contains(E.target) && v();
|
|
522
574
|
};
|
|
523
|
-
return t && document.addEventListener("mousedown",
|
|
524
|
-
document.removeEventListener("mousedown",
|
|
575
|
+
return t && document.addEventListener("mousedown", L), () => {
|
|
576
|
+
document.removeEventListener("mousedown", L);
|
|
525
577
|
};
|
|
526
|
-
}, [t, v]), t ? /* @__PURE__ */
|
|
578
|
+
}, [t, v]), t ? /* @__PURE__ */ a.createElement("ul", {
|
|
527
579
|
ref: R,
|
|
528
580
|
className: "rte-popup",
|
|
529
581
|
style: {
|
|
530
582
|
top: c.y,
|
|
531
583
|
left: c.x
|
|
532
584
|
}
|
|
533
|
-
},
|
|
534
|
-
key:
|
|
535
|
-
value:
|
|
585
|
+
}, s.length > 0 ? s.map(({
|
|
586
|
+
key: L,
|
|
587
|
+
value: E
|
|
536
588
|
}) => {
|
|
537
|
-
const
|
|
538
|
-
let D =
|
|
539
|
-
if (
|
|
540
|
-
const b =
|
|
541
|
-
D =
|
|
589
|
+
const T = L.toLowerCase(), H = y.toLowerCase(), M = T.indexOf(H);
|
|
590
|
+
let D = L;
|
|
591
|
+
if (M !== -1 && y.length > 0) {
|
|
592
|
+
const b = M + y.length;
|
|
593
|
+
D = L.substring(0, M) + `<span class="rte-highlight">${L.substring(M, b)}</span>` + L.substring(b);
|
|
542
594
|
}
|
|
543
|
-
return /* @__PURE__ */
|
|
544
|
-
key:
|
|
595
|
+
return /* @__PURE__ */ a.createElement("li", {
|
|
596
|
+
key: E,
|
|
545
597
|
onMouseDown: (b) => {
|
|
546
598
|
b.preventDefault(), d({
|
|
547
|
-
key:
|
|
548
|
-
value:
|
|
599
|
+
key: L,
|
|
600
|
+
value: E
|
|
549
601
|
});
|
|
550
602
|
},
|
|
551
603
|
style: {
|
|
@@ -559,52 +611,52 @@ const Et = [
|
|
|
559
611
|
onMouseEnter: (b) => b.currentTarget.style.background = "#f0f0f0",
|
|
560
612
|
onMouseLeave: (b) => b.currentTarget.style.background = "#fff"
|
|
561
613
|
});
|
|
562
|
-
}) : /* @__PURE__ */
|
|
614
|
+
}) : /* @__PURE__ */ a.createElement("li", {
|
|
563
615
|
style: {
|
|
564
616
|
padding: "6px 12px",
|
|
565
617
|
color: "#999"
|
|
566
618
|
}
|
|
567
619
|
}, "No matches")) : null;
|
|
568
620
|
};
|
|
569
|
-
function
|
|
570
|
-
return
|
|
621
|
+
function Le(t) {
|
|
622
|
+
return S({ 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: [] }] }] }] })(t);
|
|
571
623
|
}
|
|
572
|
-
function
|
|
573
|
-
return
|
|
624
|
+
function K(t) {
|
|
625
|
+
return S({ 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: [] }] }] }] })(t);
|
|
574
626
|
}
|
|
575
|
-
const
|
|
627
|
+
const Nt = ({
|
|
576
628
|
visible: t,
|
|
577
629
|
x: c,
|
|
578
|
-
y:
|
|
630
|
+
y: s,
|
|
579
631
|
onAction: d,
|
|
580
632
|
onClose: v
|
|
581
633
|
}) => {
|
|
582
634
|
if (!t) return null;
|
|
583
635
|
const y = {
|
|
584
|
-
top:
|
|
636
|
+
top: s,
|
|
585
637
|
left: c
|
|
586
638
|
};
|
|
587
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ a.createElement("div", {
|
|
588
640
|
style: y,
|
|
589
641
|
className: "rte-table-menu",
|
|
590
642
|
onMouseLeave: v
|
|
591
|
-
}, /* @__PURE__ */
|
|
643
|
+
}, /* @__PURE__ */ a.createElement("button", {
|
|
592
644
|
onClick: () => d("insertRowAbove")
|
|
593
|
-
}, /* @__PURE__ */
|
|
645
|
+
}, /* @__PURE__ */ a.createElement(K, null), " Insert row above"), /* @__PURE__ */ a.createElement("button", {
|
|
594
646
|
onClick: () => d("insertRowBelow")
|
|
595
|
-
}, /* @__PURE__ */
|
|
647
|
+
}, /* @__PURE__ */ a.createElement(K, null), " Insert row below"), /* @__PURE__ */ a.createElement("button", {
|
|
596
648
|
onClick: () => d("insertColLeft")
|
|
597
|
-
}, /* @__PURE__ */
|
|
649
|
+
}, /* @__PURE__ */ a.createElement(K, null), " Insert col left"), /* @__PURE__ */ a.createElement("button", {
|
|
598
650
|
onClick: () => d("insertColRight")
|
|
599
|
-
}, /* @__PURE__ */
|
|
651
|
+
}, /* @__PURE__ */ a.createElement(K, null), " Insert col right"), /* @__PURE__ */ a.createElement("button", {
|
|
600
652
|
onClick: () => d("deleteRow")
|
|
601
|
-
}, /* @__PURE__ */
|
|
653
|
+
}, /* @__PURE__ */ a.createElement(Le, null), " Delete row"), /* @__PURE__ */ a.createElement("button", {
|
|
602
654
|
onClick: () => d("deleteCol")
|
|
603
|
-
}, /* @__PURE__ */
|
|
604
|
-
},
|
|
655
|
+
}, /* @__PURE__ */ a.createElement(Le, null), " Delete column"));
|
|
656
|
+
}, kt = ({
|
|
605
657
|
html: t,
|
|
606
658
|
className: c,
|
|
607
|
-
style:
|
|
659
|
+
style: s
|
|
608
660
|
}) => {
|
|
609
661
|
const d = (v) => {
|
|
610
662
|
const y = v.target;
|
|
@@ -614,78 +666,78 @@ const bt = ({
|
|
|
614
666
|
R && window.open(R, "_blank", "noopener,noreferrer");
|
|
615
667
|
}
|
|
616
668
|
};
|
|
617
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ a.createElement("div", {
|
|
618
670
|
className: `rte-preview ${c || ""}`,
|
|
619
|
-
style:
|
|
671
|
+
style: s,
|
|
620
672
|
onClick: d,
|
|
621
673
|
dangerouslySetInnerHTML: {
|
|
622
674
|
__html: t
|
|
623
675
|
}
|
|
624
676
|
});
|
|
625
|
-
},
|
|
677
|
+
}, At = ({
|
|
626
678
|
visible: t,
|
|
627
679
|
linkData: c,
|
|
628
|
-
onClose:
|
|
680
|
+
onClose: s,
|
|
629
681
|
onInsert: d
|
|
630
682
|
}) => {
|
|
631
|
-
const [v, y] = N(""), [R,
|
|
683
|
+
const [v, y] = N(""), [R, L] = N(""), [E, T] = N(""), [H, M] = N("_self");
|
|
632
684
|
if (B(() => {
|
|
633
|
-
t ? (y(c.url || ""),
|
|
685
|
+
t ? (y(c.url || ""), L(c.text || ""), T(c.title || ""), M(c.target || "_self")) : (y(""), L(""), T(""), M("_self"));
|
|
634
686
|
}, [t, c]), !t) return null;
|
|
635
687
|
const D = () => {
|
|
636
688
|
d({
|
|
637
689
|
url: v,
|
|
638
690
|
text: R,
|
|
639
|
-
title:
|
|
640
|
-
target:
|
|
691
|
+
title: E,
|
|
692
|
+
target: H
|
|
641
693
|
});
|
|
642
694
|
};
|
|
643
|
-
return /* @__PURE__ */
|
|
695
|
+
return /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("div", {
|
|
644
696
|
className: "rte-link-modal-overlay",
|
|
645
|
-
onClick:
|
|
646
|
-
}), /* @__PURE__ */
|
|
697
|
+
onClick: s
|
|
698
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
647
699
|
className: "rte-link-modal"
|
|
648
|
-
}, /* @__PURE__ */
|
|
700
|
+
}, /* @__PURE__ */ a.createElement("h4", {
|
|
649
701
|
className: "rte-link-modal__title"
|
|
650
|
-
}, v ? "Edit Link" : "Insert Link"), /* @__PURE__ */
|
|
702
|
+
}, v ? "Edit Link" : "Insert Link"), /* @__PURE__ */ a.createElement("input", {
|
|
651
703
|
type: "text",
|
|
652
704
|
className: "rte-link-modal__input",
|
|
653
705
|
placeholder: "URL",
|
|
654
706
|
value: v,
|
|
655
707
|
onChange: (b) => y(b.target.value)
|
|
656
|
-
}), /* @__PURE__ */
|
|
708
|
+
}), /* @__PURE__ */ a.createElement("input", {
|
|
657
709
|
type: "text",
|
|
658
710
|
className: "rte-link-modal__input",
|
|
659
711
|
placeholder: "Text to Display",
|
|
660
712
|
value: R,
|
|
661
|
-
onChange: (b) =>
|
|
662
|
-
}), /* @__PURE__ */
|
|
713
|
+
onChange: (b) => L(b.target.value)
|
|
714
|
+
}), /* @__PURE__ */ a.createElement("input", {
|
|
663
715
|
type: "text",
|
|
664
716
|
className: "rte-link-modal__input",
|
|
665
717
|
placeholder: "Title",
|
|
666
|
-
value:
|
|
667
|
-
onChange: (b) =>
|
|
668
|
-
}), /* @__PURE__ */
|
|
718
|
+
value: E,
|
|
719
|
+
onChange: (b) => T(b.target.value)
|
|
720
|
+
}), /* @__PURE__ */ a.createElement("select", {
|
|
669
721
|
className: "rte-link-modal__select",
|
|
670
|
-
value:
|
|
671
|
-
onChange: (b) =>
|
|
672
|
-
}, /* @__PURE__ */
|
|
722
|
+
value: H,
|
|
723
|
+
onChange: (b) => M(b.target.value)
|
|
724
|
+
}, /* @__PURE__ */ a.createElement("option", {
|
|
673
725
|
value: "_self"
|
|
674
|
-
}, "Same tab"), /* @__PURE__ */
|
|
726
|
+
}, "Same tab"), /* @__PURE__ */ a.createElement("option", {
|
|
675
727
|
value: "_blank"
|
|
676
|
-
}, "New tab")), /* @__PURE__ */
|
|
728
|
+
}, "New tab")), /* @__PURE__ */ a.createElement("div", {
|
|
677
729
|
className: "rte-link-modal__actions"
|
|
678
|
-
}, /* @__PURE__ */
|
|
730
|
+
}, /* @__PURE__ */ a.createElement("button", {
|
|
679
731
|
className: "rte-link-modal__btn",
|
|
680
|
-
onClick:
|
|
681
|
-
}, "Cancel"), /* @__PURE__ */
|
|
732
|
+
onClick: s
|
|
733
|
+
}, "Cancel"), /* @__PURE__ */ a.createElement("button", {
|
|
682
734
|
className: "rte-link-modal__btn rte-link-modal__btn--ok",
|
|
683
735
|
onClick: D
|
|
684
736
|
}, "OK"))));
|
|
685
|
-
},
|
|
737
|
+
}, Ot = ({
|
|
686
738
|
atSuggestions: t = [],
|
|
687
739
|
showOutput: c = !1,
|
|
688
|
-
showPreview:
|
|
740
|
+
showPreview: s = !1,
|
|
689
741
|
toolbarConfig: d = {
|
|
690
742
|
link: !1,
|
|
691
743
|
image: !1,
|
|
@@ -699,22 +751,27 @@ const bt = ({
|
|
|
699
751
|
classNames: v = {},
|
|
700
752
|
styles: y = {},
|
|
701
753
|
handleGetHtml: R = () => {
|
|
754
|
+
},
|
|
755
|
+
onChange: L = () => {
|
|
756
|
+
},
|
|
757
|
+
value: E,
|
|
758
|
+
onMentionSelect: T = () => {
|
|
702
759
|
}
|
|
703
760
|
}) => {
|
|
704
|
-
var
|
|
705
|
-
const
|
|
761
|
+
var ue, me, ge, he, fe, pe, ve, Ee;
|
|
762
|
+
const H = _(null), [M, D] = N(E != null && E.length ? E : " "), [b, F] = N(!1), [q, j] = N({
|
|
706
763
|
x: 0,
|
|
707
764
|
y: 0
|
|
708
|
-
}), [
|
|
765
|
+
}), [Z, V] = N([]), x = _(null), U = _(null), [A, P] = N({
|
|
709
766
|
visible: !1,
|
|
710
767
|
x: 0,
|
|
711
768
|
y: 0
|
|
712
|
-
}), [
|
|
769
|
+
}), [h, w] = N(!1), I = _(null), [Me, te] = N({
|
|
713
770
|
url: "",
|
|
714
771
|
text: "",
|
|
715
772
|
title: "",
|
|
716
773
|
target: "_self"
|
|
717
|
-
}),
|
|
774
|
+
}), ze = {
|
|
718
775
|
bold: !0,
|
|
719
776
|
italic: !0,
|
|
720
777
|
underline: !0,
|
|
@@ -722,141 +779,155 @@ const bt = ({
|
|
|
722
779
|
unorderedList: !0,
|
|
723
780
|
orderedList: !0,
|
|
724
781
|
align: !0,
|
|
725
|
-
link: (
|
|
726
|
-
image: (
|
|
727
|
-
emoji: (
|
|
728
|
-
table: (
|
|
729
|
-
color: (
|
|
730
|
-
fontFamily: (
|
|
731
|
-
fontSize: (
|
|
732
|
-
highlight: (
|
|
733
|
-
}, [
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
|
|
782
|
+
link: (ue = d.link) != null ? ue : !1,
|
|
783
|
+
image: (me = d.image) != null ? me : !1,
|
|
784
|
+
emoji: (ge = d.emoji) != null ? ge : !1,
|
|
785
|
+
table: (he = d.table) != null ? he : !1,
|
|
786
|
+
color: (fe = d.color) != null ? fe : !1,
|
|
787
|
+
fontFamily: (pe = d.fontFamily) != null ? pe : !1,
|
|
788
|
+
fontSize: (ve = d.fontSize) != null ? ve : !1,
|
|
789
|
+
highlight: (Ee = d.fontSize) != null ? Ee : !1
|
|
790
|
+
}, [Ne, ne] = N(""), [re, ae] = N([]), O = () => H.current, z = () => {
|
|
791
|
+
const e = de();
|
|
792
|
+
D(e), R == null || R(e);
|
|
793
|
+
const n = Qe(e);
|
|
794
|
+
L(n);
|
|
795
|
+
const r = je();
|
|
796
|
+
JSON.stringify(r) !== JSON.stringify(re) && (ae(r), T(r));
|
|
797
|
+
}, oe = () => {
|
|
739
798
|
const e = window.getSelection();
|
|
740
|
-
e != null && e.rangeCount && (
|
|
741
|
-
},
|
|
799
|
+
e != null && e.rangeCount && (x.current = e.getRangeAt(0));
|
|
800
|
+
}, $ = () => {
|
|
742
801
|
const e = window.getSelection();
|
|
743
|
-
e &&
|
|
744
|
-
},
|
|
745
|
-
const
|
|
746
|
-
|
|
802
|
+
e && x.current && (e.removeAllRanges(), e.addRange(x.current));
|
|
803
|
+
}, ke = (e, n) => {
|
|
804
|
+
const r = window.getSelection();
|
|
805
|
+
r && r.rangeCount > 0 && (x.current = r.getRangeAt(0)), $(), document.execCommand(e, !1, n), z();
|
|
747
806
|
};
|
|
748
807
|
B(() => {
|
|
749
808
|
const e = O();
|
|
750
|
-
e && !e.innerHTML && (e.innerHTML =
|
|
809
|
+
e && !e.innerHTML && (e.innerHTML = M), z();
|
|
751
810
|
}, []), B(() => () => {
|
|
752
811
|
document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
|
|
753
812
|
}, []);
|
|
754
|
-
const
|
|
813
|
+
const le = (e) => {
|
|
755
814
|
for (; e && e.nodeName !== "LI"; )
|
|
756
815
|
e = e.parentNode;
|
|
757
816
|
return e;
|
|
758
|
-
},
|
|
759
|
-
let n = 0,
|
|
760
|
-
for (;
|
|
761
|
-
(
|
|
817
|
+
}, Ae = (e) => {
|
|
818
|
+
let n = 0, r = e.parentElement;
|
|
819
|
+
for (; r; )
|
|
820
|
+
(r.tagName === "UL" || r.tagName === "OL") && n++, r = r.parentElement;
|
|
762
821
|
return n;
|
|
763
|
-
},
|
|
764
|
-
const n = e.querySelector("li"),
|
|
822
|
+
}, Te = (e) => {
|
|
823
|
+
const n = e.querySelector("li"), r = n ? Ae(n) : 1;
|
|
765
824
|
if (e.querySelector("[data-hidden-array-start]")) return;
|
|
766
|
-
const
|
|
767
|
-
l.textContent =
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
},
|
|
825
|
+
const o = `{{#arrayData${r > 1 ? r : ""}}}`, u = `{{/arrayData${r > 1 ? r : ""}}}`, l = document.createElement("span");
|
|
826
|
+
l.textContent = o, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
|
|
827
|
+
const i = document.createElement("span");
|
|
828
|
+
i.textContent = u, i.style.display = "none", i.setAttribute("data-hidden-array-end", "true"), e.appendChild(i);
|
|
829
|
+
}, ce = (e) => {
|
|
771
830
|
var f;
|
|
772
831
|
const n = window.getSelection();
|
|
773
832
|
if (!(n != null && n.rangeCount)) return;
|
|
774
|
-
const
|
|
775
|
-
let
|
|
776
|
-
if (
|
|
777
|
-
let
|
|
778
|
-
|
|
833
|
+
const r = n.getRangeAt(0), o = le(r.startContainer);
|
|
834
|
+
let u, l;
|
|
835
|
+
if (o) {
|
|
836
|
+
let m = o.querySelector(e);
|
|
837
|
+
m || (m = document.createElement(e), m.style.margin = "0", m.style.paddingLeft = "20px", o.appendChild(m)), l = m, u = document.createElement("li"), u.textContent = "", l.appendChild(u);
|
|
779
838
|
} else {
|
|
780
839
|
document.execCommand(e === "ul" ? "insertUnorderedList" : "insertOrderedList");
|
|
781
|
-
const
|
|
782
|
-
if (l =
|
|
783
|
-
|
|
840
|
+
const m = O();
|
|
841
|
+
if (l = m == null ? void 0 : m.querySelector(`${e}:last-child`), !l) return;
|
|
842
|
+
u = l.querySelector("li:last-child");
|
|
784
843
|
}
|
|
785
|
-
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
},
|
|
789
|
-
e === "insertOrderedList" ?
|
|
790
|
-
},
|
|
844
|
+
Te(l);
|
|
845
|
+
const i = document.createRange();
|
|
846
|
+
i.setStart(u, 0), i.collapse(!0), n.removeAllRanges(), n.addRange(i), (f = O()) == null || f.focus(), z();
|
|
847
|
+
}, W = (e, n) => {
|
|
848
|
+
e === "insertOrderedList" ? ce("ol") : e === "insertUnorderedList" ? ce("ul") : ke(e, n), e === "insertTable" && Be();
|
|
849
|
+
}, De = (e) => {
|
|
791
850
|
const n = document.createElement("span");
|
|
792
851
|
n.textContent = "", e.insertNode(n), e.setStartAfter(n), e.collapse(!0);
|
|
793
|
-
const
|
|
794
|
-
n.remove(),
|
|
795
|
-
x:
|
|
796
|
-
y:
|
|
797
|
-
}),
|
|
798
|
-
},
|
|
852
|
+
const r = n.getBoundingClientRect();
|
|
853
|
+
n.remove(), j({
|
|
854
|
+
x: r.left,
|
|
855
|
+
y: r.bottom + window.scrollY
|
|
856
|
+
}), V(t || []), F(!0), U.current = e.cloneRange();
|
|
857
|
+
}, Oe = () => {
|
|
799
858
|
const e = window.getSelection();
|
|
800
859
|
if (!e || e.rangeCount === 0) return null;
|
|
801
860
|
const n = e.anchorNode;
|
|
802
|
-
let
|
|
861
|
+
let r = e.anchorOffset;
|
|
803
862
|
if (!n) return null;
|
|
804
|
-
let
|
|
805
|
-
for (
|
|
806
|
-
if (
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
863
|
+
let o = n;
|
|
864
|
+
for (o.nodeType !== Node.TEXT_NODE && (o.childNodes && o.childNodes[r] ? o = o.childNodes[r] : o = n.previousSibling); o; ) {
|
|
865
|
+
if (o.nodeType === Node.TEXT_NODE) {
|
|
866
|
+
const u = o.textContent || "", l = o === n ? r : u.length, i = u.lastIndexOf("@", l - 1);
|
|
867
|
+
if (i !== -1) {
|
|
809
868
|
const f = document.createRange();
|
|
810
|
-
return f.setStart(
|
|
869
|
+
return f.setStart(o, i), f.setEnd(o, l), f;
|
|
811
870
|
}
|
|
812
871
|
}
|
|
813
|
-
|
|
872
|
+
o = o.previousSibling;
|
|
814
873
|
}
|
|
815
874
|
return null;
|
|
816
|
-
},
|
|
817
|
-
var
|
|
875
|
+
}, He = (e) => {
|
|
876
|
+
var l;
|
|
818
877
|
const n = window.getSelection();
|
|
819
878
|
if (!n) return;
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
const
|
|
823
|
-
|
|
879
|
+
const r = Oe();
|
|
880
|
+
r ? (n.removeAllRanges(), n.addRange(r)) : U.current && (n.removeAllRanges(), n.addRange(U.current));
|
|
881
|
+
const o = document.createElement("span");
|
|
882
|
+
o.textContent = `{{${e.key}}}`, o.style.color = "#007bff", o.style.display = "inline", o.contentEditable = "false", o.setAttribute("data-mention", e.value || e.key || "");
|
|
824
883
|
try {
|
|
825
|
-
const
|
|
826
|
-
if (
|
|
827
|
-
|
|
884
|
+
const i = n.rangeCount ? n.getRangeAt(0) : null;
|
|
885
|
+
if (i)
|
|
886
|
+
i.deleteContents(), i.insertNode(o);
|
|
828
887
|
else {
|
|
829
|
-
const
|
|
830
|
-
|
|
888
|
+
const p = document.createRange(), g = O();
|
|
889
|
+
p.selectNodeContents(g), p.collapse(!1), p.insertNode(o);
|
|
831
890
|
}
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
} catch (
|
|
837
|
-
console.error("insertMention error:",
|
|
891
|
+
const f = document.createTextNode(" ");
|
|
892
|
+
o.after(f);
|
|
893
|
+
const m = document.createRange();
|
|
894
|
+
m.setStartAfter(f), m.collapse(!0), n.removeAllRanges(), n.addRange(m);
|
|
895
|
+
} catch (i) {
|
|
896
|
+
console.error("insertMention error:", i);
|
|
838
897
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
898
|
+
let u = [...re, e];
|
|
899
|
+
ae(u), T(u), F(!1), (l = O()) == null || l.focus(), z();
|
|
900
|
+
}, je = () => {
|
|
901
|
+
const e = O();
|
|
902
|
+
if (!e) return [];
|
|
903
|
+
const n = e.querySelectorAll("span[data-mention]"), r = [];
|
|
904
|
+
return n.forEach((o) => {
|
|
905
|
+
const u = o.getAttribute("data-mention") || "", i = (o.textContent || "").match(/{{(.+?)}}/);
|
|
906
|
+
i && r.push({
|
|
907
|
+
key: i[1],
|
|
908
|
+
value: u
|
|
909
|
+
});
|
|
910
|
+
}), r;
|
|
911
|
+
}, _e = (e) => {
|
|
912
|
+
var r, o, u;
|
|
842
913
|
const n = e.key.toLowerCase();
|
|
843
|
-
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(n) && (e.preventDefault(),
|
|
844
|
-
const l = window.getSelection(),
|
|
845
|
-
if (!
|
|
846
|
-
if (((
|
|
914
|
+
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(n) && (e.preventDefault(), W(n === "b" ? "bold" : n === "i" ? "italic" : n === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
|
|
915
|
+
const l = window.getSelection(), i = l != null && l.anchorNode ? le(l.anchorNode) : null;
|
|
916
|
+
if (!i) return;
|
|
917
|
+
if (((r = i.textContent) == null ? void 0 : r.replace(/\u200B/g, "").trim()) === "") {
|
|
847
918
|
e.preventDefault();
|
|
848
|
-
const
|
|
919
|
+
const m = i.parentElement, p = m == null ? void 0 : m.closest("li");
|
|
849
920
|
if (p) {
|
|
850
|
-
|
|
921
|
+
m == null || m.removeChild(i);
|
|
851
922
|
const g = document.createElement("p");
|
|
852
|
-
g.innerHTML = "<br />", (
|
|
923
|
+
g.innerHTML = "<br />", (o = p.parentElement) == null || o.insertBefore(g, p.nextSibling);
|
|
853
924
|
const C = document.createRange();
|
|
854
925
|
C.setStart(g, 0), C.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(C);
|
|
855
926
|
} else {
|
|
856
|
-
const g =
|
|
927
|
+
const g = i.closest("ul, ol");
|
|
857
928
|
if (g) {
|
|
858
929
|
const C = document.createElement("p");
|
|
859
|
-
C.innerHTML = "<br />", (
|
|
930
|
+
C.innerHTML = "<br />", (u = g.parentElement) == null || u.insertBefore(C, g.nextSibling), g.removeChild(i);
|
|
860
931
|
const k = document.createRange();
|
|
861
932
|
k.setStart(C, 0), k.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(k);
|
|
862
933
|
}
|
|
@@ -864,83 +935,83 @@ const bt = ({
|
|
|
864
935
|
z();
|
|
865
936
|
}
|
|
866
937
|
}
|
|
867
|
-
},
|
|
938
|
+
}, Fe = (e) => {
|
|
868
939
|
if (e.data === "@") {
|
|
869
|
-
const
|
|
870
|
-
if (!(
|
|
940
|
+
const r = window.getSelection();
|
|
941
|
+
if (!(r != null && r.rangeCount)) return;
|
|
871
942
|
setTimeout(() => {
|
|
872
|
-
|
|
943
|
+
De(r.getRangeAt(0)), ne(""), V(t), F(!0);
|
|
873
944
|
}, 0);
|
|
874
945
|
return;
|
|
875
946
|
}
|
|
876
|
-
if (
|
|
877
|
-
setTimeout(() =>
|
|
947
|
+
if (b) {
|
|
948
|
+
setTimeout(() => ie(), 0);
|
|
878
949
|
return;
|
|
879
950
|
}
|
|
880
|
-
},
|
|
881
|
-
if (z(), !
|
|
951
|
+
}, ie = () => {
|
|
952
|
+
if (z(), !b) return;
|
|
882
953
|
const e = window.getSelection();
|
|
883
954
|
if (!e || !e.anchorNode) return;
|
|
884
|
-
const
|
|
885
|
-
if (!
|
|
886
|
-
|
|
955
|
+
const r = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
|
|
956
|
+
if (!r) {
|
|
957
|
+
F(!1);
|
|
887
958
|
return;
|
|
888
959
|
}
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
},
|
|
894
|
-
var
|
|
895
|
-
const n = (
|
|
960
|
+
const o = r[1].toLowerCase();
|
|
961
|
+
ne(o);
|
|
962
|
+
const u = t.filter((l) => l.key.toLowerCase().includes(o));
|
|
963
|
+
V(u);
|
|
964
|
+
}, Ie = (e) => {
|
|
965
|
+
var o;
|
|
966
|
+
const n = (o = e.target.files) == null ? void 0 : o[0];
|
|
896
967
|
if (!n) return;
|
|
897
|
-
const
|
|
898
|
-
|
|
968
|
+
const r = new FileReader();
|
|
969
|
+
r.onload = (u) => {
|
|
899
970
|
var k;
|
|
900
|
-
const l = (k =
|
|
901
|
-
|
|
902
|
-
const
|
|
903
|
-
let f =
|
|
904
|
-
const
|
|
905
|
-
|
|
971
|
+
const l = (k = u.target) == null ? void 0 : k.result;
|
|
972
|
+
$();
|
|
973
|
+
const i = window.getSelection();
|
|
974
|
+
let f = i && i.rangeCount ? i.getRangeAt(0) : null;
|
|
975
|
+
const m = document.createElement("img");
|
|
976
|
+
m.src = l, m.alt = n.name || "image", m.className = "rte-inserted-image", m.contentEditable = "true";
|
|
906
977
|
const p = O();
|
|
907
978
|
if (!f || !p) {
|
|
908
|
-
p == null || p.appendChild(
|
|
909
|
-
const
|
|
910
|
-
p == null || p.appendChild(
|
|
911
|
-
const
|
|
912
|
-
|
|
979
|
+
p == null || p.appendChild(m);
|
|
980
|
+
const we = document.createTextNode(" ");
|
|
981
|
+
p == null || p.appendChild(we);
|
|
982
|
+
const J = document.createRange();
|
|
983
|
+
J.setStartAfter(we), J.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(J), p == null || p.focus(), z(), e.target.value = "";
|
|
913
984
|
return;
|
|
914
985
|
}
|
|
915
|
-
f.deleteContents(), f.insertNode(
|
|
986
|
+
f.deleteContents(), f.insertNode(m);
|
|
916
987
|
const g = document.createTextNode(" ");
|
|
917
|
-
|
|
988
|
+
m.after(g);
|
|
918
989
|
const C = document.createRange();
|
|
919
|
-
C.setStartAfter(g), C.collapse(!0),
|
|
920
|
-
},
|
|
921
|
-
},
|
|
922
|
-
var
|
|
923
|
-
|
|
990
|
+
C.setStartAfter(g), C.collapse(!0), i.removeAllRanges(), i.addRange(C), p.focus(), z(), e.target.value = "";
|
|
991
|
+
}, r.readAsDataURL(n);
|
|
992
|
+
}, Pe = (e) => {
|
|
993
|
+
var u;
|
|
994
|
+
$();
|
|
924
995
|
const n = window.getSelection();
|
|
925
996
|
if (!(n != null && n.rangeCount)) return;
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
},
|
|
929
|
-
|
|
997
|
+
const r = n.getRangeAt(0), o = document.createTextNode(e);
|
|
998
|
+
r.insertNode(o), r.setStartAfter(o), r.collapse(!0), n.removeAllRanges(), n.addRange(r), (u = O()) == null || u.focus(), z();
|
|
999
|
+
}, Be = () => {
|
|
1000
|
+
$();
|
|
930
1001
|
const e = document.createElement("table");
|
|
931
1002
|
e.style.borderCollapse = "collapse", e.style.width = "100%", e.style.border = "1px solid #ccc", e.style.margin = "8px 0", e.style.position = "relative";
|
|
932
|
-
const n = document.createElement("thead"),
|
|
1003
|
+
const n = document.createElement("thead"), r = document.createElement("tbody"), o = document.createElement("tr"), u = document.createElement("tr");
|
|
933
1004
|
for (let f = 0; f < 2; f++) {
|
|
934
|
-
const
|
|
935
|
-
|
|
1005
|
+
const m = document.createElement("th");
|
|
1006
|
+
m.textContent = `Header ${f + 1}`, m.style.border = "1px solid #999", m.style.padding = "8px", m.style.position = "relative", m.style.backgroundColor = "lightgray";
|
|
936
1007
|
const p = document.createElement("td");
|
|
937
|
-
p.textContent = `Row 1 Col ${f + 1}`, p.style.border = "1px solid #999", p.style.padding = "8px", p.style.position = "relative",
|
|
1008
|
+
p.textContent = `Row 1 Col ${f + 1}`, p.style.border = "1px solid #999", p.style.padding = "8px", p.style.position = "relative", p.style.backgroundColor = "#fff", Q(m), Q(p), o.appendChild(m), u.appendChild(p);
|
|
938
1009
|
}
|
|
939
|
-
n.appendChild(
|
|
1010
|
+
n.appendChild(o), r.appendChild(u), e.appendChild(n), e.appendChild(r), We(e), qe(e);
|
|
940
1011
|
const l = window.getSelection();
|
|
941
1012
|
if (!(l != null && l.rangeCount)) return;
|
|
942
1013
|
l.getRangeAt(0).insertNode(e), z();
|
|
943
|
-
},
|
|
1014
|
+
}, qe = (e) => {
|
|
944
1015
|
const n = document.createElement("div");
|
|
945
1016
|
Object.assign(n.style, {
|
|
946
1017
|
position: "absolute",
|
|
@@ -953,21 +1024,21 @@ const bt = ({
|
|
|
953
1024
|
zIndex: "20",
|
|
954
1025
|
borderRadius: "2px"
|
|
955
1026
|
});
|
|
956
|
-
let
|
|
957
|
-
n.addEventListener("mousedown", (
|
|
958
|
-
|
|
1027
|
+
let r = 0, o = 0, u = 0, l = 0;
|
|
1028
|
+
n.addEventListener("mousedown", (i) => {
|
|
1029
|
+
i.preventDefault(), r = i.clientX, o = i.clientY;
|
|
959
1030
|
const f = e.getBoundingClientRect();
|
|
960
|
-
|
|
961
|
-
const
|
|
962
|
-
const C = Math.max(100,
|
|
1031
|
+
u = f.width, l = f.height;
|
|
1032
|
+
const m = (g) => {
|
|
1033
|
+
const C = Math.max(100, u + (g.clientX - r)), k = Math.max(60, l + (g.clientY - o));
|
|
963
1034
|
e.style.width = `${C}px`, e.style.height = `${k}px`, z();
|
|
964
1035
|
}, p = () => {
|
|
965
|
-
document.removeEventListener("mousemove",
|
|
1036
|
+
document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p), z();
|
|
966
1037
|
};
|
|
967
|
-
document.addEventListener("mousemove",
|
|
1038
|
+
document.addEventListener("mousemove", m), document.addEventListener("mouseup", p);
|
|
968
1039
|
}), e.appendChild(n);
|
|
969
|
-
},
|
|
970
|
-
const n = document.createElement("div"),
|
|
1040
|
+
}, Q = (e) => {
|
|
1041
|
+
const n = document.createElement("div"), r = document.createElement("div");
|
|
971
1042
|
Object.assign(n.style, {
|
|
972
1043
|
position: "absolute",
|
|
973
1044
|
right: "0",
|
|
@@ -977,7 +1048,7 @@ const bt = ({
|
|
|
977
1048
|
cursor: "col-resize",
|
|
978
1049
|
background: "rgba(0,0,0,0.15)",
|
|
979
1050
|
zIndex: "10"
|
|
980
|
-
}), Object.assign(
|
|
1051
|
+
}), Object.assign(r.style, {
|
|
981
1052
|
position: "absolute",
|
|
982
1053
|
bottom: "0",
|
|
983
1054
|
left: "0",
|
|
@@ -986,151 +1057,147 @@ const bt = ({
|
|
|
986
1057
|
cursor: "row-resize",
|
|
987
1058
|
background: "rgba(0,0,0,0.15)",
|
|
988
1059
|
zIndex: "10"
|
|
989
|
-
}),
|
|
990
|
-
},
|
|
991
|
-
let
|
|
1060
|
+
}), Ve(e, n, r), e.appendChild(n), e.appendChild(r);
|
|
1061
|
+
}, Ve = (e, n, r) => {
|
|
1062
|
+
let o = 0, u = 0, l = 0, i = 0;
|
|
992
1063
|
n.addEventListener("mousedown", (g) => {
|
|
993
|
-
g.preventDefault(),
|
|
994
|
-
}),
|
|
995
|
-
g.preventDefault(),
|
|
1064
|
+
g.preventDefault(), o = g.clientX, l = e.offsetWidth, document.addEventListener("mousemove", f), document.addEventListener("mouseup", p);
|
|
1065
|
+
}), r.addEventListener("mousedown", (g) => {
|
|
1066
|
+
g.preventDefault(), u = g.clientY, i = e.offsetHeight, document.addEventListener("mousemove", m), document.addEventListener("mouseup", p);
|
|
996
1067
|
});
|
|
997
1068
|
const f = (g) => {
|
|
998
|
-
const C = l + (g.clientX -
|
|
1069
|
+
const C = l + (g.clientX - o);
|
|
999
1070
|
e.style.width = `${Math.max(30, C)}px`;
|
|
1000
|
-
},
|
|
1001
|
-
const C =
|
|
1071
|
+
}, m = (g) => {
|
|
1072
|
+
const C = i + (g.clientY - u);
|
|
1002
1073
|
e.style.height = `${Math.max(20, C)}px`;
|
|
1003
1074
|
}, p = () => {
|
|
1004
|
-
document.removeEventListener("mousemove", f), document.removeEventListener("mousemove",
|
|
1075
|
+
document.removeEventListener("mousemove", f), document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", p);
|
|
1005
1076
|
};
|
|
1006
|
-
},
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1077
|
+
}, Ue = (e) => {
|
|
1078
|
+
const r = e.target.closest("td, th");
|
|
1079
|
+
r && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((o) => o.classList.remove("rte-cell-highlight")), r.classList.add("rte-cell-highlight"), P({
|
|
1009
1080
|
visible: !0,
|
|
1010
1081
|
x: e.clientX,
|
|
1011
1082
|
y: e.clientY,
|
|
1012
|
-
cell:
|
|
1083
|
+
cell: r
|
|
1013
1084
|
}));
|
|
1014
|
-
},
|
|
1085
|
+
}, se = () => {
|
|
1015
1086
|
document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
|
|
1016
|
-
},
|
|
1087
|
+
}, $e = (e) => {
|
|
1017
1088
|
if (!A.cell) return;
|
|
1018
|
-
const n = A.cell.closest("table"),
|
|
1019
|
-
const
|
|
1020
|
-
return f.textContent = l.textContent || "", f.style.cssText = l.style.cssText,
|
|
1089
|
+
const n = A.cell.closest("table"), r = A.cell.cellIndex, o = A.cell.parentElement.rowIndex, u = (l) => {
|
|
1090
|
+
const i = l.tagName.toLowerCase(), f = document.createElement(i);
|
|
1091
|
+
return f.textContent = l.textContent || "", f.style.cssText = l.style.cssText, Q(f), f;
|
|
1021
1092
|
};
|
|
1022
1093
|
switch (e) {
|
|
1023
1094
|
case "insertRowAbove": {
|
|
1024
|
-
const l = n.rows[
|
|
1095
|
+
const l = n.rows[o], i = n.insertRow(o);
|
|
1025
1096
|
Array.from(l.cells).forEach((f) => {
|
|
1026
|
-
|
|
1097
|
+
i.appendChild(u(f));
|
|
1027
1098
|
});
|
|
1028
1099
|
break;
|
|
1029
1100
|
}
|
|
1030
1101
|
case "insertRowBelow": {
|
|
1031
|
-
const l = n.rows[
|
|
1102
|
+
const l = n.rows[o], i = n.insertRow(o + 1);
|
|
1032
1103
|
Array.from(l.cells).forEach((f) => {
|
|
1033
|
-
|
|
1104
|
+
i.appendChild(u(f));
|
|
1034
1105
|
});
|
|
1035
1106
|
break;
|
|
1036
1107
|
}
|
|
1037
1108
|
case "insertColLeft": {
|
|
1038
1109
|
Array.from(n.rows).forEach((l) => {
|
|
1039
|
-
const
|
|
1040
|
-
l.insertBefore(
|
|
1110
|
+
const i = l.cells[r];
|
|
1111
|
+
l.insertBefore(u(i), i);
|
|
1041
1112
|
});
|
|
1042
1113
|
break;
|
|
1043
1114
|
}
|
|
1044
1115
|
case "insertColRight": {
|
|
1045
1116
|
Array.from(n.rows).forEach((l) => {
|
|
1046
|
-
const
|
|
1047
|
-
l.insertBefore(
|
|
1117
|
+
const i = l.cells[r];
|
|
1118
|
+
l.insertBefore(u(i), i.nextSibling);
|
|
1048
1119
|
});
|
|
1049
1120
|
break;
|
|
1050
1121
|
}
|
|
1051
1122
|
case "deleteRow":
|
|
1052
|
-
n.rows.length > 1 && n.deleteRow(
|
|
1123
|
+
n.rows.length > 1 && n.deleteRow(o);
|
|
1053
1124
|
break;
|
|
1054
1125
|
case "deleteCol":
|
|
1055
1126
|
Array.from(n.rows).forEach((l) => {
|
|
1056
|
-
l.cells[
|
|
1127
|
+
l.cells[r] && l.deleteCell(r);
|
|
1057
1128
|
});
|
|
1058
1129
|
break;
|
|
1059
1130
|
}
|
|
1060
|
-
z(),
|
|
1131
|
+
z(), P(ee(G({}, A), {
|
|
1061
1132
|
visible: !1
|
|
1062
|
-
})),
|
|
1063
|
-
},
|
|
1133
|
+
})), se();
|
|
1134
|
+
}, We = (e) => {
|
|
1064
1135
|
const n = e.querySelector("tbody");
|
|
1065
1136
|
if (!n || n.querySelector("[data-hidden-table-start]")) return;
|
|
1137
|
+
const r = document.createElement("span");
|
|
1138
|
+
r.textContent = "{{#arrayData}}", r.style.display = "none", r.setAttribute("data-hidden-table-start", "true"), n.insertBefore(r, n.firstChild);
|
|
1066
1139
|
const o = document.createElement("span");
|
|
1067
|
-
o.textContent = "{{
|
|
1068
|
-
|
|
1069
|
-
a.textContent = "{{/tableData}}", a.style.display = "none", a.setAttribute("data-hidden-table-end", "true"), n.appendChild(a);
|
|
1070
|
-
}, le = () => {
|
|
1140
|
+
o.textContent = "{{/arrayData}}", o.style.display = "none", o.setAttribute("data-hidden-table-end", "true"), n.appendChild(o);
|
|
1141
|
+
}, de = () => {
|
|
1071
1142
|
const e = O();
|
|
1072
|
-
if (!e) return
|
|
1143
|
+
if (!e) return M;
|
|
1073
1144
|
const n = e.cloneNode(!0);
|
|
1074
|
-
return n.querySelectorAll(".rte-cell-highlight").forEach((
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
(o.style.cursor === "col-resize" || o.style.cursor === "row-resize" || o.style.cursor === "nwse-resize") && o.remove();
|
|
1078
|
-
}), n.innerHTML;
|
|
1079
|
-
}, Be = () => {
|
|
1080
|
-
te(), E.current = S.current, G({
|
|
1145
|
+
return n.querySelectorAll("table div").forEach((r) => r.remove()), n.querySelectorAll(".rte-cell-highlight").forEach((r) => r.classList.remove("rte-cell-highlight")), n.innerHTML;
|
|
1146
|
+
}, Ke = () => {
|
|
1147
|
+
oe(), I.current = x.current, te({
|
|
1081
1148
|
url: "",
|
|
1082
1149
|
text: "",
|
|
1083
1150
|
title: "",
|
|
1084
1151
|
target: "_self"
|
|
1085
|
-
}),
|
|
1086
|
-
},
|
|
1152
|
+
}), w(!0);
|
|
1153
|
+
}, Xe = (e) => {
|
|
1087
1154
|
const n = window.getSelection();
|
|
1088
|
-
if (!n || !
|
|
1089
|
-
n.removeAllRanges(), n.addRange(
|
|
1090
|
-
let
|
|
1091
|
-
/^https?:\/\//i.test(
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1155
|
+
if (!n || !I.current) return;
|
|
1156
|
+
n.removeAllRanges(), n.addRange(I.current);
|
|
1157
|
+
let r = e.url.trim();
|
|
1158
|
+
/^https?:\/\//i.test(r) || (r = "https://" + r);
|
|
1159
|
+
const o = document.createElement("a");
|
|
1160
|
+
o.href = r, o.style.cursor = "pointer", o.style.outline = "none", o.textContent = e.text || r, o.title = e.title, o.target = e.target, o.contentEditable = "true";
|
|
1161
|
+
const u = n.getRangeAt(0);
|
|
1162
|
+
u.deleteContents(), u.insertNode(o);
|
|
1096
1163
|
const l = document.createTextNode(" ");
|
|
1097
|
-
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1100
|
-
},
|
|
1164
|
+
o.after(l);
|
|
1165
|
+
const i = document.createRange();
|
|
1166
|
+
i.setStartAfter(l), i.collapse(!0), n.removeAllRanges(), n.addRange(i), w(!1), z();
|
|
1167
|
+
}, Ye = (e) => {
|
|
1101
1168
|
const n = e.target;
|
|
1102
1169
|
if (n.tagName === "A") {
|
|
1103
|
-
const
|
|
1170
|
+
const r = n;
|
|
1104
1171
|
if (e.ctrlKey || e.metaKey) {
|
|
1105
|
-
window.open(
|
|
1172
|
+
window.open(r.href, "_blank", "noopener,noreferrer");
|
|
1106
1173
|
return;
|
|
1107
1174
|
}
|
|
1108
1175
|
e.preventDefault();
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
url:
|
|
1112
|
-
text:
|
|
1113
|
-
title:
|
|
1114
|
-
target:
|
|
1115
|
-
}),
|
|
1176
|
+
const o = document.createRange();
|
|
1177
|
+
o.selectNode(r), I.current = o, te({
|
|
1178
|
+
url: r.href,
|
|
1179
|
+
text: r.textContent || r.href,
|
|
1180
|
+
title: r.title,
|
|
1181
|
+
target: r.target
|
|
1182
|
+
}), w(!0);
|
|
1116
1183
|
}
|
|
1117
|
-
},
|
|
1184
|
+
}, Ze = () => {
|
|
1118
1185
|
const e = O();
|
|
1119
1186
|
if (!e) return;
|
|
1120
1187
|
const n = window.getSelection();
|
|
1121
|
-
if ((!n || n.rangeCount === 0) &&
|
|
1188
|
+
if ((!n || n.rangeCount === 0) && x.current) {
|
|
1122
1189
|
const g = window.getSelection();
|
|
1123
|
-
g == null || g.removeAllRanges(), g == null || g.addRange(
|
|
1190
|
+
g == null || g.removeAllRanges(), g == null || g.addRange(x.current);
|
|
1124
1191
|
}
|
|
1125
|
-
const
|
|
1126
|
-
if (!
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1130
|
-
l.appendChild(
|
|
1131
|
-
const
|
|
1132
|
-
for (;
|
|
1133
|
-
const g =
|
|
1192
|
+
const r = window.getSelection();
|
|
1193
|
+
if (!r || r.rangeCount === 0) return;
|
|
1194
|
+
const o = r.getRangeAt(0);
|
|
1195
|
+
$(), document.execCommand("removeFormat", !1);
|
|
1196
|
+
const u = o.cloneContents(), l = document.createElement("div");
|
|
1197
|
+
l.appendChild(u);
|
|
1198
|
+
const i = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, null), f = [];
|
|
1199
|
+
for (; i.nextNode(); ) {
|
|
1200
|
+
const g = i.currentNode, C = g.tagName.toUpperCase(), k = g.getAttribute && g.getAttribute("data-mention") !== null;
|
|
1134
1201
|
C !== "A" && !k && f.push(g);
|
|
1135
1202
|
}
|
|
1136
1203
|
for (let g = f.length - 1; g >= 0; g--) {
|
|
@@ -1140,76 +1207,93 @@ const bt = ({
|
|
|
1140
1207
|
k.removeChild(C);
|
|
1141
1208
|
}
|
|
1142
1209
|
}
|
|
1143
|
-
l.querySelectorAll("[style]").forEach((g) => g.removeAttribute("style")),
|
|
1144
|
-
const
|
|
1145
|
-
for (; l.firstChild; )
|
|
1146
|
-
|
|
1210
|
+
l.querySelectorAll("[style]").forEach((g) => g.removeAttribute("style")), o.deleteContents();
|
|
1211
|
+
const m = document.createDocumentFragment();
|
|
1212
|
+
for (; l.firstChild; ) m.appendChild(l.firstChild);
|
|
1213
|
+
o.insertNode(m);
|
|
1147
1214
|
const p = document.createRange();
|
|
1148
|
-
p.setStartAfter(
|
|
1215
|
+
p.setStartAfter(o.endContainer.nodeType === Node.TEXT_NODE ? o.endContainer : o.startContainer), p.collapse(!0), r.removeAllRanges(), r.addRange(p), e.normalize(), z();
|
|
1216
|
+
}, Qe = (e) => {
|
|
1217
|
+
var o;
|
|
1218
|
+
let n = e;
|
|
1219
|
+
n = n.replace(/{{#arrayData\d*}}/g, ""), n = n.replace(/{{\/arrayData\d*}}/g, "");
|
|
1220
|
+
const r = document.createElement("div");
|
|
1221
|
+
return r.innerHTML = n, r.querySelectorAll("br").forEach((u) => {
|
|
1222
|
+
u.replaceWith(`
|
|
1223
|
+
`);
|
|
1224
|
+
}), r.querySelectorAll("p, div, tr").forEach((u) => {
|
|
1225
|
+
u.insertAdjacentText("afterend", `
|
|
1226
|
+
`);
|
|
1227
|
+
}), r.querySelectorAll("table").forEach((u) => {
|
|
1228
|
+
u.insertAdjacentText("afterend", `
|
|
1229
|
+
`);
|
|
1230
|
+
}), ((o = r.textContent) == null ? void 0 : o.replace(/\n{3,}/g, `
|
|
1231
|
+
|
|
1232
|
+
`).trim()) || "";
|
|
1149
1233
|
};
|
|
1150
|
-
return /* @__PURE__ */
|
|
1234
|
+
return /* @__PURE__ */ a.createElement("div", {
|
|
1151
1235
|
className: `rte-wrapper ${(v == null ? void 0 : v.wrapper) || ""}`,
|
|
1152
1236
|
style: y.wrapper
|
|
1153
|
-
}, /* @__PURE__ */
|
|
1237
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
1154
1238
|
style: {
|
|
1155
1239
|
flex: 1
|
|
1156
1240
|
}
|
|
1157
|
-
}, /* @__PURE__ */
|
|
1158
|
-
exec:
|
|
1159
|
-
saveSelection:
|
|
1160
|
-
handleFileChange:
|
|
1161
|
-
handleFontSizeChange: (e) =>
|
|
1162
|
-
handleFontFamilyChange: (e) =>
|
|
1163
|
-
insertEmoji:
|
|
1164
|
-
handleLink:
|
|
1165
|
-
removeFormatting:
|
|
1166
|
-
visibleActions:
|
|
1241
|
+
}, /* @__PURE__ */ a.createElement(Mt, {
|
|
1242
|
+
exec: W,
|
|
1243
|
+
saveSelection: oe,
|
|
1244
|
+
handleFileChange: Ie,
|
|
1245
|
+
handleFontSizeChange: (e) => W("fontSize", e.target.value),
|
|
1246
|
+
handleFontFamilyChange: (e) => W("fontName", e.target.value),
|
|
1247
|
+
insertEmoji: Pe,
|
|
1248
|
+
handleLink: Ke,
|
|
1249
|
+
removeFormatting: Ze,
|
|
1250
|
+
visibleActions: ze,
|
|
1167
1251
|
className: v.toolbar,
|
|
1168
1252
|
style: y.toolbar
|
|
1169
|
-
}), /* @__PURE__ */
|
|
1170
|
-
ref:
|
|
1253
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
1254
|
+
ref: H,
|
|
1171
1255
|
className: `rte-editor ${(v == null ? void 0 : v.editor) || ""}`,
|
|
1172
1256
|
style: y.editor,
|
|
1173
1257
|
contentEditable: !0,
|
|
1174
1258
|
suppressContentEditableWarning: !0,
|
|
1175
|
-
onInput:
|
|
1176
|
-
onKeyDown:
|
|
1177
|
-
onBeforeInput:
|
|
1178
|
-
onContextMenu:
|
|
1179
|
-
onClick:
|
|
1180
|
-
}), /* @__PURE__ */
|
|
1181
|
-
show:
|
|
1182
|
-
position:
|
|
1183
|
-
filtered:
|
|
1184
|
-
insertMention:
|
|
1185
|
-
onClose: () =>
|
|
1186
|
-
query:
|
|
1187
|
-
}), c && /* @__PURE__ */
|
|
1259
|
+
onInput: ie,
|
|
1260
|
+
onKeyDown: _e,
|
|
1261
|
+
onBeforeInput: Fe,
|
|
1262
|
+
onContextMenu: Ue,
|
|
1263
|
+
onClick: Ye
|
|
1264
|
+
}), /* @__PURE__ */ a.createElement(zt, {
|
|
1265
|
+
show: b,
|
|
1266
|
+
position: q,
|
|
1267
|
+
filtered: Z,
|
|
1268
|
+
insertMention: He,
|
|
1269
|
+
onClose: () => F(!1),
|
|
1270
|
+
query: Ne
|
|
1271
|
+
}), c && /* @__PURE__ */ a.createElement("div", {
|
|
1188
1272
|
className: `rte-output ${(v == null ? void 0 : v.output) || ""}`,
|
|
1189
1273
|
style: y.output
|
|
1190
|
-
}, /* @__PURE__ */
|
|
1274
|
+
}, /* @__PURE__ */ a.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ a.createElement("p", null, M)), /* @__PURE__ */ a.createElement(Nt, {
|
|
1191
1275
|
visible: A.visible,
|
|
1192
1276
|
x: A.x,
|
|
1193
1277
|
y: A.y,
|
|
1194
|
-
onAction:
|
|
1278
|
+
onAction: $e,
|
|
1195
1279
|
onClose: () => {
|
|
1196
|
-
|
|
1280
|
+
P(ee(G({}, A), {
|
|
1197
1281
|
visible: !1
|
|
1198
|
-
})),
|
|
1282
|
+
})), se();
|
|
1199
1283
|
}
|
|
1200
|
-
}), /* @__PURE__ */
|
|
1201
|
-
visible:
|
|
1202
|
-
linkData:
|
|
1203
|
-
onClose: () =>
|
|
1204
|
-
onInsert:
|
|
1205
|
-
})),
|
|
1284
|
+
}), /* @__PURE__ */ a.createElement(At, {
|
|
1285
|
+
visible: h,
|
|
1286
|
+
linkData: Me,
|
|
1287
|
+
onClose: () => w(!1),
|
|
1288
|
+
onInsert: Xe
|
|
1289
|
+
})), s ? /* @__PURE__ */ a.createElement(kt, {
|
|
1206
1290
|
className: v.preview,
|
|
1207
1291
|
style: y.preview,
|
|
1208
|
-
html:
|
|
1292
|
+
html: de()
|
|
1209
1293
|
}) : null);
|
|
1210
1294
|
};
|
|
1211
1295
|
export {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1296
|
+
Ot as RichTextEditor,
|
|
1297
|
+
kt as RtePreview,
|
|
1298
|
+
Mt as RteToolbar
|
|
1215
1299
|
};
|