@uva-glass/component-library 1.55.0 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Lexical.prod-BiuZHlIm.js → Lexical.prod-CO0gPAfo.js} +583 -607
- package/dist/Lexical.prod-CO0gPAfo.js.map +1 -0
- package/dist/LexicalComposerContext.prod-Dyvim1tK.js +27 -0
- package/dist/LexicalComposerContext.prod-Dyvim1tK.js.map +1 -0
- package/dist/LexicalList.prod-BceA-cJD.js +562 -0
- package/dist/LexicalList.prod-BceA-cJD.js.map +1 -0
- package/dist/{LexicalUtils.prod-BZOm66mY.js → LexicalUtils.prod-PbdOb6JG.js} +6 -6
- package/dist/{LexicalUtils.prod-BZOm66mY.js.map → LexicalUtils.prod-PbdOb6JG.js.map} +1 -1
- package/dist/RteEditor.module-Dz9a8vaK.js +29 -0
- package/dist/RteEditor.module-Dz9a8vaK.js.map +1 -0
- package/dist/Sortable.module-uk_YuFs1.js +24 -0
- package/dist/{Sortable.module-BrgGu8qp.js.map → Sortable.module-uk_YuFs1.js.map} +1 -1
- package/dist/{SortableProvider-Z0e0qeQT.js → SortableProvider-i4PDjRS_.js} +2 -2
- package/dist/{SortableProvider-Z0e0qeQT.js.map → SortableProvider-i4PDjRS_.js.map} +1 -1
- package/dist/TablePlugin-1L5UZfDH.js +249 -0
- package/dist/TablePlugin-1L5UZfDH.js.map +1 -0
- package/dist/assets/Container.css +1 -1
- package/dist/assets/EditorHeader.css +1 -0
- package/dist/assets/Flyout.css +1 -0
- package/dist/assets/Periods.css +1 -1
- package/dist/assets/RteEditor.css +1 -1
- package/dist/assets/Sortable.css +1 -1
- package/dist/assets/TableCellContextMenu.css +1 -0
- package/dist/assets/TablePlugin.css +1 -0
- package/dist/components/CheckboxTree/CheckboxTree.js +13 -11
- package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
- package/dist/components/Icon/icons/index.d.ts +21 -18
- package/dist/components/Icon/icons/index.js +125 -120
- package/dist/components/Icon/icons/index.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +16 -14
- package/dist/components/InputField/InputField.stories.js.map +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 +5 -3
- package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/Periods/Periods.js +12 -12
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +6 -4
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.d.ts +7 -0
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +53 -0
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -0
- package/dist/components/RteEditor/EditorHeader/index.d.ts +1 -0
- package/dist/components/RteEditor/EditorHeader/index.js +5 -0
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +11 -10
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +18 -15
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.d.ts +2 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +7 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.d.ts +2 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +63 -49
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.d.ts +3 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +6 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js.map +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +31 -8
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +6 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.d.ts +8 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js +44 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/TableCellContextMenu.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/index.js +5 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TableCellContextMenu/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.d.ts +9 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +8 -6
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.d.ts +7 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +10 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +4 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js.map +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.d.ts +4 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +48 -38
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.js +10 -8
- package/dist/components/RteEditor/Plugins/index.js.map +1 -1
- package/dist/components/RteEditor/Providers/LanguageProvider.d.ts +10 -0
- package/dist/components/RteEditor/Providers/LanguageProvider.js +18 -0
- package/dist/components/RteEditor/Providers/LanguageProvider.js.map +1 -0
- package/dist/components/RteEditor/RteEditor.d.ts +9 -1
- package/dist/components/RteEditor/RteEditor.js +476 -401
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.stories.d.ts +1 -0
- package/dist/components/RteEditor/RteEditor.stories.js +106 -15
- package/dist/components/RteEditor/RteEditor.stories.js.map +1 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +1 -1
- package/dist/components/RteEditor/hooks/components/Flyout.d.ts +7 -0
- package/dist/components/RteEditor/hooks/components/Flyout.js +14 -0
- package/dist/components/RteEditor/hooks/components/Flyout.js.map +1 -0
- package/dist/components/RteEditor/hooks/useFlyout.js +16 -20
- package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -1
- package/dist/components/RteEditor/hooks/useTranslation.d.ts +61 -0
- package/dist/components/RteEditor/hooks/useTranslation.js +10 -0
- package/dist/components/RteEditor/hooks/useTranslation.js.map +1 -0
- package/dist/components/RteEditor/index.js +3 -2
- package/dist/components/RteEditor/mockRteContent.d.ts +1 -0
- package/dist/components/RteEditor/mockRteContent.js +98 -0
- package/dist/components/RteEditor/mockRteContent.js.map +1 -0
- package/dist/components/RteEditor/translations.d.ts +64 -0
- package/dist/components/RteEditor/translations.js +68 -0
- package/dist/components/RteEditor/translations.js.map +1 -0
- package/dist/components/Sortable/Sortable.js +1 -1
- package/dist/components/Sortable/SortableProvider.js +1 -1
- package/dist/components/Sortable/components/SortableContainer.js +2 -2
- package/dist/components/Sortable/components/SortableHandle.js +1 -1
- package/dist/components/Sortable/components/SortableItem.js +2 -2
- package/dist/components/index.js +20 -19
- package/dist/helpers-BewZrn6E.js +1512 -0
- package/dist/helpers-BewZrn6E.js.map +1 -0
- package/dist/{helpers-CJF7fErD.js → helpers-Ec7CfNnA.js} +72 -59
- package/dist/helpers-Ec7CfNnA.js.map +1 -0
- package/dist/index.js +20 -19
- package/dist/storyComponents/Container/Container.d.ts +1 -1
- package/dist/storyComponents/Container/Container.js +18 -16
- package/dist/storyComponents/Container/Container.js.map +1 -1
- package/package.json +12 -12
- package/dist/AddTableFrom-CwnPli3F.js +0 -162
- package/dist/AddTableFrom-CwnPli3F.js.map +0 -1
- package/dist/Lexical.prod-BiuZHlIm.js.map +0 -1
- package/dist/ListPlugin-DFFbKLaN.js +0 -588
- package/dist/ListPlugin-DFFbKLaN.js.map +0 -1
- package/dist/RteEditor.module-BBbfV1rk.js +0 -24
- package/dist/RteEditor.module-BBbfV1rk.js.map +0 -1
- package/dist/Sortable.module-BrgGu8qp.js +0 -24
- package/dist/TablePlugin-CKJQiwra.js +0 -1506
- package/dist/TablePlugin-CKJQiwra.js.map +0 -1
- package/dist/assets/AddTableFrom.css +0 -1
- package/dist/assets/useFlyout.css +0 -1
- package/dist/components/RteEditor/hooks/index.d.ts +0 -1
- package/dist/components/RteEditor/hooks/index.js +0 -5
- package/dist/helpers-CJF7fErD.js.map +0 -1
- /package/dist/components/RteEditor/{hooks → EditorHeader}/index.js.map +0 -0
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
function Is(n) {
|
|
3
|
-
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
4
|
-
}
|
|
5
|
-
var As = Is(function(n) {
|
|
6
|
-
const e = new URLSearchParams();
|
|
7
|
-
e.append("code", n);
|
|
8
|
-
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
9
|
-
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
10
|
-
});
|
|
11
|
-
const Ms = Ls(null);
|
|
12
|
-
function Yi(n, e) {
|
|
13
|
-
let t = null;
|
|
14
|
-
return { getTheme: function() {
|
|
15
|
-
return e ?? (t != null ? t.getTheme() : null);
|
|
16
|
-
} };
|
|
17
|
-
}
|
|
18
|
-
function eo() {
|
|
19
|
-
const n = Os(Ms);
|
|
20
|
-
return n == null && As(8), n;
|
|
21
|
-
}
|
|
22
|
-
function to(n) {
|
|
1
|
+
function Hi(n) {
|
|
23
2
|
return {};
|
|
24
3
|
}
|
|
25
|
-
const bn = {},
|
|
4
|
+
const bn = {}, qi = {}, Ls = {}, yt = {}, gt = {}, Zn = {}, He = {}, zr = {}, Gn = {}, mt = {}, xt = {}, we = {}, Br = {}, Rr = {}, Os = {}, Is = {}, As = {}, Ms = {}, Ws = {}, zs = {}, Bs = {}, fn = {}, Rs = {}, Ks = {}, Js = {}, $s = {}, Us = {}, Qi = {}, Xi = {}, Zi = {}, Vs = {}, Gi = {}, js = {}, Hs = {}, qs = {}, Kr = {}, Jr = {}, Yn = {}, Yi = {}, eo = {}, to = {}, no = {}, Qs = {}, Xs = {}, Zs = {}, ne = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Gs = ne && "documentMode" in document ? document.documentMode : null, Y = 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"), wn = ne && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), It = ne && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Ys = ne && /Android/.test(navigator.userAgent), $r = ne && /^(?=.*Chrome).*/i.test(navigator.userAgent), ei = ne && Ys && $r, Nn = ne && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !$r, rt = 1, Te = 3, Ee = 0, Ur = 1, Me = 2, ti = 0, ni = 1, ri = 2, St = 4, Tt = 8, En = 128, si = 112 | (3 | St | Tt) | En, Pn = 1, Fn = 2, Dn = 3, Ln = 4, On = 5, In = 6, At = wn || It || Nn ? " " : "", ae = `
|
|
26
5
|
|
|
27
|
-
`,
|
|
28
|
-
function
|
|
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: En, italic: 2, strikethrough: St, subscript: 32, superscript: 64, underline: Tt }, ci = { directionless: 1, unmergeable: 2 }, er = { center: Fn, end: In, justify: Ln, left: Pn, right: Dn, start: On }, ai = { [Fn]: "center", [In]: "end", [Ln]: "justify", [Pn]: "left", [Dn]: "right", [On]: "start" }, ui = { normal: 0, segmented: 2, token: 1 }, fi = { [ti]: "normal", [ri]: "segmented", [ni]: "token" };
|
|
7
|
+
function di(n) {
|
|
29
8
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
30
9
|
}
|
|
31
|
-
var k =
|
|
10
|
+
var k = di(function(n) {
|
|
32
11
|
const e = new URLSearchParams();
|
|
33
12
|
e.append("code", n);
|
|
34
13
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
@@ -39,22 +18,22 @@ function Ct(...n) {
|
|
|
39
18
|
for (const t of n) if (t && typeof t == "string") for (const [r] of t.matchAll(/\S+/g)) e.push(r);
|
|
40
19
|
return e;
|
|
41
20
|
}
|
|
42
|
-
const
|
|
21
|
+
const hi = 100;
|
|
43
22
|
let dn = !1, An = 0;
|
|
44
|
-
function
|
|
23
|
+
function gi(n) {
|
|
45
24
|
An = n.timeStamp;
|
|
46
25
|
}
|
|
47
26
|
function en(n, e, t) {
|
|
48
27
|
return e.__lexicalLineBreak === n || n[`__lexicalKey_${t._key}`] !== void 0;
|
|
49
28
|
}
|
|
50
|
-
function
|
|
29
|
+
function _i(n, e, t) {
|
|
51
30
|
const r = se(t._window);
|
|
52
31
|
let s = null, i = null;
|
|
53
32
|
r !== null && r.anchorNode === n && (s = r.anchorOffset, i = r.focusOffset);
|
|
54
33
|
const o = n.nodeValue;
|
|
55
34
|
o !== null && Bn(e, o, s, i, !1);
|
|
56
35
|
}
|
|
57
|
-
function
|
|
36
|
+
function pi(n, e, t) {
|
|
58
37
|
if (F(n)) {
|
|
59
38
|
const r = n.anchor.getNode();
|
|
60
39
|
if (r.is(t) && n.format !== r.getFormat()) return !1;
|
|
@@ -63,7 +42,7 @@ function Si(n, e, t) {
|
|
|
63
42
|
}
|
|
64
43
|
function Hr(n, e, t) {
|
|
65
44
|
dn = !0;
|
|
66
|
-
const r = performance.now() - An >
|
|
45
|
+
const r = performance.now() - An > hi;
|
|
67
46
|
try {
|
|
68
47
|
X(n, () => {
|
|
69
48
|
const s = I() || function(u) {
|
|
@@ -71,19 +50,19 @@ function Hr(n, e, t) {
|
|
|
71
50
|
const d = I();
|
|
72
51
|
return d !== null ? d.clone() : null;
|
|
73
52
|
});
|
|
74
|
-
}(n), i = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState,
|
|
75
|
-
let
|
|
53
|
+
}(n), i = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState, c = n._blockCursorElement;
|
|
54
|
+
let a = !1, f = "";
|
|
76
55
|
for (let u = 0; u < e.length; u++) {
|
|
77
56
|
const d = e[u], g = d.type, p = d.target;
|
|
78
57
|
let _ = zt(p, l);
|
|
79
58
|
if (!(_ === null && p !== o || A(_))) {
|
|
80
|
-
if (g === "characterData") r && N(_) &&
|
|
59
|
+
if (g === "characterData") r && N(_) && pi(s, p, _) && _i(p, _, n);
|
|
81
60
|
else if (g === "childList") {
|
|
82
|
-
|
|
61
|
+
a = !0;
|
|
83
62
|
const m = d.addedNodes;
|
|
84
63
|
for (let C = 0; C < m.length; C++) {
|
|
85
64
|
const b = m[C], v = Yr(b), P = b.parentNode;
|
|
86
|
-
if (P != null && b !==
|
|
65
|
+
if (P != null && b !== c && v === null && (b.nodeName !== "BR" || !en(b, P, n))) {
|
|
87
66
|
if (xe) {
|
|
88
67
|
const T = b.innerText || b.nodeValue;
|
|
89
68
|
T && (f += T);
|
|
@@ -96,7 +75,7 @@ function Hr(n, e, t) {
|
|
|
96
75
|
let C = 0;
|
|
97
76
|
for (let b = 0; b < x; b++) {
|
|
98
77
|
const v = y[b];
|
|
99
|
-
(v.nodeName === "BR" && en(v, p, n) ||
|
|
78
|
+
(v.nodeName === "BR" && en(v, p, n) || c === v) && (p.appendChild(v), C++);
|
|
100
79
|
}
|
|
101
80
|
x !== C && (p === o && (_ = ts(l)), i.set(p, _));
|
|
102
81
|
}
|
|
@@ -122,7 +101,7 @@ function Hr(n, e, t) {
|
|
|
122
101
|
}
|
|
123
102
|
t.takeRecords();
|
|
124
103
|
}
|
|
125
|
-
s !== null && (
|
|
104
|
+
s !== null && (a && (s.dirty = !0, ue(s)), xe && is(n) && s.insertRawText(f));
|
|
126
105
|
});
|
|
127
106
|
} finally {
|
|
128
107
|
dn = !1;
|
|
@@ -134,7 +113,7 @@ function qr(n) {
|
|
|
134
113
|
}
|
|
135
114
|
function Qr(n) {
|
|
136
115
|
(function(e) {
|
|
137
|
-
An === 0 && Kt(e).addEventListener("textInput",
|
|
116
|
+
An === 0 && Kt(e).addEventListener("textInput", gi, !0);
|
|
138
117
|
})(n), n._observer = new MutationObserver((e, t) => {
|
|
139
118
|
Hr(n, e, t);
|
|
140
119
|
});
|
|
@@ -172,7 +151,7 @@ function rr(n) {
|
|
|
172
151
|
}
|
|
173
152
|
} else r.remove();
|
|
174
153
|
}
|
|
175
|
-
function
|
|
154
|
+
function yi(n) {
|
|
176
155
|
return sr(n.anchor), sr(n.focus), n;
|
|
177
156
|
}
|
|
178
157
|
function sr(n) {
|
|
@@ -187,8 +166,8 @@ function sr(n) {
|
|
|
187
166
|
n.set(r.__key, s ? r.getChildrenSize() : 0, "element");
|
|
188
167
|
}
|
|
189
168
|
}
|
|
190
|
-
let
|
|
191
|
-
const
|
|
169
|
+
let mi = 1;
|
|
170
|
+
const xi = typeof queueMicrotask == "function" ? queueMicrotask : (n) => {
|
|
192
171
|
Promise.resolve().then(n);
|
|
193
172
|
};
|
|
194
173
|
function Xr(n) {
|
|
@@ -223,30 +202,30 @@ function Wt(n) {
|
|
|
223
202
|
function be(n) {
|
|
224
203
|
return n.isToken() || n.isSegmented();
|
|
225
204
|
}
|
|
226
|
-
function
|
|
205
|
+
function vi(n) {
|
|
227
206
|
return n.nodeType === Te;
|
|
228
207
|
}
|
|
229
208
|
function kt(n) {
|
|
230
209
|
let e = n;
|
|
231
210
|
for (; e != null; ) {
|
|
232
|
-
if (
|
|
211
|
+
if (vi(e)) return e;
|
|
233
212
|
e = e.firstChild;
|
|
234
213
|
}
|
|
235
214
|
return null;
|
|
236
215
|
}
|
|
237
216
|
function bt(n, e, t) {
|
|
238
|
-
const r =
|
|
217
|
+
const r = ce[e];
|
|
239
218
|
if (t !== null && (n & r) == (t & r)) return n;
|
|
240
219
|
let s = n ^ r;
|
|
241
|
-
return e === "subscript" ? s &= ~
|
|
220
|
+
return e === "subscript" ? s &= ~ce.superscript : e === "superscript" && (s &= ~ce.subscript), s;
|
|
242
221
|
}
|
|
243
|
-
function
|
|
222
|
+
function ro(n) {
|
|
244
223
|
return N(n) || Ae(n) || A(n);
|
|
245
224
|
}
|
|
246
225
|
function Gr(n, e) {
|
|
247
226
|
if (e != null) return void (n.__key = e);
|
|
248
227
|
q(), bs();
|
|
249
|
-
const t = M(), r = fe(), s = "" +
|
|
228
|
+
const t = M(), r = fe(), s = "" + mi++;
|
|
250
229
|
r._nodeMap.set(s, n), S(n) ? t._dirtyElements.set(s, !0) : t._dirtyLeaves.add(s), t._cloneNotNeeded.add(s), t._dirtyType = Ur, n.__key = s;
|
|
251
230
|
}
|
|
252
231
|
function Ne(n) {
|
|
@@ -283,11 +262,11 @@ function Ne(n) {
|
|
|
283
262
|
function wt(n) {
|
|
284
263
|
bs();
|
|
285
264
|
const e = n.getLatest(), t = e.__parent, r = fe(), s = M(), i = r._nodeMap, o = s._dirtyElements;
|
|
286
|
-
t !== null && function(
|
|
287
|
-
let h =
|
|
265
|
+
t !== null && function(c, a, f) {
|
|
266
|
+
let h = c;
|
|
288
267
|
for (; h !== null; ) {
|
|
289
268
|
if (f.has(h)) return;
|
|
290
|
-
const u =
|
|
269
|
+
const u = a.get(h);
|
|
291
270
|
if (u === void 0) break;
|
|
292
271
|
f.set(h, !1), h = u.__parent;
|
|
293
272
|
}
|
|
@@ -295,7 +274,7 @@ function wt(n) {
|
|
|
295
274
|
const l = e.__key;
|
|
296
275
|
s._dirtyType = Ur, S(n) ? o.set(l, !0) : s._dirtyLeaves.add(l);
|
|
297
276
|
}
|
|
298
|
-
function
|
|
277
|
+
function $(n) {
|
|
299
278
|
q();
|
|
300
279
|
const e = M(), t = e._compositionKey;
|
|
301
280
|
if (n !== t) {
|
|
@@ -384,13 +363,13 @@ function zn(n, e, t) {
|
|
|
384
363
|
let { anchorOffset: i, focusOffset: o } = r;
|
|
385
364
|
if (s !== null) {
|
|
386
365
|
let l = ss(s);
|
|
387
|
-
const
|
|
388
|
-
if (l !== null && N(
|
|
366
|
+
const c = zt(s);
|
|
367
|
+
if (l !== null && N(c)) {
|
|
389
368
|
if (l === At && t) {
|
|
390
|
-
const
|
|
391
|
-
l = t, i =
|
|
369
|
+
const a = t.length;
|
|
370
|
+
l = t, i = a, o = a;
|
|
392
371
|
}
|
|
393
|
-
l !== null && Bn(
|
|
372
|
+
l !== null && Bn(c, l, i, o, n);
|
|
394
373
|
}
|
|
395
374
|
}
|
|
396
375
|
}
|
|
@@ -400,10 +379,10 @@ function Bn(n, e, t, r, s) {
|
|
|
400
379
|
const o = i.isComposing();
|
|
401
380
|
let l = e;
|
|
402
381
|
(o || s) && e[e.length - 1] === At && (l = e.slice(0, -1));
|
|
403
|
-
const
|
|
404
|
-
if (s || l !==
|
|
382
|
+
const c = i.getTextContent();
|
|
383
|
+
if (s || l !== c) {
|
|
405
384
|
if (l === "") {
|
|
406
|
-
if (
|
|
385
|
+
if ($(null), wn || It || Nn) i.remove();
|
|
407
386
|
else {
|
|
408
387
|
const p = M();
|
|
409
388
|
setTimeout(() => {
|
|
@@ -414,19 +393,19 @@ function Bn(n, e, t, r, s) {
|
|
|
414
393
|
}
|
|
415
394
|
return;
|
|
416
395
|
}
|
|
417
|
-
const
|
|
418
|
-
if (i.isToken() || u !== null && d === u && !o || F(f) && (
|
|
396
|
+
const a = i.getParent(), f = ot(), h = i.getTextContentSize(), u = ye(), d = i.getKey();
|
|
397
|
+
if (i.isToken() || u !== null && d === u && !o || F(f) && (a !== null && !a.canInsertTextBefore() && f.anchor.offset === 0 || f.anchor.key === n.__key && f.anchor.offset === 0 && !i.canInsertTextBefore() && !o || f.focus.key === n.__key && f.focus.offset === h && !i.canInsertTextAfter() && !o)) return void i.markDirty();
|
|
419
398
|
const g = I();
|
|
420
399
|
if (!F(g) || t === null || r === null) return void i.setTextContent(l);
|
|
421
400
|
if (g.setTextNodeRange(i, t, i, r), i.isSegmented()) {
|
|
422
|
-
const p =
|
|
401
|
+
const p = J(i.getTextContent());
|
|
423
402
|
i.replace(p), i = p;
|
|
424
403
|
}
|
|
425
404
|
i.setTextContent(l);
|
|
426
405
|
}
|
|
427
406
|
}
|
|
428
407
|
}
|
|
429
|
-
function
|
|
408
|
+
function Si(n, e) {
|
|
430
409
|
if (e.isSegmented()) return !0;
|
|
431
410
|
if (!n.isCollapsed()) return !1;
|
|
432
411
|
const t = n.anchor.offset, r = e.getParentOrThrow(), s = e.isToken();
|
|
@@ -438,27 +417,27 @@ function wi(n, e) {
|
|
|
438
417
|
function lr(n) {
|
|
439
418
|
return n === "ArrowLeft";
|
|
440
419
|
}
|
|
441
|
-
function
|
|
420
|
+
function cr(n) {
|
|
442
421
|
return n === "ArrowRight";
|
|
443
422
|
}
|
|
444
423
|
function Ve(n, e) {
|
|
445
424
|
return Y ? n : e;
|
|
446
425
|
}
|
|
447
|
-
function
|
|
426
|
+
function ar(n) {
|
|
448
427
|
return n === "Enter";
|
|
449
428
|
}
|
|
450
429
|
function Ke(n) {
|
|
451
430
|
return n === "Backspace";
|
|
452
431
|
}
|
|
453
|
-
function
|
|
432
|
+
function Je(n) {
|
|
454
433
|
return n === "Delete";
|
|
455
434
|
}
|
|
456
435
|
function ur(n, e, t) {
|
|
457
436
|
return n.toLowerCase() === "a" && Ve(e, t);
|
|
458
437
|
}
|
|
459
|
-
function
|
|
438
|
+
function so() {
|
|
460
439
|
const n = G();
|
|
461
|
-
ue(
|
|
440
|
+
ue(yi(n.select(0, n.getChildrenSize())));
|
|
462
441
|
}
|
|
463
442
|
function qe(n, e) {
|
|
464
443
|
n.__lexicalClassNameCache === void 0 && (n.__lexicalClassNameCache = {});
|
|
@@ -475,11 +454,11 @@ function Rn(n, e, t, r, s) {
|
|
|
475
454
|
if (t.size === 0) return;
|
|
476
455
|
const i = r.__type, o = r.__key, l = e.get(i);
|
|
477
456
|
l === void 0 && k(33, i);
|
|
478
|
-
const
|
|
479
|
-
let
|
|
480
|
-
|
|
481
|
-
const f =
|
|
482
|
-
(f === void 0 || h) &&
|
|
457
|
+
const c = l.klass;
|
|
458
|
+
let a = n.get(c);
|
|
459
|
+
a === void 0 && (a = /* @__PURE__ */ new Map(), n.set(c, a));
|
|
460
|
+
const f = a.get(o), h = f === "destroyed" && s === "created";
|
|
461
|
+
(f === void 0 || h) && a.set(o, h ? "updated" : s);
|
|
483
462
|
}
|
|
484
463
|
function fr(n, e, t) {
|
|
485
464
|
const r = n.getParent();
|
|
@@ -529,7 +508,7 @@ function Kt(n) {
|
|
|
529
508
|
const e = n._window;
|
|
530
509
|
return e === null && k(78), e;
|
|
531
510
|
}
|
|
532
|
-
function
|
|
511
|
+
function Ti(n) {
|
|
533
512
|
let e = n.getParentOrThrow();
|
|
534
513
|
for (; e !== null; ) {
|
|
535
514
|
if (Pe(e)) return e;
|
|
@@ -540,11 +519,11 @@ function Ni(n) {
|
|
|
540
519
|
function Pe(n) {
|
|
541
520
|
return Z(n) || S(n) && n.isShadowRoot();
|
|
542
521
|
}
|
|
543
|
-
function
|
|
522
|
+
function Ci(n) {
|
|
544
523
|
const e = n.constructor.clone(n);
|
|
545
524
|
return Gr(e, null), e;
|
|
546
525
|
}
|
|
547
|
-
function
|
|
526
|
+
function Jt(n) {
|
|
548
527
|
const e = M(), t = n.constructor.getType(), r = e._nodes.get(t);
|
|
549
528
|
r === void 0 && k(200, n.constructor.name, t);
|
|
550
529
|
const { replace: s, replaceWithKlass: i } = r;
|
|
@@ -565,22 +544,22 @@ function Kn(n, e, t) {
|
|
|
565
544
|
const r = n.parentElement;
|
|
566
545
|
r !== null && r.removeChild(n);
|
|
567
546
|
}
|
|
568
|
-
function
|
|
547
|
+
function ki(n, e, t) {
|
|
569
548
|
let r = n._blockCursorElement;
|
|
570
549
|
if (F(t) && t.isCollapsed() && t.anchor.type === "element" && e.contains(document.activeElement)) {
|
|
571
550
|
const s = t.anchor, i = s.getNode(), o = s.offset;
|
|
572
|
-
let l = !1,
|
|
551
|
+
let l = !1, c = null;
|
|
573
552
|
if (o === i.getChildrenSize())
|
|
574
553
|
nn(i.getChildAtIndex(o - 1)) && (l = !0);
|
|
575
554
|
else {
|
|
576
|
-
const
|
|
577
|
-
if (nn(
|
|
578
|
-
const f =
|
|
579
|
-
(f === null || nn(f)) && (l = !0,
|
|
555
|
+
const a = i.getChildAtIndex(o);
|
|
556
|
+
if (nn(a)) {
|
|
557
|
+
const f = a.getPreviousSibling();
|
|
558
|
+
(f === null || nn(f)) && (l = !0, c = n.getElementByKey(a.__key));
|
|
580
559
|
}
|
|
581
560
|
}
|
|
582
561
|
if (l) {
|
|
583
|
-
const
|
|
562
|
+
const a = n.getElementByKey(i.__key);
|
|
584
563
|
return r === null && (n._blockCursorElement = r = function(f) {
|
|
585
564
|
const h = f.theme, u = document.createElement("div");
|
|
586
565
|
u.contentEditable = "false", u.setAttribute("data-lexical-cursor", "true");
|
|
@@ -593,7 +572,7 @@ function Pi(n, e, t) {
|
|
|
593
572
|
d !== void 0 && u.classList.add(...d);
|
|
594
573
|
}
|
|
595
574
|
return u;
|
|
596
|
-
}(n._config)), e.style.caretColor = "transparent", void (
|
|
575
|
+
}(n._config)), e.style.caretColor = "transparent", void (c === null ? a.appendChild(r) : a.insertBefore(r, c));
|
|
597
576
|
}
|
|
598
577
|
}
|
|
599
578
|
r !== null && Kn(r, n, e);
|
|
@@ -601,29 +580,29 @@ function Pi(n, e, t) {
|
|
|
601
580
|
function se(n) {
|
|
602
581
|
return ne ? (n || window).getSelection() : null;
|
|
603
582
|
}
|
|
604
|
-
function
|
|
583
|
+
function io(n, e) {
|
|
605
584
|
let t = n.getChildAtIndex(e);
|
|
606
585
|
t == null && (t = n), Pe(n) && k(102);
|
|
607
586
|
const r = (o) => {
|
|
608
|
-
const l = o.getParentOrThrow(),
|
|
609
|
-
if (
|
|
587
|
+
const l = o.getParentOrThrow(), c = Pe(l), a = o !== t || c ? Ci(o) : o;
|
|
588
|
+
if (c) return S(o) && S(a) || k(133), o.insertAfter(a), [o, a, a];
|
|
610
589
|
{
|
|
611
590
|
const [f, h, u] = r(l), d = o.getNextSiblings();
|
|
612
|
-
return u.append(
|
|
591
|
+
return u.append(a, ...d), [f, h, a];
|
|
613
592
|
}
|
|
614
593
|
}, [s, i] = r(t);
|
|
615
594
|
return [s, i];
|
|
616
595
|
}
|
|
617
|
-
function
|
|
618
|
-
return
|
|
596
|
+
function oo(n) {
|
|
597
|
+
return Jn(n) && n.tagName === "A";
|
|
619
598
|
}
|
|
620
|
-
function
|
|
599
|
+
function Jn(n) {
|
|
621
600
|
return n.nodeType === 1;
|
|
622
601
|
}
|
|
623
|
-
function
|
|
602
|
+
function lo(n) {
|
|
624
603
|
return n.nodeType === 11;
|
|
625
604
|
}
|
|
626
|
-
function
|
|
605
|
+
function bi(n) {
|
|
627
606
|
const e = new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/, "i");
|
|
628
607
|
return n.nodeName.match(e) !== null;
|
|
629
608
|
}
|
|
@@ -637,17 +616,17 @@ function _e(n) {
|
|
|
637
616
|
const e = n.getFirstChild(), t = e === null || Ae(e) || N(e) || e.isInline();
|
|
638
617
|
return !n.isInline() && n.canBeEmpty() !== !1 && t;
|
|
639
618
|
}
|
|
640
|
-
function
|
|
619
|
+
function $e(n, e) {
|
|
641
620
|
let t = n;
|
|
642
621
|
for (; t !== null && t.getParent() !== null && !e(t); ) t = t.getParentOrThrow();
|
|
643
622
|
return e(t) ? t : null;
|
|
644
623
|
}
|
|
645
|
-
function
|
|
624
|
+
function co() {
|
|
646
625
|
return M();
|
|
647
626
|
}
|
|
648
|
-
const gr = /* @__PURE__ */ new WeakMap(),
|
|
649
|
-
function
|
|
650
|
-
if (!n._readOnly && n.isEmpty()) return
|
|
627
|
+
const gr = /* @__PURE__ */ new WeakMap(), wi = /* @__PURE__ */ new Map();
|
|
628
|
+
function Ni(n) {
|
|
629
|
+
if (!n._readOnly && n.isEmpty()) return wi;
|
|
651
630
|
n._readOnly || k(192);
|
|
652
631
|
let e = gr.get(n);
|
|
653
632
|
if (!e) {
|
|
@@ -660,7 +639,7 @@ function Li(n) {
|
|
|
660
639
|
}
|
|
661
640
|
return e;
|
|
662
641
|
}
|
|
663
|
-
function
|
|
642
|
+
function Ei(n) {
|
|
664
643
|
const e = n.constructor.clone(n);
|
|
665
644
|
return e.afterCloneFrom(n), e;
|
|
666
645
|
}
|
|
@@ -671,7 +650,7 @@ function os(n, e, t, r, s, i) {
|
|
|
671
650
|
o.__parent === e && (S(o) && os(o, l, t, r, s, i), t.has(l) || i.delete(l), s.push(l)), o = o.getNextSibling();
|
|
672
651
|
}
|
|
673
652
|
}
|
|
674
|
-
let Se, H, Ye,
|
|
653
|
+
let Se, H, Ye, $t, hn, gn, Fe, te, _n, et, B = "", j = "", re = null, ee = "", le = "", ls = !1, tt = !1, _t = null;
|
|
675
654
|
function Et(n, e) {
|
|
676
655
|
const t = Fe.get(n);
|
|
677
656
|
if (e !== null) {
|
|
@@ -682,7 +661,7 @@ function Et(n, e) {
|
|
|
682
661
|
const r = Ft(t, Fe);
|
|
683
662
|
pn(r, 0, r.length - 1, null);
|
|
684
663
|
}
|
|
685
|
-
t !== void 0 && Rn(et, Ye,
|
|
664
|
+
t !== void 0 && Rn(et, Ye, $t, t, "destroyed");
|
|
686
665
|
}
|
|
687
666
|
function pn(n, e, t, r) {
|
|
688
667
|
let s = e;
|
|
@@ -694,17 +673,17 @@ function pn(n, e, t, r) {
|
|
|
694
673
|
function ke(n, e) {
|
|
695
674
|
n.setProperty("text-align", e);
|
|
696
675
|
}
|
|
697
|
-
const
|
|
698
|
-
function
|
|
676
|
+
const Pi = "40px";
|
|
677
|
+
function cs(n, e) {
|
|
699
678
|
const t = Se.theme.indent;
|
|
700
679
|
if (typeof t == "string") {
|
|
701
680
|
const s = n.classList.contains(t);
|
|
702
681
|
e > 0 && !s ? n.classList.add(t) : e < 1 && s && n.classList.remove(t);
|
|
703
682
|
}
|
|
704
|
-
const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") ||
|
|
683
|
+
const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") || Pi;
|
|
705
684
|
n.style.setProperty("padding-inline-start", e === 0 ? "" : `calc(${e} * ${r})`);
|
|
706
685
|
}
|
|
707
|
-
function
|
|
686
|
+
function as(n, e) {
|
|
708
687
|
const t = n.style;
|
|
709
688
|
e === 0 ? ke(t, "") : e === Pn ? ke(t, "left") : e === Fn ? ke(t, "center") : e === Dn ? ke(t, "right") : e === Ln ? ke(t, "justify") : e === On ? ke(t, "start") : e === In && ke(t, "end");
|
|
710
689
|
}
|
|
@@ -713,19 +692,19 @@ function Pt(n, e, t) {
|
|
|
713
692
|
r === void 0 && k(60);
|
|
714
693
|
const s = r.createDOM(Se, H);
|
|
715
694
|
if (function(i, o, l) {
|
|
716
|
-
const
|
|
717
|
-
o["__lexicalKey_" + l._key] = i,
|
|
695
|
+
const c = l._keyToDOMMap;
|
|
696
|
+
o["__lexicalKey_" + l._key] = i, c.set(i, o);
|
|
718
697
|
}(n, s, H), N(r) ? s.setAttribute("data-lexical-text", "true") : A(r) && s.setAttribute("data-lexical-decorator", "true"), S(r)) {
|
|
719
698
|
const i = r.__indent, o = r.__size;
|
|
720
|
-
if (i !== 0 &&
|
|
721
|
-
const
|
|
722
|
-
(function(
|
|
699
|
+
if (i !== 0 && cs(s, i), o !== 0) {
|
|
700
|
+
const c = o - 1;
|
|
701
|
+
(function(a, f, h, u) {
|
|
723
702
|
const d = j;
|
|
724
|
-
j = "", yn(
|
|
725
|
-
})(Ft(r, te),
|
|
703
|
+
j = "", yn(a, h, 0, f, u, null), fs(h, u), j = d;
|
|
704
|
+
})(Ft(r, te), c, r, s);
|
|
726
705
|
}
|
|
727
706
|
const l = r.__format;
|
|
728
|
-
l !== 0 &&
|
|
707
|
+
l !== 0 && as(s, l), r.isInline() || us(null, r, s), Bt(r) && (B += ae, le += ae);
|
|
729
708
|
} else {
|
|
730
709
|
const i = r.getTextContent();
|
|
731
710
|
if (A(r)) {
|
|
@@ -739,7 +718,7 @@ function Pt(n, e, t) {
|
|
|
739
718
|
const i = e.__lexicalLineBreak;
|
|
740
719
|
i != null ? e.insertBefore(s, i) : e.appendChild(s);
|
|
741
720
|
}
|
|
742
|
-
return Rn(et, Ye,
|
|
721
|
+
return Rn(et, Ye, $t, r, "created"), s;
|
|
743
722
|
}
|
|
744
723
|
function yn(n, e, t, r, s, i) {
|
|
745
724
|
const o = B;
|
|
@@ -747,10 +726,10 @@ function yn(n, e, t, r, s, i) {
|
|
|
747
726
|
let l = t;
|
|
748
727
|
for (; l <= r; ++l) {
|
|
749
728
|
Pt(n[l], s, i);
|
|
750
|
-
const
|
|
751
|
-
|
|
729
|
+
const c = te.get(n[l]);
|
|
730
|
+
c !== null && N(c) && (re === null && (re = c.getFormat()), ee === "" && (ee = c.getStyle()));
|
|
752
731
|
}
|
|
753
|
-
Bt(e) && (B +=
|
|
732
|
+
Bt(e) && (B += ae), s.__lexicalTextContent = B, B = o + B;
|
|
754
733
|
}
|
|
755
734
|
function _r(n, e) {
|
|
756
735
|
const t = e.get(n);
|
|
@@ -780,23 +759,23 @@ function us(n, e, t) {
|
|
|
780
759
|
function fs(n, e) {
|
|
781
760
|
const t = e.__lexicalDirTextContent, r = e.__lexicalDir;
|
|
782
761
|
if (t !== j || r !== _t) {
|
|
783
|
-
const i = j === "", o = i ? _t : (s = j,
|
|
762
|
+
const i = j === "", o = i ? _t : (s = j, oi.test(s) ? "rtl" : li.test(s) ? "ltr" : null);
|
|
784
763
|
if (o !== r) {
|
|
785
|
-
const l = e.classList,
|
|
786
|
-
let
|
|
787
|
-
if (
|
|
788
|
-
if (typeof
|
|
789
|
-
const h = Ct(
|
|
790
|
-
|
|
764
|
+
const l = e.classList, c = Se.theme;
|
|
765
|
+
let a = r !== null ? c[r] : void 0, f = o !== null ? c[o] : void 0;
|
|
766
|
+
if (a !== void 0) {
|
|
767
|
+
if (typeof a == "string") {
|
|
768
|
+
const h = Ct(a);
|
|
769
|
+
a = c[r] = h;
|
|
791
770
|
}
|
|
792
|
-
l.remove(...
|
|
771
|
+
l.remove(...a);
|
|
793
772
|
}
|
|
794
773
|
if (o === null || i && o === "ltr") e.removeAttribute("dir");
|
|
795
774
|
else {
|
|
796
775
|
if (f !== void 0) {
|
|
797
776
|
if (typeof f == "string") {
|
|
798
777
|
const h = Ct(f);
|
|
799
|
-
f =
|
|
778
|
+
f = c[o] = h;
|
|
800
779
|
}
|
|
801
780
|
f !== void 0 && l.add(...f);
|
|
802
781
|
}
|
|
@@ -808,12 +787,12 @@ function fs(n, e) {
|
|
|
808
787
|
}
|
|
809
788
|
var s;
|
|
810
789
|
}
|
|
811
|
-
function
|
|
790
|
+
function Fi(n, e, t) {
|
|
812
791
|
const r = j;
|
|
813
792
|
var s;
|
|
814
793
|
j = "", re = null, ee = "", function(i, o, l) {
|
|
815
|
-
const
|
|
816
|
-
if (B = "",
|
|
794
|
+
const c = B, a = i.__size, f = o.__size;
|
|
795
|
+
if (B = "", a === 1 && f === 1) {
|
|
817
796
|
const h = i.__first, u = o.__first;
|
|
818
797
|
if (h === u) je(h, l);
|
|
819
798
|
else {
|
|
@@ -833,11 +812,11 @@ function Ai(n, e, t) {
|
|
|
833
812
|
N(d) && (re === null && (re = d.getFormat()), ee === "" && (ee = d.getStyle()));
|
|
834
813
|
} else {
|
|
835
814
|
const h = Ft(i, Fe), u = Ft(o, te);
|
|
836
|
-
if (
|
|
815
|
+
if (a === 0) f !== 0 && yn(u, o, 0, f - 1, l, null);
|
|
837
816
|
else if (f === 0) {
|
|
838
|
-
if (
|
|
817
|
+
if (a !== 0) {
|
|
839
818
|
const d = l.__lexicalLineBreak == null;
|
|
840
|
-
pn(h, 0,
|
|
819
|
+
pn(h, 0, a - 1, d ? null : l), d && (l.textContent = "");
|
|
841
820
|
}
|
|
842
821
|
} else (function(d, g, p, _, m, y) {
|
|
843
822
|
const x = _ - 1, C = m - 1;
|
|
@@ -862,9 +841,9 @@ function Ai(n, e, t) {
|
|
|
862
841
|
const L = p[C + 1];
|
|
863
842
|
yn(p, d, E, C, y, L === void 0 ? null : H.getElementByKey(L));
|
|
864
843
|
} else W && !O && pn(g, T, x, y);
|
|
865
|
-
})(o, h, u,
|
|
844
|
+
})(o, h, u, a, f, l);
|
|
866
845
|
}
|
|
867
|
-
Bt(o) && (B +=
|
|
846
|
+
Bt(o) && (B += ae), l.__lexicalTextContent = B, B = c + B;
|
|
868
847
|
}(n, e, t), fs(e, t), kn(s = e) && re != null && re !== s.__textFormat && !tt && (s.setTextFormat(re), s.setTextStyle(ee)), function(i) {
|
|
869
848
|
kn(i) && ee !== "" && ee !== i.__textStyle && !tt && i.setTextStyle(ee);
|
|
870
849
|
}(e), j = r;
|
|
@@ -895,15 +874,15 @@ function je(n, e) {
|
|
|
895
874
|
}
|
|
896
875
|
return i;
|
|
897
876
|
}
|
|
898
|
-
if (t !== r && s && Rn(et, Ye,
|
|
877
|
+
if (t !== r && s && Rn(et, Ye, $t, r, "updated"), r.updateDOM(t, i, Se)) {
|
|
899
878
|
const o = Pt(n, null, null);
|
|
900
879
|
return e === null && k(62), e.replaceChild(o, i), Et(n, null), o;
|
|
901
880
|
}
|
|
902
881
|
if (S(t) && S(r)) {
|
|
903
882
|
const o = r.__indent;
|
|
904
|
-
o !== t.__indent &&
|
|
883
|
+
o !== t.__indent && cs(i, o);
|
|
905
884
|
const l = r.__format;
|
|
906
|
-
l !== t.__format &&
|
|
885
|
+
l !== t.__format && as(i, l), s && (Fi(t, r, i), Z(r) || r.isInline() || us(t, r, i)), Bt(r) && (B += ae, le += ae);
|
|
907
886
|
} else {
|
|
908
887
|
const o = r.getTextContent();
|
|
909
888
|
if (A(r)) {
|
|
@@ -931,8 +910,8 @@ function rn(n) {
|
|
|
931
910
|
let e = n.nextSibling;
|
|
932
911
|
return e !== null && e === H._blockCursorElement && (e = e.nextSibling), e;
|
|
933
912
|
}
|
|
934
|
-
function
|
|
935
|
-
B = "", le = "", j = "", ls = r === Me, _t = null, H = t, Se = t._config, Ye = t._nodes,
|
|
913
|
+
function Di(n, e, t, r, s, i) {
|
|
914
|
+
B = "", le = "", j = "", ls = r === Me, _t = null, H = t, Se = t._config, Ye = t._nodes, $t = H._listeners.mutation, hn = s, gn = i, Fe = n._nodeMap, te = e._nodeMap, tt = e._readOnly, _n = new Map(t._keyToDOMMap);
|
|
936
915
|
const o = /* @__PURE__ */ new Map();
|
|
937
916
|
return et = o, je("root", null), H = void 0, Ye = void 0, hn = void 0, gn = void 0, Fe = void 0, te = void 0, Se = void 0, _n = void 0, et = void 0, o;
|
|
938
917
|
}
|
|
@@ -943,63 +922,63 @@ function mn(n) {
|
|
|
943
922
|
const oe = Object.freeze({}), xn = 30, vn = [["keydown", function(n, e) {
|
|
944
923
|
if (Xe = n.timeStamp, hs = n.key, e.isComposing()) return;
|
|
945
924
|
const { key: t, shiftKey: r, ctrlKey: s, metaKey: i, altKey: o } = n;
|
|
946
|
-
w(e,
|
|
947
|
-
return
|
|
948
|
-
}(t, s, o, i) ? w(e,
|
|
949
|
-
return
|
|
950
|
-
}(t, s, r, o, i) ? w(e,
|
|
951
|
-
return lr(l) && !
|
|
952
|
-
}(t, s, o, i) ? w(e,
|
|
953
|
-
return lr(l) && !f && !
|
|
954
|
-
}(t, s, r, o, i) ? w(e,
|
|
925
|
+
w(e, Os, n) || t != null && (function(l, c, a, f) {
|
|
926
|
+
return cr(l) && !c && !f && !a;
|
|
927
|
+
}(t, s, o, i) ? w(e, Is, n) : function(l, c, a, f, h) {
|
|
928
|
+
return cr(l) && !f && !a && (c || h);
|
|
929
|
+
}(t, s, r, o, i) ? w(e, As, n) : function(l, c, a, f) {
|
|
930
|
+
return lr(l) && !c && !f && !a;
|
|
931
|
+
}(t, s, o, i) ? w(e, Ms, n) : function(l, c, a, f, h) {
|
|
932
|
+
return lr(l) && !f && !a && (c || h);
|
|
933
|
+
}(t, s, r, o, i) ? w(e, Ws, n) : /* @__PURE__ */ function(l, c, a) {
|
|
955
934
|
return /* @__PURE__ */ function(f) {
|
|
956
935
|
return f === "ArrowUp";
|
|
957
|
-
}(l) && !
|
|
958
|
-
}(t, s, i) ? w(e,
|
|
936
|
+
}(l) && !c && !a;
|
|
937
|
+
}(t, s, i) ? w(e, zs, n) : /* @__PURE__ */ function(l, c, a) {
|
|
959
938
|
return /* @__PURE__ */ function(f) {
|
|
960
939
|
return f === "ArrowDown";
|
|
961
|
-
}(l) && !
|
|
962
|
-
}(t, s, i) ? w(e,
|
|
963
|
-
return
|
|
940
|
+
}(l) && !c && !a;
|
|
941
|
+
}(t, s, i) ? w(e, Bs, n) : function(l, c) {
|
|
942
|
+
return ar(l) && c;
|
|
964
943
|
}(t, r) ? (Ze = !0, w(e, fn, n)) : /* @__PURE__ */ function(l) {
|
|
965
944
|
return l === " ";
|
|
966
|
-
}(t) ? w(e,
|
|
967
|
-
return Y &&
|
|
968
|
-
}(t, s) ? (n.preventDefault(), Ze = !0, w(e, gt, !0)) : function(l,
|
|
969
|
-
return
|
|
970
|
-
}(t, r) ? (Ze = !1, w(e, fn, n)) : function(l,
|
|
971
|
-
return Y ? !
|
|
972
|
-
}(t, o, i, s) ? Ke(t) ? w(e,
|
|
945
|
+
}(t) ? w(e, Rs, n) : function(l, c) {
|
|
946
|
+
return Y && c && l.toLowerCase() === "o";
|
|
947
|
+
}(t, s) ? (n.preventDefault(), Ze = !0, w(e, gt, !0)) : function(l, c) {
|
|
948
|
+
return ar(l) && !c;
|
|
949
|
+
}(t, r) ? (Ze = !1, w(e, fn, n)) : function(l, c, a, f) {
|
|
950
|
+
return Y ? !c && !a && (Ke(l) || l.toLowerCase() === "h" && f) : !(f || c || a) && Ke(l);
|
|
951
|
+
}(t, o, i, s) ? Ke(t) ? w(e, Ks, n) : (n.preventDefault(), w(e, yt, !0)) : /* @__PURE__ */ function(l) {
|
|
973
952
|
return l === "Escape";
|
|
974
|
-
}(t) ? w(e,
|
|
975
|
-
return Y ? !(
|
|
976
|
-
}(t, s, r, o, i) ?
|
|
977
|
-
return Ke(l) && (Y ?
|
|
978
|
-
}(t, o, s) ? (n.preventDefault(), w(e, mt, !0)) : function(l,
|
|
979
|
-
return
|
|
980
|
-
}(t, o, s) ? (n.preventDefault(), w(e, mt, !1)) : function(l,
|
|
981
|
-
return Y &&
|
|
982
|
-
}(t, i) ? (n.preventDefault(), w(e, xt, !0)) : function(l,
|
|
983
|
-
return Y &&
|
|
984
|
-
}(t, i) ? (n.preventDefault(), w(e, xt, !1)) : function(l,
|
|
985
|
-
return l.toLowerCase() === "b" && !
|
|
986
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "bold")) : function(l,
|
|
987
|
-
return l.toLowerCase() === "u" && !
|
|
988
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "underline")) : function(l,
|
|
989
|
-
return l.toLowerCase() === "i" && !
|
|
990
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "italic")) : /* @__PURE__ */ function(l,
|
|
991
|
-
return l === "Tab" && !
|
|
992
|
-
}(t, o, s, i) ? w(e,
|
|
993
|
-
return l.toLowerCase() === "z" && !
|
|
994
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Br, void 0)) : function(l,
|
|
995
|
-
return Y ? l.toLowerCase() === "z" &&
|
|
996
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Rr, void 0)) : jt(e._editorState._selection) ? function(l,
|
|
997
|
-
return !
|
|
998
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Kr, n)) : function(l,
|
|
999
|
-
return !
|
|
1000
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e,
|
|
1001
|
-
return l ||
|
|
1002
|
-
}(s, r, o, i) && w(e,
|
|
953
|
+
}(t) ? w(e, Js, n) : function(l, c, a, f, h) {
|
|
954
|
+
return Y ? !(a || f || h) && (Je(l) || l.toLowerCase() === "d" && c) : !(c || f || h) && Je(l);
|
|
955
|
+
}(t, s, r, o, i) ? Je(t) ? w(e, $s, n) : (n.preventDefault(), w(e, yt, !1)) : function(l, c, a) {
|
|
956
|
+
return Ke(l) && (Y ? c : a);
|
|
957
|
+
}(t, o, s) ? (n.preventDefault(), w(e, mt, !0)) : function(l, c, a) {
|
|
958
|
+
return Je(l) && (Y ? c : a);
|
|
959
|
+
}(t, o, s) ? (n.preventDefault(), w(e, mt, !1)) : function(l, c) {
|
|
960
|
+
return Y && c && Ke(l);
|
|
961
|
+
}(t, i) ? (n.preventDefault(), w(e, xt, !0)) : function(l, c) {
|
|
962
|
+
return Y && c && Je(l);
|
|
963
|
+
}(t, i) ? (n.preventDefault(), w(e, xt, !1)) : function(l, c, a, f) {
|
|
964
|
+
return l.toLowerCase() === "b" && !c && Ve(a, f);
|
|
965
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "bold")) : function(l, c, a, f) {
|
|
966
|
+
return l.toLowerCase() === "u" && !c && Ve(a, f);
|
|
967
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "underline")) : function(l, c, a, f) {
|
|
968
|
+
return l.toLowerCase() === "i" && !c && Ve(a, f);
|
|
969
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "italic")) : /* @__PURE__ */ function(l, c, a, f) {
|
|
970
|
+
return l === "Tab" && !c && !a && !f;
|
|
971
|
+
}(t, o, s, i) ? w(e, Us, n) : function(l, c, a, f) {
|
|
972
|
+
return l.toLowerCase() === "z" && !c && Ve(a, f);
|
|
973
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Br, void 0)) : function(l, c, a, f) {
|
|
974
|
+
return Y ? l.toLowerCase() === "z" && a && c : l.toLowerCase() === "y" && f || l.toLowerCase() === "z" && f && c;
|
|
975
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Rr, void 0)) : jt(e._editorState._selection) ? function(l, c, a, f) {
|
|
976
|
+
return !c && l.toLowerCase() === "c" && (Y ? a : f);
|
|
977
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Kr, n)) : function(l, c, a, f) {
|
|
978
|
+
return !c && l.toLowerCase() === "x" && (Y ? a : f);
|
|
979
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Jr, n)) : ur(t, i, s) && (n.preventDefault(), w(e, Yn, n)) : !xe && ur(t, i, s) && (n.preventDefault(), w(e, Yn, n)), /* @__PURE__ */ function(l, c, a, f) {
|
|
980
|
+
return l || c || a || f;
|
|
981
|
+
}(s, r, o, i) && w(e, Zs, n));
|
|
1003
982
|
}], ["pointerdown", function(n, e) {
|
|
1004
983
|
const t = n.target, r = n.pointerType;
|
|
1005
984
|
t instanceof Node && r !== "touch" && X(e, () => {
|
|
@@ -1010,7 +989,7 @@ const oe = Object.freeze({}), xn = 30, vn = [["keydown", function(n, e) {
|
|
|
1010
989
|
const t = I();
|
|
1011
990
|
if (F(t) && !e.isComposing()) {
|
|
1012
991
|
const r = t.anchor, s = t.anchor.getNode();
|
|
1013
|
-
|
|
992
|
+
$(r.key), (n.timeStamp < Xe + xn || r.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || N(s) && s.getStyle() !== t.style) && w(e, He, ii);
|
|
1014
993
|
}
|
|
1015
994
|
});
|
|
1016
995
|
}], ["compositionend", function(n, e) {
|
|
@@ -1024,10 +1003,10 @@ const oe = Object.freeze({}), xn = 30, vn = [["keydown", function(n, e) {
|
|
|
1024
1003
|
Ue && (sn(e, r), Ue = !1);
|
|
1025
1004
|
const i = t.anchor.getNode(), o = se(e._window);
|
|
1026
1005
|
if (o === null) return;
|
|
1027
|
-
const l = t.isBackward(),
|
|
1028
|
-
vt && !t.isCollapsed() && N(i) && o.anchorNode !== null && i.getTextContent().slice(0,
|
|
1006
|
+
const l = t.isBackward(), c = l ? t.anchor.offset : t.focus.offset, a = l ? t.focus.offset : t.anchor.offset;
|
|
1007
|
+
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);
|
|
1029
1008
|
const f = r.length;
|
|
1030
|
-
xe && f > 1 && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= f), wn || It || Nn || !e.isComposing() || (Xe = 0,
|
|
1009
|
+
xe && f > 1 && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= f), wn || It || Nn || !e.isComposing() || (Xe = 0, $(null));
|
|
1031
1010
|
} else
|
|
1032
1011
|
zn(!1, e, r !== null ? r : void 0), Ue && (sn(e, r || void 0), Ue = !1);
|
|
1033
1012
|
q(), qr(M());
|
|
@@ -1047,7 +1026,7 @@ const oe = Object.freeze({}), xn = 30, vn = [["keydown", function(n, e) {
|
|
|
1047
1026
|
}
|
|
1048
1027
|
}
|
|
1049
1028
|
}
|
|
1050
|
-
w(e,
|
|
1029
|
+
w(e, Ls, n);
|
|
1051
1030
|
});
|
|
1052
1031
|
}], ["cut", oe], ["copy", oe], ["dragstart", oe], ["dragover", oe], ["dragend", oe], ["paste", oe], ["focus", oe], ["blur", oe], ["drop", oe]];
|
|
1053
1032
|
vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
@@ -1063,27 +1042,27 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1063
1042
|
if (F(o)) {
|
|
1064
1043
|
const d = o.anchor.key === o.focus.key;
|
|
1065
1044
|
if (l = t.timeStamp, hs === "MediaLast" && l < Xe + xn && r.isComposing() && d) {
|
|
1066
|
-
if (
|
|
1045
|
+
if ($(null), Xe = 0, setTimeout(() => {
|
|
1067
1046
|
X(r, () => {
|
|
1068
|
-
|
|
1047
|
+
$(null);
|
|
1069
1048
|
});
|
|
1070
1049
|
}, xn), F(o)) {
|
|
1071
1050
|
const g = o.anchor.getNode();
|
|
1072
1051
|
g.markDirty(), o.format = g.getFormat(), N(g) || k(142), o.style = g.getStyle();
|
|
1073
1052
|
}
|
|
1074
1053
|
} else {
|
|
1075
|
-
|
|
1054
|
+
$(null), t.preventDefault();
|
|
1076
1055
|
const g = o.anchor.getNode().getTextContent(), p = o.anchor.offset === 0 && o.focus.offset === g.length;
|
|
1077
|
-
|
|
1056
|
+
ei && d && !p || w(r, yt, !0);
|
|
1078
1057
|
}
|
|
1079
1058
|
return;
|
|
1080
1059
|
}
|
|
1081
1060
|
}
|
|
1082
1061
|
var l;
|
|
1083
1062
|
if (!F(o)) return;
|
|
1084
|
-
const
|
|
1063
|
+
const c = t.data;
|
|
1085
1064
|
Le !== null && zn(!1, r, Le), o.dirty && Le === null || !o.isCollapsed() || Z(o.anchor.getNode()) || i === null || o.applyDOMRange(i), Le = null;
|
|
1086
|
-
const
|
|
1065
|
+
const a = o.anchor, f = o.focus, h = a.getNode(), u = f.getNode();
|
|
1087
1066
|
if (s !== "insertText" && s !== "insertTranspose") switch (t.preventDefault(), s) {
|
|
1088
1067
|
case "insertFromYank":
|
|
1089
1068
|
case "insertFromDrop":
|
|
@@ -1091,13 +1070,13 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1091
1070
|
w(r, He, t);
|
|
1092
1071
|
break;
|
|
1093
1072
|
case "insertFromComposition":
|
|
1094
|
-
|
|
1073
|
+
$(null), w(r, He, t);
|
|
1095
1074
|
break;
|
|
1096
1075
|
case "insertLineBreak":
|
|
1097
|
-
|
|
1076
|
+
$(null), w(r, gt, !1);
|
|
1098
1077
|
break;
|
|
1099
1078
|
case "insertParagraph":
|
|
1100
|
-
|
|
1079
|
+
$(null), Ze && !It ? (Ze = !1, w(r, gt, !1)) : w(r, Zn, void 0);
|
|
1101
1080
|
break;
|
|
1102
1081
|
case "insertFromPaste":
|
|
1103
1082
|
case "insertFromPasteAsQuotation":
|
|
@@ -1149,13 +1128,13 @@ vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1149
1128
|
w(r, Rr, void 0);
|
|
1150
1129
|
}
|
|
1151
1130
|
else {
|
|
1152
|
-
if (
|
|
1131
|
+
if (c === `
|
|
1153
1132
|
`) t.preventDefault(), w(r, gt, !1);
|
|
1154
|
-
else if (
|
|
1155
|
-
else if (
|
|
1133
|
+
else if (c === ae) t.preventDefault(), w(r, Zn, void 0);
|
|
1134
|
+
else if (c == null && t.dataTransfer) {
|
|
1156
1135
|
const d = t.dataTransfer.getData("text/plain");
|
|
1157
1136
|
t.preventDefault(), o.insertRawText(d);
|
|
1158
|
-
} else
|
|
1137
|
+
} else c != null && ps(o, i, c, t.timeStamp, !0) ? (t.preventDefault(), w(r, He, c)) : Le = c;
|
|
1159
1138
|
gs = t.timeStamp;
|
|
1160
1139
|
}
|
|
1161
1140
|
});
|
|
@@ -1164,8 +1143,8 @@ let Xe = 0, hs = null, gs = 0, Le = null;
|
|
|
1164
1143
|
const Dt = /* @__PURE__ */ new WeakMap();
|
|
1165
1144
|
let Sn = !1, Tn = !1, Ze = !1, Ue = !1, _s = [0, "", 0, "root", 0];
|
|
1166
1145
|
function ps(n, e, t, r, s) {
|
|
1167
|
-
const i = n.anchor, o = n.focus, l = i.getNode(),
|
|
1168
|
-
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) && u !== null && !l.isComposing() && f !== kt(u) ||
|
|
1146
|
+
const i = n.anchor, o = n.focus, l = i.getNode(), c = M(), a = se(c._window), f = a !== null ? a.anchorNode : null, h = i.key, u = c.getElementByKey(h), d = t.length;
|
|
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) && u !== null && !l.isComposing() && f !== kt(u) || 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);
|
|
1169
1148
|
}
|
|
1170
1149
|
function pr(n, e) {
|
|
1171
1150
|
return n !== null && n.nodeValue !== null && n.nodeType === Te && e !== 0 && e !== n.nodeValue.length;
|
|
@@ -1177,19 +1156,19 @@ function yr(n, e, t) {
|
|
|
1177
1156
|
if (!Mt(e, r, i)) return;
|
|
1178
1157
|
const l = I();
|
|
1179
1158
|
if (F(l)) {
|
|
1180
|
-
const
|
|
1159
|
+
const c = l.anchor, a = c.getNode();
|
|
1181
1160
|
if (l.isCollapsed()) {
|
|
1182
1161
|
n.type === "Range" && n.anchorNode === n.focusNode && (l.dirty = !0);
|
|
1183
1162
|
const f = Kt(e).event, h = f ? f.timeStamp : performance.now(), [u, d, g, p, _] = _s, m = G(), y = e.isComposing() === !1 && m.getTextContent() === "";
|
|
1184
|
-
if (h < _ + 200 &&
|
|
1185
|
-
else if (
|
|
1186
|
-
else if (
|
|
1187
|
-
const x =
|
|
1163
|
+
if (h < _ + 200 && c.offset === g && c.key === p) l.format = u, l.style = d;
|
|
1164
|
+
else if (c.type === "text") N(a) || k(141), l.format = a.getFormat(), l.style = a.getStyle();
|
|
1165
|
+
else if (c.type === "element" && !y) {
|
|
1166
|
+
const x = c.getNode();
|
|
1188
1167
|
l.style = "", x instanceof ze && x.getChildrenSize() === 0 ? (l.format = x.getTextFormat(), l.style = x.getTextStyle()) : l.format = 0;
|
|
1189
1168
|
}
|
|
1190
1169
|
} else {
|
|
1191
|
-
const f =
|
|
1192
|
-
let x =
|
|
1170
|
+
const f = c.key, h = l.focus.key, u = l.getNodes(), d = u.length, g = l.isBackward(), p = g ? o : s, _ = g ? s : o, m = g ? h : f, y = g ? f : h;
|
|
1171
|
+
let x = si, C = !1;
|
|
1193
1172
|
for (let b = 0; b < d; b++) {
|
|
1194
1173
|
const v = u[b], P = v.getTextContentSize();
|
|
1195
1174
|
if (N(v) && P !== 0 && !(b === 0 && v.__key === m && p === P || b === d - 1 && v.__key === y && _ === 0) && (C = !0, x &= v.getFormat(), x === 0)) break;
|
|
@@ -1207,7 +1186,7 @@ function ys(n) {
|
|
|
1207
1186
|
}
|
|
1208
1187
|
function sn(n, e) {
|
|
1209
1188
|
const t = n._compositionKey;
|
|
1210
|
-
if (
|
|
1189
|
+
if ($(null), t !== null && e != null) {
|
|
1211
1190
|
if (e === "") {
|
|
1212
1191
|
const r = V(t), s = kt(n.getElementByKey(t));
|
|
1213
1192
|
return void (s !== null && s.nodeValue !== null && N(r) && Bn(r, s.nodeValue, null, null, !0));
|
|
@@ -1234,13 +1213,13 @@ function xs(n) {
|
|
|
1234
1213
|
const r = Zr(t.anchorNode);
|
|
1235
1214
|
if (r === null) return;
|
|
1236
1215
|
Tn && (Tn = !1, X(r, () => {
|
|
1237
|
-
const
|
|
1216
|
+
const a = ot(), f = t.anchorNode;
|
|
1238
1217
|
if (f === null) return;
|
|
1239
1218
|
const h = f.nodeType;
|
|
1240
|
-
h !== rt && h !== Te || ue(Ht(
|
|
1219
|
+
h !== rt && h !== Te || ue(Ht(a, t, r, n));
|
|
1241
1220
|
}));
|
|
1242
|
-
const s = Wn(r), i = s[s.length - 1], o = i._key, l = Ie.get(o),
|
|
1243
|
-
|
|
1221
|
+
const s = Wn(r), i = s[s.length - 1], o = i._key, l = Ie.get(o), c = l || i;
|
|
1222
|
+
c !== r && yr(t, c, !1), yr(t, r, !0), r !== i ? Ie.set(o, r) : l && Ie.delete(o);
|
|
1244
1223
|
}
|
|
1245
1224
|
function mr(n) {
|
|
1246
1225
|
n._lexicalHandled = !0;
|
|
@@ -1248,7 +1227,7 @@ function mr(n) {
|
|
|
1248
1227
|
function xr(n) {
|
|
1249
1228
|
return n._lexicalHandled === !0;
|
|
1250
1229
|
}
|
|
1251
|
-
function
|
|
1230
|
+
function Li(n) {
|
|
1252
1231
|
const e = n.ownerDocument, t = Dt.get(e);
|
|
1253
1232
|
t === void 0 && k(162);
|
|
1254
1233
|
const r = t - 1;
|
|
@@ -1256,8 +1235,8 @@ function Wi(n) {
|
|
|
1256
1235
|
const s = Wt(n);
|
|
1257
1236
|
Mn(s) ? (function(o) {
|
|
1258
1237
|
if (o._parentEditor !== null) {
|
|
1259
|
-
const l = Wn(o),
|
|
1260
|
-
Ie.get(
|
|
1238
|
+
const l = Wn(o), c = l[l.length - 1]._key;
|
|
1239
|
+
Ie.get(c) === o && Ie.delete(c);
|
|
1261
1240
|
} else Ie.delete(o._key);
|
|
1262
1241
|
}(s), n.__lexicalEditor = null) : s && k(198);
|
|
1263
1242
|
const i = ms(n);
|
|
@@ -1269,15 +1248,15 @@ function Cn(n, e, t) {
|
|
|
1269
1248
|
const r = n.__key, s = n.getParent();
|
|
1270
1249
|
if (s === null) return;
|
|
1271
1250
|
const i = function(l) {
|
|
1272
|
-
const
|
|
1273
|
-
if (!F(
|
|
1274
|
-
const { anchor:
|
|
1275
|
-
return Qe(h, l) &&
|
|
1251
|
+
const c = I();
|
|
1252
|
+
if (!F(c) || !S(l)) return c;
|
|
1253
|
+
const { anchor: a, focus: f } = c, h = a.getNode(), u = f.getNode();
|
|
1254
|
+
return Qe(h, l) && a.set(l.__key, 0, "element"), Qe(u, l) && f.set(l.__key, 0, "element"), c;
|
|
1276
1255
|
}(n);
|
|
1277
1256
|
let o = !1;
|
|
1278
1257
|
if (F(i) && e) {
|
|
1279
|
-
const l = i.anchor,
|
|
1280
|
-
l.key === r && (Ot(l, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0),
|
|
1258
|
+
const l = i.anchor, c = i.focus;
|
|
1259
|
+
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);
|
|
1281
1260
|
} else jt(i) && e && n.isSelected() && n.selectPrevious();
|
|
1282
1261
|
if (F(i) && e && !o) {
|
|
1283
1262
|
const l = n.getIndexWithinParent();
|
|
@@ -1403,8 +1382,8 @@ class Ut {
|
|
|
1403
1382
|
if (s === 0 || i === 0 || t[s - 1] !== r[i - 1]) return null;
|
|
1404
1383
|
const o = new Set(r);
|
|
1405
1384
|
for (let l = 0; l < s; l++) {
|
|
1406
|
-
const
|
|
1407
|
-
if (o.has(
|
|
1385
|
+
const c = t[l];
|
|
1386
|
+
if (o.has(c)) return c;
|
|
1408
1387
|
}
|
|
1409
1388
|
return null;
|
|
1410
1389
|
}
|
|
@@ -1456,14 +1435,14 @@ class Ut {
|
|
|
1456
1435
|
i = l;
|
|
1457
1436
|
continue;
|
|
1458
1437
|
}
|
|
1459
|
-
const
|
|
1460
|
-
if (
|
|
1461
|
-
i =
|
|
1438
|
+
const c = t ? i.getNextSibling() : i.getPreviousSibling();
|
|
1439
|
+
if (c !== null) {
|
|
1440
|
+
i = c;
|
|
1462
1441
|
continue;
|
|
1463
1442
|
}
|
|
1464
|
-
const
|
|
1465
|
-
if (s.has(
|
|
1466
|
-
let f = null, h =
|
|
1443
|
+
const a = i.getParentOrThrow();
|
|
1444
|
+
if (s.has(a.__key) || r.push(a), a === e) break;
|
|
1445
|
+
let f = null, h = a;
|
|
1467
1446
|
do {
|
|
1468
1447
|
if (h === null && k(68), f = t ? h.getNextSibling() : h.getPreviousSibling(), h = h.getParent(), h === null) break;
|
|
1469
1448
|
f !== null || s.has(h.__key) || r.push(h);
|
|
@@ -1484,8 +1463,8 @@ class Ut {
|
|
|
1484
1463
|
q();
|
|
1485
1464
|
const e = fe(), t = M(), r = e._nodeMap, s = this.__key, i = this.getLatest(), o = t._cloneNotNeeded, l = I();
|
|
1486
1465
|
if (l !== null && l.setCachedNodes(null), o.has(s)) return wt(i), i;
|
|
1487
|
-
const
|
|
1488
|
-
return o.add(s), wt(
|
|
1466
|
+
const c = Ei(i);
|
|
1467
|
+
return o.add(s), wt(c), r.set(s, c), c;
|
|
1489
1468
|
}
|
|
1490
1469
|
getTextContent() {
|
|
1491
1470
|
return "";
|
|
@@ -1518,35 +1497,35 @@ class Ut {
|
|
|
1518
1497
|
q();
|
|
1519
1498
|
let r = I();
|
|
1520
1499
|
r !== null && (r = r.clone()), tn(this, e);
|
|
1521
|
-
const s = this.getLatest(), i = this.__key, o = e.__key, l = e.getWritable(),
|
|
1500
|
+
const s = this.getLatest(), i = this.__key, o = e.__key, l = e.getWritable(), c = this.getParentOrThrow().getWritable(), a = c.__size;
|
|
1522
1501
|
Ne(l);
|
|
1523
1502
|
const f = s.getPreviousSibling(), h = s.getNextSibling(), u = s.__prev, d = s.__next, g = s.__parent;
|
|
1524
|
-
if (Cn(s, !1, !0), f === null ?
|
|
1503
|
+
if (Cn(s, !1, !0), f === null ? c.__first = o : f.getWritable().__next = o, l.__prev = u, h === null ? c.__last = o : h.getWritable().__prev = o, l.__next = d, l.__parent = g, c.__size = a, t && (S(this) && S(l) || k(139), this.getChildren().forEach((p) => {
|
|
1525
1504
|
l.append(p);
|
|
1526
1505
|
})), F(r)) {
|
|
1527
1506
|
ue(r);
|
|
1528
1507
|
const p = r.anchor, _ = r.focus;
|
|
1529
1508
|
p.key === i && Cr(p, l), _.key === i && Cr(_, l);
|
|
1530
1509
|
}
|
|
1531
|
-
return ye() === i &&
|
|
1510
|
+
return ye() === i && $(o), l;
|
|
1532
1511
|
}
|
|
1533
1512
|
insertAfter(e, t = !0) {
|
|
1534
1513
|
q(), tn(this, e);
|
|
1535
1514
|
const r = this.getWritable(), s = e.getWritable(), i = s.getParent(), o = I();
|
|
1536
|
-
let l = !1,
|
|
1515
|
+
let l = !1, c = !1;
|
|
1537
1516
|
if (i !== null) {
|
|
1538
1517
|
const d = e.getIndexWithinParent();
|
|
1539
1518
|
if (Ne(s), F(o)) {
|
|
1540
1519
|
const g = i.__key, p = o.anchor, _ = o.focus;
|
|
1541
|
-
l = p.type === "element" && p.key === g && p.offset === d + 1,
|
|
1520
|
+
l = p.type === "element" && p.key === g && p.offset === d + 1, c = _.type === "element" && _.key === g && _.offset === d + 1;
|
|
1542
1521
|
}
|
|
1543
1522
|
}
|
|
1544
|
-
const
|
|
1545
|
-
if (
|
|
1523
|
+
const a = this.getNextSibling(), f = this.getParentOrThrow().getWritable(), h = s.__key, u = r.__next;
|
|
1524
|
+
if (a === null ? f.__last = h : a.getWritable().__prev = h, f.__size++, r.__next = h, s.__next = u, s.__prev = r.__key, s.__parent = r.__parent, t && F(o)) {
|
|
1546
1525
|
const d = this.getIndexWithinParent();
|
|
1547
1526
|
Lt(o, f, d + 1);
|
|
1548
1527
|
const g = f.__key;
|
|
1549
|
-
l && o.anchor.set(g, d + 2, "element"),
|
|
1528
|
+
l && o.anchor.set(g, d + 2, "element"), c && o.focus.set(g, d + 2, "element");
|
|
1550
1529
|
}
|
|
1551
1530
|
return e;
|
|
1552
1531
|
}
|
|
@@ -1554,10 +1533,10 @@ class Ut {
|
|
|
1554
1533
|
q(), tn(this, e);
|
|
1555
1534
|
const r = this.getWritable(), s = e.getWritable(), i = s.__key;
|
|
1556
1535
|
Ne(s);
|
|
1557
|
-
const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(),
|
|
1558
|
-
o === null ? l.__first = i : o.getWritable().__next = i, l.__size++, r.__prev = i, s.__prev =
|
|
1536
|
+
const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), c = r.__prev, a = this.getIndexWithinParent();
|
|
1537
|
+
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;
|
|
1559
1538
|
const f = I();
|
|
1560
|
-
return t && F(f) && Lt(f, this.getParentOrThrow(),
|
|
1539
|
+
return t && F(f) && Lt(f, this.getParentOrThrow(), a), e;
|
|
1561
1540
|
}
|
|
1562
1541
|
isParentRequired() {
|
|
1563
1542
|
return !1;
|
|
@@ -1637,7 +1616,7 @@ class st extends Ut {
|
|
|
1637
1616
|
if (i === t || i.previousSibling === t && dt(i)) return !0;
|
|
1638
1617
|
}
|
|
1639
1618
|
return !1;
|
|
1640
|
-
}(e) ? null : { conversion:
|
|
1619
|
+
}(e) ? null : { conversion: Oi, priority: 0 } };
|
|
1641
1620
|
}
|
|
1642
1621
|
static importJSON(e) {
|
|
1643
1622
|
return nt();
|
|
@@ -1646,11 +1625,11 @@ class st extends Ut {
|
|
|
1646
1625
|
return { type: "linebreak", version: 1 };
|
|
1647
1626
|
}
|
|
1648
1627
|
}
|
|
1649
|
-
function
|
|
1628
|
+
function Oi(n) {
|
|
1650
1629
|
return { node: nt() };
|
|
1651
1630
|
}
|
|
1652
1631
|
function nt() {
|
|
1653
|
-
return
|
|
1632
|
+
return Jt(new st());
|
|
1654
1633
|
}
|
|
1655
1634
|
function Ae(n) {
|
|
1656
1635
|
return n instanceof st;
|
|
@@ -1669,16 +1648,16 @@ function vs(n, e, t, r, s) {
|
|
|
1669
1648
|
let o = qe(s, "base");
|
|
1670
1649
|
o !== void 0 && i.add(...o), o = qe(s, "underlineStrikethrough");
|
|
1671
1650
|
let l = !1;
|
|
1672
|
-
const
|
|
1673
|
-
o !== void 0 && (t & Tt && t & St ? (l = !0,
|
|
1674
|
-
for (const
|
|
1675
|
-
const f =
|
|
1676
|
-
if (o = qe(s,
|
|
1677
|
-
if (l && (
|
|
1651
|
+
const c = e & Tt && e & St;
|
|
1652
|
+
o !== void 0 && (t & Tt && t & St ? (l = !0, c || i.add(...o)) : c && i.remove(...o));
|
|
1653
|
+
for (const a in ce) {
|
|
1654
|
+
const f = ce[a];
|
|
1655
|
+
if (o = qe(s, a), o !== void 0) if (t & f) {
|
|
1656
|
+
if (l && (a === "underline" || a === "strikethrough")) {
|
|
1678
1657
|
e & f && i.remove(...o);
|
|
1679
1658
|
continue;
|
|
1680
1659
|
}
|
|
1681
|
-
e & f && (!
|
|
1660
|
+
e & f && (!c || a !== "underline") && a !== "strikethrough" || i.add(...o);
|
|
1682
1661
|
} else e & f && i.remove(...o);
|
|
1683
1662
|
}
|
|
1684
1663
|
}
|
|
@@ -1688,14 +1667,14 @@ function Ss(n, e, t) {
|
|
|
1688
1667
|
else {
|
|
1689
1668
|
const o = r.nodeValue;
|
|
1690
1669
|
if (o !== i) if (s || xe) {
|
|
1691
|
-
const [l,
|
|
1670
|
+
const [l, c, a] = function(f, h) {
|
|
1692
1671
|
const u = f.length, d = h.length;
|
|
1693
1672
|
let g = 0, p = 0;
|
|
1694
1673
|
for (; g < u && g < d && f[g] === h[g]; ) g++;
|
|
1695
1674
|
for (; p + g < u && p + g < d && f[u - p - 1] === h[d - p - 1]; ) p++;
|
|
1696
1675
|
return [g, u - g - p, h.slice(g, d - p)];
|
|
1697
1676
|
}(o, i);
|
|
1698
|
-
|
|
1677
|
+
c !== 0 && r.deleteData(l, c), r.insertData(l, a);
|
|
1699
1678
|
} else r.nodeValue = i;
|
|
1700
1679
|
}
|
|
1701
1680
|
}
|
|
@@ -1729,7 +1708,7 @@ class We extends Ut {
|
|
|
1729
1708
|
}
|
|
1730
1709
|
getMode() {
|
|
1731
1710
|
const e = this.getLatest();
|
|
1732
|
-
return
|
|
1711
|
+
return fi[e.__mode];
|
|
1733
1712
|
}
|
|
1734
1713
|
getStyle() {
|
|
1735
1714
|
return this.getLatest().__style;
|
|
@@ -1750,7 +1729,7 @@ class We extends Ut {
|
|
|
1750
1729
|
return !!(2 & this.getLatest().__detail);
|
|
1751
1730
|
}
|
|
1752
1731
|
hasFormat(e) {
|
|
1753
|
-
const t =
|
|
1732
|
+
const t = ce[e];
|
|
1754
1733
|
return !!(this.getFormat() & t);
|
|
1755
1734
|
}
|
|
1756
1735
|
isSimpleText() {
|
|
@@ -1767,37 +1746,37 @@ class We extends Ut {
|
|
|
1767
1746
|
}
|
|
1768
1747
|
createDOM(e, t) {
|
|
1769
1748
|
const r = this.__format, s = on(0, r), i = ln(0, r), o = s === null ? i : s, l = document.createElement(o);
|
|
1770
|
-
let
|
|
1771
|
-
this.hasFormat("code") && l.setAttribute("spellcheck", "false"), s !== null && (
|
|
1772
|
-
const
|
|
1773
|
-
return
|
|
1749
|
+
let c = l;
|
|
1750
|
+
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
|
+
const a = this.__style;
|
|
1752
|
+
return a !== "" && (l.style.cssText = a), l;
|
|
1774
1753
|
}
|
|
1775
1754
|
updateDOM(e, t, r) {
|
|
1776
|
-
const s = this.__text, i = e.__format, o = this.__format, l = on(0, i),
|
|
1777
|
-
if ((l === null ?
|
|
1778
|
-
if (l ===
|
|
1755
|
+
const s = this.__text, i = e.__format, o = this.__format, l = on(0, i), c = on(0, o), a = ln(0, i), f = ln(0, o);
|
|
1756
|
+
if ((l === null ? a : l) !== (c === null ? f : c)) return !0;
|
|
1757
|
+
if (l === c && a !== f) {
|
|
1779
1758
|
const p = t.firstChild;
|
|
1780
1759
|
p == null && k(48);
|
|
1781
1760
|
const _ = document.createElement(f);
|
|
1782
1761
|
return vr(_, this, 0, o, s, r), t.replaceChild(_, p), !1;
|
|
1783
1762
|
}
|
|
1784
1763
|
let h = t;
|
|
1785
|
-
|
|
1764
|
+
c !== null && l !== null && (h = t.firstChild, h == null && k(49)), Ss(s, h, this);
|
|
1786
1765
|
const u = r.theme.text;
|
|
1787
1766
|
u !== void 0 && i !== o && vs(0, i, o, h, u);
|
|
1788
1767
|
const d = e.__style, g = this.__style;
|
|
1789
1768
|
return d !== g && (t.style.cssText = g), !1;
|
|
1790
1769
|
}
|
|
1791
1770
|
static importDOM() {
|
|
1792
|
-
return { "#text": () => ({ conversion:
|
|
1771
|
+
return { "#text": () => ({ conversion: Wi, priority: 0 }), b: () => ({ conversion: Ai, priority: 0 }), code: () => ({ conversion: ge, priority: 0 }), em: () => ({ conversion: ge, priority: 0 }), i: () => ({ conversion: ge, priority: 0 }), s: () => ({ conversion: ge, priority: 0 }), span: () => ({ conversion: Ii, priority: 0 }), strong: () => ({ conversion: ge, priority: 0 }), sub: () => ({ conversion: ge, priority: 0 }), sup: () => ({ conversion: ge, priority: 0 }), u: () => ({ conversion: ge, priority: 0 }) };
|
|
1793
1772
|
}
|
|
1794
1773
|
static importJSON(e) {
|
|
1795
|
-
const t =
|
|
1774
|
+
const t = J(e.text);
|
|
1796
1775
|
return t.setFormat(e.format), t.setDetail(e.detail), t.setMode(e.mode), t.setStyle(e.style), t;
|
|
1797
1776
|
}
|
|
1798
1777
|
exportDOM(e) {
|
|
1799
1778
|
let { element: t } = super.exportDOM(e);
|
|
1800
|
-
return t !== null &&
|
|
1779
|
+
return t !== null && Jn(t) || k(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 };
|
|
1801
1780
|
}
|
|
1802
1781
|
exportJSON() {
|
|
1803
1782
|
return { detail: this.getDetail(), format: this.getFormat(), mode: this.getMode(), style: this.getStyle(), text: this.getTextContent(), type: "text", version: 1 };
|
|
@@ -1806,11 +1785,11 @@ class We extends Ut {
|
|
|
1806
1785
|
}
|
|
1807
1786
|
setFormat(e) {
|
|
1808
1787
|
const t = this.getWritable();
|
|
1809
|
-
return t.__format = typeof e == "string" ?
|
|
1788
|
+
return t.__format = typeof e == "string" ? ce[e] : e, t;
|
|
1810
1789
|
}
|
|
1811
1790
|
setDetail(e) {
|
|
1812
1791
|
const t = this.getWritable();
|
|
1813
|
-
return t.__detail = typeof e == "string" ?
|
|
1792
|
+
return t.__detail = typeof e == "string" ? ci[e] : e, t;
|
|
1814
1793
|
}
|
|
1815
1794
|
setStyle(e) {
|
|
1816
1795
|
const t = this.getWritable();
|
|
@@ -1829,7 +1808,7 @@ class We extends Ut {
|
|
|
1829
1808
|
return e.__detail ^= 2, e;
|
|
1830
1809
|
}
|
|
1831
1810
|
setMode(e) {
|
|
1832
|
-
const t =
|
|
1811
|
+
const t = ui[e];
|
|
1833
1812
|
if (this.__mode === t) return this;
|
|
1834
1813
|
const r = this.getWritable();
|
|
1835
1814
|
return r.__mode = t, r;
|
|
@@ -1844,13 +1823,13 @@ class We extends Ut {
|
|
|
1844
1823
|
let r = e, s = t;
|
|
1845
1824
|
const i = I(), o = this.getTextContent(), l = this.__key;
|
|
1846
1825
|
if (typeof o == "string") {
|
|
1847
|
-
const
|
|
1848
|
-
r === void 0 && (r =
|
|
1826
|
+
const c = o.length;
|
|
1827
|
+
r === void 0 && (r = c), s === void 0 && (s = c);
|
|
1849
1828
|
} else r = 0, s = 0;
|
|
1850
1829
|
if (!F(i)) return ks(l, r, l, s, "text", "text");
|
|
1851
1830
|
{
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1831
|
+
const c = ye();
|
|
1832
|
+
c !== i.anchor.key && c !== i.focus.key || $(l), i.setTextNodeRange(this, r, this, s);
|
|
1854
1833
|
}
|
|
1855
1834
|
return i;
|
|
1856
1835
|
}
|
|
@@ -1863,14 +1842,14 @@ class We extends Ut {
|
|
|
1863
1842
|
}
|
|
1864
1843
|
spliceText(e, t, r, s) {
|
|
1865
1844
|
const i = this.getWritable(), o = i.__text, l = r.length;
|
|
1866
|
-
let
|
|
1867
|
-
|
|
1868
|
-
const
|
|
1869
|
-
if (s && F(
|
|
1845
|
+
let c = e;
|
|
1846
|
+
c < 0 && (c = l + c, c < 0 && (c = 0));
|
|
1847
|
+
const a = I();
|
|
1848
|
+
if (s && F(a)) {
|
|
1870
1849
|
const h = e + l;
|
|
1871
|
-
|
|
1850
|
+
a.setTextNodeRange(i, h, i, h);
|
|
1872
1851
|
}
|
|
1873
|
-
const f = o.slice(0,
|
|
1852
|
+
const f = o.slice(0, c) + r + o.slice(c + t);
|
|
1874
1853
|
return i.__text = f, i;
|
|
1875
1854
|
}
|
|
1876
1855
|
canInsertTextBefore() {
|
|
@@ -1881,10 +1860,10 @@ class We extends Ut {
|
|
|
1881
1860
|
}
|
|
1882
1861
|
splitText(...e) {
|
|
1883
1862
|
q();
|
|
1884
|
-
const t = this.getLatest(), r = t.getTextContent(), s = t.__key, i = ye(), o = new Set(e), l = [],
|
|
1885
|
-
let
|
|
1886
|
-
for (let b = 0; b <
|
|
1887
|
-
|
|
1863
|
+
const t = this.getLatest(), r = t.getTextContent(), s = t.__key, i = ye(), o = new Set(e), l = [], c = r.length;
|
|
1864
|
+
let a = "";
|
|
1865
|
+
for (let b = 0; b < c; b++) a !== "" && o.has(b) && (l.push(a), a = ""), a += r[b];
|
|
1866
|
+
a !== "" && l.push(a);
|
|
1888
1867
|
const f = l.length;
|
|
1889
1868
|
if (f === 0) return [];
|
|
1890
1869
|
if (l[0] === r) return [t];
|
|
@@ -1892,18 +1871,18 @@ class We extends Ut {
|
|
|
1892
1871
|
let d;
|
|
1893
1872
|
const g = t.getFormat(), p = t.getStyle(), _ = t.__detail;
|
|
1894
1873
|
let m = !1;
|
|
1895
|
-
t.isSegmented() ? (d =
|
|
1874
|
+
t.isSegmented() ? (d = J(h), d.__format = g, d.__style = p, d.__detail = _, m = !0) : (d = t.getWritable(), d.__text = h);
|
|
1896
1875
|
const y = I(), x = [d];
|
|
1897
1876
|
let C = h.length;
|
|
1898
1877
|
for (let b = 1; b < f; b++) {
|
|
1899
|
-
const v = l[b], P = v.length, T =
|
|
1878
|
+
const v = l[b], P = v.length, T = J(v).getWritable();
|
|
1900
1879
|
T.__format = g, T.__style = p, T.__detail = _;
|
|
1901
1880
|
const E = T.__key, D = C + P;
|
|
1902
1881
|
if (F(y)) {
|
|
1903
1882
|
const O = y.anchor, W = y.focus;
|
|
1904
1883
|
O.key === s && O.type === "text" && O.offset > C && O.offset <= D && (O.key = E, O.offset -= C, y.dirty = !0), W.key === s && W.type === "text" && W.offset > C && W.offset <= D && (W.key = E, W.offset -= C, y.dirty = !0);
|
|
1905
1884
|
}
|
|
1906
|
-
i === s &&
|
|
1885
|
+
i === s && $(E), C = D, x.push(T);
|
|
1907
1886
|
}
|
|
1908
1887
|
if (u !== null) {
|
|
1909
1888
|
(function(P) {
|
|
@@ -1919,14 +1898,14 @@ class We extends Ut {
|
|
|
1919
1898
|
const t = e === this.getPreviousSibling();
|
|
1920
1899
|
t || e === this.getNextSibling() || k(50);
|
|
1921
1900
|
const r = this.__key, s = e.__key, i = this.__text, o = i.length;
|
|
1922
|
-
ye() === s &&
|
|
1901
|
+
ye() === s && $(r);
|
|
1923
1902
|
const l = I();
|
|
1924
1903
|
if (F(l)) {
|
|
1925
1904
|
const h = l.anchor, u = l.focus;
|
|
1926
1905
|
h !== null && h.key === s && (Dr(h, t, r, e, o), l.dirty = !0), u !== null && u.key === s && (Dr(u, t, r, e, o), l.dirty = !0);
|
|
1927
1906
|
}
|
|
1928
|
-
const
|
|
1929
|
-
this.setTextContent(
|
|
1907
|
+
const c = e.__text, a = t ? c + i : i + c;
|
|
1908
|
+
this.setTextContent(a);
|
|
1930
1909
|
const f = this.getWritable();
|
|
1931
1910
|
return e.remove(), f;
|
|
1932
1911
|
}
|
|
@@ -1934,27 +1913,27 @@ class We extends Ut {
|
|
|
1934
1913
|
return !1;
|
|
1935
1914
|
}
|
|
1936
1915
|
}
|
|
1937
|
-
function
|
|
1938
|
-
return { forChild:
|
|
1916
|
+
function Ii(n) {
|
|
1917
|
+
return { forChild: $n(n.style), node: null };
|
|
1939
1918
|
}
|
|
1940
|
-
function
|
|
1919
|
+
function Ai(n) {
|
|
1941
1920
|
const e = n, t = e.style.fontWeight === "normal";
|
|
1942
|
-
return { forChild:
|
|
1921
|
+
return { forChild: $n(e.style, t ? void 0 : "bold"), node: null };
|
|
1943
1922
|
}
|
|
1944
1923
|
const Sr = /* @__PURE__ */ new WeakMap();
|
|
1945
|
-
function
|
|
1924
|
+
function Mi(n) {
|
|
1946
1925
|
return n.nodeName === "PRE" || n.nodeType === rt && n.style !== void 0 && n.style.whiteSpace !== void 0 && n.style.whiteSpace.startsWith("pre");
|
|
1947
1926
|
}
|
|
1948
|
-
function
|
|
1927
|
+
function Wi(n) {
|
|
1949
1928
|
const e = n;
|
|
1950
1929
|
n.parentElement === null && k(129);
|
|
1951
1930
|
let t = e.textContent || "";
|
|
1952
1931
|
if (function(r) {
|
|
1953
1932
|
let s, i = r.parentNode;
|
|
1954
1933
|
const o = [r];
|
|
1955
|
-
for (; i !== null && (s = Sr.get(i)) === void 0 && !
|
|
1934
|
+
for (; i !== null && (s = Sr.get(i)) === void 0 && !Mi(i); ) o.push(i), i = i.parentNode;
|
|
1956
1935
|
const l = s === void 0 ? i : s;
|
|
1957
|
-
for (let
|
|
1936
|
+
for (let c = 0; c < o.length; c++) Sr.set(o[c], l);
|
|
1958
1937
|
return l;
|
|
1959
1938
|
}(e) !== null) {
|
|
1960
1939
|
const r = t.split(/(\r?\n|\t)/), s = [], i = r.length;
|
|
@@ -1962,7 +1941,7 @@ function $i(n) {
|
|
|
1962
1941
|
const l = r[o];
|
|
1963
1942
|
l === `
|
|
1964
1943
|
` || l === `\r
|
|
1965
|
-
` ? s.push(nt()) : l === " " ? s.push(Un()) : l !== "" && s.push(
|
|
1944
|
+
` ? s.push(nt()) : l === " " ? s.push(Un()) : l !== "" && s.push(J(l));
|
|
1966
1945
|
}
|
|
1967
1946
|
return { node: s };
|
|
1968
1947
|
}
|
|
@@ -1987,7 +1966,7 @@ function $i(n) {
|
|
|
1987
1966
|
}
|
|
1988
1967
|
s && (t = t.slice(0, t.length - 1));
|
|
1989
1968
|
}
|
|
1990
|
-
return t === "" ? { node: null } : { node:
|
|
1969
|
+
return t === "" ? { node: null } : { node: J(t) };
|
|
1991
1970
|
}
|
|
1992
1971
|
function Tr(n, e) {
|
|
1993
1972
|
let t = n;
|
|
@@ -2000,7 +1979,7 @@ function Tr(n, e) {
|
|
|
2000
1979
|
}
|
|
2001
1980
|
if (t = r, t.nodeType === rt) {
|
|
2002
1981
|
const i = t.style.display;
|
|
2003
|
-
if (i === "" && !
|
|
1982
|
+
if (i === "" && !bi(t) || i !== "" && !i.startsWith("inline")) return null;
|
|
2004
1983
|
}
|
|
2005
1984
|
let s = t;
|
|
2006
1985
|
for (; (s = e ? t.firstChild : t.lastChild) !== null; ) t = s;
|
|
@@ -2008,20 +1987,20 @@ function Tr(n, e) {
|
|
|
2008
1987
|
if (t.nodeName === "BR") return null;
|
|
2009
1988
|
}
|
|
2010
1989
|
}
|
|
2011
|
-
const
|
|
1990
|
+
const zi = { code: "code", em: "italic", i: "italic", s: "strikethrough", strong: "bold", sub: "subscript", sup: "superscript", u: "underline" };
|
|
2012
1991
|
function ge(n) {
|
|
2013
|
-
const e =
|
|
2014
|
-
return e === void 0 ? { node: null } : { forChild:
|
|
1992
|
+
const e = zi[n.nodeName.toLowerCase()];
|
|
1993
|
+
return e === void 0 ? { node: null } : { forChild: $n(n.style, e), node: null };
|
|
2015
1994
|
}
|
|
2016
|
-
function
|
|
2017
|
-
return
|
|
1995
|
+
function J(n = "") {
|
|
1996
|
+
return Jt(new We(n));
|
|
2018
1997
|
}
|
|
2019
1998
|
function N(n) {
|
|
2020
1999
|
return n instanceof We;
|
|
2021
2000
|
}
|
|
2022
|
-
function
|
|
2023
|
-
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"),
|
|
2024
|
-
return (
|
|
2001
|
+
function $n(n, e) {
|
|
2002
|
+
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
|
+
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);
|
|
2025
2004
|
}
|
|
2026
2005
|
class it extends We {
|
|
2027
2006
|
static getType() {
|
|
@@ -2063,12 +2042,12 @@ class it extends We {
|
|
|
2063
2042
|
}
|
|
2064
2043
|
}
|
|
2065
2044
|
function Un() {
|
|
2066
|
-
return
|
|
2045
|
+
return Jt(new it());
|
|
2067
2046
|
}
|
|
2068
|
-
function
|
|
2047
|
+
function Bi(n) {
|
|
2069
2048
|
return n instanceof it;
|
|
2070
2049
|
}
|
|
2071
|
-
class
|
|
2050
|
+
class Ri {
|
|
2072
2051
|
constructor(e, t, r) {
|
|
2073
2052
|
this._selection = null, this.key = e, this.offset = t, this.type = r;
|
|
2074
2053
|
}
|
|
@@ -2094,13 +2073,13 @@ class Vi {
|
|
|
2094
2073
|
}
|
|
2095
2074
|
set(e, t, r) {
|
|
2096
2075
|
const s = this._selection, i = this.key;
|
|
2097
|
-
this.key = e, this.offset = t, this.type = r, lt() || (ye() === i &&
|
|
2076
|
+
this.key = e, this.offset = t, this.type = r, lt() || (ye() === i && $(e), s !== null && (s.setCachedNodes(null), s.dirty = !0));
|
|
2098
2077
|
}
|
|
2099
2078
|
}
|
|
2100
2079
|
function ie(n, e, t) {
|
|
2101
|
-
return new
|
|
2080
|
+
return new Ri(n, e, t);
|
|
2102
2081
|
}
|
|
2103
|
-
function
|
|
2082
|
+
function cn(n, e) {
|
|
2104
2083
|
let t = e.__key, r = n.offset, s = "element";
|
|
2105
2084
|
if (N(e)) {
|
|
2106
2085
|
s = "text";
|
|
@@ -2119,8 +2098,8 @@ function an(n, e) {
|
|
|
2119
2098
|
function Cr(n, e) {
|
|
2120
2099
|
if (S(e)) {
|
|
2121
2100
|
const t = e.getLastDescendant();
|
|
2122
|
-
S(t) || N(t) ?
|
|
2123
|
-
} else
|
|
2101
|
+
S(t) || N(t) ? cn(n, t) : cn(n, e);
|
|
2102
|
+
} else cn(n, e);
|
|
2124
2103
|
}
|
|
2125
2104
|
function pe(n, e, t, r) {
|
|
2126
2105
|
n.key = e, n.offset = t, n.type = r;
|
|
@@ -2222,18 +2201,18 @@ class Ce {
|
|
|
2222
2201
|
const e = this._cachedNodes;
|
|
2223
2202
|
if (e !== null) return e;
|
|
2224
2203
|
const t = this.anchor, r = this.focus, s = t.isBefore(r), i = s ? t : r, o = s ? r : t;
|
|
2225
|
-
let l = i.getNode(),
|
|
2226
|
-
const
|
|
2204
|
+
let l = i.getNode(), c = o.getNode();
|
|
2205
|
+
const a = i.offset, f = o.offset;
|
|
2227
2206
|
if (S(l)) {
|
|
2228
|
-
const u = l.getDescendantByIndex(
|
|
2207
|
+
const u = l.getDescendantByIndex(a);
|
|
2229
2208
|
l = u ?? l;
|
|
2230
2209
|
}
|
|
2231
|
-
if (S(
|
|
2232
|
-
let u =
|
|
2233
|
-
u !== null && u !== l &&
|
|
2210
|
+
if (S(c)) {
|
|
2211
|
+
let u = c.getDescendantByIndex(f);
|
|
2212
|
+
u !== null && u !== l && c.getChildAtIndex(f) === u && (u = u.getPreviousSibling()), c = u ?? c;
|
|
2234
2213
|
}
|
|
2235
2214
|
let h;
|
|
2236
|
-
return h = l.is(
|
|
2215
|
+
return h = l.is(c) ? S(l) && l.getChildrenSize() > 0 ? [] : [l] : l.getNodesBetween(c), lt() || (this._cachedNodes = h), h;
|
|
2237
2216
|
}
|
|
2238
2217
|
setTextNodeRange(e, t, r, s) {
|
|
2239
2218
|
pe(this.anchor, e.__key, t, "text"), pe(this.focus, r.__key, s, "text"), this._cachedNodes = null, this.dirty = !0;
|
|
@@ -2241,18 +2220,18 @@ class Ce {
|
|
|
2241
2220
|
getTextContent() {
|
|
2242
2221
|
const e = this.getNodes();
|
|
2243
2222
|
if (e.length === 0) return "";
|
|
2244
|
-
const t = e[0], r = e[e.length - 1], s = this.anchor, i = this.focus, o = s.isBefore(i), [l,
|
|
2245
|
-
let
|
|
2223
|
+
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 = "", f = !0;
|
|
2246
2225
|
for (let h = 0; h < e.length; h++) {
|
|
2247
2226
|
const u = e[h];
|
|
2248
|
-
if (S(u) && !u.isInline()) f || (
|
|
2227
|
+
if (S(u) && !u.isInline()) f || (a += `
|
|
2249
2228
|
`), f = !u.isEmpty();
|
|
2250
2229
|
else if (f = !1, N(u)) {
|
|
2251
2230
|
let d = u.getTextContent();
|
|
2252
|
-
u === t ? u === r ? s.type === "element" && i.type === "element" && i.offset !== s.offset || (d = l <
|
|
2253
|
-
} else !A(u) && !Ae(u) || u === r && this.isCollapsed() || (
|
|
2231
|
+
u === t ? u === 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) : u === r && (d = o ? d.slice(0, c) : d.slice(0, l)), a += d;
|
|
2232
|
+
} else !A(u) && !Ae(u) || u === r && this.isCollapsed() || (a += u.getTextContent());
|
|
2254
2233
|
}
|
|
2255
|
-
return
|
|
2234
|
+
return a;
|
|
2256
2235
|
}
|
|
2257
2236
|
applyDOMRange(e) {
|
|
2258
2237
|
const t = M(), r = t.getEditorState()._selection, s = Cs(e.startContainer, e.startOffset, e.endContainer, e.endOffset, t, r);
|
|
@@ -2271,7 +2250,7 @@ class Ce {
|
|
|
2271
2250
|
this.style = e, this.dirty = !0;
|
|
2272
2251
|
}
|
|
2273
2252
|
hasFormat(e) {
|
|
2274
|
-
const t =
|
|
2253
|
+
const t = ce[e];
|
|
2275
2254
|
return !!(this.format & t);
|
|
2276
2255
|
}
|
|
2277
2256
|
insertRawText(e) {
|
|
@@ -2280,7 +2259,7 @@ class Ce {
|
|
|
2280
2259
|
const o = t[i];
|
|
2281
2260
|
o === `
|
|
2282
2261
|
` || o === `\r
|
|
2283
|
-
` ? r.push(nt()) : o === " " ? r.push(Un()) : r.push(
|
|
2262
|
+
` ? r.push(nt()) : o === " " ? r.push(Un()) : r.push(J(o));
|
|
2284
2263
|
}
|
|
2285
2264
|
this.insertNodes(r);
|
|
2286
2265
|
}
|
|
@@ -2288,24 +2267,24 @@ class Ce {
|
|
|
2288
2267
|
const t = this.anchor, r = this.focus, s = this.format, i = this.style;
|
|
2289
2268
|
let o = t, l = r;
|
|
2290
2269
|
!this.isCollapsed() && r.isBefore(t) && (o = r, l = t), o.type === "element" && function(_, m, y, x) {
|
|
2291
|
-
const C = _.getNode(), b = C.getChildAtIndex(_.offset), v =
|
|
2270
|
+
const C = _.getNode(), b = C.getChildAtIndex(_.offset), v = J(), P = Z(C) ? ve().append(v) : v;
|
|
2292
2271
|
v.setFormat(y), v.setStyle(x), b === null ? C.append(P) : b.insertBefore(P), _.is(m) && m.set(v.__key, 0, "text"), _.set(v.__key, 0, "text");
|
|
2293
2272
|
}(o, l, s, i);
|
|
2294
|
-
const
|
|
2295
|
-
let
|
|
2273
|
+
const c = o.offset;
|
|
2274
|
+
let a = l.offset;
|
|
2296
2275
|
const f = this.getNodes(), h = f.length;
|
|
2297
2276
|
let u = f[0];
|
|
2298
2277
|
N(u) || k(26);
|
|
2299
2278
|
const d = u.getTextContent().length, g = u.getParentOrThrow();
|
|
2300
2279
|
let p = f[h - 1];
|
|
2301
|
-
if (h === 1 && l.type === "element" && (
|
|
2280
|
+
if (h === 1 && l.type === "element" && (a = d, l.set(o.key, a, "text")), this.isCollapsed() && c === d && (u.isSegmented() || u.isToken() || !u.canInsertTextAfter() || !g.canInsertTextAfter() && u.getNextSibling() === null)) {
|
|
2302
2281
|
let _ = u.getNextSibling();
|
|
2303
|
-
if (N(_) && _.canInsertTextBefore() && !be(_) || (_ =
|
|
2304
|
-
} else if (this.isCollapsed() &&
|
|
2282
|
+
if (N(_) && _.canInsertTextBefore() && !be(_) || (_ = J(), _.setFormat(s), _.setStyle(i), g.canInsertTextAfter() ? u.insertAfter(_) : g.insertAfter(_)), _.select(0, 0), u = _, e !== "") return void this.insertText(e);
|
|
2283
|
+
} else if (this.isCollapsed() && c === 0 && (u.isSegmented() || u.isToken() || !u.canInsertTextBefore() || !g.canInsertTextBefore() && u.getPreviousSibling() === null)) {
|
|
2305
2284
|
let _ = u.getPreviousSibling();
|
|
2306
|
-
if (N(_) && !be(_) || (_ =
|
|
2307
|
-
} else if (u.isSegmented() &&
|
|
2308
|
-
const _ =
|
|
2285
|
+
if (N(_) && !be(_) || (_ = J(), _.setFormat(s), g.canInsertTextBefore() ? u.insertBefore(_) : g.insertBefore(_)), _.select(), u = _, e !== "") return void this.insertText(e);
|
|
2286
|
+
} else if (u.isSegmented() && c !== d) {
|
|
2287
|
+
const _ = J(u.getTextContent());
|
|
2309
2288
|
_.setFormat(s), u.replace(_), u = _;
|
|
2310
2289
|
} else if (!this.isCollapsed() && e !== "") {
|
|
2311
2290
|
const _ = p.getParent();
|
|
@@ -2313,41 +2292,41 @@ class Ce {
|
|
|
2313
2292
|
}
|
|
2314
2293
|
if (h === 1) {
|
|
2315
2294
|
if (u.isToken()) {
|
|
2316
|
-
const x =
|
|
2295
|
+
const x = J(e);
|
|
2317
2296
|
return x.select(), void u.replace(x);
|
|
2318
2297
|
}
|
|
2319
2298
|
const _ = u.getFormat(), m = u.getStyle();
|
|
2320
|
-
if (
|
|
2321
|
-
if (
|
|
2322
|
-
const x =
|
|
2299
|
+
if (c !== a || _ === s && m === i) {
|
|
2300
|
+
if (Bi(u)) {
|
|
2301
|
+
const x = J(e);
|
|
2323
2302
|
return x.setFormat(s), x.setStyle(i), x.select(), void u.replace(x);
|
|
2324
2303
|
}
|
|
2325
2304
|
} else {
|
|
2326
2305
|
if (u.getTextContent() !== "") {
|
|
2327
|
-
const x =
|
|
2328
|
-
if (x.setFormat(s), x.setStyle(i), x.select(),
|
|
2306
|
+
const x = J(e);
|
|
2307
|
+
if (x.setFormat(s), x.setStyle(i), x.select(), c === 0) u.insertBefore(x, !1);
|
|
2329
2308
|
else {
|
|
2330
|
-
const [C] = u.splitText(
|
|
2309
|
+
const [C] = u.splitText(c);
|
|
2331
2310
|
C.insertAfter(x, !1);
|
|
2332
2311
|
}
|
|
2333
2312
|
return void (x.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length));
|
|
2334
2313
|
}
|
|
2335
2314
|
u.setFormat(s), u.setStyle(i);
|
|
2336
2315
|
}
|
|
2337
|
-
const y =
|
|
2338
|
-
u = u.spliceText(
|
|
2316
|
+
const y = a - c;
|
|
2317
|
+
u = u.spliceText(c, y, e, !0), u.getTextContent() === "" ? u.remove() : this.anchor.type === "text" && (u.isComposing() ? this.anchor.offset -= e.length : (this.format = _, this.style = m));
|
|
2339
2318
|
} else {
|
|
2340
2319
|
const _ = /* @__PURE__ */ new Set([...u.getParentKeys(), ...p.getParentKeys()]), m = S(u) ? u : u.getParentOrThrow();
|
|
2341
2320
|
let y = S(p) ? p : p.getParentOrThrow(), x = p;
|
|
2342
2321
|
if (!m.is(y) && y.isInline()) do
|
|
2343
2322
|
x = y, y = y.getParentOrThrow();
|
|
2344
2323
|
while (y.isInline());
|
|
2345
|
-
if (l.type === "text" && (
|
|
2324
|
+
if (l.type === "text" && (a !== 0 || p.getTextContent() === "") || l.type === "element" && p.getIndexWithinParent() < a) if (N(p) && !p.isToken() && a !== p.getTextContentSize()) {
|
|
2346
2325
|
if (p.isSegmented()) {
|
|
2347
|
-
const T =
|
|
2326
|
+
const T = J(p.getTextContent());
|
|
2348
2327
|
p.replace(T), p = T;
|
|
2349
2328
|
}
|
|
2350
|
-
Z(l.getNode()) || l.type !== "text" || (p = p.spliceText(0,
|
|
2329
|
+
Z(l.getNode()) || l.type !== "text" || (p = p.spliceText(0, a, "")), _.add(p.__key);
|
|
2351
2330
|
} else {
|
|
2352
2331
|
const T = p.getParentOrThrow();
|
|
2353
2332
|
T.canBeEmpty() || T.getChildrenSize() !== 1 ? p.remove() : T.remove();
|
|
@@ -2366,12 +2345,12 @@ class Ce {
|
|
|
2366
2345
|
(O === 0 || D[O - 1].is(E)) && (_.delete(T.__key), E = T), T = T.getParent();
|
|
2367
2346
|
}
|
|
2368
2347
|
}
|
|
2369
|
-
if (u.isToken()) if (
|
|
2348
|
+
if (u.isToken()) if (c === d) u.select();
|
|
2370
2349
|
else {
|
|
2371
|
-
const T =
|
|
2350
|
+
const T = J(e);
|
|
2372
2351
|
T.select(), u.replace(T);
|
|
2373
2352
|
}
|
|
2374
|
-
else u = u.spliceText(
|
|
2353
|
+
else u = u.spliceText(c, d - c, e, !0), u.getTextContent() === "" ? u.remove() : u.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length);
|
|
2375
2354
|
for (let T = 1; T < h; T++) {
|
|
2376
2355
|
const E = f[T], D = E.__key;
|
|
2377
2356
|
_.has(D) || E.remove();
|
|
@@ -2382,14 +2361,14 @@ class Ce {
|
|
|
2382
2361
|
if (this.isCollapsed()) return;
|
|
2383
2362
|
const { anchor: e, focus: t } = this, r = this.getNodes(), s = this.isBackward() ? t : e, i = this.isBackward() ? e : t;
|
|
2384
2363
|
let o = s.getNode(), l = i.getNode();
|
|
2385
|
-
const
|
|
2364
|
+
const c = $e(o, _e), a = $e(l, _e);
|
|
2386
2365
|
r.forEach((h) => {
|
|
2387
2366
|
Qe(o, h) || Qe(l, h) || h.getKey() === o.getKey() || h.getKey() === l.getKey() || h.remove();
|
|
2388
2367
|
});
|
|
2389
2368
|
const f = (h, u) => {
|
|
2390
2369
|
if (h.getTextContent() === "") h.remove();
|
|
2391
2370
|
else if (u !== 0 && be(h)) {
|
|
2392
|
-
const d =
|
|
2371
|
+
const d = J(h.getTextContent());
|
|
2393
2372
|
return d.setFormat(h.getFormat()), d.setStyle(h.getStyle()), h.replace(d);
|
|
2394
2373
|
}
|
|
2395
2374
|
};
|
|
@@ -2401,17 +2380,17 @@ class Ce {
|
|
|
2401
2380
|
const h = o.getTextContentSize() - s.offset;
|
|
2402
2381
|
o.spliceText(s.offset, h, ""), o = f(o, h) || o;
|
|
2403
2382
|
}
|
|
2404
|
-
N(l) && (l.spliceText(0, i.offset, ""), l = f(l, i.offset) || l), o.isAttached() && N(o) ? o.selectEnd() : l.isAttached() && N(l) && l.selectStart(), S(
|
|
2383
|
+
N(l) && (l.spliceText(0, i.offset, ""), l = f(l, i.offset) || l), o.isAttached() && N(o) ? o.selectEnd() : l.isAttached() && N(l) && l.selectStart(), S(c) && S(a) && c !== a && (c.append(...a.getChildren()), a.remove(), i.set(s.key, s.offset, s.type));
|
|
2405
2384
|
}
|
|
2406
2385
|
formatText(e, t = null) {
|
|
2407
|
-
if (this.isCollapsed()) return this.toggleFormat(e), void
|
|
2386
|
+
if (this.isCollapsed()) return this.toggleFormat(e), void $(null);
|
|
2408
2387
|
const r = this.getNodes(), s = [];
|
|
2409
2388
|
for (const x of r) N(x) && s.push(x);
|
|
2410
2389
|
const i = s.length;
|
|
2411
|
-
if (i === 0) return this.toggleFormat(e), void
|
|
2412
|
-
const o = this.anchor, l = this.focus,
|
|
2413
|
-
let h = 0, u = s[0], d =
|
|
2414
|
-
if (
|
|
2390
|
+
if (i === 0) return this.toggleFormat(e), void $(null);
|
|
2391
|
+
const o = this.anchor, l = this.focus, c = this.isBackward(), a = c ? l : o, f = c ? o : l;
|
|
2392
|
+
let h = 0, u = s[0], d = a.type === "element" ? 0 : a.offset;
|
|
2393
|
+
if (a.type === "text" && d === u.getTextContentSize() && (h = 1, u = s[1], d = 0), u == null) return;
|
|
2415
2394
|
const g = u.getFormatFlags(e, t);
|
|
2416
2395
|
r.forEach((x) => {
|
|
2417
2396
|
if (kn(x)) {
|
|
@@ -2427,7 +2406,7 @@ class Ce {
|
|
|
2427
2406
|
if (be(u) || d === 0 && m === u.getTextContentSize()) u.setFormat(g);
|
|
2428
2407
|
else {
|
|
2429
2408
|
const x = u.splitText(d, m), C = d === 0 ? x[0] : x[1];
|
|
2430
|
-
C.setFormat(g),
|
|
2409
|
+
C.setFormat(g), a.type === "text" && a.set(C.__key, 0, "text"), f.type === "text" && f.set(C.__key, m - d, "text");
|
|
2431
2410
|
}
|
|
2432
2411
|
return void (this.format = g);
|
|
2433
2412
|
}
|
|
@@ -2438,7 +2417,7 @@ class Ce {
|
|
|
2438
2417
|
const C = s[x], b = C.getFormatFlags(e, y);
|
|
2439
2418
|
C.setFormat(b);
|
|
2440
2419
|
}
|
|
2441
|
-
|
|
2420
|
+
a.type === "text" && a.set(u.__key, d, "text"), f.type === "text" && f.set(_.__key, m, "text"), this.format = g | y;
|
|
2442
2421
|
}
|
|
2443
2422
|
insertNodes(e) {
|
|
2444
2423
|
if (e.length === 0) return;
|
|
@@ -2447,18 +2426,18 @@ class Ce {
|
|
|
2447
2426
|
const d = I();
|
|
2448
2427
|
return F(d) || k(134), d.insertNodes(e);
|
|
2449
2428
|
}
|
|
2450
|
-
const t =
|
|
2429
|
+
const t = $e((this.isBackward() ? this.focus : this.anchor).getNode(), _e), r = e[e.length - 1];
|
|
2451
2430
|
if ("__language" in t && S(t)) {
|
|
2452
2431
|
if ("__language" in e[0]) this.insertText(e[0].getTextContent());
|
|
2453
2432
|
else {
|
|
2454
|
-
const d =
|
|
2433
|
+
const d = an(this);
|
|
2455
2434
|
t.splice(d, 0, e), r.selectEnd();
|
|
2456
2435
|
}
|
|
2457
2436
|
return;
|
|
2458
2437
|
}
|
|
2459
2438
|
if (!e.some((d) => (S(d) || A(d)) && !d.isInline())) {
|
|
2460
2439
|
S(t) || k(135);
|
|
2461
|
-
const d =
|
|
2440
|
+
const d = an(this);
|
|
2462
2441
|
return t.splice(d, 0, e), void r.selectEnd();
|
|
2463
2442
|
}
|
|
2464
2443
|
const s = function(d) {
|
|
@@ -2472,19 +2451,19 @@ class Ce {
|
|
|
2472
2451
|
} else g.append(m), p = null;
|
|
2473
2452
|
}
|
|
2474
2453
|
return g;
|
|
2475
|
-
}(e), i = s.getLastDescendant(), o = s.getChildren(), l = !S(t) || !t.isEmpty() ? this.insertParagraph() : null,
|
|
2476
|
-
let
|
|
2454
|
+
}(e), i = s.getLastDescendant(), o = s.getChildren(), l = !S(t) || !t.isEmpty() ? this.insertParagraph() : null, c = o[o.length - 1];
|
|
2455
|
+
let a = o[0];
|
|
2477
2456
|
var f;
|
|
2478
|
-
S(f =
|
|
2457
|
+
S(f = a) && _e(f) && !f.isEmpty() && S(t) && (!t.isEmpty() || t.canMergeWhenEmpty()) && (S(t) || k(135), t.append(...a.getChildren()), a = o[1]), a && function(d, g, p) {
|
|
2479
2458
|
const _ = g.getParentOrThrow().getLastChild();
|
|
2480
2459
|
let m = g;
|
|
2481
2460
|
const y = [g];
|
|
2482
2461
|
for (; m !== _; ) m.getNextSibling() || k(140), m = m.getNextSibling(), y.push(m);
|
|
2483
2462
|
let x = d;
|
|
2484
2463
|
for (const C of y) x = x.insertAfter(C);
|
|
2485
|
-
}(t,
|
|
2486
|
-
const h =
|
|
2487
|
-
l && S(h) && (l.canMergeWhenEmpty() || _e(
|
|
2464
|
+
}(t, a);
|
|
2465
|
+
const h = $e(i, _e);
|
|
2466
|
+
l && S(h) && (l.canMergeWhenEmpty() || _e(c)) && (h.append(...l.getChildren()), l.remove()), S(t) && t.isEmpty() && t.remove(), i.selectEnd();
|
|
2488
2467
|
const u = S(t) ? t.getLastChild() : null;
|
|
2489
2468
|
Ae(u) && h !== t && u.remove();
|
|
2490
2469
|
}
|
|
@@ -2493,7 +2472,7 @@ class Ce {
|
|
|
2493
2472
|
const o = ve();
|
|
2494
2473
|
return G().splice(this.anchor.offset, 0, [o]), o.select(), o;
|
|
2495
2474
|
}
|
|
2496
|
-
const e =
|
|
2475
|
+
const e = an(this), t = $e(this.anchor.getNode(), _e);
|
|
2497
2476
|
S(t) || k(136);
|
|
2498
2477
|
const r = t.getChildAtIndex(e), s = r ? [r, ...r.getNextSiblings()] : [], i = t.insertNewAfter(this, !1);
|
|
2499
2478
|
return i ? (i.append(...s), i.selectStart(), i) : null;
|
|
@@ -2508,22 +2487,22 @@ class Ce {
|
|
|
2508
2487
|
extract() {
|
|
2509
2488
|
const e = this.getNodes(), t = e.length, r = t - 1, s = this.anchor, i = this.focus;
|
|
2510
2489
|
let o = e[0], l = e[r];
|
|
2511
|
-
const [
|
|
2490
|
+
const [c, a] = br(this);
|
|
2512
2491
|
if (t === 0) return [];
|
|
2513
2492
|
if (t === 1) {
|
|
2514
2493
|
if (N(o) && !this.isCollapsed()) {
|
|
2515
|
-
const h =
|
|
2494
|
+
const h = c > a ? a : c, u = c > a ? c : a, d = o.splitText(h, u), g = h === 0 ? d[0] : d[1];
|
|
2516
2495
|
return g != null ? [g] : [];
|
|
2517
2496
|
}
|
|
2518
2497
|
return [o];
|
|
2519
2498
|
}
|
|
2520
2499
|
const f = s.isBefore(i);
|
|
2521
2500
|
if (N(o)) {
|
|
2522
|
-
const h = f ?
|
|
2501
|
+
const h = f ? c : a;
|
|
2523
2502
|
h === o.getTextContentSize() ? e.shift() : h !== 0 && ([, o] = o.splitText(h), e[0] = o);
|
|
2524
2503
|
}
|
|
2525
2504
|
if (N(l)) {
|
|
2526
|
-
const h = l.getTextContent().length, u = f ?
|
|
2505
|
+
const h = l.getTextContent().length, u = f ? a : c;
|
|
2527
2506
|
u === 0 ? e.pop() : u !== h && ([l] = l.splitText(u), e[r] = l);
|
|
2528
2507
|
}
|
|
2529
2508
|
return e;
|
|
@@ -2546,13 +2525,13 @@ class Ce {
|
|
|
2546
2525
|
return S(u) ? (p = u.__key, g = t ? u.getChildrenSize() : 0) : (g = l.getIndexWithinParent(), p = d.__key, t || g++), s.set(p, g, "element"), void (o && i.set(p, g, "element"));
|
|
2547
2526
|
}
|
|
2548
2527
|
}
|
|
2549
|
-
const
|
|
2550
|
-
if (!
|
|
2551
|
-
const f =
|
|
2552
|
-
if (h === null || f === null || !S(l) || l.isInline() || l.canBeEmpty() || Kn(f,
|
|
2528
|
+
const c = M(), a = se(c._window);
|
|
2529
|
+
if (!a) return;
|
|
2530
|
+
const f = c._blockCursorElement, h = c._rootElement;
|
|
2531
|
+
if (h === null || f === null || !S(l) || l.isInline() || l.canBeEmpty() || Kn(f, c, h), function(u, d, g, p) {
|
|
2553
2532
|
u.modify(d, g, p);
|
|
2554
|
-
}(
|
|
2555
|
-
const u =
|
|
2533
|
+
}(a, e, t ? "backward" : "forward", r), a.rangeCount > 0) {
|
|
2534
|
+
const u = a.getRangeAt(0), d = this.anchor.getNode(), g = Z(d) ? d : Ti(d);
|
|
2556
2535
|
if (this.applyDOMRange(u), this.dirty = !0, !o) {
|
|
2557
2536
|
const p = this.getNodes(), _ = [];
|
|
2558
2537
|
let m = !1;
|
|
@@ -2567,7 +2546,7 @@ class Ce {
|
|
|
2567
2546
|
const y = _[_.length - 1];
|
|
2568
2547
|
S(y) ? y.selectEnd() : y.getParentOrThrow().selectEnd();
|
|
2569
2548
|
}
|
|
2570
|
-
|
|
2549
|
+
a.anchorNode === u.startContainer && a.anchorOffset === u.startOffset || function(y) {
|
|
2571
2550
|
const x = y.focus, C = y.anchor, b = C.key, v = C.offset, P = C.type;
|
|
2572
2551
|
pe(C, x.key, x.offset, x.type), pe(x, b, v, P), y._cachedNodes = null;
|
|
2573
2552
|
}(this);
|
|
@@ -2604,17 +2583,17 @@ class Ce {
|
|
|
2604
2583
|
} else {
|
|
2605
2584
|
const l = i.type === "text" ? i.getNode() : null;
|
|
2606
2585
|
if (s = r.type === "text" ? r.getNode() : null, l !== null && l.isSegmented()) {
|
|
2607
|
-
const
|
|
2608
|
-
if (l.is(s) || e &&
|
|
2586
|
+
const c = i.offset, a = l.getTextContentSize();
|
|
2587
|
+
if (l.is(s) || e && c !== a || !e && c !== 0) return void wr(l, e, c);
|
|
2609
2588
|
} else if (s !== null && s.isSegmented()) {
|
|
2610
|
-
const
|
|
2611
|
-
if (s.is(l) || e &&
|
|
2589
|
+
const c = r.offset, a = s.getTextContentSize();
|
|
2590
|
+
if (s.is(l) || e && c !== 0 || !e && c !== a) return void wr(s, e, c);
|
|
2612
2591
|
}
|
|
2613
|
-
(function(
|
|
2614
|
-
const f =
|
|
2592
|
+
(function(c, a) {
|
|
2593
|
+
const f = c.anchor, h = c.focus, u = f.getNode(), d = h.getNode();
|
|
2615
2594
|
if (u === d && f.type === "text" && h.type === "text") {
|
|
2616
2595
|
const g = f.offset, p = h.offset, _ = g < p, m = _ ? g : p, y = _ ? p : g, x = y - 1;
|
|
2617
|
-
m !== x && (ns(u.getTextContent().slice(m, y)) || (
|
|
2596
|
+
m !== x && (ns(u.getTextContent().slice(m, y)) || (a ? h.offset = x : f.offset = x));
|
|
2618
2597
|
}
|
|
2619
2598
|
})(this, e);
|
|
2620
2599
|
}
|
|
@@ -2667,27 +2646,27 @@ function br(n) {
|
|
|
2667
2646
|
function wr(n, e, t) {
|
|
2668
2647
|
const r = n, s = r.getTextContent().split(/(?=\s)/g), i = s.length;
|
|
2669
2648
|
let o = 0, l = 0;
|
|
2670
|
-
for (let
|
|
2671
|
-
const f =
|
|
2672
|
-
if (l = o, o += s[
|
|
2673
|
-
s.splice(
|
|
2649
|
+
for (let a = 0; a < i; a++) {
|
|
2650
|
+
const f = a === i - 1;
|
|
2651
|
+
if (l = o, o += s[a].length, e && o === t || o > t || f) {
|
|
2652
|
+
s.splice(a, 1), f && (l = void 0);
|
|
2674
2653
|
break;
|
|
2675
2654
|
}
|
|
2676
2655
|
}
|
|
2677
|
-
const
|
|
2678
|
-
|
|
2656
|
+
const c = s.join("").trim();
|
|
2657
|
+
c === "" ? r.remove() : (r.setTextContent(c), r.select(l, l));
|
|
2679
2658
|
}
|
|
2680
2659
|
function Nr(n, e, t, r) {
|
|
2681
2660
|
let s, i = e;
|
|
2682
2661
|
if (n.nodeType === rt) {
|
|
2683
2662
|
let o = !1;
|
|
2684
|
-
const l = n.childNodes,
|
|
2685
|
-
i ===
|
|
2663
|
+
const l = n.childNodes, c = l.length, a = r._blockCursorElement;
|
|
2664
|
+
i === c && (o = !0, i = c - 1);
|
|
2686
2665
|
let f = l[i], h = !1;
|
|
2687
|
-
if (f ===
|
|
2688
|
-
else if (
|
|
2689
|
-
const u =
|
|
2690
|
-
n === u && e > Array.prototype.indexOf.call(u.children,
|
|
2666
|
+
if (f === a) f = l[i + 1], h = !0;
|
|
2667
|
+
else if (a !== null) {
|
|
2668
|
+
const u = a.parentNode;
|
|
2669
|
+
n === u && e > Array.prototype.indexOf.call(u.children, a) && i--;
|
|
2691
2670
|
}
|
|
2692
2671
|
if (s = Oe(f), N(s)) i = or(s, o);
|
|
2693
2672
|
else {
|
|
@@ -2750,37 +2729,37 @@ function Cs(n, e, t, r, s, i) {
|
|
|
2750
2729
|
const l = Nr(t, r, F(i) ? i.focus : null, s);
|
|
2751
2730
|
if (l === null) return null;
|
|
2752
2731
|
if (o.type === "element" && l.type === "element") {
|
|
2753
|
-
const
|
|
2754
|
-
if (A(
|
|
2732
|
+
const c = Oe(n), a = Oe(t);
|
|
2733
|
+
if (A(c) && A(a)) return null;
|
|
2755
2734
|
}
|
|
2756
2735
|
return Ts(o, l, i), [o, l];
|
|
2757
2736
|
}
|
|
2758
|
-
function
|
|
2737
|
+
function ao(n) {
|
|
2759
2738
|
return S(n) && !n.isInline();
|
|
2760
2739
|
}
|
|
2761
2740
|
function ks(n, e, t, r, s, i) {
|
|
2762
2741
|
const o = fe(), l = new Ce(ie(n, e, s), ie(t, r, i), 0, "");
|
|
2763
2742
|
return l.dirty = !0, o._selection = l, l;
|
|
2764
2743
|
}
|
|
2765
|
-
function
|
|
2744
|
+
function uo() {
|
|
2766
2745
|
const n = ie("root", 0, "element"), e = ie("root", 0, "element");
|
|
2767
2746
|
return new Ce(n, e, 0, "");
|
|
2768
2747
|
}
|
|
2769
2748
|
function Pr() {
|
|
2770
2749
|
return new Vt(/* @__PURE__ */ new Set());
|
|
2771
2750
|
}
|
|
2772
|
-
function
|
|
2751
|
+
function fo(n, e) {
|
|
2773
2752
|
return Ht(null, n, e, null);
|
|
2774
2753
|
}
|
|
2775
2754
|
function Ht(n, e, t, r) {
|
|
2776
2755
|
const s = t._window;
|
|
2777
2756
|
if (s === null) return null;
|
|
2778
|
-
const i = r || s.event, o = i ? i.type : void 0, l = o === "selectionchange",
|
|
2779
|
-
let
|
|
2780
|
-
if (F(n) && !
|
|
2757
|
+
const i = r || s.event, o = i ? i.type : void 0, l = o === "selectionchange", c = !dn && (l || o === "beforeinput" || o === "compositionstart" || o === "compositionend" || o === "click" && i && i.detail === 3 || o === "drop" || o === void 0);
|
|
2758
|
+
let a, f, h, u;
|
|
2759
|
+
if (F(n) && !c) return n.clone();
|
|
2781
2760
|
if (e === null) return null;
|
|
2782
|
-
if (
|
|
2783
|
-
const d = Cs(
|
|
2761
|
+
if (a = e.anchorNode, f = e.focusNode, h = e.anchorOffset, u = e.focusOffset, l && F(n) && !Mt(t, a, f)) return n.clone();
|
|
2762
|
+
const d = Cs(a, h, f, u, t, n);
|
|
2784
2763
|
if (d === null) return null;
|
|
2785
2764
|
const [g, p] = d;
|
|
2786
2765
|
return new Ce(g, p, F(n) ? n.format : 0, F(n) ? n.style : "");
|
|
@@ -2794,22 +2773,22 @@ function ot() {
|
|
|
2794
2773
|
function Lt(n, e, t, r = 1) {
|
|
2795
2774
|
const s = n.anchor, i = n.focus, o = s.getNode(), l = i.getNode();
|
|
2796
2775
|
if (!e.is(o) && !e.is(l)) return;
|
|
2797
|
-
const
|
|
2776
|
+
const c = e.__key;
|
|
2798
2777
|
if (n.isCollapsed()) {
|
|
2799
|
-
const
|
|
2800
|
-
if (t <=
|
|
2801
|
-
const f = Math.max(0,
|
|
2802
|
-
s.set(
|
|
2778
|
+
const a = s.offset;
|
|
2779
|
+
if (t <= a && r > 0 || t < a && r < 0) {
|
|
2780
|
+
const f = Math.max(0, a + r);
|
|
2781
|
+
s.set(c, f, "element"), i.set(c, f, "element"), Fr(n);
|
|
2803
2782
|
}
|
|
2804
2783
|
} else {
|
|
2805
|
-
const
|
|
2784
|
+
const a = n.isBackward(), f = a ? i : s, h = f.getNode(), u = a ? s : i, d = u.getNode();
|
|
2806
2785
|
if (e.is(h)) {
|
|
2807
2786
|
const g = f.offset;
|
|
2808
|
-
(t <= g && r > 0 || t < g && r < 0) && f.set(
|
|
2787
|
+
(t <= g && r > 0 || t < g && r < 0) && f.set(c, Math.max(0, g + r), "element");
|
|
2809
2788
|
}
|
|
2810
2789
|
if (e.is(d)) {
|
|
2811
2790
|
const g = u.offset;
|
|
2812
|
-
(t <= g && r > 0 || t < g && r < 0) && u.set(
|
|
2791
|
+
(t <= g && r > 0 || t < g && r < 0) && u.set(c, Math.max(0, g + r), "element");
|
|
2813
2792
|
}
|
|
2814
2793
|
}
|
|
2815
2794
|
Fr(n);
|
|
@@ -2818,24 +2797,24 @@ function Fr(n) {
|
|
|
2818
2797
|
const e = n.anchor, t = e.offset, r = n.focus, s = r.offset, i = e.getNode(), o = r.getNode();
|
|
2819
2798
|
if (n.isCollapsed()) {
|
|
2820
2799
|
if (!S(i)) return;
|
|
2821
|
-
const l = i.getChildrenSize(),
|
|
2822
|
-
if (N(
|
|
2800
|
+
const l = i.getChildrenSize(), c = t >= l, a = c ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
|
|
2801
|
+
if (N(a)) {
|
|
2823
2802
|
let f = 0;
|
|
2824
|
-
|
|
2803
|
+
c && (f = a.getTextContentSize()), e.set(a.__key, f, "text"), r.set(a.__key, f, "text");
|
|
2825
2804
|
}
|
|
2826
2805
|
} else {
|
|
2827
2806
|
if (S(i)) {
|
|
2828
|
-
const l = i.getChildrenSize(),
|
|
2829
|
-
if (N(
|
|
2807
|
+
const l = i.getChildrenSize(), c = t >= l, a = c ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
|
|
2808
|
+
if (N(a)) {
|
|
2830
2809
|
let f = 0;
|
|
2831
|
-
|
|
2810
|
+
c && (f = a.getTextContentSize()), e.set(a.__key, f, "text");
|
|
2832
2811
|
}
|
|
2833
2812
|
}
|
|
2834
2813
|
if (S(o)) {
|
|
2835
|
-
const l = o.getChildrenSize(),
|
|
2836
|
-
if (N(
|
|
2814
|
+
const l = o.getChildrenSize(), c = s >= l, a = c ? o.getChildAtIndex(l - 1) : o.getChildAtIndex(s);
|
|
2815
|
+
if (N(a)) {
|
|
2837
2816
|
let f = 0;
|
|
2838
|
-
|
|
2817
|
+
c && (f = a.getTextContentSize()), r.set(a.__key, f, "text");
|
|
2839
2818
|
}
|
|
2840
2819
|
}
|
|
2841
2820
|
}
|
|
@@ -2847,10 +2826,10 @@ function Ot(n, e, t, r, s) {
|
|
|
2847
2826
|
function Dr(n, e, t, r, s) {
|
|
2848
2827
|
n.type === "text" ? (n.key = t, e || (n.offset += s)) : n.offset > r.getIndexWithinParent() && (n.offset -= 1);
|
|
2849
2828
|
}
|
|
2850
|
-
function
|
|
2851
|
-
const l = r.anchorNode,
|
|
2829
|
+
function Ki(n, e, t, r, s, i, o) {
|
|
2830
|
+
const l = r.anchorNode, c = r.focusNode, a = r.anchorOffset, f = r.focusOffset, h = document.activeElement;
|
|
2852
2831
|
if (s.has("collaboration") && h !== i || h !== null && Xr(h)) return;
|
|
2853
|
-
if (!F(e)) return void (n !== null && Mt(t, l,
|
|
2832
|
+
if (!F(e)) return void (n !== null && Mt(t, l, c) && r.removeAllRanges());
|
|
2854
2833
|
const u = e.anchor, d = e.focus, g = u.key, p = d.key, _ = Nt(t, g), m = Nt(t, p), y = u.offset, x = d.offset, C = e.format, b = e.style, v = e.isCollapsed();
|
|
2855
2834
|
let P = _, T = m, E = !1;
|
|
2856
2835
|
if (u.type === "text") {
|
|
@@ -2859,7 +2838,7 @@ function ji(n, e, t, r, s, i, o) {
|
|
|
2859
2838
|
E = z.getFormat() !== C || z.getStyle() !== b;
|
|
2860
2839
|
} else F(n) && n.anchor.type === "text" && (E = !0);
|
|
2861
2840
|
var D, O, W, L, U;
|
|
2862
|
-
if (d.type === "text" && (T = kt(m)), P !== null && T !== null && (v && (n === null || E || F(n) && (n.format !== C || n.style !== b)) && (D = C, O = b, W = y, L = g, U = performance.now(), _s = [D, O, W, L, U]),
|
|
2841
|
+
if (d.type === "text" && (T = kt(m)), P !== null && T !== null && (v && (n === null || E || F(n) && (n.format !== C || n.style !== b)) && (D = C, O = b, W = y, L = g, U = performance.now(), _s = [D, O, W, L, U]), a !== y || f !== x || l !== P || c !== T || r.type === "Range" && v || (h !== null && i.contains(h) || i.focus({ preventScroll: !0 }), u.type === "element"))) {
|
|
2863
2842
|
try {
|
|
2864
2843
|
r.setBaseAndExtent(P, y, T, x);
|
|
2865
2844
|
} catch {
|
|
@@ -2875,16 +2854,16 @@ function ji(n, e, t, r, s, i, o) {
|
|
|
2875
2854
|
(function(De, Be, Hn) {
|
|
2876
2855
|
const qn = Hn.ownerDocument, Qn = qn.defaultView;
|
|
2877
2856
|
if (Qn === null) return;
|
|
2878
|
-
let { top: Zt, bottom: Gt } = Be,
|
|
2857
|
+
let { top: Zt, bottom: Gt } = Be, at = 0, ut = 0, he = Hn;
|
|
2879
2858
|
for (; he !== null; ) {
|
|
2880
2859
|
const Yt = he === qn.body;
|
|
2881
|
-
if (Yt)
|
|
2860
|
+
if (Yt) at = 0, ut = Kt(De).innerHeight;
|
|
2882
2861
|
else {
|
|
2883
2862
|
const ft = he.getBoundingClientRect();
|
|
2884
|
-
|
|
2863
|
+
at = ft.top, ut = ft.bottom;
|
|
2885
2864
|
}
|
|
2886
2865
|
let Re = 0;
|
|
2887
|
-
if (Zt <
|
|
2866
|
+
if (Zt < at ? Re = -(at - Zt) : Gt > ut && (Re = Gt - ut), Re !== 0) if (Yt) Qn.scrollBy(0, Re);
|
|
2888
2867
|
else {
|
|
2889
2868
|
const ft = he.scrollTop;
|
|
2890
2869
|
he.scrollTop += Re;
|
|
@@ -2900,21 +2879,21 @@ function ji(n, e, t, r, s, i, o) {
|
|
|
2900
2879
|
Sn = !0;
|
|
2901
2880
|
}
|
|
2902
2881
|
}
|
|
2903
|
-
function
|
|
2882
|
+
function ho(n) {
|
|
2904
2883
|
let e = I() || ot();
|
|
2905
2884
|
e === null && (e = G().selectEnd()), e.insertNodes(n);
|
|
2906
2885
|
}
|
|
2907
|
-
function
|
|
2886
|
+
function an(n) {
|
|
2908
2887
|
let e = n;
|
|
2909
2888
|
n.isCollapsed() || e.removeText();
|
|
2910
2889
|
const t = I();
|
|
2911
2890
|
F(t) && (e = t), F(e) || k(161);
|
|
2912
2891
|
const r = e.anchor;
|
|
2913
2892
|
let s = r.getNode(), i = r.offset;
|
|
2914
|
-
for (; !_e(s); ) [s, i] =
|
|
2893
|
+
for (; !_e(s); ) [s, i] = Ji(s, i);
|
|
2915
2894
|
return i;
|
|
2916
2895
|
}
|
|
2917
|
-
function
|
|
2896
|
+
function Ji(n, e) {
|
|
2918
2897
|
const t = n.getParent();
|
|
2919
2898
|
if (!t) {
|
|
2920
2899
|
const s = ve();
|
|
@@ -2965,13 +2944,13 @@ function ws() {
|
|
|
2965
2944
|
let r = ` Detected on the page: ${n} compatible editor(s) with version ${t}`;
|
|
2966
2945
|
return e.size && (r += ` and incompatible editors with versions ${Array.from(e).join(", ")}`), r;
|
|
2967
2946
|
}
|
|
2968
|
-
function
|
|
2947
|
+
function $i() {
|
|
2969
2948
|
return K;
|
|
2970
2949
|
}
|
|
2971
2950
|
function Or(n, e, t) {
|
|
2972
|
-
const r = e.__type, s = function(l,
|
|
2973
|
-
const
|
|
2974
|
-
return
|
|
2951
|
+
const r = e.__type, s = function(l, c) {
|
|
2952
|
+
const a = l._nodes.get(c);
|
|
2953
|
+
return a === void 0 && k(30, c), a;
|
|
2975
2954
|
}(n, r);
|
|
2976
2955
|
let i = t.get(r);
|
|
2977
2956
|
i === void 0 && (i = Array.from(s.transforms), t.set(r, i));
|
|
@@ -2988,7 +2967,7 @@ function Ns(n, e) {
|
|
|
2988
2967
|
Array.isArray(e) || (r = [e]);
|
|
2989
2968
|
for (const s of r) t.add(s);
|
|
2990
2969
|
}
|
|
2991
|
-
function
|
|
2970
|
+
function go(n) {
|
|
2992
2971
|
return Vn(n, M()._nodes);
|
|
2993
2972
|
}
|
|
2994
2973
|
function Vn(n, e) {
|
|
@@ -2998,8 +2977,8 @@ function Vn(n, e) {
|
|
|
2998
2977
|
n.type !== s.getType() && k(18, s.name);
|
|
2999
2978
|
const i = s.importJSON(n), o = n.children;
|
|
3000
2979
|
if (S(i) && Array.isArray(o)) for (let l = 0; l < o.length; l++) {
|
|
3001
|
-
const
|
|
3002
|
-
i.append(
|
|
2980
|
+
const c = Vn(o[l], e);
|
|
2981
|
+
i.append(c);
|
|
3003
2982
|
}
|
|
3004
2983
|
return i;
|
|
3005
2984
|
}
|
|
@@ -3015,23 +2994,23 @@ function Ar(n, e, t) {
|
|
|
3015
2994
|
function me(n, e) {
|
|
3016
2995
|
const t = n._pendingEditorState, r = n._rootElement, s = n._headless || r === null;
|
|
3017
2996
|
if (t === null) return;
|
|
3018
|
-
const i = n._editorState, o = i._selection, l = t._selection,
|
|
2997
|
+
const i = n._editorState, o = i._selection, l = t._selection, c = n._dirtyType !== Ee, a = R, f = Q, h = K, u = n._updating, d = n._observer;
|
|
3019
2998
|
let g = null;
|
|
3020
|
-
if (n._pendingEditorState = null, n._editorState = t, !s &&
|
|
2999
|
+
if (n._pendingEditorState = null, n._editorState = t, !s && c && d !== null) {
|
|
3021
3000
|
K = n, R = t, Q = !1, n._updating = !0;
|
|
3022
3001
|
try {
|
|
3023
3002
|
const v = n._dirtyType, P = n._dirtyElements, T = n._dirtyLeaves;
|
|
3024
|
-
d.disconnect(), g =
|
|
3003
|
+
d.disconnect(), g = Di(i, t, n, v, P, T);
|
|
3025
3004
|
} catch (v) {
|
|
3026
3005
|
if (v instanceof Error && n._onError(v), un) throw v;
|
|
3027
3006
|
return Ds(n, null, r, t), Qr(n), n._dirtyType = Me, un = !0, me(n, i), void (un = !1);
|
|
3028
3007
|
} finally {
|
|
3029
|
-
d.observe(r, Lr), n._updating = u, R =
|
|
3008
|
+
d.observe(r, Lr), n._updating = u, R = a, Q = f, K = h;
|
|
3030
3009
|
}
|
|
3031
3010
|
}
|
|
3032
3011
|
t._readOnly || (t._readOnly = !0);
|
|
3033
3012
|
const p = n._dirtyLeaves, _ = n._dirtyElements, m = n._normalizedNodes, y = n._updateTags, x = n._deferred;
|
|
3034
|
-
|
|
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(v, P) {
|
|
3035
3014
|
const T = v._decorators;
|
|
3036
3015
|
let E = v._pendingDecorators || T;
|
|
3037
3016
|
const D = P._nodeMap;
|
|
@@ -3039,16 +3018,16 @@ function me(n, e) {
|
|
|
3039
3018
|
for (O in E) D.has(O) || (E === T && (E = es(v)), delete E[O]);
|
|
3040
3019
|
}(n, t);
|
|
3041
3020
|
const C = s ? null : se(n._window);
|
|
3042
|
-
if (n._editable && C !== null && (
|
|
3021
|
+
if (n._editable && C !== null && (c || l === null || l.dirty)) {
|
|
3043
3022
|
K = n, R = t;
|
|
3044
3023
|
try {
|
|
3045
|
-
if (d !== null && d.disconnect(),
|
|
3024
|
+
if (d !== null && d.disconnect(), c || l === null || l.dirty) {
|
|
3046
3025
|
const v = n._blockCursorElement;
|
|
3047
|
-
v !== null && Kn(v, n, r),
|
|
3026
|
+
v !== null && Kn(v, n, r), Ki(o, l, n, C, y, r);
|
|
3048
3027
|
}
|
|
3049
|
-
|
|
3028
|
+
ki(n, r, l), d !== null && d.observe(r, Lr);
|
|
3050
3029
|
} finally {
|
|
3051
|
-
K = h, R =
|
|
3030
|
+
K = h, R = a;
|
|
3052
3031
|
}
|
|
3053
3032
|
}
|
|
3054
3033
|
g !== null && function(v, P, T, E, D) {
|
|
@@ -3106,8 +3085,8 @@ function Es(n, e, t) {
|
|
|
3106
3085
|
if (o !== void 0) {
|
|
3107
3086
|
const l = o[s];
|
|
3108
3087
|
if (l !== void 0) {
|
|
3109
|
-
const
|
|
3110
|
-
for (let f = 0; f <
|
|
3088
|
+
const c = Array.from(l), a = c.length;
|
|
3089
|
+
for (let f = 0; f < a; f++) if (c[f](t, n) === !0) return !0;
|
|
3111
3090
|
}
|
|
3112
3091
|
}
|
|
3113
3092
|
}
|
|
@@ -3123,8 +3102,8 @@ function Mr(n, e) {
|
|
|
3123
3102
|
let l;
|
|
3124
3103
|
if (o !== void 0) {
|
|
3125
3104
|
if (l = o.onUpdate, o.skipTransforms && (r = !0), o.discrete) {
|
|
3126
|
-
const
|
|
3127
|
-
|
|
3105
|
+
const c = n._pendingEditorState;
|
|
3106
|
+
c === null && k(191), c._flushSync = !0;
|
|
3128
3107
|
}
|
|
3129
3108
|
l && n._deferred.push(l), Ns(n, o.tag);
|
|
3130
3109
|
}
|
|
@@ -3138,12 +3117,12 @@ function Ps(n, e, t) {
|
|
|
3138
3117
|
let s, i = !1, o = !1;
|
|
3139
3118
|
t !== void 0 && (s = t.onUpdate, Ns(n, t.tag), i = t.skipTransforms || !1, o = t.discrete || !1), s && n._deferred.push(s);
|
|
3140
3119
|
const l = n._editorState;
|
|
3141
|
-
let
|
|
3142
|
-
(
|
|
3120
|
+
let c = n._pendingEditorState, a = !1;
|
|
3121
|
+
(c === null || c._readOnly) && (c = n._pendingEditorState = new Qt(new Map((c || l)._nodeMap)), a = !0), c._flushSync = o;
|
|
3143
3122
|
const f = R, h = Q, u = K, d = n._updating;
|
|
3144
|
-
R =
|
|
3123
|
+
R = c, Q = !1, n._updating = !0, K = n;
|
|
3145
3124
|
try {
|
|
3146
|
-
|
|
3125
|
+
a && (n._headless ? l._selection !== null && (c._selection = l._selection.clone()) : c._selection = function(m) {
|
|
3147
3126
|
const y = m.getEditorState()._selection, x = se(m._window);
|
|
3148
3127
|
return F(y) || y == null ? Ht(y, x, m, null) : y.clone();
|
|
3149
3128
|
}(n));
|
|
@@ -3158,13 +3137,13 @@ function Ps(n, e, t) {
|
|
|
3158
3137
|
P !== T && T.selectionTransform(x, C);
|
|
3159
3138
|
}
|
|
3160
3139
|
}
|
|
3161
|
-
}(
|
|
3140
|
+
}(c, n), n._dirtyType !== Ee && (i ? function(m, y) {
|
|
3162
3141
|
const x = y._dirtyLeaves, C = m._nodeMap;
|
|
3163
3142
|
for (const b of x) {
|
|
3164
3143
|
const v = C.get(b);
|
|
3165
3144
|
N(v) && v.isAttached() && v.isSimpleText() && !v.isUnmergeable() && rr(v);
|
|
3166
3145
|
}
|
|
3167
|
-
}(
|
|
3146
|
+
}(c, n) : function(m, y) {
|
|
3168
3147
|
const x = y._dirtyLeaves, C = y._dirtyElements, b = m._nodeMap, v = ye(), P = /* @__PURE__ */ new Map();
|
|
3169
3148
|
let T = x, E = T.size, D = C, O = D.size;
|
|
3170
3149
|
for (; E > 0 || O > 0; ) {
|
|
@@ -3189,7 +3168,7 @@ function Ps(n, e, t) {
|
|
|
3189
3168
|
T = y._dirtyLeaves, E = T.size, D = y._dirtyElements, O = D.size, pt++;
|
|
3190
3169
|
}
|
|
3191
3170
|
y._dirtyLeaves = x, y._dirtyElements = C;
|
|
3192
|
-
}(
|
|
3171
|
+
}(c, n), Mr(n), function(m, y, x, C) {
|
|
3193
3172
|
const b = m._nodeMap, v = y._nodeMap, P = [];
|
|
3194
3173
|
for (const [T] of C) {
|
|
3195
3174
|
const E = v.get(T);
|
|
@@ -3200,12 +3179,12 @@ function Ps(n, e, t) {
|
|
|
3200
3179
|
const E = v.get(T);
|
|
3201
3180
|
E === void 0 || E.isAttached() || (b.has(T) || x.delete(T), v.delete(T));
|
|
3202
3181
|
}
|
|
3203
|
-
}(l,
|
|
3204
|
-
const _ =
|
|
3182
|
+
}(l, c, n._dirtyLeaves, n._dirtyElements)), p !== n._compositionKey && (c._flushSync = !0);
|
|
3183
|
+
const _ = c._selection;
|
|
3205
3184
|
if (F(_)) {
|
|
3206
|
-
const m =
|
|
3185
|
+
const m = c._nodeMap, y = _.anchor.key, x = _.focus.key;
|
|
3207
3186
|
m.get(y) !== void 0 && m.get(x) !== void 0 || k(19);
|
|
3208
|
-
} else jt(_) && _._nodes.size === 0 && (
|
|
3187
|
+
} else jt(_) && _._nodes.size === 0 && (c._selection = null);
|
|
3209
3188
|
} catch (p) {
|
|
3210
3189
|
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);
|
|
3211
3190
|
} finally {
|
|
@@ -3217,9 +3196,9 @@ function Ps(n, e, t) {
|
|
|
3217
3196
|
if (y.dirty || !y.is(m)) return !0;
|
|
3218
3197
|
} else if (m !== null) return !0;
|
|
3219
3198
|
return !1;
|
|
3220
|
-
}(
|
|
3199
|
+
}(c, n) ? c._flushSync ? (c._flushSync = !1, me(n)) : a && xi(() => {
|
|
3221
3200
|
me(n);
|
|
3222
|
-
}) : (
|
|
3201
|
+
}) : (c._flushSync = !1, a && (r.clear(), n._deferred = [], n._pendingEditorState = null));
|
|
3223
3202
|
}
|
|
3224
3203
|
function X(n, e, t) {
|
|
3225
3204
|
n._updating ? n._updates.push([e, t]) : Ps(n, e, t);
|
|
@@ -3236,7 +3215,7 @@ class qt extends Ut {
|
|
|
3236
3215
|
}
|
|
3237
3216
|
getFormatType() {
|
|
3238
3217
|
const e = this.getFormat();
|
|
3239
|
-
return
|
|
3218
|
+
return ai[e] || "";
|
|
3240
3219
|
}
|
|
3241
3220
|
getStyle() {
|
|
3242
3221
|
return this.getLatest().__style;
|
|
@@ -3346,7 +3325,7 @@ class qt extends Ut {
|
|
|
3346
3325
|
const t = this.getChildren(), r = t.length;
|
|
3347
3326
|
for (let s = 0; s < r; s++) {
|
|
3348
3327
|
const i = t[s];
|
|
3349
|
-
e += i.getTextContent(), S(i) && s !== r - 1 && !i.isInline() && (e +=
|
|
3328
|
+
e += i.getTextContent(), S(i) && s !== r - 1 && !i.isInline() && (e += ae);
|
|
3350
3329
|
}
|
|
3351
3330
|
return e;
|
|
3352
3331
|
}
|
|
@@ -3355,7 +3334,7 @@ class qt extends Ut {
|
|
|
3355
3334
|
const t = this.getChildren(), r = t.length;
|
|
3356
3335
|
for (let s = 0; s < r; s++) {
|
|
3357
3336
|
const i = t[s];
|
|
3358
|
-
e += i.getTextContentSize(), S(i) && s !== r - 1 && !i.isInline() && (e +=
|
|
3337
|
+
e += i.getTextContentSize(), S(i) && s !== r - 1 && !i.isInline() && (e += ae.length);
|
|
3359
3338
|
}
|
|
3360
3339
|
return e;
|
|
3361
3340
|
}
|
|
@@ -3376,11 +3355,11 @@ class qt extends Ut {
|
|
|
3376
3355
|
const o = this.getChildrenSize();
|
|
3377
3356
|
if (!this.canBeEmpty()) {
|
|
3378
3357
|
if (e === 0 && t === 0) {
|
|
3379
|
-
const
|
|
3380
|
-
if (N(
|
|
3358
|
+
const c = this.getFirstChild();
|
|
3359
|
+
if (N(c) || S(c)) return c.select(0, 0);
|
|
3381
3360
|
} else if (!(e !== void 0 && e !== o || t !== void 0 && t !== o)) {
|
|
3382
|
-
const
|
|
3383
|
-
if (N(
|
|
3361
|
+
const c = this.getLastChild();
|
|
3362
|
+
if (N(c) || S(c)) return c.select();
|
|
3384
3363
|
}
|
|
3385
3364
|
}
|
|
3386
3365
|
s === void 0 && (s = o), i === void 0 && (i = o);
|
|
@@ -3416,7 +3395,7 @@ class qt extends Ut {
|
|
|
3416
3395
|
return this.getWritable().__indent = e, this;
|
|
3417
3396
|
}
|
|
3418
3397
|
splice(e, t, r) {
|
|
3419
|
-
const s = r.length, i = this.getChildrenSize(), o = this.getWritable(), l = o.__key,
|
|
3398
|
+
const s = r.length, i = this.getChildrenSize(), o = this.getWritable(), l = o.__key, c = [], a = [], f = this.getChildAtIndex(e + t);
|
|
3420
3399
|
let h = null, u = i - t + s;
|
|
3421
3400
|
if (e !== 0) if (e === i) h = this.getLastChild();
|
|
3422
3401
|
else {
|
|
@@ -3428,7 +3407,7 @@ class qt extends Ut {
|
|
|
3428
3407
|
for (let p = 0; p < t; p++) {
|
|
3429
3408
|
g === null && k(100);
|
|
3430
3409
|
const _ = g.getNextSibling(), m = g.__key;
|
|
3431
|
-
Ne(g.getWritable()),
|
|
3410
|
+
Ne(g.getWritable()), a.push(m), g = _;
|
|
3432
3411
|
}
|
|
3433
3412
|
}
|
|
3434
3413
|
let d = h;
|
|
@@ -3443,7 +3422,7 @@ class qt extends Ut {
|
|
|
3443
3422
|
const y = d.getWritable();
|
|
3444
3423
|
y.__next = m, _.__prev = y.__key;
|
|
3445
3424
|
}
|
|
3446
|
-
p.__key === l && k(76), _.__parent = l,
|
|
3425
|
+
p.__key === l && k(76), _.__parent = l, c.push(m), d = p;
|
|
3447
3426
|
}
|
|
3448
3427
|
if (e + t === i)
|
|
3449
3428
|
d !== null && (d.getWritable().__next = null, o.__last = d.__key);
|
|
@@ -3454,10 +3433,10 @@ class qt extends Ut {
|
|
|
3454
3433
|
g.__prev = d.__key, p.__next = f.__key;
|
|
3455
3434
|
} else g.__prev = null;
|
|
3456
3435
|
}
|
|
3457
|
-
if (o.__size = u,
|
|
3436
|
+
if (o.__size = u, a.length) {
|
|
3458
3437
|
const g = I();
|
|
3459
3438
|
if (F(g)) {
|
|
3460
|
-
const p = new Set(
|
|
3439
|
+
const p = new Set(a), _ = new Set(c), { anchor: m, focus: y } = g;
|
|
3461
3440
|
Wr(m, p, _) && Ot(m, m.getNode(), this, h, f), Wr(y, p, _) && Ot(y, y.getNode(), this, h, f), u !== 0 || this.canBeEmpty() || Pe(this) || this.remove();
|
|
3462
3441
|
}
|
|
3463
3442
|
}
|
|
@@ -3521,7 +3500,7 @@ function Wr(n, e, t) {
|
|
|
3521
3500
|
}
|
|
3522
3501
|
return !1;
|
|
3523
3502
|
}
|
|
3524
|
-
class
|
|
3503
|
+
class Ui extends Ut {
|
|
3525
3504
|
constructor(e) {
|
|
3526
3505
|
super(e);
|
|
3527
3506
|
}
|
|
@@ -3539,14 +3518,14 @@ class Qi extends Ut {
|
|
|
3539
3518
|
}
|
|
3540
3519
|
}
|
|
3541
3520
|
function A(n) {
|
|
3542
|
-
return n instanceof
|
|
3521
|
+
return n instanceof Ui;
|
|
3543
3522
|
}
|
|
3544
|
-
class
|
|
3523
|
+
class ct extends qt {
|
|
3545
3524
|
static getType() {
|
|
3546
3525
|
return "root";
|
|
3547
3526
|
}
|
|
3548
3527
|
static clone() {
|
|
3549
|
-
return new
|
|
3528
|
+
return new ct();
|
|
3550
3529
|
}
|
|
3551
3530
|
constructor() {
|
|
3552
3531
|
super("root"), this.__cachedText = null;
|
|
@@ -3592,10 +3571,10 @@ class at extends qt {
|
|
|
3592
3571
|
}
|
|
3593
3572
|
}
|
|
3594
3573
|
function Z(n) {
|
|
3595
|
-
return n instanceof
|
|
3574
|
+
return n instanceof ct;
|
|
3596
3575
|
}
|
|
3597
3576
|
function jn() {
|
|
3598
|
-
return new Qt(/* @__PURE__ */ new Map([["root", new
|
|
3577
|
+
return new Qt(/* @__PURE__ */ new Map([["root", new ct()]]));
|
|
3599
3578
|
}
|
|
3600
3579
|
function Fs(n) {
|
|
3601
3580
|
const e = n.exportJSON(), t = n.constructor;
|
|
@@ -3628,7 +3607,7 @@ class Qt {
|
|
|
3628
3607
|
return Ar(null, this, () => ({ root: Fs(G()) }));
|
|
3629
3608
|
}
|
|
3630
3609
|
}
|
|
3631
|
-
class
|
|
3610
|
+
class Vi extends qt {
|
|
3632
3611
|
static getType() {
|
|
3633
3612
|
return "artificial";
|
|
3634
3613
|
}
|
|
@@ -3651,7 +3630,7 @@ class ze extends qt {
|
|
|
3651
3630
|
return t.__textFormat = e, t;
|
|
3652
3631
|
}
|
|
3653
3632
|
hasTextFormat(e) {
|
|
3654
|
-
const t =
|
|
3633
|
+
const t = ce[e];
|
|
3655
3634
|
return !!(this.getTextFormat() & t);
|
|
3656
3635
|
}
|
|
3657
3636
|
getFormatFlags(e, t) {
|
|
@@ -3678,11 +3657,11 @@ class ze extends qt {
|
|
|
3678
3657
|
return !1;
|
|
3679
3658
|
}
|
|
3680
3659
|
static importDOM() {
|
|
3681
|
-
return { p: (e) => ({ conversion:
|
|
3660
|
+
return { p: (e) => ({ conversion: ji, priority: 0 }) };
|
|
3682
3661
|
}
|
|
3683
3662
|
exportDOM(e) {
|
|
3684
3663
|
const { element: t } = super.exportDOM(e);
|
|
3685
|
-
if (t &&
|
|
3664
|
+
if (t && Jn(t)) {
|
|
3686
3665
|
this.isEmpty() && t.append(document.createElement("br"));
|
|
3687
3666
|
const r = this.getFormatType();
|
|
3688
3667
|
t.style.textAlign = r;
|
|
@@ -3715,7 +3694,7 @@ class ze extends qt {
|
|
|
3715
3694
|
return !1;
|
|
3716
3695
|
}
|
|
3717
3696
|
}
|
|
3718
|
-
function
|
|
3697
|
+
function ji(n) {
|
|
3719
3698
|
const e = ve();
|
|
3720
3699
|
if (n.style) {
|
|
3721
3700
|
e.setFormat(n.style.textAlign);
|
|
@@ -3725,26 +3704,26 @@ function Zi(n) {
|
|
|
3725
3704
|
return { node: e };
|
|
3726
3705
|
}
|
|
3727
3706
|
function ve() {
|
|
3728
|
-
return
|
|
3707
|
+
return Jt(new ze());
|
|
3729
3708
|
}
|
|
3730
3709
|
function kn(n) {
|
|
3731
3710
|
return n instanceof ze;
|
|
3732
3711
|
}
|
|
3733
|
-
const
|
|
3712
|
+
const _o = 0, po = 1, yo = 3, mo = 4;
|
|
3734
3713
|
function Ds(n, e, t, r) {
|
|
3735
3714
|
const s = n._keyToDOMMap;
|
|
3736
3715
|
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;
|
|
3737
3716
|
const i = n._observer;
|
|
3738
3717
|
i !== null && (i.disconnect(), n._observer = null), e !== null && (e.textContent = ""), t !== null && (t.textContent = "", s.set("root", t));
|
|
3739
3718
|
}
|
|
3740
|
-
function
|
|
3741
|
-
const e = n || {}, t =
|
|
3719
|
+
function xo(n) {
|
|
3720
|
+
const e = n || {}, t = $i(), 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, We, st, it, ze, Vi, ...e.nodes || []], { onError: f, html: h } = e, u = e.editable === void 0 || e.editable;
|
|
3742
3721
|
let d;
|
|
3743
3722
|
if (n === void 0 && t !== null) d = t._nodes;
|
|
3744
3723
|
else {
|
|
3745
3724
|
d = /* @__PURE__ */ new Map();
|
|
3746
|
-
for (let p = 0; p <
|
|
3747
|
-
let _ =
|
|
3725
|
+
for (let p = 0; p < a.length; p++) {
|
|
3726
|
+
let _ = a[p], m = null, y = null;
|
|
3748
3727
|
if (typeof _ != "function") {
|
|
3749
3728
|
const v = _;
|
|
3750
3729
|
_ = v.replace, m = v.with, y = v.withKlass || null;
|
|
@@ -3768,7 +3747,7 @@ function No(n) {
|
|
|
3768
3747
|
v !== null && x(v);
|
|
3769
3748
|
}), _ && x(_), m;
|
|
3770
3749
|
}(d, h ? h.import : void 0), u);
|
|
3771
|
-
return
|
|
3750
|
+
return c !== void 0 && (g._pendingEditorState = c, g._dirtyType = Me), g;
|
|
3772
3751
|
}
|
|
3773
3752
|
class Xt {
|
|
3774
3753
|
constructor(e, t, r, s, i, o, l) {
|
|
@@ -3835,7 +3814,7 @@ class Xt {
|
|
|
3835
3814
|
return e;
|
|
3836
3815
|
}
|
|
3837
3816
|
initializeMutationListener(e, t) {
|
|
3838
|
-
const r = this._editorState, s =
|
|
3817
|
+
const r = this._editorState, s = Ni(r).get(t.getType());
|
|
3839
3818
|
if (!s) return;
|
|
3840
3819
|
const i = /* @__PURE__ */ new Map();
|
|
3841
3820
|
for (const o of s.keys()) i.set(o, "created");
|
|
@@ -3848,18 +3827,18 @@ class Xt {
|
|
|
3848
3827
|
registerNodeTransform(e, t) {
|
|
3849
3828
|
const r = this.registerNodeTransformToKlass(e, t), s = [r], i = r.replaceWithKlass;
|
|
3850
3829
|
if (i != null) {
|
|
3851
|
-
const
|
|
3852
|
-
s.push(
|
|
3830
|
+
const c = this.registerNodeTransformToKlass(i, t);
|
|
3831
|
+
s.push(c);
|
|
3853
3832
|
}
|
|
3854
3833
|
var o, l;
|
|
3855
3834
|
return o = this, l = e.getType(), X(o, () => {
|
|
3856
|
-
const
|
|
3857
|
-
if (
|
|
3835
|
+
const c = fe();
|
|
3836
|
+
if (c.isEmpty()) return;
|
|
3858
3837
|
if (l === "root") return void G().markDirty();
|
|
3859
|
-
const
|
|
3860
|
-
for (const [, f] of
|
|
3838
|
+
const a = c._nodeMap;
|
|
3839
|
+
for (const [, f] of a) f.markDirty();
|
|
3861
3840
|
}, o._pendingEditorState === null ? { tag: "history-merge" } : void 0), () => {
|
|
3862
|
-
s.forEach((
|
|
3841
|
+
s.forEach((c) => c.transforms.delete(t));
|
|
3863
3842
|
};
|
|
3864
3843
|
}
|
|
3865
3844
|
hasNode(e) {
|
|
@@ -3884,41 +3863,41 @@ class Xt {
|
|
|
3884
3863
|
const t = this._rootElement;
|
|
3885
3864
|
if (e !== t) {
|
|
3886
3865
|
const r = qe(this._config.theme, "root"), s = this._pendingEditorState || this._editorState;
|
|
3887
|
-
if (this._rootElement = e, Ds(this, t, e, s), t !== null && (this._config.disableEvents ||
|
|
3866
|
+
if (this._rootElement = e, Ds(this, t, e, s), t !== null && (this._config.disableEvents || Li(t), r != null && t.classList.remove(...r)), e !== null) {
|
|
3888
3867
|
const i = function(l) {
|
|
3889
|
-
const
|
|
3890
|
-
return
|
|
3868
|
+
const c = l.ownerDocument;
|
|
3869
|
+
return c && c.defaultView || null;
|
|
3891
3870
|
}(e), o = e.style;
|
|
3892
|
-
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,
|
|
3893
|
-
const
|
|
3894
|
-
(f === void 0 || f < 1) &&
|
|
3871
|
+
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, f = Dt.get(a);
|
|
3873
|
+
(f === void 0 || f < 1) && a.addEventListener("selectionchange", xs), Dt.set(a, (f || 0) + 1), l.__lexicalEditor = c;
|
|
3895
3874
|
const h = ms(l);
|
|
3896
3875
|
for (let u = 0; u < vn.length; u++) {
|
|
3897
3876
|
const [d, g] = vn[u], p = typeof g == "function" ? (_) => {
|
|
3898
|
-
xr(_) || (mr(_), (
|
|
3877
|
+
xr(_) || (mr(_), (c.isEditable() || d === "click") && g(_, c));
|
|
3899
3878
|
} : (_) => {
|
|
3900
3879
|
if (xr(_)) return;
|
|
3901
3880
|
mr(_);
|
|
3902
|
-
const m =
|
|
3881
|
+
const m = c.isEditable();
|
|
3903
3882
|
switch (d) {
|
|
3904
3883
|
case "cut":
|
|
3905
|
-
return m && w(
|
|
3884
|
+
return m && w(c, Jr, _);
|
|
3906
3885
|
case "copy":
|
|
3907
|
-
return w(
|
|
3886
|
+
return w(c, Kr, _);
|
|
3908
3887
|
case "paste":
|
|
3909
|
-
return m && w(
|
|
3888
|
+
return m && w(c, zr, _);
|
|
3910
3889
|
case "dragstart":
|
|
3911
|
-
return m && w(
|
|
3890
|
+
return m && w(c, js, _);
|
|
3912
3891
|
case "dragover":
|
|
3913
|
-
return m && w(
|
|
3892
|
+
return m && w(c, Hs, _);
|
|
3914
3893
|
case "dragend":
|
|
3915
|
-
return m && w(
|
|
3894
|
+
return m && w(c, qs, _);
|
|
3916
3895
|
case "focus":
|
|
3917
|
-
return m && w(
|
|
3896
|
+
return m && w(c, Qs, _);
|
|
3918
3897
|
case "blur":
|
|
3919
|
-
return m && w(
|
|
3898
|
+
return m && w(c, Xs, _);
|
|
3920
3899
|
case "drop":
|
|
3921
|
-
return m && w(
|
|
3900
|
+
return m && w(c, Vs, _);
|
|
3922
3901
|
}
|
|
3923
3902
|
};
|
|
3924
3903
|
l.addEventListener(d, p), h.push(() => {
|
|
@@ -3943,7 +3922,7 @@ class Xt {
|
|
|
3943
3922
|
}
|
|
3944
3923
|
parseEditorState(e, t) {
|
|
3945
3924
|
return function(r, s, i) {
|
|
3946
|
-
const o = jn(), l = R,
|
|
3925
|
+
const o = jn(), l = R, c = Q, a = K, f = s._dirtyElements, h = s._dirtyLeaves, u = s._cloneNotNeeded, d = s._dirtyType;
|
|
3947
3926
|
s._dirtyElements = /* @__PURE__ */ new Map(), s._dirtyLeaves = /* @__PURE__ */ new Set(), s._cloneNotNeeded = /* @__PURE__ */ new Set(), s._dirtyType = 0, R = o, Q = !1, K = s;
|
|
3948
3927
|
try {
|
|
3949
3928
|
const g = s._nodes;
|
|
@@ -3951,7 +3930,7 @@ class Xt {
|
|
|
3951
3930
|
} catch (g) {
|
|
3952
3931
|
g instanceof Error && s._onError(g);
|
|
3953
3932
|
} finally {
|
|
3954
|
-
s._dirtyElements = f, s._dirtyLeaves = h, s._cloneNotNeeded = u, s._dirtyType = d, R = l, Q =
|
|
3933
|
+
s._dirtyElements = f, s._dirtyLeaves = h, s._cloneNotNeeded = u, s._dirtyType = d, R = l, Q = c, K = a;
|
|
3955
3934
|
}
|
|
3956
3935
|
return o;
|
|
3957
3936
|
}(typeof e == "string" ? JSON.parse(e) : e, this, t);
|
|
@@ -3989,98 +3968,95 @@ class Xt {
|
|
|
3989
3968
|
}
|
|
3990
3969
|
Xt.version = "0.18.0+prod.esm";
|
|
3991
3970
|
export {
|
|
3992
|
-
|
|
3971
|
+
no as $,
|
|
3993
3972
|
ot as A,
|
|
3994
|
-
|
|
3973
|
+
go as B,
|
|
3995
3974
|
hr as C,
|
|
3996
|
-
|
|
3997
|
-
|
|
3975
|
+
mo as D,
|
|
3976
|
+
ao as E,
|
|
3998
3977
|
kn as F,
|
|
3999
3978
|
Mt as G,
|
|
4000
|
-
|
|
3979
|
+
co as H,
|
|
4001
3980
|
I,
|
|
4002
3981
|
Ae as J,
|
|
4003
|
-
|
|
4004
|
-
|
|
3982
|
+
to as K,
|
|
3983
|
+
po as L,
|
|
4005
3984
|
Kr as M,
|
|
4006
3985
|
zt as N,
|
|
4007
|
-
|
|
3986
|
+
Bs as O,
|
|
4008
3987
|
ve as P,
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
3988
|
+
yo as Q,
|
|
3989
|
+
zs as R,
|
|
3990
|
+
lo as S,
|
|
4012
3991
|
br as T,
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
3992
|
+
Ms as U,
|
|
3993
|
+
Is as V,
|
|
3994
|
+
Js as W,
|
|
4016
3995
|
dr as X,
|
|
4017
3996
|
We as Y,
|
|
4018
3997
|
mt as Z,
|
|
4019
|
-
|
|
4020
|
-
|
|
3998
|
+
ro as _,
|
|
3999
|
+
Zn as a,
|
|
4021
4000
|
xt as a0,
|
|
4022
4001
|
yt as a1,
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4002
|
+
Ks as a2,
|
|
4003
|
+
$s as a3,
|
|
4004
|
+
Jr as a4,
|
|
4005
|
+
Gi as a5,
|
|
4027
4006
|
He as a6,
|
|
4028
|
-
|
|
4029
|
-
|
|
4007
|
+
Us as a7,
|
|
4008
|
+
Qs as a8,
|
|
4030
4009
|
bn as a9,
|
|
4031
|
-
Zr as aA,
|
|
4032
|
-
ao as aB,
|
|
4033
|
-
lo as aC,
|
|
4034
4010
|
ue as aa,
|
|
4035
|
-
|
|
4011
|
+
fo as ab,
|
|
4036
4012
|
V as ac,
|
|
4037
|
-
|
|
4038
|
-
|
|
4013
|
+
uo as ad,
|
|
4014
|
+
yi as ae,
|
|
4039
4015
|
lt as af,
|
|
4040
4016
|
ie as ag,
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4017
|
+
xo as ah,
|
|
4018
|
+
zr as ai,
|
|
4019
|
+
Xr as aj,
|
|
4020
|
+
_o as ak,
|
|
4021
|
+
Yn as al,
|
|
4022
|
+
so as am,
|
|
4023
|
+
Hs as an,
|
|
4024
|
+
js as ao,
|
|
4025
|
+
Vs as ap,
|
|
4026
|
+
fn as aq,
|
|
4027
|
+
gt as ar,
|
|
4028
|
+
Zi as as,
|
|
4029
|
+
Xi as at,
|
|
4030
|
+
Qi as au,
|
|
4031
|
+
ho as av,
|
|
4032
|
+
Gn as aw,
|
|
4033
|
+
Zr as ax,
|
|
4034
|
+
eo as ay,
|
|
4035
|
+
Yi as az,
|
|
4036
|
+
Pe as b,
|
|
4037
|
+
io as c,
|
|
4062
4038
|
we as d,
|
|
4063
4039
|
jt as e,
|
|
4064
|
-
|
|
4040
|
+
Jt as f,
|
|
4065
4041
|
Rr as g,
|
|
4066
4042
|
Br as h,
|
|
4067
4043
|
A as i,
|
|
4068
4044
|
Z as j,
|
|
4069
|
-
|
|
4045
|
+
Vi as k,
|
|
4070
4046
|
N as l,
|
|
4071
4047
|
F as m,
|
|
4072
4048
|
nt as n,
|
|
4073
|
-
|
|
4049
|
+
J as o,
|
|
4074
4050
|
qt as p,
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4051
|
+
Ei as q,
|
|
4052
|
+
Ls as r,
|
|
4053
|
+
bi as s,
|
|
4054
|
+
Hi as t,
|
|
4055
|
+
Un as u,
|
|
4056
|
+
Jn as v,
|
|
4081
4057
|
G as w,
|
|
4082
|
-
|
|
4058
|
+
oo as x,
|
|
4083
4059
|
S as y,
|
|
4084
|
-
|
|
4060
|
+
qi as z
|
|
4085
4061
|
};
|
|
4086
|
-
//# sourceMappingURL=Lexical.prod-
|
|
4062
|
+
//# sourceMappingURL=Lexical.prod-CO0gPAfo.js.map
|