@ryzeup/richtexteditor 1.0.17 → 1.0.18
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 +288 -286
- package/dist/index.js +5 -5
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var it = Object.defineProperty, st = Object.defineProperties;
|
|
2
|
+
var dt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Le = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var ut = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var xe = (r, c, d) => c in r ? it(r, c, { enumerable: !0, configurable: !0, writable: !0, value: d }) : r[c] = d, ae = (r, c) => {
|
|
6
6
|
for (var d in c || (c = {}))
|
|
7
|
-
|
|
7
|
+
ut.call(c, d) && xe(r, d, c[d]);
|
|
8
8
|
if (Le)
|
|
9
9
|
for (var d of Le(c))
|
|
10
|
-
|
|
10
|
+
mt.call(c, d) && xe(r, d, c[d]);
|
|
11
11
|
return r;
|
|
12
|
-
}, oe = (r, c) =>
|
|
13
|
-
import * as
|
|
14
|
-
import o, { useRef as P, useState as M, useEffect as
|
|
15
|
-
import { createPortal as
|
|
16
|
-
window.React =
|
|
17
|
-
var
|
|
12
|
+
}, oe = (r, c) => st(r, dt(c));
|
|
13
|
+
import * as gt from "react";
|
|
14
|
+
import o, { useRef as P, useState as M, useEffect as I } from "react";
|
|
15
|
+
import { createPortal as ft } from "react-dom";
|
|
16
|
+
window.React = gt;
|
|
17
|
+
var Ne = {
|
|
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(Ne), ht = ["attr", "size", "title"];
|
|
24
|
+
function pt(r, c) {
|
|
25
25
|
if (r == null) return {};
|
|
26
|
-
var d =
|
|
26
|
+
var d = vt(r, c), u, m;
|
|
27
27
|
if (Object.getOwnPropertySymbols) {
|
|
28
28
|
var y = Object.getOwnPropertySymbols(r);
|
|
29
29
|
for (m = 0; m < y.length; m++)
|
|
@@ -31,7 +31,7 @@ function ht(r, c) {
|
|
|
31
31
|
}
|
|
32
32
|
return d;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function vt(r, c) {
|
|
35
35
|
if (r == null) return {};
|
|
36
36
|
var d = {};
|
|
37
37
|
for (var u in r)
|
|
@@ -41,17 +41,17 @@ function pt(r, c) {
|
|
|
41
41
|
}
|
|
42
42
|
return d;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
44
|
+
function J() {
|
|
45
|
+
return J = Object.assign ? Object.assign.bind() : function(r) {
|
|
46
46
|
for (var c = 1; c < arguments.length; c++) {
|
|
47
47
|
var d = arguments[c];
|
|
48
48
|
for (var u in d)
|
|
49
49
|
Object.prototype.hasOwnProperty.call(d, u) && (r[u] = d[u]);
|
|
50
50
|
}
|
|
51
51
|
return r;
|
|
52
|
-
},
|
|
52
|
+
}, J.apply(this, arguments);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Me(r, c) {
|
|
55
55
|
var d = Object.keys(r);
|
|
56
56
|
if (Object.getOwnPropertySymbols) {
|
|
57
57
|
var u = Object.getOwnPropertySymbols(r);
|
|
@@ -61,25 +61,25 @@ function Ae(r, c) {
|
|
|
61
61
|
}
|
|
62
62
|
return d;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function G(r) {
|
|
65
65
|
for (var c = 1; c < arguments.length; c++) {
|
|
66
66
|
var d = arguments[c] != null ? arguments[c] : {};
|
|
67
|
-
c % 2 ?
|
|
68
|
-
|
|
69
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) :
|
|
67
|
+
c % 2 ? Me(Object(d), !0).forEach(function(u) {
|
|
68
|
+
Et(r, u, d[u]);
|
|
69
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(d)) : Me(Object(d)).forEach(function(u) {
|
|
70
70
|
Object.defineProperty(r, u, Object.getOwnPropertyDescriptor(d, u));
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
return r;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return c =
|
|
75
|
+
function Et(r, c, d) {
|
|
76
|
+
return c = yt(c), c in r ? Object.defineProperty(r, c, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : r[c] = d, r;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
var c =
|
|
78
|
+
function yt(r) {
|
|
79
|
+
var c = wt(r, "string");
|
|
80
80
|
return typeof c == "symbol" ? c : c + "";
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function wt(r, c) {
|
|
83
83
|
if (typeof r != "object" || !r) return r;
|
|
84
84
|
var d = r[Symbol.toPrimitive];
|
|
85
85
|
if (d !== void 0) {
|
|
@@ -89,85 +89,85 @@ function yt(r, c) {
|
|
|
89
89
|
}
|
|
90
90
|
return (c === "string" ? String : Number)(r);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
return r && r.map((c, d) => /* @__PURE__ */ o.createElement(c.tag,
|
|
92
|
+
function ke(r) {
|
|
93
|
+
return r && r.map((c, d) => /* @__PURE__ */ o.createElement(c.tag, G({
|
|
94
94
|
key: d
|
|
95
|
-
}, c.attr),
|
|
95
|
+
}, c.attr), ke(c.child)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return (c) => /* @__PURE__ */ o.createElement(
|
|
99
|
-
attr:
|
|
100
|
-
}, c),
|
|
97
|
+
function z(r) {
|
|
98
|
+
return (c) => /* @__PURE__ */ o.createElement(Ct, J({
|
|
99
|
+
attr: G({}, r.attr)
|
|
100
|
+
}, c), ke(r.child));
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function Ct(r) {
|
|
103
103
|
var c = (d) => {
|
|
104
104
|
var {
|
|
105
105
|
attr: u,
|
|
106
106
|
size: m,
|
|
107
107
|
title: y
|
|
108
|
-
} = r,
|
|
109
|
-
return d.className && (E = d.className), r.className && (E = (E ? E + " " : "") + r.className), /* @__PURE__ */ o.createElement("svg",
|
|
108
|
+
} = r, b = pt(r, ht), R = m || d.size || "1em", E;
|
|
109
|
+
return d.className && (E = d.className), r.className && (E = (E ? E + " " : "") + r.className), /* @__PURE__ */ o.createElement("svg", J({
|
|
110
110
|
stroke: "currentColor",
|
|
111
111
|
fill: "currentColor",
|
|
112
112
|
strokeWidth: "0"
|
|
113
|
-
}, d.attr, u,
|
|
113
|
+
}, d.attr, u, b, {
|
|
114
114
|
className: E,
|
|
115
|
-
style:
|
|
115
|
+
style: G(G({
|
|
116
116
|
color: r.color || d.color
|
|
117
117
|
}, d.style), r.style),
|
|
118
|
-
height:
|
|
119
|
-
width:
|
|
118
|
+
height: R,
|
|
119
|
+
width: R,
|
|
120
120
|
xmlns: "http://www.w3.org/2000/svg"
|
|
121
121
|
}), y && /* @__PURE__ */ o.createElement("title", null, y), r.children);
|
|
122
122
|
};
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
function Ct(r) {
|
|
126
|
-
return A({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z" }, child: [] }] })(r);
|
|
123
|
+
return Se !== void 0 ? /* @__PURE__ */ o.createElement(Se.Consumer, null, (d) => c(d)) : c(Ne);
|
|
127
124
|
}
|
|
128
125
|
function bt(r) {
|
|
129
|
-
return
|
|
126
|
+
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z" }, child: [] }] })(r);
|
|
130
127
|
}
|
|
131
128
|
function Rt(r) {
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
function xt(r) {
|
|
135
|
-
return A({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z" }, child: [] }] })(r);
|
|
129
|
+
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z" }, child: [] }] })(r);
|
|
136
130
|
}
|
|
137
131
|
function Lt(r) {
|
|
138
|
-
return
|
|
132
|
+
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z" }, child: [] }] })(r);
|
|
133
|
+
}
|
|
134
|
+
function xt(r) {
|
|
135
|
+
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z" }, child: [] }] })(r);
|
|
139
136
|
}
|
|
140
137
|
function St(r) {
|
|
141
|
-
return
|
|
138
|
+
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
|
|
142
139
|
}
|
|
143
140
|
function Mt(r) {
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
function At(r) {
|
|
147
|
-
return A({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z" }, child: [] }] })(r);
|
|
141
|
+
return z({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z" }, child: [] }] })(r);
|
|
148
142
|
}
|
|
149
143
|
function zt(r) {
|
|
150
|
-
return
|
|
144
|
+
return z({ attr: { viewBox: "0 0 544 512" }, child: [{ tag: "path", attr: { d: "M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z" }, child: [] }] })(r);
|
|
145
|
+
}
|
|
146
|
+
function At(r) {
|
|
147
|
+
return z({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z" }, child: [] }] })(r);
|
|
151
148
|
}
|
|
152
149
|
function Nt(r) {
|
|
153
|
-
return
|
|
150
|
+
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z" }, child: [] }] })(r);
|
|
154
151
|
}
|
|
155
152
|
function kt(r) {
|
|
156
|
-
return
|
|
153
|
+
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
|
|
157
154
|
}
|
|
158
155
|
function Tt(r) {
|
|
159
|
-
return
|
|
156
|
+
return z({ attr: { viewBox: "0 0 496 512" }, child: [{ tag: "path", attr: { d: "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z" }, child: [] }] })(r);
|
|
160
157
|
}
|
|
161
158
|
function Dt(r) {
|
|
162
|
-
return
|
|
159
|
+
return z({ 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: [] }] })(r);
|
|
163
160
|
}
|
|
164
161
|
function Ot(r) {
|
|
165
|
-
return
|
|
162
|
+
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z" }, child: [] }] })(r);
|
|
166
163
|
}
|
|
167
164
|
function Ht(r) {
|
|
168
|
-
return
|
|
165
|
+
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z" }, child: [] }] })(r);
|
|
169
166
|
}
|
|
170
|
-
|
|
167
|
+
function jt(r) {
|
|
168
|
+
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z" }, child: [] }] })(r);
|
|
169
|
+
}
|
|
170
|
+
const _t = [
|
|
171
171
|
"😀",
|
|
172
172
|
"😁",
|
|
173
173
|
"😂",
|
|
@@ -279,7 +279,7 @@ const jt = [
|
|
|
279
279
|
"👏",
|
|
280
280
|
"🫶",
|
|
281
281
|
"👐"
|
|
282
|
-
],
|
|
282
|
+
], Ft = ({
|
|
283
283
|
exec: r,
|
|
284
284
|
saveSelection: c,
|
|
285
285
|
handleFileChange: d,
|
|
@@ -287,25 +287,25 @@ const jt = [
|
|
|
287
287
|
handleFontFamilyChange: m,
|
|
288
288
|
// insertListBlock,
|
|
289
289
|
insertEmoji: y,
|
|
290
|
-
handleLink:
|
|
291
|
-
removeFormatting:
|
|
290
|
+
handleLink: b,
|
|
291
|
+
removeFormatting: R,
|
|
292
292
|
visibleActions: E,
|
|
293
293
|
className: O,
|
|
294
294
|
style: _
|
|
295
295
|
}) => {
|
|
296
296
|
var V, T;
|
|
297
|
-
const
|
|
297
|
+
const A = P(null), j = P(null), L = P(null), [K, $] = M(!1), [q, B] = M({
|
|
298
298
|
x: 0,
|
|
299
299
|
y: 0
|
|
300
300
|
});
|
|
301
|
-
|
|
301
|
+
I(() => {
|
|
302
302
|
const f = (w) => {
|
|
303
303
|
!w.target.closest(".rte-emoji-popup") && !w.target.closest("button[title='Emoji']") && $(!1);
|
|
304
304
|
};
|
|
305
305
|
return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
|
|
306
306
|
}, []);
|
|
307
307
|
const F = (f) => {
|
|
308
|
-
var
|
|
308
|
+
var H;
|
|
309
309
|
f.preventDefault();
|
|
310
310
|
const w = f.currentTarget.dataset.command;
|
|
311
311
|
if (w)
|
|
@@ -319,7 +319,7 @@ const jt = [
|
|
|
319
319
|
r(w);
|
|
320
320
|
break;
|
|
321
321
|
case "insertImage": {
|
|
322
|
-
(
|
|
322
|
+
(H = A.current) == null || H.click();
|
|
323
323
|
break;
|
|
324
324
|
}
|
|
325
325
|
default:
|
|
@@ -329,7 +329,7 @@ const jt = [
|
|
|
329
329
|
r("foreColor", f.target.value);
|
|
330
330
|
}, te = (f) => {
|
|
331
331
|
r("backColor", f.target.value);
|
|
332
|
-
}, [
|
|
332
|
+
}, [S, k] = M({
|
|
333
333
|
bold: !1,
|
|
334
334
|
italic: !1,
|
|
335
335
|
underline: !1,
|
|
@@ -346,7 +346,7 @@ const jt = [
|
|
|
346
346
|
color: !1,
|
|
347
347
|
highlight: !1
|
|
348
348
|
});
|
|
349
|
-
return
|
|
349
|
+
return I(() => {
|
|
350
350
|
const f = () => {
|
|
351
351
|
k({
|
|
352
352
|
bold: document.queryCommandState("bold"),
|
|
@@ -374,48 +374,48 @@ const jt = [
|
|
|
374
374
|
"data-command": "bold",
|
|
375
375
|
title: "Bold",
|
|
376
376
|
onMouseDown: F,
|
|
377
|
-
className:
|
|
378
|
-
}, /* @__PURE__ */ o.createElement(
|
|
377
|
+
className: S.bold ? "rte-active" : ""
|
|
378
|
+
}, /* @__PURE__ */ o.createElement(Mt, null)), E.italic && /* @__PURE__ */ o.createElement("button", {
|
|
379
379
|
"data-command": "italic",
|
|
380
380
|
title: "Italic",
|
|
381
381
|
onMouseDown: F,
|
|
382
|
-
className:
|
|
382
|
+
className: S.italic ? "rte-active" : ""
|
|
383
383
|
}, /* @__PURE__ */ o.createElement(At, null)), E.underline && /* @__PURE__ */ o.createElement("button", {
|
|
384
384
|
"data-command": "underline",
|
|
385
385
|
title: "Underline",
|
|
386
386
|
onMouseDown: F,
|
|
387
|
-
className:
|
|
388
|
-
}, /* @__PURE__ */ o.createElement(
|
|
387
|
+
className: S.underline ? "rte-active" : ""
|
|
388
|
+
}, /* @__PURE__ */ o.createElement(Ot, null)), E.unorderedList && /* @__PURE__ */ o.createElement("button", {
|
|
389
389
|
"data-command": "insertUnorderedList",
|
|
390
390
|
onMouseDown: F,
|
|
391
391
|
title: "UnorderedList",
|
|
392
|
-
className:
|
|
393
|
-
}, /* @__PURE__ */ o.createElement(
|
|
392
|
+
className: S.unorderedList ? "rte-active" : ""
|
|
393
|
+
}, /* @__PURE__ */ o.createElement(kt, null)), E.orderedList && /* @__PURE__ */ o.createElement("button", {
|
|
394
394
|
"data-command": "insertOrderedList",
|
|
395
395
|
title: "OrderedList",
|
|
396
396
|
onMouseDown: F,
|
|
397
|
-
className:
|
|
397
|
+
className: S.orderedList ? "rte-active" : ""
|
|
398
398
|
}, /* @__PURE__ */ o.createElement(xt, null)), E.link && /* @__PURE__ */ o.createElement("button", {
|
|
399
399
|
"data-command": "createLink",
|
|
400
400
|
title: "Link",
|
|
401
|
-
onClick:
|
|
402
|
-
className:
|
|
403
|
-
}, /* @__PURE__ */ o.createElement(
|
|
401
|
+
onClick: b,
|
|
402
|
+
className: S.link ? "rte-active" : ""
|
|
403
|
+
}, /* @__PURE__ */ o.createElement(Nt, null)), E.removeFormat && /* @__PURE__ */ o.createElement("button", {
|
|
404
404
|
"data-command": "Remove format",
|
|
405
405
|
title: "removeFormat",
|
|
406
406
|
onMouseDown: (f) => {
|
|
407
|
-
f.preventDefault(), c(),
|
|
407
|
+
f.preventDefault(), c(), R();
|
|
408
408
|
},
|
|
409
|
-
className:
|
|
410
|
-
}, /* @__PURE__ */ o.createElement(
|
|
409
|
+
className: S.removeFormat ? "rte-active" : ""
|
|
410
|
+
}, /* @__PURE__ */ o.createElement(jt, null)), E.image && /* @__PURE__ */ o.createElement("button", {
|
|
411
411
|
"data-command": "insertImage",
|
|
412
412
|
title: "Image",
|
|
413
413
|
onMouseDown: F,
|
|
414
|
-
className:
|
|
415
|
-
}, /* @__PURE__ */ o.createElement(
|
|
414
|
+
className: S.image ? "rte-active" : ""
|
|
415
|
+
}, /* @__PURE__ */ o.createElement(Lt, null)), /* @__PURE__ */ o.createElement("input", {
|
|
416
416
|
type: "file",
|
|
417
417
|
accept: "image/*",
|
|
418
|
-
ref:
|
|
418
|
+
ref: A,
|
|
419
419
|
style: {
|
|
420
420
|
display: "none"
|
|
421
421
|
},
|
|
@@ -429,28 +429,28 @@ const jt = [
|
|
|
429
429
|
onMouseDown: (f) => {
|
|
430
430
|
f.preventDefault(), c();
|
|
431
431
|
const w = f.currentTarget.getBoundingClientRect();
|
|
432
|
-
|
|
432
|
+
B({
|
|
433
433
|
x: w.left,
|
|
434
434
|
y: w.bottom + 8
|
|
435
435
|
// small spacing
|
|
436
|
-
}), $((
|
|
436
|
+
}), $((H) => !H);
|
|
437
437
|
},
|
|
438
|
-
className:
|
|
439
|
-
}, /* @__PURE__ */ o.createElement(
|
|
438
|
+
className: S.emoji ? "rte-active" : ""
|
|
439
|
+
}, /* @__PURE__ */ o.createElement(Tt, null)), K && /* @__PURE__ */ ft(/* @__PURE__ */ o.createElement("div", {
|
|
440
440
|
className: "rte-emoji-popup",
|
|
441
441
|
style: {
|
|
442
442
|
top: q.y,
|
|
443
443
|
left: q.x
|
|
444
444
|
}
|
|
445
|
-
},
|
|
445
|
+
}, _t.map((f, w) => /* @__PURE__ */ o.createElement("span", {
|
|
446
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(f), $(!1);
|
|
454
454
|
}
|
|
455
455
|
}, f))), document.body)), E.color && /* @__PURE__ */ o.createElement("div", {
|
|
456
456
|
style: {
|
|
@@ -460,18 +460,18 @@ const jt = [
|
|
|
460
460
|
title: "Text Color",
|
|
461
461
|
onMouseDown: (f) => {
|
|
462
462
|
var w;
|
|
463
|
-
f.preventDefault(), c(), (w =
|
|
463
|
+
f.preventDefault(), c(), (w = j.current) == null || w.click();
|
|
464
464
|
},
|
|
465
465
|
style: {
|
|
466
466
|
display: "flex",
|
|
467
467
|
alignItems: "center",
|
|
468
468
|
justifyContent: "center",
|
|
469
|
-
color: ((V =
|
|
469
|
+
color: ((V = j.current) == null ? void 0 : V.value) || "#000",
|
|
470
470
|
fontSize: "18px"
|
|
471
471
|
},
|
|
472
|
-
className:
|
|
473
|
-
}, /* @__PURE__ */ o.createElement(
|
|
474
|
-
ref:
|
|
472
|
+
className: S.color ? "rte-active" : ""
|
|
473
|
+
}, /* @__PURE__ */ o.createElement(Ht, null)), /* @__PURE__ */ o.createElement("input", {
|
|
474
|
+
ref: j,
|
|
475
475
|
type: "color",
|
|
476
476
|
defaultValue: "#000000",
|
|
477
477
|
onChange: (f) => {
|
|
@@ -493,18 +493,18 @@ const jt = [
|
|
|
493
493
|
title: "Highlight",
|
|
494
494
|
onMouseDown: (f) => {
|
|
495
495
|
var w;
|
|
496
|
-
f.preventDefault(), c(), (w =
|
|
496
|
+
f.preventDefault(), c(), (w = L.current) == null || w.click();
|
|
497
497
|
},
|
|
498
498
|
style: {
|
|
499
499
|
display: "flex",
|
|
500
500
|
alignItems: "center",
|
|
501
501
|
justifyContent: "center",
|
|
502
|
-
color: ((T =
|
|
502
|
+
color: ((T = L.current) == null ? void 0 : T.value) || "#000",
|
|
503
503
|
fontSize: "18px"
|
|
504
504
|
},
|
|
505
|
-
className:
|
|
506
|
-
}, /* @__PURE__ */ o.createElement(
|
|
507
|
-
ref:
|
|
505
|
+
className: S.highlight ? "rte-active" : ""
|
|
506
|
+
}, /* @__PURE__ */ o.createElement(zt, null)), /* @__PURE__ */ o.createElement("input", {
|
|
507
|
+
ref: L,
|
|
508
508
|
type: "color",
|
|
509
509
|
onChange: (f) => {
|
|
510
510
|
var w;
|
|
@@ -522,23 +522,23 @@ const jt = [
|
|
|
522
522
|
title: "Align Left",
|
|
523
523
|
onMouseDown: (f) => f.preventDefault(),
|
|
524
524
|
onClick: () => r("justifyLeft"),
|
|
525
|
-
className:
|
|
526
|
-
}, /* @__PURE__ */ o.createElement(
|
|
525
|
+
className: S.alignLeft ? "rte-active" : ""
|
|
526
|
+
}, /* @__PURE__ */ o.createElement(St, null)), /* @__PURE__ */ o.createElement("button", {
|
|
527
527
|
title: "Align Center",
|
|
528
528
|
onMouseDown: (f) => f.preventDefault(),
|
|
529
529
|
onClick: () => r("justifyCenter"),
|
|
530
|
-
className:
|
|
531
|
-
}, /* @__PURE__ */ o.createElement(
|
|
530
|
+
className: S.alignCenter ? "rte-active" : ""
|
|
531
|
+
}, /* @__PURE__ */ o.createElement(bt, null)), /* @__PURE__ */ o.createElement("button", {
|
|
532
532
|
title: "Align Right",
|
|
533
533
|
onMouseDown: (f) => f.preventDefault(),
|
|
534
534
|
onClick: () => r("justifyRight"),
|
|
535
|
-
className:
|
|
536
|
-
}, /* @__PURE__ */ o.createElement(
|
|
535
|
+
className: S.alignRight ? "rte-active" : ""
|
|
536
|
+
}, /* @__PURE__ */ o.createElement(Rt, null))), E.table && /* @__PURE__ */ o.createElement("button", {
|
|
537
537
|
title: "Insert Table",
|
|
538
538
|
onMouseDown: (f) => f.preventDefault(),
|
|
539
539
|
onClick: () => r("insertTable"),
|
|
540
|
-
className:
|
|
541
|
-
}, /* @__PURE__ */ o.createElement(
|
|
540
|
+
className: S.table ? "rte-active" : ""
|
|
541
|
+
}, /* @__PURE__ */ o.createElement(Dt, null)), E.fontFamily && /* @__PURE__ */ o.createElement("select", {
|
|
542
542
|
className: "rte-dropdown",
|
|
543
543
|
defaultValue: "",
|
|
544
544
|
onMouseDown: () => c(),
|
|
@@ -573,7 +573,7 @@ const jt = [
|
|
|
573
573
|
}, "Medium"), /* @__PURE__ */ o.createElement("option", {
|
|
574
574
|
value: "5"
|
|
575
575
|
}, "Large")));
|
|
576
|
-
},
|
|
576
|
+
}, Pt = ({
|
|
577
577
|
show: r,
|
|
578
578
|
position: c,
|
|
579
579
|
filtered: d,
|
|
@@ -581,36 +581,36 @@ const jt = [
|
|
|
581
581
|
onClose: m,
|
|
582
582
|
query: y
|
|
583
583
|
}) => {
|
|
584
|
-
const
|
|
585
|
-
return
|
|
586
|
-
const
|
|
587
|
-
|
|
584
|
+
const b = P(null);
|
|
585
|
+
return I(() => {
|
|
586
|
+
const R = (E) => {
|
|
587
|
+
b.current && !b.current.contains(E.target) && m();
|
|
588
588
|
};
|
|
589
|
-
return r && document.addEventListener("mousedown",
|
|
590
|
-
document.removeEventListener("mousedown",
|
|
589
|
+
return r && document.addEventListener("mousedown", R), () => {
|
|
590
|
+
document.removeEventListener("mousedown", R);
|
|
591
591
|
};
|
|
592
592
|
}, [r, m]), r ? /* @__PURE__ */ o.createElement("ul", {
|
|
593
|
-
ref:
|
|
593
|
+
ref: b,
|
|
594
594
|
className: "rte-popup",
|
|
595
595
|
style: {
|
|
596
596
|
top: c.y,
|
|
597
597
|
left: c.x
|
|
598
598
|
}
|
|
599
599
|
}, d.length > 0 ? d.map(({
|
|
600
|
-
name:
|
|
600
|
+
name: R,
|
|
601
601
|
value: E
|
|
602
602
|
}) => {
|
|
603
|
-
const O =
|
|
604
|
-
let
|
|
605
|
-
if (
|
|
606
|
-
const
|
|
607
|
-
|
|
603
|
+
const O = R.toLowerCase(), _ = y.toLowerCase(), A = O.indexOf(_);
|
|
604
|
+
let j = R;
|
|
605
|
+
if (A !== -1 && y.length > 0) {
|
|
606
|
+
const L = A + y.length;
|
|
607
|
+
j = R.substring(0, A) + `<span class="rte-highlight">${R.substring(A, L)}</span>` + R.substring(L);
|
|
608
608
|
}
|
|
609
609
|
return /* @__PURE__ */ o.createElement("li", {
|
|
610
610
|
key: E,
|
|
611
|
-
onMouseDown: (
|
|
612
|
-
|
|
613
|
-
name:
|
|
611
|
+
onMouseDown: (L) => {
|
|
612
|
+
L.preventDefault(), u({
|
|
613
|
+
name: R,
|
|
614
614
|
value: E
|
|
615
615
|
});
|
|
616
616
|
},
|
|
@@ -620,10 +620,10 @@ const jt = [
|
|
|
620
620
|
fontSize: "14px"
|
|
621
621
|
},
|
|
622
622
|
dangerouslySetInnerHTML: {
|
|
623
|
-
__html:
|
|
623
|
+
__html: j
|
|
624
624
|
},
|
|
625
|
-
onMouseEnter: (
|
|
626
|
-
onMouseLeave: (
|
|
625
|
+
onMouseEnter: (L) => L.currentTarget.style.background = "#f0f0f0",
|
|
626
|
+
onMouseLeave: (L) => L.currentTarget.style.background = "#fff"
|
|
627
627
|
});
|
|
628
628
|
}) : /* @__PURE__ */ o.createElement("li", {
|
|
629
629
|
style: {
|
|
@@ -633,12 +633,12 @@ const jt = [
|
|
|
633
633
|
}, "No matches")) : null;
|
|
634
634
|
};
|
|
635
635
|
function ze(r) {
|
|
636
|
-
return
|
|
636
|
+
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Minus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z" }, child: [] }] }] }] })(r);
|
|
637
637
|
}
|
|
638
|
-
function
|
|
639
|
-
return
|
|
638
|
+
function Q(r) {
|
|
639
|
+
return z({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "g", attr: { id: "Circle_Plus" }, child: [{ tag: "g", attr: {}, child: [{ tag: "path", attr: { d: "M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z" }, child: [] }, { tag: "path", attr: { d: "M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z" }, child: [] }] }] }] })(r);
|
|
640
640
|
}
|
|
641
|
-
const
|
|
641
|
+
const It = ({
|
|
642
642
|
visible: r,
|
|
643
643
|
x: c,
|
|
644
644
|
y: d,
|
|
@@ -656,13 +656,13 @@ const Pt = ({
|
|
|
656
656
|
onMouseLeave: m
|
|
657
657
|
}, /* @__PURE__ */ o.createElement("button", {
|
|
658
658
|
onClick: () => u("insertRowAbove")
|
|
659
|
-
}, /* @__PURE__ */ o.createElement(
|
|
659
|
+
}, /* @__PURE__ */ o.createElement(Q, null), " Insert row above"), /* @__PURE__ */ o.createElement("button", {
|
|
660
660
|
onClick: () => u("insertRowBelow")
|
|
661
|
-
}, /* @__PURE__ */ o.createElement(
|
|
661
|
+
}, /* @__PURE__ */ o.createElement(Q, null), " Insert row below"), /* @__PURE__ */ o.createElement("button", {
|
|
662
662
|
onClick: () => u("insertColLeft")
|
|
663
|
-
}, /* @__PURE__ */ o.createElement(
|
|
663
|
+
}, /* @__PURE__ */ o.createElement(Q, null), " Insert col left"), /* @__PURE__ */ o.createElement("button", {
|
|
664
664
|
onClick: () => u("insertColRight")
|
|
665
|
-
}, /* @__PURE__ */ o.createElement(
|
|
665
|
+
}, /* @__PURE__ */ o.createElement(Q, null), " Insert col right"), /* @__PURE__ */ o.createElement("button", {
|
|
666
666
|
onClick: () => u("deleteRow")
|
|
667
667
|
}, /* @__PURE__ */ o.createElement(ze, null), " Delete row"), /* @__PURE__ */ o.createElement("button", {
|
|
668
668
|
onClick: () => u("deleteCol")
|
|
@@ -673,13 +673,16 @@ const Pt = ({
|
|
|
673
673
|
style: d
|
|
674
674
|
}) => {
|
|
675
675
|
const u = (y) => {
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
676
|
+
const b = y.target;
|
|
677
|
+
if (b.tagName === "A") {
|
|
678
678
|
y.preventDefault();
|
|
679
|
-
const
|
|
680
|
-
|
|
679
|
+
const R = b.href;
|
|
680
|
+
R && window.open(R, "_blank", "noopener,noreferrer");
|
|
681
681
|
}
|
|
682
|
-
}, m = (y) =>
|
|
682
|
+
}, m = (y) => {
|
|
683
|
+
let b = y.replace(/{{\s*(.*?)\s*}}/g, "$1");
|
|
684
|
+
return b = b.replace(/#arrayData/g, ""), b = b.replace(/\/arrayData/g, ""), b;
|
|
685
|
+
};
|
|
683
686
|
return /* @__PURE__ */ o.createElement("div", {
|
|
684
687
|
className: `rte-preview ${c || ""}`,
|
|
685
688
|
style: d,
|
|
@@ -688,20 +691,20 @@ const Pt = ({
|
|
|
688
691
|
__html: m(r)
|
|
689
692
|
}
|
|
690
693
|
});
|
|
691
|
-
},
|
|
694
|
+
}, qt = ({
|
|
692
695
|
visible: r,
|
|
693
696
|
linkData: c,
|
|
694
697
|
onClose: d,
|
|
695
698
|
onInsert: u
|
|
696
699
|
}) => {
|
|
697
|
-
const [m, y] = M(""), [
|
|
698
|
-
if (
|
|
699
|
-
r ? (y(c.url || ""),
|
|
700
|
+
const [m, y] = M(""), [b, R] = M(""), [E, O] = M(""), [_, A] = M("_self");
|
|
701
|
+
if (I(() => {
|
|
702
|
+
r ? (y(c.url || ""), R(c.text || ""), O(c.title || ""), A(c.target || "_self")) : (y(""), R(""), O(""), A("_self"));
|
|
700
703
|
}, [r, c]), !r) return null;
|
|
701
|
-
const
|
|
704
|
+
const j = () => {
|
|
702
705
|
u({
|
|
703
706
|
url: m,
|
|
704
|
-
text:
|
|
707
|
+
text: b,
|
|
705
708
|
title: E,
|
|
706
709
|
target: _
|
|
707
710
|
});
|
|
@@ -718,23 +721,23 @@ const Pt = ({
|
|
|
718
721
|
className: "rte-link-modal__input",
|
|
719
722
|
placeholder: "URL",
|
|
720
723
|
value: m,
|
|
721
|
-
onChange: (
|
|
724
|
+
onChange: (L) => y(L.target.value)
|
|
722
725
|
}), /* @__PURE__ */ o.createElement("input", {
|
|
723
726
|
type: "text",
|
|
724
727
|
className: "rte-link-modal__input",
|
|
725
728
|
placeholder: "Text to Display",
|
|
726
|
-
value:
|
|
727
|
-
onChange: (
|
|
729
|
+
value: b,
|
|
730
|
+
onChange: (L) => R(L.target.value)
|
|
728
731
|
}), /* @__PURE__ */ o.createElement("input", {
|
|
729
732
|
type: "text",
|
|
730
733
|
className: "rte-link-modal__input",
|
|
731
734
|
placeholder: "Title",
|
|
732
735
|
value: E,
|
|
733
|
-
onChange: (
|
|
736
|
+
onChange: (L) => O(L.target.value)
|
|
734
737
|
}), /* @__PURE__ */ o.createElement("select", {
|
|
735
738
|
className: "rte-link-modal__select",
|
|
736
739
|
value: _,
|
|
737
|
-
onChange: (
|
|
740
|
+
onChange: (L) => A(L.target.value)
|
|
738
741
|
}, /* @__PURE__ */ o.createElement("option", {
|
|
739
742
|
value: "_self"
|
|
740
743
|
}, "Same tab"), /* @__PURE__ */ o.createElement("option", {
|
|
@@ -746,13 +749,13 @@ const Pt = ({
|
|
|
746
749
|
onClick: d
|
|
747
750
|
}, "Cancel"), /* @__PURE__ */ o.createElement("button", {
|
|
748
751
|
className: "rte-link-modal__btn rte-link-modal__btn--ok",
|
|
749
|
-
onClick:
|
|
752
|
+
onClick: j
|
|
750
753
|
}, "OK"))));
|
|
751
754
|
};
|
|
752
|
-
function
|
|
755
|
+
function Ae(r) {
|
|
753
756
|
return Array.from(new Map(r.map((c) => [c.value, c])).values());
|
|
754
757
|
}
|
|
755
|
-
const
|
|
758
|
+
const Wt = ({
|
|
756
759
|
atSuggestions: r = [],
|
|
757
760
|
showOutput: c = !1,
|
|
758
761
|
showPreview: d = !1,
|
|
@@ -768,9 +771,9 @@ const $t = ({
|
|
|
768
771
|
},
|
|
769
772
|
classNames: m = {},
|
|
770
773
|
styles: y = {},
|
|
771
|
-
handleGetHtml:
|
|
774
|
+
handleGetHtml: b = () => {
|
|
772
775
|
},
|
|
773
|
-
onChange:
|
|
776
|
+
onChange: R = () => {
|
|
774
777
|
},
|
|
775
778
|
value: E,
|
|
776
779
|
onMentionSelect: O = () => {
|
|
@@ -778,20 +781,20 @@ const $t = ({
|
|
|
778
781
|
handleAddAttributes: _ = () => {
|
|
779
782
|
}
|
|
780
783
|
}) => {
|
|
781
|
-
var pe, ve, Ee, ye, we, Ce, be
|
|
782
|
-
const
|
|
784
|
+
var he, pe, ve, Ee, ye, we, Ce, be;
|
|
785
|
+
const A = P(null), [j, L] = M(E != null && E.length ? E : " "), [K, $] = M(""), [q, B] = M(!1), [F, ee] = M({
|
|
783
786
|
x: 0,
|
|
784
787
|
y: 0
|
|
785
|
-
}), [te,
|
|
788
|
+
}), [te, S] = M([]), k = P(null), V = P(null), [T, f] = M({
|
|
786
789
|
visible: !1,
|
|
787
790
|
x: 0,
|
|
788
791
|
y: 0
|
|
789
|
-
}), [w,
|
|
792
|
+
}), [w, H] = M(!1), X = P(null), [Te, le] = M({
|
|
790
793
|
url: "",
|
|
791
794
|
text: "",
|
|
792
795
|
title: "",
|
|
793
796
|
target: "_self"
|
|
794
|
-
}),
|
|
797
|
+
}), De = {
|
|
795
798
|
bold: !0,
|
|
796
799
|
italic: !0,
|
|
797
800
|
underline: !0,
|
|
@@ -799,22 +802,29 @@ const $t = ({
|
|
|
799
802
|
unorderedList: !0,
|
|
800
803
|
orderedList: !0,
|
|
801
804
|
align: !0,
|
|
802
|
-
link: (
|
|
803
|
-
image: (
|
|
804
|
-
emoji: (
|
|
805
|
-
table: (
|
|
806
|
-
color: (
|
|
807
|
-
fontFamily: (
|
|
808
|
-
fontSize: (
|
|
809
|
-
highlight: (
|
|
810
|
-
}, [
|
|
811
|
-
const e =
|
|
812
|
-
$(e),
|
|
813
|
-
const t =
|
|
814
|
-
|
|
815
|
-
const n =
|
|
805
|
+
link: (he = u.link) != null ? he : !1,
|
|
806
|
+
image: (pe = u.image) != null ? pe : !1,
|
|
807
|
+
emoji: (ve = u.emoji) != null ? ve : !1,
|
|
808
|
+
table: (Ee = u.table) != null ? Ee : !1,
|
|
809
|
+
color: (ye = u.color) != null ? ye : !1,
|
|
810
|
+
fontFamily: (we = u.fontFamily) != null ? we : !1,
|
|
811
|
+
fontSize: (Ce = u.fontSize) != null ? Ce : !1,
|
|
812
|
+
highlight: (be = u.fontSize) != null ? be : !1
|
|
813
|
+
}, [Oe, ce] = M(""), [ie, ne] = M([]), D = () => A.current, x = () => {
|
|
814
|
+
const e = He();
|
|
815
|
+
$(e), b == null || b(e);
|
|
816
|
+
const t = ot(e);
|
|
817
|
+
R(t);
|
|
818
|
+
const n = $e(), a = Ae(n);
|
|
816
819
|
JSON.stringify(a) !== JSON.stringify(ie) && (ne(a), O(a));
|
|
817
|
-
},
|
|
820
|
+
}, He = () => {
|
|
821
|
+
const e = D();
|
|
822
|
+
if (!e) return j;
|
|
823
|
+
const t = e.cloneNode(!0);
|
|
824
|
+
t.querySelectorAll("table div").forEach((a) => a.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight"));
|
|
825
|
+
let n = t.innerHTML;
|
|
826
|
+
return n = je(n), n;
|
|
827
|
+
}, je = (e) => e.replace(/<tbody[^>]*>/g, "<tbody>{{#arrayData}}").replace(/<\/tbody>/g, "{{/arrayData}}</tbody>"), U = () => {
|
|
818
828
|
const e = window.getSelection();
|
|
819
829
|
if (!e || e.rangeCount === 0) return;
|
|
820
830
|
const t = document.getElementById("rte-editor-body");
|
|
@@ -828,33 +838,37 @@ const $t = ({
|
|
|
828
838
|
const n = window.getSelection();
|
|
829
839
|
n && n.rangeCount > 0 && (k.current = n.getRangeAt(0)), W(), document.execCommand(e, !1, t), x();
|
|
830
840
|
};
|
|
831
|
-
|
|
841
|
+
I(() => {
|
|
832
842
|
const e = D();
|
|
833
|
-
|
|
834
|
-
|
|
843
|
+
if (!e || !E) return;
|
|
844
|
+
const t = _e(E);
|
|
845
|
+
e.innerHTML = t, x();
|
|
846
|
+
}, []);
|
|
847
|
+
const _e = (e) => e.replace(/<span[^>]*data-hidden-table-start[^>]*>.*?<\/span>/g, "").replace(/<span[^>]*data-hidden-table-end[^>]*>.*?<\/span>/g, "").replace(/{{#arrayData}}/g, "").replace(/{{\/arrayData}}/g, "");
|
|
848
|
+
I(() => () => {
|
|
835
849
|
document.removeEventListener("mousemove", null), document.removeEventListener("mouseup", null);
|
|
836
|
-
}, []),
|
|
850
|
+
}, []), I(() => {
|
|
837
851
|
_ && _((e) => {
|
|
838
|
-
|
|
852
|
+
Ue(e);
|
|
839
853
|
});
|
|
840
|
-
}, []),
|
|
854
|
+
}, []), I(() => {
|
|
841
855
|
const e = D();
|
|
842
856
|
if (!e) return;
|
|
843
857
|
e.querySelectorAll("table").forEach((n) => {
|
|
844
|
-
ge(n), n.querySelectorAll("th, td").forEach((s) =>
|
|
858
|
+
ge(n), n.querySelectorAll("th, td").forEach((s) => Z(s));
|
|
845
859
|
});
|
|
846
860
|
}, []);
|
|
847
861
|
const de = (e) => {
|
|
848
862
|
for (; e && e.nodeName !== "LI"; )
|
|
849
863
|
e = e.parentNode;
|
|
850
864
|
return e;
|
|
851
|
-
},
|
|
865
|
+
}, Fe = (e) => {
|
|
852
866
|
let t = 0, n = e.parentElement;
|
|
853
867
|
for (; n; )
|
|
854
868
|
(n.tagName === "UL" || n.tagName === "OL") && t++, n = n.parentElement;
|
|
855
869
|
return t;
|
|
856
|
-
},
|
|
857
|
-
const t = e.querySelector("li"), n = t ?
|
|
870
|
+
}, Pe = (e) => {
|
|
871
|
+
const t = e.querySelector("li"), n = t ? Fe(t) : 1;
|
|
858
872
|
if (e.querySelector("[data-hidden-array-start]")) return;
|
|
859
873
|
const a = `{{#arrayData${n > 1 ? n : ""}}}`, s = `{{/arrayData${n > 1 ? n : ""}}}`, l = document.createElement("span");
|
|
860
874
|
l.textContent = a, l.style.display = "none", l.setAttribute("data-hidden-array-start", "true"), e.insertBefore(l, e.firstChild);
|
|
@@ -875,20 +889,20 @@ const $t = ({
|
|
|
875
889
|
if (l = g == null ? void 0 : g.querySelector(`${e}:last-child`), !l) return;
|
|
876
890
|
s = l.querySelector("li:last-child");
|
|
877
891
|
}
|
|
878
|
-
|
|
892
|
+
Pe(l);
|
|
879
893
|
const i = document.createRange();
|
|
880
894
|
i.setStart(s, 0), i.collapse(!0), t.removeAllRanges(), t.addRange(i), (v = D()) == null || v.focus(), x();
|
|
881
|
-
},
|
|
882
|
-
e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : e.startsWith("justify") ?
|
|
883
|
-
},
|
|
895
|
+
}, Y = (e, t) => {
|
|
896
|
+
e === "insertOrderedList" ? ue("ol") : e === "insertUnorderedList" ? ue("ul") : e.startsWith("justify") ? ct(e) : se(e, t), e === "insertTable" && Qe();
|
|
897
|
+
}, Ie = (e) => {
|
|
884
898
|
const t = document.createElement("span");
|
|
885
899
|
t.textContent = "", e.insertNode(t), e.setStartAfter(t), e.collapse(!0);
|
|
886
900
|
const n = t.getBoundingClientRect();
|
|
887
901
|
t.remove(), ee({
|
|
888
902
|
x: n.left,
|
|
889
903
|
y: n.bottom + window.scrollY
|
|
890
|
-
}),
|
|
891
|
-
},
|
|
904
|
+
}), S(r || []), B(!0), V.current = e.cloneRange();
|
|
905
|
+
}, Be = () => {
|
|
892
906
|
const e = window.getSelection();
|
|
893
907
|
if (!e || e.rangeCount === 0) return null;
|
|
894
908
|
const t = e.anchorNode;
|
|
@@ -906,11 +920,11 @@ const $t = ({
|
|
|
906
920
|
a = a.previousSibling;
|
|
907
921
|
}
|
|
908
922
|
return null;
|
|
909
|
-
},
|
|
923
|
+
}, qe = (e) => {
|
|
910
924
|
var l;
|
|
911
925
|
const t = window.getSelection();
|
|
912
926
|
if (!t) return;
|
|
913
|
-
const n =
|
|
927
|
+
const n = Be();
|
|
914
928
|
n ? (t.removeAllRanges(), t.addRange(n)) : V.current && (t.removeAllRanges(), t.addRange(V.current));
|
|
915
929
|
const a = document.createElement("span");
|
|
916
930
|
a.textContent = `{{${e.name}}}`, a.style.display = "inline", a.contentEditable = "false", a.setAttribute("data-mention", e.value || e.name || "");
|
|
@@ -929,9 +943,9 @@ const $t = ({
|
|
|
929
943
|
} catch (i) {
|
|
930
944
|
console.error("insertMention error:", i);
|
|
931
945
|
}
|
|
932
|
-
let s =
|
|
933
|
-
ne(s), O(s),
|
|
934
|
-
},
|
|
946
|
+
let s = Ae([...ie, e]);
|
|
947
|
+
ne(s), O(s), B(!1), (l = D()) == null || l.focus(), x();
|
|
948
|
+
}, Ve = (e) => {
|
|
935
949
|
const t = D();
|
|
936
950
|
if (!t) return;
|
|
937
951
|
let n = null;
|
|
@@ -945,12 +959,12 @@ const $t = ({
|
|
|
945
959
|
s.after(l);
|
|
946
960
|
const i = document.createRange();
|
|
947
961
|
i.setStartAfter(l), i.collapse(!0), a.removeAllRanges(), a.addRange(i), k.current = i.cloneRange(), t.focus();
|
|
948
|
-
},
|
|
949
|
-
e.forEach((t) =>
|
|
962
|
+
}, Ue = (e) => {
|
|
963
|
+
e.forEach((t) => Ve(t)), ne((t) => {
|
|
950
964
|
const n = [...t, ...e], a = Array.from(new Map(n.map((s) => [s.name, s])).values());
|
|
951
965
|
return O(a), a;
|
|
952
966
|
}), x();
|
|
953
|
-
},
|
|
967
|
+
}, $e = () => {
|
|
954
968
|
const e = D();
|
|
955
969
|
if (!e) return [];
|
|
956
970
|
const t = e.querySelectorAll("span[data-mention]"), n = [];
|
|
@@ -961,10 +975,10 @@ const $t = ({
|
|
|
961
975
|
value: s
|
|
962
976
|
});
|
|
963
977
|
}), n;
|
|
964
|
-
},
|
|
978
|
+
}, We = (e) => {
|
|
965
979
|
var n, a, s;
|
|
966
980
|
const t = e.key.toLowerCase();
|
|
967
|
-
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(),
|
|
981
|
+
if ((e.ctrlKey || e.metaKey) && ["b", "i", "u"].includes(t) && (e.preventDefault(), Y(t === "b" ? "bold" : t === "i" ? "italic" : t === "u" ? "underline" : "")), e.shiftKey && e.key === "2" && e.preventDefault(), e.key === "Enter") {
|
|
968
982
|
const l = window.getSelection(), i = l != null && l.anchorNode ? de(l.anchorNode) : null;
|
|
969
983
|
if (!i) return;
|
|
970
984
|
if (((n = i.textContent) == null ? void 0 : n.replace(/\u200B/g, "").trim()) === "") {
|
|
@@ -988,15 +1002,15 @@ const $t = ({
|
|
|
988
1002
|
x();
|
|
989
1003
|
}
|
|
990
1004
|
}
|
|
991
|
-
},
|
|
1005
|
+
}, Ke = (e) => {
|
|
992
1006
|
if (e.data === "@") {
|
|
993
1007
|
const n = window.getSelection();
|
|
994
1008
|
if (!(n != null && n.rangeCount)) return;
|
|
995
1009
|
const a = n.anchorNode;
|
|
996
|
-
if (
|
|
1010
|
+
if (Xe(a))
|
|
997
1011
|
return;
|
|
998
1012
|
setTimeout(() => {
|
|
999
|
-
|
|
1013
|
+
Ie(n.getRangeAt(0)), ce(""), S(r), B(!0);
|
|
1000
1014
|
}, 0);
|
|
1001
1015
|
return;
|
|
1002
1016
|
}
|
|
@@ -1004,7 +1018,7 @@ const $t = ({
|
|
|
1004
1018
|
setTimeout(() => me(), 0);
|
|
1005
1019
|
return;
|
|
1006
1020
|
}
|
|
1007
|
-
},
|
|
1021
|
+
}, Xe = (e) => {
|
|
1008
1022
|
if (!e) return !1;
|
|
1009
1023
|
let t = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
1010
1024
|
for (; t; ) {
|
|
@@ -1018,14 +1032,14 @@ const $t = ({
|
|
|
1018
1032
|
if (!e || !e.anchorNode) return;
|
|
1019
1033
|
const n = (e.anchorNode.textContent || "").match(/@([a-zA-Z0-9_]*)$/);
|
|
1020
1034
|
if (!n) {
|
|
1021
|
-
|
|
1035
|
+
B(!1);
|
|
1022
1036
|
return;
|
|
1023
1037
|
}
|
|
1024
1038
|
const a = n[1].toLowerCase();
|
|
1025
1039
|
ce(a);
|
|
1026
1040
|
const s = r.filter((l) => l.name.toLowerCase().includes(a));
|
|
1027
|
-
|
|
1028
|
-
},
|
|
1041
|
+
S(s);
|
|
1042
|
+
}, Ye = (e) => {
|
|
1029
1043
|
var a;
|
|
1030
1044
|
const t = (a = e.target.files) == null ? void 0 : a[0];
|
|
1031
1045
|
if (!t) return;
|
|
@@ -1041,10 +1055,10 @@ const $t = ({
|
|
|
1041
1055
|
const p = D();
|
|
1042
1056
|
if (!v || !p) {
|
|
1043
1057
|
p == null || p.appendChild(g);
|
|
1044
|
-
const
|
|
1045
|
-
p == null || p.appendChild(
|
|
1058
|
+
const Re = document.createTextNode(" ");
|
|
1059
|
+
p == null || p.appendChild(Re);
|
|
1046
1060
|
const re = document.createRange();
|
|
1047
|
-
re.setStartAfter(
|
|
1061
|
+
re.setStartAfter(Re), re.collapse(!0), i == null || i.removeAllRanges(), i == null || i.addRange(re), p == null || p.focus(), x(), e.target.value = "";
|
|
1048
1062
|
return;
|
|
1049
1063
|
}
|
|
1050
1064
|
v.deleteContents(), v.insertNode(g);
|
|
@@ -1053,14 +1067,14 @@ const $t = ({
|
|
|
1053
1067
|
const C = document.createRange();
|
|
1054
1068
|
C.setStartAfter(h), C.collapse(!0), i.removeAllRanges(), i.addRange(C), p.focus(), x(), e.target.value = "";
|
|
1055
1069
|
}, n.readAsDataURL(t);
|
|
1056
|
-
},
|
|
1070
|
+
}, Ze = (e) => {
|
|
1057
1071
|
var s;
|
|
1058
1072
|
W();
|
|
1059
1073
|
const t = window.getSelection();
|
|
1060
1074
|
if (!(t != null && t.rangeCount)) return;
|
|
1061
1075
|
const n = t.getRangeAt(0), a = document.createTextNode(e);
|
|
1062
1076
|
n.insertNode(a), n.setStartAfter(a), n.collapse(!0), t.removeAllRanges(), t.addRange(n), (s = D()) == null || s.focus(), x();
|
|
1063
|
-
},
|
|
1077
|
+
}, Qe = () => {
|
|
1064
1078
|
W();
|
|
1065
1079
|
const e = document.createElement("table");
|
|
1066
1080
|
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);
|
|
@@ -1076,9 +1090,9 @@ const $t = ({
|
|
|
1076
1090
|
const g = document.createElement("th");
|
|
1077
1091
|
g.textContent = `Header ${v + 1}`, g.style.border = "1px solid #999", g.style.padding = "8px", g.style.position = "relative", g.style.backgroundColor = "lightgray", m.th && g.classList.add(m.th);
|
|
1078
1092
|
const p = document.createElement("td");
|
|
1079
|
-
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),
|
|
1093
|
+
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), Z(g), Z(p), a.appendChild(g), s.appendChild(p);
|
|
1080
1094
|
}
|
|
1081
|
-
t.appendChild(a), n.appendChild(s), e.appendChild(t), e.appendChild(n),
|
|
1095
|
+
t.appendChild(a), n.appendChild(s), e.appendChild(t), e.appendChild(n), ge(e);
|
|
1082
1096
|
const l = window.getSelection();
|
|
1083
1097
|
if (!(l != null && l.rangeCount)) return;
|
|
1084
1098
|
l.getRangeAt(0).insertNode(e), x();
|
|
@@ -1108,7 +1122,7 @@ const $t = ({
|
|
|
1108
1122
|
};
|
|
1109
1123
|
document.addEventListener("mousemove", g), document.addEventListener("mouseup", p);
|
|
1110
1124
|
}), e.appendChild(t);
|
|
1111
|
-
},
|
|
1125
|
+
}, Z = (e) => {
|
|
1112
1126
|
const t = document.createElement("div"), n = document.createElement("div");
|
|
1113
1127
|
Object.assign(t.style, {
|
|
1114
1128
|
position: "absolute",
|
|
@@ -1128,8 +1142,8 @@ const $t = ({
|
|
|
1128
1142
|
cursor: "row-resize",
|
|
1129
1143
|
background: "rgba(0,0,0,0.15)",
|
|
1130
1144
|
zIndex: "10"
|
|
1131
|
-
}),
|
|
1132
|
-
},
|
|
1145
|
+
}), Je(e, t, n), e.appendChild(t), e.appendChild(n);
|
|
1146
|
+
}, Je = (e, t, n) => {
|
|
1133
1147
|
let a = 0, s = 0, l = 0, i = 0;
|
|
1134
1148
|
t.addEventListener("mousedown", (h) => {
|
|
1135
1149
|
h.preventDefault(), a = h.clientX, l = e.offsetWidth, document.addEventListener("mousemove", v), document.addEventListener("mouseup", p);
|
|
@@ -1145,7 +1159,7 @@ const $t = ({
|
|
|
1145
1159
|
}, p = () => {
|
|
1146
1160
|
document.removeEventListener("mousemove", v), document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", p), x();
|
|
1147
1161
|
};
|
|
1148
|
-
},
|
|
1162
|
+
}, Ge = (e) => {
|
|
1149
1163
|
const n = e.target.closest("td, th");
|
|
1150
1164
|
n && (e.preventDefault(), document.querySelectorAll(".rte-cell-highlight").forEach((a) => a.classList.remove("rte-cell-highlight")), n.classList.add("rte-cell-highlight"), f({
|
|
1151
1165
|
visible: !0,
|
|
@@ -1155,11 +1169,11 @@ const $t = ({
|
|
|
1155
1169
|
}));
|
|
1156
1170
|
}, fe = () => {
|
|
1157
1171
|
document.querySelectorAll(".rte-cell-highlight").forEach((e) => e.classList.remove("rte-cell-highlight"));
|
|
1158
|
-
},
|
|
1172
|
+
}, et = (e) => {
|
|
1159
1173
|
if (!T.cell) return;
|
|
1160
1174
|
const t = T.cell.closest("table"), n = T.cell.cellIndex, a = T.cell.parentElement.rowIndex, s = (l) => {
|
|
1161
1175
|
const i = l.tagName.toLowerCase(), v = document.createElement(i);
|
|
1162
|
-
return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText,
|
|
1176
|
+
return v.textContent = l.textContent || "", v.style.cssText = l.style.cssText, Z(v), v;
|
|
1163
1177
|
};
|
|
1164
1178
|
switch (e) {
|
|
1165
1179
|
case "insertRowAbove": {
|
|
@@ -1202,29 +1216,17 @@ const $t = ({
|
|
|
1202
1216
|
x(), f(oe(ae({}, T), {
|
|
1203
1217
|
visible: !1
|
|
1204
1218
|
})), fe();
|
|
1205
|
-
},
|
|
1206
|
-
|
|
1207
|
-
if (!t || t.querySelector("[data-hidden-table-start]")) return;
|
|
1208
|
-
const n = document.createElement("span");
|
|
1209
|
-
n.textContent = "{{#arrayData}}", n.style.display = "none", n.setAttribute("data-hidden-table-start", "true"), t.insertBefore(n, t.firstChild);
|
|
1210
|
-
const a = document.createElement("span");
|
|
1211
|
-
a.textContent = "{{/arrayData}}", a.style.display = "none", a.setAttribute("data-hidden-table-end", "true"), t.appendChild(a);
|
|
1212
|
-
}, he = () => {
|
|
1213
|
-
const e = D();
|
|
1214
|
-
if (!e) return H;
|
|
1215
|
-
const t = e.cloneNode(!0);
|
|
1216
|
-
return t.querySelectorAll("table div").forEach((n) => n.remove()), t.querySelectorAll(".rte-cell-highlight").forEach((n) => n.classList.remove("rte-cell-highlight")), t.innerHTML;
|
|
1217
|
-
}, et = () => {
|
|
1218
|
-
U(), K.current = k.current, le({
|
|
1219
|
+
}, tt = () => {
|
|
1220
|
+
U(), X.current = k.current, le({
|
|
1219
1221
|
url: "",
|
|
1220
1222
|
text: "",
|
|
1221
1223
|
title: "",
|
|
1222
1224
|
target: "_self"
|
|
1223
|
-
}),
|
|
1224
|
-
},
|
|
1225
|
+
}), H(!0);
|
|
1226
|
+
}, nt = (e) => {
|
|
1225
1227
|
const t = window.getSelection();
|
|
1226
|
-
if (!t || !
|
|
1227
|
-
t.removeAllRanges(), t.addRange(
|
|
1228
|
+
if (!t || !X.current) return;
|
|
1229
|
+
t.removeAllRanges(), t.addRange(X.current);
|
|
1228
1230
|
let n = e.url.trim();
|
|
1229
1231
|
/^https?:\/\//i.test(n) || (n = "https://" + n);
|
|
1230
1232
|
const a = document.createElement("a");
|
|
@@ -1234,8 +1236,8 @@ const $t = ({
|
|
|
1234
1236
|
const l = document.createTextNode(" ");
|
|
1235
1237
|
a.after(l);
|
|
1236
1238
|
const i = document.createRange();
|
|
1237
|
-
i.setStartAfter(l), i.collapse(!0), t.removeAllRanges(), t.addRange(i),
|
|
1238
|
-
},
|
|
1239
|
+
i.setStartAfter(l), i.collapse(!0), t.removeAllRanges(), t.addRange(i), H(!1), x();
|
|
1240
|
+
}, rt = (e) => {
|
|
1239
1241
|
const t = e.target;
|
|
1240
1242
|
if (t.tagName === "A") {
|
|
1241
1243
|
const n = t;
|
|
@@ -1245,14 +1247,14 @@ const $t = ({
|
|
|
1245
1247
|
}
|
|
1246
1248
|
e.preventDefault();
|
|
1247
1249
|
const a = document.createRange();
|
|
1248
|
-
a.selectNode(n),
|
|
1250
|
+
a.selectNode(n), X.current = a, le({
|
|
1249
1251
|
url: n.href,
|
|
1250
1252
|
text: n.textContent || n.href,
|
|
1251
1253
|
title: n.title,
|
|
1252
1254
|
target: n.target
|
|
1253
|
-
}),
|
|
1255
|
+
}), H(!0);
|
|
1254
1256
|
}
|
|
1255
|
-
},
|
|
1257
|
+
}, at = () => {
|
|
1256
1258
|
const e = D();
|
|
1257
1259
|
if (!e) return;
|
|
1258
1260
|
const t = window.getSelection();
|
|
@@ -1284,7 +1286,7 @@ const $t = ({
|
|
|
1284
1286
|
a.insertNode(g);
|
|
1285
1287
|
const p = document.createRange();
|
|
1286
1288
|
p.setStartAfter(a.endContainer.nodeType === Node.TEXT_NODE ? a.endContainer : a.startContainer), p.collapse(!0), n.removeAllRanges(), n.addRange(p), e.normalize(), x();
|
|
1287
|
-
},
|
|
1289
|
+
}, ot = (e) => {
|
|
1288
1290
|
var a;
|
|
1289
1291
|
let t = e;
|
|
1290
1292
|
t = t.replace(/{{#arrayData\d*}}/g, ""), t = t.replace(/{{\/arrayData\d*}}/g, "");
|
|
@@ -1302,7 +1304,7 @@ const $t = ({
|
|
|
1302
1304
|
|
|
1303
1305
|
`).trim()) || "";
|
|
1304
1306
|
};
|
|
1305
|
-
function
|
|
1307
|
+
function lt() {
|
|
1306
1308
|
const e = window.getSelection();
|
|
1307
1309
|
if (!e || e.rangeCount === 0) return [];
|
|
1308
1310
|
const t = e.getRangeAt(0), n = t.commonAncestorContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
|
|
@@ -1311,8 +1313,8 @@ const $t = ({
|
|
|
1311
1313
|
return i.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, i) < 0 && t.compareBoundaryPoints(Range.START_TO_END, i) > 0;
|
|
1312
1314
|
});
|
|
1313
1315
|
}
|
|
1314
|
-
function
|
|
1315
|
-
const t =
|
|
1316
|
+
function ct(e) {
|
|
1317
|
+
const t = lt();
|
|
1316
1318
|
if (t.length === 0) {
|
|
1317
1319
|
se(e);
|
|
1318
1320
|
return;
|
|
@@ -1329,20 +1331,20 @@ const $t = ({
|
|
|
1329
1331
|
style: {
|
|
1330
1332
|
flex: 1
|
|
1331
1333
|
}
|
|
1332
|
-
}, /* @__PURE__ */ o.createElement(
|
|
1333
|
-
exec:
|
|
1334
|
+
}, /* @__PURE__ */ o.createElement(Ft, {
|
|
1335
|
+
exec: Y,
|
|
1334
1336
|
saveSelection: U,
|
|
1335
|
-
handleFileChange:
|
|
1336
|
-
handleFontSizeChange: (e) =>
|
|
1337
|
-
handleFontFamilyChange: (e) =>
|
|
1338
|
-
insertEmoji:
|
|
1339
|
-
handleLink:
|
|
1340
|
-
removeFormatting:
|
|
1341
|
-
visibleActions:
|
|
1337
|
+
handleFileChange: Ye,
|
|
1338
|
+
handleFontSizeChange: (e) => Y("fontSize", e.target.value),
|
|
1339
|
+
handleFontFamilyChange: (e) => Y("fontName", e.target.value),
|
|
1340
|
+
insertEmoji: Ze,
|
|
1341
|
+
handleLink: tt,
|
|
1342
|
+
removeFormatting: at,
|
|
1343
|
+
visibleActions: De,
|
|
1342
1344
|
className: m.toolbar,
|
|
1343
1345
|
style: y.toolbar
|
|
1344
1346
|
}), /* @__PURE__ */ o.createElement("div", {
|
|
1345
|
-
ref:
|
|
1347
|
+
ref: A,
|
|
1346
1348
|
id: "rte-editor-body",
|
|
1347
1349
|
className: `rte-editor ${(m == null ? void 0 : m.editor) || ""}`,
|
|
1348
1350
|
style: y.editor,
|
|
@@ -1353,45 +1355,45 @@ const $t = ({
|
|
|
1353
1355
|
onInput: () => {
|
|
1354
1356
|
me(), U();
|
|
1355
1357
|
},
|
|
1356
|
-
onKeyDown:
|
|
1357
|
-
onBeforeInput:
|
|
1358
|
-
onContextMenu:
|
|
1358
|
+
onKeyDown: We,
|
|
1359
|
+
onBeforeInput: Ke,
|
|
1360
|
+
onContextMenu: Ge,
|
|
1359
1361
|
onClick: (e) => {
|
|
1360
|
-
|
|
1362
|
+
rt(e), U();
|
|
1361
1363
|
}
|
|
1362
|
-
}), /* @__PURE__ */ o.createElement(
|
|
1364
|
+
}), /* @__PURE__ */ o.createElement(Pt, {
|
|
1363
1365
|
show: q,
|
|
1364
1366
|
position: F,
|
|
1365
1367
|
filtered: te,
|
|
1366
|
-
insertMention:
|
|
1367
|
-
onClose: () =>
|
|
1368
|
-
query:
|
|
1368
|
+
insertMention: qe,
|
|
1369
|
+
onClose: () => B(!1),
|
|
1370
|
+
query: Oe
|
|
1369
1371
|
}), c && /* @__PURE__ */ o.createElement("div", {
|
|
1370
1372
|
className: `rte-output ${(m == null ? void 0 : m.output) || ""}`,
|
|
1371
1373
|
style: y.output
|
|
1372
|
-
}, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null,
|
|
1374
|
+
}, /* @__PURE__ */ o.createElement("h4", null, "Output HTML:"), /* @__PURE__ */ o.createElement("p", null, K)), /* @__PURE__ */ o.createElement(It, {
|
|
1373
1375
|
visible: T.visible,
|
|
1374
1376
|
x: T.x,
|
|
1375
1377
|
y: T.y,
|
|
1376
|
-
onAction:
|
|
1378
|
+
onAction: et,
|
|
1377
1379
|
onClose: () => {
|
|
1378
1380
|
f(oe(ae({}, T), {
|
|
1379
1381
|
visible: !1
|
|
1380
1382
|
})), fe();
|
|
1381
1383
|
}
|
|
1382
|
-
}), /* @__PURE__ */ o.createElement(
|
|
1384
|
+
}), /* @__PURE__ */ o.createElement(qt, {
|
|
1383
1385
|
visible: w,
|
|
1384
|
-
linkData:
|
|
1385
|
-
onClose: () =>
|
|
1386
|
-
onInsert:
|
|
1386
|
+
linkData: Te,
|
|
1387
|
+
onClose: () => H(!1),
|
|
1388
|
+
onInsert: nt
|
|
1387
1389
|
})), d ? /* @__PURE__ */ o.createElement(Bt, {
|
|
1388
1390
|
className: m.preview,
|
|
1389
1391
|
style: y.preview,
|
|
1390
|
-
html:
|
|
1392
|
+
html: K
|
|
1391
1393
|
}) : null);
|
|
1392
1394
|
};
|
|
1393
1395
|
export {
|
|
1394
|
-
|
|
1396
|
+
Wt as RichTextEditor,
|
|
1395
1397
|
Bt as RtePreview,
|
|
1396
|
-
|
|
1398
|
+
Ft as RteToolbar
|
|
1397
1399
|
};
|