@uva-glass/component-library 1.59.1 → 1.59.3
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-CO0gPAfo.js → Lexical.prod-BhH9TCLN.js} +952 -944
- package/dist/Lexical.prod-BhH9TCLN.js.map +1 -0
- package/dist/{LexicalList.prod-BceA-cJD.js → LexicalList.prod-Czb3Osbz.js} +25 -23
- package/dist/LexicalList.prod-Czb3Osbz.js.map +1 -0
- package/dist/{LexicalUtils.prod-PbdOb6JG.js → LexicalUtils.prod-Bsuvahba.js} +20 -20
- package/dist/{LexicalUtils.prod-PbdOb6JG.js.map → LexicalUtils.prod-Bsuvahba.js.map} +1 -1
- package/dist/{TablePlugin-Cj6IBz2k.js → TablePlugin-deK-rcE1.js} +32 -32
- package/dist/{TablePlugin-Cj6IBz2k.js.map → TablePlugin-deK-rcE1.js.map} +1 -1
- package/dist/assets/Periods.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/Periods/Periods.js +28 -25
- package/dist/components/Periods/Periods.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +11 -11
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +2 -2
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +25 -25
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +505 -505
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-Ec7CfNnA.js → helpers-BRIyyVa6.js} +23 -23
- package/dist/{helpers-Ec7CfNnA.js.map → helpers-BRIyyVa6.js.map} +1 -1
- package/dist/{helpers-BewZrn6E.js → helpers-CaU5T9i-.js} +462 -423
- package/dist/helpers-CaU5T9i-.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +9 -9
- package/dist/Lexical.prod-CO0gPAfo.js.map +0 -1
- package/dist/LexicalList.prod-BceA-cJD.js.map +0 -1
- package/dist/helpers-BewZrn6E.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function
|
|
1
|
+
function qi(n) {
|
|
2
2
|
return {};
|
|
3
3
|
}
|
|
4
|
-
const
|
|
4
|
+
const wn = {}, Qi = {}, Ls = {}, yt = {}, gt = {}, Yn = {}, He = {}, Wr = {}, Gn = {}, mt = {}, xt = {}, we = {}, Br = {}, Rr = {}, Os = {}, Is = {}, As = {}, Ms = {}, zs = {}, Ws = {}, Bs = {}, dn = {}, Rs = {}, Ks = {}, $s = {}, Js = {}, Us = {}, Xi = {}, Yi = {}, Gi = {}, Vs = {}, Zi = {}, js = {}, Hs = {}, qs = {}, Kr = {}, $r = {}, Zn = {}, eo = {}, to = {}, no = {}, ro = {}, Qs = {}, Xs = {}, Ys = {}, ne = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Gs = ne && "documentMode" in document ? document.documentMode : null, Z = ne && /Mac|iPod|iPhone|iPad/.test(navigator.platform), xe = ne && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent), vt = !(!ne || !("InputEvent" in window) || Gs) && "getTargetRanges" in new window.InputEvent("input"), Nn = ne && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), It = ne && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Zs = ne && /Android/.test(navigator.userAgent), Jr = ne && /^(?=.*Chrome).*/i.test(navigator.userAgent), ei = ne && Zs && Jr, En = ne && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Jr, rt = 1, Te = 3, Ee = 0, Ur = 1, Me = 2, ti = 0, ni = 1, ri = 2, St = 4, Tt = 8, Pn = 128, si = 112 | (3 | St | Tt) | Pn, Fn = 1, Dn = 2, Ln = 3, On = 4, In = 5, An = 6, At = Nn || It || En ? " " : "", ae = `
|
|
5
5
|
|
|
6
|
-
`, ii = xe ? " " : At, Vr = "֑-߿יִ-﷽ﹰ-ﻼ", jr = "A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--", oi = new RegExp("^[^" + jr + "]*[" + Vr + "]"), li = new RegExp("^[^" + Vr + "]*[" + jr + "]"), ce = { bold: 1, code: 16, highlight:
|
|
6
|
+
`, ii = xe ? " " : At, Vr = "֑-߿יִ-﷽ﹰ-ﻼ", jr = "A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--", oi = new RegExp("^[^" + jr + "]*[" + Vr + "]"), li = new RegExp("^[^" + Vr + "]*[" + jr + "]"), ce = { bold: 1, code: 16, highlight: Pn, italic: 2, strikethrough: St, subscript: 32, superscript: 64, underline: Tt }, ci = { directionless: 1, unmergeable: 2 }, er = { center: Dn, end: An, justify: On, left: Fn, right: Ln, start: In }, ai = { [Dn]: "center", [An]: "end", [On]: "justify", [Fn]: "left", [Ln]: "right", [In]: "start" }, ui = { normal: 0, segmented: 2, token: 1 }, fi = { [ti]: "normal", [ri]: "segmented", [ni]: "token" };
|
|
7
7
|
function di(n) {
|
|
8
8
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
9
9
|
}
|
|
10
|
-
var
|
|
10
|
+
var b = di(function(n) {
|
|
11
11
|
const e = new URLSearchParams();
|
|
12
12
|
e.append("code", n);
|
|
13
13
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
@@ -19,11 +19,11 @@ function Ct(...n) {
|
|
|
19
19
|
return e;
|
|
20
20
|
}
|
|
21
21
|
const hi = 100;
|
|
22
|
-
let
|
|
22
|
+
let hn = !1, Mn = 0;
|
|
23
23
|
function gi(n) {
|
|
24
|
-
|
|
24
|
+
Mn = n.timeStamp;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function tn(n, e, t) {
|
|
27
27
|
return e.__lexicalLineBreak === n || n[`__lexicalKey_${t._key}`] !== void 0;
|
|
28
28
|
}
|
|
29
29
|
function _i(n, e, t) {
|
|
@@ -31,7 +31,7 @@ function _i(n, e, t) {
|
|
|
31
31
|
let s = null, i = null;
|
|
32
32
|
r !== null && r.anchorNode === n && (s = r.anchorOffset, i = r.focusOffset);
|
|
33
33
|
const o = n.nodeValue;
|
|
34
|
-
o !== null &&
|
|
34
|
+
o !== null && Rn(e, o, s, i, !1);
|
|
35
35
|
}
|
|
36
36
|
function pi(n, e, t) {
|
|
37
37
|
if (F(n)) {
|
|
@@ -41,70 +41,70 @@ function pi(n, e, t) {
|
|
|
41
41
|
return e.nodeType === Te && t.isAttached();
|
|
42
42
|
}
|
|
43
43
|
function Hr(n, e, t) {
|
|
44
|
-
|
|
45
|
-
const r = performance.now() -
|
|
44
|
+
hn = !0;
|
|
45
|
+
const r = performance.now() - Mn > hi;
|
|
46
46
|
try {
|
|
47
47
|
X(n, () => {
|
|
48
|
-
const s = I() || function(
|
|
49
|
-
return
|
|
48
|
+
const s = I() || function(f) {
|
|
49
|
+
return f.getEditorState().read(() => {
|
|
50
50
|
const d = I();
|
|
51
51
|
return d !== null ? d.clone() : null;
|
|
52
52
|
});
|
|
53
53
|
}(n), i = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState, c = n._blockCursorElement;
|
|
54
|
-
let a = !1,
|
|
55
|
-
for (let
|
|
56
|
-
const d = e[
|
|
57
|
-
let _ =
|
|
54
|
+
let a = !1, u = "";
|
|
55
|
+
for (let f = 0; f < e.length; f++) {
|
|
56
|
+
const d = e[f], g = d.type, p = d.target;
|
|
57
|
+
let _ = Wt(p, l);
|
|
58
58
|
if (!(_ === null && p !== o || A(_))) {
|
|
59
59
|
if (g === "characterData") r && N(_) && pi(s, p, _) && _i(p, _, n);
|
|
60
60
|
else if (g === "childList") {
|
|
61
61
|
a = !0;
|
|
62
62
|
const m = d.addedNodes;
|
|
63
|
-
for (let
|
|
64
|
-
const
|
|
65
|
-
if (P != null &&
|
|
63
|
+
for (let k = 0; k < m.length; k++) {
|
|
64
|
+
const T = m[k], x = Zr(T), P = T.parentNode;
|
|
65
|
+
if (P != null && T !== c && x === null && (T.nodeName !== "BR" || !tn(T, P, n))) {
|
|
66
66
|
if (xe) {
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const C = T.innerText || T.nodeValue;
|
|
68
|
+
C && (u += C);
|
|
69
69
|
}
|
|
70
|
-
P.removeChild(
|
|
70
|
+
P.removeChild(T);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
const y = d.removedNodes,
|
|
74
|
-
if (
|
|
75
|
-
let
|
|
76
|
-
for (let
|
|
77
|
-
const
|
|
78
|
-
(
|
|
73
|
+
const y = d.removedNodes, S = y.length;
|
|
74
|
+
if (S > 0) {
|
|
75
|
+
let k = 0;
|
|
76
|
+
for (let T = 0; T < S; T++) {
|
|
77
|
+
const x = y[T];
|
|
78
|
+
(x.nodeName === "BR" && tn(x, p, n) || c === x) && (p.appendChild(x), k++);
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
S !== k && (p === o && (_ = ts(l)), i.set(p, _));
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
if (i.size > 0) for (const [
|
|
85
|
+
if (i.size > 0) for (const [f, d] of i) if (v(d)) {
|
|
86
86
|
const g = d.getChildrenKeys();
|
|
87
|
-
let p =
|
|
87
|
+
let p = f.firstChild;
|
|
88
88
|
for (let _ = 0; _ < g.length; _++) {
|
|
89
89
|
const m = g[_], y = n.getElementByKey(m);
|
|
90
|
-
y !== null && (p == null ? (
|
|
90
|
+
y !== null && (p == null ? (f.appendChild(y), p = y) : p !== y && f.replaceChild(y, p), p = p.nextSibling);
|
|
91
91
|
}
|
|
92
92
|
} else N(d) && d.markDirty();
|
|
93
93
|
const h = t.takeRecords();
|
|
94
94
|
if (h.length > 0) {
|
|
95
|
-
for (let
|
|
96
|
-
const d = h[
|
|
95
|
+
for (let f = 0; f < h.length; f++) {
|
|
96
|
+
const d = h[f], g = d.addedNodes, p = d.target;
|
|
97
97
|
for (let _ = 0; _ < g.length; _++) {
|
|
98
98
|
const m = g[_], y = m.parentNode;
|
|
99
|
-
y == null || m.nodeName !== "BR" ||
|
|
99
|
+
y == null || m.nodeName !== "BR" || tn(m, p, n) || y.removeChild(m);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
t.takeRecords();
|
|
103
103
|
}
|
|
104
|
-
s !== null && (a && (s.dirty = !0, ue(s)), xe && is(n) && s.insertRawText(
|
|
104
|
+
s !== null && (a && (s.dirty = !0, ue(s)), xe && is(n) && s.insertRawText(u));
|
|
105
105
|
});
|
|
106
106
|
} finally {
|
|
107
|
-
|
|
107
|
+
hn = !1;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
function qr(n) {
|
|
@@ -113,7 +113,7 @@ function qr(n) {
|
|
|
113
113
|
}
|
|
114
114
|
function Qr(n) {
|
|
115
115
|
(function(e) {
|
|
116
|
-
|
|
116
|
+
Mn === 0 && Kt(e).addEventListener("textInput", gi, !0);
|
|
117
117
|
})(n), n._observer = new MutationObserver((e, t) => {
|
|
118
118
|
Hr(n, e, t);
|
|
119
119
|
});
|
|
@@ -162,7 +162,7 @@ function sr(n) {
|
|
|
162
162
|
n.set(r.__key, s ? r.getTextContentSize() : 0, "text");
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
165
|
-
if (!
|
|
165
|
+
if (!v(r)) break;
|
|
166
166
|
n.set(r.__key, s ? r.getChildrenSize() : 0, "element");
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -174,29 +174,29 @@ function Xr(n) {
|
|
|
174
174
|
const e = document.activeElement;
|
|
175
175
|
if (e === null) return !1;
|
|
176
176
|
const t = e.nodeName;
|
|
177
|
-
return A(
|
|
177
|
+
return A(Wt(n)) && (t === "INPUT" || t === "TEXTAREA" || e.contentEditable === "true" && zt(e) == null);
|
|
178
178
|
}
|
|
179
179
|
function Mt(n, e, t) {
|
|
180
180
|
const r = n.getRootElement();
|
|
181
181
|
try {
|
|
182
|
-
return r !== null && r.contains(e) && r.contains(t) && e !== null && !Xr(e) &&
|
|
182
|
+
return r !== null && r.contains(e) && r.contains(t) && e !== null && !Xr(e) && Yr(e) === n;
|
|
183
183
|
} catch {
|
|
184
184
|
return !1;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
return n instanceof
|
|
187
|
+
function zn(n) {
|
|
188
|
+
return n instanceof Yt;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function Yr(n) {
|
|
191
191
|
let e = n;
|
|
192
192
|
for (; e != null; ) {
|
|
193
|
-
const t =
|
|
194
|
-
if (
|
|
193
|
+
const t = zt(e);
|
|
194
|
+
if (zn(t)) return t;
|
|
195
195
|
e = Rt(e);
|
|
196
196
|
}
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function zt(n) {
|
|
200
200
|
return n ? n.__lexicalEditor : null;
|
|
201
201
|
}
|
|
202
202
|
function be(n) {
|
|
@@ -219,14 +219,14 @@ function bt(n, e, t) {
|
|
|
219
219
|
let s = n ^ r;
|
|
220
220
|
return e === "subscript" ? s &= ~ce.superscript : e === "superscript" && (s &= ~ce.subscript), s;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function so(n) {
|
|
223
223
|
return N(n) || Ae(n) || A(n);
|
|
224
224
|
}
|
|
225
225
|
function Gr(n, e) {
|
|
226
226
|
if (e != null) return void (n.__key = e);
|
|
227
227
|
q(), bs();
|
|
228
228
|
const t = M(), r = fe(), s = "" + mi++;
|
|
229
|
-
r._nodeMap.set(s, n),
|
|
229
|
+
r._nodeMap.set(s, n), v(n) ? t._dirtyElements.set(s, !0) : t._dirtyLeaves.add(s), t._cloneNotNeeded.add(s), t._dirtyType = Ur, n.__key = s;
|
|
230
230
|
}
|
|
231
231
|
function Ne(n) {
|
|
232
232
|
const e = n.getParent();
|
|
@@ -262,19 +262,19 @@ function Ne(n) {
|
|
|
262
262
|
function wt(n) {
|
|
263
263
|
bs();
|
|
264
264
|
const e = n.getLatest(), t = e.__parent, r = fe(), s = M(), i = r._nodeMap, o = s._dirtyElements;
|
|
265
|
-
t !== null && function(c, a,
|
|
265
|
+
t !== null && function(c, a, u) {
|
|
266
266
|
let h = c;
|
|
267
267
|
for (; h !== null; ) {
|
|
268
|
-
if (
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
|
|
268
|
+
if (u.has(h)) return;
|
|
269
|
+
const f = a.get(h);
|
|
270
|
+
if (f === void 0) break;
|
|
271
|
+
u.set(h, !1), h = f.__parent;
|
|
272
272
|
}
|
|
273
273
|
}(t, i, o);
|
|
274
274
|
const l = e.__key;
|
|
275
|
-
s._dirtyType = Ur,
|
|
275
|
+
s._dirtyType = Ur, v(n) ? o.set(l, !0) : s._dirtyLeaves.add(l);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function J(n) {
|
|
278
278
|
q();
|
|
279
279
|
const e = M(), t = e._compositionKey;
|
|
280
280
|
if (n !== t) {
|
|
@@ -295,14 +295,14 @@ function V(n, e) {
|
|
|
295
295
|
const t = (e || fe())._nodeMap.get(n);
|
|
296
296
|
return t === void 0 ? null : t;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function Zr(n, e) {
|
|
299
299
|
const t = n[`__lexicalKey_${M()._key}`];
|
|
300
300
|
return t !== void 0 ? V(t, e) : null;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function Wt(n, e) {
|
|
303
303
|
let t = n;
|
|
304
304
|
for (; t != null; ) {
|
|
305
|
-
const r =
|
|
305
|
+
const r = Zr(t, e);
|
|
306
306
|
if (r !== null) return r;
|
|
307
307
|
t = Rt(t);
|
|
308
308
|
}
|
|
@@ -356,24 +356,24 @@ function rs() {
|
|
|
356
356
|
function ss(n) {
|
|
357
357
|
return n.nodeType === Te ? n.nodeValue : null;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Bn(n, e, t) {
|
|
360
360
|
const r = se(e._window);
|
|
361
361
|
if (r === null) return;
|
|
362
362
|
const s = r.anchorNode;
|
|
363
363
|
let { anchorOffset: i, focusOffset: o } = r;
|
|
364
364
|
if (s !== null) {
|
|
365
365
|
let l = ss(s);
|
|
366
|
-
const c =
|
|
366
|
+
const c = Wt(s);
|
|
367
367
|
if (l !== null && N(c)) {
|
|
368
368
|
if (l === At && t) {
|
|
369
369
|
const a = t.length;
|
|
370
370
|
l = t, i = a, o = a;
|
|
371
371
|
}
|
|
372
|
-
l !== null &&
|
|
372
|
+
l !== null && Rn(c, l, i, o, n);
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Rn(n, e, t, r, s) {
|
|
377
377
|
let i = n;
|
|
378
378
|
if (i.isAttached() && (s || !i.isDirty())) {
|
|
379
379
|
const o = i.isComposing();
|
|
@@ -382,7 +382,7 @@ function Bn(n, e, t, r, s) {
|
|
|
382
382
|
const c = i.getTextContent();
|
|
383
383
|
if (s || l !== c) {
|
|
384
384
|
if (l === "") {
|
|
385
|
-
if (
|
|
385
|
+
if (J(null), Nn || It || En) i.remove();
|
|
386
386
|
else {
|
|
387
387
|
const p = M();
|
|
388
388
|
setTimeout(() => {
|
|
@@ -393,12 +393,12 @@ function Bn(n, e, t, r, s) {
|
|
|
393
393
|
}
|
|
394
394
|
return;
|
|
395
395
|
}
|
|
396
|
-
const a = i.getParent(),
|
|
397
|
-
if (i.isToken() ||
|
|
396
|
+
const a = i.getParent(), u = ot(), h = i.getTextContentSize(), f = ye(), d = i.getKey();
|
|
397
|
+
if (i.isToken() || f !== null && d === f && !o || F(u) && (a !== null && !a.canInsertTextBefore() && u.anchor.offset === 0 || u.anchor.key === n.__key && u.anchor.offset === 0 && !i.canInsertTextBefore() && !o || u.focus.key === n.__key && u.focus.offset === h && !i.canInsertTextAfter() && !o)) return void i.markDirty();
|
|
398
398
|
const g = I();
|
|
399
399
|
if (!F(g) || t === null || r === null) return void i.setTextContent(l);
|
|
400
400
|
if (g.setTextNodeRange(i, t, i, r), i.isSegmented()) {
|
|
401
|
-
const p =
|
|
401
|
+
const p = $(i.getTextContent());
|
|
402
402
|
i.replace(p), i = p;
|
|
403
403
|
}
|
|
404
404
|
i.setTextContent(l);
|
|
@@ -411,7 +411,7 @@ function Si(n, e) {
|
|
|
411
411
|
const t = n.anchor.offset, r = e.getParentOrThrow(), s = e.isToken();
|
|
412
412
|
return t === 0 ? !e.canInsertTextBefore() || !r.canInsertTextBefore() && !e.isComposing() || s || function(i) {
|
|
413
413
|
const o = i.getPreviousSibling();
|
|
414
|
-
return (N(o) ||
|
|
414
|
+
return (N(o) || v(o) && o.isInline()) && !o.canInsertTextAfter();
|
|
415
415
|
}(e) : t === e.getTextContentSize() && (!e.canInsertTextAfter() || !r.canInsertTextAfter() && !e.isComposing() || s);
|
|
416
416
|
}
|
|
417
417
|
function lr(n) {
|
|
@@ -421,7 +421,7 @@ function cr(n) {
|
|
|
421
421
|
return n === "ArrowRight";
|
|
422
422
|
}
|
|
423
423
|
function Ve(n, e) {
|
|
424
|
-
return
|
|
424
|
+
return Z ? n : e;
|
|
425
425
|
}
|
|
426
426
|
function ar(n) {
|
|
427
427
|
return n === "Enter";
|
|
@@ -429,13 +429,13 @@ function ar(n) {
|
|
|
429
429
|
function Ke(n) {
|
|
430
430
|
return n === "Backspace";
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function $e(n) {
|
|
433
433
|
return n === "Delete";
|
|
434
434
|
}
|
|
435
435
|
function ur(n, e, t) {
|
|
436
436
|
return n.toLowerCase() === "a" && Ve(e, t);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function io() {
|
|
439
439
|
const n = G();
|
|
440
440
|
ue(yi(n.select(0, n.getChildrenSize())));
|
|
441
441
|
}
|
|
@@ -450,15 +450,15 @@ function qe(n, e) {
|
|
|
450
450
|
}
|
|
451
451
|
return s;
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Kn(n, e, t, r, s) {
|
|
454
454
|
if (t.size === 0) return;
|
|
455
455
|
const i = r.__type, o = r.__key, l = e.get(i);
|
|
456
|
-
l === void 0 &&
|
|
456
|
+
l === void 0 && b(33, i);
|
|
457
457
|
const c = l.klass;
|
|
458
458
|
let a = n.get(c);
|
|
459
459
|
a === void 0 && (a = /* @__PURE__ */ new Map(), n.set(c, a));
|
|
460
|
-
const
|
|
461
|
-
(
|
|
460
|
+
const u = a.get(o), h = u === "destroyed" && s === "created";
|
|
461
|
+
(u === void 0 || h) && a.set(o, h ? "updated" : s);
|
|
462
462
|
}
|
|
463
463
|
function fr(n, e, t) {
|
|
464
464
|
const r = n.getParent();
|
|
@@ -486,11 +486,11 @@ function w(n, e, t) {
|
|
|
486
486
|
return Es(n, e, t);
|
|
487
487
|
}
|
|
488
488
|
function Bt(n) {
|
|
489
|
-
return !
|
|
489
|
+
return !Y(n) && !n.isLastChild() && !n.isInline();
|
|
490
490
|
}
|
|
491
491
|
function Nt(n, e) {
|
|
492
492
|
const t = n._keyToDOMMap.get(e);
|
|
493
|
-
return t === void 0 &&
|
|
493
|
+
return t === void 0 && b(75, e), t;
|
|
494
494
|
}
|
|
495
495
|
function Rt(n) {
|
|
496
496
|
const e = n.assignedSlot || n.parentElement;
|
|
@@ -506,7 +506,7 @@ function Qe(n, e) {
|
|
|
506
506
|
}
|
|
507
507
|
function Kt(n) {
|
|
508
508
|
const e = n._window;
|
|
509
|
-
return e === null &&
|
|
509
|
+
return e === null && b(78), e;
|
|
510
510
|
}
|
|
511
511
|
function Ti(n) {
|
|
512
512
|
let e = n.getParentOrThrow();
|
|
@@ -517,29 +517,29 @@ function Ti(n) {
|
|
|
517
517
|
return e;
|
|
518
518
|
}
|
|
519
519
|
function Pe(n) {
|
|
520
|
-
return
|
|
520
|
+
return Y(n) || v(n) && n.isShadowRoot();
|
|
521
521
|
}
|
|
522
522
|
function Ci(n) {
|
|
523
523
|
const e = n.constructor.clone(n);
|
|
524
524
|
return Gr(e, null), e;
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function $t(n) {
|
|
527
527
|
const e = M(), t = n.constructor.getType(), r = e._nodes.get(t);
|
|
528
|
-
r === void 0 &&
|
|
528
|
+
r === void 0 && b(200, n.constructor.name, t);
|
|
529
529
|
const { replace: s, replaceWithKlass: i } = r;
|
|
530
530
|
if (s !== null) {
|
|
531
531
|
const o = s(n), l = o.constructor;
|
|
532
|
-
return i !== null ? o instanceof i ||
|
|
532
|
+
return i !== null ? o instanceof i || b(201, i.name, i.getType(), l.name, l.getType(), n.constructor.name, t) : o instanceof n.constructor && l !== n.constructor || b(202, l.name, l.getType(), n.constructor.name, t), o.__key === n.__key && b(203, n.constructor.name, t, l.name, l.getType()), o;
|
|
533
533
|
}
|
|
534
534
|
return n;
|
|
535
535
|
}
|
|
536
|
-
function
|
|
537
|
-
!
|
|
536
|
+
function nn(n, e) {
|
|
537
|
+
!Y(n.getParent()) || v(e) || A(e) || b(99);
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
return (A(n) ||
|
|
539
|
+
function rn(n) {
|
|
540
|
+
return (A(n) || v(n) && !n.canBeEmpty()) && !n.isInline();
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function $n(n, e, t) {
|
|
543
543
|
t.style.removeProperty("caret-color"), e._blockCursorElement = null;
|
|
544
544
|
const r = n.parentElement;
|
|
545
545
|
r !== null && r.removeChild(n);
|
|
@@ -550,56 +550,56 @@ function ki(n, e, t) {
|
|
|
550
550
|
const s = t.anchor, i = s.getNode(), o = s.offset;
|
|
551
551
|
let l = !1, c = null;
|
|
552
552
|
if (o === i.getChildrenSize())
|
|
553
|
-
|
|
553
|
+
rn(i.getChildAtIndex(o - 1)) && (l = !0);
|
|
554
554
|
else {
|
|
555
555
|
const a = i.getChildAtIndex(o);
|
|
556
|
-
if (
|
|
557
|
-
const
|
|
558
|
-
(
|
|
556
|
+
if (rn(a)) {
|
|
557
|
+
const u = a.getPreviousSibling();
|
|
558
|
+
(u === null || rn(u)) && (l = !0, c = n.getElementByKey(a.__key));
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
if (l) {
|
|
562
562
|
const a = n.getElementByKey(i.__key);
|
|
563
|
-
return r === null && (n._blockCursorElement = r = function(
|
|
564
|
-
const h =
|
|
565
|
-
|
|
563
|
+
return r === null && (n._blockCursorElement = r = function(u) {
|
|
564
|
+
const h = u.theme, f = document.createElement("div");
|
|
565
|
+
f.contentEditable = "false", f.setAttribute("data-lexical-cursor", "true");
|
|
566
566
|
let d = h.blockCursor;
|
|
567
567
|
if (d !== void 0) {
|
|
568
568
|
if (typeof d == "string") {
|
|
569
569
|
const g = Ct(d);
|
|
570
570
|
d = h.blockCursor = g;
|
|
571
571
|
}
|
|
572
|
-
d !== void 0 &&
|
|
572
|
+
d !== void 0 && f.classList.add(...d);
|
|
573
573
|
}
|
|
574
|
-
return
|
|
574
|
+
return f;
|
|
575
575
|
}(n._config)), e.style.caretColor = "transparent", void (c === null ? a.appendChild(r) : a.insertBefore(r, c));
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
|
-
r !== null &&
|
|
578
|
+
r !== null && $n(r, n, e);
|
|
579
579
|
}
|
|
580
580
|
function se(n) {
|
|
581
581
|
return ne ? (n || window).getSelection() : null;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function oo(n, e) {
|
|
584
584
|
let t = n.getChildAtIndex(e);
|
|
585
|
-
t == null && (t = n), Pe(n) &&
|
|
585
|
+
t == null && (t = n), Pe(n) && b(102);
|
|
586
586
|
const r = (o) => {
|
|
587
587
|
const l = o.getParentOrThrow(), c = Pe(l), a = o !== t || c ? Ci(o) : o;
|
|
588
|
-
if (c) return
|
|
588
|
+
if (c) return v(o) && v(a) || b(133), o.insertAfter(a), [o, a, a];
|
|
589
589
|
{
|
|
590
|
-
const [
|
|
591
|
-
return
|
|
590
|
+
const [u, h, f] = r(l), d = o.getNextSiblings();
|
|
591
|
+
return f.append(a, ...d), [u, h, a];
|
|
592
592
|
}
|
|
593
593
|
}, [s, i] = r(t);
|
|
594
594
|
return [s, i];
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
return
|
|
596
|
+
function lo(n) {
|
|
597
|
+
return Jt(n) && n.tagName === "A";
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Jt(n) {
|
|
600
600
|
return n.nodeType === 1;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function co(n) {
|
|
603
603
|
return n.nodeType === 11;
|
|
604
604
|
}
|
|
605
605
|
function bi(n) {
|
|
@@ -612,22 +612,22 @@ function hr(n) {
|
|
|
612
612
|
}
|
|
613
613
|
function _e(n) {
|
|
614
614
|
if (A(n) && !n.isInline()) return !0;
|
|
615
|
-
if (!
|
|
615
|
+
if (!v(n) || Pe(n)) return !1;
|
|
616
616
|
const e = n.getFirstChild(), t = e === null || Ae(e) || N(e) || e.isInline();
|
|
617
617
|
return !n.isInline() && n.canBeEmpty() !== !1 && t;
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function Je(n, e) {
|
|
620
620
|
let t = n;
|
|
621
621
|
for (; t !== null && t.getParent() !== null && !e(t); ) t = t.getParentOrThrow();
|
|
622
622
|
return e(t) ? t : null;
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function ao() {
|
|
625
625
|
return M();
|
|
626
626
|
}
|
|
627
627
|
const gr = /* @__PURE__ */ new WeakMap(), wi = /* @__PURE__ */ new Map();
|
|
628
628
|
function Ni(n) {
|
|
629
629
|
if (!n._readOnly && n.isEmpty()) return wi;
|
|
630
|
-
n._readOnly ||
|
|
630
|
+
n._readOnly || b(192);
|
|
631
631
|
let e = gr.get(n);
|
|
632
632
|
if (!e) {
|
|
633
633
|
e = /* @__PURE__ */ new Map(), gr.set(n, e);
|
|
@@ -643,27 +643,31 @@ function Ei(n) {
|
|
|
643
643
|
const e = n.constructor.clone(n);
|
|
644
644
|
return e.afterCloneFrom(n), e;
|
|
645
645
|
}
|
|
646
|
+
function Pi(n, e) {
|
|
647
|
+
const t = (parseInt(n.style.paddingInlineStart, 10) || 0) / 40;
|
|
648
|
+
e.setIndent(t);
|
|
649
|
+
}
|
|
646
650
|
function os(n, e, t, r, s, i) {
|
|
647
651
|
let o = n.getFirstChild();
|
|
648
652
|
for (; o !== null; ) {
|
|
649
653
|
const l = o.__key;
|
|
650
|
-
o.__parent === e && (
|
|
654
|
+
o.__parent === e && (v(o) && os(o, l, t, r, s, i), t.has(l) || i.delete(l), s.push(l)), o = o.getNextSibling();
|
|
651
655
|
}
|
|
652
656
|
}
|
|
653
|
-
let Se, H,
|
|
657
|
+
let Se, H, Ze, Ut, gn, _n, Fe, te, pn, et, B = "", j = "", re = null, ee = "", le = "", ls = !1, tt = !1, _t = null;
|
|
654
658
|
function Et(n, e) {
|
|
655
659
|
const t = Fe.get(n);
|
|
656
660
|
if (e !== null) {
|
|
657
|
-
const r =
|
|
661
|
+
const r = xn(n);
|
|
658
662
|
r.parentNode === e && e.removeChild(r);
|
|
659
663
|
}
|
|
660
|
-
if (te.has(n) || H._keyToDOMMap.delete(n),
|
|
664
|
+
if (te.has(n) || H._keyToDOMMap.delete(n), v(t)) {
|
|
661
665
|
const r = Ft(t, Fe);
|
|
662
|
-
|
|
666
|
+
yn(r, 0, r.length - 1, null);
|
|
663
667
|
}
|
|
664
|
-
t !== void 0 &&
|
|
668
|
+
t !== void 0 && Kn(et, Ze, Ut, t, "destroyed");
|
|
665
669
|
}
|
|
666
|
-
function
|
|
670
|
+
function yn(n, e, t, r) {
|
|
667
671
|
let s = e;
|
|
668
672
|
for (; s <= t; ++s) {
|
|
669
673
|
const i = n[s];
|
|
@@ -673,34 +677,34 @@ function pn(n, e, t, r) {
|
|
|
673
677
|
function ke(n, e) {
|
|
674
678
|
n.setProperty("text-align", e);
|
|
675
679
|
}
|
|
676
|
-
const
|
|
680
|
+
const Fi = "40px";
|
|
677
681
|
function cs(n, e) {
|
|
678
682
|
const t = Se.theme.indent;
|
|
679
683
|
if (typeof t == "string") {
|
|
680
684
|
const s = n.classList.contains(t);
|
|
681
685
|
e > 0 && !s ? n.classList.add(t) : e < 1 && s && n.classList.remove(t);
|
|
682
686
|
}
|
|
683
|
-
const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") ||
|
|
687
|
+
const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") || Fi;
|
|
684
688
|
n.style.setProperty("padding-inline-start", e === 0 ? "" : `calc(${e} * ${r})`);
|
|
685
689
|
}
|
|
686
690
|
function as(n, e) {
|
|
687
691
|
const t = n.style;
|
|
688
|
-
e === 0 ? ke(t, "") : e ===
|
|
692
|
+
e === 0 ? ke(t, "") : e === Fn ? ke(t, "left") : e === Dn ? ke(t, "center") : e === Ln ? ke(t, "right") : e === On ? ke(t, "justify") : e === In ? ke(t, "start") : e === An && ke(t, "end");
|
|
689
693
|
}
|
|
690
694
|
function Pt(n, e, t) {
|
|
691
695
|
const r = te.get(n);
|
|
692
|
-
r === void 0 &&
|
|
696
|
+
r === void 0 && b(60);
|
|
693
697
|
const s = r.createDOM(Se, H);
|
|
694
698
|
if (function(i, o, l) {
|
|
695
699
|
const c = l._keyToDOMMap;
|
|
696
700
|
o["__lexicalKey_" + l._key] = i, c.set(i, o);
|
|
697
|
-
}(n, s, H), N(r) ? s.setAttribute("data-lexical-text", "true") : A(r) && s.setAttribute("data-lexical-decorator", "true"),
|
|
701
|
+
}(n, s, H), N(r) ? s.setAttribute("data-lexical-text", "true") : A(r) && s.setAttribute("data-lexical-decorator", "true"), v(r)) {
|
|
698
702
|
const i = r.__indent, o = r.__size;
|
|
699
703
|
if (i !== 0 && cs(s, i), o !== 0) {
|
|
700
704
|
const c = o - 1;
|
|
701
|
-
(function(a,
|
|
705
|
+
(function(a, u, h, f) {
|
|
702
706
|
const d = j;
|
|
703
|
-
j = "",
|
|
707
|
+
j = "", mn(a, h, 0, u, f, null), fs(h, f), j = d;
|
|
704
708
|
})(Ft(r, te), c, r, s);
|
|
705
709
|
}
|
|
706
710
|
const l = r.__format;
|
|
@@ -718,9 +722,9 @@ function Pt(n, e, t) {
|
|
|
718
722
|
const i = e.__lexicalLineBreak;
|
|
719
723
|
i != null ? e.insertBefore(s, i) : e.appendChild(s);
|
|
720
724
|
}
|
|
721
|
-
return
|
|
725
|
+
return Kn(et, Ze, Ut, r, "created"), s;
|
|
722
726
|
}
|
|
723
|
-
function
|
|
727
|
+
function mn(n, e, t, r, s, i) {
|
|
724
728
|
const o = B;
|
|
725
729
|
B = "";
|
|
726
730
|
let l = t;
|
|
@@ -762,7 +766,7 @@ function fs(n, e) {
|
|
|
762
766
|
const i = j === "", o = i ? _t : (s = j, oi.test(s) ? "rtl" : li.test(s) ? "ltr" : null);
|
|
763
767
|
if (o !== r) {
|
|
764
768
|
const l = e.classList, c = Se.theme;
|
|
765
|
-
let a = r !== null ? c[r] : void 0,
|
|
769
|
+
let a = r !== null ? c[r] : void 0, u = o !== null ? c[o] : void 0;
|
|
766
770
|
if (a !== void 0) {
|
|
767
771
|
if (typeof a == "string") {
|
|
768
772
|
const h = Ct(a);
|
|
@@ -772,12 +776,12 @@ function fs(n, e) {
|
|
|
772
776
|
}
|
|
773
777
|
if (o === null || i && o === "ltr") e.removeAttribute("dir");
|
|
774
778
|
else {
|
|
775
|
-
if (
|
|
776
|
-
if (typeof
|
|
777
|
-
const h = Ct(
|
|
778
|
-
|
|
779
|
+
if (u !== void 0) {
|
|
780
|
+
if (typeof u == "string") {
|
|
781
|
+
const h = Ct(u);
|
|
782
|
+
u = c[o] = h;
|
|
779
783
|
}
|
|
780
|
-
|
|
784
|
+
u !== void 0 && l.add(...u);
|
|
781
785
|
}
|
|
782
786
|
e.dir = o;
|
|
783
787
|
}
|
|
@@ -787,65 +791,65 @@ function fs(n, e) {
|
|
|
787
791
|
}
|
|
788
792
|
var s;
|
|
789
793
|
}
|
|
790
|
-
function
|
|
794
|
+
function Di(n, e, t) {
|
|
791
795
|
const r = j;
|
|
792
796
|
var s;
|
|
793
797
|
j = "", re = null, ee = "", function(i, o, l) {
|
|
794
|
-
const c = B, a = i.__size,
|
|
795
|
-
if (B = "", a === 1 &&
|
|
796
|
-
const h = i.__first,
|
|
797
|
-
if (h ===
|
|
798
|
+
const c = B, a = i.__size, u = o.__size;
|
|
799
|
+
if (B = "", a === 1 && u === 1) {
|
|
800
|
+
const h = i.__first, f = o.__first;
|
|
801
|
+
if (h === f) je(h, l);
|
|
798
802
|
else {
|
|
799
|
-
const g =
|
|
803
|
+
const g = xn(h), p = Pt(f, null, null);
|
|
800
804
|
try {
|
|
801
805
|
l.replaceChild(p, g);
|
|
802
806
|
} catch (_) {
|
|
803
807
|
if (typeof _ == "object" && _ != null) {
|
|
804
|
-
const m = `${_.toString()} Parent: ${l.tagName}, new child: {tag: ${p.tagName} key: ${
|
|
808
|
+
const m = `${_.toString()} Parent: ${l.tagName}, new child: {tag: ${p.tagName} key: ${f}}, old child: {tag: ${g.tagName}, key: ${h}}.`;
|
|
805
809
|
throw new Error(m);
|
|
806
810
|
}
|
|
807
811
|
throw _;
|
|
808
812
|
}
|
|
809
813
|
Et(h, null);
|
|
810
814
|
}
|
|
811
|
-
const d = te.get(
|
|
815
|
+
const d = te.get(f);
|
|
812
816
|
N(d) && (re === null && (re = d.getFormat()), ee === "" && (ee = d.getStyle()));
|
|
813
817
|
} else {
|
|
814
|
-
const h = Ft(i, Fe),
|
|
815
|
-
if (a === 0)
|
|
816
|
-
else if (
|
|
818
|
+
const h = Ft(i, Fe), f = Ft(o, te);
|
|
819
|
+
if (a === 0) u !== 0 && mn(f, o, 0, u - 1, l, null);
|
|
820
|
+
else if (u === 0) {
|
|
817
821
|
if (a !== 0) {
|
|
818
822
|
const d = l.__lexicalLineBreak == null;
|
|
819
|
-
|
|
823
|
+
yn(h, 0, a - 1, d ? null : l), d && (l.textContent = "");
|
|
820
824
|
}
|
|
821
825
|
} else (function(d, g, p, _, m, y) {
|
|
822
|
-
const
|
|
823
|
-
let
|
|
824
|
-
for (var D;
|
|
825
|
-
const L = g[
|
|
826
|
-
if (L === U) P =
|
|
826
|
+
const S = _ - 1, k = m - 1;
|
|
827
|
+
let T, x, P = (D = y, D.firstChild), C = 0, E = 0;
|
|
828
|
+
for (var D; C <= S && E <= k; ) {
|
|
829
|
+
const L = g[C], U = p[E];
|
|
830
|
+
if (L === U) P = sn(je(U, y)), C++, E++;
|
|
827
831
|
else {
|
|
828
|
-
|
|
829
|
-
const de =
|
|
832
|
+
T === void 0 && (T = new Set(g)), x === void 0 && (x = new Set(p));
|
|
833
|
+
const de = x.has(L), De = T.has(U);
|
|
830
834
|
if (de) if (De) {
|
|
831
835
|
const Be = Nt(H, U);
|
|
832
|
-
Be === P ? P =
|
|
836
|
+
Be === P ? P = sn(je(U, y)) : (P != null ? y.insertBefore(Be, P) : y.appendChild(Be), je(U, y)), C++, E++;
|
|
833
837
|
} else Pt(U, y, P), E++;
|
|
834
|
-
else P =
|
|
838
|
+
else P = sn(xn(L)), Et(L, y), C++;
|
|
835
839
|
}
|
|
836
|
-
const
|
|
837
|
-
|
|
840
|
+
const W = te.get(U);
|
|
841
|
+
W !== null && N(W) && (re === null && (re = W.getFormat()), ee === "" && (ee = W.getStyle()));
|
|
838
842
|
}
|
|
839
|
-
const O =
|
|
840
|
-
if (O && !
|
|
841
|
-
const L = p[
|
|
842
|
-
|
|
843
|
-
} else
|
|
844
|
-
})(o, h,
|
|
843
|
+
const O = C > S, z = E > k;
|
|
844
|
+
if (O && !z) {
|
|
845
|
+
const L = p[k + 1];
|
|
846
|
+
mn(p, d, E, k, y, L === void 0 ? null : H.getElementByKey(L));
|
|
847
|
+
} else z && !O && yn(g, C, S, y);
|
|
848
|
+
})(o, h, f, a, u, l);
|
|
845
849
|
}
|
|
846
850
|
Bt(o) && (B += ae), l.__lexicalTextContent = B, B = c + B;
|
|
847
|
-
}(n, e, t), fs(e, t),
|
|
848
|
-
|
|
851
|
+
}(n, e, t), fs(e, t), bn(s = e) && re != null && re !== s.__textFormat && !tt && (s.setTextFormat(re), s.setTextStyle(ee)), function(i) {
|
|
852
|
+
bn(i) && ee !== "" && ee !== i.__textStyle && !tt && i.setTextStyle(ee);
|
|
849
853
|
}(e), j = r;
|
|
850
854
|
}
|
|
851
855
|
function Ft(n, e) {
|
|
@@ -853,17 +857,17 @@ function Ft(n, e) {
|
|
|
853
857
|
let r = n.__first;
|
|
854
858
|
for (; r !== null; ) {
|
|
855
859
|
const s = e.get(r);
|
|
856
|
-
s === void 0 &&
|
|
860
|
+
s === void 0 && b(101), t.push(r), r = s.__next;
|
|
857
861
|
}
|
|
858
862
|
return t;
|
|
859
863
|
}
|
|
860
864
|
function je(n, e) {
|
|
861
865
|
const t = Fe.get(n);
|
|
862
866
|
let r = te.get(n);
|
|
863
|
-
t !== void 0 && r !== void 0 ||
|
|
864
|
-
const s = ls ||
|
|
867
|
+
t !== void 0 && r !== void 0 || b(61);
|
|
868
|
+
const s = ls || _n.has(n) || gn.has(n), i = Nt(H, n);
|
|
865
869
|
if (t === r && !s) {
|
|
866
|
-
if (
|
|
870
|
+
if (v(t)) {
|
|
867
871
|
const o = i.__lexicalTextContent;
|
|
868
872
|
o !== void 0 && (B += o, le += o);
|
|
869
873
|
const l = i.__lexicalDirTextContent;
|
|
@@ -874,15 +878,15 @@ function je(n, e) {
|
|
|
874
878
|
}
|
|
875
879
|
return i;
|
|
876
880
|
}
|
|
877
|
-
if (t !== r && s &&
|
|
881
|
+
if (t !== r && s && Kn(et, Ze, Ut, r, "updated"), r.updateDOM(t, i, Se)) {
|
|
878
882
|
const o = Pt(n, null, null);
|
|
879
|
-
return e === null &&
|
|
883
|
+
return e === null && b(62), e.replaceChild(o, i), Et(n, null), o;
|
|
880
884
|
}
|
|
881
|
-
if (
|
|
885
|
+
if (v(t) && v(r)) {
|
|
882
886
|
const o = r.__indent;
|
|
883
887
|
o !== t.__indent && cs(i, o);
|
|
884
888
|
const l = r.__format;
|
|
885
|
-
l !== t.__format && as(i, l), s && (
|
|
889
|
+
l !== t.__format && as(i, l), s && (Di(t, r, i), Y(r) || r.isInline() || us(t, r, i)), Bt(r) && (B += ae, le += ae);
|
|
886
890
|
} else {
|
|
887
891
|
const o = r.getTextContent();
|
|
888
892
|
if (A(r)) {
|
|
@@ -891,7 +895,7 @@ function je(n, e) {
|
|
|
891
895
|
} else N(r) && !r.isDirectionless() && (j += o);
|
|
892
896
|
B += o, le += o;
|
|
893
897
|
}
|
|
894
|
-
if (!tt &&
|
|
898
|
+
if (!tt && Y(r) && r.__cachedText !== le) {
|
|
895
899
|
const o = r.getWritable();
|
|
896
900
|
o.__cachedText = le, r = o;
|
|
897
901
|
}
|
|
@@ -906,109 +910,109 @@ function ds(n, e) {
|
|
|
906
910
|
}
|
|
907
911
|
t[n] = e;
|
|
908
912
|
}
|
|
909
|
-
function
|
|
913
|
+
function sn(n) {
|
|
910
914
|
let e = n.nextSibling;
|
|
911
915
|
return e !== null && e === H._blockCursorElement && (e = e.nextSibling), e;
|
|
912
916
|
}
|
|
913
|
-
function
|
|
914
|
-
B = "", le = "", j = "", ls = r === Me, _t = null, H = t, Se = t._config,
|
|
917
|
+
function Li(n, e, t, r, s, i) {
|
|
918
|
+
B = "", le = "", j = "", ls = r === Me, _t = null, H = t, Se = t._config, Ze = t._nodes, Ut = H._listeners.mutation, gn = s, _n = i, Fe = n._nodeMap, te = e._nodeMap, tt = e._readOnly, pn = new Map(t._keyToDOMMap);
|
|
915
919
|
const o = /* @__PURE__ */ new Map();
|
|
916
|
-
return et = o, je("root", null), H = void 0,
|
|
920
|
+
return et = o, je("root", null), H = void 0, Ze = void 0, gn = void 0, _n = void 0, Fe = void 0, te = void 0, Se = void 0, pn = void 0, et = void 0, o;
|
|
917
921
|
}
|
|
918
|
-
function
|
|
919
|
-
const e =
|
|
920
|
-
return e === void 0 &&
|
|
922
|
+
function xn(n) {
|
|
923
|
+
const e = pn.get(n);
|
|
924
|
+
return e === void 0 && b(75, n), e;
|
|
921
925
|
}
|
|
922
|
-
const oe = Object.freeze({}),
|
|
926
|
+
const oe = Object.freeze({}), vn = 30, Sn = [["keydown", function(n, e) {
|
|
923
927
|
if (Xe = n.timeStamp, hs = n.key, e.isComposing()) return;
|
|
924
928
|
const { key: t, shiftKey: r, ctrlKey: s, metaKey: i, altKey: o } = n;
|
|
925
|
-
w(e, Os, n) || t != null && (function(l, c, a,
|
|
926
|
-
return cr(l) && !c && !
|
|
927
|
-
}(t, s, o, i) ? w(e, Is, n) : function(l, c, a,
|
|
928
|
-
return cr(l) && !
|
|
929
|
-
}(t, s, r, o, i) ? w(e, As, n) : function(l, c, a,
|
|
930
|
-
return lr(l) && !c && !
|
|
931
|
-
}(t, s, o, i) ? w(e, Ms, n) : function(l, c, a,
|
|
932
|
-
return lr(l) && !
|
|
933
|
-
}(t, s, r, o, i) ? w(e,
|
|
934
|
-
return /* @__PURE__ */ function(
|
|
935
|
-
return
|
|
929
|
+
w(e, Os, n) || t != null && (function(l, c, a, u) {
|
|
930
|
+
return cr(l) && !c && !u && !a;
|
|
931
|
+
}(t, s, o, i) ? w(e, Is, n) : function(l, c, a, u, h) {
|
|
932
|
+
return cr(l) && !u && !a && (c || h);
|
|
933
|
+
}(t, s, r, o, i) ? w(e, As, n) : function(l, c, a, u) {
|
|
934
|
+
return lr(l) && !c && !u && !a;
|
|
935
|
+
}(t, s, o, i) ? w(e, Ms, n) : function(l, c, a, u, h) {
|
|
936
|
+
return lr(l) && !u && !a && (c || h);
|
|
937
|
+
}(t, s, r, o, i) ? w(e, zs, n) : /* @__PURE__ */ function(l, c, a) {
|
|
938
|
+
return /* @__PURE__ */ function(u) {
|
|
939
|
+
return u === "ArrowUp";
|
|
936
940
|
}(l) && !c && !a;
|
|
937
|
-
}(t, s, i) ? w(e,
|
|
938
|
-
return /* @__PURE__ */ function(
|
|
939
|
-
return
|
|
941
|
+
}(t, s, i) ? w(e, Ws, n) : /* @__PURE__ */ function(l, c, a) {
|
|
942
|
+
return /* @__PURE__ */ function(u) {
|
|
943
|
+
return u === "ArrowDown";
|
|
940
944
|
}(l) && !c && !a;
|
|
941
945
|
}(t, s, i) ? w(e, Bs, n) : function(l, c) {
|
|
942
946
|
return ar(l) && c;
|
|
943
|
-
}(t, r) ? (
|
|
947
|
+
}(t, r) ? (Ye = !0, w(e, dn, n)) : /* @__PURE__ */ function(l) {
|
|
944
948
|
return l === " ";
|
|
945
949
|
}(t) ? w(e, Rs, n) : function(l, c) {
|
|
946
|
-
return
|
|
947
|
-
}(t, s) ? (n.preventDefault(),
|
|
950
|
+
return Z && c && l.toLowerCase() === "o";
|
|
951
|
+
}(t, s) ? (n.preventDefault(), Ye = !0, w(e, gt, !0)) : function(l, c) {
|
|
948
952
|
return ar(l) && !c;
|
|
949
|
-
}(t, r) ? (
|
|
950
|
-
return
|
|
953
|
+
}(t, r) ? (Ye = !1, w(e, dn, n)) : function(l, c, a, u) {
|
|
954
|
+
return Z ? !c && !a && (Ke(l) || l.toLowerCase() === "h" && u) : !(u || c || a) && Ke(l);
|
|
951
955
|
}(t, o, i, s) ? Ke(t) ? w(e, Ks, n) : (n.preventDefault(), w(e, yt, !0)) : /* @__PURE__ */ function(l) {
|
|
952
956
|
return l === "Escape";
|
|
953
|
-
}(t) ? w(e,
|
|
954
|
-
return
|
|
955
|
-
}(t, s, r, o, i) ?
|
|
956
|
-
return Ke(l) && (
|
|
957
|
+
}(t) ? w(e, $s, n) : function(l, c, a, u, h) {
|
|
958
|
+
return Z ? !(a || u || h) && ($e(l) || l.toLowerCase() === "d" && c) : !(c || u || h) && $e(l);
|
|
959
|
+
}(t, s, r, o, i) ? $e(t) ? w(e, Js, n) : (n.preventDefault(), w(e, yt, !1)) : function(l, c, a) {
|
|
960
|
+
return Ke(l) && (Z ? c : a);
|
|
957
961
|
}(t, o, s) ? (n.preventDefault(), w(e, mt, !0)) : function(l, c, a) {
|
|
958
|
-
return
|
|
962
|
+
return $e(l) && (Z ? c : a);
|
|
959
963
|
}(t, o, s) ? (n.preventDefault(), w(e, mt, !1)) : function(l, c) {
|
|
960
|
-
return
|
|
964
|
+
return Z && c && Ke(l);
|
|
961
965
|
}(t, i) ? (n.preventDefault(), w(e, xt, !0)) : function(l, c) {
|
|
962
|
-
return
|
|
963
|
-
}(t, i) ? (n.preventDefault(), w(e, xt, !1)) : function(l, c, a,
|
|
964
|
-
return l.toLowerCase() === "b" && !c && Ve(a,
|
|
965
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "bold")) : function(l, c, a,
|
|
966
|
-
return l.toLowerCase() === "u" && !c && Ve(a,
|
|
967
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "underline")) : function(l, c, a,
|
|
968
|
-
return l.toLowerCase() === "i" && !c && Ve(a,
|
|
969
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "italic")) : /* @__PURE__ */ function(l, c, a,
|
|
970
|
-
return l === "Tab" && !c && !a && !
|
|
971
|
-
}(t, o, s, i) ? w(e, Us, n) : function(l, c, a,
|
|
972
|
-
return l.toLowerCase() === "z" && !c && Ve(a,
|
|
973
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Br, void 0)) : function(l, c, a,
|
|
974
|
-
return
|
|
975
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Rr, void 0)) :
|
|
976
|
-
return !c && l.toLowerCase() === "c" && (
|
|
977
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Kr, n)) : function(l, c, a,
|
|
978
|
-
return !c && l.toLowerCase() === "x" && (
|
|
979
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e,
|
|
980
|
-
return l || c || a ||
|
|
981
|
-
}(s, r, o, i) && w(e,
|
|
966
|
+
return Z && c && $e(l);
|
|
967
|
+
}(t, i) ? (n.preventDefault(), w(e, xt, !1)) : function(l, c, a, u) {
|
|
968
|
+
return l.toLowerCase() === "b" && !c && Ve(a, u);
|
|
969
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "bold")) : function(l, c, a, u) {
|
|
970
|
+
return l.toLowerCase() === "u" && !c && Ve(a, u);
|
|
971
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "underline")) : function(l, c, a, u) {
|
|
972
|
+
return l.toLowerCase() === "i" && !c && Ve(a, u);
|
|
973
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "italic")) : /* @__PURE__ */ function(l, c, a, u) {
|
|
974
|
+
return l === "Tab" && !c && !a && !u;
|
|
975
|
+
}(t, o, s, i) ? w(e, Us, n) : function(l, c, a, u) {
|
|
976
|
+
return l.toLowerCase() === "z" && !c && Ve(a, u);
|
|
977
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Br, void 0)) : function(l, c, a, u) {
|
|
978
|
+
return Z ? l.toLowerCase() === "z" && a && c : l.toLowerCase() === "y" && u || l.toLowerCase() === "z" && u && c;
|
|
979
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Rr, void 0)) : Ht(e._editorState._selection) ? function(l, c, a, u) {
|
|
980
|
+
return !c && l.toLowerCase() === "c" && (Z ? a : u);
|
|
981
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Kr, n)) : function(l, c, a, u) {
|
|
982
|
+
return !c && l.toLowerCase() === "x" && (Z ? a : u);
|
|
983
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, $r, n)) : ur(t, i, s) && (n.preventDefault(), w(e, Zn, n)) : !xe && ur(t, i, s) && (n.preventDefault(), w(e, Zn, n)), /* @__PURE__ */ function(l, c, a, u) {
|
|
984
|
+
return l || c || a || u;
|
|
985
|
+
}(s, r, o, i) && w(e, Ys, n));
|
|
982
986
|
}], ["pointerdown", function(n, e) {
|
|
983
987
|
const t = n.target, r = n.pointerType;
|
|
984
988
|
t instanceof Node && r !== "touch" && X(e, () => {
|
|
985
|
-
A(
|
|
989
|
+
A(Wt(t)) || (Cn = !0);
|
|
986
990
|
});
|
|
987
991
|
}], ["compositionstart", function(n, e) {
|
|
988
992
|
X(e, () => {
|
|
989
993
|
const t = I();
|
|
990
994
|
if (F(t) && !e.isComposing()) {
|
|
991
995
|
const r = t.anchor, s = t.anchor.getNode();
|
|
992
|
-
|
|
996
|
+
J(r.key), (n.timeStamp < Xe + vn || r.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || N(s) && s.getStyle() !== t.style) && w(e, He, ii);
|
|
993
997
|
}
|
|
994
998
|
});
|
|
995
999
|
}], ["compositionend", function(n, e) {
|
|
996
1000
|
xe ? Ue = !0 : X(e, () => {
|
|
997
|
-
|
|
1001
|
+
on(e, n.data);
|
|
998
1002
|
});
|
|
999
1003
|
}], ["input", function(n, e) {
|
|
1000
1004
|
n.stopPropagation(), X(e, () => {
|
|
1001
1005
|
const t = I(), r = n.data, s = ys(n);
|
|
1002
1006
|
if (r != null && F(t) && ps(t, s, r, n.timeStamp, !1)) {
|
|
1003
|
-
Ue && (
|
|
1007
|
+
Ue && (on(e, r), Ue = !1);
|
|
1004
1008
|
const i = t.anchor.getNode(), o = se(e._window);
|
|
1005
1009
|
if (o === null) return;
|
|
1006
1010
|
const l = t.isBackward(), c = l ? t.anchor.offset : t.focus.offset, a = l ? t.focus.offset : t.anchor.offset;
|
|
1007
1011
|
vt && !t.isCollapsed() && N(i) && o.anchorNode !== null && i.getTextContent().slice(0, c) + r + i.getTextContent().slice(c + a) === ss(o.anchorNode) || w(e, He, r);
|
|
1008
|
-
const
|
|
1009
|
-
xe &&
|
|
1012
|
+
const u = r.length;
|
|
1013
|
+
xe && u > 1 && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= u), Nn || It || En || !e.isComposing() || (Xe = 0, J(null));
|
|
1010
1014
|
} else
|
|
1011
|
-
|
|
1015
|
+
Bn(!1, e, r !== null ? r : void 0), Ue && (on(e, r || void 0), Ue = !1);
|
|
1012
1016
|
q(), qr(M());
|
|
1013
1017
|
}), Le = null;
|
|
1014
1018
|
}], ["click", function(n, e) {
|
|
@@ -1017,19 +1021,19 @@ const oe = Object.freeze({}), xn = 30, vn = [["keydown", function(n, e) {
|
|
|
1017
1021
|
if (r) {
|
|
1018
1022
|
if (F(t)) {
|
|
1019
1023
|
const i = t.anchor, o = i.getNode();
|
|
1020
|
-
i.type === "element" && i.offset === 0 && t.isCollapsed() && !
|
|
1024
|
+
i.type === "element" && i.offset === 0 && t.isCollapsed() && !Y(o) && G().getChildrenSize() === 1 && o.getTopLevelElementOrThrow().isEmpty() && s !== null && t.is(s) ? (r.removeAllRanges(), t.dirty = !0) : n.detail === 3 && !t.isCollapsed() && o !== t.focus.getNode() && (v(o) ? o.select(0) : o.getParentOrThrow().select(0));
|
|
1021
1025
|
} else if (n.pointerType === "touch") {
|
|
1022
1026
|
const i = r.anchorNode;
|
|
1023
1027
|
if (i !== null) {
|
|
1024
1028
|
const o = i.nodeType;
|
|
1025
|
-
(o === rt || o === Te) && ue(
|
|
1029
|
+
(o === rt || o === Te) && ue(qt(s, r, e, n));
|
|
1026
1030
|
}
|
|
1027
1031
|
}
|
|
1028
1032
|
}
|
|
1029
1033
|
w(e, Ls, n);
|
|
1030
1034
|
});
|
|
1031
1035
|
}], ["cut", oe], ["copy", oe], ["dragstart", oe], ["dragover", oe], ["dragend", oe], ["paste", oe], ["focus", oe], ["blur", oe], ["drop", oe]];
|
|
1032
|
-
vt &&
|
|
1036
|
+
vt && Sn.push(["beforeinput", (n, e) => function(t, r) {
|
|
1033
1037
|
const s = t.inputType, i = ys(t);
|
|
1034
1038
|
s === "deleteCompositionText" || xe && is(r) || s !== "insertCompositionText" && X(r, () => {
|
|
1035
1039
|
const o = I();
|
|
@@ -1041,17 +1045,17 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1041
1045
|
}
|
|
1042
1046
|
if (F(o)) {
|
|
1043
1047
|
const d = o.anchor.key === o.focus.key;
|
|
1044
|
-
if (l = t.timeStamp, hs === "MediaLast" && l < Xe +
|
|
1045
|
-
if (
|
|
1048
|
+
if (l = t.timeStamp, hs === "MediaLast" && l < Xe + vn && r.isComposing() && d) {
|
|
1049
|
+
if (J(null), Xe = 0, setTimeout(() => {
|
|
1046
1050
|
X(r, () => {
|
|
1047
|
-
|
|
1051
|
+
J(null);
|
|
1048
1052
|
});
|
|
1049
|
-
},
|
|
1053
|
+
}, vn), F(o)) {
|
|
1050
1054
|
const g = o.anchor.getNode();
|
|
1051
|
-
g.markDirty(), o.format = g.getFormat(), N(g) ||
|
|
1055
|
+
g.markDirty(), o.format = g.getFormat(), N(g) || b(142), o.style = g.getStyle();
|
|
1052
1056
|
}
|
|
1053
1057
|
} else {
|
|
1054
|
-
|
|
1058
|
+
J(null), t.preventDefault();
|
|
1055
1059
|
const g = o.anchor.getNode().getTextContent(), p = o.anchor.offset === 0 && o.focus.offset === g.length;
|
|
1056
1060
|
ei && d && !p || w(r, yt, !0);
|
|
1057
1061
|
}
|
|
@@ -1061,8 +1065,8 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1061
1065
|
var l;
|
|
1062
1066
|
if (!F(o)) return;
|
|
1063
1067
|
const c = t.data;
|
|
1064
|
-
Le !== null &&
|
|
1065
|
-
const a = o.anchor,
|
|
1068
|
+
Le !== null && Bn(!1, r, Le), o.dirty && Le === null || !o.isCollapsed() || Y(o.anchor.getNode()) || i === null || o.applyDOMRange(i), Le = null;
|
|
1069
|
+
const a = o.anchor, u = o.focus, h = a.getNode(), f = u.getNode();
|
|
1066
1070
|
if (s !== "insertText" && s !== "insertTranspose") switch (t.preventDefault(), s) {
|
|
1067
1071
|
case "insertFromYank":
|
|
1068
1072
|
case "insertFromDrop":
|
|
@@ -1070,22 +1074,22 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1070
1074
|
w(r, He, t);
|
|
1071
1075
|
break;
|
|
1072
1076
|
case "insertFromComposition":
|
|
1073
|
-
|
|
1077
|
+
J(null), w(r, He, t);
|
|
1074
1078
|
break;
|
|
1075
1079
|
case "insertLineBreak":
|
|
1076
|
-
|
|
1080
|
+
J(null), w(r, gt, !1);
|
|
1077
1081
|
break;
|
|
1078
1082
|
case "insertParagraph":
|
|
1079
|
-
|
|
1083
|
+
J(null), Ye && !It ? (Ye = !1, w(r, gt, !1)) : w(r, Yn, void 0);
|
|
1080
1084
|
break;
|
|
1081
1085
|
case "insertFromPaste":
|
|
1082
1086
|
case "insertFromPasteAsQuotation":
|
|
1083
|
-
w(r,
|
|
1087
|
+
w(r, Wr, t);
|
|
1084
1088
|
break;
|
|
1085
1089
|
case "deleteByComposition":
|
|
1086
1090
|
(function(d, g) {
|
|
1087
|
-
return d !== g ||
|
|
1088
|
-
})(h,
|
|
1091
|
+
return d !== g || v(d) || v(g) || !d.isToken() || !g.isToken();
|
|
1092
|
+
})(h, f) && w(r, Gn, t);
|
|
1089
1093
|
break;
|
|
1090
1094
|
case "deleteByDrag":
|
|
1091
1095
|
case "deleteByCut":
|
|
@@ -1130,7 +1134,7 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1130
1134
|
else {
|
|
1131
1135
|
if (c === `
|
|
1132
1136
|
`) t.preventDefault(), w(r, gt, !1);
|
|
1133
|
-
else if (c === ae) t.preventDefault(), w(r,
|
|
1137
|
+
else if (c === ae) t.preventDefault(), w(r, Yn, void 0);
|
|
1134
1138
|
else if (c == null && t.dataTransfer) {
|
|
1135
1139
|
const d = t.dataTransfer.getData("text/plain");
|
|
1136
1140
|
t.preventDefault(), o.insertRawText(d);
|
|
@@ -1141,17 +1145,17 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1141
1145
|
}(n, e)]);
|
|
1142
1146
|
let Xe = 0, hs = null, gs = 0, Le = null;
|
|
1143
1147
|
const Dt = /* @__PURE__ */ new WeakMap();
|
|
1144
|
-
let
|
|
1148
|
+
let Tn = !1, Cn = !1, Ye = !1, Ue = !1, _s = [0, "", 0, "root", 0];
|
|
1145
1149
|
function ps(n, e, t, r, s) {
|
|
1146
|
-
const i = n.anchor, o = n.focus, l = i.getNode(), c = M(), a = se(c._window),
|
|
1147
|
-
return h !== o.key || !N(l) || (!s && (!vt || gs < r + 50) || l.isDirty() && d < 2 || ns(t)) && i.offset !== o.offset && !l.isComposing() || be(l) || l.isDirty() && d > 1 || (s || !vt) &&
|
|
1150
|
+
const i = n.anchor, o = n.focus, l = i.getNode(), c = M(), a = se(c._window), u = a !== null ? a.anchorNode : null, h = i.key, f = c.getElementByKey(h), d = t.length;
|
|
1151
|
+
return h !== o.key || !N(l) || (!s && (!vt || gs < r + 50) || l.isDirty() && d < 2 || ns(t)) && i.offset !== o.offset && !l.isComposing() || be(l) || l.isDirty() && d > 1 || (s || !vt) && f !== null && !l.isComposing() && u !== kt(f) || a !== null && e !== null && (!e.collapsed || e.startContainer !== a.anchorNode || e.startOffset !== a.anchorOffset) || l.getFormat() !== n.format || l.getStyle() !== n.style || Si(n, l);
|
|
1148
1152
|
}
|
|
1149
1153
|
function pr(n, e) {
|
|
1150
1154
|
return n !== null && n.nodeValue !== null && n.nodeType === Te && e !== 0 && e !== n.nodeValue.length;
|
|
1151
1155
|
}
|
|
1152
1156
|
function yr(n, e, t) {
|
|
1153
1157
|
const { anchorNode: r, anchorOffset: s, focusNode: i, focusOffset: o } = n;
|
|
1154
|
-
|
|
1158
|
+
Tn && (Tn = !1, pr(r, s) && pr(i, o)) || X(e, () => {
|
|
1155
1159
|
if (!t) return void ue(null);
|
|
1156
1160
|
if (!Mt(e, r, i)) return;
|
|
1157
1161
|
const l = I();
|
|
@@ -1159,24 +1163,24 @@ function yr(n, e, t) {
|
|
|
1159
1163
|
const c = l.anchor, a = c.getNode();
|
|
1160
1164
|
if (l.isCollapsed()) {
|
|
1161
1165
|
n.type === "Range" && n.anchorNode === n.focusNode && (l.dirty = !0);
|
|
1162
|
-
const
|
|
1163
|
-
if (h < _ + 200 && c.offset === g && c.key === p) l.format =
|
|
1164
|
-
else if (c.type === "text") N(a) ||
|
|
1166
|
+
const u = Kt(e).event, h = u ? u.timeStamp : performance.now(), [f, d, g, p, _] = _s, m = G(), y = e.isComposing() === !1 && m.getTextContent() === "";
|
|
1167
|
+
if (h < _ + 200 && c.offset === g && c.key === p) l.format = f, l.style = d;
|
|
1168
|
+
else if (c.type === "text") N(a) || b(141), l.format = a.getFormat(), l.style = a.getStyle();
|
|
1165
1169
|
else if (c.type === "element" && !y) {
|
|
1166
|
-
const
|
|
1167
|
-
l.style = "",
|
|
1170
|
+
const S = c.getNode();
|
|
1171
|
+
l.style = "", S instanceof We && S.getChildrenSize() === 0 ? (l.format = S.getTextFormat(), l.style = S.getTextStyle()) : l.format = 0;
|
|
1168
1172
|
}
|
|
1169
1173
|
} else {
|
|
1170
|
-
const
|
|
1171
|
-
let
|
|
1172
|
-
for (let
|
|
1173
|
-
const
|
|
1174
|
-
if (N(
|
|
1174
|
+
const u = c.key, h = l.focus.key, f = l.getNodes(), d = f.length, g = l.isBackward(), p = g ? o : s, _ = g ? s : o, m = g ? h : u, y = g ? u : h;
|
|
1175
|
+
let S = si, k = !1;
|
|
1176
|
+
for (let T = 0; T < d; T++) {
|
|
1177
|
+
const x = f[T], P = x.getTextContentSize();
|
|
1178
|
+
if (N(x) && P !== 0 && !(T === 0 && x.__key === m && p === P || T === d - 1 && x.__key === y && _ === 0) && (k = !0, S &= x.getFormat(), S === 0)) break;
|
|
1175
1179
|
}
|
|
1176
|
-
l.format =
|
|
1180
|
+
l.format = k ? S : 0;
|
|
1177
1181
|
}
|
|
1178
1182
|
}
|
|
1179
|
-
w(e,
|
|
1183
|
+
w(e, wn, void 0);
|
|
1180
1184
|
});
|
|
1181
1185
|
}
|
|
1182
1186
|
function ys(n) {
|
|
@@ -1184,23 +1188,23 @@ function ys(n) {
|
|
|
1184
1188
|
const e = n.getTargetRanges();
|
|
1185
1189
|
return e.length === 0 ? null : e[0];
|
|
1186
1190
|
}
|
|
1187
|
-
function
|
|
1191
|
+
function on(n, e) {
|
|
1188
1192
|
const t = n._compositionKey;
|
|
1189
|
-
if (
|
|
1193
|
+
if (J(null), t !== null && e != null) {
|
|
1190
1194
|
if (e === "") {
|
|
1191
1195
|
const r = V(t), s = kt(n.getElementByKey(t));
|
|
1192
|
-
return void (s !== null && s.nodeValue !== null && N(r) &&
|
|
1196
|
+
return void (s !== null && s.nodeValue !== null && N(r) && Rn(r, s.nodeValue, null, null, !0));
|
|
1193
1197
|
}
|
|
1194
1198
|
if (e[e.length - 1] === `
|
|
1195
1199
|
`) {
|
|
1196
1200
|
const r = I();
|
|
1197
1201
|
if (F(r)) {
|
|
1198
1202
|
const s = r.focus;
|
|
1199
|
-
return r.anchor.set(s.key, s.offset, s.type), void w(n,
|
|
1203
|
+
return r.anchor.set(s.key, s.offset, s.type), void w(n, dn, null);
|
|
1200
1204
|
}
|
|
1201
1205
|
}
|
|
1202
1206
|
}
|
|
1203
|
-
|
|
1207
|
+
Bn(!0, n, e);
|
|
1204
1208
|
}
|
|
1205
1209
|
function ms(n) {
|
|
1206
1210
|
let e = n.__lexicalEventHandles;
|
|
@@ -1210,13 +1214,13 @@ const Ie = /* @__PURE__ */ new Map();
|
|
|
1210
1214
|
function xs(n) {
|
|
1211
1215
|
const e = n.target, t = se(e == null ? null : e.nodeType === 9 ? e.defaultView : e.ownerDocument.defaultView);
|
|
1212
1216
|
if (t === null) return;
|
|
1213
|
-
const r =
|
|
1217
|
+
const r = Yr(t.anchorNode);
|
|
1214
1218
|
if (r === null) return;
|
|
1215
|
-
|
|
1216
|
-
const a = ot(),
|
|
1217
|
-
if (
|
|
1218
|
-
const h =
|
|
1219
|
-
h !== rt && h !== Te || ue(
|
|
1219
|
+
Cn && (Cn = !1, X(r, () => {
|
|
1220
|
+
const a = ot(), u = t.anchorNode;
|
|
1221
|
+
if (u === null) return;
|
|
1222
|
+
const h = u.nodeType;
|
|
1223
|
+
h !== rt && h !== Te || ue(qt(a, t, r, n));
|
|
1220
1224
|
}));
|
|
1221
1225
|
const s = Wn(r), i = s[s.length - 1], o = i._key, l = Ie.get(o), c = l || i;
|
|
1222
1226
|
c !== r && yr(t, c, !1), yr(t, r, !0), r !== i ? Ie.set(o, r) : l && Ie.delete(o);
|
|
@@ -1227,49 +1231,49 @@ function mr(n) {
|
|
|
1227
1231
|
function xr(n) {
|
|
1228
1232
|
return n._lexicalHandled === !0;
|
|
1229
1233
|
}
|
|
1230
|
-
function
|
|
1234
|
+
function Oi(n) {
|
|
1231
1235
|
const e = n.ownerDocument, t = Dt.get(e);
|
|
1232
|
-
t === void 0 &&
|
|
1236
|
+
t === void 0 && b(162);
|
|
1233
1237
|
const r = t - 1;
|
|
1234
|
-
r >= 0 ||
|
|
1235
|
-
const s =
|
|
1236
|
-
|
|
1238
|
+
r >= 0 || b(164), Dt.set(e, r), r === 0 && e.removeEventListener("selectionchange", xs);
|
|
1239
|
+
const s = zt(n);
|
|
1240
|
+
zn(s) ? (function(o) {
|
|
1237
1241
|
if (o._parentEditor !== null) {
|
|
1238
1242
|
const l = Wn(o), c = l[l.length - 1]._key;
|
|
1239
1243
|
Ie.get(c) === o && Ie.delete(c);
|
|
1240
1244
|
} else Ie.delete(o._key);
|
|
1241
|
-
}(s), n.__lexicalEditor = null) : s &&
|
|
1245
|
+
}(s), n.__lexicalEditor = null) : s && b(198);
|
|
1242
1246
|
const i = ms(n);
|
|
1243
1247
|
for (let o = 0; o < i.length; o++) i[o]();
|
|
1244
1248
|
n.__lexicalEventHandles = [];
|
|
1245
1249
|
}
|
|
1246
|
-
function
|
|
1250
|
+
function kn(n, e, t) {
|
|
1247
1251
|
q();
|
|
1248
1252
|
const r = n.__key, s = n.getParent();
|
|
1249
1253
|
if (s === null) return;
|
|
1250
1254
|
const i = function(l) {
|
|
1251
1255
|
const c = I();
|
|
1252
|
-
if (!F(c) || !
|
|
1253
|
-
const { anchor: a, focus:
|
|
1254
|
-
return Qe(h, l) && a.set(l.__key, 0, "element"), Qe(
|
|
1256
|
+
if (!F(c) || !v(l)) return c;
|
|
1257
|
+
const { anchor: a, focus: u } = c, h = a.getNode(), f = u.getNode();
|
|
1258
|
+
return Qe(h, l) && a.set(l.__key, 0, "element"), Qe(f, l) && u.set(l.__key, 0, "element"), c;
|
|
1255
1259
|
}(n);
|
|
1256
1260
|
let o = !1;
|
|
1257
1261
|
if (F(i) && e) {
|
|
1258
1262
|
const l = i.anchor, c = i.focus;
|
|
1259
1263
|
l.key === r && (Ot(l, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0), c.key === r && (Ot(c, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0);
|
|
1260
|
-
} else
|
|
1264
|
+
} else Ht(i) && e && n.isSelected() && n.selectPrevious();
|
|
1261
1265
|
if (F(i) && e && !o) {
|
|
1262
1266
|
const l = n.getIndexWithinParent();
|
|
1263
1267
|
Ne(n), Lt(i, s, l, -1);
|
|
1264
1268
|
} else Ne(n);
|
|
1265
|
-
t || Pe(s) || s.canBeEmpty() || !s.isEmpty() ||
|
|
1269
|
+
t || Pe(s) || s.canBeEmpty() || !s.isEmpty() || kn(s, e), e && Y(s) && s.isEmpty() && s.selectEnd();
|
|
1266
1270
|
}
|
|
1267
|
-
class
|
|
1271
|
+
class Vt {
|
|
1268
1272
|
static getType() {
|
|
1269
|
-
|
|
1273
|
+
b(64, this.name);
|
|
1270
1274
|
}
|
|
1271
1275
|
static clone(e) {
|
|
1272
|
-
|
|
1276
|
+
b(65, this.name);
|
|
1273
1277
|
}
|
|
1274
1278
|
afterCloneFrom(e) {
|
|
1275
1279
|
this.__parent = e.__parent, this.__next = e.__next, this.__prev = e.__prev;
|
|
@@ -1281,7 +1285,7 @@ class Ut {
|
|
|
1281
1285
|
return this.__type;
|
|
1282
1286
|
}
|
|
1283
1287
|
isInline() {
|
|
1284
|
-
|
|
1288
|
+
b(137, this.constructor.name);
|
|
1285
1289
|
}
|
|
1286
1290
|
isAttached() {
|
|
1287
1291
|
let e = this.__key;
|
|
@@ -1327,20 +1331,20 @@ class Ut {
|
|
|
1327
1331
|
}
|
|
1328
1332
|
getParentOrThrow() {
|
|
1329
1333
|
const e = this.getParent();
|
|
1330
|
-
return e === null &&
|
|
1334
|
+
return e === null && b(66, this.__key), e;
|
|
1331
1335
|
}
|
|
1332
1336
|
getTopLevelElement() {
|
|
1333
1337
|
let e = this;
|
|
1334
1338
|
for (; e !== null; ) {
|
|
1335
1339
|
const t = e.getParent();
|
|
1336
|
-
if (Pe(t)) return
|
|
1340
|
+
if (Pe(t)) return v(e) || e === this && A(e) || b(194), e;
|
|
1337
1341
|
e = t;
|
|
1338
1342
|
}
|
|
1339
1343
|
return null;
|
|
1340
1344
|
}
|
|
1341
1345
|
getTopLevelElementOrThrow() {
|
|
1342
1346
|
const e = this.getTopLevelElement();
|
|
1343
|
-
return e === null &&
|
|
1347
|
+
return e === null && b(67, this.__key), e;
|
|
1344
1348
|
}
|
|
1345
1349
|
getParents() {
|
|
1346
1350
|
const e = [];
|
|
@@ -1377,7 +1381,7 @@ class Ut {
|
|
|
1377
1381
|
}
|
|
1378
1382
|
getCommonAncestor(e) {
|
|
1379
1383
|
const t = this.getParents(), r = e.getParents();
|
|
1380
|
-
|
|
1384
|
+
v(this) && t.unshift(this), v(e) && r.unshift(e);
|
|
1381
1385
|
const s = t.length, i = r.length;
|
|
1382
1386
|
if (s === 0 || i === 0 || t[s - 1] !== r[i - 1]) return null;
|
|
1383
1387
|
const o = new Set(r);
|
|
@@ -1430,7 +1434,7 @@ class Ut {
|
|
|
1430
1434
|
for (; i !== null; ) {
|
|
1431
1435
|
const o = i.__key;
|
|
1432
1436
|
if (s.has(o) || (s.add(o), r.push(i)), i === e) break;
|
|
1433
|
-
const l =
|
|
1437
|
+
const l = v(i) ? t ? i.getFirstChild() : i.getLastChild() : null;
|
|
1434
1438
|
if (l !== null) {
|
|
1435
1439
|
i = l;
|
|
1436
1440
|
continue;
|
|
@@ -1442,12 +1446,12 @@ class Ut {
|
|
|
1442
1446
|
}
|
|
1443
1447
|
const a = i.getParentOrThrow();
|
|
1444
1448
|
if (s.has(a.__key) || r.push(a), a === e) break;
|
|
1445
|
-
let
|
|
1449
|
+
let u = null, h = a;
|
|
1446
1450
|
do {
|
|
1447
|
-
if (h === null &&
|
|
1448
|
-
|
|
1449
|
-
} while (
|
|
1450
|
-
i =
|
|
1451
|
+
if (h === null && b(68), u = t ? h.getNextSibling() : h.getPreviousSibling(), h = h.getParent(), h === null) break;
|
|
1452
|
+
u !== null || s.has(h.__key) || r.push(h);
|
|
1453
|
+
} while (u === null);
|
|
1454
|
+
i = u;
|
|
1451
1455
|
}
|
|
1452
1456
|
return t || r.reverse(), r;
|
|
1453
1457
|
}
|
|
@@ -1457,7 +1461,7 @@ class Ut {
|
|
|
1457
1461
|
}
|
|
1458
1462
|
getLatest() {
|
|
1459
1463
|
const e = V(this.__key);
|
|
1460
|
-
return e === null &&
|
|
1464
|
+
return e === null && b(113), e;
|
|
1461
1465
|
}
|
|
1462
1466
|
getWritable() {
|
|
1463
1467
|
q();
|
|
@@ -1473,44 +1477,44 @@ class Ut {
|
|
|
1473
1477
|
return this.getTextContent().length;
|
|
1474
1478
|
}
|
|
1475
1479
|
createDOM(e, t) {
|
|
1476
|
-
|
|
1480
|
+
b(70);
|
|
1477
1481
|
}
|
|
1478
1482
|
updateDOM(e, t, r) {
|
|
1479
|
-
|
|
1483
|
+
b(71);
|
|
1480
1484
|
}
|
|
1481
1485
|
exportDOM(e) {
|
|
1482
1486
|
return { element: this.createDOM(e._config, e) };
|
|
1483
1487
|
}
|
|
1484
1488
|
exportJSON() {
|
|
1485
|
-
|
|
1489
|
+
b(72);
|
|
1486
1490
|
}
|
|
1487
1491
|
static importJSON(e) {
|
|
1488
|
-
|
|
1492
|
+
b(18, this.name);
|
|
1489
1493
|
}
|
|
1490
1494
|
static transform() {
|
|
1491
1495
|
return null;
|
|
1492
1496
|
}
|
|
1493
1497
|
remove(e) {
|
|
1494
|
-
|
|
1498
|
+
kn(this, !0, e);
|
|
1495
1499
|
}
|
|
1496
1500
|
replace(e, t) {
|
|
1497
1501
|
q();
|
|
1498
1502
|
let r = I();
|
|
1499
|
-
r !== null && (r = r.clone()),
|
|
1503
|
+
r !== null && (r = r.clone()), nn(this, e);
|
|
1500
1504
|
const s = this.getLatest(), i = this.__key, o = e.__key, l = e.getWritable(), c = this.getParentOrThrow().getWritable(), a = c.__size;
|
|
1501
1505
|
Ne(l);
|
|
1502
|
-
const
|
|
1503
|
-
if (
|
|
1506
|
+
const u = s.getPreviousSibling(), h = s.getNextSibling(), f = s.__prev, d = s.__next, g = s.__parent;
|
|
1507
|
+
if (kn(s, !1, !0), u === null ? c.__first = o : u.getWritable().__next = o, l.__prev = f, h === null ? c.__last = o : h.getWritable().__prev = o, l.__next = d, l.__parent = g, c.__size = a, t && (v(this) && v(l) || b(139), this.getChildren().forEach((p) => {
|
|
1504
1508
|
l.append(p);
|
|
1505
1509
|
})), F(r)) {
|
|
1506
1510
|
ue(r);
|
|
1507
1511
|
const p = r.anchor, _ = r.focus;
|
|
1508
1512
|
p.key === i && Cr(p, l), _.key === i && Cr(_, l);
|
|
1509
1513
|
}
|
|
1510
|
-
return ye() === i &&
|
|
1514
|
+
return ye() === i && J(o), l;
|
|
1511
1515
|
}
|
|
1512
1516
|
insertAfter(e, t = !0) {
|
|
1513
|
-
q(),
|
|
1517
|
+
q(), nn(this, e);
|
|
1514
1518
|
const r = this.getWritable(), s = e.getWritable(), i = s.getParent(), o = I();
|
|
1515
1519
|
let l = !1, c = !1;
|
|
1516
1520
|
if (i !== null) {
|
|
@@ -1520,23 +1524,23 @@ class Ut {
|
|
|
1520
1524
|
l = p.type === "element" && p.key === g && p.offset === d + 1, c = _.type === "element" && _.key === g && _.offset === d + 1;
|
|
1521
1525
|
}
|
|
1522
1526
|
}
|
|
1523
|
-
const a = this.getNextSibling(),
|
|
1524
|
-
if (a === null ?
|
|
1527
|
+
const a = this.getNextSibling(), u = this.getParentOrThrow().getWritable(), h = s.__key, f = r.__next;
|
|
1528
|
+
if (a === null ? u.__last = h : a.getWritable().__prev = h, u.__size++, r.__next = h, s.__next = f, s.__prev = r.__key, s.__parent = r.__parent, t && F(o)) {
|
|
1525
1529
|
const d = this.getIndexWithinParent();
|
|
1526
|
-
Lt(o,
|
|
1527
|
-
const g =
|
|
1530
|
+
Lt(o, u, d + 1);
|
|
1531
|
+
const g = u.__key;
|
|
1528
1532
|
l && o.anchor.set(g, d + 2, "element"), c && o.focus.set(g, d + 2, "element");
|
|
1529
1533
|
}
|
|
1530
1534
|
return e;
|
|
1531
1535
|
}
|
|
1532
1536
|
insertBefore(e, t = !0) {
|
|
1533
|
-
q(),
|
|
1537
|
+
q(), nn(this, e);
|
|
1534
1538
|
const r = this.getWritable(), s = e.getWritable(), i = s.__key;
|
|
1535
1539
|
Ne(s);
|
|
1536
1540
|
const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), c = r.__prev, a = this.getIndexWithinParent();
|
|
1537
1541
|
o === null ? l.__first = i : o.getWritable().__next = i, l.__size++, r.__prev = i, s.__prev = c, s.__next = r.__key, s.__parent = r.__parent;
|
|
1538
|
-
const
|
|
1539
|
-
return t && F(
|
|
1542
|
+
const u = I();
|
|
1543
|
+
return t && F(u) && Lt(u, this.getParentOrThrow(), a), e;
|
|
1540
1544
|
}
|
|
1541
1545
|
isParentRequired() {
|
|
1542
1546
|
return !1;
|
|
@@ -1554,7 +1558,7 @@ class Ut {
|
|
|
1554
1558
|
q();
|
|
1555
1559
|
const r = this.getPreviousSibling(), s = this.getParentOrThrow();
|
|
1556
1560
|
if (r === null) return s.select(0, 0);
|
|
1557
|
-
if (
|
|
1561
|
+
if (v(r)) return r.select();
|
|
1558
1562
|
if (!N(r)) {
|
|
1559
1563
|
const i = r.getIndexWithinParent() + 1;
|
|
1560
1564
|
return s.select(i, i);
|
|
@@ -1565,7 +1569,7 @@ class Ut {
|
|
|
1565
1569
|
q();
|
|
1566
1570
|
const r = this.getNextSibling(), s = this.getParentOrThrow();
|
|
1567
1571
|
if (r === null) return s.select();
|
|
1568
|
-
if (
|
|
1572
|
+
if (v(r)) return r.select(0, 0);
|
|
1569
1573
|
if (!N(r)) {
|
|
1570
1574
|
const i = r.getIndexWithinParent();
|
|
1571
1575
|
return s.select(i, i);
|
|
@@ -1576,7 +1580,7 @@ class Ut {
|
|
|
1576
1580
|
this.getWritable();
|
|
1577
1581
|
}
|
|
1578
1582
|
}
|
|
1579
|
-
class st extends
|
|
1583
|
+
class st extends Vt {
|
|
1580
1584
|
static getType() {
|
|
1581
1585
|
return "linebreak";
|
|
1582
1586
|
}
|
|
@@ -1616,7 +1620,7 @@ class st extends Ut {
|
|
|
1616
1620
|
if (i === t || i.previousSibling === t && dt(i)) return !0;
|
|
1617
1621
|
}
|
|
1618
1622
|
return !1;
|
|
1619
|
-
}(e) ? null : { conversion:
|
|
1623
|
+
}(e) ? null : { conversion: Ii, priority: 0 } };
|
|
1620
1624
|
}
|
|
1621
1625
|
static importJSON(e) {
|
|
1622
1626
|
return nt();
|
|
@@ -1625,11 +1629,11 @@ class st extends Ut {
|
|
|
1625
1629
|
return { type: "linebreak", version: 1 };
|
|
1626
1630
|
}
|
|
1627
1631
|
}
|
|
1628
|
-
function
|
|
1632
|
+
function Ii(n) {
|
|
1629
1633
|
return { node: nt() };
|
|
1630
1634
|
}
|
|
1631
1635
|
function nt() {
|
|
1632
|
-
return
|
|
1636
|
+
return $t(new st());
|
|
1633
1637
|
}
|
|
1634
1638
|
function Ae(n) {
|
|
1635
1639
|
return n instanceof st;
|
|
@@ -1637,10 +1641,10 @@ function Ae(n) {
|
|
|
1637
1641
|
function dt(n) {
|
|
1638
1642
|
return n.nodeType === Te && /^( |\t|\r?\n)+$/.test(n.textContent || "");
|
|
1639
1643
|
}
|
|
1640
|
-
function on(n, e) {
|
|
1641
|
-
return 16 & e ? "code" : e & En ? "mark" : 32 & e ? "sub" : 64 & e ? "sup" : null;
|
|
1642
|
-
}
|
|
1643
1644
|
function ln(n, e) {
|
|
1645
|
+
return 16 & e ? "code" : e & Pn ? "mark" : 32 & e ? "sub" : 64 & e ? "sup" : null;
|
|
1646
|
+
}
|
|
1647
|
+
function cn(n, e) {
|
|
1644
1648
|
return 1 & e ? "strong" : 2 & e ? "em" : "span";
|
|
1645
1649
|
}
|
|
1646
1650
|
function vs(n, e, t, r, s) {
|
|
@@ -1651,14 +1655,14 @@ function vs(n, e, t, r, s) {
|
|
|
1651
1655
|
const c = e & Tt && e & St;
|
|
1652
1656
|
o !== void 0 && (t & Tt && t & St ? (l = !0, c || i.add(...o)) : c && i.remove(...o));
|
|
1653
1657
|
for (const a in ce) {
|
|
1654
|
-
const
|
|
1655
|
-
if (o = qe(s, a), o !== void 0) if (t &
|
|
1658
|
+
const u = ce[a];
|
|
1659
|
+
if (o = qe(s, a), o !== void 0) if (t & u) {
|
|
1656
1660
|
if (l && (a === "underline" || a === "strikethrough")) {
|
|
1657
|
-
e &
|
|
1661
|
+
e & u && i.remove(...o);
|
|
1658
1662
|
continue;
|
|
1659
1663
|
}
|
|
1660
|
-
e &
|
|
1661
|
-
} else e &
|
|
1664
|
+
e & u && (!c || a !== "underline") && a !== "strikethrough" || i.add(...o);
|
|
1665
|
+
} else e & u && i.remove(...o);
|
|
1662
1666
|
}
|
|
1663
1667
|
}
|
|
1664
1668
|
function Ss(n, e, t) {
|
|
@@ -1667,12 +1671,12 @@ function Ss(n, e, t) {
|
|
|
1667
1671
|
else {
|
|
1668
1672
|
const o = r.nodeValue;
|
|
1669
1673
|
if (o !== i) if (s || xe) {
|
|
1670
|
-
const [l, c, a] = function(
|
|
1671
|
-
const
|
|
1674
|
+
const [l, c, a] = function(u, h) {
|
|
1675
|
+
const f = u.length, d = h.length;
|
|
1672
1676
|
let g = 0, p = 0;
|
|
1673
|
-
for (; g <
|
|
1674
|
-
for (; p + g <
|
|
1675
|
-
return [g,
|
|
1677
|
+
for (; g < f && g < d && u[g] === h[g]; ) g++;
|
|
1678
|
+
for (; p + g < f && p + g < d && u[f - p - 1] === h[d - p - 1]; ) p++;
|
|
1679
|
+
return [g, f - g - p, h.slice(g, d - p)];
|
|
1676
1680
|
}(o, i);
|
|
1677
1681
|
c !== 0 && r.deleteData(l, c), r.insertData(l, a);
|
|
1678
1682
|
} else r.nodeValue = i;
|
|
@@ -1687,12 +1691,12 @@ function ht(n, e) {
|
|
|
1687
1691
|
const t = document.createElement(e);
|
|
1688
1692
|
return t.appendChild(n), t;
|
|
1689
1693
|
}
|
|
1690
|
-
class
|
|
1694
|
+
class ze extends Vt {
|
|
1691
1695
|
static getType() {
|
|
1692
1696
|
return "text";
|
|
1693
1697
|
}
|
|
1694
1698
|
static clone(e) {
|
|
1695
|
-
return new
|
|
1699
|
+
return new ze(e.__text, e.__key);
|
|
1696
1700
|
}
|
|
1697
1701
|
afterCloneFrom(e) {
|
|
1698
1702
|
super.afterCloneFrom(e), this.__format = e.__format, this.__style = e.__style, this.__mode = e.__mode, this.__detail = e.__detail;
|
|
@@ -1745,38 +1749,38 @@ class We extends Ut {
|
|
|
1745
1749
|
return !0;
|
|
1746
1750
|
}
|
|
1747
1751
|
createDOM(e, t) {
|
|
1748
|
-
const r = this.__format, s =
|
|
1752
|
+
const r = this.__format, s = ln(0, r), i = cn(0, r), o = s === null ? i : s, l = document.createElement(o);
|
|
1749
1753
|
let c = l;
|
|
1750
1754
|
this.hasFormat("code") && l.setAttribute("spellcheck", "false"), s !== null && (c = document.createElement(i), l.appendChild(c)), vr(c, this, 0, r, this.__text, e);
|
|
1751
1755
|
const a = this.__style;
|
|
1752
1756
|
return a !== "" && (l.style.cssText = a), l;
|
|
1753
1757
|
}
|
|
1754
1758
|
updateDOM(e, t, r) {
|
|
1755
|
-
const s = this.__text, i = e.__format, o = this.__format, l =
|
|
1756
|
-
if ((l === null ? a : l) !== (c === null ?
|
|
1757
|
-
if (l === c && a !==
|
|
1759
|
+
const s = this.__text, i = e.__format, o = this.__format, l = ln(0, i), c = ln(0, o), a = cn(0, i), u = cn(0, o);
|
|
1760
|
+
if ((l === null ? a : l) !== (c === null ? u : c)) return !0;
|
|
1761
|
+
if (l === c && a !== u) {
|
|
1758
1762
|
const p = t.firstChild;
|
|
1759
|
-
p == null &&
|
|
1760
|
-
const _ = document.createElement(
|
|
1763
|
+
p == null && b(48);
|
|
1764
|
+
const _ = document.createElement(u);
|
|
1761
1765
|
return vr(_, this, 0, o, s, r), t.replaceChild(_, p), !1;
|
|
1762
1766
|
}
|
|
1763
1767
|
let h = t;
|
|
1764
|
-
c !== null && l !== null && (h = t.firstChild, h == null &&
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1768
|
+
c !== null && l !== null && (h = t.firstChild, h == null && b(49)), Ss(s, h, this);
|
|
1769
|
+
const f = r.theme.text;
|
|
1770
|
+
f !== void 0 && i !== o && vs(0, i, o, h, f);
|
|
1767
1771
|
const d = e.__style, g = this.__style;
|
|
1768
1772
|
return d !== g && (t.style.cssText = g), !1;
|
|
1769
1773
|
}
|
|
1770
1774
|
static importDOM() {
|
|
1771
|
-
return { "#text": () => ({ conversion: Wi, priority: 0 }), b: () => ({ conversion:
|
|
1775
|
+
return { "#text": () => ({ conversion: Wi, priority: 0 }), b: () => ({ conversion: Mi, priority: 0 }), code: () => ({ conversion: ge, priority: 0 }), em: () => ({ conversion: ge, priority: 0 }), i: () => ({ conversion: ge, priority: 0 }), s: () => ({ conversion: ge, priority: 0 }), span: () => ({ conversion: Ai, priority: 0 }), strong: () => ({ conversion: ge, priority: 0 }), sub: () => ({ conversion: ge, priority: 0 }), sup: () => ({ conversion: ge, priority: 0 }), u: () => ({ conversion: ge, priority: 0 }) };
|
|
1772
1776
|
}
|
|
1773
1777
|
static importJSON(e) {
|
|
1774
|
-
const t =
|
|
1778
|
+
const t = $(e.text);
|
|
1775
1779
|
return t.setFormat(e.format), t.setDetail(e.detail), t.setMode(e.mode), t.setStyle(e.style), t;
|
|
1776
1780
|
}
|
|
1777
1781
|
exportDOM(e) {
|
|
1778
1782
|
let { element: t } = super.exportDOM(e);
|
|
1779
|
-
return t !== null &&
|
|
1783
|
+
return t !== null && Jt(t) || b(132), t.style.whiteSpace = "pre-wrap", this.hasFormat("bold") && (t = ht(t, "b")), this.hasFormat("italic") && (t = ht(t, "i")), this.hasFormat("strikethrough") && (t = ht(t, "s")), this.hasFormat("underline") && (t = ht(t, "u")), { element: t };
|
|
1780
1784
|
}
|
|
1781
1785
|
exportJSON() {
|
|
1782
1786
|
return { detail: this.getDetail(), format: this.getFormat(), mode: this.getMode(), style: this.getStyle(), text: this.getTextContent(), type: "text", version: 1 };
|
|
@@ -1829,7 +1833,7 @@ class We extends Ut {
|
|
|
1829
1833
|
if (!F(i)) return ks(l, r, l, s, "text", "text");
|
|
1830
1834
|
{
|
|
1831
1835
|
const c = ye();
|
|
1832
|
-
c !== i.anchor.key && c !== i.focus.key ||
|
|
1836
|
+
c !== i.anchor.key && c !== i.focus.key || J(l), i.setTextNodeRange(this, r, this, s);
|
|
1833
1837
|
}
|
|
1834
1838
|
return i;
|
|
1835
1839
|
}
|
|
@@ -1849,8 +1853,8 @@ class We extends Ut {
|
|
|
1849
1853
|
const h = e + l;
|
|
1850
1854
|
a.setTextNodeRange(i, h, i, h);
|
|
1851
1855
|
}
|
|
1852
|
-
const
|
|
1853
|
-
return i.__text =
|
|
1856
|
+
const u = o.slice(0, c) + r + o.slice(c + t);
|
|
1857
|
+
return i.__text = u, i;
|
|
1854
1858
|
}
|
|
1855
1859
|
canInsertTextBefore() {
|
|
1856
1860
|
return !0;
|
|
@@ -1862,76 +1866,76 @@ class We extends Ut {
|
|
|
1862
1866
|
q();
|
|
1863
1867
|
const t = this.getLatest(), r = t.getTextContent(), s = t.__key, i = ye(), o = new Set(e), l = [], c = r.length;
|
|
1864
1868
|
let a = "";
|
|
1865
|
-
for (let
|
|
1869
|
+
for (let T = 0; T < c; T++) a !== "" && o.has(T) && (l.push(a), a = ""), a += r[T];
|
|
1866
1870
|
a !== "" && l.push(a);
|
|
1867
|
-
const
|
|
1868
|
-
if (
|
|
1871
|
+
const u = l.length;
|
|
1872
|
+
if (u === 0) return [];
|
|
1869
1873
|
if (l[0] === r) return [t];
|
|
1870
|
-
const h = l[0],
|
|
1874
|
+
const h = l[0], f = t.getParent();
|
|
1871
1875
|
let d;
|
|
1872
1876
|
const g = t.getFormat(), p = t.getStyle(), _ = t.__detail;
|
|
1873
1877
|
let m = !1;
|
|
1874
|
-
t.isSegmented() ? (d =
|
|
1875
|
-
const y = I(),
|
|
1876
|
-
let
|
|
1877
|
-
for (let
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
const E =
|
|
1878
|
+
t.isSegmented() ? (d = $(h), d.__format = g, d.__style = p, d.__detail = _, m = !0) : (d = t.getWritable(), d.__text = h);
|
|
1879
|
+
const y = I(), S = [d];
|
|
1880
|
+
let k = h.length;
|
|
1881
|
+
for (let T = 1; T < u; T++) {
|
|
1882
|
+
const x = l[T], P = x.length, C = $(x).getWritable();
|
|
1883
|
+
C.__format = g, C.__style = p, C.__detail = _;
|
|
1884
|
+
const E = C.__key, D = k + P;
|
|
1881
1885
|
if (F(y)) {
|
|
1882
|
-
const O = y.anchor,
|
|
1883
|
-
O.key === s && O.type === "text" && O.offset >
|
|
1886
|
+
const O = y.anchor, z = y.focus;
|
|
1887
|
+
O.key === s && O.type === "text" && O.offset > k && O.offset <= D && (O.key = E, O.offset -= k, y.dirty = !0), z.key === s && z.type === "text" && z.offset > k && z.offset <= D && (z.key = E, z.offset -= k, y.dirty = !0);
|
|
1884
1888
|
}
|
|
1885
|
-
i === s &&
|
|
1889
|
+
i === s && J(E), k = D, S.push(C);
|
|
1886
1890
|
}
|
|
1887
|
-
if (
|
|
1891
|
+
if (f !== null) {
|
|
1888
1892
|
(function(P) {
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1893
|
+
const C = P.getPreviousSibling(), E = P.getNextSibling();
|
|
1894
|
+
C !== null && wt(C), E !== null && wt(E);
|
|
1891
1895
|
})(this);
|
|
1892
|
-
const
|
|
1893
|
-
m ? (
|
|
1896
|
+
const T = f.getWritable(), x = this.getIndexWithinParent();
|
|
1897
|
+
m ? (T.splice(x, 0, S), this.remove()) : T.splice(x, 1, S), F(y) && Lt(y, f, x, u - 1);
|
|
1894
1898
|
}
|
|
1895
|
-
return
|
|
1899
|
+
return S;
|
|
1896
1900
|
}
|
|
1897
1901
|
mergeWithSibling(e) {
|
|
1898
1902
|
const t = e === this.getPreviousSibling();
|
|
1899
|
-
t || e === this.getNextSibling() ||
|
|
1903
|
+
t || e === this.getNextSibling() || b(50);
|
|
1900
1904
|
const r = this.__key, s = e.__key, i = this.__text, o = i.length;
|
|
1901
|
-
ye() === s &&
|
|
1905
|
+
ye() === s && J(r);
|
|
1902
1906
|
const l = I();
|
|
1903
1907
|
if (F(l)) {
|
|
1904
|
-
const h = l.anchor,
|
|
1905
|
-
h !== null && h.key === s && (Dr(h, t, r, e, o), l.dirty = !0),
|
|
1908
|
+
const h = l.anchor, f = l.focus;
|
|
1909
|
+
h !== null && h.key === s && (Dr(h, t, r, e, o), l.dirty = !0), f !== null && f.key === s && (Dr(f, t, r, e, o), l.dirty = !0);
|
|
1906
1910
|
}
|
|
1907
1911
|
const c = e.__text, a = t ? c + i : i + c;
|
|
1908
1912
|
this.setTextContent(a);
|
|
1909
|
-
const
|
|
1910
|
-
return e.remove(),
|
|
1913
|
+
const u = this.getWritable();
|
|
1914
|
+
return e.remove(), u;
|
|
1911
1915
|
}
|
|
1912
1916
|
isTextEntity() {
|
|
1913
1917
|
return !1;
|
|
1914
1918
|
}
|
|
1915
1919
|
}
|
|
1916
|
-
function Ii(n) {
|
|
1917
|
-
return { forChild: $n(n.style), node: null };
|
|
1918
|
-
}
|
|
1919
1920
|
function Ai(n) {
|
|
1921
|
+
return { forChild: Jn(n.style), node: null };
|
|
1922
|
+
}
|
|
1923
|
+
function Mi(n) {
|
|
1920
1924
|
const e = n, t = e.style.fontWeight === "normal";
|
|
1921
|
-
return { forChild:
|
|
1925
|
+
return { forChild: Jn(e.style, t ? void 0 : "bold"), node: null };
|
|
1922
1926
|
}
|
|
1923
1927
|
const Sr = /* @__PURE__ */ new WeakMap();
|
|
1924
|
-
function
|
|
1928
|
+
function zi(n) {
|
|
1925
1929
|
return n.nodeName === "PRE" || n.nodeType === rt && n.style !== void 0 && n.style.whiteSpace !== void 0 && n.style.whiteSpace.startsWith("pre");
|
|
1926
1930
|
}
|
|
1927
1931
|
function Wi(n) {
|
|
1928
1932
|
const e = n;
|
|
1929
|
-
n.parentElement === null &&
|
|
1933
|
+
n.parentElement === null && b(129);
|
|
1930
1934
|
let t = e.textContent || "";
|
|
1931
1935
|
if (function(r) {
|
|
1932
1936
|
let s, i = r.parentNode;
|
|
1933
1937
|
const o = [r];
|
|
1934
|
-
for (; i !== null && (s = Sr.get(i)) === void 0 && !
|
|
1938
|
+
for (; i !== null && (s = Sr.get(i)) === void 0 && !zi(i); ) o.push(i), i = i.parentNode;
|
|
1935
1939
|
const l = s === void 0 ? i : s;
|
|
1936
1940
|
for (let c = 0; c < o.length; c++) Sr.set(o[c], l);
|
|
1937
1941
|
return l;
|
|
@@ -1941,7 +1945,7 @@ function Wi(n) {
|
|
|
1941
1945
|
const l = r[o];
|
|
1942
1946
|
l === `
|
|
1943
1947
|
` || l === `\r
|
|
1944
|
-
` ? s.push(nt()) : l === " " ? s.push(Un()) : l !== "" && s.push(
|
|
1948
|
+
` ? s.push(nt()) : l === " " ? s.push(Un()) : l !== "" && s.push($(l));
|
|
1945
1949
|
}
|
|
1946
1950
|
return { node: s };
|
|
1947
1951
|
}
|
|
@@ -1966,7 +1970,7 @@ function Wi(n) {
|
|
|
1966
1970
|
}
|
|
1967
1971
|
s && (t = t.slice(0, t.length - 1));
|
|
1968
1972
|
}
|
|
1969
|
-
return t === "" ? { node: null } : { node:
|
|
1973
|
+
return t === "" ? { node: null } : { node: $(t) };
|
|
1970
1974
|
}
|
|
1971
1975
|
function Tr(n, e) {
|
|
1972
1976
|
let t = n;
|
|
@@ -1987,22 +1991,22 @@ function Tr(n, e) {
|
|
|
1987
1991
|
if (t.nodeName === "BR") return null;
|
|
1988
1992
|
}
|
|
1989
1993
|
}
|
|
1990
|
-
const
|
|
1994
|
+
const Bi = { code: "code", em: "italic", i: "italic", s: "strikethrough", strong: "bold", sub: "subscript", sup: "superscript", u: "underline" };
|
|
1991
1995
|
function ge(n) {
|
|
1992
|
-
const e =
|
|
1993
|
-
return e === void 0 ? { node: null } : { forChild:
|
|
1996
|
+
const e = Bi[n.nodeName.toLowerCase()];
|
|
1997
|
+
return e === void 0 ? { node: null } : { forChild: Jn(n.style, e), node: null };
|
|
1994
1998
|
}
|
|
1995
|
-
function
|
|
1996
|
-
return
|
|
1999
|
+
function $(n = "") {
|
|
2000
|
+
return $t(new ze(n));
|
|
1997
2001
|
}
|
|
1998
2002
|
function N(n) {
|
|
1999
|
-
return n instanceof
|
|
2003
|
+
return n instanceof ze;
|
|
2000
2004
|
}
|
|
2001
|
-
function
|
|
2005
|
+
function Jn(n, e) {
|
|
2002
2006
|
const t = n.fontWeight, r = n.textDecoration.split(" "), s = t === "700" || t === "bold", i = r.includes("line-through"), o = n.fontStyle === "italic", l = r.includes("underline"), c = n.verticalAlign;
|
|
2003
2007
|
return (a) => (N(a) && (s && !a.hasFormat("bold") && a.toggleFormat("bold"), i && !a.hasFormat("strikethrough") && a.toggleFormat("strikethrough"), o && !a.hasFormat("italic") && a.toggleFormat("italic"), l && !a.hasFormat("underline") && a.toggleFormat("underline"), c !== "sub" || a.hasFormat("subscript") || a.toggleFormat("subscript"), c !== "super" || a.hasFormat("superscript") || a.toggleFormat("superscript"), e && !a.hasFormat(e) && a.toggleFormat(e)), a);
|
|
2004
2008
|
}
|
|
2005
|
-
class it extends
|
|
2009
|
+
class it extends ze {
|
|
2006
2010
|
static getType() {
|
|
2007
2011
|
return "tab";
|
|
2008
2012
|
}
|
|
@@ -2026,13 +2030,13 @@ class it extends We {
|
|
|
2026
2030
|
return { ...super.exportJSON(), type: "tab", version: 1 };
|
|
2027
2031
|
}
|
|
2028
2032
|
setTextContent(e) {
|
|
2029
|
-
|
|
2033
|
+
b(126);
|
|
2030
2034
|
}
|
|
2031
2035
|
setDetail(e) {
|
|
2032
|
-
|
|
2036
|
+
b(127);
|
|
2033
2037
|
}
|
|
2034
2038
|
setMode(e) {
|
|
2035
|
-
|
|
2039
|
+
b(128);
|
|
2036
2040
|
}
|
|
2037
2041
|
canInsertTextBefore() {
|
|
2038
2042
|
return !1;
|
|
@@ -2042,12 +2046,12 @@ class it extends We {
|
|
|
2042
2046
|
}
|
|
2043
2047
|
}
|
|
2044
2048
|
function Un() {
|
|
2045
|
-
return
|
|
2049
|
+
return $t(new it());
|
|
2046
2050
|
}
|
|
2047
|
-
function
|
|
2051
|
+
function Ri(n) {
|
|
2048
2052
|
return n instanceof it;
|
|
2049
2053
|
}
|
|
2050
|
-
class
|
|
2054
|
+
class Ki {
|
|
2051
2055
|
constructor(e, t, r) {
|
|
2052
2056
|
this._selection = null, this.key = e, this.offset = t, this.type = r;
|
|
2053
2057
|
}
|
|
@@ -2057,11 +2061,11 @@ class Ri {
|
|
|
2057
2061
|
isBefore(e) {
|
|
2058
2062
|
let t = this.getNode(), r = e.getNode();
|
|
2059
2063
|
const s = this.offset, i = e.offset;
|
|
2060
|
-
if (
|
|
2064
|
+
if (v(t)) {
|
|
2061
2065
|
const o = t.getDescendantByIndex(s);
|
|
2062
2066
|
t = o ?? t;
|
|
2063
2067
|
}
|
|
2064
|
-
if (
|
|
2068
|
+
if (v(r)) {
|
|
2065
2069
|
const o = r.getDescendantByIndex(i);
|
|
2066
2070
|
r = o ?? r;
|
|
2067
2071
|
}
|
|
@@ -2069,23 +2073,23 @@ class Ri {
|
|
|
2069
2073
|
}
|
|
2070
2074
|
getNode() {
|
|
2071
2075
|
const e = V(this.key);
|
|
2072
|
-
return e === null &&
|
|
2076
|
+
return e === null && b(20), e;
|
|
2073
2077
|
}
|
|
2074
2078
|
set(e, t, r) {
|
|
2075
2079
|
const s = this._selection, i = this.key;
|
|
2076
|
-
this.key = e, this.offset = t, this.type = r, lt() || (ye() === i &&
|
|
2080
|
+
this.key = e, this.offset = t, this.type = r, lt() || (ye() === i && J(e), s !== null && (s.setCachedNodes(null), s.dirty = !0));
|
|
2077
2081
|
}
|
|
2078
2082
|
}
|
|
2079
2083
|
function ie(n, e, t) {
|
|
2080
|
-
return new
|
|
2084
|
+
return new Ki(n, e, t);
|
|
2081
2085
|
}
|
|
2082
|
-
function
|
|
2086
|
+
function an(n, e) {
|
|
2083
2087
|
let t = e.__key, r = n.offset, s = "element";
|
|
2084
2088
|
if (N(e)) {
|
|
2085
2089
|
s = "text";
|
|
2086
2090
|
const i = e.getTextContentSize();
|
|
2087
2091
|
r > i && (r = i);
|
|
2088
|
-
} else if (!
|
|
2092
|
+
} else if (!v(e)) {
|
|
2089
2093
|
const i = e.getNextSibling();
|
|
2090
2094
|
if (N(i)) t = i.__key, r = 0, s = "text";
|
|
2091
2095
|
else {
|
|
@@ -2096,15 +2100,15 @@ function cn(n, e) {
|
|
|
2096
2100
|
n.set(t, r, s);
|
|
2097
2101
|
}
|
|
2098
2102
|
function Cr(n, e) {
|
|
2099
|
-
if (
|
|
2103
|
+
if (v(e)) {
|
|
2100
2104
|
const t = e.getLastDescendant();
|
|
2101
|
-
|
|
2102
|
-
} else
|
|
2105
|
+
v(t) || N(t) ? an(n, t) : an(n, e);
|
|
2106
|
+
} else an(n, e);
|
|
2103
2107
|
}
|
|
2104
2108
|
function pe(n, e, t, r) {
|
|
2105
2109
|
n.key = e, n.offset = t, n.type = r;
|
|
2106
2110
|
}
|
|
2107
|
-
class
|
|
2111
|
+
class jt {
|
|
2108
2112
|
constructor(e) {
|
|
2109
2113
|
this._cachedNodes = null, this._nodes = e, this.dirty = !1;
|
|
2110
2114
|
}
|
|
@@ -2115,7 +2119,7 @@ class Vt {
|
|
|
2115
2119
|
this._cachedNodes = e;
|
|
2116
2120
|
}
|
|
2117
2121
|
is(e) {
|
|
2118
|
-
if (!
|
|
2122
|
+
if (!Ht(e)) return !1;
|
|
2119
2123
|
const t = this._nodes, r = e._nodes;
|
|
2120
2124
|
return t.size === r.size && Array.from(t).every((s) => r.has(s));
|
|
2121
2125
|
}
|
|
@@ -2141,7 +2145,7 @@ class Vt {
|
|
|
2141
2145
|
return this._nodes.has(e);
|
|
2142
2146
|
}
|
|
2143
2147
|
clone() {
|
|
2144
|
-
return new
|
|
2148
|
+
return new jt(new Set(this._nodes));
|
|
2145
2149
|
}
|
|
2146
2150
|
extract() {
|
|
2147
2151
|
return this.getNodes();
|
|
@@ -2202,17 +2206,17 @@ class Ce {
|
|
|
2202
2206
|
if (e !== null) return e;
|
|
2203
2207
|
const t = this.anchor, r = this.focus, s = t.isBefore(r), i = s ? t : r, o = s ? r : t;
|
|
2204
2208
|
let l = i.getNode(), c = o.getNode();
|
|
2205
|
-
const a = i.offset,
|
|
2206
|
-
if (
|
|
2207
|
-
const
|
|
2208
|
-
l =
|
|
2209
|
+
const a = i.offset, u = o.offset;
|
|
2210
|
+
if (v(l)) {
|
|
2211
|
+
const f = l.getDescendantByIndex(a);
|
|
2212
|
+
l = f ?? l;
|
|
2209
2213
|
}
|
|
2210
|
-
if (
|
|
2211
|
-
let
|
|
2212
|
-
|
|
2214
|
+
if (v(c)) {
|
|
2215
|
+
let f = c.getDescendantByIndex(u);
|
|
2216
|
+
f !== null && f !== l && c.getChildAtIndex(u) === f && (f = f.getPreviousSibling()), c = f ?? c;
|
|
2213
2217
|
}
|
|
2214
2218
|
let h;
|
|
2215
|
-
return h = l.is(c) ?
|
|
2219
|
+
return h = l.is(c) ? v(l) && l.getChildrenSize() > 0 ? [] : [l] : l.getNodesBetween(c), lt() || (this._cachedNodes = h), h;
|
|
2216
2220
|
}
|
|
2217
2221
|
setTextNodeRange(e, t, r, s) {
|
|
2218
2222
|
pe(this.anchor, e.__key, t, "text"), pe(this.focus, r.__key, s, "text"), this._cachedNodes = null, this.dirty = !0;
|
|
@@ -2221,15 +2225,15 @@ class Ce {
|
|
|
2221
2225
|
const e = this.getNodes();
|
|
2222
2226
|
if (e.length === 0) return "";
|
|
2223
2227
|
const t = e[0], r = e[e.length - 1], s = this.anchor, i = this.focus, o = s.isBefore(i), [l, c] = br(this);
|
|
2224
|
-
let a = "",
|
|
2228
|
+
let a = "", u = !0;
|
|
2225
2229
|
for (let h = 0; h < e.length; h++) {
|
|
2226
|
-
const
|
|
2227
|
-
if (
|
|
2228
|
-
`),
|
|
2229
|
-
else if (
|
|
2230
|
-
let d =
|
|
2231
|
-
|
|
2232
|
-
} else !A(
|
|
2230
|
+
const f = e[h];
|
|
2231
|
+
if (v(f) && !f.isInline()) u || (a += `
|
|
2232
|
+
`), u = !f.isEmpty();
|
|
2233
|
+
else if (u = !1, N(f)) {
|
|
2234
|
+
let d = f.getTextContent();
|
|
2235
|
+
f === t ? f === r ? s.type === "element" && i.type === "element" && i.offset !== s.offset || (d = l < c ? d.slice(l, c) : d.slice(c, l)) : d = o ? d.slice(l) : d.slice(c) : f === r && (d = o ? d.slice(0, c) : d.slice(0, l)), a += d;
|
|
2236
|
+
} else !A(f) && !Ae(f) || f === r && this.isCollapsed() || (a += f.getTextContent());
|
|
2233
2237
|
}
|
|
2234
2238
|
return a;
|
|
2235
2239
|
}
|
|
@@ -2259,100 +2263,100 @@ class Ce {
|
|
|
2259
2263
|
const o = t[i];
|
|
2260
2264
|
o === `
|
|
2261
2265
|
` || o === `\r
|
|
2262
|
-
` ? r.push(nt()) : o === " " ? r.push(Un()) : r.push(
|
|
2266
|
+
` ? r.push(nt()) : o === " " ? r.push(Un()) : r.push($(o));
|
|
2263
2267
|
}
|
|
2264
2268
|
this.insertNodes(r);
|
|
2265
2269
|
}
|
|
2266
2270
|
insertText(e) {
|
|
2267
2271
|
const t = this.anchor, r = this.focus, s = this.format, i = this.style;
|
|
2268
2272
|
let o = t, l = r;
|
|
2269
|
-
!this.isCollapsed() && r.isBefore(t) && (o = r, l = t), o.type === "element" && function(_, m, y,
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2273
|
+
!this.isCollapsed() && r.isBefore(t) && (o = r, l = t), o.type === "element" && function(_, m, y, S) {
|
|
2274
|
+
const k = _.getNode(), T = k.getChildAtIndex(_.offset), x = $(), P = Y(k) ? ve().append(x) : x;
|
|
2275
|
+
x.setFormat(y), x.setStyle(S), T === null ? k.append(P) : T.insertBefore(P), _.is(m) && m.set(x.__key, 0, "text"), _.set(x.__key, 0, "text");
|
|
2272
2276
|
}(o, l, s, i);
|
|
2273
2277
|
const c = o.offset;
|
|
2274
2278
|
let a = l.offset;
|
|
2275
|
-
const
|
|
2276
|
-
let
|
|
2277
|
-
N(
|
|
2278
|
-
const d =
|
|
2279
|
-
let p =
|
|
2280
|
-
if (h === 1 && l.type === "element" && (a = d, l.set(o.key, a, "text")), this.isCollapsed() && c === d && (
|
|
2281
|
-
let _ =
|
|
2282
|
-
if (N(_) && _.canInsertTextBefore() && !be(_) || (_ =
|
|
2283
|
-
} else if (this.isCollapsed() && c === 0 && (
|
|
2284
|
-
let _ =
|
|
2285
|
-
if (N(_) && !be(_) || (_ =
|
|
2286
|
-
} else if (
|
|
2287
|
-
const _ =
|
|
2288
|
-
_.setFormat(s),
|
|
2279
|
+
const u = this.getNodes(), h = u.length;
|
|
2280
|
+
let f = u[0];
|
|
2281
|
+
N(f) || b(26);
|
|
2282
|
+
const d = f.getTextContent().length, g = f.getParentOrThrow();
|
|
2283
|
+
let p = u[h - 1];
|
|
2284
|
+
if (h === 1 && l.type === "element" && (a = d, l.set(o.key, a, "text")), this.isCollapsed() && c === d && (f.isSegmented() || f.isToken() || !f.canInsertTextAfter() || !g.canInsertTextAfter() && f.getNextSibling() === null)) {
|
|
2285
|
+
let _ = f.getNextSibling();
|
|
2286
|
+
if (N(_) && _.canInsertTextBefore() && !be(_) || (_ = $(), _.setFormat(s), _.setStyle(i), g.canInsertTextAfter() ? f.insertAfter(_) : g.insertAfter(_)), _.select(0, 0), f = _, e !== "") return void this.insertText(e);
|
|
2287
|
+
} else if (this.isCollapsed() && c === 0 && (f.isSegmented() || f.isToken() || !f.canInsertTextBefore() || !g.canInsertTextBefore() && f.getPreviousSibling() === null)) {
|
|
2288
|
+
let _ = f.getPreviousSibling();
|
|
2289
|
+
if (N(_) && !be(_) || (_ = $(), _.setFormat(s), g.canInsertTextBefore() ? f.insertBefore(_) : g.insertBefore(_)), _.select(), f = _, e !== "") return void this.insertText(e);
|
|
2290
|
+
} else if (f.isSegmented() && c !== d) {
|
|
2291
|
+
const _ = $(f.getTextContent());
|
|
2292
|
+
_.setFormat(s), f.replace(_), f = _;
|
|
2289
2293
|
} else if (!this.isCollapsed() && e !== "") {
|
|
2290
2294
|
const _ = p.getParent();
|
|
2291
|
-
if (!g.canInsertTextBefore() || !g.canInsertTextAfter() ||
|
|
2295
|
+
if (!g.canInsertTextBefore() || !g.canInsertTextAfter() || v(_) && (!_.canInsertTextBefore() || !_.canInsertTextAfter())) return this.insertText(""), Ts(this.anchor, this.focus, null), void this.insertText(e);
|
|
2292
2296
|
}
|
|
2293
2297
|
if (h === 1) {
|
|
2294
|
-
if (
|
|
2295
|
-
const
|
|
2296
|
-
return
|
|
2298
|
+
if (f.isToken()) {
|
|
2299
|
+
const S = $(e);
|
|
2300
|
+
return S.select(), void f.replace(S);
|
|
2297
2301
|
}
|
|
2298
|
-
const _ =
|
|
2302
|
+
const _ = f.getFormat(), m = f.getStyle();
|
|
2299
2303
|
if (c !== a || _ === s && m === i) {
|
|
2300
|
-
if (
|
|
2301
|
-
const
|
|
2302
|
-
return
|
|
2304
|
+
if (Ri(f)) {
|
|
2305
|
+
const S = $(e);
|
|
2306
|
+
return S.setFormat(s), S.setStyle(i), S.select(), void f.replace(S);
|
|
2303
2307
|
}
|
|
2304
2308
|
} else {
|
|
2305
|
-
if (
|
|
2306
|
-
const
|
|
2307
|
-
if (
|
|
2309
|
+
if (f.getTextContent() !== "") {
|
|
2310
|
+
const S = $(e);
|
|
2311
|
+
if (S.setFormat(s), S.setStyle(i), S.select(), c === 0) f.insertBefore(S, !1);
|
|
2308
2312
|
else {
|
|
2309
|
-
const [
|
|
2310
|
-
|
|
2313
|
+
const [k] = f.splitText(c);
|
|
2314
|
+
k.insertAfter(S, !1);
|
|
2311
2315
|
}
|
|
2312
|
-
return void (
|
|
2316
|
+
return void (S.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length));
|
|
2313
2317
|
}
|
|
2314
|
-
|
|
2318
|
+
f.setFormat(s), f.setStyle(i);
|
|
2315
2319
|
}
|
|
2316
2320
|
const y = a - c;
|
|
2317
|
-
|
|
2321
|
+
f = f.spliceText(c, y, e, !0), f.getTextContent() === "" ? f.remove() : this.anchor.type === "text" && (f.isComposing() ? this.anchor.offset -= e.length : (this.format = _, this.style = m));
|
|
2318
2322
|
} else {
|
|
2319
|
-
const _ = /* @__PURE__ */ new Set([...
|
|
2320
|
-
let y =
|
|
2323
|
+
const _ = /* @__PURE__ */ new Set([...f.getParentKeys(), ...p.getParentKeys()]), m = v(f) ? f : f.getParentOrThrow();
|
|
2324
|
+
let y = v(p) ? p : p.getParentOrThrow(), S = p;
|
|
2321
2325
|
if (!m.is(y) && y.isInline()) do
|
|
2322
|
-
|
|
2326
|
+
S = y, y = y.getParentOrThrow();
|
|
2323
2327
|
while (y.isInline());
|
|
2324
2328
|
if (l.type === "text" && (a !== 0 || p.getTextContent() === "") || l.type === "element" && p.getIndexWithinParent() < a) if (N(p) && !p.isToken() && a !== p.getTextContentSize()) {
|
|
2325
2329
|
if (p.isSegmented()) {
|
|
2326
|
-
const
|
|
2327
|
-
p.replace(
|
|
2330
|
+
const C = $(p.getTextContent());
|
|
2331
|
+
p.replace(C), p = C;
|
|
2328
2332
|
}
|
|
2329
|
-
|
|
2333
|
+
Y(l.getNode()) || l.type !== "text" || (p = p.spliceText(0, a, "")), _.add(p.__key);
|
|
2330
2334
|
} else {
|
|
2331
|
-
const
|
|
2332
|
-
|
|
2335
|
+
const C = p.getParentOrThrow();
|
|
2336
|
+
C.canBeEmpty() || C.getChildrenSize() !== 1 ? p.remove() : C.remove();
|
|
2333
2337
|
}
|
|
2334
2338
|
else _.add(p.__key);
|
|
2335
|
-
const
|
|
2336
|
-
for (let
|
|
2337
|
-
const E = C
|
|
2338
|
-
if (E.is(
|
|
2339
|
-
E.isAttached() && (!
|
|
2340
|
-
}
|
|
2341
|
-
if (!
|
|
2342
|
-
let
|
|
2343
|
-
for (;
|
|
2344
|
-
const D =
|
|
2345
|
-
(O === 0 || D[O - 1].is(E)) && (_.delete(
|
|
2339
|
+
const k = y.getChildren(), T = new Set(u), x = m.is(y), P = m.isInline() && f.getNextSibling() === null ? m : f;
|
|
2340
|
+
for (let C = k.length - 1; C >= 0; C--) {
|
|
2341
|
+
const E = k[C];
|
|
2342
|
+
if (E.is(f) || v(E) && E.isParentOf(f)) break;
|
|
2343
|
+
E.isAttached() && (!T.has(E) || E.is(S) ? x || P.insertAfter(E, !1) : E.remove());
|
|
2344
|
+
}
|
|
2345
|
+
if (!x) {
|
|
2346
|
+
let C = y, E = null;
|
|
2347
|
+
for (; C !== null; ) {
|
|
2348
|
+
const D = C.getChildren(), O = D.length;
|
|
2349
|
+
(O === 0 || D[O - 1].is(E)) && (_.delete(C.__key), E = C), C = C.getParent();
|
|
2346
2350
|
}
|
|
2347
2351
|
}
|
|
2348
|
-
if (
|
|
2352
|
+
if (f.isToken()) if (c === d) f.select();
|
|
2349
2353
|
else {
|
|
2350
|
-
const
|
|
2351
|
-
|
|
2354
|
+
const C = $(e);
|
|
2355
|
+
C.select(), f.replace(C);
|
|
2352
2356
|
}
|
|
2353
|
-
else
|
|
2354
|
-
for (let
|
|
2355
|
-
const E =
|
|
2357
|
+
else f = f.spliceText(c, d - c, e, !0), f.getTextContent() === "" ? f.remove() : f.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length);
|
|
2358
|
+
for (let C = 1; C < h; C++) {
|
|
2359
|
+
const E = u[C], D = E.__key;
|
|
2356
2360
|
_.has(D) || E.remove();
|
|
2357
2361
|
}
|
|
2358
2362
|
}
|
|
@@ -2361,119 +2365,121 @@ class Ce {
|
|
|
2361
2365
|
if (this.isCollapsed()) return;
|
|
2362
2366
|
const { anchor: e, focus: t } = this, r = this.getNodes(), s = this.isBackward() ? t : e, i = this.isBackward() ? e : t;
|
|
2363
2367
|
let o = s.getNode(), l = i.getNode();
|
|
2364
|
-
const c =
|
|
2365
|
-
r.forEach((h) => {
|
|
2368
|
+
const c = Je(o, _e), a = Je(l, _e);
|
|
2369
|
+
N(o) && o.isToken() && s.offset < o.getTextContentSize() && (s.offset = 0), i.offset > 0 && N(l) && l.isToken() && (i.offset = l.getTextContentSize()), r.forEach((h) => {
|
|
2366
2370
|
Qe(o, h) || Qe(l, h) || h.getKey() === o.getKey() || h.getKey() === l.getKey() || h.remove();
|
|
2367
2371
|
});
|
|
2368
|
-
const
|
|
2372
|
+
const u = (h, f) => {
|
|
2369
2373
|
if (h.getTextContent() === "") h.remove();
|
|
2370
|
-
else if (
|
|
2371
|
-
const d =
|
|
2374
|
+
else if (f !== 0 && be(h)) {
|
|
2375
|
+
const d = $(h.getTextContent());
|
|
2372
2376
|
return d.setFormat(h.getFormat()), d.setStyle(h.getStyle()), h.replace(d);
|
|
2373
2377
|
}
|
|
2374
2378
|
};
|
|
2375
2379
|
if (o === l && N(o)) {
|
|
2376
2380
|
const h = Math.abs(t.offset - e.offset);
|
|
2377
|
-
return o.spliceText(s.offset, h, "", !0), void
|
|
2381
|
+
return o.spliceText(s.offset, h, "", !0), void u(o, h);
|
|
2378
2382
|
}
|
|
2379
2383
|
if (N(o)) {
|
|
2380
2384
|
const h = o.getTextContentSize() - s.offset;
|
|
2381
|
-
o.spliceText(s.offset, h, ""), o =
|
|
2385
|
+
o.spliceText(s.offset, h, ""), o = u(o, h) || o;
|
|
2382
2386
|
}
|
|
2383
|
-
N(l) && (l.spliceText(0, i.offset, ""), l =
|
|
2387
|
+
N(l) && (l.spliceText(0, i.offset, ""), l = u(l, i.offset) || l), o.isAttached() && N(o) ? o.selectEnd() : l.isAttached() && N(l) && l.selectStart(), v(c) && v(a) && c !== a && (c.append(...a.getChildren()), a.remove(), i.set(s.key, s.offset, s.type));
|
|
2384
2388
|
}
|
|
2385
2389
|
formatText(e, t = null) {
|
|
2386
|
-
if (this.isCollapsed()) return this.toggleFormat(e), void
|
|
2390
|
+
if (this.isCollapsed()) return this.toggleFormat(e), void J(null);
|
|
2387
2391
|
const r = this.getNodes(), s = [];
|
|
2388
|
-
for (const
|
|
2389
|
-
const i =
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
const p =
|
|
2402
|
-
|
|
2403
|
-
const
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2392
|
+
for (const k of r) N(k) && s.push(k);
|
|
2393
|
+
const i = (k) => {
|
|
2394
|
+
r.forEach((T) => {
|
|
2395
|
+
if (bn(T)) {
|
|
2396
|
+
const x = T.getFormatFlags(e, k);
|
|
2397
|
+
T.setTextFormat(x);
|
|
2398
|
+
}
|
|
2399
|
+
});
|
|
2400
|
+
}, o = s.length;
|
|
2401
|
+
if (o === 0) return this.toggleFormat(e), J(null), void i(t);
|
|
2402
|
+
const l = this.anchor, c = this.focus, a = this.isBackward(), u = a ? c : l, h = a ? l : c;
|
|
2403
|
+
let f = 0, d = s[0], g = u.type === "element" ? 0 : u.offset;
|
|
2404
|
+
if (u.type === "text" && g === d.getTextContentSize() && (f = 1, d = s[1], g = 0), d == null) return;
|
|
2405
|
+
const p = d.getFormatFlags(e, t);
|
|
2406
|
+
i(p);
|
|
2407
|
+
const _ = o - 1;
|
|
2408
|
+
let m = s[_];
|
|
2409
|
+
const y = h.type === "text" ? h.offset : m.getTextContentSize();
|
|
2410
|
+
if (d.is(m)) {
|
|
2411
|
+
if (g === y) return;
|
|
2412
|
+
if (be(d) || g === 0 && y === d.getTextContentSize()) d.setFormat(p);
|
|
2407
2413
|
else {
|
|
2408
|
-
const
|
|
2409
|
-
|
|
2414
|
+
const k = d.splitText(g, y), T = g === 0 ? k[0] : k[1];
|
|
2415
|
+
T.setFormat(p), u.type === "text" && u.set(T.__key, 0, "text"), h.type === "text" && h.set(T.__key, y - g, "text");
|
|
2410
2416
|
}
|
|
2411
|
-
return void (this.format =
|
|
2417
|
+
return void (this.format = p);
|
|
2412
2418
|
}
|
|
2413
|
-
|
|
2414
|
-
const
|
|
2415
|
-
|
|
2416
|
-
for (let
|
|
2417
|
-
const
|
|
2418
|
-
|
|
2419
|
+
g === 0 || be(d) || ([, d] = d.splitText(g), g = 0), d.setFormat(p);
|
|
2420
|
+
const S = m.getFormatFlags(e, p);
|
|
2421
|
+
y > 0 && (y === m.getTextContentSize() || be(m) || ([m] = m.splitText(y)), m.setFormat(S));
|
|
2422
|
+
for (let k = f + 1; k < _; k++) {
|
|
2423
|
+
const T = s[k], x = T.getFormatFlags(e, S);
|
|
2424
|
+
T.setFormat(x);
|
|
2419
2425
|
}
|
|
2420
|
-
|
|
2426
|
+
u.type === "text" && u.set(d.__key, g, "text"), h.type === "text" && h.set(m.__key, y, "text"), this.format = p | S;
|
|
2421
2427
|
}
|
|
2422
2428
|
insertNodes(e) {
|
|
2423
2429
|
if (e.length === 0) return;
|
|
2424
2430
|
if (this.anchor.key === "root") {
|
|
2425
2431
|
this.insertParagraph();
|
|
2426
|
-
const
|
|
2427
|
-
return F(
|
|
2432
|
+
const g = I();
|
|
2433
|
+
return F(g) || b(134), g.insertNodes(e);
|
|
2428
2434
|
}
|
|
2429
|
-
const t =
|
|
2430
|
-
if ("__language" in
|
|
2435
|
+
const t = (this.isBackward() ? this.focus : this.anchor).getNode(), r = Je(t, _e), s = e[e.length - 1];
|
|
2436
|
+
if (v(r) && "__language" in r) {
|
|
2431
2437
|
if ("__language" in e[0]) this.insertText(e[0].getTextContent());
|
|
2432
2438
|
else {
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2439
|
+
const g = un(this);
|
|
2440
|
+
r.splice(g, 0, e), s.selectEnd();
|
|
2435
2441
|
}
|
|
2436
2442
|
return;
|
|
2437
2443
|
}
|
|
2438
|
-
if (!e.some((
|
|
2439
|
-
|
|
2440
|
-
const
|
|
2441
|
-
return
|
|
2442
|
-
}
|
|
2443
|
-
const
|
|
2444
|
-
const
|
|
2445
|
-
let
|
|
2446
|
-
for (let
|
|
2447
|
-
const
|
|
2448
|
-
if (
|
|
2449
|
-
if (
|
|
2450
|
-
|
|
2451
|
-
} else
|
|
2452
|
-
}
|
|
2453
|
-
return
|
|
2454
|
-
}(e),
|
|
2455
|
-
let
|
|
2456
|
-
var
|
|
2457
|
-
|
|
2458
|
-
const
|
|
2459
|
-
let
|
|
2460
|
-
const
|
|
2461
|
-
for (;
|
|
2462
|
-
let
|
|
2463
|
-
for (const
|
|
2464
|
-
}(
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2467
|
-
const
|
|
2468
|
-
Ae(
|
|
2444
|
+
if (!e.some((g) => (v(g) || A(g)) && !g.isInline())) {
|
|
2445
|
+
v(r) || b(211, t.constructor.name, t.getType());
|
|
2446
|
+
const g = un(this);
|
|
2447
|
+
return r.splice(g, 0, e), void s.selectEnd();
|
|
2448
|
+
}
|
|
2449
|
+
const i = function(g) {
|
|
2450
|
+
const p = ve();
|
|
2451
|
+
let _ = null;
|
|
2452
|
+
for (let m = 0; m < g.length; m++) {
|
|
2453
|
+
const y = g[m], S = Ae(y);
|
|
2454
|
+
if (S || A(y) && y.isInline() || v(y) && y.isInline() || N(y) || y.isParentRequired()) {
|
|
2455
|
+
if (_ === null && (_ = y.createParentElementNode(), p.append(_), S)) continue;
|
|
2456
|
+
_ !== null && _.append(y);
|
|
2457
|
+
} else p.append(y), _ = null;
|
|
2458
|
+
}
|
|
2459
|
+
return p;
|
|
2460
|
+
}(e), o = i.getLastDescendant(), l = i.getChildren(), c = !v(r) || !r.isEmpty() ? this.insertParagraph() : null, a = l[l.length - 1];
|
|
2461
|
+
let u = l[0];
|
|
2462
|
+
var h;
|
|
2463
|
+
v(h = u) && _e(h) && !h.isEmpty() && v(r) && (!r.isEmpty() || r.canMergeWhenEmpty()) && (v(r) || b(211, t.constructor.name, t.getType()), r.append(...u.getChildren()), u = l[1]), u && (r === null && b(212, t.constructor.name, t.getType()), function(g, p, _) {
|
|
2464
|
+
const m = p.getParentOrThrow().getLastChild();
|
|
2465
|
+
let y = p;
|
|
2466
|
+
const S = [p];
|
|
2467
|
+
for (; y !== m; ) y.getNextSibling() || b(140), y = y.getNextSibling(), S.push(y);
|
|
2468
|
+
let k = g;
|
|
2469
|
+
for (const T of S) k = k.insertAfter(T);
|
|
2470
|
+
}(r, u));
|
|
2471
|
+
const f = Je(o, _e);
|
|
2472
|
+
c && v(f) && (c.canMergeWhenEmpty() || _e(a)) && (f.append(...c.getChildren()), c.remove()), v(r) && r.isEmpty() && r.remove(), o.selectEnd();
|
|
2473
|
+
const d = v(r) ? r.getLastChild() : null;
|
|
2474
|
+
Ae(d) && f !== r && d.remove();
|
|
2469
2475
|
}
|
|
2470
2476
|
insertParagraph() {
|
|
2471
2477
|
if (this.anchor.key === "root") {
|
|
2472
2478
|
const o = ve();
|
|
2473
2479
|
return G().splice(this.anchor.offset, 0, [o]), o.select(), o;
|
|
2474
2480
|
}
|
|
2475
|
-
const e =
|
|
2476
|
-
|
|
2481
|
+
const e = un(this), t = Je(this.anchor.getNode(), _e);
|
|
2482
|
+
v(t) || b(213);
|
|
2477
2483
|
const r = t.getChildAtIndex(e), s = r ? [r, ...r.getNextSiblings()] : [], i = t.insertNewAfter(this, !1);
|
|
2478
2484
|
return i ? (i.append(...s), i.selectStart(), i) : null;
|
|
2479
2485
|
}
|
|
@@ -2491,19 +2497,19 @@ class Ce {
|
|
|
2491
2497
|
if (t === 0) return [];
|
|
2492
2498
|
if (t === 1) {
|
|
2493
2499
|
if (N(o) && !this.isCollapsed()) {
|
|
2494
|
-
const h = c > a ? a : c,
|
|
2500
|
+
const h = c > a ? a : c, f = c > a ? c : a, d = o.splitText(h, f), g = h === 0 ? d[0] : d[1];
|
|
2495
2501
|
return g != null ? [g] : [];
|
|
2496
2502
|
}
|
|
2497
2503
|
return [o];
|
|
2498
2504
|
}
|
|
2499
|
-
const
|
|
2505
|
+
const u = s.isBefore(i);
|
|
2500
2506
|
if (N(o)) {
|
|
2501
|
-
const h =
|
|
2507
|
+
const h = u ? c : a;
|
|
2502
2508
|
h === o.getTextContentSize() ? e.shift() : h !== 0 && ([, o] = o.splitText(h), e[0] = o);
|
|
2503
2509
|
}
|
|
2504
2510
|
if (N(l)) {
|
|
2505
|
-
const h = l.getTextContent().length,
|
|
2506
|
-
|
|
2511
|
+
const h = l.getTextContent().length, f = u ? a : c;
|
|
2512
|
+
f === 0 ? e.pop() : f !== h && ([l] = l.splitText(f), e[r] = l);
|
|
2507
2513
|
}
|
|
2508
2514
|
return e;
|
|
2509
2515
|
}
|
|
@@ -2514,49 +2520,49 @@ class Ce {
|
|
|
2514
2520
|
const d = Pr();
|
|
2515
2521
|
return d.add(l.__key), void ue(d);
|
|
2516
2522
|
}
|
|
2517
|
-
const
|
|
2518
|
-
if (N(
|
|
2519
|
-
const d =
|
|
2523
|
+
const f = t ? l.getPreviousSibling() : l.getNextSibling();
|
|
2524
|
+
if (N(f)) {
|
|
2525
|
+
const d = f.__key, g = t ? f.getTextContent().length : 0;
|
|
2520
2526
|
return s.set(d, g, "text"), void (o && i.set(d, g, "text"));
|
|
2521
2527
|
}
|
|
2522
2528
|
{
|
|
2523
2529
|
const d = l.getParentOrThrow();
|
|
2524
2530
|
let g, p;
|
|
2525
|
-
return
|
|
2531
|
+
return v(f) ? (p = f.__key, g = t ? f.getChildrenSize() : 0) : (g = l.getIndexWithinParent(), p = d.__key, t || g++), s.set(p, g, "element"), void (o && i.set(p, g, "element"));
|
|
2526
2532
|
}
|
|
2527
2533
|
}
|
|
2528
2534
|
const c = M(), a = se(c._window);
|
|
2529
2535
|
if (!a) return;
|
|
2530
|
-
const
|
|
2531
|
-
if (h === null ||
|
|
2532
|
-
|
|
2536
|
+
const u = c._blockCursorElement, h = c._rootElement;
|
|
2537
|
+
if (h === null || u === null || !v(l) || l.isInline() || l.canBeEmpty() || $n(u, c, h), function(f, d, g, p) {
|
|
2538
|
+
f.modify(d, g, p);
|
|
2533
2539
|
}(a, e, t ? "backward" : "forward", r), a.rangeCount > 0) {
|
|
2534
|
-
const
|
|
2535
|
-
if (this.applyDOMRange(
|
|
2540
|
+
const f = a.getRangeAt(0), d = this.anchor.getNode(), g = Y(d) ? d : Ti(d);
|
|
2541
|
+
if (this.applyDOMRange(f), this.dirty = !0, !o) {
|
|
2536
2542
|
const p = this.getNodes(), _ = [];
|
|
2537
2543
|
let m = !1;
|
|
2538
2544
|
for (let y = 0; y < p.length; y++) {
|
|
2539
|
-
const
|
|
2540
|
-
Qe(
|
|
2545
|
+
const S = p[y];
|
|
2546
|
+
Qe(S, g) ? _.push(S) : m = !0;
|
|
2541
2547
|
}
|
|
2542
2548
|
if (m && _.length > 0) if (t) {
|
|
2543
2549
|
const y = _[0];
|
|
2544
|
-
|
|
2550
|
+
v(y) ? y.selectStart() : y.getParentOrThrow().selectStart();
|
|
2545
2551
|
} else {
|
|
2546
2552
|
const y = _[_.length - 1];
|
|
2547
|
-
|
|
2553
|
+
v(y) ? y.selectEnd() : y.getParentOrThrow().selectEnd();
|
|
2548
2554
|
}
|
|
2549
|
-
a.anchorNode ===
|
|
2550
|
-
const
|
|
2551
|
-
pe(
|
|
2555
|
+
a.anchorNode === f.startContainer && a.anchorOffset === f.startOffset || function(y) {
|
|
2556
|
+
const S = y.focus, k = y.anchor, T = k.key, x = k.offset, P = k.type;
|
|
2557
|
+
pe(k, S.key, S.offset, S.type), pe(S, T, x, P), y._cachedNodes = null;
|
|
2552
2558
|
}(this);
|
|
2553
2559
|
}
|
|
2554
2560
|
}
|
|
2555
2561
|
}
|
|
2556
2562
|
forwardDeletion(e, t, r) {
|
|
2557
|
-
if (!r && (e.type === "element" &&
|
|
2563
|
+
if (!r && (e.type === "element" && v(t) && e.offset === t.getChildrenSize() || e.type === "text" && e.offset === t.getTextContentSize())) {
|
|
2558
2564
|
const s = t.getParent(), i = t.getNextSibling() || (s === null ? null : s.getNextSibling());
|
|
2559
|
-
if (
|
|
2565
|
+
if (v(i) && i.isShadowRoot()) return !0;
|
|
2560
2566
|
}
|
|
2561
2567
|
return !1;
|
|
2562
2568
|
}
|
|
@@ -2568,15 +2574,15 @@ class Ce {
|
|
|
2568
2574
|
if (this.forwardDeletion(r, s, e)) return;
|
|
2569
2575
|
const i = this.focus, o = dr(i, e);
|
|
2570
2576
|
if (A(o) && !o.isIsolated()) {
|
|
2571
|
-
if (o.isKeyboardSelectable() &&
|
|
2577
|
+
if (o.isKeyboardSelectable() && v(s) && s.getChildrenSize() === 0) {
|
|
2572
2578
|
s.remove();
|
|
2573
2579
|
const l = Pr();
|
|
2574
2580
|
l.add(o.__key), ue(l);
|
|
2575
2581
|
} else
|
|
2576
|
-
o.remove(), M().dispatchCommand(
|
|
2582
|
+
o.remove(), M().dispatchCommand(wn, void 0);
|
|
2577
2583
|
return;
|
|
2578
2584
|
}
|
|
2579
|
-
if (!e &&
|
|
2585
|
+
if (!e && v(o) && v(s) && s.isEmpty()) return s.remove(), void o.selectStart();
|
|
2580
2586
|
if (this.modify("extend", e, "character"), this.isCollapsed()) {
|
|
2581
2587
|
if (e && r.offset === 0 && (r.type === "element" ? r.getNode() : r.getNode().getParentOrThrow()).collapseAtStart(this))
|
|
2582
2588
|
return;
|
|
@@ -2590,23 +2596,23 @@ class Ce {
|
|
|
2590
2596
|
if (s.is(l) || e && c !== 0 || !e && c !== a) return void wr(s, e, c);
|
|
2591
2597
|
}
|
|
2592
2598
|
(function(c, a) {
|
|
2593
|
-
const
|
|
2594
|
-
if (
|
|
2595
|
-
const g =
|
|
2596
|
-
m !==
|
|
2599
|
+
const u = c.anchor, h = c.focus, f = u.getNode(), d = h.getNode();
|
|
2600
|
+
if (f === d && u.type === "text" && h.type === "text") {
|
|
2601
|
+
const g = u.offset, p = h.offset, _ = g < p, m = _ ? g : p, y = _ ? p : g, S = y - 1;
|
|
2602
|
+
m !== S && (ns(f.getTextContent().slice(m, y)) || (a ? h.offset = S : u.offset = S));
|
|
2597
2603
|
}
|
|
2598
2604
|
})(this, e);
|
|
2599
2605
|
}
|
|
2600
2606
|
}
|
|
2601
2607
|
if (this.removeText(), e && !t && this.isCollapsed() && this.anchor.type === "element" && this.anchor.offset === 0) {
|
|
2602
2608
|
const r = this.anchor.getNode();
|
|
2603
|
-
r.isEmpty() &&
|
|
2609
|
+
r.isEmpty() && Y(r.getParent()) && r.getIndexWithinParent() === 0 && r.collapseAtStart(this);
|
|
2604
2610
|
}
|
|
2605
2611
|
}
|
|
2606
2612
|
deleteLine(e) {
|
|
2607
2613
|
if (this.isCollapsed()) {
|
|
2608
2614
|
const t = this.anchor.type === "element";
|
|
2609
|
-
if (t && this.insertText(" "), this.modify("extend", e, "lineboundary"),
|
|
2615
|
+
if (t && this.insertText(" "), this.modify("extend", e, "lineboundary"), this.isCollapsed() && this.anchor.offset === 0 && this.modify("extend", e, "character"), t) {
|
|
2610
2616
|
const r = e ? this.anchor : this.focus;
|
|
2611
2617
|
r.set(r.key, r.offset + 1, r.type);
|
|
2612
2618
|
}
|
|
@@ -2628,8 +2634,8 @@ class Ce {
|
|
|
2628
2634
|
return [this.anchor, this.focus];
|
|
2629
2635
|
}
|
|
2630
2636
|
}
|
|
2631
|
-
function
|
|
2632
|
-
return n instanceof
|
|
2637
|
+
function Ht(n) {
|
|
2638
|
+
return n instanceof jt;
|
|
2633
2639
|
}
|
|
2634
2640
|
function kr(n) {
|
|
2635
2641
|
const e = n.offset;
|
|
@@ -2647,9 +2653,9 @@ function wr(n, e, t) {
|
|
|
2647
2653
|
const r = n, s = r.getTextContent().split(/(?=\s)/g), i = s.length;
|
|
2648
2654
|
let o = 0, l = 0;
|
|
2649
2655
|
for (let a = 0; a < i; a++) {
|
|
2650
|
-
const
|
|
2651
|
-
if (l = o, o += s[a].length, e && o === t || o > t ||
|
|
2652
|
-
s.splice(a, 1),
|
|
2656
|
+
const u = a === i - 1;
|
|
2657
|
+
if (l = o, o += s[a].length, e && o === t || o > t || u) {
|
|
2658
|
+
s.splice(a, 1), u && (l = void 0);
|
|
2653
2659
|
break;
|
|
2654
2660
|
}
|
|
2655
2661
|
}
|
|
@@ -2662,32 +2668,32 @@ function Nr(n, e, t, r) {
|
|
|
2662
2668
|
let o = !1;
|
|
2663
2669
|
const l = n.childNodes, c = l.length, a = r._blockCursorElement;
|
|
2664
2670
|
i === c && (o = !0, i = c - 1);
|
|
2665
|
-
let
|
|
2666
|
-
if (
|
|
2671
|
+
let u = l[i], h = !1;
|
|
2672
|
+
if (u === a) u = l[i + 1], h = !0;
|
|
2667
2673
|
else if (a !== null) {
|
|
2668
|
-
const
|
|
2669
|
-
n ===
|
|
2674
|
+
const f = a.parentNode;
|
|
2675
|
+
n === f && e > Array.prototype.indexOf.call(f.children, a) && i--;
|
|
2670
2676
|
}
|
|
2671
|
-
if (s = Oe(
|
|
2677
|
+
if (s = Oe(u), N(s)) i = or(s, o);
|
|
2672
2678
|
else {
|
|
2673
|
-
let
|
|
2674
|
-
if (
|
|
2675
|
-
if (
|
|
2676
|
-
i = Math.min(
|
|
2677
|
-
let d =
|
|
2678
|
-
if (
|
|
2679
|
+
let f = Oe(n);
|
|
2680
|
+
if (f === null) return null;
|
|
2681
|
+
if (v(f)) {
|
|
2682
|
+
i = Math.min(f.getChildrenSize(), i);
|
|
2683
|
+
let d = f.getChildAtIndex(i);
|
|
2684
|
+
if (v(d) && function(g, p, _) {
|
|
2679
2685
|
const m = g.getParent();
|
|
2680
2686
|
return _ === null || m === null || !m.canBeEmpty() || m !== _.getNode();
|
|
2681
2687
|
}(d, 0, t)) {
|
|
2682
2688
|
const g = o ? d.getLastDescendant() : d.getFirstDescendant();
|
|
2683
|
-
g === null ?
|
|
2689
|
+
g === null ? f = d : (d = g, f = v(d) ? d : d.getParentOrThrow()), i = 0;
|
|
2684
2690
|
}
|
|
2685
|
-
N(d) ? (s = d,
|
|
2691
|
+
N(d) ? (s = d, f = null, i = or(d, o)) : d !== f && o && !h && i++;
|
|
2686
2692
|
} else {
|
|
2687
|
-
const d =
|
|
2688
|
-
i = e === 0 && A(
|
|
2693
|
+
const d = f.getIndexWithinParent();
|
|
2694
|
+
i = e === 0 && A(f) && Oe(n) === f ? d : d + 1, f = f.getParentOrThrow();
|
|
2689
2695
|
}
|
|
2690
|
-
if (
|
|
2696
|
+
if (v(f)) return ie(f.__key, i, "element");
|
|
2691
2697
|
}
|
|
2692
2698
|
} else s = Oe(n);
|
|
2693
2699
|
return N(s) ? ie(s.__key, i, "text") : null;
|
|
@@ -2697,15 +2703,15 @@ function Er(n, e, t) {
|
|
|
2697
2703
|
if (r === 0) {
|
|
2698
2704
|
const i = s.getPreviousSibling(), o = s.getParent();
|
|
2699
2705
|
if (e) {
|
|
2700
|
-
if ((t || !e) && i === null &&
|
|
2706
|
+
if ((t || !e) && i === null && v(o) && o.isInline()) {
|
|
2701
2707
|
const l = o.getPreviousSibling();
|
|
2702
2708
|
N(l) && (n.key = l.__key, n.offset = l.getTextContent().length);
|
|
2703
2709
|
}
|
|
2704
|
-
} else
|
|
2710
|
+
} else v(i) && !t && i.isInline() ? (n.key = i.__key, n.offset = i.getChildrenSize(), n.type = "element") : N(i) && (n.key = i.__key, n.offset = i.getTextContent().length);
|
|
2705
2711
|
} else if (r === s.getTextContent().length) {
|
|
2706
2712
|
const i = s.getNextSibling(), o = s.getParent();
|
|
2707
|
-
if (e &&
|
|
2708
|
-
else if ((t || e) && i === null &&
|
|
2713
|
+
if (e && v(i) && i.isInline()) n.key = i.__key, n.offset = 0, n.type = "element";
|
|
2714
|
+
else if ((t || e) && i === null && v(o) && o.isInline() && !o.canInsertTextAfter()) {
|
|
2709
2715
|
const l = o.getNextSibling();
|
|
2710
2716
|
N(l) && (n.key = l.__key, n.offset = 0);
|
|
2711
2717
|
}
|
|
@@ -2734,32 +2740,32 @@ function Cs(n, e, t, r, s, i) {
|
|
|
2734
2740
|
}
|
|
2735
2741
|
return Ts(o, l, i), [o, l];
|
|
2736
2742
|
}
|
|
2737
|
-
function
|
|
2738
|
-
return
|
|
2743
|
+
function uo(n) {
|
|
2744
|
+
return v(n) && !n.isInline();
|
|
2739
2745
|
}
|
|
2740
2746
|
function ks(n, e, t, r, s, i) {
|
|
2741
2747
|
const o = fe(), l = new Ce(ie(n, e, s), ie(t, r, i), 0, "");
|
|
2742
2748
|
return l.dirty = !0, o._selection = l, l;
|
|
2743
2749
|
}
|
|
2744
|
-
function
|
|
2750
|
+
function fo() {
|
|
2745
2751
|
const n = ie("root", 0, "element"), e = ie("root", 0, "element");
|
|
2746
2752
|
return new Ce(n, e, 0, "");
|
|
2747
2753
|
}
|
|
2748
2754
|
function Pr() {
|
|
2749
|
-
return new
|
|
2755
|
+
return new jt(/* @__PURE__ */ new Set());
|
|
2750
2756
|
}
|
|
2751
|
-
function
|
|
2752
|
-
return
|
|
2757
|
+
function ho(n, e) {
|
|
2758
|
+
return qt(null, n, e, null);
|
|
2753
2759
|
}
|
|
2754
|
-
function
|
|
2760
|
+
function qt(n, e, t, r) {
|
|
2755
2761
|
const s = t._window;
|
|
2756
2762
|
if (s === null) return null;
|
|
2757
|
-
const i = r || s.event, o = i ? i.type : void 0, l = o === "selectionchange", c = !
|
|
2758
|
-
let a,
|
|
2763
|
+
const i = r || s.event, o = i ? i.type : void 0, l = o === "selectionchange", c = !hn && (l || o === "beforeinput" || o === "compositionstart" || o === "compositionend" || o === "click" && i && i.detail === 3 || o === "drop" || o === void 0);
|
|
2764
|
+
let a, u, h, f;
|
|
2759
2765
|
if (F(n) && !c) return n.clone();
|
|
2760
2766
|
if (e === null) return null;
|
|
2761
|
-
if (a = e.anchorNode,
|
|
2762
|
-
const d = Cs(a, h,
|
|
2767
|
+
if (a = e.anchorNode, u = e.focusNode, h = e.anchorOffset, f = e.focusOffset, l && F(n) && !Mt(t, a, u)) return n.clone();
|
|
2768
|
+
const d = Cs(a, h, u, f, t, n);
|
|
2763
2769
|
if (d === null) return null;
|
|
2764
2770
|
const [g, p] = d;
|
|
2765
2771
|
return new Ce(g, p, F(n) ? n.format : 0, F(n) ? n.style : "");
|
|
@@ -2777,117 +2783,117 @@ function Lt(n, e, t, r = 1) {
|
|
|
2777
2783
|
if (n.isCollapsed()) {
|
|
2778
2784
|
const a = s.offset;
|
|
2779
2785
|
if (t <= a && r > 0 || t < a && r < 0) {
|
|
2780
|
-
const
|
|
2781
|
-
s.set(c,
|
|
2786
|
+
const u = Math.max(0, a + r);
|
|
2787
|
+
s.set(c, u, "element"), i.set(c, u, "element"), Fr(n);
|
|
2782
2788
|
}
|
|
2783
2789
|
} else {
|
|
2784
|
-
const a = n.isBackward(),
|
|
2790
|
+
const a = n.isBackward(), u = a ? i : s, h = u.getNode(), f = a ? s : i, d = f.getNode();
|
|
2785
2791
|
if (e.is(h)) {
|
|
2786
|
-
const g = f.offset;
|
|
2787
|
-
(t <= g && r > 0 || t < g && r < 0) && f.set(c, Math.max(0, g + r), "element");
|
|
2788
|
-
}
|
|
2789
|
-
if (e.is(d)) {
|
|
2790
2792
|
const g = u.offset;
|
|
2791
2793
|
(t <= g && r > 0 || t < g && r < 0) && u.set(c, Math.max(0, g + r), "element");
|
|
2792
2794
|
}
|
|
2795
|
+
if (e.is(d)) {
|
|
2796
|
+
const g = f.offset;
|
|
2797
|
+
(t <= g && r > 0 || t < g && r < 0) && f.set(c, Math.max(0, g + r), "element");
|
|
2798
|
+
}
|
|
2793
2799
|
}
|
|
2794
2800
|
Fr(n);
|
|
2795
2801
|
}
|
|
2796
2802
|
function Fr(n) {
|
|
2797
2803
|
const e = n.anchor, t = e.offset, r = n.focus, s = r.offset, i = e.getNode(), o = r.getNode();
|
|
2798
2804
|
if (n.isCollapsed()) {
|
|
2799
|
-
if (!
|
|
2805
|
+
if (!v(i)) return;
|
|
2800
2806
|
const l = i.getChildrenSize(), c = t >= l, a = c ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
|
|
2801
2807
|
if (N(a)) {
|
|
2802
|
-
let
|
|
2803
|
-
c && (
|
|
2808
|
+
let u = 0;
|
|
2809
|
+
c && (u = a.getTextContentSize()), e.set(a.__key, u, "text"), r.set(a.__key, u, "text");
|
|
2804
2810
|
}
|
|
2805
2811
|
} else {
|
|
2806
|
-
if (
|
|
2812
|
+
if (v(i)) {
|
|
2807
2813
|
const l = i.getChildrenSize(), c = t >= l, a = c ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
|
|
2808
2814
|
if (N(a)) {
|
|
2809
|
-
let
|
|
2810
|
-
c && (
|
|
2815
|
+
let u = 0;
|
|
2816
|
+
c && (u = a.getTextContentSize()), e.set(a.__key, u, "text");
|
|
2811
2817
|
}
|
|
2812
2818
|
}
|
|
2813
|
-
if (
|
|
2819
|
+
if (v(o)) {
|
|
2814
2820
|
const l = o.getChildrenSize(), c = s >= l, a = c ? o.getChildAtIndex(l - 1) : o.getChildAtIndex(s);
|
|
2815
2821
|
if (N(a)) {
|
|
2816
|
-
let
|
|
2817
|
-
c && (
|
|
2822
|
+
let u = 0;
|
|
2823
|
+
c && (u = a.getTextContentSize()), r.set(a.__key, u, "text");
|
|
2818
2824
|
}
|
|
2819
2825
|
}
|
|
2820
2826
|
}
|
|
2821
2827
|
}
|
|
2822
2828
|
function Ot(n, e, t, r, s) {
|
|
2823
2829
|
let i = null, o = 0, l = null;
|
|
2824
|
-
r !== null ? (i = r.__key, N(r) ? (o = r.getTextContentSize(), l = "text") :
|
|
2830
|
+
r !== null ? (i = r.__key, N(r) ? (o = r.getTextContentSize(), l = "text") : v(r) && (o = r.getChildrenSize(), l = "element")) : s !== null && (i = s.__key, N(s) ? l = "text" : v(s) && (l = "element")), i !== null && l !== null ? n.set(i, o, l) : (o = e.getIndexWithinParent(), o === -1 && (o = t.getChildrenSize()), n.set(t.__key, o, "element"));
|
|
2825
2831
|
}
|
|
2826
2832
|
function Dr(n, e, t, r, s) {
|
|
2827
2833
|
n.type === "text" ? (n.key = t, e || (n.offset += s)) : n.offset > r.getIndexWithinParent() && (n.offset -= 1);
|
|
2828
2834
|
}
|
|
2829
|
-
function
|
|
2830
|
-
const l = r.anchorNode, c = r.focusNode, a = r.anchorOffset,
|
|
2835
|
+
function $i(n, e, t, r, s, i, o) {
|
|
2836
|
+
const l = r.anchorNode, c = r.focusNode, a = r.anchorOffset, u = r.focusOffset, h = document.activeElement;
|
|
2831
2837
|
if (s.has("collaboration") && h !== i || h !== null && Xr(h)) return;
|
|
2832
2838
|
if (!F(e)) return void (n !== null && Mt(t, l, c) && r.removeAllRanges());
|
|
2833
|
-
const
|
|
2834
|
-
let P = _,
|
|
2835
|
-
if (
|
|
2839
|
+
const f = e.anchor, d = e.focus, g = f.key, p = d.key, _ = Nt(t, g), m = Nt(t, p), y = f.offset, S = d.offset, k = e.format, T = e.style, x = e.isCollapsed();
|
|
2840
|
+
let P = _, C = m, E = !1;
|
|
2841
|
+
if (f.type === "text") {
|
|
2836
2842
|
P = kt(_);
|
|
2837
|
-
const
|
|
2838
|
-
E =
|
|
2843
|
+
const W = f.getNode();
|
|
2844
|
+
E = W.getFormat() !== k || W.getStyle() !== T;
|
|
2839
2845
|
} else F(n) && n.anchor.type === "text" && (E = !0);
|
|
2840
|
-
var D, O,
|
|
2841
|
-
if (d.type === "text" && (
|
|
2846
|
+
var D, O, z, L, U;
|
|
2847
|
+
if (d.type === "text" && (C = kt(m)), P !== null && C !== null && (x && (n === null || E || F(n) && (n.format !== k || n.style !== T)) && (D = k, O = T, z = y, L = g, U = performance.now(), _s = [D, O, z, L, U]), a !== y || u !== S || l !== P || c !== C || r.type === "Range" && x || (h !== null && i.contains(h) || i.focus({ preventScroll: !0 }), f.type === "element"))) {
|
|
2842
2848
|
try {
|
|
2843
|
-
r.setBaseAndExtent(P, y,
|
|
2849
|
+
r.setBaseAndExtent(P, y, C, S);
|
|
2844
2850
|
} catch {
|
|
2845
2851
|
}
|
|
2846
2852
|
if (!s.has("skip-scroll-into-view") && e.isCollapsed() && i !== null && i === document.activeElement) {
|
|
2847
|
-
const
|
|
2848
|
-
if (
|
|
2853
|
+
const W = e instanceof Ce && e.anchor.type === "element" ? P.childNodes[y] || null : r.rangeCount > 0 ? r.getRangeAt(0) : null;
|
|
2854
|
+
if (W !== null) {
|
|
2849
2855
|
let de;
|
|
2850
|
-
if (
|
|
2856
|
+
if (W instanceof Text) {
|
|
2851
2857
|
const De = document.createRange();
|
|
2852
|
-
De.selectNode(
|
|
2853
|
-
} else de =
|
|
2858
|
+
De.selectNode(W), de = De.getBoundingClientRect();
|
|
2859
|
+
} else de = W.getBoundingClientRect();
|
|
2854
2860
|
(function(De, Be, Hn) {
|
|
2855
2861
|
const qn = Hn.ownerDocument, Qn = qn.defaultView;
|
|
2856
2862
|
if (Qn === null) return;
|
|
2857
|
-
let { top:
|
|
2863
|
+
let { top: Gt, bottom: Zt } = Be, at = 0, ut = 0, he = Hn;
|
|
2858
2864
|
for (; he !== null; ) {
|
|
2859
|
-
const
|
|
2860
|
-
if (
|
|
2865
|
+
const en = he === qn.body;
|
|
2866
|
+
if (en) at = 0, ut = Kt(De).innerHeight;
|
|
2861
2867
|
else {
|
|
2862
2868
|
const ft = he.getBoundingClientRect();
|
|
2863
2869
|
at = ft.top, ut = ft.bottom;
|
|
2864
2870
|
}
|
|
2865
2871
|
let Re = 0;
|
|
2866
|
-
if (
|
|
2872
|
+
if (Gt < at ? Re = -(at - Gt) : Zt > ut && (Re = Zt - ut), Re !== 0) if (en) Qn.scrollBy(0, Re);
|
|
2867
2873
|
else {
|
|
2868
2874
|
const ft = he.scrollTop;
|
|
2869
2875
|
he.scrollTop += Re;
|
|
2870
2876
|
const Xn = he.scrollTop - ft;
|
|
2871
|
-
|
|
2877
|
+
Gt -= Xn, Zt -= Xn;
|
|
2872
2878
|
}
|
|
2873
|
-
if (
|
|
2879
|
+
if (en) break;
|
|
2874
2880
|
he = Rt(he);
|
|
2875
2881
|
}
|
|
2876
2882
|
})(t, de, i);
|
|
2877
2883
|
}
|
|
2878
2884
|
}
|
|
2879
|
-
|
|
2885
|
+
Tn = !0;
|
|
2880
2886
|
}
|
|
2881
2887
|
}
|
|
2882
|
-
function
|
|
2888
|
+
function go(n) {
|
|
2883
2889
|
let e = I() || ot();
|
|
2884
2890
|
e === null && (e = G().selectEnd()), e.insertNodes(n);
|
|
2885
2891
|
}
|
|
2886
|
-
function
|
|
2892
|
+
function un(n) {
|
|
2887
2893
|
let e = n;
|
|
2888
2894
|
n.isCollapsed() || e.removeText();
|
|
2889
2895
|
const t = I();
|
|
2890
|
-
F(t) && (e = t), F(e) ||
|
|
2896
|
+
F(t) && (e = t), F(e) || b(161);
|
|
2891
2897
|
const r = e.anchor;
|
|
2892
2898
|
let s = r.getNode(), i = r.offset;
|
|
2893
2899
|
for (; !_e(s); ) [s, i] = Ji(s, i);
|
|
@@ -2905,7 +2911,7 @@ function Ji(n, e) {
|
|
|
2905
2911
|
const i = e === 0 ? 0 : 1;
|
|
2906
2912
|
return [t, s[0].getIndexWithinParent() + i];
|
|
2907
2913
|
}
|
|
2908
|
-
if (!
|
|
2914
|
+
if (!v(n) || e === 0) return [t, n.getIndexWithinParent()];
|
|
2909
2915
|
const r = n.getChildAtIndex(e);
|
|
2910
2916
|
if (r) {
|
|
2911
2917
|
const s = new Ce(ie(n.__key, e, "element"), ie(n.__key, e, "element"), 0, ""), i = n.insertNewAfter(s);
|
|
@@ -2913,29 +2919,29 @@ function Ji(n, e) {
|
|
|
2913
2919
|
}
|
|
2914
2920
|
return [t, n.getIndexWithinParent() + 1];
|
|
2915
2921
|
}
|
|
2916
|
-
let R = null, K = null, Q = !1,
|
|
2922
|
+
let R = null, K = null, Q = !1, fn = !1, pt = 0;
|
|
2917
2923
|
const Lr = { characterData: !0, childList: !0, subtree: !0 };
|
|
2918
2924
|
function lt() {
|
|
2919
2925
|
return Q || R !== null && R._readOnly;
|
|
2920
2926
|
}
|
|
2921
2927
|
function q() {
|
|
2922
|
-
Q &&
|
|
2928
|
+
Q && b(13);
|
|
2923
2929
|
}
|
|
2924
2930
|
function bs() {
|
|
2925
|
-
pt > 99 &&
|
|
2931
|
+
pt > 99 && b(14);
|
|
2926
2932
|
}
|
|
2927
2933
|
function fe() {
|
|
2928
|
-
return R === null &&
|
|
2934
|
+
return R === null && b(195, ws()), R;
|
|
2929
2935
|
}
|
|
2930
2936
|
function M() {
|
|
2931
|
-
return K === null &&
|
|
2937
|
+
return K === null && b(196, ws()), K;
|
|
2932
2938
|
}
|
|
2933
2939
|
function ws() {
|
|
2934
2940
|
let n = 0;
|
|
2935
|
-
const e = /* @__PURE__ */ new Set(), t =
|
|
2941
|
+
const e = /* @__PURE__ */ new Set(), t = Yt.version;
|
|
2936
2942
|
if (typeof window < "u") for (const s of document.querySelectorAll("[contenteditable]")) {
|
|
2937
|
-
const i =
|
|
2938
|
-
if (
|
|
2943
|
+
const i = zt(s);
|
|
2944
|
+
if (zn(i)) n++;
|
|
2939
2945
|
else if (i) {
|
|
2940
2946
|
let o = String(i.constructor.version || "<0.17.1");
|
|
2941
2947
|
o === t && (o += " (separately built, likely a bundler configuration issue)"), e.add(o);
|
|
@@ -2944,13 +2950,13 @@ function ws() {
|
|
|
2944
2950
|
let r = ` Detected on the page: ${n} compatible editor(s) with version ${t}`;
|
|
2945
2951
|
return e.size && (r += ` and incompatible editors with versions ${Array.from(e).join(", ")}`), r;
|
|
2946
2952
|
}
|
|
2947
|
-
function
|
|
2953
|
+
function Ui() {
|
|
2948
2954
|
return K;
|
|
2949
2955
|
}
|
|
2950
2956
|
function Or(n, e, t) {
|
|
2951
2957
|
const r = e.__type, s = function(l, c) {
|
|
2952
2958
|
const a = l._nodes.get(c);
|
|
2953
|
-
return a === void 0 &&
|
|
2959
|
+
return a === void 0 && b(30, c), a;
|
|
2954
2960
|
}(n, r);
|
|
2955
2961
|
let i = t.get(r);
|
|
2956
2962
|
i === void 0 && (i = Array.from(s.transforms), t.set(r, i));
|
|
@@ -2967,16 +2973,16 @@ function Ns(n, e) {
|
|
|
2967
2973
|
Array.isArray(e) || (r = [e]);
|
|
2968
2974
|
for (const s of r) t.add(s);
|
|
2969
2975
|
}
|
|
2970
|
-
function
|
|
2976
|
+
function _o(n) {
|
|
2971
2977
|
return Vn(n, M()._nodes);
|
|
2972
2978
|
}
|
|
2973
2979
|
function Vn(n, e) {
|
|
2974
2980
|
const t = n.type, r = e.get(t);
|
|
2975
|
-
r === void 0 &&
|
|
2981
|
+
r === void 0 && b(17, t);
|
|
2976
2982
|
const s = r.klass;
|
|
2977
|
-
n.type !== s.getType() &&
|
|
2983
|
+
n.type !== s.getType() && b(18, s.name);
|
|
2978
2984
|
const i = s.importJSON(n), o = n.children;
|
|
2979
|
-
if (
|
|
2985
|
+
if (v(i) && Array.isArray(o)) for (let l = 0; l < o.length; l++) {
|
|
2980
2986
|
const c = Vn(o[l], e);
|
|
2981
2987
|
i.append(c);
|
|
2982
2988
|
}
|
|
@@ -2994,70 +3000,70 @@ function Ar(n, e, t) {
|
|
|
2994
3000
|
function me(n, e) {
|
|
2995
3001
|
const t = n._pendingEditorState, r = n._rootElement, s = n._headless || r === null;
|
|
2996
3002
|
if (t === null) return;
|
|
2997
|
-
const i = n._editorState, o = i._selection, l = t._selection, c = n._dirtyType !== Ee, a = R,
|
|
3003
|
+
const i = n._editorState, o = i._selection, l = t._selection, c = n._dirtyType !== Ee, a = R, u = Q, h = K, f = n._updating, d = n._observer;
|
|
2998
3004
|
let g = null;
|
|
2999
3005
|
if (n._pendingEditorState = null, n._editorState = t, !s && c && d !== null) {
|
|
3000
3006
|
K = n, R = t, Q = !1, n._updating = !0;
|
|
3001
3007
|
try {
|
|
3002
|
-
const
|
|
3003
|
-
d.disconnect(), g =
|
|
3004
|
-
} catch (
|
|
3005
|
-
if (
|
|
3006
|
-
return Ds(n, null, r, t), Qr(n), n._dirtyType = Me,
|
|
3008
|
+
const x = n._dirtyType, P = n._dirtyElements, C = n._dirtyLeaves;
|
|
3009
|
+
d.disconnect(), g = Li(i, t, n, x, P, C);
|
|
3010
|
+
} catch (x) {
|
|
3011
|
+
if (x instanceof Error && n._onError(x), fn) throw x;
|
|
3012
|
+
return Ds(n, null, r, t), Qr(n), n._dirtyType = Me, fn = !0, me(n, i), void (fn = !1);
|
|
3007
3013
|
} finally {
|
|
3008
|
-
d.observe(r, Lr), n._updating =
|
|
3014
|
+
d.observe(r, Lr), n._updating = f, R = a, Q = u, K = h;
|
|
3009
3015
|
}
|
|
3010
3016
|
}
|
|
3011
3017
|
t._readOnly || (t._readOnly = !0);
|
|
3012
|
-
const p = n._dirtyLeaves, _ = n._dirtyElements, m = n._normalizedNodes, y = n._updateTags,
|
|
3013
|
-
c && (n._dirtyType = Ee, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements = /* @__PURE__ */ new Map(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set()), function(
|
|
3014
|
-
const
|
|
3015
|
-
let E =
|
|
3018
|
+
const p = n._dirtyLeaves, _ = n._dirtyElements, m = n._normalizedNodes, y = n._updateTags, S = n._deferred;
|
|
3019
|
+
c && (n._dirtyType = Ee, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements = /* @__PURE__ */ new Map(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set()), function(x, P) {
|
|
3020
|
+
const C = x._decorators;
|
|
3021
|
+
let E = x._pendingDecorators || C;
|
|
3016
3022
|
const D = P._nodeMap;
|
|
3017
3023
|
let O;
|
|
3018
|
-
for (O in E) D.has(O) || (E ===
|
|
3024
|
+
for (O in E) D.has(O) || (E === C && (E = es(x)), delete E[O]);
|
|
3019
3025
|
}(n, t);
|
|
3020
|
-
const
|
|
3021
|
-
if (n._editable &&
|
|
3026
|
+
const k = s ? null : se(n._window);
|
|
3027
|
+
if (n._editable && k !== null && (c || l === null || l.dirty)) {
|
|
3022
3028
|
K = n, R = t;
|
|
3023
3029
|
try {
|
|
3024
3030
|
if (d !== null && d.disconnect(), c || l === null || l.dirty) {
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3031
|
+
const x = n._blockCursorElement;
|
|
3032
|
+
x !== null && $n(x, n, r), $i(o, l, n, k, y, r);
|
|
3027
3033
|
}
|
|
3028
3034
|
ki(n, r, l), d !== null && d.observe(r, Lr);
|
|
3029
3035
|
} finally {
|
|
3030
3036
|
K = h, R = a;
|
|
3031
3037
|
}
|
|
3032
3038
|
}
|
|
3033
|
-
g !== null && function(
|
|
3034
|
-
const O = Array.from(
|
|
3035
|
-
for (let L = 0; L <
|
|
3036
|
-
const [U,
|
|
3037
|
-
de !== void 0 && U(de, { dirtyLeaves: E, prevEditorState: D, updateTags:
|
|
3038
|
-
}
|
|
3039
|
-
}(n, g, y, p, i), F(l) || l === null || o !== null && o.is(l) || n.dispatchCommand(
|
|
3040
|
-
const
|
|
3041
|
-
|
|
3042
|
-
const E = ir(P), D = ir(
|
|
3043
|
-
E !== D && Ge("textcontent",
|
|
3044
|
-
}(n, e || i, t), Ge("update", n, !0, { dirtyElements: _, dirtyLeaves: p, editorState: t, normalizedNodes: m, prevEditorState: e || i, tags: y }), function(
|
|
3045
|
-
if (
|
|
3046
|
-
const
|
|
3047
|
-
|
|
3039
|
+
g !== null && function(x, P, C, E, D) {
|
|
3040
|
+
const O = Array.from(x._listeners.mutation), z = O.length;
|
|
3041
|
+
for (let L = 0; L < z; L++) {
|
|
3042
|
+
const [U, W] = O[L], de = P.get(W);
|
|
3043
|
+
de !== void 0 && U(de, { dirtyLeaves: E, prevEditorState: D, updateTags: C });
|
|
3044
|
+
}
|
|
3045
|
+
}(n, g, y, p, i), F(l) || l === null || o !== null && o.is(l) || n.dispatchCommand(wn, void 0);
|
|
3046
|
+
const T = n._pendingDecorators;
|
|
3047
|
+
T !== null && (n._decorators = T, n._pendingDecorators = null, Ge("decorator", n, !0, T)), function(x, P, C) {
|
|
3048
|
+
const E = ir(P), D = ir(C);
|
|
3049
|
+
E !== D && Ge("textcontent", x, !0, D);
|
|
3050
|
+
}(n, e || i, t), Ge("update", n, !0, { dirtyElements: _, dirtyLeaves: p, editorState: t, normalizedNodes: m, prevEditorState: e || i, tags: y }), function(x, P) {
|
|
3051
|
+
if (x._deferred = [], P.length !== 0) {
|
|
3052
|
+
const C = x._updating;
|
|
3053
|
+
x._updating = !0;
|
|
3048
3054
|
try {
|
|
3049
3055
|
for (let E = 0; E < P.length; E++) P[E]();
|
|
3050
3056
|
} finally {
|
|
3051
|
-
|
|
3057
|
+
x._updating = C;
|
|
3052
3058
|
}
|
|
3053
3059
|
}
|
|
3054
|
-
}(n,
|
|
3055
|
-
const P =
|
|
3060
|
+
}(n, S), function(x) {
|
|
3061
|
+
const P = x._updates;
|
|
3056
3062
|
if (P.length !== 0) {
|
|
3057
|
-
const
|
|
3058
|
-
if (
|
|
3059
|
-
const [E, D] =
|
|
3060
|
-
Ps(
|
|
3063
|
+
const C = P.shift();
|
|
3064
|
+
if (C) {
|
|
3065
|
+
const [E, D] = C;
|
|
3066
|
+
Ps(x, E, D);
|
|
3061
3067
|
}
|
|
3062
3068
|
}
|
|
3063
3069
|
}(n);
|
|
@@ -3086,7 +3092,7 @@ function Es(n, e, t) {
|
|
|
3086
3092
|
const l = o[s];
|
|
3087
3093
|
if (l !== void 0) {
|
|
3088
3094
|
const c = Array.from(l), a = c.length;
|
|
3089
|
-
for (let
|
|
3095
|
+
for (let u = 0; u < a; u++) if (c[u](t, n) === !0) return !0;
|
|
3090
3096
|
}
|
|
3091
3097
|
}
|
|
3092
3098
|
}
|
|
@@ -3103,7 +3109,7 @@ function Mr(n, e) {
|
|
|
3103
3109
|
if (o !== void 0) {
|
|
3104
3110
|
if (l = o.onUpdate, o.skipTransforms && (r = !0), o.discrete) {
|
|
3105
3111
|
const c = n._pendingEditorState;
|
|
3106
|
-
c === null &&
|
|
3112
|
+
c === null && b(191), c._flushSync = !0;
|
|
3107
3113
|
}
|
|
3108
3114
|
l && n._deferred.push(l), Ns(n, o.tag);
|
|
3109
3115
|
}
|
|
@@ -3118,77 +3124,77 @@ function Ps(n, e, t) {
|
|
|
3118
3124
|
t !== void 0 && (s = t.onUpdate, Ns(n, t.tag), i = t.skipTransforms || !1, o = t.discrete || !1), s && n._deferred.push(s);
|
|
3119
3125
|
const l = n._editorState;
|
|
3120
3126
|
let c = n._pendingEditorState, a = !1;
|
|
3121
|
-
(c === null || c._readOnly) && (c = n._pendingEditorState = new
|
|
3122
|
-
const
|
|
3127
|
+
(c === null || c._readOnly) && (c = n._pendingEditorState = new Xt(new Map((c || l)._nodeMap)), a = !0), c._flushSync = o;
|
|
3128
|
+
const u = R, h = Q, f = K, d = n._updating;
|
|
3123
3129
|
R = c, Q = !1, n._updating = !0, K = n;
|
|
3124
3130
|
try {
|
|
3125
3131
|
a && (n._headless ? l._selection !== null && (c._selection = l._selection.clone()) : c._selection = function(m) {
|
|
3126
|
-
const y = m.getEditorState()._selection,
|
|
3127
|
-
return F(y) || y == null ?
|
|
3132
|
+
const y = m.getEditorState()._selection, S = se(m._window);
|
|
3133
|
+
return F(y) || y == null ? qt(y, S, m, null) : y.clone();
|
|
3128
3134
|
}(n));
|
|
3129
3135
|
const p = n._compositionKey;
|
|
3130
3136
|
e(), i = Mr(n, i), function(m, y) {
|
|
3131
|
-
const
|
|
3132
|
-
if (F(
|
|
3133
|
-
const
|
|
3137
|
+
const S = y.getEditorState()._selection, k = m._selection;
|
|
3138
|
+
if (F(k)) {
|
|
3139
|
+
const T = k.anchor, x = k.focus;
|
|
3134
3140
|
let P;
|
|
3135
|
-
if (
|
|
3136
|
-
const
|
|
3137
|
-
P !==
|
|
3141
|
+
if (T.type === "text" && (P = T.getNode(), P.selectionTransform(S, k)), x.type === "text") {
|
|
3142
|
+
const C = x.getNode();
|
|
3143
|
+
P !== C && C.selectionTransform(S, k);
|
|
3138
3144
|
}
|
|
3139
3145
|
}
|
|
3140
3146
|
}(c, n), n._dirtyType !== Ee && (i ? function(m, y) {
|
|
3141
|
-
const
|
|
3142
|
-
for (const
|
|
3143
|
-
const
|
|
3144
|
-
N(
|
|
3147
|
+
const S = y._dirtyLeaves, k = m._nodeMap;
|
|
3148
|
+
for (const T of S) {
|
|
3149
|
+
const x = k.get(T);
|
|
3150
|
+
N(x) && x.isAttached() && x.isSimpleText() && !x.isUnmergeable() && rr(x);
|
|
3145
3151
|
}
|
|
3146
3152
|
}(c, n) : function(m, y) {
|
|
3147
|
-
const
|
|
3148
|
-
let
|
|
3153
|
+
const S = y._dirtyLeaves, k = y._dirtyElements, T = m._nodeMap, x = ye(), P = /* @__PURE__ */ new Map();
|
|
3154
|
+
let C = S, E = C.size, D = k, O = D.size;
|
|
3149
3155
|
for (; E > 0 || O > 0; ) {
|
|
3150
3156
|
if (E > 0) {
|
|
3151
3157
|
y._dirtyLeaves = /* @__PURE__ */ new Set();
|
|
3152
|
-
for (const
|
|
3153
|
-
const L =
|
|
3154
|
-
N(L) && L.isAttached() && L.isSimpleText() && !L.isUnmergeable() && rr(L), L !== void 0 && Ir(L,
|
|
3158
|
+
for (const z of C) {
|
|
3159
|
+
const L = T.get(z);
|
|
3160
|
+
N(L) && L.isAttached() && L.isSimpleText() && !L.isUnmergeable() && rr(L), L !== void 0 && Ir(L, x) && Or(y, L, P), S.add(z);
|
|
3155
3161
|
}
|
|
3156
|
-
if (
|
|
3162
|
+
if (C = y._dirtyLeaves, E = C.size, E > 0) {
|
|
3157
3163
|
pt++;
|
|
3158
3164
|
continue;
|
|
3159
3165
|
}
|
|
3160
3166
|
}
|
|
3161
3167
|
y._dirtyLeaves = /* @__PURE__ */ new Set(), y._dirtyElements = /* @__PURE__ */ new Map();
|
|
3162
|
-
for (const
|
|
3163
|
-
const L =
|
|
3168
|
+
for (const z of D) {
|
|
3169
|
+
const L = z[0], U = z[1];
|
|
3164
3170
|
if (L !== "root" && !U) continue;
|
|
3165
|
-
const
|
|
3166
|
-
|
|
3171
|
+
const W = T.get(L);
|
|
3172
|
+
W !== void 0 && Ir(W, x) && Or(y, W, P), k.set(L, U);
|
|
3167
3173
|
}
|
|
3168
|
-
|
|
3174
|
+
C = y._dirtyLeaves, E = C.size, D = y._dirtyElements, O = D.size, pt++;
|
|
3169
3175
|
}
|
|
3170
|
-
y._dirtyLeaves =
|
|
3171
|
-
}(c, n), Mr(n), function(m, y,
|
|
3172
|
-
const
|
|
3173
|
-
for (const [
|
|
3174
|
-
const E =
|
|
3175
|
-
E !== void 0 && (E.isAttached() || (
|
|
3176
|
+
y._dirtyLeaves = S, y._dirtyElements = k;
|
|
3177
|
+
}(c, n), Mr(n), function(m, y, S, k) {
|
|
3178
|
+
const T = m._nodeMap, x = y._nodeMap, P = [];
|
|
3179
|
+
for (const [C] of k) {
|
|
3180
|
+
const E = x.get(C);
|
|
3181
|
+
E !== void 0 && (E.isAttached() || (v(E) && os(E, C, T, x, P, k), T.has(C) || k.delete(C), P.push(C)));
|
|
3176
3182
|
}
|
|
3177
|
-
for (const
|
|
3178
|
-
for (const
|
|
3179
|
-
const E =
|
|
3180
|
-
E === void 0 || E.isAttached() || (
|
|
3183
|
+
for (const C of P) x.delete(C);
|
|
3184
|
+
for (const C of S) {
|
|
3185
|
+
const E = x.get(C);
|
|
3186
|
+
E === void 0 || E.isAttached() || (T.has(C) || S.delete(C), x.delete(C));
|
|
3181
3187
|
}
|
|
3182
3188
|
}(l, c, n._dirtyLeaves, n._dirtyElements)), p !== n._compositionKey && (c._flushSync = !0);
|
|
3183
3189
|
const _ = c._selection;
|
|
3184
3190
|
if (F(_)) {
|
|
3185
|
-
const m = c._nodeMap, y = _.anchor.key,
|
|
3186
|
-
m.get(y) !== void 0 && m.get(
|
|
3187
|
-
} else
|
|
3191
|
+
const m = c._nodeMap, y = _.anchor.key, S = _.focus.key;
|
|
3192
|
+
m.get(y) !== void 0 && m.get(S) !== void 0 || b(19);
|
|
3193
|
+
} else Ht(_) && _._nodes.size === 0 && (c._selection = null);
|
|
3188
3194
|
} catch (p) {
|
|
3189
3195
|
return p instanceof Error && n._onError(p), n._pendingEditorState = l, n._dirtyType = Me, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements.clear(), void me(n);
|
|
3190
3196
|
} finally {
|
|
3191
|
-
R =
|
|
3197
|
+
R = u, Q = h, K = f, n._updating = d, pt = 0;
|
|
3192
3198
|
}
|
|
3193
3199
|
n._dirtyType !== Ee || function(p, _) {
|
|
3194
3200
|
const m = _.getEditorState()._selection, y = p._selection;
|
|
@@ -3203,7 +3209,7 @@ function Ps(n, e, t) {
|
|
|
3203
3209
|
function X(n, e, t) {
|
|
3204
3210
|
n._updating ? n._updates.push([e, t]) : Ps(n, e, t);
|
|
3205
3211
|
}
|
|
3206
|
-
class
|
|
3212
|
+
class Qt extends Vt {
|
|
3207
3213
|
constructor(e) {
|
|
3208
3214
|
super(e), this.__first = null, this.__last = null, this.__size = 0, this.__format = 0, this.__style = "", this.__indent = 0, this.__dir = null;
|
|
3209
3215
|
}
|
|
@@ -3253,7 +3259,7 @@ class qt extends Ut {
|
|
|
3253
3259
|
const e = [];
|
|
3254
3260
|
let t = this.getFirstChild();
|
|
3255
3261
|
for (; t !== null; ) {
|
|
3256
|
-
if (N(t) && e.push(t),
|
|
3262
|
+
if (N(t) && e.push(t), v(t)) {
|
|
3257
3263
|
const r = t.getAllTextNodes();
|
|
3258
3264
|
e.push(...r);
|
|
3259
3265
|
}
|
|
@@ -3263,7 +3269,7 @@ class qt extends Ut {
|
|
|
3263
3269
|
}
|
|
3264
3270
|
getFirstDescendant() {
|
|
3265
3271
|
let e = this.getFirstChild();
|
|
3266
|
-
for (;
|
|
3272
|
+
for (; v(e); ) {
|
|
3267
3273
|
const t = e.getFirstChild();
|
|
3268
3274
|
if (t === null) break;
|
|
3269
3275
|
e = t;
|
|
@@ -3272,7 +3278,7 @@ class qt extends Ut {
|
|
|
3272
3278
|
}
|
|
3273
3279
|
getLastDescendant() {
|
|
3274
3280
|
let e = this.getLastChild();
|
|
3275
|
-
for (;
|
|
3281
|
+
for (; v(e); ) {
|
|
3276
3282
|
const t = e.getLastChild();
|
|
3277
3283
|
if (t === null) break;
|
|
3278
3284
|
e = t;
|
|
@@ -3283,10 +3289,10 @@ class qt extends Ut {
|
|
|
3283
3289
|
const t = this.getChildren(), r = t.length;
|
|
3284
3290
|
if (e >= r) {
|
|
3285
3291
|
const i = t[r - 1];
|
|
3286
|
-
return
|
|
3292
|
+
return v(i) && i.getLastDescendant() || i || null;
|
|
3287
3293
|
}
|
|
3288
3294
|
const s = t[e];
|
|
3289
|
-
return
|
|
3295
|
+
return v(s) && s.getFirstDescendant() || s || null;
|
|
3290
3296
|
}
|
|
3291
3297
|
getFirstChild() {
|
|
3292
3298
|
const e = this.getLatest().__first;
|
|
@@ -3294,7 +3300,7 @@ class qt extends Ut {
|
|
|
3294
3300
|
}
|
|
3295
3301
|
getFirstChildOrThrow() {
|
|
3296
3302
|
const e = this.getFirstChild();
|
|
3297
|
-
return e === null &&
|
|
3303
|
+
return e === null && b(45, this.__key), e;
|
|
3298
3304
|
}
|
|
3299
3305
|
getLastChild() {
|
|
3300
3306
|
const e = this.getLatest().__last;
|
|
@@ -3302,7 +3308,7 @@ class qt extends Ut {
|
|
|
3302
3308
|
}
|
|
3303
3309
|
getLastChildOrThrow() {
|
|
3304
3310
|
const e = this.getLastChild();
|
|
3305
|
-
return e === null &&
|
|
3311
|
+
return e === null && b(96, this.__key), e;
|
|
3306
3312
|
}
|
|
3307
3313
|
getChildAtIndex(e) {
|
|
3308
3314
|
const t = this.getChildrenSize();
|
|
@@ -3325,7 +3331,7 @@ class qt extends Ut {
|
|
|
3325
3331
|
const t = this.getChildren(), r = t.length;
|
|
3326
3332
|
for (let s = 0; s < r; s++) {
|
|
3327
3333
|
const i = t[s];
|
|
3328
|
-
e += i.getTextContent(),
|
|
3334
|
+
e += i.getTextContent(), v(i) && s !== r - 1 && !i.isInline() && (e += ae);
|
|
3329
3335
|
}
|
|
3330
3336
|
return e;
|
|
3331
3337
|
}
|
|
@@ -3334,7 +3340,7 @@ class qt extends Ut {
|
|
|
3334
3340
|
const t = this.getChildren(), r = t.length;
|
|
3335
3341
|
for (let s = 0; s < r; s++) {
|
|
3336
3342
|
const i = t[s];
|
|
3337
|
-
e += i.getTextContentSize(),
|
|
3343
|
+
e += i.getTextContentSize(), v(i) && s !== r - 1 && !i.isInline() && (e += ae.length);
|
|
3338
3344
|
}
|
|
3339
3345
|
return e;
|
|
3340
3346
|
}
|
|
@@ -3356,10 +3362,10 @@ class qt extends Ut {
|
|
|
3356
3362
|
if (!this.canBeEmpty()) {
|
|
3357
3363
|
if (e === 0 && t === 0) {
|
|
3358
3364
|
const c = this.getFirstChild();
|
|
3359
|
-
if (N(c) ||
|
|
3365
|
+
if (N(c) || v(c)) return c.select(0, 0);
|
|
3360
3366
|
} else if (!(e !== void 0 && e !== o || t !== void 0 && t !== o)) {
|
|
3361
3367
|
const c = this.getLastChild();
|
|
3362
|
-
if (N(c) ||
|
|
3368
|
+
if (N(c) || v(c)) return c.select();
|
|
3363
3369
|
}
|
|
3364
3370
|
}
|
|
3365
3371
|
s === void 0 && (s = o), i === void 0 && (i = o);
|
|
@@ -3395,8 +3401,8 @@ class qt extends Ut {
|
|
|
3395
3401
|
return this.getWritable().__indent = e, this;
|
|
3396
3402
|
}
|
|
3397
3403
|
splice(e, t, r) {
|
|
3398
|
-
const s = r.length, i = this.getChildrenSize(), o = this.getWritable(), l = o.__key, c = [], a = [],
|
|
3399
|
-
let h = null,
|
|
3404
|
+
const s = r.length, i = this.getChildrenSize(), o = this.getWritable(), l = o.__key, c = [], a = [], u = this.getChildAtIndex(e + t);
|
|
3405
|
+
let h = null, f = i - t + s;
|
|
3400
3406
|
if (e !== 0) if (e === i) h = this.getLastChild();
|
|
3401
3407
|
else {
|
|
3402
3408
|
const g = this.getChildAtIndex(e);
|
|
@@ -3405,7 +3411,7 @@ class qt extends Ut {
|
|
|
3405
3411
|
if (t > 0) {
|
|
3406
3412
|
let g = h === null ? this.getFirstChild() : h.getNextSibling();
|
|
3407
3413
|
for (let p = 0; p < t; p++) {
|
|
3408
|
-
g === null &&
|
|
3414
|
+
g === null && b(100);
|
|
3409
3415
|
const _ = g.getNextSibling(), m = g.__key;
|
|
3410
3416
|
Ne(g.getWritable()), a.push(m), g = _;
|
|
3411
3417
|
}
|
|
@@ -3415,33 +3421,41 @@ class qt extends Ut {
|
|
|
3415
3421
|
const p = r[g];
|
|
3416
3422
|
d !== null && p.is(d) && (h = d = d.getPreviousSibling());
|
|
3417
3423
|
const _ = p.getWritable();
|
|
3418
|
-
_.__parent === l &&
|
|
3424
|
+
_.__parent === l && f--, Ne(_);
|
|
3419
3425
|
const m = p.__key;
|
|
3420
3426
|
if (d === null) o.__first = m, _.__prev = null;
|
|
3421
3427
|
else {
|
|
3422
3428
|
const y = d.getWritable();
|
|
3423
3429
|
y.__next = m, _.__prev = y.__key;
|
|
3424
3430
|
}
|
|
3425
|
-
p.__key === l &&
|
|
3431
|
+
p.__key === l && b(76), _.__parent = l, c.push(m), d = p;
|
|
3426
3432
|
}
|
|
3427
3433
|
if (e + t === i)
|
|
3428
3434
|
d !== null && (d.getWritable().__next = null, o.__last = d.__key);
|
|
3429
|
-
else if (
|
|
3430
|
-
const g =
|
|
3435
|
+
else if (u !== null) {
|
|
3436
|
+
const g = u.getWritable();
|
|
3431
3437
|
if (d !== null) {
|
|
3432
3438
|
const p = d.getWritable();
|
|
3433
|
-
g.__prev = d.__key, p.__next =
|
|
3439
|
+
g.__prev = d.__key, p.__next = u.__key;
|
|
3434
3440
|
} else g.__prev = null;
|
|
3435
3441
|
}
|
|
3436
|
-
if (o.__size =
|
|
3442
|
+
if (o.__size = f, a.length) {
|
|
3437
3443
|
const g = I();
|
|
3438
3444
|
if (F(g)) {
|
|
3439
3445
|
const p = new Set(a), _ = new Set(c), { anchor: m, focus: y } = g;
|
|
3440
|
-
|
|
3446
|
+
zr(m, p, _) && Ot(m, m.getNode(), this, h, u), zr(y, p, _) && Ot(y, y.getNode(), this, h, u), f !== 0 || this.canBeEmpty() || Pe(this) || this.remove();
|
|
3441
3447
|
}
|
|
3442
3448
|
}
|
|
3443
3449
|
return o;
|
|
3444
3450
|
}
|
|
3451
|
+
exportDOM(e) {
|
|
3452
|
+
const { element: t } = super.exportDOM(e);
|
|
3453
|
+
if (t && Jt(t)) {
|
|
3454
|
+
const r = this.getIndent();
|
|
3455
|
+
r > 0 && (t.style.paddingInlineStart = 40 * r + "px");
|
|
3456
|
+
}
|
|
3457
|
+
return { element: t };
|
|
3458
|
+
}
|
|
3445
3459
|
exportJSON() {
|
|
3446
3460
|
return { children: [], direction: this.getDirection(), format: this.getFormatType(), indent: this.getIndent(), type: "element", version: 1 };
|
|
3447
3461
|
}
|
|
@@ -3488,10 +3502,10 @@ class qt extends Ut {
|
|
|
3488
3502
|
return !1;
|
|
3489
3503
|
}
|
|
3490
3504
|
}
|
|
3491
|
-
function
|
|
3492
|
-
return n instanceof
|
|
3505
|
+
function v(n) {
|
|
3506
|
+
return n instanceof Qt;
|
|
3493
3507
|
}
|
|
3494
|
-
function
|
|
3508
|
+
function zr(n, e, t) {
|
|
3495
3509
|
let r = n.getNode();
|
|
3496
3510
|
for (; r; ) {
|
|
3497
3511
|
const s = r.__key;
|
|
@@ -3500,12 +3514,12 @@ function Wr(n, e, t) {
|
|
|
3500
3514
|
}
|
|
3501
3515
|
return !1;
|
|
3502
3516
|
}
|
|
3503
|
-
class
|
|
3517
|
+
class Vi extends Vt {
|
|
3504
3518
|
constructor(e) {
|
|
3505
3519
|
super(e);
|
|
3506
3520
|
}
|
|
3507
3521
|
decorate(e, t) {
|
|
3508
|
-
|
|
3522
|
+
b(47);
|
|
3509
3523
|
}
|
|
3510
3524
|
isIsolated() {
|
|
3511
3525
|
return !1;
|
|
@@ -3518,9 +3532,9 @@ class Ui extends Ut {
|
|
|
3518
3532
|
}
|
|
3519
3533
|
}
|
|
3520
3534
|
function A(n) {
|
|
3521
|
-
return n instanceof
|
|
3535
|
+
return n instanceof Vi;
|
|
3522
3536
|
}
|
|
3523
|
-
class ct extends
|
|
3537
|
+
class ct extends Qt {
|
|
3524
3538
|
static getType() {
|
|
3525
3539
|
return "root";
|
|
3526
3540
|
}
|
|
@@ -3531,23 +3545,23 @@ class ct extends qt {
|
|
|
3531
3545
|
super("root"), this.__cachedText = null;
|
|
3532
3546
|
}
|
|
3533
3547
|
getTopLevelElementOrThrow() {
|
|
3534
|
-
|
|
3548
|
+
b(51);
|
|
3535
3549
|
}
|
|
3536
3550
|
getTextContent() {
|
|
3537
3551
|
const e = this.__cachedText;
|
|
3538
3552
|
return !lt() && M()._dirtyType !== Ee || e === null ? super.getTextContent() : e;
|
|
3539
3553
|
}
|
|
3540
3554
|
remove() {
|
|
3541
|
-
|
|
3555
|
+
b(52);
|
|
3542
3556
|
}
|
|
3543
3557
|
replace(e) {
|
|
3544
|
-
|
|
3558
|
+
b(53);
|
|
3545
3559
|
}
|
|
3546
3560
|
insertBefore(e) {
|
|
3547
|
-
|
|
3561
|
+
b(54);
|
|
3548
3562
|
}
|
|
3549
3563
|
insertAfter(e) {
|
|
3550
|
-
|
|
3564
|
+
b(55);
|
|
3551
3565
|
}
|
|
3552
3566
|
updateDOM(e, t) {
|
|
3553
3567
|
return !1;
|
|
@@ -3555,7 +3569,7 @@ class ct extends qt {
|
|
|
3555
3569
|
append(...e) {
|
|
3556
3570
|
for (let t = 0; t < e.length; t++) {
|
|
3557
3571
|
const r = e[t];
|
|
3558
|
-
|
|
3572
|
+
v(r) || A(r) || b(56);
|
|
3559
3573
|
}
|
|
3560
3574
|
return super.append(...e);
|
|
3561
3575
|
}
|
|
@@ -3570,17 +3584,17 @@ class ct extends qt {
|
|
|
3570
3584
|
return !0;
|
|
3571
3585
|
}
|
|
3572
3586
|
}
|
|
3573
|
-
function
|
|
3587
|
+
function Y(n) {
|
|
3574
3588
|
return n instanceof ct;
|
|
3575
3589
|
}
|
|
3576
3590
|
function jn() {
|
|
3577
|
-
return new
|
|
3591
|
+
return new Xt(/* @__PURE__ */ new Map([["root", new ct()]]));
|
|
3578
3592
|
}
|
|
3579
3593
|
function Fs(n) {
|
|
3580
3594
|
const e = n.exportJSON(), t = n.constructor;
|
|
3581
|
-
if (e.type !== t.getType() &&
|
|
3595
|
+
if (e.type !== t.getType() && b(130, t.name), v(n)) {
|
|
3582
3596
|
const r = e.children;
|
|
3583
|
-
Array.isArray(r) ||
|
|
3597
|
+
Array.isArray(r) || b(59, t.name);
|
|
3584
3598
|
const s = n.getChildren();
|
|
3585
3599
|
for (let i = 0; i < s.length; i++) {
|
|
3586
3600
|
const o = Fs(s[i]);
|
|
@@ -3589,7 +3603,7 @@ function Fs(n) {
|
|
|
3589
3603
|
}
|
|
3590
3604
|
return e;
|
|
3591
3605
|
}
|
|
3592
|
-
class
|
|
3606
|
+
class Xt {
|
|
3593
3607
|
constructor(e, t) {
|
|
3594
3608
|
this._nodeMap = e, this._selection = t || null, this._flushSync = !1, this._readOnly = !1;
|
|
3595
3609
|
}
|
|
@@ -3600,14 +3614,14 @@ class Qt {
|
|
|
3600
3614
|
return Ar(t && t.editor || null, this, e);
|
|
3601
3615
|
}
|
|
3602
3616
|
clone(e) {
|
|
3603
|
-
const t = new
|
|
3617
|
+
const t = new Xt(this._nodeMap, e === void 0 ? this._selection : e);
|
|
3604
3618
|
return t._readOnly = !0, t;
|
|
3605
3619
|
}
|
|
3606
3620
|
toJSON() {
|
|
3607
3621
|
return Ar(null, this, () => ({ root: Fs(G()) }));
|
|
3608
3622
|
}
|
|
3609
3623
|
}
|
|
3610
|
-
class
|
|
3624
|
+
class ji extends Qt {
|
|
3611
3625
|
static getType() {
|
|
3612
3626
|
return "artificial";
|
|
3613
3627
|
}
|
|
@@ -3615,7 +3629,7 @@ class Vi extends qt {
|
|
|
3615
3629
|
return document.createElement("div");
|
|
3616
3630
|
}
|
|
3617
3631
|
}
|
|
3618
|
-
class
|
|
3632
|
+
class We extends Qt {
|
|
3619
3633
|
constructor(e) {
|
|
3620
3634
|
super(e), this.__textFormat = 0, this.__textStyle = "";
|
|
3621
3635
|
}
|
|
@@ -3644,7 +3658,7 @@ class ze extends qt {
|
|
|
3644
3658
|
return t.__textStyle = e, t;
|
|
3645
3659
|
}
|
|
3646
3660
|
static clone(e) {
|
|
3647
|
-
return new
|
|
3661
|
+
return new We(e.__key);
|
|
3648
3662
|
}
|
|
3649
3663
|
afterCloneFrom(e) {
|
|
3650
3664
|
super.afterCloneFrom(e), this.__textFormat = e.__textFormat, this.__textStyle = e.__textStyle;
|
|
@@ -3657,18 +3671,16 @@ class ze extends qt {
|
|
|
3657
3671
|
return !1;
|
|
3658
3672
|
}
|
|
3659
3673
|
static importDOM() {
|
|
3660
|
-
return { p: (e) => ({ conversion:
|
|
3674
|
+
return { p: (e) => ({ conversion: Hi, priority: 0 }) };
|
|
3661
3675
|
}
|
|
3662
3676
|
exportDOM(e) {
|
|
3663
3677
|
const { element: t } = super.exportDOM(e);
|
|
3664
|
-
if (t &&
|
|
3678
|
+
if (t && Jt(t)) {
|
|
3665
3679
|
this.isEmpty() && t.append(document.createElement("br"));
|
|
3666
3680
|
const r = this.getFormatType();
|
|
3667
3681
|
t.style.textAlign = r;
|
|
3668
3682
|
const s = this.getDirection();
|
|
3669
3683
|
s && (t.dir = s);
|
|
3670
|
-
const i = this.getIndent();
|
|
3671
|
-
i > 0 && (t.style.textIndent = 20 * i + "px");
|
|
3672
3684
|
}
|
|
3673
3685
|
return { element: t };
|
|
3674
3686
|
}
|
|
@@ -3694,30 +3706,25 @@ class ze extends qt {
|
|
|
3694
3706
|
return !1;
|
|
3695
3707
|
}
|
|
3696
3708
|
}
|
|
3697
|
-
function
|
|
3709
|
+
function Hi(n) {
|
|
3698
3710
|
const e = ve();
|
|
3699
|
-
|
|
3700
|
-
e.setFormat(n.style.textAlign);
|
|
3701
|
-
const t = parseInt(n.style.textIndent, 10) / 20;
|
|
3702
|
-
t > 0 && e.setIndent(t);
|
|
3703
|
-
}
|
|
3704
|
-
return { node: e };
|
|
3711
|
+
return n.style && (e.setFormat(n.style.textAlign), Pi(n, e)), { node: e };
|
|
3705
3712
|
}
|
|
3706
3713
|
function ve() {
|
|
3707
|
-
return
|
|
3714
|
+
return $t(new We());
|
|
3708
3715
|
}
|
|
3709
|
-
function
|
|
3710
|
-
return n instanceof
|
|
3716
|
+
function bn(n) {
|
|
3717
|
+
return n instanceof We;
|
|
3711
3718
|
}
|
|
3712
|
-
const
|
|
3719
|
+
const po = 0, yo = 1, mo = 3, xo = 4;
|
|
3713
3720
|
function Ds(n, e, t, r) {
|
|
3714
3721
|
const s = n._keyToDOMMap;
|
|
3715
3722
|
s.clear(), n._editorState = jn(), n._pendingEditorState = r, n._compositionKey = null, n._dirtyType = Ee, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements.clear(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set(), n._updates = [], n._blockCursorElement = null;
|
|
3716
3723
|
const i = n._observer;
|
|
3717
3724
|
i !== null && (i.disconnect(), n._observer = null), e !== null && (e.textContent = ""), t !== null && (t.textContent = "", s.set("root", t));
|
|
3718
3725
|
}
|
|
3719
|
-
function
|
|
3720
|
-
const e = n || {}, t =
|
|
3726
|
+
function vo(n) {
|
|
3727
|
+
const e = n || {}, t = Ui(), r = e.theme || {}, s = n === void 0 ? t : e.parentEditor || null, i = e.disableEvents || !1, o = jn(), l = e.namespace || (s !== null ? s._config.namespace : rs()), c = e.editorState, a = [ct, ze, st, it, We, ji, ...e.nodes || []], { onError: u, html: h } = e, f = e.editable === void 0 || e.editable;
|
|
3721
3728
|
let d;
|
|
3722
3729
|
if (n === void 0 && t !== null) d = t._nodes;
|
|
3723
3730
|
else {
|
|
@@ -3725,31 +3732,31 @@ function xo(n) {
|
|
|
3725
3732
|
for (let p = 0; p < a.length; p++) {
|
|
3726
3733
|
let _ = a[p], m = null, y = null;
|
|
3727
3734
|
if (typeof _ != "function") {
|
|
3728
|
-
const
|
|
3729
|
-
_ =
|
|
3735
|
+
const x = _;
|
|
3736
|
+
_ = x.replace, m = x.with, y = x.withKlass || null;
|
|
3730
3737
|
}
|
|
3731
|
-
const
|
|
3732
|
-
|
|
3738
|
+
const S = _.getType(), k = _.transform(), T = /* @__PURE__ */ new Set();
|
|
3739
|
+
k !== null && T.add(k), d.set(S, { exportDOM: h && h.export ? h.export.get(_) : void 0, klass: _, replace: m, replaceWithKlass: y, transforms: T });
|
|
3733
3740
|
}
|
|
3734
3741
|
}
|
|
3735
|
-
const g = new
|
|
3736
|
-
const m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(),
|
|
3737
|
-
Object.keys(
|
|
3738
|
-
let
|
|
3739
|
-
|
|
3742
|
+
const g = new Yt(o, s, d, { disableEvents: i, namespace: l, theme: r }, u || console.error, function(p, _) {
|
|
3743
|
+
const m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), S = (k) => {
|
|
3744
|
+
Object.keys(k).forEach((T) => {
|
|
3745
|
+
let x = m.get(T);
|
|
3746
|
+
x === void 0 && (x = [], m.set(T, x)), x.push(k[T]);
|
|
3740
3747
|
});
|
|
3741
3748
|
};
|
|
3742
|
-
return p.forEach((
|
|
3743
|
-
const
|
|
3744
|
-
if (
|
|
3745
|
-
y.add(
|
|
3746
|
-
const
|
|
3747
|
-
|
|
3748
|
-
}), _ &&
|
|
3749
|
-
}(d, h ? h.import : void 0),
|
|
3749
|
+
return p.forEach((k) => {
|
|
3750
|
+
const T = k.klass.importDOM;
|
|
3751
|
+
if (T == null || y.has(T)) return;
|
|
3752
|
+
y.add(T);
|
|
3753
|
+
const x = T.call(k.klass);
|
|
3754
|
+
x !== null && S(x);
|
|
3755
|
+
}), _ && S(_), m;
|
|
3756
|
+
}(d, h ? h.import : void 0), f);
|
|
3750
3757
|
return c !== void 0 && (g._pendingEditorState = c, g._dirtyType = Me), g;
|
|
3751
3758
|
}
|
|
3752
|
-
class
|
|
3759
|
+
class Yt {
|
|
3753
3760
|
constructor(e, t, r, s, i, o, l) {
|
|
3754
3761
|
this._parentEditor = t, this._rootElement = null, this._editorState = e, this._pendingEditorState = null, this._compositionKey = null, this._deferred = [], this._keyToDOMMap = /* @__PURE__ */ new Map(), this._updates = [], this._updating = !1, this._listeners = { decorator: /* @__PURE__ */ new Set(), editable: /* @__PURE__ */ new Set(), mutation: /* @__PURE__ */ new Map(), root: /* @__PURE__ */ new Set(), textcontent: /* @__PURE__ */ new Set(), update: /* @__PURE__ */ new Set() }, this._commands = /* @__PURE__ */ new Map(), this._config = s, this._nodes = r, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = Ee, this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._dirtyElements = /* @__PURE__ */ new Map(), this._normalizedNodes = /* @__PURE__ */ new Set(), this._updateTags = /* @__PURE__ */ new Set(), this._observer = null, this._key = rs(), this._onError = i, this._htmlConversions = o, this._editable = l, this._headless = t !== null && t._headless, this._window = null, this._blockCursorElement = null;
|
|
3755
3762
|
}
|
|
@@ -3787,11 +3794,11 @@ class Xt {
|
|
|
3787
3794
|
};
|
|
3788
3795
|
}
|
|
3789
3796
|
registerCommand(e, t, r) {
|
|
3790
|
-
r === void 0 &&
|
|
3797
|
+
r === void 0 && b(35);
|
|
3791
3798
|
const s = this._commands;
|
|
3792
3799
|
s.has(e) || s.set(e, [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()]);
|
|
3793
3800
|
const i = s.get(e);
|
|
3794
|
-
i === void 0 &&
|
|
3801
|
+
i === void 0 && b(36, String(e));
|
|
3795
3802
|
const o = i[r];
|
|
3796
3803
|
return o.add(t), () => {
|
|
3797
3804
|
o.delete(t), i.every((l) => l.size === 0) && s.delete(e);
|
|
@@ -3807,7 +3814,7 @@ class Xt {
|
|
|
3807
3814
|
}
|
|
3808
3815
|
getRegisteredNode(e) {
|
|
3809
3816
|
const t = this._nodes.get(e.getType());
|
|
3810
|
-
return t === void 0 &&
|
|
3817
|
+
return t === void 0 && b(37, e.name), t;
|
|
3811
3818
|
}
|
|
3812
3819
|
resolveRegisteredNodeAfterReplacements(e) {
|
|
3813
3820
|
for (; e.replaceWithKlass; ) e = this.getRegisteredNode(e.replaceWithKlass);
|
|
@@ -3836,7 +3843,7 @@ class Xt {
|
|
|
3836
3843
|
if (c.isEmpty()) return;
|
|
3837
3844
|
if (l === "root") return void G().markDirty();
|
|
3838
3845
|
const a = c._nodeMap;
|
|
3839
|
-
for (const [,
|
|
3846
|
+
for (const [, u] of a) u.markDirty();
|
|
3840
3847
|
}, o._pendingEditorState === null ? { tag: "history-merge" } : void 0), () => {
|
|
3841
3848
|
s.forEach((c) => c.transforms.delete(t));
|
|
3842
3849
|
};
|
|
@@ -3863,17 +3870,17 @@ class Xt {
|
|
|
3863
3870
|
const t = this._rootElement;
|
|
3864
3871
|
if (e !== t) {
|
|
3865
3872
|
const r = qe(this._config.theme, "root"), s = this._pendingEditorState || this._editorState;
|
|
3866
|
-
if (this._rootElement = e, Ds(this, t, e, s), t !== null && (this._config.disableEvents ||
|
|
3873
|
+
if (this._rootElement = e, Ds(this, t, e, s), t !== null && (this._config.disableEvents || Oi(t), r != null && t.classList.remove(...r)), e !== null) {
|
|
3867
3874
|
const i = function(l) {
|
|
3868
3875
|
const c = l.ownerDocument;
|
|
3869
3876
|
return c && c.defaultView || null;
|
|
3870
3877
|
}(e), o = e.style;
|
|
3871
3878
|
o.userSelect = "text", o.whiteSpace = "pre-wrap", o.wordBreak = "break-word", e.setAttribute("data-lexical-editor", "true"), this._window = i, this._dirtyType = Me, Qr(this), this._updateTags.add("history-merge"), me(this), this._config.disableEvents || function(l, c) {
|
|
3872
|
-
const a = l.ownerDocument,
|
|
3873
|
-
(
|
|
3879
|
+
const a = l.ownerDocument, u = Dt.get(a);
|
|
3880
|
+
(u === void 0 || u < 1) && a.addEventListener("selectionchange", xs), Dt.set(a, (u || 0) + 1), l.__lexicalEditor = c;
|
|
3874
3881
|
const h = ms(l);
|
|
3875
|
-
for (let
|
|
3876
|
-
const [d, g] =
|
|
3882
|
+
for (let f = 0; f < Sn.length; f++) {
|
|
3883
|
+
const [d, g] = Sn[f], p = typeof g == "function" ? (_) => {
|
|
3877
3884
|
xr(_) || (mr(_), (c.isEditable() || d === "click") && g(_, c));
|
|
3878
3885
|
} : (_) => {
|
|
3879
3886
|
if (xr(_)) return;
|
|
@@ -3881,11 +3888,11 @@ class Xt {
|
|
|
3881
3888
|
const m = c.isEditable();
|
|
3882
3889
|
switch (d) {
|
|
3883
3890
|
case "cut":
|
|
3884
|
-
return m && w(c,
|
|
3891
|
+
return m && w(c, $r, _);
|
|
3885
3892
|
case "copy":
|
|
3886
3893
|
return w(c, Kr, _);
|
|
3887
3894
|
case "paste":
|
|
3888
|
-
return m && w(c,
|
|
3895
|
+
return m && w(c, Wr, _);
|
|
3889
3896
|
case "dragstart":
|
|
3890
3897
|
return m && w(c, js, _);
|
|
3891
3898
|
case "dragover":
|
|
@@ -3916,13 +3923,13 @@ class Xt {
|
|
|
3916
3923
|
return this._editorState;
|
|
3917
3924
|
}
|
|
3918
3925
|
setEditorState(e, t) {
|
|
3919
|
-
e.isEmpty() &&
|
|
3926
|
+
e.isEmpty() && b(38), qr(this);
|
|
3920
3927
|
const r = this._pendingEditorState, s = this._updateTags, i = t !== void 0 ? t.tag : null;
|
|
3921
3928
|
r === null || r.isEmpty() || (i != null && s.add(i), me(this)), this._pendingEditorState = e, this._dirtyType = Me, this._dirtyElements.set("root", !1), this._compositionKey = null, i != null && s.add(i), me(this);
|
|
3922
3929
|
}
|
|
3923
3930
|
parseEditorState(e, t) {
|
|
3924
3931
|
return function(r, s, i) {
|
|
3925
|
-
const o = jn(), l = R, c = Q, a = K,
|
|
3932
|
+
const o = jn(), l = R, c = Q, a = K, u = s._dirtyElements, h = s._dirtyLeaves, f = s._cloneNotNeeded, d = s._dirtyType;
|
|
3926
3933
|
s._dirtyElements = /* @__PURE__ */ new Map(), s._dirtyLeaves = /* @__PURE__ */ new Set(), s._cloneNotNeeded = /* @__PURE__ */ new Set(), s._dirtyType = 0, R = o, Q = !1, K = s;
|
|
3927
3934
|
try {
|
|
3928
3935
|
const g = s._nodes;
|
|
@@ -3930,7 +3937,7 @@ class Xt {
|
|
|
3930
3937
|
} catch (g) {
|
|
3931
3938
|
g instanceof Error && s._onError(g);
|
|
3932
3939
|
} finally {
|
|
3933
|
-
s._dirtyElements =
|
|
3940
|
+
s._dirtyElements = u, s._dirtyLeaves = h, s._cloneNotNeeded = f, s._dirtyType = d, R = l, Q = c, K = a;
|
|
3934
3941
|
}
|
|
3935
3942
|
return o;
|
|
3936
3943
|
}(typeof e == "string" ? JSON.parse(e) : e, this, t);
|
|
@@ -3966,97 +3973,98 @@ class Xt {
|
|
|
3966
3973
|
return { editorState: this._editorState.toJSON() };
|
|
3967
3974
|
}
|
|
3968
3975
|
}
|
|
3969
|
-
|
|
3976
|
+
Yt.version = "0.19.0+prod.esm";
|
|
3970
3977
|
export {
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
I,
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3978
|
+
ro as $,
|
|
3979
|
+
I as A,
|
|
3980
|
+
xo as B,
|
|
3981
|
+
br as C,
|
|
3982
|
+
bn as D,
|
|
3983
|
+
Mt as E,
|
|
3984
|
+
ve as F,
|
|
3985
|
+
ao as G,
|
|
3986
|
+
Wt as H,
|
|
3987
|
+
Bs as I,
|
|
3988
|
+
nt as J,
|
|
3989
|
+
no as K,
|
|
3990
|
+
mo as L,
|
|
3991
|
+
ot as M,
|
|
3992
|
+
ji as N,
|
|
3993
|
+
yo as O,
|
|
3994
|
+
uo as P,
|
|
3995
|
+
Ws as Q,
|
|
3996
|
+
Ms as R,
|
|
3997
|
+
Ht as S,
|
|
3998
|
+
bi as T,
|
|
3999
|
+
Ae as U,
|
|
3993
4000
|
Is as V,
|
|
3994
|
-
|
|
4001
|
+
$s as W,
|
|
3995
4002
|
dr as X,
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4003
|
+
mt as Y,
|
|
4004
|
+
ze as Z,
|
|
4005
|
+
so as _,
|
|
4006
|
+
Pe as a,
|
|
4000
4007
|
xt as a0,
|
|
4001
4008
|
yt as a1,
|
|
4002
4009
|
Ks as a2,
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4010
|
+
Js as a3,
|
|
4011
|
+
$r as a4,
|
|
4012
|
+
Zi as a5,
|
|
4006
4013
|
He as a6,
|
|
4007
4014
|
Us as a7,
|
|
4008
4015
|
Qs as a8,
|
|
4009
|
-
|
|
4016
|
+
wn as a9,
|
|
4017
|
+
eo as aA,
|
|
4010
4018
|
ue as aa,
|
|
4011
|
-
|
|
4019
|
+
ho as ab,
|
|
4012
4020
|
V as ac,
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4021
|
+
fo as ad,
|
|
4022
|
+
ce as ae,
|
|
4023
|
+
yi as af,
|
|
4024
|
+
lt as ag,
|
|
4025
|
+
ie as ah,
|
|
4026
|
+
vo as ai,
|
|
4027
|
+
Wr as aj,
|
|
4028
|
+
Xr as ak,
|
|
4029
|
+
po as al,
|
|
4030
|
+
Zn as am,
|
|
4031
|
+
io as an,
|
|
4032
|
+
Hs as ao,
|
|
4033
|
+
js as ap,
|
|
4034
|
+
Vs as aq,
|
|
4035
|
+
dn as ar,
|
|
4036
|
+
gt as as,
|
|
4037
|
+
Gi as at,
|
|
4038
|
+
Yi as au,
|
|
4039
|
+
Xi as av,
|
|
4040
|
+
go as aw,
|
|
4041
|
+
Gn as ax,
|
|
4042
|
+
Yr as ay,
|
|
4043
|
+
to as az,
|
|
4044
|
+
oo as b,
|
|
4045
|
+
N as c,
|
|
4038
4046
|
we as d,
|
|
4039
|
-
|
|
4040
|
-
|
|
4047
|
+
lo as e,
|
|
4048
|
+
$t as f,
|
|
4041
4049
|
Rr as g,
|
|
4042
4050
|
Br as h,
|
|
4043
4051
|
A as i,
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
+
Y as j,
|
|
4053
|
+
Ei as k,
|
|
4054
|
+
$ as l,
|
|
4055
|
+
v as m,
|
|
4056
|
+
co as n,
|
|
4057
|
+
Yn as o,
|
|
4058
|
+
hr as p,
|
|
4059
|
+
Un as q,
|
|
4052
4060
|
Ls as r,
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4061
|
+
Qi as s,
|
|
4062
|
+
qi as t,
|
|
4063
|
+
_o as u,
|
|
4064
|
+
Jt as v,
|
|
4057
4065
|
G as w,
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4066
|
+
F as x,
|
|
4067
|
+
Qt as y,
|
|
4068
|
+
Kr as z
|
|
4061
4069
|
};
|
|
4062
|
-
//# sourceMappingURL=Lexical.prod-
|
|
4070
|
+
//# sourceMappingURL=Lexical.prod-BhH9TCLN.js.map
|