@uva-glass/component-library 1.52.1 → 1.53.0
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/{Lexical.prod-zUeT_jIr.js → Lexical.prod-DNRTKPfN.js} +72 -66
- package/dist/Lexical.prod-DNRTKPfN.js.map +1 -0
- package/dist/{LexicalUtils.prod-DtRifALg.js → LexicalUtils.prod-D_BPEjfg.js} +2 -2
- package/dist/{LexicalUtils.prod-DtRifALg.js.map → LexicalUtils.prod-D_BPEjfg.js.map} +1 -1
- package/dist/{ListPlugin-CxyYg2bv.js → ListPlugin-CgNBzfIl.js} +4 -4
- package/dist/{ListPlugin-CxyYg2bv.js.map → ListPlugin-CgNBzfIl.js.map} +1 -1
- package/dist/RteEditor.module-BjGyWKhW.js +26 -0
- package/dist/RteEditor.module-BjGyWKhW.js.map +1 -0
- package/dist/assets/RteEditor.css +1 -1
- package/dist/components/Icon/icons/index.d.ts +9 -0
- package/dist/components/Icon/icons/index.js +52 -37
- package/dist/components/Icon/icons/index.js.map +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +62 -0
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -0
- package/dist/components/RteEditor/Plugins/HistoryPlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js +5 -0
- package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +22 -20
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.d.ts +2 -0
- package/dist/components/RteEditor/Plugins/index.js +10 -6
- package/dist/components/RteEditor/Plugins/index.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.js +567 -462
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +1 -1
- package/dist/{helpers-DpGAANJ8.js → helpers-TSjo3aAv.js} +3 -3
- package/dist/{helpers-DpGAANJ8.js.map → helpers-TSjo3aAv.js.map} +1 -1
- package/package.json +2 -2
- package/dist/Lexical.prod-zUeT_jIr.js.map +0 -1
- package/dist/RteEditor.module--4R0Ql6Y.js +0 -26
- package/dist/RteEditor.module--4R0Ql6Y.js.map +0 -1
|
@@ -1,163 +1,178 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { W as
|
|
3
|
-
import * as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { i as
|
|
6
|
-
import { r as
|
|
7
|
-
import { J as
|
|
8
|
-
import { a as
|
|
9
|
-
import { s as
|
|
10
|
-
import { ToolBarPlugin as
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsx as E, jsxs as Q, Fragment as Ie } from "react/jsx-runtime";
|
|
2
|
+
import { W as st, w as O, P as de, I as g, e as at, i as lt, u as T, j as I, y as _, F as ct, l as N, T as ut, X as ie, k as fe, m as h, n as Ke, q as ze, r as Ue, v as dt, S as ge, b as ft, E as se, C as he, s as ve, z as Be, A as mt, B as pt, M as je, D as gt, G as ht, H as vt, N as Je, O as yt, Q as y, R as wt, c as F, U as Ct, V as Et, Z as bt, a0 as ee, a1 as xt, a2 as $t, a3 as St, a4 as _t, a5 as Nt, a6 as Dt, a7 as kt, a8 as ye, a as we, a9 as Lt, aa as ne, ab as Tt, ac as Ce, ad as Pt, ae as Rt, af as Ot, ag as Mt, ah as Ft, ai as At, aj as It, ak as Kt, d as zt, al as Ut, am as Bt, an as jt, ao as Jt, ap as Wt, t as Vt, L as Ee, aq as qt, x as Ht, K as q, $ as H, ar as Xt, as as Yt, g as Zt, h as Gt } from "../../Lexical.prod-DNRTKPfN.js";
|
|
3
|
+
import * as re from "react";
|
|
4
|
+
import { useMemo as W, useLayoutEffect as z, useEffect as k, useRef as Qt, useState as K, Suspense as en, forwardRef as We, useCallback as tn } from "react";
|
|
5
|
+
import { i as R, L as U, e as nn, t as me } from "../../LexicalUtils.prod-D_BPEjfg.js";
|
|
6
|
+
import { r as be } from "../../index-DsprzSCj.js";
|
|
7
|
+
import { J as Ve, D as qe, Z as rn } from "../../ListPlugin-CgNBzfIl.js";
|
|
8
|
+
import { a as He, U as xe, m as oe, g as on, b as sn, F as an, M as ln, f as cn } from "../../helpers-TSjo3aAv.js";
|
|
9
|
+
import { s as J } from "../../RteEditor.module-BjGyWKhW.js";
|
|
10
|
+
import { ToolBarPlugin as un } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
|
|
11
|
+
import "../Buttons/Button.js";
|
|
12
|
+
import "../Buttons/LinkButton.js";
|
|
13
|
+
import "@react-aria/button";
|
|
14
|
+
import "@react-aria/dialog";
|
|
15
|
+
import "@react-aria/focus";
|
|
16
|
+
import "@react-aria/overlays";
|
|
17
|
+
import "../OverlayCloseButton/OverlayCloseButton.js";
|
|
18
|
+
import "../GridRow/GridRow.js";
|
|
19
|
+
import "../IconButton/IconButton.js";
|
|
20
|
+
import "../Input/Input.js";
|
|
21
|
+
import "../InputField/InputField.js";
|
|
22
|
+
import "react-router-dom";
|
|
23
|
+
import "../../MultiSelect-D1FnMER4.js";
|
|
24
|
+
import "../SelectListbox/SelectListbox.js";
|
|
25
|
+
import "../SelectListbox/SelectProvider.js";
|
|
26
|
+
import { UvaTheme as dn } from "./UvaTheme/UvaTheme.js";
|
|
27
|
+
const Xe = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, fn = Xe ? z : k, X = { tag: "history-merge" };
|
|
28
|
+
function mn({ initialConfig: t, children: e }) {
|
|
29
|
+
const n = W(() => {
|
|
30
|
+
const { theme: r, namespace: s, nodes: i, onError: o, editorState: a, html: l } = t, c = lt(null, r), u = st({ editable: t.editable, html: l, namespace: s, nodes: i, onError: (d) => o(d, u), theme: r });
|
|
16
31
|
return function(d, f) {
|
|
17
32
|
if (f !== null) {
|
|
18
33
|
if (f === void 0) d.update(() => {
|
|
19
|
-
const p =
|
|
34
|
+
const p = O();
|
|
20
35
|
if (p.isEmpty()) {
|
|
21
|
-
const m =
|
|
36
|
+
const m = de();
|
|
22
37
|
p.append(m);
|
|
23
|
-
const
|
|
24
|
-
(g() !== null ||
|
|
38
|
+
const v = Xe ? document.activeElement : null;
|
|
39
|
+
(g() !== null || v !== null && v === d.getRootElement()) && m.select();
|
|
25
40
|
}
|
|
26
|
-
},
|
|
41
|
+
}, X);
|
|
27
42
|
else if (f !== null) switch (typeof f) {
|
|
28
43
|
case "string": {
|
|
29
44
|
const p = d.parseEditorState(f);
|
|
30
|
-
d.setEditorState(p,
|
|
45
|
+
d.setEditorState(p, X);
|
|
31
46
|
break;
|
|
32
47
|
}
|
|
33
48
|
case "object":
|
|
34
|
-
d.setEditorState(f,
|
|
49
|
+
d.setEditorState(f, X);
|
|
35
50
|
break;
|
|
36
51
|
case "function":
|
|
37
52
|
d.update(() => {
|
|
38
|
-
|
|
39
|
-
},
|
|
53
|
+
O().isEmpty() && f(d);
|
|
54
|
+
}, X);
|
|
40
55
|
}
|
|
41
56
|
}
|
|
42
57
|
}(u, a), [u, c];
|
|
43
58
|
}, []);
|
|
44
|
-
return
|
|
45
|
-
const r = t.editable, [
|
|
46
|
-
|
|
47
|
-
}, []),
|
|
59
|
+
return fn(() => {
|
|
60
|
+
const r = t.editable, [s] = n;
|
|
61
|
+
s.setEditable(r === void 0 || r);
|
|
62
|
+
}, []), E(at.Provider, { value: n, children: e });
|
|
48
63
|
}
|
|
49
|
-
const
|
|
50
|
-
function
|
|
64
|
+
const pn = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
|
|
65
|
+
function gn(t) {
|
|
51
66
|
return { initialValueFn: () => t.isEditable(), subscribe: (e) => t.registerEditableListener(e) };
|
|
52
67
|
}
|
|
53
|
-
function
|
|
68
|
+
function hn() {
|
|
54
69
|
return function(t) {
|
|
55
|
-
const [e] =
|
|
56
|
-
return
|
|
70
|
+
const [e] = T(), n = W(() => t(e), [e, t]), r = Qt(n.initialValueFn()), [s, i] = K(r.current);
|
|
71
|
+
return pn(() => {
|
|
57
72
|
const { initialValueFn: o, subscribe: a } = n, l = o();
|
|
58
|
-
return r.current !== l && (r.current = l,
|
|
59
|
-
r.current = c,
|
|
73
|
+
return r.current !== l && (r.current = l, i(l)), a((c) => {
|
|
74
|
+
r.current = c, i(c);
|
|
60
75
|
});
|
|
61
|
-
}, [n, t]),
|
|
62
|
-
}(
|
|
76
|
+
}, [n, t]), s;
|
|
77
|
+
}(gn);
|
|
63
78
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
79
|
+
function vn() {
|
|
80
|
+
return O().getTextContent();
|
|
66
81
|
}
|
|
67
|
-
function
|
|
82
|
+
function yn(t, e = !0) {
|
|
68
83
|
if (t) return !1;
|
|
69
|
-
let n =
|
|
84
|
+
let n = vn();
|
|
70
85
|
return e && (n = n.trim()), n === "";
|
|
71
86
|
}
|
|
72
|
-
function
|
|
73
|
-
if (!
|
|
74
|
-
const e =
|
|
87
|
+
function wn(t) {
|
|
88
|
+
if (!yn(t, !1)) return !1;
|
|
89
|
+
const e = O().getChildren(), n = e.length;
|
|
75
90
|
if (n > 1) return !1;
|
|
76
91
|
for (let r = 0; r < n; r++) {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
if (
|
|
80
|
-
if (!
|
|
81
|
-
const
|
|
92
|
+
const s = e[r];
|
|
93
|
+
if (I(s)) return !1;
|
|
94
|
+
if (_(s)) {
|
|
95
|
+
if (!ct(s) || s.__indent !== 0) return !1;
|
|
96
|
+
const i = s.getChildren(), o = i.length;
|
|
82
97
|
for (let a = 0; a < o; a++) {
|
|
83
|
-
const l =
|
|
84
|
-
if (!
|
|
98
|
+
const l = i[r];
|
|
99
|
+
if (!N(l)) return !1;
|
|
85
100
|
}
|
|
86
101
|
}
|
|
87
102
|
}
|
|
88
103
|
return !0;
|
|
89
104
|
}
|
|
90
|
-
function
|
|
91
|
-
return () =>
|
|
105
|
+
function Ye(t) {
|
|
106
|
+
return () => wn(t);
|
|
92
107
|
}
|
|
93
|
-
function
|
|
108
|
+
function Cn(t) {
|
|
94
109
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
95
110
|
}
|
|
96
|
-
|
|
111
|
+
Cn(function(t) {
|
|
97
112
|
const e = new URLSearchParams();
|
|
98
113
|
e.append("code", t);
|
|
99
114
|
for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
|
|
100
115
|
throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
101
116
|
});
|
|
102
|
-
function
|
|
117
|
+
function En(t) {
|
|
103
118
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
104
119
|
}
|
|
105
|
-
|
|
120
|
+
En(function(t) {
|
|
106
121
|
const e = new URLSearchParams();
|
|
107
122
|
e.append("code", t);
|
|
108
123
|
for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
|
|
109
124
|
throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
110
125
|
});
|
|
111
|
-
const
|
|
112
|
-
function
|
|
126
|
+
const bn = /* @__PURE__ */ new Map();
|
|
127
|
+
function xn(t) {
|
|
113
128
|
const e = {}, n = t.split(";");
|
|
114
129
|
for (const r of n) if (r !== "") {
|
|
115
|
-
const [
|
|
116
|
-
|
|
130
|
+
const [s, i] = r.split(/:([^]+)/);
|
|
131
|
+
s && i && (e[s.trim()] = i.trim());
|
|
117
132
|
}
|
|
118
133
|
return e;
|
|
119
134
|
}
|
|
120
|
-
function
|
|
135
|
+
function Ze(t, e) {
|
|
121
136
|
const n = t.getStartEndPoints();
|
|
122
137
|
if (e.isSelected(t) && !e.isSegmented() && !e.isToken() && n !== null) {
|
|
123
|
-
const [r,
|
|
138
|
+
const [r, s] = n, i = t.isBackward(), o = r.getNode(), a = s.getNode(), l = e.is(o), c = e.is(a);
|
|
124
139
|
if (l || c) {
|
|
125
|
-
const [u, d] =
|
|
126
|
-
let
|
|
127
|
-
return f ? (
|
|
140
|
+
const [u, d] = ut(t), f = o.is(a), p = e.is(i ? a : o), m = e.is(i ? o : a);
|
|
141
|
+
let v, b = 0;
|
|
142
|
+
return f ? (b = u > d ? d : u, v = u > d ? u : d) : p ? (b = i ? d : u, v = void 0) : m && (b = 0, v = i ? u : d), e.__text = e.__text.slice(b, v), e;
|
|
128
143
|
}
|
|
129
144
|
}
|
|
130
145
|
return e;
|
|
131
146
|
}
|
|
132
|
-
function
|
|
133
|
-
const e = t.getStyle(), n =
|
|
134
|
-
|
|
147
|
+
function $n(t) {
|
|
148
|
+
const e = t.getStyle(), n = xn(e);
|
|
149
|
+
bn.set(e, n);
|
|
135
150
|
}
|
|
136
|
-
function
|
|
137
|
-
const n =
|
|
138
|
-
return
|
|
151
|
+
function $e(t, e) {
|
|
152
|
+
const n = ie(t.focus, e);
|
|
153
|
+
return I(n) && !n.isIsolated() || _(n) && !n.isInline() && !n.canBeEmpty();
|
|
139
154
|
}
|
|
140
|
-
function
|
|
155
|
+
function Sn(t, e, n, r) {
|
|
141
156
|
t.modify(e ? "extend" : "move", n, r);
|
|
142
157
|
}
|
|
143
|
-
function
|
|
158
|
+
function _n(t) {
|
|
144
159
|
const e = t.anchor.getNode();
|
|
145
|
-
return (
|
|
160
|
+
return (fe(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
|
|
146
161
|
}
|
|
147
|
-
function
|
|
148
|
-
const r =
|
|
149
|
-
|
|
162
|
+
function Se(t, e, n) {
|
|
163
|
+
const r = _n(t);
|
|
164
|
+
Sn(t, e, n ? !r : r, "character");
|
|
150
165
|
}
|
|
151
|
-
function
|
|
166
|
+
function Nn(t) {
|
|
152
167
|
const e = window.location.origin, n = (r) => {
|
|
153
168
|
if (r.origin !== e) return;
|
|
154
|
-
const
|
|
155
|
-
if (document.activeElement !==
|
|
156
|
-
const
|
|
157
|
-
if (typeof
|
|
169
|
+
const s = t.getRootElement();
|
|
170
|
+
if (document.activeElement !== s) return;
|
|
171
|
+
const i = r.data;
|
|
172
|
+
if (typeof i == "string") {
|
|
158
173
|
let o;
|
|
159
174
|
try {
|
|
160
|
-
o = JSON.parse(
|
|
175
|
+
o = JSON.parse(i);
|
|
161
176
|
} catch {
|
|
162
177
|
return;
|
|
163
178
|
}
|
|
@@ -168,14 +183,14 @@ function gn(t) {
|
|
|
168
183
|
if (l) {
|
|
169
184
|
const [c, u, d, f, p, m] = l;
|
|
170
185
|
t.update(() => {
|
|
171
|
-
const
|
|
172
|
-
if (h(
|
|
173
|
-
const
|
|
174
|
-
let
|
|
175
|
-
if (
|
|
176
|
-
C = f,
|
|
177
|
-
const
|
|
178
|
-
C = C >
|
|
186
|
+
const v = g();
|
|
187
|
+
if (h(v)) {
|
|
188
|
+
const b = v.anchor;
|
|
189
|
+
let w = b.getNode(), C = 0, x = 0;
|
|
190
|
+
if (N(w) && c >= 0 && u >= 0 && (C = c, x = c + u, v.setTextNodeRange(w, C, w, x)), C === x && d === "" || (v.insertRawText(d), w = b.getNode()), N(w)) {
|
|
191
|
+
C = f, x = f + p;
|
|
192
|
+
const $ = w.getTextContentSize();
|
|
193
|
+
C = C > $ ? $ : C, x = x > $ ? $ : x, v.setTextNodeRange(w, C, w, x);
|
|
179
194
|
}
|
|
180
195
|
r.stopImmediatePropagation();
|
|
181
196
|
}
|
|
@@ -189,70 +204,70 @@ function gn(t) {
|
|
|
189
204
|
window.removeEventListener("message", n, !0);
|
|
190
205
|
};
|
|
191
206
|
}
|
|
192
|
-
function
|
|
207
|
+
function Ge(t, e) {
|
|
193
208
|
const n = e.body ? e.body.childNodes : [];
|
|
194
209
|
let r = [];
|
|
195
|
-
const
|
|
196
|
-
for (let
|
|
197
|
-
const o = n[
|
|
198
|
-
if (!
|
|
199
|
-
const a =
|
|
210
|
+
const s = [];
|
|
211
|
+
for (let i = 0; i < n.length; i++) {
|
|
212
|
+
const o = n[i];
|
|
213
|
+
if (!tt.has(o.nodeName)) {
|
|
214
|
+
const a = nt(o, t, s, !1);
|
|
200
215
|
a !== null && (r = r.concat(a));
|
|
201
216
|
}
|
|
202
217
|
}
|
|
203
|
-
return function(
|
|
204
|
-
for (const o of
|
|
205
|
-
for (const o of
|
|
218
|
+
return function(i) {
|
|
219
|
+
for (const o of i) o.getNextSibling() instanceof Ke && o.insertAfter(ze());
|
|
220
|
+
for (const o of i) {
|
|
206
221
|
const a = o.getChildren();
|
|
207
222
|
for (const l of a) o.insertBefore(l);
|
|
208
223
|
o.remove();
|
|
209
224
|
}
|
|
210
|
-
}(
|
|
225
|
+
}(s), r;
|
|
211
226
|
}
|
|
212
|
-
function
|
|
227
|
+
function Qe(t, e) {
|
|
213
228
|
if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
|
|
214
|
-
const n = document.createElement("div"), r =
|
|
215
|
-
for (let
|
|
216
|
-
|
|
229
|
+
const n = document.createElement("div"), r = O().getChildren();
|
|
230
|
+
for (let s = 0; s < r.length; s++)
|
|
231
|
+
et(t, r[s], n, e);
|
|
217
232
|
return n.innerHTML;
|
|
218
233
|
}
|
|
219
|
-
function
|
|
220
|
-
let
|
|
221
|
-
const
|
|
234
|
+
function et(t, e, n, r = null) {
|
|
235
|
+
let s = r === null || e.isSelected(r);
|
|
236
|
+
const i = _(e) && e.excludeFromCopy("html");
|
|
222
237
|
let o = e;
|
|
223
238
|
if (r !== null) {
|
|
224
|
-
let p =
|
|
225
|
-
p =
|
|
239
|
+
let p = Ue(e);
|
|
240
|
+
p = N(p) && r !== null ? Ze(r, p) : p, o = p;
|
|
226
241
|
}
|
|
227
|
-
const a =
|
|
242
|
+
const a = _(o) ? o.getChildren() : [], l = t._nodes.get(o.getType());
|
|
228
243
|
let c;
|
|
229
244
|
c = l && l.exportDOM !== void 0 ? l.exportDOM(t, o) : o.exportDOM(t);
|
|
230
245
|
const { element: u, after: d } = c;
|
|
231
246
|
if (!u) return !1;
|
|
232
247
|
const f = document.createDocumentFragment();
|
|
233
248
|
for (let p = 0; p < a.length; p++) {
|
|
234
|
-
const m = a[p],
|
|
235
|
-
!
|
|
249
|
+
const m = a[p], v = et(t, m, f, r);
|
|
250
|
+
!s && _(e) && v && e.extractWithChild(m, r, "html") && (s = !0);
|
|
236
251
|
}
|
|
237
|
-
if (
|
|
238
|
-
if ((
|
|
252
|
+
if (s && !i) {
|
|
253
|
+
if ((dt(u) || ge(u)) && u.append(f), n.append(u), d) {
|
|
239
254
|
const p = d.call(o, u);
|
|
240
|
-
p && (
|
|
255
|
+
p && (ge(u) ? u.replaceChildren(p) : u.replaceWith(p));
|
|
241
256
|
}
|
|
242
257
|
} else n.append(f);
|
|
243
|
-
return
|
|
258
|
+
return s;
|
|
244
259
|
}
|
|
245
|
-
const
|
|
246
|
-
function
|
|
260
|
+
const tt = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
|
|
261
|
+
function nt(t, e, n, r, s = /* @__PURE__ */ new Map(), i) {
|
|
247
262
|
let o = [];
|
|
248
|
-
if (
|
|
263
|
+
if (tt.has(t.nodeName)) return o;
|
|
249
264
|
let a = null;
|
|
250
|
-
const l = function(m,
|
|
251
|
-
const { nodeName:
|
|
265
|
+
const l = function(m, v) {
|
|
266
|
+
const { nodeName: b } = m, w = v._htmlConversions.get(b.toLowerCase());
|
|
252
267
|
let C = null;
|
|
253
|
-
if (
|
|
254
|
-
const
|
|
255
|
-
|
|
268
|
+
if (w !== void 0) for (const x of w) {
|
|
269
|
+
const $ = x(m);
|
|
270
|
+
$ !== null && (C === null || (C.priority || 0) < ($.priority || 0)) && (C = $);
|
|
256
271
|
}
|
|
257
272
|
return C !== null ? C.conversion : null;
|
|
258
273
|
}(t, e), c = l ? l(t) : null;
|
|
@@ -261,68 +276,68 @@ function qe(t, e, n, r, i = /* @__PURE__ */ new Map(), s) {
|
|
|
261
276
|
u = c.after;
|
|
262
277
|
const m = c.node;
|
|
263
278
|
if (a = Array.isArray(m) ? m[m.length - 1] : m, a !== null) {
|
|
264
|
-
for (const [,
|
|
279
|
+
for (const [, v] of s) if (a = v(a, i), !a) break;
|
|
265
280
|
a && o.push(...Array.isArray(m) ? m : [a]);
|
|
266
281
|
}
|
|
267
|
-
c.forChild != null &&
|
|
282
|
+
c.forChild != null && s.set(t.nodeName, c.forChild);
|
|
268
283
|
}
|
|
269
284
|
const d = t.childNodes;
|
|
270
285
|
let f = [];
|
|
271
|
-
const p = (a == null || !
|
|
272
|
-
for (let m = 0; m < d.length; m++) f.push(...
|
|
273
|
-
return u != null && (f = u(f)),
|
|
274
|
-
const m = new
|
|
286
|
+
const p = (a == null || !ft(a)) && (a != null && se(a) || r);
|
|
287
|
+
for (let m = 0; m < d.length; m++) f.push(...nt(d[m], e, n, p, new Map(s), a));
|
|
288
|
+
return u != null && (f = u(f)), he(t) && (f = Dn(t, f, p ? () => {
|
|
289
|
+
const m = new Ke();
|
|
275
290
|
return n.push(m), m;
|
|
276
|
-
} :
|
|
277
|
-
return m.nextSibling == null || m.previousSibling == null ? !1 :
|
|
278
|
-
}(t) && (o = o.concat(
|
|
291
|
+
} : de)), a == null ? f.length > 0 ? o = o.concat(f) : he(t) && function(m) {
|
|
292
|
+
return m.nextSibling == null || m.previousSibling == null ? !1 : ve(m.nextSibling) && ve(m.previousSibling);
|
|
293
|
+
}(t) && (o = o.concat(ze())) : _(a) && a.append(...f), o;
|
|
279
294
|
}
|
|
280
|
-
function
|
|
281
|
-
const r = t.style.textAlign,
|
|
282
|
-
let
|
|
295
|
+
function Dn(t, e, n) {
|
|
296
|
+
const r = t.style.textAlign, s = [];
|
|
297
|
+
let i = [];
|
|
283
298
|
for (let o = 0; o < e.length; o++) {
|
|
284
299
|
const a = e[o];
|
|
285
|
-
if (
|
|
286
|
-
else if (
|
|
300
|
+
if (se(a)) r && !a.getFormat() && a.setFormat(r), s.push(a);
|
|
301
|
+
else if (i.push(a), o === e.length - 1 || o < e.length - 1 && se(e[o + 1])) {
|
|
287
302
|
const l = n();
|
|
288
|
-
l.setFormat(r), l.append(...
|
|
303
|
+
l.setFormat(r), l.append(...i), s.push(l), i = [];
|
|
289
304
|
}
|
|
290
305
|
}
|
|
291
|
-
return
|
|
306
|
+
return s;
|
|
292
307
|
}
|
|
293
|
-
function
|
|
308
|
+
function kn(t) {
|
|
294
309
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
295
310
|
}
|
|
296
|
-
var
|
|
311
|
+
var te = kn(function(t) {
|
|
297
312
|
const e = new URLSearchParams();
|
|
298
313
|
e.append("code", t);
|
|
299
314
|
for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]);
|
|
300
315
|
throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
301
316
|
});
|
|
302
|
-
const
|
|
303
|
-
function
|
|
304
|
-
return e == null &&
|
|
317
|
+
const Ln = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, rt = (t) => Ln ? (t || window).getSelection() : null;
|
|
318
|
+
function Tn(t, e = g()) {
|
|
319
|
+
return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : Qe(t, e);
|
|
305
320
|
}
|
|
306
|
-
function
|
|
307
|
-
return e == null &&
|
|
321
|
+
function Pn(t, e = g()) {
|
|
322
|
+
return e == null && te(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(Rn(t, e));
|
|
308
323
|
}
|
|
309
|
-
function
|
|
324
|
+
function _e(t, e, n) {
|
|
310
325
|
const r = t.getData("application/x-lexical-editor");
|
|
311
326
|
if (r) try {
|
|
312
327
|
const o = JSON.parse(r);
|
|
313
328
|
if (o.namespace === n._config.namespace && Array.isArray(o.nodes))
|
|
314
|
-
return
|
|
329
|
+
return Ne(n, On(o.nodes), e);
|
|
315
330
|
} catch {
|
|
316
331
|
}
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
319
|
-
const o = new DOMParser().parseFromString(
|
|
320
|
-
return
|
|
332
|
+
const s = t.getData("text/html");
|
|
333
|
+
if (s) try {
|
|
334
|
+
const o = new DOMParser().parseFromString(s, "text/html");
|
|
335
|
+
return Ne(n, Ge(n, o), e);
|
|
321
336
|
} catch {
|
|
322
337
|
}
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
const o =
|
|
338
|
+
const i = t.getData("text/plain") || t.getData("text/uri-list");
|
|
339
|
+
if (i != null) if (h(e)) {
|
|
340
|
+
const o = i.split(/(\r?\n|\t)/);
|
|
326
341
|
o[o.length - 1] === "" && o.pop();
|
|
327
342
|
for (let a = 0; a < o.length; a++) {
|
|
328
343
|
const l = g();
|
|
@@ -330,112 +345,112 @@ function we(t, e, n) {
|
|
|
330
345
|
const c = o[a];
|
|
331
346
|
c === `
|
|
332
347
|
` || c === `\r
|
|
333
|
-
` ? l.insertParagraph() : c === " " ? l.insertNodes([
|
|
348
|
+
` ? l.insertParagraph() : c === " " ? l.insertNodes([Be()]) : l.insertText(c);
|
|
334
349
|
}
|
|
335
350
|
}
|
|
336
|
-
} else e.insertRawText(
|
|
351
|
+
} else e.insertRawText(i);
|
|
337
352
|
}
|
|
338
|
-
function
|
|
339
|
-
t.dispatchCommand(
|
|
353
|
+
function Ne(t, e, n) {
|
|
354
|
+
t.dispatchCommand(mt, { nodes: e, selection: n }) || n.insertNodes(e);
|
|
340
355
|
}
|
|
341
|
-
function
|
|
342
|
-
let
|
|
343
|
-
const
|
|
356
|
+
function ot(t, e, n, r = []) {
|
|
357
|
+
let s = e === null || n.isSelected(e);
|
|
358
|
+
const i = _(n) && n.excludeFromCopy("html");
|
|
344
359
|
let o = n;
|
|
345
360
|
if (e !== null) {
|
|
346
|
-
let c =
|
|
347
|
-
c =
|
|
361
|
+
let c = Ue(n);
|
|
362
|
+
c = N(c) && e !== null ? Ze(e, c) : c, o = c;
|
|
348
363
|
}
|
|
349
|
-
const a =
|
|
364
|
+
const a = _(o) ? o.getChildren() : [], l = function(c) {
|
|
350
365
|
const u = c.exportJSON(), d = c.constructor;
|
|
351
|
-
if (u.type !== d.getType() &&
|
|
366
|
+
if (u.type !== d.getType() && te(58, d.name), _(c)) {
|
|
352
367
|
const f = u.children;
|
|
353
|
-
Array.isArray(f) ||
|
|
368
|
+
Array.isArray(f) || te(59, d.name);
|
|
354
369
|
}
|
|
355
370
|
return u;
|
|
356
371
|
}(o);
|
|
357
|
-
if (
|
|
372
|
+
if (N(o)) {
|
|
358
373
|
const c = o.__text;
|
|
359
|
-
c.length > 0 ? l.text = c :
|
|
374
|
+
c.length > 0 ? l.text = c : s = !1;
|
|
360
375
|
}
|
|
361
376
|
for (let c = 0; c < a.length; c++) {
|
|
362
|
-
const u = a[c], d =
|
|
363
|
-
!
|
|
377
|
+
const u = a[c], d = ot(t, e, u, l.children);
|
|
378
|
+
!s && _(n) && d && n.extractWithChild(u, e, "clone") && (s = !0);
|
|
364
379
|
}
|
|
365
|
-
if (
|
|
380
|
+
if (s && !i) r.push(l);
|
|
366
381
|
else if (Array.isArray(l.children)) for (let c = 0; c < l.children.length; c++) {
|
|
367
382
|
const u = l.children[c];
|
|
368
383
|
r.push(u);
|
|
369
384
|
}
|
|
370
|
-
return
|
|
385
|
+
return s;
|
|
371
386
|
}
|
|
372
|
-
function
|
|
373
|
-
const n = [], r =
|
|
374
|
-
for (let
|
|
375
|
-
|
|
387
|
+
function Rn(t, e) {
|
|
388
|
+
const n = [], r = O().getChildren();
|
|
389
|
+
for (let s = 0; s < r.length; s++)
|
|
390
|
+
ot(t, e, r[s], n);
|
|
376
391
|
return { namespace: t._config.namespace, nodes: n };
|
|
377
392
|
}
|
|
378
|
-
function
|
|
393
|
+
function On(t) {
|
|
379
394
|
const e = [];
|
|
380
395
|
for (let n = 0; n < t.length; n++) {
|
|
381
|
-
const r = t[n],
|
|
382
|
-
|
|
396
|
+
const r = t[n], s = pt(r);
|
|
397
|
+
N(s) && $n(s), e.push(s);
|
|
383
398
|
}
|
|
384
399
|
return e;
|
|
385
400
|
}
|
|
386
|
-
let
|
|
387
|
-
async function
|
|
388
|
-
if (
|
|
401
|
+
let A = null;
|
|
402
|
+
async function De(t, e, n) {
|
|
403
|
+
if (A !== null) return !1;
|
|
389
404
|
if (e !== null) return new Promise((l, c) => {
|
|
390
405
|
t.update(() => {
|
|
391
|
-
l(
|
|
406
|
+
l(ke(t, e, n));
|
|
392
407
|
});
|
|
393
408
|
});
|
|
394
|
-
const r = t.getRootElement(),
|
|
395
|
-
if (r === null ||
|
|
396
|
-
const o =
|
|
397
|
-
o.style.cssText = "position: fixed; top: -1000px;", o.append(
|
|
409
|
+
const r = t.getRootElement(), s = t._window == null ? window.document : t._window.document, i = rt(t._window);
|
|
410
|
+
if (r === null || i === null) return !1;
|
|
411
|
+
const o = s.createElement("span");
|
|
412
|
+
o.style.cssText = "position: fixed; top: -1000px;", o.append(s.createTextNode("#")), r.append(o);
|
|
398
413
|
const a = new Range();
|
|
399
|
-
return a.setStart(o, 0), a.setEnd(o, 1),
|
|
400
|
-
const u = t.registerCommand(
|
|
401
|
-
|
|
402
|
-
u(),
|
|
403
|
-
}, 50),
|
|
414
|
+
return a.setStart(o, 0), a.setEnd(o, 1), i.removeAllRanges(), i.addRange(a), new Promise((l, c) => {
|
|
415
|
+
const u = t.registerCommand(je, (d) => (R(d, ClipboardEvent) && (u(), A !== null && (window.clearTimeout(A), A = null), l(ke(t, d, n))), !0), gt);
|
|
416
|
+
A = window.setTimeout(() => {
|
|
417
|
+
u(), A = null, l(!1);
|
|
418
|
+
}, 50), s.execCommand("copy"), o.remove();
|
|
404
419
|
});
|
|
405
420
|
}
|
|
406
|
-
function
|
|
421
|
+
function ke(t, e, n) {
|
|
407
422
|
if (n === void 0) {
|
|
408
|
-
const
|
|
409
|
-
if (!
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
423
|
+
const s = rt(t._window);
|
|
424
|
+
if (!s) return !1;
|
|
425
|
+
const i = s.anchorNode, o = s.focusNode;
|
|
426
|
+
if (i !== null && o !== null && !ht(t, i, o)) return !1;
|
|
412
427
|
const a = g();
|
|
413
428
|
if (a === null) return !1;
|
|
414
|
-
n =
|
|
429
|
+
n = Fn(a);
|
|
415
430
|
}
|
|
416
431
|
e.preventDefault();
|
|
417
432
|
const r = e.clipboardData;
|
|
418
|
-
return r !== null && (
|
|
433
|
+
return r !== null && (An(r, n), !0);
|
|
419
434
|
}
|
|
420
|
-
const
|
|
421
|
-
function
|
|
435
|
+
const Mn = [["text/html", Tn], ["application/x-lexical-editor", Pn]];
|
|
436
|
+
function Fn(t = g()) {
|
|
422
437
|
const e = { "text/plain": t ? t.getTextContent() : "" };
|
|
423
438
|
if (t) {
|
|
424
|
-
const n =
|
|
425
|
-
for (const [r,
|
|
426
|
-
const
|
|
427
|
-
|
|
439
|
+
const n = vt();
|
|
440
|
+
for (const [r, s] of Mn) {
|
|
441
|
+
const i = s(n, t);
|
|
442
|
+
i !== null && (e[r] = i);
|
|
428
443
|
}
|
|
429
444
|
}
|
|
430
445
|
return e;
|
|
431
446
|
}
|
|
432
|
-
function
|
|
447
|
+
function An(t, e) {
|
|
433
448
|
for (const n in e) {
|
|
434
449
|
const r = e[n];
|
|
435
450
|
r !== void 0 && t.setData(n, r);
|
|
436
451
|
}
|
|
437
452
|
}
|
|
438
|
-
function
|
|
453
|
+
function Le(t, e) {
|
|
439
454
|
if (document.caretRangeFromPoint !== void 0) {
|
|
440
455
|
const n = document.caretRangeFromPoint(t, e);
|
|
441
456
|
return n === null ? null : { node: n.startContainer, offset: n.startOffset };
|
|
@@ -446,273 +461,273 @@ function be(t, e) {
|
|
|
446
461
|
}
|
|
447
462
|
return null;
|
|
448
463
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
464
|
+
const B = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, In = B && "documentMode" in document ? document.documentMode : null, Kn = !(!B || !("InputEvent" in window) || In) && "getTargetRanges" in new window.InputEvent("input"), zn = B && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Un = B && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Bn = B && /^(?=.*Chrome).*/i.test(navigator.userAgent), jn = B && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Bn, Te = Vt();
|
|
465
|
+
function Y(t) {
|
|
451
466
|
let e = null;
|
|
452
|
-
if (
|
|
453
|
-
const n = e.types, r = n.includes("Files"),
|
|
454
|
-
return [r, Array.from(e.files),
|
|
467
|
+
if (R(t, DragEvent) ? e = t.dataTransfer : R(t, ClipboardEvent) && (e = t.clipboardData), e === null) return [!1, [], !1];
|
|
468
|
+
const n = e.types, r = n.includes("Files"), s = n.includes("text/html") || n.includes("text/plain");
|
|
469
|
+
return [r, Array.from(e.files), s];
|
|
455
470
|
}
|
|
456
|
-
function
|
|
471
|
+
function Pe(t) {
|
|
457
472
|
const e = g();
|
|
458
473
|
if (!h(e)) return !1;
|
|
459
474
|
const n = /* @__PURE__ */ new Set(), r = e.getNodes();
|
|
460
|
-
for (let
|
|
461
|
-
const
|
|
475
|
+
for (let s = 0; s < r.length; s++) {
|
|
476
|
+
const i = r[s], o = i.getKey();
|
|
462
477
|
if (n.has(o)) continue;
|
|
463
|
-
const a =
|
|
478
|
+
const a = me(i, (c) => _(c) && !c.isInline());
|
|
464
479
|
if (a === null) continue;
|
|
465
480
|
const l = a.getKey();
|
|
466
481
|
a.canIndent() && !n.has(l) && (n.add(l), t(a));
|
|
467
482
|
}
|
|
468
483
|
return n.size > 0;
|
|
469
484
|
}
|
|
470
|
-
function
|
|
471
|
-
const e =
|
|
472
|
-
return
|
|
485
|
+
function Z(t) {
|
|
486
|
+
const e = ee(t);
|
|
487
|
+
return I(e);
|
|
473
488
|
}
|
|
474
|
-
function
|
|
475
|
-
return U(t.registerCommand(
|
|
489
|
+
function Jn(t) {
|
|
490
|
+
return U(t.registerCommand(Wt, (e) => {
|
|
476
491
|
const n = g();
|
|
477
|
-
return !!
|
|
478
|
-
}, 0), t.registerCommand(
|
|
492
|
+
return !!F(n) && (n.clear(), !0);
|
|
493
|
+
}, 0), t.registerCommand(ne, (e) => {
|
|
479
494
|
const n = g();
|
|
480
495
|
return !!h(n) && (n.deleteCharacter(e), !0);
|
|
481
|
-
},
|
|
496
|
+
}, y), t.registerCommand(Jt, (e) => {
|
|
482
497
|
const n = g();
|
|
483
498
|
return !!h(n) && (n.deleteWord(e), !0);
|
|
484
|
-
},
|
|
499
|
+
}, y), t.registerCommand(jt, (e) => {
|
|
485
500
|
const n = g();
|
|
486
501
|
return !!h(n) && (n.deleteLine(e), !0);
|
|
487
|
-
},
|
|
502
|
+
}, y), t.registerCommand(Bt, (e) => {
|
|
488
503
|
const n = g();
|
|
489
504
|
if (typeof e == "string") n !== null && n.insertText(e);
|
|
490
505
|
else {
|
|
491
506
|
if (n === null) return !1;
|
|
492
507
|
const r = e.dataTransfer;
|
|
493
|
-
if (r != null)
|
|
508
|
+
if (r != null) _e(r, n, t);
|
|
494
509
|
else if (h(n)) {
|
|
495
|
-
const
|
|
496
|
-
return
|
|
510
|
+
const s = e.data;
|
|
511
|
+
return s && n.insertText(s), !0;
|
|
497
512
|
}
|
|
498
513
|
}
|
|
499
514
|
return !0;
|
|
500
|
-
},
|
|
515
|
+
}, y), t.registerCommand(Ut, () => {
|
|
501
516
|
const e = g();
|
|
502
517
|
return !!h(e) && (e.removeText(), !0);
|
|
503
|
-
},
|
|
518
|
+
}, y), t.registerCommand(zt, (e) => {
|
|
504
519
|
const n = g();
|
|
505
520
|
return !!h(n) && (n.formatText(e), !0);
|
|
506
|
-
},
|
|
521
|
+
}, y), t.registerCommand(Kt, (e) => {
|
|
507
522
|
const n = g();
|
|
508
|
-
if (!h(n) && !
|
|
523
|
+
if (!h(n) && !F(n)) return !1;
|
|
509
524
|
const r = n.getNodes();
|
|
510
|
-
for (const
|
|
511
|
-
const
|
|
512
|
-
|
|
525
|
+
for (const s of r) {
|
|
526
|
+
const i = me(s, (o) => _(o) && !o.isInline());
|
|
527
|
+
i !== null && i.setFormat(e);
|
|
513
528
|
}
|
|
514
529
|
return !0;
|
|
515
|
-
},
|
|
530
|
+
}, y), t.registerCommand(ye, (e) => {
|
|
516
531
|
const n = g();
|
|
517
532
|
return !!h(n) && (n.insertLineBreak(e), !0);
|
|
518
|
-
},
|
|
533
|
+
}, y), t.registerCommand(we, () => {
|
|
519
534
|
const e = g();
|
|
520
535
|
return !!h(e) && (e.insertParagraph(), !0);
|
|
521
|
-
},
|
|
536
|
+
}, y), t.registerCommand(At, () => (It([Be()]), !0), y), t.registerCommand(Ft, () => Pe((e) => {
|
|
522
537
|
const n = e.getIndent();
|
|
523
538
|
e.setIndent(n + 1);
|
|
524
|
-
}),
|
|
539
|
+
}), y), t.registerCommand(Ce, () => Pe((e) => {
|
|
525
540
|
const n = e.getIndent();
|
|
526
541
|
n > 0 && e.setIndent(n - 1);
|
|
527
|
-
}),
|
|
542
|
+
}), y), t.registerCommand(Mt, (e) => {
|
|
528
543
|
const n = g();
|
|
529
|
-
if (
|
|
544
|
+
if (F(n) && !Z(e.target)) {
|
|
530
545
|
const r = n.getNodes();
|
|
531
546
|
if (r.length > 0) return r[0].selectPrevious(), !0;
|
|
532
547
|
} else if (h(n)) {
|
|
533
|
-
const r =
|
|
534
|
-
if (!e.shiftKey &&
|
|
548
|
+
const r = ie(n.focus, !0);
|
|
549
|
+
if (!e.shiftKey && I(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
|
|
535
550
|
}
|
|
536
551
|
return !1;
|
|
537
|
-
},
|
|
552
|
+
}, y), t.registerCommand(Ot, (e) => {
|
|
538
553
|
const n = g();
|
|
539
|
-
if (
|
|
554
|
+
if (F(n)) {
|
|
540
555
|
const r = n.getNodes();
|
|
541
556
|
if (r.length > 0) return r[0].selectNext(0, 0), !0;
|
|
542
557
|
} else if (h(n)) {
|
|
543
|
-
if (function(
|
|
544
|
-
const
|
|
545
|
-
return
|
|
558
|
+
if (function(s) {
|
|
559
|
+
const i = s.focus;
|
|
560
|
+
return i.key === "root" && i.offset === O().getChildrenSize();
|
|
546
561
|
}(n)) return e.preventDefault(), !0;
|
|
547
|
-
const r =
|
|
548
|
-
if (!e.shiftKey &&
|
|
562
|
+
const r = ie(n.focus, !1);
|
|
563
|
+
if (!e.shiftKey && I(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
|
|
549
564
|
}
|
|
550
565
|
return !1;
|
|
551
|
-
},
|
|
566
|
+
}, y), t.registerCommand(Rt, (e) => {
|
|
552
567
|
const n = g();
|
|
553
|
-
if (
|
|
568
|
+
if (F(n)) {
|
|
554
569
|
const r = n.getNodes();
|
|
555
570
|
if (r.length > 0) return e.preventDefault(), r[0].selectPrevious(), !0;
|
|
556
571
|
}
|
|
557
572
|
if (!h(n)) return !1;
|
|
558
|
-
if (
|
|
573
|
+
if ($e(n, !0)) {
|
|
559
574
|
const r = e.shiftKey;
|
|
560
|
-
return e.preventDefault(),
|
|
575
|
+
return e.preventDefault(), Se(n, r, !0), !0;
|
|
561
576
|
}
|
|
562
577
|
return !1;
|
|
563
|
-
},
|
|
578
|
+
}, y), t.registerCommand(Pt, (e) => {
|
|
564
579
|
const n = g();
|
|
565
|
-
if (
|
|
566
|
-
const
|
|
567
|
-
if (
|
|
580
|
+
if (F(n) && !Z(e.target)) {
|
|
581
|
+
const s = n.getNodes();
|
|
582
|
+
if (s.length > 0) return e.preventDefault(), s[0].selectNext(0, 0), !0;
|
|
568
583
|
}
|
|
569
584
|
if (!h(n)) return !1;
|
|
570
585
|
const r = e.shiftKey;
|
|
571
|
-
return
|
|
572
|
-
},
|
|
573
|
-
if (
|
|
586
|
+
return !!$e(n, !1) && (e.preventDefault(), Se(n, r, !1), !0);
|
|
587
|
+
}, y), t.registerCommand(Tt, (e) => {
|
|
588
|
+
if (Z(e.target)) return !1;
|
|
574
589
|
const n = g();
|
|
575
590
|
if (!h(n)) return !1;
|
|
576
591
|
e.preventDefault();
|
|
577
|
-
const { anchor: r } = n,
|
|
578
|
-
return n.isCollapsed() && r.offset === 0 && !
|
|
579
|
-
},
|
|
580
|
-
if (
|
|
592
|
+
const { anchor: r } = n, s = r.getNode();
|
|
593
|
+
return n.isCollapsed() && r.offset === 0 && !fe(s) && nn(s).getIndent() > 0 ? t.dispatchCommand(Ce, void 0) : t.dispatchCommand(ne, !0);
|
|
594
|
+
}, y), t.registerCommand(Lt, (e) => {
|
|
595
|
+
if (Z(e.target)) return !1;
|
|
581
596
|
const n = g();
|
|
582
|
-
return !!h(n) && (e.preventDefault(), t.dispatchCommand(
|
|
583
|
-
},
|
|
597
|
+
return !!h(n) && (e.preventDefault(), t.dispatchCommand(ne, !1));
|
|
598
|
+
}, y), t.registerCommand(kt, (e) => {
|
|
584
599
|
const n = g();
|
|
585
600
|
if (!h(n)) return !1;
|
|
586
601
|
if (e !== null) {
|
|
587
|
-
if ((
|
|
588
|
-
if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(
|
|
602
|
+
if ((Un || zn || jn) && Kn) return !1;
|
|
603
|
+
if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(ye, !1);
|
|
589
604
|
}
|
|
590
|
-
return t.dispatchCommand(
|
|
591
|
-
},
|
|
605
|
+
return t.dispatchCommand(we, void 0);
|
|
606
|
+
}, y), t.registerCommand(Dt, () => {
|
|
592
607
|
const e = g();
|
|
593
608
|
return !!h(e) && (t.blur(), !0);
|
|
594
|
-
},
|
|
595
|
-
const [, n] =
|
|
609
|
+
}, y), t.registerCommand($t, (e) => {
|
|
610
|
+
const [, n] = Y(e);
|
|
596
611
|
if (n.length > 0) {
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
599
|
-
const { offset:
|
|
612
|
+
const s = Le(e.clientX, e.clientY);
|
|
613
|
+
if (s !== null) {
|
|
614
|
+
const { offset: i, node: o } = s, a = ee(o);
|
|
600
615
|
if (a !== null) {
|
|
601
|
-
const l =
|
|
602
|
-
if (
|
|
616
|
+
const l = St();
|
|
617
|
+
if (N(a)) l.anchor.set(a.getKey(), i, "text"), l.focus.set(a.getKey(), i, "text");
|
|
603
618
|
else {
|
|
604
619
|
const u = a.getParentOrThrow().getKey(), d = a.getIndexWithinParent() + 1;
|
|
605
620
|
l.anchor.set(u, d, "element"), l.focus.set(u, d, "element");
|
|
606
621
|
}
|
|
607
|
-
const c =
|
|
608
|
-
|
|
622
|
+
const c = _t(l);
|
|
623
|
+
Nt(c);
|
|
609
624
|
}
|
|
610
|
-
t.dispatchCommand(
|
|
625
|
+
t.dispatchCommand(Te, n);
|
|
611
626
|
}
|
|
612
627
|
return e.preventDefault(), !0;
|
|
613
628
|
}
|
|
614
629
|
const r = g();
|
|
615
630
|
return !!h(r);
|
|
616
|
-
},
|
|
617
|
-
const [n] =
|
|
631
|
+
}, y), t.registerCommand(xt, (e) => {
|
|
632
|
+
const [n] = Y(e), r = g();
|
|
618
633
|
return !(n && !h(r));
|
|
619
|
-
},
|
|
620
|
-
const [n] =
|
|
634
|
+
}, y), t.registerCommand(bt, (e) => {
|
|
635
|
+
const [n] = Y(e), r = g();
|
|
621
636
|
if (n && !h(r)) return !1;
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
624
|
-
const
|
|
625
|
-
|
|
637
|
+
const s = Le(e.clientX, e.clientY);
|
|
638
|
+
if (s !== null) {
|
|
639
|
+
const i = ee(s.node);
|
|
640
|
+
I(i) && e.preventDefault();
|
|
626
641
|
}
|
|
627
642
|
return !0;
|
|
628
|
-
},
|
|
629
|
-
await
|
|
630
|
-
const
|
|
631
|
-
h(
|
|
643
|
+
}, y), t.registerCommand(Ct, () => (Et(), !0), y), t.registerCommand(je, (e) => (De(t, R(e, ClipboardEvent) ? e : null), !0), y), t.registerCommand(wt, (e) => (async function(n, r) {
|
|
644
|
+
await De(r, R(n, ClipboardEvent) ? n : null), r.update(() => {
|
|
645
|
+
const s = g();
|
|
646
|
+
h(s) ? s.removeText() : F(s) && s.getNodes().forEach((i) => i.remove());
|
|
632
647
|
});
|
|
633
|
-
}(e, t), !0),
|
|
634
|
-
const [, n, r] =
|
|
635
|
-
return n.length > 0 && !r ? (t.dispatchCommand(
|
|
636
|
-
|
|
637
|
-
const o = g(), a =
|
|
638
|
-
a != null && o !== null &&
|
|
648
|
+
}(e, t), !0), y), t.registerCommand(Je, (e) => {
|
|
649
|
+
const [, n, r] = Y(e);
|
|
650
|
+
return n.length > 0 && !r ? (t.dispatchCommand(Te, n), !0) : yt(e.target) ? !1 : g() !== null && (function(s, i) {
|
|
651
|
+
s.preventDefault(), i.update(() => {
|
|
652
|
+
const o = g(), a = R(s, InputEvent) || R(s, KeyboardEvent) ? null : s.clipboardData;
|
|
653
|
+
a != null && o !== null && _e(a, o, i);
|
|
639
654
|
}, { tag: "paste" });
|
|
640
655
|
}(e, t), !0);
|
|
641
|
-
},
|
|
656
|
+
}, y));
|
|
642
657
|
}
|
|
643
|
-
const
|
|
644
|
-
function
|
|
645
|
-
return t.getEditorState().read(
|
|
658
|
+
const ae = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
|
|
659
|
+
function Re(t) {
|
|
660
|
+
return t.getEditorState().read(Ye(t.isComposing()));
|
|
646
661
|
}
|
|
647
|
-
function
|
|
648
|
-
const [r] =
|
|
649
|
-
const [a, l] =
|
|
650
|
-
return
|
|
651
|
-
|
|
662
|
+
function Wn({ contentEditable: t, placeholder: e = null, ErrorBoundary: n }) {
|
|
663
|
+
const [r] = T(), s = function(i, o) {
|
|
664
|
+
const [a, l] = K(() => i.getDecorators());
|
|
665
|
+
return ae(() => i.registerDecoratorListener((c) => {
|
|
666
|
+
be.flushSync(() => {
|
|
652
667
|
l(c);
|
|
653
668
|
});
|
|
654
|
-
}), [
|
|
655
|
-
l(
|
|
656
|
-
}, [
|
|
669
|
+
}), [i]), k(() => {
|
|
670
|
+
l(i.getDecorators());
|
|
671
|
+
}, [i]), W(() => {
|
|
657
672
|
const c = [], u = Object.keys(a);
|
|
658
673
|
for (let d = 0; d < u.length; d++) {
|
|
659
|
-
const f = u[d], p =
|
|
660
|
-
m !== null && c.push(
|
|
674
|
+
const f = u[d], p = E(o, { onError: (v) => i._onError(v), children: E(en, { fallback: null, children: a[f] }) }), m = i.getElementByKey(f);
|
|
675
|
+
m !== null && c.push(be.createPortal(p, m, f));
|
|
661
676
|
}
|
|
662
677
|
return c;
|
|
663
|
-
}, [o, a,
|
|
678
|
+
}, [o, a, i]);
|
|
664
679
|
}(r, n);
|
|
665
|
-
return function(
|
|
666
|
-
|
|
667
|
-
}(r),
|
|
668
|
-
}
|
|
669
|
-
function
|
|
670
|
-
const [e] =
|
|
671
|
-
const [
|
|
672
|
-
return
|
|
680
|
+
return function(i) {
|
|
681
|
+
ae(() => U(Jn(i), Nn(i)), [i]);
|
|
682
|
+
}(r), Q(Ie, { children: [t, E(Vn, { content: e }), s] });
|
|
683
|
+
}
|
|
684
|
+
function Vn({ content: t }) {
|
|
685
|
+
const [e] = T(), n = function(s) {
|
|
686
|
+
const [i, o] = K(() => Re(s));
|
|
687
|
+
return ae(() => {
|
|
673
688
|
function a() {
|
|
674
|
-
const l =
|
|
689
|
+
const l = Re(s);
|
|
675
690
|
o(l);
|
|
676
691
|
}
|
|
677
|
-
return a(), U(
|
|
692
|
+
return a(), U(s.registerUpdateListener(() => {
|
|
678
693
|
a();
|
|
679
|
-
}),
|
|
694
|
+
}), s.registerEditableListener(() => {
|
|
680
695
|
a();
|
|
681
696
|
}));
|
|
682
|
-
}, [
|
|
683
|
-
}(e), r =
|
|
697
|
+
}, [s]), i;
|
|
698
|
+
}(e), r = hn();
|
|
684
699
|
return n ? typeof t == "function" ? t(r) : t : null;
|
|
685
700
|
}
|
|
686
|
-
const
|
|
687
|
-
function
|
|
688
|
-
const [S,
|
|
689
|
-
|
|
690
|
-
}, [t]),
|
|
691
|
-
return (
|
|
692
|
-
|
|
693
|
-
typeof
|
|
701
|
+
const it = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
|
|
702
|
+
function qn({ editor: t, ariaActiveDescendant: e, ariaAutoComplete: n, ariaControls: r, ariaDescribedBy: s, ariaExpanded: i, ariaLabel: o, ariaLabelledBy: a, ariaMultiline: l, ariaOwns: c, ariaRequired: u, autoCapitalize: d, className: f, id: p, role: m = "textbox", spellCheck: v = !0, style: b, tabIndex: w, "data-testid": C, ...x }, $) {
|
|
703
|
+
const [S, L] = K(t.isEditable()), M = tn((P) => {
|
|
704
|
+
P && P.ownerDocument && P.ownerDocument.defaultView ? t.setRootElement(P) : t.setRootElement(null);
|
|
705
|
+
}, [t]), j = W(() => /* @__PURE__ */ function(...P) {
|
|
706
|
+
return (pe) => {
|
|
707
|
+
P.forEach((V) => {
|
|
708
|
+
typeof V == "function" ? V(pe) : V != null && (V.current = pe);
|
|
694
709
|
});
|
|
695
710
|
};
|
|
696
|
-
}(
|
|
697
|
-
return
|
|
698
|
-
|
|
699
|
-
})), [t]),
|
|
711
|
+
}($, M), [M, $]);
|
|
712
|
+
return it(() => (L(t.isEditable()), t.registerEditableListener((P) => {
|
|
713
|
+
L(P);
|
|
714
|
+
})), [t]), E("div", { ...x, "aria-activedescendant": S ? e : void 0, "aria-autocomplete": S ? n : "none", "aria-controls": S ? r : void 0, "aria-describedby": s, "aria-expanded": S && m === "combobox" ? !!i : void 0, "aria-label": o, "aria-labelledby": a, "aria-multiline": l, "aria-owns": S ? c : void 0, "aria-readonly": !S || void 0, "aria-required": u, autoCapitalize: d, className: f, contentEditable: S, "data-testid": C, id: p, ref: j, role: S ? m : void 0, spellCheck: v, style: b, tabIndex: w });
|
|
700
715
|
}
|
|
701
|
-
const
|
|
702
|
-
function
|
|
703
|
-
return t.getEditorState().read(
|
|
716
|
+
const Hn = We(qn);
|
|
717
|
+
function Oe(t) {
|
|
718
|
+
return t.getEditorState().read(Ye(t.isComposing()));
|
|
704
719
|
}
|
|
705
|
-
const
|
|
706
|
-
function
|
|
707
|
-
const { placeholder: n, ...r } = t, [
|
|
708
|
-
return
|
|
720
|
+
const Xn = We(Yn);
|
|
721
|
+
function Yn(t, e) {
|
|
722
|
+
const { placeholder: n, ...r } = t, [s] = T();
|
|
723
|
+
return Q(Ie, { children: [E(Hn, { editor: s, ...r, ref: e }), n != null && E(Zn, { editor: s, content: n })] });
|
|
709
724
|
}
|
|
710
|
-
function
|
|
725
|
+
function Zn({ content: t, editor: e }) {
|
|
711
726
|
const n = function(o) {
|
|
712
|
-
const [a, l] =
|
|
713
|
-
return
|
|
727
|
+
const [a, l] = K(() => Oe(o));
|
|
728
|
+
return it(() => {
|
|
714
729
|
function c() {
|
|
715
|
-
const u =
|
|
730
|
+
const u = Oe(o);
|
|
716
731
|
l(u);
|
|
717
732
|
}
|
|
718
733
|
return c(), U(o.registerUpdateListener(() => {
|
|
@@ -721,188 +736,278 @@ function Kn({ content: t, editor: e }) {
|
|
|
721
736
|
c();
|
|
722
737
|
}));
|
|
723
738
|
}, [o]), a;
|
|
724
|
-
}(e), [r,
|
|
725
|
-
if (
|
|
726
|
-
|
|
739
|
+
}(e), [r, s] = K(e.isEditable());
|
|
740
|
+
if (z(() => (s(e.isEditable()), e.registerEditableListener((o) => {
|
|
741
|
+
s(o);
|
|
727
742
|
})), [e]), !n) return null;
|
|
728
|
-
let
|
|
729
|
-
return typeof t == "function" ?
|
|
743
|
+
let i = null;
|
|
744
|
+
return typeof t == "function" ? i = t(r) : t !== null && (i = t), i === null ? null : E("div", { "aria-hidden": !0, children: i });
|
|
730
745
|
}
|
|
731
|
-
function
|
|
732
|
-
return
|
|
746
|
+
function le(t, e) {
|
|
747
|
+
return le = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
|
|
733
748
|
return n.__proto__ = r, n;
|
|
734
|
-
},
|
|
749
|
+
}, le(t, e);
|
|
735
750
|
}
|
|
736
|
-
var
|
|
751
|
+
var Me = { error: null }, Gn = function(t) {
|
|
737
752
|
var e, n;
|
|
738
753
|
function r() {
|
|
739
|
-
for (var
|
|
740
|
-
return (
|
|
754
|
+
for (var i, o = arguments.length, a = new Array(o), l = 0; l < o; l++) a[l] = arguments[l];
|
|
755
|
+
return (i = t.call.apply(t, [this].concat(a)) || this).state = Me, i.resetErrorBoundary = function() {
|
|
741
756
|
for (var c, u = arguments.length, d = new Array(u), f = 0; f < u; f++) d[f] = arguments[f];
|
|
742
|
-
|
|
743
|
-
},
|
|
757
|
+
i.props.onReset == null || (c = i.props).onReset.apply(c, d), i.reset();
|
|
758
|
+
}, i;
|
|
744
759
|
}
|
|
745
|
-
n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e,
|
|
746
|
-
return { error:
|
|
760
|
+
n = t, (e = r).prototype = Object.create(n.prototype), e.prototype.constructor = e, le(e, n), r.getDerivedStateFromError = function(i) {
|
|
761
|
+
return { error: i };
|
|
747
762
|
};
|
|
748
|
-
var
|
|
749
|
-
return
|
|
750
|
-
this.setState(
|
|
751
|
-
},
|
|
763
|
+
var s = r.prototype;
|
|
764
|
+
return s.reset = function() {
|
|
765
|
+
this.setState(Me);
|
|
766
|
+
}, s.componentDidCatch = function(i, o) {
|
|
752
767
|
var a, l;
|
|
753
|
-
(a = (l = this.props).onError) == null || a.call(l,
|
|
754
|
-
},
|
|
768
|
+
(a = (l = this.props).onError) == null || a.call(l, i, o);
|
|
769
|
+
}, s.componentDidUpdate = function(i, o) {
|
|
755
770
|
var a, l, c, u, d = this.state.error, f = this.props.resetKeys;
|
|
756
|
-
d !== null && o.error !== null && ((c =
|
|
771
|
+
d !== null && o.error !== null && ((c = i.resetKeys) === void 0 && (c = []), (u = f) === void 0 && (u = []), c.length !== u.length || c.some(function(p, m) {
|
|
757
772
|
return !Object.is(p, u[m]);
|
|
758
|
-
})) && ((a = (l = this.props).onResetKeysChange) == null || a.call(l,
|
|
759
|
-
},
|
|
760
|
-
var
|
|
761
|
-
if (
|
|
762
|
-
var u = { error:
|
|
763
|
-
if (
|
|
773
|
+
})) && ((a = (l = this.props).onResetKeysChange) == null || a.call(l, i.resetKeys, f), this.reset());
|
|
774
|
+
}, s.render = function() {
|
|
775
|
+
var i = this.state.error, o = this.props, a = o.fallbackRender, l = o.FallbackComponent, c = o.fallback;
|
|
776
|
+
if (i !== null) {
|
|
777
|
+
var u = { error: i, resetErrorBoundary: this.resetErrorBoundary };
|
|
778
|
+
if (re.isValidElement(c)) return c;
|
|
764
779
|
if (typeof a == "function") return a(u);
|
|
765
|
-
if (l) return
|
|
780
|
+
if (l) return re.createElement(l, u);
|
|
766
781
|
throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
|
|
767
782
|
}
|
|
768
783
|
return this.props.children;
|
|
769
784
|
}, r;
|
|
770
|
-
}(
|
|
771
|
-
function
|
|
772
|
-
return
|
|
773
|
-
}
|
|
774
|
-
const
|
|
775
|
-
function
|
|
776
|
-
const [r] =
|
|
777
|
-
return
|
|
778
|
-
if (n) return r.registerUpdateListener(({ editorState:
|
|
779
|
-
e &&
|
|
785
|
+
}(re.Component);
|
|
786
|
+
function Qn({ children: t, onError: e }) {
|
|
787
|
+
return E(Gn, { fallback: E("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }), onError: e, children: t });
|
|
788
|
+
}
|
|
789
|
+
const er = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? z : k;
|
|
790
|
+
function tr({ ignoreHistoryMergeTagChange: t = !0, ignoreSelectionChange: e = !1, onChange: n }) {
|
|
791
|
+
const [r] = T();
|
|
792
|
+
return er(() => {
|
|
793
|
+
if (n) return r.registerUpdateListener(({ editorState: s, dirtyElements: i, dirtyLeaves: o, prevEditorState: a, tags: l }) => {
|
|
794
|
+
e && i.size === 0 && o.size === 0 || t && l.has("history-merge") || a.isEmpty() || n(s, r, l);
|
|
780
795
|
});
|
|
781
796
|
}, [r, t, e, n]), null;
|
|
782
797
|
}
|
|
783
|
-
function
|
|
784
|
-
const [t] =
|
|
785
|
-
return
|
|
786
|
-
if (!t.hasNodes([
|
|
798
|
+
function nr() {
|
|
799
|
+
const [t] = T();
|
|
800
|
+
return k(() => {
|
|
801
|
+
if (!t.hasNodes([Ve, qe])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
|
|
787
802
|
}, [t]), function(e) {
|
|
788
|
-
|
|
803
|
+
k(() => rn(e), [e]);
|
|
789
804
|
}(t), null;
|
|
790
805
|
}
|
|
791
|
-
function
|
|
792
|
-
const [e] =
|
|
793
|
-
return
|
|
794
|
-
if (!e.hasNodes([
|
|
795
|
-
return U(e.registerCommand(
|
|
796
|
-
if (n === null) return
|
|
797
|
-
if (typeof n == "string") return !(t !== void 0 && !t(n)) && (
|
|
806
|
+
function rr({ validateUrl: t }) {
|
|
807
|
+
const [e] = T();
|
|
808
|
+
return k(() => {
|
|
809
|
+
if (!e.hasNodes([He])) throw new Error("LinkPlugin: LinkNode not registered on editor");
|
|
810
|
+
return U(e.registerCommand(xe, (n) => {
|
|
811
|
+
if (n === null) return oe(n), !0;
|
|
812
|
+
if (typeof n == "string") return !(t !== void 0 && !t(n)) && (oe(n), !0);
|
|
798
813
|
{
|
|
799
|
-
const { url: r, target:
|
|
800
|
-
return
|
|
814
|
+
const { url: r, target: s, rel: i, title: o } = n;
|
|
815
|
+
return oe(r, { rel: i, target: s, title: o }), !0;
|
|
801
816
|
}
|
|
802
|
-
},
|
|
817
|
+
}, Ee), t !== void 0 ? e.registerCommand(Je, (n) => {
|
|
803
818
|
const r = g();
|
|
804
|
-
if (!h(r) || r.isCollapsed() || !
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
807
|
-
const
|
|
808
|
-
return !!t(
|
|
809
|
-
},
|
|
819
|
+
if (!h(r) || r.isCollapsed() || !R(n, ClipboardEvent)) return !1;
|
|
820
|
+
const s = n;
|
|
821
|
+
if (s.clipboardData === null) return !1;
|
|
822
|
+
const i = s.clipboardData.getData("text");
|
|
823
|
+
return !!t(i) && !r.getNodes().some((o) => _(o)) && (e.dispatchCommand(xe, i), n.preventDefault(), !0);
|
|
824
|
+
}, Ee) : () => {
|
|
810
825
|
});
|
|
811
826
|
}, [e, t]), null;
|
|
812
827
|
}
|
|
813
|
-
function
|
|
814
|
-
const [n] =
|
|
815
|
-
return
|
|
816
|
-
const r = (
|
|
817
|
-
const o =
|
|
828
|
+
function or({ newTab: t = !0, disabled: e = !1 }) {
|
|
829
|
+
const [n] = T();
|
|
830
|
+
return k(() => {
|
|
831
|
+
const r = (i) => {
|
|
832
|
+
const o = i.target;
|
|
818
833
|
if (!(o instanceof Node)) return;
|
|
819
|
-
const a =
|
|
834
|
+
const a = qt(o);
|
|
820
835
|
if (a === null) return;
|
|
821
836
|
let l = null, c = null;
|
|
822
837
|
if (a.update(() => {
|
|
823
|
-
const f =
|
|
838
|
+
const f = ee(o);
|
|
824
839
|
if (f !== null) {
|
|
825
|
-
const p =
|
|
826
|
-
if (!e) if (
|
|
840
|
+
const p = me(f, _);
|
|
841
|
+
if (!e) if (on(p)) l = p.sanitizeUrl(p.getURL()), c = p.getTarget();
|
|
827
842
|
else {
|
|
828
|
-
const m = function(
|
|
829
|
-
let
|
|
830
|
-
for (;
|
|
831
|
-
if (
|
|
832
|
-
|
|
843
|
+
const m = function(v, b) {
|
|
844
|
+
let w = v;
|
|
845
|
+
for (; w != null; ) {
|
|
846
|
+
if (b(w)) return w;
|
|
847
|
+
w = w.parentNode;
|
|
833
848
|
}
|
|
834
849
|
return null;
|
|
835
|
-
}(o,
|
|
850
|
+
}(o, Ht);
|
|
836
851
|
m !== null && (l = m.href, c = m.target);
|
|
837
852
|
}
|
|
838
853
|
}
|
|
839
854
|
}), l === null || l === "") return;
|
|
840
855
|
const u = n.getEditorState().read(g);
|
|
841
|
-
if (h(u) && !u.isCollapsed()) return void
|
|
842
|
-
const d =
|
|
843
|
-
window.open(l, t || d ||
|
|
844
|
-
},
|
|
845
|
-
|
|
856
|
+
if (h(u) && !u.isCollapsed()) return void i.preventDefault();
|
|
857
|
+
const d = i.type === "auxclick" && i.button === 1;
|
|
858
|
+
window.open(l, t || d || i.metaKey || i.ctrlKey || c === "_blank" ? "_blank" : "_self"), i.preventDefault();
|
|
859
|
+
}, s = (i) => {
|
|
860
|
+
i.button === 1 && r(i);
|
|
846
861
|
};
|
|
847
|
-
return n.registerRootListener((
|
|
848
|
-
o !== null && (o.removeEventListener("click", r), o.removeEventListener("mouseup",
|
|
862
|
+
return n.registerRootListener((i, o) => {
|
|
863
|
+
o !== null && (o.removeEventListener("click", r), o.removeEventListener("mouseup", s)), i !== null && (i.addEventListener("click", r), i.addEventListener("mouseup", s));
|
|
849
864
|
});
|
|
850
865
|
}, [n, t, e]), null;
|
|
851
866
|
}
|
|
852
|
-
const
|
|
867
|
+
const G = 0, ce = 1, ue = 2, D = 0, ir = 1, Fe = 2, sr = 3, ar = 4;
|
|
868
|
+
function lr(t, e, n, r, s) {
|
|
869
|
+
if (t === null || n.size === 0 && r.size === 0 && !s) return D;
|
|
870
|
+
const i = e._selection, o = t._selection;
|
|
871
|
+
if (s) return ir;
|
|
872
|
+
if (!(h(i) && h(o) && o.isCollapsed() && i.isCollapsed())) return D;
|
|
873
|
+
const a = function(w, C, x) {
|
|
874
|
+
const $ = w._nodeMap, S = [];
|
|
875
|
+
for (const L of C) {
|
|
876
|
+
const M = $.get(L);
|
|
877
|
+
M !== void 0 && S.push(M);
|
|
878
|
+
}
|
|
879
|
+
for (const [L, M] of x) {
|
|
880
|
+
if (!M) continue;
|
|
881
|
+
const j = $.get(L);
|
|
882
|
+
j === void 0 || fe(j) || S.push(j);
|
|
883
|
+
}
|
|
884
|
+
return S;
|
|
885
|
+
}(e, n, r);
|
|
886
|
+
if (a.length === 0) return D;
|
|
887
|
+
if (a.length > 1) {
|
|
888
|
+
const w = e._nodeMap, C = w.get(i.anchor.key), x = w.get(o.anchor.key);
|
|
889
|
+
return C && x && !t._nodeMap.has(C.__key) && N(C) && C.__text.length === 1 && i.anchor.offset === 1 ? Fe : D;
|
|
890
|
+
}
|
|
891
|
+
const l = a[0], c = t._nodeMap.get(l.__key);
|
|
892
|
+
if (!N(c) || !N(l) || c.__mode !== l.__mode) return D;
|
|
893
|
+
const u = c.__text, d = l.__text;
|
|
894
|
+
if (u === d) return D;
|
|
895
|
+
const f = i.anchor, p = o.anchor;
|
|
896
|
+
if (f.key !== p.key || f.type !== "text") return D;
|
|
897
|
+
const m = f.offset, v = p.offset, b = d.length - u.length;
|
|
898
|
+
return b === 1 && v === m - 1 ? Fe : b === -1 && v === m + 1 ? sr : b === -1 && v === m ? ar : D;
|
|
899
|
+
}
|
|
900
|
+
function cr(t, e) {
|
|
901
|
+
let n = Date.now(), r = D;
|
|
902
|
+
return (s, i, o, a, l, c) => {
|
|
903
|
+
const u = Date.now();
|
|
904
|
+
if (c.has("historic")) return r = D, n = u, ue;
|
|
905
|
+
const d = lr(s, i, a, l, t.isComposing()), f = (() => {
|
|
906
|
+
const p = o === null || o.editor === t, m = c.has("history-push");
|
|
907
|
+
if (!m && p && c.has("history-merge")) return G;
|
|
908
|
+
if (s === null) return ce;
|
|
909
|
+
const v = i._selection;
|
|
910
|
+
return a.size > 0 || l.size > 0 ? m === !1 && d !== D && d === r && u < n + e && p || a.size === 1 && function(b, w, C) {
|
|
911
|
+
const x = w._nodeMap.get(b), $ = C._nodeMap.get(b), S = w._selection, L = C._selection;
|
|
912
|
+
return !(h(S) && h(L) && S.anchor.type === "element" && S.focus.type === "element" && L.anchor.type === "text" && L.focus.type === "text" || !N(x) || !N($) || x.__parent !== $.__parent) && JSON.stringify(w.read(() => x.exportJSON())) === JSON.stringify(C.read(() => $.exportJSON()));
|
|
913
|
+
}(Array.from(a)[0], s, i) ? G : ce : v !== null ? G : ue;
|
|
914
|
+
})();
|
|
915
|
+
return n = u, r = d, f;
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
function Ae(t) {
|
|
919
|
+
t.undoStack = [], t.redoStack = [], t.current = null;
|
|
920
|
+
}
|
|
921
|
+
function ur(t, e, n) {
|
|
922
|
+
const r = cr(t, n);
|
|
923
|
+
return U(t.registerCommand(Gt, () => (function(i, o) {
|
|
924
|
+
const a = o.redoStack, l = o.undoStack;
|
|
925
|
+
if (l.length !== 0) {
|
|
926
|
+
const c = o.current, u = l.pop();
|
|
927
|
+
c !== null && (a.push(c), i.dispatchCommand(q, !0)), l.length === 0 && i.dispatchCommand(H, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
|
|
928
|
+
}
|
|
929
|
+
}(t, e), !0), y), t.registerCommand(Zt, () => (function(i, o) {
|
|
930
|
+
const a = o.redoStack, l = o.undoStack;
|
|
931
|
+
if (a.length !== 0) {
|
|
932
|
+
const c = o.current;
|
|
933
|
+
c !== null && (l.push(c), i.dispatchCommand(H, !0));
|
|
934
|
+
const u = a.pop();
|
|
935
|
+
a.length === 0 && i.dispatchCommand(q, !1), o.current = u || null, u && u.editor.setEditorState(u.editorState, { tag: "historic" });
|
|
936
|
+
}
|
|
937
|
+
}(t, e), !0), y), t.registerCommand(Yt, () => (Ae(e), !1), y), t.registerCommand(Xt, () => (Ae(e), t.dispatchCommand(q, !1), t.dispatchCommand(H, !1), !0), y), t.registerUpdateListener(({ editorState: i, prevEditorState: o, dirtyLeaves: a, dirtyElements: l, tags: c }) => {
|
|
938
|
+
const u = e.current, d = e.redoStack, f = e.undoStack, p = u === null ? null : u.editorState;
|
|
939
|
+
if (u !== null && i === p) return;
|
|
940
|
+
const m = r(o, i, u, a, l, c);
|
|
941
|
+
if (m === ce) d.length !== 0 && (e.redoStack = [], t.dispatchCommand(q, !1)), u !== null && (f.push({ ...u }), t.dispatchCommand(H, !0));
|
|
942
|
+
else if (m === ue) return;
|
|
943
|
+
e.current = { editor: t, editorState: i };
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
function dr() {
|
|
947
|
+
return { current: null, redoStack: [], undoStack: [] };
|
|
948
|
+
}
|
|
949
|
+
function fr({ delay: t, externalHistoryState: e }) {
|
|
950
|
+
const [n] = T();
|
|
951
|
+
return function(r, s, i = 1e3) {
|
|
952
|
+
const o = W(() => s || dr(), [s]);
|
|
953
|
+
k(() => ur(r, o, i), [i, r, o]);
|
|
954
|
+
}(n, e, t), null;
|
|
955
|
+
}
|
|
956
|
+
const Ir = ({
|
|
853
957
|
namespace: t = "UvaEditor",
|
|
854
958
|
initialValue: e = "",
|
|
855
959
|
placeholder: n = "",
|
|
856
960
|
onChange: r
|
|
857
961
|
}) => {
|
|
858
|
-
const
|
|
962
|
+
const s = {
|
|
859
963
|
namespace: t,
|
|
860
|
-
theme:
|
|
964
|
+
theme: dn,
|
|
861
965
|
onError(o) {
|
|
862
966
|
throw o;
|
|
863
967
|
},
|
|
864
|
-
nodes: [
|
|
968
|
+
nodes: [Ve, qe, He, cn],
|
|
865
969
|
editorState: (o) => {
|
|
866
|
-
const l = new DOMParser().parseFromString(e, "text/html"), c =
|
|
970
|
+
const l = new DOMParser().parseFromString(e, "text/html"), c = Ge(o, l), u = O();
|
|
867
971
|
u.clear();
|
|
868
|
-
const d =
|
|
972
|
+
const d = de();
|
|
869
973
|
c.forEach((f) => d.append(f)), u.append(d);
|
|
870
974
|
}
|
|
871
|
-
},
|
|
975
|
+
}, i = (o, a) => {
|
|
872
976
|
o.read(() => {
|
|
873
|
-
const l =
|
|
977
|
+
const l = Qe(a);
|
|
874
978
|
r(l);
|
|
875
979
|
});
|
|
876
980
|
};
|
|
877
|
-
return /* @__PURE__ */
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
|
|
981
|
+
return /* @__PURE__ */ E("div", { className: J.editor__wrapper, children: /* @__PURE__ */ Q(mn, { initialConfig: s, children: [
|
|
982
|
+
/* @__PURE__ */ E(un, {}),
|
|
983
|
+
/* @__PURE__ */ Q("div", { className: J["editor__field-wrapper"], children: [
|
|
984
|
+
/* @__PURE__ */ E(
|
|
985
|
+
Wn,
|
|
882
986
|
{
|
|
883
|
-
contentEditable: /* @__PURE__ */
|
|
884
|
-
|
|
987
|
+
contentEditable: /* @__PURE__ */ E(
|
|
988
|
+
Xn,
|
|
885
989
|
{
|
|
886
|
-
className:
|
|
990
|
+
className: J.editor__field,
|
|
887
991
|
"aria-label": "Rich text editor content",
|
|
888
992
|
"aria-placeholder": n,
|
|
889
993
|
title: "Rich text editor content",
|
|
890
|
-
placeholder: /* @__PURE__ */
|
|
994
|
+
placeholder: /* @__PURE__ */ E("div", { className: J.editor__placeholder, children: n })
|
|
891
995
|
}
|
|
892
996
|
),
|
|
893
|
-
placeholder: /* @__PURE__ */
|
|
894
|
-
ErrorBoundary:
|
|
997
|
+
placeholder: /* @__PURE__ */ E("div", { className: J.editor__placeholder, children: n }),
|
|
998
|
+
ErrorBoundary: Qn
|
|
895
999
|
}
|
|
896
1000
|
),
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
1001
|
+
/* @__PURE__ */ E(fr, {}),
|
|
1002
|
+
/* @__PURE__ */ E(nr, {}),
|
|
1003
|
+
/* @__PURE__ */ E(rr, { validateUrl: sn }),
|
|
1004
|
+
/* @__PURE__ */ E(an, { matchers: ln }),
|
|
1005
|
+
/* @__PURE__ */ E(or, {}),
|
|
1006
|
+
/* @__PURE__ */ E(tr, { onChange: i })
|
|
902
1007
|
] })
|
|
903
1008
|
] }) });
|
|
904
1009
|
};
|
|
905
1010
|
export {
|
|
906
|
-
|
|
1011
|
+
Ir as RteEditor
|
|
907
1012
|
};
|
|
908
1013
|
//# sourceMappingURL=RteEditor.js.map
|