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