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