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