@uva-glass/component-library 1.54.0 → 1.55.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/AddTableFrom-CwnPli3F.js +162 -0
- package/dist/AddTableFrom-CwnPli3F.js.map +1 -0
- package/dist/{Lexical.prod-DNRTKPfN.js → Lexical.prod-BiuZHlIm.js} +927 -897
- package/dist/Lexical.prod-BiuZHlIm.js.map +1 -0
- package/dist/LexicalUtils.prod-BZOm66mY.js +94 -0
- package/dist/{LexicalUtils.prod-D_BPEjfg.js.map → LexicalUtils.prod-BZOm66mY.js.map} +1 -1
- package/dist/{ListPlugin-CgNBzfIl.js → ListPlugin-DFFbKLaN.js} +4 -4
- package/dist/{ListPlugin-CgNBzfIl.js.map → ListPlugin-DFFbKLaN.js.map} +1 -1
- package/dist/RteEditor.module-BBbfV1rk.js +24 -0
- package/dist/RteEditor.module-BBbfV1rk.js.map +1 -0
- package/dist/TablePlugin-CKJQiwra.js +1506 -0
- package/dist/TablePlugin-CKJQiwra.js.map +1 -0
- package/dist/assets/AddTableFrom.css +1 -0
- package/dist/assets/PageOverlay.css +1 -0
- package/dist/assets/RteEditor.css +1 -1
- package/dist/assets/useFlyout.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/Icon/icons/index.d.ts +3 -0
- package/dist/components/Icon/icons/index.js +18 -13
- package/dist/components/Icon/icons/index.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/PageOverlay/PageOverlay.d.ts +25 -0
- package/dist/components/PageOverlay/PageOverlay.js +100 -0
- package/dist/components/PageOverlay/PageOverlay.js.map +1 -0
- package/dist/components/PageOverlay/PageOverlay.stories.d.ts +7 -0
- package/dist/components/PageOverlay/PageOverlay.stories.js +167 -0
- package/dist/components/PageOverlay/PageOverlay.stories.js.map +1 -0
- package/dist/components/PageOverlay/index.d.ts +1 -0
- package/dist/components/PageOverlay/index.js +5 -0
- package/dist/components/PageOverlay/index.js.map +1 -0
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.d.ts +12 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +28 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js.map +1 -0
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +47 -68
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.d.ts +10 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +25 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +29 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +5 -0
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js.map +1 -0
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +26 -24
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/index.d.ts +1 -0
- package/dist/components/RteEditor/Plugins/index.js +6 -4
- package/dist/components/RteEditor/Plugins/index.js.map +1 -1
- package/dist/components/RteEditor/RteEditor.js +557 -774
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/UvaTheme/UvaTheme.d.ts +1 -0
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js +5 -4
- package/dist/components/RteEditor/UvaTheme/UvaTheme.js.map +1 -1
- package/dist/components/RteEditor/hooks/useFlyout.d.ts +1 -0
- package/dist/components/RteEditor/hooks/useFlyout.js +18 -38
- package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -1
- package/dist/components/hooks/useOnClickOuside.d.ts +4 -0
- package/dist/components/hooks/useOnClickOuside.js +15 -0
- package/dist/components/hooks/useOnClickOuside.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +40 -38
- package/dist/components/index.js.map +1 -1
- package/dist/{helpers-TSjo3aAv.js → helpers-CJF7fErD.js} +3 -3
- package/dist/{helpers-TSjo3aAv.js.map → helpers-CJF7fErD.js.map} +1 -1
- package/dist/index.js +40 -38
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/Lexical.prod-DNRTKPfN.js.map +0 -1
- package/dist/LexicalUtils.prod-D_BPEjfg.js +0 -64
- package/dist/MultiSelect-DQaqItEH.js +0 -55
- package/dist/MultiSelect-DQaqItEH.js.map +0 -1
- package/dist/RteEditor.module-BjGyWKhW.js +0 -26
- package/dist/RteEditor.module-BjGyWKhW.js.map +0 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
function
|
|
1
|
+
import { createContext as Ls, useContext as Os } from "react";
|
|
2
|
+
function Is(n) {
|
|
3
3
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
4
4
|
}
|
|
5
|
-
var
|
|
5
|
+
var As = Is(function(n) {
|
|
6
6
|
const e = new URLSearchParams();
|
|
7
7
|
e.append("code", n);
|
|
8
8
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
9
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
10
|
});
|
|
11
|
-
const
|
|
12
|
-
function
|
|
11
|
+
const Ms = Ls(null);
|
|
12
|
+
function Yi(n, e) {
|
|
13
13
|
let t = null;
|
|
14
14
|
return { getTheme: function() {
|
|
15
15
|
return e ?? (t != null ? t.getTheme() : null);
|
|
16
16
|
} };
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
const n =
|
|
20
|
-
return n == null &&
|
|
18
|
+
function eo() {
|
|
19
|
+
const n = Os(Ms);
|
|
20
|
+
return n == null && As(8), n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function to(n) {
|
|
23
23
|
return {};
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const bn = {}, no = {}, Ws = {}, yt = {}, gt = {}, Zn = {}, He = {}, zr = {}, Gn = {}, mt = {}, xt = {}, we = {}, Br = {}, Rr = {}, zs = {}, Bs = {}, Rs = {}, Ks = {}, $s = {}, Js = {}, Us = {}, fn = {}, Vs = {}, js = {}, Hs = {}, qs = {}, Qs = {}, ro = {}, so = {}, io = {}, Xs = {}, oo = {}, Zs = {}, Gs = {}, Ys = {}, Kr = {}, $r = {}, Yn = {}, lo = {}, ao = {}, co = {}, uo = {}, ei = {}, ti = {}, ni = {}, ne = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, ri = 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) || ri) && "getTargetRanges" in new window.InputEvent("input"), wn = ne && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), It = ne && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, si = ne && /Android/.test(navigator.userAgent), Jr = ne && /^(?=.*Chrome).*/i.test(navigator.userAgent), ii = ne && si && Jr, Nn = ne && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Jr, rt = 1, Te = 3, Ee = 0, Ur = 1, Me = 2, oi = 0, li = 1, ai = 2, St = 4, Tt = 8, En = 128, ci = 112 | (3 | St | Tt) | En, Pn = 1, Fn = 2, Dn = 3, Ln = 4, On = 5, In = 6, At = wn || It || Nn ? " " : "", ce = `
|
|
26
26
|
|
|
27
|
-
`,
|
|
28
|
-
function
|
|
27
|
+
`, ui = xe ? " " : At, Vr = "֑-߿יִ-﷽ﹰ-ﻼ", jr = "A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--", fi = new RegExp("^[^" + jr + "]*[" + Vr + "]"), di = new RegExp("^[^" + Vr + "]*[" + jr + "]"), ae = { bold: 1, code: 16, highlight: En, italic: 2, strikethrough: St, subscript: 32, superscript: 64, underline: Tt }, hi = { directionless: 1, unmergeable: 2 }, er = { center: Fn, end: In, justify: Ln, left: Pn, right: Dn, start: On }, gi = { [Fn]: "center", [In]: "end", [Ln]: "justify", [Pn]: "left", [Dn]: "right", [On]: "start" }, _i = { normal: 0, segmented: 2, token: 1 }, pi = { [oi]: "normal", [ai]: "segmented", [li]: "token" };
|
|
28
|
+
function yi(n) {
|
|
29
29
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
30
30
|
}
|
|
31
|
-
var
|
|
31
|
+
var k = yi(function(n) {
|
|
32
32
|
const e = new URLSearchParams();
|
|
33
33
|
e.append("code", n);
|
|
34
34
|
for (let t = 1; t < arguments.length; t++) e.append("v", arguments[t]);
|
|
@@ -39,22 +39,22 @@ function Ct(...n) {
|
|
|
39
39
|
for (const t of n) if (t && typeof t == "string") for (const [r] of t.matchAll(/\S+/g)) e.push(r);
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
let
|
|
44
|
-
function
|
|
45
|
-
|
|
42
|
+
const mi = 100;
|
|
43
|
+
let dn = !1, An = 0;
|
|
44
|
+
function xi(n) {
|
|
45
|
+
An = n.timeStamp;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function en(n, e, t) {
|
|
48
48
|
return e.__lexicalLineBreak === n || n[`__lexicalKey_${t._key}`] !== void 0;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function vi(n, e, t) {
|
|
51
51
|
const r = se(t._window);
|
|
52
52
|
let s = null, i = null;
|
|
53
53
|
r !== null && r.anchorNode === n && (s = r.anchorOffset, i = r.focusOffset);
|
|
54
54
|
const o = n.nodeValue;
|
|
55
|
-
o !== null &&
|
|
55
|
+
o !== null && Bn(e, o, s, i, !1);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Si(n, e, t) {
|
|
58
58
|
if (F(n)) {
|
|
59
59
|
const r = n.anchor.getNode();
|
|
60
60
|
if (r.is(t) && n.format !== r.getFormat()) return !1;
|
|
@@ -62,8 +62,8 @@ function vi(n, e, t) {
|
|
|
62
62
|
return e.nodeType === Te && t.isAttached();
|
|
63
63
|
}
|
|
64
64
|
function Hr(n, e, t) {
|
|
65
|
-
|
|
66
|
-
const r = performance.now() -
|
|
65
|
+
dn = !0;
|
|
66
|
+
const r = performance.now() - An > mi;
|
|
67
67
|
try {
|
|
68
68
|
X(n, () => {
|
|
69
69
|
const s = I() || function(u) {
|
|
@@ -71,34 +71,34 @@ function Hr(n, e, t) {
|
|
|
71
71
|
const d = I();
|
|
72
72
|
return d !== null ? d.clone() : null;
|
|
73
73
|
});
|
|
74
|
-
}(n), i = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState,
|
|
75
|
-
let
|
|
74
|
+
}(n), i = /* @__PURE__ */ new Map(), o = n.getRootElement(), l = n._editorState, a = n._blockCursorElement;
|
|
75
|
+
let c = !1, f = "";
|
|
76
76
|
for (let u = 0; u < e.length; u++) {
|
|
77
77
|
const d = e[u], g = d.type, p = d.target;
|
|
78
78
|
let _ = zt(p, l);
|
|
79
79
|
if (!(_ === null && p !== o || A(_))) {
|
|
80
|
-
if (g === "characterData") r && N(_) &&
|
|
80
|
+
if (g === "characterData") r && N(_) && Si(s, p, _) && vi(p, _, n);
|
|
81
81
|
else if (g === "childList") {
|
|
82
|
-
|
|
82
|
+
c = !0;
|
|
83
83
|
const m = d.addedNodes;
|
|
84
84
|
for (let C = 0; C < m.length; C++) {
|
|
85
|
-
const
|
|
86
|
-
if (P != null &&
|
|
85
|
+
const b = m[C], v = Yr(b), P = b.parentNode;
|
|
86
|
+
if (P != null && b !== a && v === null && (b.nodeName !== "BR" || !en(b, P, n))) {
|
|
87
87
|
if (xe) {
|
|
88
|
-
const T =
|
|
88
|
+
const T = b.innerText || b.nodeValue;
|
|
89
89
|
T && (f += T);
|
|
90
90
|
}
|
|
91
|
-
P.removeChild(
|
|
91
|
+
P.removeChild(b);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
const y = d.removedNodes, x = y.length;
|
|
95
95
|
if (x > 0) {
|
|
96
96
|
let C = 0;
|
|
97
|
-
for (let
|
|
98
|
-
const v = y[
|
|
99
|
-
(v.nodeName === "BR" &&
|
|
97
|
+
for (let b = 0; b < x; b++) {
|
|
98
|
+
const v = y[b];
|
|
99
|
+
(v.nodeName === "BR" && en(v, p, n) || a === v) && (p.appendChild(v), C++);
|
|
100
100
|
}
|
|
101
|
-
x !== C && (p === o && (_ =
|
|
101
|
+
x !== C && (p === o && (_ = ts(l)), i.set(p, _));
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -117,15 +117,15 @@ function Hr(n, e, t) {
|
|
|
117
117
|
const d = h[u], g = d.addedNodes, p = d.target;
|
|
118
118
|
for (let _ = 0; _ < g.length; _++) {
|
|
119
119
|
const m = g[_], y = m.parentNode;
|
|
120
|
-
y == null || m.nodeName !== "BR" ||
|
|
120
|
+
y == null || m.nodeName !== "BR" || en(m, p, n) || y.removeChild(m);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
t.takeRecords();
|
|
124
124
|
}
|
|
125
|
-
s !== null && (
|
|
125
|
+
s !== null && (c && (s.dirty = !0, ue(s)), xe && is(n) && s.insertRawText(f));
|
|
126
126
|
});
|
|
127
127
|
} finally {
|
|
128
|
-
|
|
128
|
+
dn = !1;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
function qr(n) {
|
|
@@ -134,7 +134,7 @@ function qr(n) {
|
|
|
134
134
|
}
|
|
135
135
|
function Qr(n) {
|
|
136
136
|
(function(e) {
|
|
137
|
-
|
|
137
|
+
An === 0 && Kt(e).addEventListener("textInput", xi, !0);
|
|
138
138
|
})(n), n._observer = new MutationObserver((e, t) => {
|
|
139
139
|
Hr(n, e, t);
|
|
140
140
|
});
|
|
@@ -172,7 +172,7 @@ function rr(n) {
|
|
|
172
172
|
}
|
|
173
173
|
} else r.remove();
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function Ti(n) {
|
|
176
176
|
return sr(n.anchor), sr(n.focus), n;
|
|
177
177
|
}
|
|
178
178
|
function sr(n) {
|
|
@@ -187,8 +187,8 @@ function sr(n) {
|
|
|
187
187
|
n.set(r.__key, s ? r.getChildrenSize() : 0, "element");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
let
|
|
191
|
-
const
|
|
190
|
+
let Ci = 1;
|
|
191
|
+
const ki = typeof queueMicrotask == "function" ? queueMicrotask : (n) => {
|
|
192
192
|
Promise.resolve().then(n);
|
|
193
193
|
};
|
|
194
194
|
function Xr(n) {
|
|
@@ -205,14 +205,14 @@ function Mt(n, e, t) {
|
|
|
205
205
|
return !1;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
return n instanceof
|
|
208
|
+
function Mn(n) {
|
|
209
|
+
return n instanceof Xt;
|
|
210
210
|
}
|
|
211
211
|
function Zr(n) {
|
|
212
212
|
let e = n;
|
|
213
213
|
for (; e != null; ) {
|
|
214
214
|
const t = Wt(e);
|
|
215
|
-
if (
|
|
215
|
+
if (Mn(t)) return t;
|
|
216
216
|
e = Rt(e);
|
|
217
217
|
}
|
|
218
218
|
return null;
|
|
@@ -223,30 +223,30 @@ function Wt(n) {
|
|
|
223
223
|
function be(n) {
|
|
224
224
|
return n.isToken() || n.isSegmented();
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function bi(n) {
|
|
227
227
|
return n.nodeType === Te;
|
|
228
228
|
}
|
|
229
229
|
function kt(n) {
|
|
230
230
|
let e = n;
|
|
231
231
|
for (; e != null; ) {
|
|
232
|
-
if (
|
|
232
|
+
if (bi(e)) return e;
|
|
233
233
|
e = e.firstChild;
|
|
234
234
|
}
|
|
235
235
|
return null;
|
|
236
236
|
}
|
|
237
237
|
function bt(n, e, t) {
|
|
238
|
-
const r =
|
|
238
|
+
const r = ae[e];
|
|
239
239
|
if (t !== null && (n & r) == (t & r)) return n;
|
|
240
240
|
let s = n ^ r;
|
|
241
|
-
return e === "subscript" ? s &= ~
|
|
241
|
+
return e === "subscript" ? s &= ~ae.superscript : e === "superscript" && (s &= ~ae.subscript), s;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
return N(n) ||
|
|
243
|
+
function fo(n) {
|
|
244
|
+
return N(n) || Ae(n) || A(n);
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function Gr(n, e) {
|
|
247
247
|
if (e != null) return void (n.__key = e);
|
|
248
|
-
q(),
|
|
249
|
-
const t = M(), r = fe(), s = "" +
|
|
248
|
+
q(), bs();
|
|
249
|
+
const t = M(), r = fe(), s = "" + Ci++;
|
|
250
250
|
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
251
|
}
|
|
252
252
|
function Ne(n) {
|
|
@@ -281,13 +281,13 @@ function Ne(n) {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
function wt(n) {
|
|
284
|
-
|
|
284
|
+
bs();
|
|
285
285
|
const e = n.getLatest(), t = e.__parent, r = fe(), s = M(), i = r._nodeMap, o = s._dirtyElements;
|
|
286
|
-
t !== null && function(
|
|
287
|
-
let h =
|
|
286
|
+
t !== null && function(a, c, f) {
|
|
287
|
+
let h = a;
|
|
288
288
|
for (; h !== null; ) {
|
|
289
289
|
if (f.has(h)) return;
|
|
290
|
-
const u =
|
|
290
|
+
const u = c.get(h);
|
|
291
291
|
if (u === void 0) break;
|
|
292
292
|
f.set(h, !1), h = u.__parent;
|
|
293
293
|
}
|
|
@@ -316,20 +316,20 @@ function V(n, e) {
|
|
|
316
316
|
const t = (e || fe())._nodeMap.get(n);
|
|
317
317
|
return t === void 0 ? null : t;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Yr(n, e) {
|
|
320
320
|
const t = n[`__lexicalKey_${M()._key}`];
|
|
321
321
|
return t !== void 0 ? V(t, e) : null;
|
|
322
322
|
}
|
|
323
323
|
function zt(n, e) {
|
|
324
324
|
let t = n;
|
|
325
325
|
for (; t != null; ) {
|
|
326
|
-
const r =
|
|
326
|
+
const r = Yr(t, e);
|
|
327
327
|
if (r !== null) return r;
|
|
328
328
|
t = Rt(t);
|
|
329
329
|
}
|
|
330
330
|
return null;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function es(n) {
|
|
333
333
|
const e = n._decorators, t = Object.assign({}, e);
|
|
334
334
|
return n._pendingDecorators = t, t;
|
|
335
335
|
}
|
|
@@ -337,9 +337,9 @@ function ir(n) {
|
|
|
337
337
|
return n.read(() => G().getTextContent());
|
|
338
338
|
}
|
|
339
339
|
function G() {
|
|
340
|
-
return
|
|
340
|
+
return ts(fe());
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function ts(n) {
|
|
343
343
|
return n._nodeMap.get("root");
|
|
344
344
|
}
|
|
345
345
|
function ue(n) {
|
|
@@ -347,7 +347,7 @@ function ue(n) {
|
|
|
347
347
|
const e = fe();
|
|
348
348
|
n !== null && (n.dirty = !0, n.setCachedNodes(null)), e._selection = n;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Oe(n) {
|
|
351
351
|
const e = M(), t = function(r, s) {
|
|
352
352
|
let i = r;
|
|
353
353
|
for (; i != null; ) {
|
|
@@ -362,48 +362,48 @@ function Le(n) {
|
|
|
362
362
|
function or(n, e) {
|
|
363
363
|
return e ? n.getTextContentSize() : 0;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function ns(n) {
|
|
366
366
|
return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n);
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function Wn(n) {
|
|
369
369
|
const e = [];
|
|
370
370
|
let t = n;
|
|
371
371
|
for (; t !== null; ) e.push(t), t = t._parentEditor;
|
|
372
372
|
return e;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function rs() {
|
|
375
375
|
return Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 5);
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function ss(n) {
|
|
378
378
|
return n.nodeType === Te ? n.nodeValue : null;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function zn(n, e, t) {
|
|
381
381
|
const r = se(e._window);
|
|
382
382
|
if (r === null) return;
|
|
383
383
|
const s = r.anchorNode;
|
|
384
384
|
let { anchorOffset: i, focusOffset: o } = r;
|
|
385
385
|
if (s !== null) {
|
|
386
|
-
let l =
|
|
387
|
-
const
|
|
388
|
-
if (l !== null && N(
|
|
386
|
+
let l = ss(s);
|
|
387
|
+
const a = zt(s);
|
|
388
|
+
if (l !== null && N(a)) {
|
|
389
389
|
if (l === At && t) {
|
|
390
|
-
const
|
|
391
|
-
l = t, i =
|
|
390
|
+
const c = t.length;
|
|
391
|
+
l = t, i = c, o = c;
|
|
392
392
|
}
|
|
393
|
-
l !== null &&
|
|
393
|
+
l !== null && Bn(a, l, i, o, n);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function Bn(n, e, t, r, s) {
|
|
398
398
|
let i = n;
|
|
399
399
|
if (i.isAttached() && (s || !i.isDirty())) {
|
|
400
400
|
const o = i.isComposing();
|
|
401
401
|
let l = e;
|
|
402
402
|
(o || s) && e[e.length - 1] === At && (l = e.slice(0, -1));
|
|
403
|
-
const
|
|
404
|
-
if (s || l !==
|
|
403
|
+
const a = i.getTextContent();
|
|
404
|
+
if (s || l !== a) {
|
|
405
405
|
if (l === "") {
|
|
406
|
-
if (J(null),
|
|
406
|
+
if (J(null), wn || It || Nn) i.remove();
|
|
407
407
|
else {
|
|
408
408
|
const p = M();
|
|
409
409
|
setTimeout(() => {
|
|
@@ -414,8 +414,8 @@ function zn(n, e, t, r, s) {
|
|
|
414
414
|
}
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
417
|
-
const
|
|
418
|
-
if (i.isToken() || u !== null && d === u && !o || F(f) && (
|
|
417
|
+
const c = i.getParent(), f = ot(), h = i.getTextContentSize(), u = ye(), d = i.getKey();
|
|
418
|
+
if (i.isToken() || u !== null && d === u && !o || F(f) && (c !== null && !c.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
419
|
const g = I();
|
|
420
420
|
if (!F(g) || t === null || r === null) return void i.setTextContent(l);
|
|
421
421
|
if (g.setTextNodeRange(i, t, i, r), i.isSegmented()) {
|
|
@@ -438,29 +438,29 @@ function wi(n, e) {
|
|
|
438
438
|
function lr(n) {
|
|
439
439
|
return n === "ArrowLeft";
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function ar(n) {
|
|
442
442
|
return n === "ArrowRight";
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function Ve(n, e) {
|
|
445
445
|
return Y ? n : e;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function cr(n) {
|
|
448
448
|
return n === "Enter";
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function Ke(n) {
|
|
451
451
|
return n === "Backspace";
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function $e(n) {
|
|
454
454
|
return n === "Delete";
|
|
455
455
|
}
|
|
456
456
|
function ur(n, e, t) {
|
|
457
|
-
return n.toLowerCase() === "a" &&
|
|
457
|
+
return n.toLowerCase() === "a" && Ve(e, t);
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function ho() {
|
|
460
460
|
const n = G();
|
|
461
|
-
ue(
|
|
461
|
+
ue(Ti(n.select(0, n.getChildrenSize())));
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function qe(n, e) {
|
|
464
464
|
n.__lexicalClassNameCache === void 0 && (n.__lexicalClassNameCache = {});
|
|
465
465
|
const t = n.__lexicalClassNameCache, r = t[e];
|
|
466
466
|
if (r !== void 0) return r;
|
|
@@ -471,15 +471,15 @@ function He(n, e) {
|
|
|
471
471
|
}
|
|
472
472
|
return s;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function Rn(n, e, t, r, s) {
|
|
475
475
|
if (t.size === 0) return;
|
|
476
476
|
const i = r.__type, o = r.__key, l = e.get(i);
|
|
477
|
-
l === void 0 &&
|
|
478
|
-
const
|
|
479
|
-
let
|
|
480
|
-
|
|
481
|
-
const f =
|
|
482
|
-
(f === void 0 || h) &&
|
|
477
|
+
l === void 0 && k(33, i);
|
|
478
|
+
const a = l.klass;
|
|
479
|
+
let c = n.get(a);
|
|
480
|
+
c === void 0 && (c = /* @__PURE__ */ new Map(), n.set(a, c));
|
|
481
|
+
const f = c.get(o), h = f === "destroyed" && s === "created";
|
|
482
|
+
(f === void 0 || h) && c.set(o, h ? "updated" : s);
|
|
483
483
|
}
|
|
484
484
|
function fr(n, e, t) {
|
|
485
485
|
const r = n.getParent();
|
|
@@ -499,25 +499,25 @@ function dr(n, e) {
|
|
|
499
499
|
}
|
|
500
500
|
return null;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function is(n) {
|
|
503
503
|
const e = Kt(n).event, t = e && e.inputType;
|
|
504
504
|
return t === "insertFromPaste" || t === "insertFromPasteAsQuotation";
|
|
505
505
|
}
|
|
506
506
|
function w(n, e, t) {
|
|
507
|
-
return
|
|
507
|
+
return Es(n, e, t);
|
|
508
508
|
}
|
|
509
509
|
function Bt(n) {
|
|
510
510
|
return !Z(n) && !n.isLastChild() && !n.isInline();
|
|
511
511
|
}
|
|
512
512
|
function Nt(n, e) {
|
|
513
513
|
const t = n._keyToDOMMap.get(e);
|
|
514
|
-
return t === void 0 &&
|
|
514
|
+
return t === void 0 && k(75, e), t;
|
|
515
515
|
}
|
|
516
516
|
function Rt(n) {
|
|
517
517
|
const e = n.assignedSlot || n.parentElement;
|
|
518
518
|
return e !== null && e.nodeType === 11 ? e.host : e;
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function Qe(n, e) {
|
|
521
521
|
let t = n.getParent();
|
|
522
522
|
for (; t !== null; ) {
|
|
523
523
|
if (t.is(e)) return !0;
|
|
@@ -527,56 +527,60 @@ function qe(n, e) {
|
|
|
527
527
|
}
|
|
528
528
|
function Kt(n) {
|
|
529
529
|
const e = n._window;
|
|
530
|
-
return e === null &&
|
|
530
|
+
return e === null && k(78), e;
|
|
531
531
|
}
|
|
532
532
|
function Ni(n) {
|
|
533
533
|
let e = n.getParentOrThrow();
|
|
534
534
|
for (; e !== null; ) {
|
|
535
|
-
if (
|
|
535
|
+
if (Pe(e)) return e;
|
|
536
536
|
e = e.getParentOrThrow();
|
|
537
537
|
}
|
|
538
538
|
return e;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function Pe(n) {
|
|
541
541
|
return Z(n) || S(n) && n.isShadowRoot();
|
|
542
542
|
}
|
|
543
|
+
function Ei(n) {
|
|
544
|
+
const e = n.constructor.clone(n);
|
|
545
|
+
return Gr(e, null), e;
|
|
546
|
+
}
|
|
543
547
|
function $t(n) {
|
|
544
548
|
const e = M(), t = n.constructor.getType(), r = e._nodes.get(t);
|
|
545
|
-
r === void 0 &&
|
|
549
|
+
r === void 0 && k(200, n.constructor.name, t);
|
|
546
550
|
const { replace: s, replaceWithKlass: i } = r;
|
|
547
551
|
if (s !== null) {
|
|
548
552
|
const o = s(n), l = o.constructor;
|
|
549
|
-
return i !== null ? o instanceof i ||
|
|
553
|
+
return i !== null ? o instanceof i || k(201, i.name, i.getType(), l.name, l.getType(), n.constructor.name, t) : o instanceof n.constructor && l !== n.constructor || k(202, l.name, l.getType(), n.constructor.name, t), o.__key === n.__key && k(203, n.constructor.name, t, l.name, l.getType()), o;
|
|
550
554
|
}
|
|
551
555
|
return n;
|
|
552
556
|
}
|
|
553
|
-
function
|
|
554
|
-
!Z(n.getParent()) || S(e) || A(e) ||
|
|
557
|
+
function tn(n, e) {
|
|
558
|
+
!Z(n.getParent()) || S(e) || A(e) || k(99);
|
|
555
559
|
}
|
|
556
|
-
function
|
|
560
|
+
function nn(n) {
|
|
557
561
|
return (A(n) || S(n) && !n.canBeEmpty()) && !n.isInline();
|
|
558
562
|
}
|
|
559
|
-
function
|
|
563
|
+
function Kn(n, e, t) {
|
|
560
564
|
t.style.removeProperty("caret-color"), e._blockCursorElement = null;
|
|
561
565
|
const r = n.parentElement;
|
|
562
566
|
r !== null && r.removeChild(n);
|
|
563
567
|
}
|
|
564
|
-
function
|
|
568
|
+
function Pi(n, e, t) {
|
|
565
569
|
let r = n._blockCursorElement;
|
|
566
570
|
if (F(t) && t.isCollapsed() && t.anchor.type === "element" && e.contains(document.activeElement)) {
|
|
567
571
|
const s = t.anchor, i = s.getNode(), o = s.offset;
|
|
568
|
-
let l = !1,
|
|
572
|
+
let l = !1, a = null;
|
|
569
573
|
if (o === i.getChildrenSize())
|
|
570
|
-
|
|
574
|
+
nn(i.getChildAtIndex(o - 1)) && (l = !0);
|
|
571
575
|
else {
|
|
572
|
-
const
|
|
573
|
-
if (
|
|
574
|
-
const f =
|
|
575
|
-
(f === null ||
|
|
576
|
+
const c = i.getChildAtIndex(o);
|
|
577
|
+
if (nn(c)) {
|
|
578
|
+
const f = c.getPreviousSibling();
|
|
579
|
+
(f === null || nn(f)) && (l = !0, a = n.getElementByKey(c.__key));
|
|
576
580
|
}
|
|
577
581
|
}
|
|
578
582
|
if (l) {
|
|
579
|
-
const
|
|
583
|
+
const c = n.getElementByKey(i.__key);
|
|
580
584
|
return r === null && (n._blockCursorElement = r = function(f) {
|
|
581
585
|
const h = f.theme, u = document.createElement("div");
|
|
582
586
|
u.contentEditable = "false", u.setAttribute("data-lexical-cursor", "true");
|
|
@@ -589,24 +593,37 @@ function Ei(n, e, t) {
|
|
|
589
593
|
d !== void 0 && u.classList.add(...d);
|
|
590
594
|
}
|
|
591
595
|
return u;
|
|
592
|
-
}(n._config)), e.style.caretColor = "transparent", void (
|
|
596
|
+
}(n._config)), e.style.caretColor = "transparent", void (a === null ? c.appendChild(r) : c.insertBefore(r, a));
|
|
593
597
|
}
|
|
594
598
|
}
|
|
595
|
-
r !== null &&
|
|
599
|
+
r !== null && Kn(r, n, e);
|
|
596
600
|
}
|
|
597
601
|
function se(n) {
|
|
598
602
|
return ne ? (n || window).getSelection() : null;
|
|
599
603
|
}
|
|
600
|
-
function
|
|
601
|
-
|
|
604
|
+
function go(n, e) {
|
|
605
|
+
let t = n.getChildAtIndex(e);
|
|
606
|
+
t == null && (t = n), Pe(n) && k(102);
|
|
607
|
+
const r = (o) => {
|
|
608
|
+
const l = o.getParentOrThrow(), a = Pe(l), c = o !== t || a ? Ei(o) : o;
|
|
609
|
+
if (a) return S(o) && S(c) || k(133), o.insertAfter(c), [o, c, c];
|
|
610
|
+
{
|
|
611
|
+
const [f, h, u] = r(l), d = o.getNextSiblings();
|
|
612
|
+
return u.append(c, ...d), [f, h, c];
|
|
613
|
+
}
|
|
614
|
+
}, [s, i] = r(t);
|
|
615
|
+
return [s, i];
|
|
602
616
|
}
|
|
603
|
-
function
|
|
617
|
+
function _o(n) {
|
|
618
|
+
return $n(n) && n.tagName === "A";
|
|
619
|
+
}
|
|
620
|
+
function $n(n) {
|
|
604
621
|
return n.nodeType === 1;
|
|
605
622
|
}
|
|
606
|
-
function
|
|
623
|
+
function po(n) {
|
|
607
624
|
return n.nodeType === 11;
|
|
608
625
|
}
|
|
609
|
-
function
|
|
626
|
+
function Fi(n) {
|
|
610
627
|
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");
|
|
611
628
|
return n.nodeName.match(e) !== null;
|
|
612
629
|
}
|
|
@@ -616,22 +633,22 @@ function hr(n) {
|
|
|
616
633
|
}
|
|
617
634
|
function _e(n) {
|
|
618
635
|
if (A(n) && !n.isInline()) return !0;
|
|
619
|
-
if (!S(n) ||
|
|
620
|
-
const e = n.getFirstChild(), t = e === null ||
|
|
636
|
+
if (!S(n) || Pe(n)) return !1;
|
|
637
|
+
const e = n.getFirstChild(), t = e === null || Ae(e) || N(e) || e.isInline();
|
|
621
638
|
return !n.isInline() && n.canBeEmpty() !== !1 && t;
|
|
622
639
|
}
|
|
623
|
-
function
|
|
640
|
+
function Je(n, e) {
|
|
624
641
|
let t = n;
|
|
625
642
|
for (; t !== null && t.getParent() !== null && !e(t); ) t = t.getParentOrThrow();
|
|
626
643
|
return e(t) ? t : null;
|
|
627
644
|
}
|
|
628
|
-
function
|
|
645
|
+
function yo() {
|
|
629
646
|
return M();
|
|
630
647
|
}
|
|
631
|
-
const gr = /* @__PURE__ */ new WeakMap(),
|
|
632
|
-
function
|
|
633
|
-
if (!n._readOnly && n.isEmpty()) return
|
|
634
|
-
n._readOnly ||
|
|
648
|
+
const gr = /* @__PURE__ */ new WeakMap(), Di = /* @__PURE__ */ new Map();
|
|
649
|
+
function Li(n) {
|
|
650
|
+
if (!n._readOnly && n.isEmpty()) return Di;
|
|
651
|
+
n._readOnly || k(192);
|
|
635
652
|
let e = gr.get(n);
|
|
636
653
|
if (!e) {
|
|
637
654
|
e = /* @__PURE__ */ new Map(), gr.set(n, e);
|
|
@@ -643,31 +660,31 @@ function Di(n) {
|
|
|
643
660
|
}
|
|
644
661
|
return e;
|
|
645
662
|
}
|
|
646
|
-
function
|
|
663
|
+
function Oi(n) {
|
|
647
664
|
const e = n.constructor.clone(n);
|
|
648
665
|
return e.afterCloneFrom(n), e;
|
|
649
666
|
}
|
|
650
|
-
function
|
|
667
|
+
function os(n, e, t, r, s, i) {
|
|
651
668
|
let o = n.getFirstChild();
|
|
652
669
|
for (; o !== null; ) {
|
|
653
670
|
const l = o.__key;
|
|
654
|
-
o.__parent === e && (S(o) &&
|
|
671
|
+
o.__parent === e && (S(o) && os(o, l, t, r, s, i), t.has(l) || i.delete(l), s.push(l)), o = o.getNextSibling();
|
|
655
672
|
}
|
|
656
673
|
}
|
|
657
|
-
let Se, H,
|
|
674
|
+
let Se, H, Ye, Jt, hn, gn, Fe, te, _n, et, B = "", j = "", re = null, ee = "", le = "", ls = !1, tt = !1, _t = null;
|
|
658
675
|
function Et(n, e) {
|
|
659
|
-
const t =
|
|
676
|
+
const t = Fe.get(n);
|
|
660
677
|
if (e !== null) {
|
|
661
|
-
const r =
|
|
678
|
+
const r = mn(n);
|
|
662
679
|
r.parentNode === e && e.removeChild(r);
|
|
663
680
|
}
|
|
664
681
|
if (te.has(n) || H._keyToDOMMap.delete(n), S(t)) {
|
|
665
|
-
const r = Ft(t,
|
|
666
|
-
|
|
682
|
+
const r = Ft(t, Fe);
|
|
683
|
+
pn(r, 0, r.length - 1, null);
|
|
667
684
|
}
|
|
668
|
-
t !== void 0 &&
|
|
685
|
+
t !== void 0 && Rn(et, Ye, Jt, t, "destroyed");
|
|
669
686
|
}
|
|
670
|
-
function
|
|
687
|
+
function pn(n, e, t, r) {
|
|
671
688
|
let s = e;
|
|
672
689
|
for (; s <= t; ++s) {
|
|
673
690
|
const i = n[s];
|
|
@@ -677,43 +694,43 @@ function _n(n, e, t, r) {
|
|
|
677
694
|
function ke(n, e) {
|
|
678
695
|
n.setProperty("text-align", e);
|
|
679
696
|
}
|
|
680
|
-
const
|
|
681
|
-
function
|
|
697
|
+
const Ii = "40px";
|
|
698
|
+
function as(n, e) {
|
|
682
699
|
const t = Se.theme.indent;
|
|
683
700
|
if (typeof t == "string") {
|
|
684
701
|
const s = n.classList.contains(t);
|
|
685
702
|
e > 0 && !s ? n.classList.add(t) : e < 1 && s && n.classList.remove(t);
|
|
686
703
|
}
|
|
687
|
-
const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") ||
|
|
704
|
+
const r = getComputedStyle(n).getPropertyValue("--lexical-indent-base-value") || Ii;
|
|
688
705
|
n.style.setProperty("padding-inline-start", e === 0 ? "" : `calc(${e} * ${r})`);
|
|
689
706
|
}
|
|
690
707
|
function cs(n, e) {
|
|
691
708
|
const t = n.style;
|
|
692
|
-
e === 0 ? ke(t, "") : e ===
|
|
709
|
+
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");
|
|
693
710
|
}
|
|
694
711
|
function Pt(n, e, t) {
|
|
695
712
|
const r = te.get(n);
|
|
696
|
-
r === void 0 &&
|
|
713
|
+
r === void 0 && k(60);
|
|
697
714
|
const s = r.createDOM(Se, H);
|
|
698
715
|
if (function(i, o, l) {
|
|
699
|
-
const
|
|
700
|
-
o["__lexicalKey_" + l._key] = i,
|
|
716
|
+
const a = l._keyToDOMMap;
|
|
717
|
+
o["__lexicalKey_" + l._key] = i, a.set(i, o);
|
|
701
718
|
}(n, s, H), N(r) ? s.setAttribute("data-lexical-text", "true") : A(r) && s.setAttribute("data-lexical-decorator", "true"), S(r)) {
|
|
702
719
|
const i = r.__indent, o = r.__size;
|
|
703
|
-
if (i !== 0 &&
|
|
704
|
-
const
|
|
705
|
-
(function(
|
|
720
|
+
if (i !== 0 && as(s, i), o !== 0) {
|
|
721
|
+
const a = o - 1;
|
|
722
|
+
(function(c, f, h, u) {
|
|
706
723
|
const d = j;
|
|
707
|
-
j = "",
|
|
708
|
-
})(Ft(r, te),
|
|
724
|
+
j = "", yn(c, h, 0, f, u, null), fs(h, u), j = d;
|
|
725
|
+
})(Ft(r, te), a, r, s);
|
|
709
726
|
}
|
|
710
727
|
const l = r.__format;
|
|
711
|
-
l !== 0 && cs(s, l), r.isInline() ||
|
|
728
|
+
l !== 0 && cs(s, l), r.isInline() || us(null, r, s), Bt(r) && (B += ce, le += ce);
|
|
712
729
|
} else {
|
|
713
730
|
const i = r.getTextContent();
|
|
714
731
|
if (A(r)) {
|
|
715
732
|
const o = r.decorate(H, Se);
|
|
716
|
-
o !== null &&
|
|
733
|
+
o !== null && ds(n, o), s.contentEditable = "false";
|
|
717
734
|
} else N(r) && (r.isDirectionless() || (j += i));
|
|
718
735
|
B += i, le += i;
|
|
719
736
|
}
|
|
@@ -722,25 +739,25 @@ function Pt(n, e, t) {
|
|
|
722
739
|
const i = e.__lexicalLineBreak;
|
|
723
740
|
i != null ? e.insertBefore(s, i) : e.appendChild(s);
|
|
724
741
|
}
|
|
725
|
-
return
|
|
742
|
+
return Rn(et, Ye, Jt, r, "created"), s;
|
|
726
743
|
}
|
|
727
|
-
function
|
|
744
|
+
function yn(n, e, t, r, s, i) {
|
|
728
745
|
const o = B;
|
|
729
746
|
B = "";
|
|
730
747
|
let l = t;
|
|
731
748
|
for (; l <= r; ++l) {
|
|
732
749
|
Pt(n[l], s, i);
|
|
733
|
-
const
|
|
734
|
-
|
|
750
|
+
const a = te.get(n[l]);
|
|
751
|
+
a !== null && N(a) && (re === null && (re = a.getFormat()), ee === "" && (ee = a.getStyle()));
|
|
735
752
|
}
|
|
736
|
-
Bt(e) && (B +=
|
|
753
|
+
Bt(e) && (B += ce), s.__lexicalTextContent = B, B = o + B;
|
|
737
754
|
}
|
|
738
755
|
function _r(n, e) {
|
|
739
756
|
const t = e.get(n);
|
|
740
|
-
return
|
|
757
|
+
return Ae(t) || A(t) && t.isInline();
|
|
741
758
|
}
|
|
742
|
-
function
|
|
743
|
-
const r = n !== null && (n.__size === 0 || _r(n.__last,
|
|
759
|
+
function us(n, e, t) {
|
|
760
|
+
const r = n !== null && (n.__size === 0 || _r(n.__last, Fe)), s = e.__size === 0 || _r(e.__last, te);
|
|
744
761
|
if (r) {
|
|
745
762
|
if (!s) {
|
|
746
763
|
const i = t.__lexicalLineBreak;
|
|
@@ -760,47 +777,47 @@ function as(n, e, t) {
|
|
|
760
777
|
t.__lexicalLineBreak = i, t.appendChild(i);
|
|
761
778
|
}
|
|
762
779
|
}
|
|
763
|
-
function
|
|
780
|
+
function fs(n, e) {
|
|
764
781
|
const t = e.__lexicalDirTextContent, r = e.__lexicalDir;
|
|
765
782
|
if (t !== j || r !== _t) {
|
|
766
|
-
const i = j === "", o = i ? _t : (s = j,
|
|
783
|
+
const i = j === "", o = i ? _t : (s = j, fi.test(s) ? "rtl" : di.test(s) ? "ltr" : null);
|
|
767
784
|
if (o !== r) {
|
|
768
|
-
const l = e.classList,
|
|
769
|
-
let
|
|
770
|
-
if (
|
|
771
|
-
if (typeof
|
|
772
|
-
const h = Ct(
|
|
773
|
-
|
|
785
|
+
const l = e.classList, a = Se.theme;
|
|
786
|
+
let c = r !== null ? a[r] : void 0, f = o !== null ? a[o] : void 0;
|
|
787
|
+
if (c !== void 0) {
|
|
788
|
+
if (typeof c == "string") {
|
|
789
|
+
const h = Ct(c);
|
|
790
|
+
c = a[r] = h;
|
|
774
791
|
}
|
|
775
|
-
l.remove(...
|
|
792
|
+
l.remove(...c);
|
|
776
793
|
}
|
|
777
794
|
if (o === null || i && o === "ltr") e.removeAttribute("dir");
|
|
778
795
|
else {
|
|
779
796
|
if (f !== void 0) {
|
|
780
797
|
if (typeof f == "string") {
|
|
781
798
|
const h = Ct(f);
|
|
782
|
-
f =
|
|
799
|
+
f = a[o] = h;
|
|
783
800
|
}
|
|
784
801
|
f !== void 0 && l.add(...f);
|
|
785
802
|
}
|
|
786
803
|
e.dir = o;
|
|
787
804
|
}
|
|
788
|
-
|
|
805
|
+
tt || (n.getWritable().__dir = o);
|
|
789
806
|
}
|
|
790
807
|
_t = o, e.__lexicalDirTextContent = j, e.__lexicalDir = o;
|
|
791
808
|
}
|
|
792
809
|
var s;
|
|
793
810
|
}
|
|
794
|
-
function
|
|
811
|
+
function Ai(n, e, t) {
|
|
795
812
|
const r = j;
|
|
796
813
|
var s;
|
|
797
814
|
j = "", re = null, ee = "", function(i, o, l) {
|
|
798
|
-
const
|
|
799
|
-
if (B = "",
|
|
815
|
+
const a = B, c = i.__size, f = o.__size;
|
|
816
|
+
if (B = "", c === 1 && f === 1) {
|
|
800
817
|
const h = i.__first, u = o.__first;
|
|
801
|
-
if (h === u)
|
|
818
|
+
if (h === u) je(h, l);
|
|
802
819
|
else {
|
|
803
|
-
const g =
|
|
820
|
+
const g = mn(h), p = Pt(u, null, null);
|
|
804
821
|
try {
|
|
805
822
|
l.replaceChild(p, g);
|
|
806
823
|
} catch (_) {
|
|
@@ -815,27 +832,27 @@ function Ii(n, e, t) {
|
|
|
815
832
|
const d = te.get(u);
|
|
816
833
|
N(d) && (re === null && (re = d.getFormat()), ee === "" && (ee = d.getStyle()));
|
|
817
834
|
} else {
|
|
818
|
-
const h = Ft(i,
|
|
819
|
-
if (
|
|
835
|
+
const h = Ft(i, Fe), u = Ft(o, te);
|
|
836
|
+
if (c === 0) f !== 0 && yn(u, o, 0, f - 1, l, null);
|
|
820
837
|
else if (f === 0) {
|
|
821
|
-
if (
|
|
838
|
+
if (c !== 0) {
|
|
822
839
|
const d = l.__lexicalLineBreak == null;
|
|
823
|
-
|
|
840
|
+
pn(h, 0, c - 1, d ? null : l), d && (l.textContent = "");
|
|
824
841
|
}
|
|
825
842
|
} else (function(d, g, p, _, m, y) {
|
|
826
843
|
const x = _ - 1, C = m - 1;
|
|
827
|
-
let
|
|
844
|
+
let b, v, P = (D = y, D.firstChild), T = 0, E = 0;
|
|
828
845
|
for (var D; T <= x && E <= C; ) {
|
|
829
846
|
const L = g[T], U = p[E];
|
|
830
|
-
if (L === U) P =
|
|
847
|
+
if (L === U) P = rn(je(U, y)), T++, E++;
|
|
831
848
|
else {
|
|
832
|
-
|
|
833
|
-
const de = v.has(L),
|
|
834
|
-
if (de) if (
|
|
835
|
-
const
|
|
836
|
-
|
|
849
|
+
b === void 0 && (b = new Set(g)), v === void 0 && (v = new Set(p));
|
|
850
|
+
const de = v.has(L), De = b.has(U);
|
|
851
|
+
if (de) if (De) {
|
|
852
|
+
const Be = Nt(H, U);
|
|
853
|
+
Be === P ? P = rn(je(U, y)) : (P != null ? y.insertBefore(Be, P) : y.appendChild(Be), je(U, y)), T++, E++;
|
|
837
854
|
} else Pt(U, y, P), E++;
|
|
838
|
-
else P =
|
|
855
|
+
else P = rn(mn(L)), Et(L, y), T++;
|
|
839
856
|
}
|
|
840
857
|
const z = te.get(U);
|
|
841
858
|
z !== null && N(z) && (re === null && (re = z.getFormat()), ee === "" && (ee = z.getStyle()));
|
|
@@ -843,13 +860,13 @@ function Ii(n, e, t) {
|
|
|
843
860
|
const O = T > x, W = E > C;
|
|
844
861
|
if (O && !W) {
|
|
845
862
|
const L = p[C + 1];
|
|
846
|
-
|
|
847
|
-
} else W && !O &&
|
|
848
|
-
})(o, h, u,
|
|
863
|
+
yn(p, d, E, C, y, L === void 0 ? null : H.getElementByKey(L));
|
|
864
|
+
} else W && !O && pn(g, T, x, y);
|
|
865
|
+
})(o, h, u, c, f, l);
|
|
849
866
|
}
|
|
850
|
-
Bt(o) && (B +=
|
|
851
|
-
}(n, e, t),
|
|
852
|
-
|
|
867
|
+
Bt(o) && (B += ce), l.__lexicalTextContent = B, B = a + B;
|
|
868
|
+
}(n, e, t), fs(e, t), kn(s = e) && re != null && re !== s.__textFormat && !tt && (s.setTextFormat(re), s.setTextStyle(ee)), function(i) {
|
|
869
|
+
kn(i) && ee !== "" && ee !== i.__textStyle && !tt && i.setTextStyle(ee);
|
|
853
870
|
}(e), j = r;
|
|
854
871
|
}
|
|
855
872
|
function Ft(n, e) {
|
|
@@ -857,15 +874,15 @@ function Ft(n, e) {
|
|
|
857
874
|
let r = n.__first;
|
|
858
875
|
for (; r !== null; ) {
|
|
859
876
|
const s = e.get(r);
|
|
860
|
-
s === void 0 &&
|
|
877
|
+
s === void 0 && k(101), t.push(r), r = s.__next;
|
|
861
878
|
}
|
|
862
879
|
return t;
|
|
863
880
|
}
|
|
864
|
-
function
|
|
865
|
-
const t =
|
|
881
|
+
function je(n, e) {
|
|
882
|
+
const t = Fe.get(n);
|
|
866
883
|
let r = te.get(n);
|
|
867
|
-
t !== void 0 && r !== void 0 ||
|
|
868
|
-
const s =
|
|
884
|
+
t !== void 0 && r !== void 0 || k(61);
|
|
885
|
+
const s = ls || gn.has(n) || hn.has(n), i = Nt(H, n);
|
|
869
886
|
if (t === r && !s) {
|
|
870
887
|
if (S(t)) {
|
|
871
888
|
const o = i.__lexicalTextContent;
|
|
@@ -878,143 +895,143 @@ function Ve(n, e) {
|
|
|
878
895
|
}
|
|
879
896
|
return i;
|
|
880
897
|
}
|
|
881
|
-
if (t !== r && s &&
|
|
898
|
+
if (t !== r && s && Rn(et, Ye, Jt, r, "updated"), r.updateDOM(t, i, Se)) {
|
|
882
899
|
const o = Pt(n, null, null);
|
|
883
|
-
return e === null &&
|
|
900
|
+
return e === null && k(62), e.replaceChild(o, i), Et(n, null), o;
|
|
884
901
|
}
|
|
885
902
|
if (S(t) && S(r)) {
|
|
886
903
|
const o = r.__indent;
|
|
887
|
-
o !== t.__indent &&
|
|
904
|
+
o !== t.__indent && as(i, o);
|
|
888
905
|
const l = r.__format;
|
|
889
|
-
l !== t.__format && cs(i, l), s && (
|
|
906
|
+
l !== t.__format && cs(i, l), s && (Ai(t, r, i), Z(r) || r.isInline() || us(t, r, i)), Bt(r) && (B += ce, le += ce);
|
|
890
907
|
} else {
|
|
891
908
|
const o = r.getTextContent();
|
|
892
909
|
if (A(r)) {
|
|
893
910
|
const l = r.decorate(H, Se);
|
|
894
|
-
l !== null &&
|
|
911
|
+
l !== null && ds(n, l);
|
|
895
912
|
} else N(r) && !r.isDirectionless() && (j += o);
|
|
896
913
|
B += o, le += o;
|
|
897
914
|
}
|
|
898
|
-
if (!
|
|
915
|
+
if (!tt && Z(r) && r.__cachedText !== le) {
|
|
899
916
|
const o = r.getWritable();
|
|
900
917
|
o.__cachedText = le, r = o;
|
|
901
918
|
}
|
|
902
919
|
return i;
|
|
903
920
|
}
|
|
904
|
-
function
|
|
921
|
+
function ds(n, e) {
|
|
905
922
|
let t = H._pendingDecorators;
|
|
906
923
|
const r = H._decorators;
|
|
907
924
|
if (t === null) {
|
|
908
925
|
if (r[n] === e) return;
|
|
909
|
-
t =
|
|
926
|
+
t = es(H);
|
|
910
927
|
}
|
|
911
928
|
t[n] = e;
|
|
912
929
|
}
|
|
913
|
-
function
|
|
930
|
+
function rn(n) {
|
|
914
931
|
let e = n.nextSibling;
|
|
915
932
|
return e !== null && e === H._blockCursorElement && (e = e.nextSibling), e;
|
|
916
933
|
}
|
|
917
|
-
function
|
|
918
|
-
B = "", le = "", j = "",
|
|
934
|
+
function Mi(n, e, t, r, s, i) {
|
|
935
|
+
B = "", le = "", j = "", ls = r === Me, _t = null, H = t, Se = t._config, Ye = t._nodes, Jt = H._listeners.mutation, hn = s, gn = i, Fe = n._nodeMap, te = e._nodeMap, tt = e._readOnly, _n = new Map(t._keyToDOMMap);
|
|
919
936
|
const o = /* @__PURE__ */ new Map();
|
|
920
|
-
return
|
|
937
|
+
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;
|
|
921
938
|
}
|
|
922
|
-
function
|
|
923
|
-
const e =
|
|
924
|
-
return e === void 0 &&
|
|
939
|
+
function mn(n) {
|
|
940
|
+
const e = _n.get(n);
|
|
941
|
+
return e === void 0 && k(75, n), e;
|
|
925
942
|
}
|
|
926
|
-
const oe = Object.freeze({}),
|
|
927
|
-
if (
|
|
943
|
+
const oe = Object.freeze({}), xn = 30, vn = [["keydown", function(n, e) {
|
|
944
|
+
if (Xe = n.timeStamp, hs = n.key, e.isComposing()) return;
|
|
928
945
|
const { key: t, shiftKey: r, ctrlKey: s, metaKey: i, altKey: o } = n;
|
|
929
|
-
w(e,
|
|
930
|
-
return
|
|
931
|
-
}(t, s, o, i) ? w(e,
|
|
932
|
-
return
|
|
933
|
-
}(t, s, r, o, i) ? w(e,
|
|
934
|
-
return lr(l) && !
|
|
935
|
-
}(t, s, o, i) ? w(e,
|
|
936
|
-
return lr(l) && !f && !
|
|
937
|
-
}(t, s, r, o, i) ? w(e,
|
|
946
|
+
w(e, zs, n) || t != null && (function(l, a, c, f) {
|
|
947
|
+
return ar(l) && !a && !f && !c;
|
|
948
|
+
}(t, s, o, i) ? w(e, Bs, n) : function(l, a, c, f, h) {
|
|
949
|
+
return ar(l) && !f && !c && (a || h);
|
|
950
|
+
}(t, s, r, o, i) ? w(e, Rs, n) : function(l, a, c, f) {
|
|
951
|
+
return lr(l) && !a && !f && !c;
|
|
952
|
+
}(t, s, o, i) ? w(e, Ks, n) : function(l, a, c, f, h) {
|
|
953
|
+
return lr(l) && !f && !c && (a || h);
|
|
954
|
+
}(t, s, r, o, i) ? w(e, $s, n) : /* @__PURE__ */ function(l, a, c) {
|
|
938
955
|
return /* @__PURE__ */ function(f) {
|
|
939
956
|
return f === "ArrowUp";
|
|
940
|
-
}(l) && !
|
|
941
|
-
}(t, s, i) ? w(e,
|
|
957
|
+
}(l) && !a && !c;
|
|
958
|
+
}(t, s, i) ? w(e, Js, n) : /* @__PURE__ */ function(l, a, c) {
|
|
942
959
|
return /* @__PURE__ */ function(f) {
|
|
943
960
|
return f === "ArrowDown";
|
|
944
|
-
}(l) && !
|
|
945
|
-
}(t, s, i) ? w(e,
|
|
946
|
-
return
|
|
947
|
-
}(t, r) ? (
|
|
961
|
+
}(l) && !a && !c;
|
|
962
|
+
}(t, s, i) ? w(e, Us, n) : function(l, a) {
|
|
963
|
+
return cr(l) && a;
|
|
964
|
+
}(t, r) ? (Ze = !0, w(e, fn, n)) : /* @__PURE__ */ function(l) {
|
|
948
965
|
return l === " ";
|
|
949
|
-
}(t) ? w(e,
|
|
950
|
-
return Y &&
|
|
951
|
-
}(t, s) ? (n.preventDefault(),
|
|
952
|
-
return
|
|
953
|
-
}(t, r) ? (
|
|
954
|
-
return Y ? !
|
|
955
|
-
}(t, o, i, s) ?
|
|
966
|
+
}(t) ? w(e, Vs, n) : function(l, a) {
|
|
967
|
+
return Y && a && l.toLowerCase() === "o";
|
|
968
|
+
}(t, s) ? (n.preventDefault(), Ze = !0, w(e, gt, !0)) : function(l, a) {
|
|
969
|
+
return cr(l) && !a;
|
|
970
|
+
}(t, r) ? (Ze = !1, w(e, fn, n)) : function(l, a, c, f) {
|
|
971
|
+
return Y ? !a && !c && (Ke(l) || l.toLowerCase() === "h" && f) : !(f || a || c) && Ke(l);
|
|
972
|
+
}(t, o, i, s) ? Ke(t) ? w(e, js, n) : (n.preventDefault(), w(e, yt, !0)) : /* @__PURE__ */ function(l) {
|
|
956
973
|
return l === "Escape";
|
|
957
|
-
}(t) ? w(e,
|
|
958
|
-
return Y ? !(
|
|
959
|
-
}(t, s, r, o, i) ?
|
|
960
|
-
return
|
|
961
|
-
}(t, o, s) ? (n.preventDefault(), w(e, mt, !0)) : function(l,
|
|
962
|
-
return
|
|
963
|
-
}(t, o, s) ? (n.preventDefault(), w(e, mt, !1)) : function(l,
|
|
964
|
-
return Y &&
|
|
965
|
-
}(t, i) ? (n.preventDefault(), w(e, xt, !0)) : function(l,
|
|
966
|
-
return Y &&
|
|
967
|
-
}(t, i) ? (n.preventDefault(), w(e, xt, !1)) : function(l,
|
|
968
|
-
return l.toLowerCase() === "b" && !
|
|
969
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "bold")) : function(l,
|
|
970
|
-
return l.toLowerCase() === "u" && !
|
|
971
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "underline")) : function(l,
|
|
972
|
-
return l.toLowerCase() === "i" && !
|
|
973
|
-
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "italic")) : /* @__PURE__ */ function(l,
|
|
974
|
-
return l === "Tab" && !
|
|
975
|
-
}(t, o, s, i) ? w(e,
|
|
976
|
-
return l.toLowerCase() === "z" && !
|
|
977
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Br, void 0)) : function(l,
|
|
978
|
-
return Y ? l.toLowerCase() === "z" &&
|
|
979
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Rr, void 0)) : jt(e._editorState._selection) ? function(l,
|
|
980
|
-
return !
|
|
981
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, Kr, n)) : function(l,
|
|
982
|
-
return !
|
|
983
|
-
}(t, r, i, s) ? (n.preventDefault(), w(e, $r, 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,
|
|
984
|
-
return l ||
|
|
985
|
-
}(s, r, o, i) && w(e,
|
|
974
|
+
}(t) ? w(e, Hs, n) : function(l, a, c, f, h) {
|
|
975
|
+
return Y ? !(c || f || h) && ($e(l) || l.toLowerCase() === "d" && a) : !(a || f || h) && $e(l);
|
|
976
|
+
}(t, s, r, o, i) ? $e(t) ? w(e, qs, n) : (n.preventDefault(), w(e, yt, !1)) : function(l, a, c) {
|
|
977
|
+
return Ke(l) && (Y ? a : c);
|
|
978
|
+
}(t, o, s) ? (n.preventDefault(), w(e, mt, !0)) : function(l, a, c) {
|
|
979
|
+
return $e(l) && (Y ? a : c);
|
|
980
|
+
}(t, o, s) ? (n.preventDefault(), w(e, mt, !1)) : function(l, a) {
|
|
981
|
+
return Y && a && Ke(l);
|
|
982
|
+
}(t, i) ? (n.preventDefault(), w(e, xt, !0)) : function(l, a) {
|
|
983
|
+
return Y && a && $e(l);
|
|
984
|
+
}(t, i) ? (n.preventDefault(), w(e, xt, !1)) : function(l, a, c, f) {
|
|
985
|
+
return l.toLowerCase() === "b" && !a && Ve(c, f);
|
|
986
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "bold")) : function(l, a, c, f) {
|
|
987
|
+
return l.toLowerCase() === "u" && !a && Ve(c, f);
|
|
988
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "underline")) : function(l, a, c, f) {
|
|
989
|
+
return l.toLowerCase() === "i" && !a && Ve(c, f);
|
|
990
|
+
}(t, o, i, s) ? (n.preventDefault(), w(e, we, "italic")) : /* @__PURE__ */ function(l, a, c, f) {
|
|
991
|
+
return l === "Tab" && !a && !c && !f;
|
|
992
|
+
}(t, o, s, i) ? w(e, Qs, n) : function(l, a, c, f) {
|
|
993
|
+
return l.toLowerCase() === "z" && !a && Ve(c, f);
|
|
994
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Br, void 0)) : function(l, a, c, f) {
|
|
995
|
+
return Y ? l.toLowerCase() === "z" && c && a : l.toLowerCase() === "y" && f || l.toLowerCase() === "z" && f && a;
|
|
996
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Rr, void 0)) : jt(e._editorState._selection) ? function(l, a, c, f) {
|
|
997
|
+
return !a && l.toLowerCase() === "c" && (Y ? c : f);
|
|
998
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, Kr, n)) : function(l, a, c, f) {
|
|
999
|
+
return !a && l.toLowerCase() === "x" && (Y ? c : f);
|
|
1000
|
+
}(t, r, i, s) ? (n.preventDefault(), w(e, $r, 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, a, c, f) {
|
|
1001
|
+
return l || a || c || f;
|
|
1002
|
+
}(s, r, o, i) && w(e, ni, n));
|
|
986
1003
|
}], ["pointerdown", function(n, e) {
|
|
987
1004
|
const t = n.target, r = n.pointerType;
|
|
988
1005
|
t instanceof Node && r !== "touch" && X(e, () => {
|
|
989
|
-
A(zt(t)) || (
|
|
1006
|
+
A(zt(t)) || (Tn = !0);
|
|
990
1007
|
});
|
|
991
1008
|
}], ["compositionstart", function(n, e) {
|
|
992
1009
|
X(e, () => {
|
|
993
1010
|
const t = I();
|
|
994
1011
|
if (F(t) && !e.isComposing()) {
|
|
995
1012
|
const r = t.anchor, s = t.anchor.getNode();
|
|
996
|
-
J(r.key), (n.timeStamp <
|
|
1013
|
+
J(r.key), (n.timeStamp < Xe + xn || r.type === "element" || !t.isCollapsed() || s.getFormat() !== t.format || N(s) && s.getStyle() !== t.style) && w(e, He, ui);
|
|
997
1014
|
}
|
|
998
1015
|
});
|
|
999
1016
|
}], ["compositionend", function(n, e) {
|
|
1000
|
-
xe ?
|
|
1001
|
-
|
|
1017
|
+
xe ? Ue = !0 : X(e, () => {
|
|
1018
|
+
sn(e, n.data);
|
|
1002
1019
|
});
|
|
1003
1020
|
}], ["input", function(n, e) {
|
|
1004
1021
|
n.stopPropagation(), X(e, () => {
|
|
1005
|
-
const t = I(), r = n.data, s =
|
|
1006
|
-
if (r != null && F(t) &&
|
|
1007
|
-
|
|
1022
|
+
const t = I(), r = n.data, s = ys(n);
|
|
1023
|
+
if (r != null && F(t) && ps(t, s, r, n.timeStamp, !1)) {
|
|
1024
|
+
Ue && (sn(e, r), Ue = !1);
|
|
1008
1025
|
const i = t.anchor.getNode(), o = se(e._window);
|
|
1009
1026
|
if (o === null) return;
|
|
1010
|
-
const l = t.isBackward(),
|
|
1011
|
-
vt && !t.isCollapsed() && N(i) && o.anchorNode !== null && i.getTextContent().slice(0,
|
|
1027
|
+
const l = t.isBackward(), a = l ? t.anchor.offset : t.focus.offset, c = l ? t.focus.offset : t.anchor.offset;
|
|
1028
|
+
vt && !t.isCollapsed() && N(i) && o.anchorNode !== null && i.getTextContent().slice(0, a) + r + i.getTextContent().slice(a + c) === ss(o.anchorNode) || w(e, He, r);
|
|
1012
1029
|
const f = r.length;
|
|
1013
|
-
xe && f > 1 && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= f),
|
|
1030
|
+
xe && f > 1 && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= f), wn || It || Nn || !e.isComposing() || (Xe = 0, J(null));
|
|
1014
1031
|
} else
|
|
1015
|
-
|
|
1032
|
+
zn(!1, e, r !== null ? r : void 0), Ue && (sn(e, r || void 0), Ue = !1);
|
|
1016
1033
|
q(), qr(M());
|
|
1017
|
-
}),
|
|
1034
|
+
}), Le = null;
|
|
1018
1035
|
}], ["click", function(n, e) {
|
|
1019
1036
|
X(e, () => {
|
|
1020
1037
|
const t = I(), r = se(e._window), s = ot();
|
|
@@ -1026,16 +1043,16 @@ const oe = Object.freeze({}), mn = 30, xn = [["keydown", function(n, e) {
|
|
|
1026
1043
|
const i = r.anchorNode;
|
|
1027
1044
|
if (i !== null) {
|
|
1028
1045
|
const o = i.nodeType;
|
|
1029
|
-
(o ===
|
|
1046
|
+
(o === rt || o === Te) && ue(Ht(s, r, e, n));
|
|
1030
1047
|
}
|
|
1031
1048
|
}
|
|
1032
1049
|
}
|
|
1033
|
-
w(e,
|
|
1050
|
+
w(e, Ws, n);
|
|
1034
1051
|
});
|
|
1035
1052
|
}], ["cut", oe], ["copy", oe], ["dragstart", oe], ["dragover", oe], ["dragend", oe], ["paste", oe], ["focus", oe], ["blur", oe], ["drop", oe]];
|
|
1036
|
-
vt &&
|
|
1037
|
-
const s = t.inputType, i =
|
|
1038
|
-
s === "deleteCompositionText" || xe &&
|
|
1053
|
+
vt && vn.push(["beforeinput", (n, e) => function(t, r) {
|
|
1054
|
+
const s = t.inputType, i = ys(t);
|
|
1055
|
+
s === "deleteCompositionText" || xe && is(r) || s !== "insertCompositionText" && X(r, () => {
|
|
1039
1056
|
const o = I();
|
|
1040
1057
|
if (s === "deleteContentBackward") {
|
|
1041
1058
|
if (o === null) {
|
|
@@ -1045,42 +1062,42 @@ vt && xn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1045
1062
|
}
|
|
1046
1063
|
if (F(o)) {
|
|
1047
1064
|
const d = o.anchor.key === o.focus.key;
|
|
1048
|
-
if (l = t.timeStamp,
|
|
1049
|
-
if (J(null),
|
|
1065
|
+
if (l = t.timeStamp, hs === "MediaLast" && l < Xe + xn && r.isComposing() && d) {
|
|
1066
|
+
if (J(null), Xe = 0, setTimeout(() => {
|
|
1050
1067
|
X(r, () => {
|
|
1051
1068
|
J(null);
|
|
1052
1069
|
});
|
|
1053
|
-
},
|
|
1070
|
+
}, xn), F(o)) {
|
|
1054
1071
|
const g = o.anchor.getNode();
|
|
1055
|
-
g.markDirty(), o.format = g.getFormat(), N(g) ||
|
|
1072
|
+
g.markDirty(), o.format = g.getFormat(), N(g) || k(142), o.style = g.getStyle();
|
|
1056
1073
|
}
|
|
1057
1074
|
} else {
|
|
1058
1075
|
J(null), t.preventDefault();
|
|
1059
1076
|
const g = o.anchor.getNode().getTextContent(), p = o.anchor.offset === 0 && o.focus.offset === g.length;
|
|
1060
|
-
|
|
1077
|
+
ii && d && !p || w(r, yt, !0);
|
|
1061
1078
|
}
|
|
1062
1079
|
return;
|
|
1063
1080
|
}
|
|
1064
1081
|
}
|
|
1065
1082
|
var l;
|
|
1066
1083
|
if (!F(o)) return;
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
const
|
|
1084
|
+
const a = t.data;
|
|
1085
|
+
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 c = o.anchor, f = o.focus, h = c.getNode(), u = f.getNode();
|
|
1070
1087
|
if (s !== "insertText" && s !== "insertTranspose") switch (t.preventDefault(), s) {
|
|
1071
1088
|
case "insertFromYank":
|
|
1072
1089
|
case "insertFromDrop":
|
|
1073
1090
|
case "insertReplacementText":
|
|
1074
|
-
w(r,
|
|
1091
|
+
w(r, He, t);
|
|
1075
1092
|
break;
|
|
1076
1093
|
case "insertFromComposition":
|
|
1077
|
-
J(null), w(r,
|
|
1094
|
+
J(null), w(r, He, t);
|
|
1078
1095
|
break;
|
|
1079
1096
|
case "insertLineBreak":
|
|
1080
1097
|
J(null), w(r, gt, !1);
|
|
1081
1098
|
break;
|
|
1082
1099
|
case "insertParagraph":
|
|
1083
|
-
J(null),
|
|
1100
|
+
J(null), Ze && !It ? (Ze = !1, w(r, gt, !1)) : w(r, Zn, void 0);
|
|
1084
1101
|
break;
|
|
1085
1102
|
case "insertFromPaste":
|
|
1086
1103
|
case "insertFromPasteAsQuotation":
|
|
@@ -1132,98 +1149,98 @@ vt && xn.push(["beforeinput", (n, e) => function(t, r) {
|
|
|
1132
1149
|
w(r, Rr, void 0);
|
|
1133
1150
|
}
|
|
1134
1151
|
else {
|
|
1135
|
-
if (
|
|
1152
|
+
if (a === `
|
|
1136
1153
|
`) t.preventDefault(), w(r, gt, !1);
|
|
1137
|
-
else if (
|
|
1138
|
-
else if (
|
|
1154
|
+
else if (a === ce) t.preventDefault(), w(r, Zn, void 0);
|
|
1155
|
+
else if (a == null && t.dataTransfer) {
|
|
1139
1156
|
const d = t.dataTransfer.getData("text/plain");
|
|
1140
1157
|
t.preventDefault(), o.insertRawText(d);
|
|
1141
|
-
} else
|
|
1142
|
-
|
|
1158
|
+
} else a != null && ps(o, i, a, t.timeStamp, !0) ? (t.preventDefault(), w(r, He, a)) : Le = a;
|
|
1159
|
+
gs = t.timeStamp;
|
|
1143
1160
|
}
|
|
1144
1161
|
});
|
|
1145
1162
|
}(n, e)]);
|
|
1146
|
-
let
|
|
1163
|
+
let Xe = 0, hs = null, gs = 0, Le = null;
|
|
1147
1164
|
const Dt = /* @__PURE__ */ new WeakMap();
|
|
1148
|
-
let
|
|
1149
|
-
function
|
|
1150
|
-
const i = n.anchor, o = n.focus, l = i.getNode(),
|
|
1151
|
-
return h !== o.key || !N(l) || (!s && (!vt ||
|
|
1165
|
+
let Sn = !1, Tn = !1, Ze = !1, Ue = !1, _s = [0, "", 0, "root", 0];
|
|
1166
|
+
function ps(n, e, t, r, s) {
|
|
1167
|
+
const i = n.anchor, o = n.focus, l = i.getNode(), a = M(), c = se(a._window), f = c !== null ? c.anchorNode : null, h = i.key, u = a.getElementByKey(h), d = t.length;
|
|
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) || c !== null && e !== null && (!e.collapsed || e.startContainer !== c.anchorNode || e.startOffset !== c.anchorOffset) || l.getFormat() !== n.format || l.getStyle() !== n.style || wi(n, l);
|
|
1152
1169
|
}
|
|
1153
1170
|
function pr(n, e) {
|
|
1154
1171
|
return n !== null && n.nodeValue !== null && n.nodeType === Te && e !== 0 && e !== n.nodeValue.length;
|
|
1155
1172
|
}
|
|
1156
1173
|
function yr(n, e, t) {
|
|
1157
1174
|
const { anchorNode: r, anchorOffset: s, focusNode: i, focusOffset: o } = n;
|
|
1158
|
-
|
|
1175
|
+
Sn && (Sn = !1, pr(r, s) && pr(i, o)) || X(e, () => {
|
|
1159
1176
|
if (!t) return void ue(null);
|
|
1160
1177
|
if (!Mt(e, r, i)) return;
|
|
1161
1178
|
const l = I();
|
|
1162
1179
|
if (F(l)) {
|
|
1163
|
-
const
|
|
1180
|
+
const a = l.anchor, c = a.getNode();
|
|
1164
1181
|
if (l.isCollapsed()) {
|
|
1165
1182
|
n.type === "Range" && n.anchorNode === n.focusNode && (l.dirty = !0);
|
|
1166
|
-
const f = Kt(e).event, h = f ? f.timeStamp : performance.now(), [u, d, g, p, _] =
|
|
1167
|
-
if (h < _ + 200 &&
|
|
1168
|
-
else if (
|
|
1169
|
-
else if (
|
|
1170
|
-
const x =
|
|
1171
|
-
l.style = "", x instanceof
|
|
1183
|
+
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 && a.offset === g && a.key === p) l.format = u, l.style = d;
|
|
1185
|
+
else if (a.type === "text") N(c) || k(141), l.format = c.getFormat(), l.style = c.getStyle();
|
|
1186
|
+
else if (a.type === "element" && !y) {
|
|
1187
|
+
const x = a.getNode();
|
|
1188
|
+
l.style = "", x instanceof ze && x.getChildrenSize() === 0 ? (l.format = x.getTextFormat(), l.style = x.getTextStyle()) : l.format = 0;
|
|
1172
1189
|
}
|
|
1173
1190
|
} else {
|
|
1174
|
-
const f =
|
|
1191
|
+
const f = a.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;
|
|
1175
1192
|
let x = ci, C = !1;
|
|
1176
|
-
for (let
|
|
1177
|
-
const v = u[
|
|
1178
|
-
if (N(v) && P !== 0 && !(
|
|
1193
|
+
for (let b = 0; b < d; b++) {
|
|
1194
|
+
const v = u[b], P = v.getTextContentSize();
|
|
1195
|
+
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;
|
|
1179
1196
|
}
|
|
1180
1197
|
l.format = C ? x : 0;
|
|
1181
1198
|
}
|
|
1182
1199
|
}
|
|
1183
|
-
w(e,
|
|
1200
|
+
w(e, bn, void 0);
|
|
1184
1201
|
});
|
|
1185
1202
|
}
|
|
1186
|
-
function
|
|
1203
|
+
function ys(n) {
|
|
1187
1204
|
if (!n.getTargetRanges) return null;
|
|
1188
1205
|
const e = n.getTargetRanges();
|
|
1189
1206
|
return e.length === 0 ? null : e[0];
|
|
1190
1207
|
}
|
|
1191
|
-
function
|
|
1208
|
+
function sn(n, e) {
|
|
1192
1209
|
const t = n._compositionKey;
|
|
1193
1210
|
if (J(null), t !== null && e != null) {
|
|
1194
1211
|
if (e === "") {
|
|
1195
1212
|
const r = V(t), s = kt(n.getElementByKey(t));
|
|
1196
|
-
return void (s !== null && s.nodeValue !== null && N(r) &&
|
|
1213
|
+
return void (s !== null && s.nodeValue !== null && N(r) && Bn(r, s.nodeValue, null, null, !0));
|
|
1197
1214
|
}
|
|
1198
1215
|
if (e[e.length - 1] === `
|
|
1199
1216
|
`) {
|
|
1200
1217
|
const r = I();
|
|
1201
1218
|
if (F(r)) {
|
|
1202
1219
|
const s = r.focus;
|
|
1203
|
-
return r.anchor.set(s.key, s.offset, s.type), void w(n,
|
|
1220
|
+
return r.anchor.set(s.key, s.offset, s.type), void w(n, fn, null);
|
|
1204
1221
|
}
|
|
1205
1222
|
}
|
|
1206
1223
|
}
|
|
1207
|
-
|
|
1224
|
+
zn(!0, n, e);
|
|
1208
1225
|
}
|
|
1209
|
-
function
|
|
1226
|
+
function ms(n) {
|
|
1210
1227
|
let e = n.__lexicalEventHandles;
|
|
1211
1228
|
return e === void 0 && (e = [], n.__lexicalEventHandles = e), e;
|
|
1212
1229
|
}
|
|
1213
|
-
const
|
|
1214
|
-
function
|
|
1230
|
+
const Ie = /* @__PURE__ */ new Map();
|
|
1231
|
+
function xs(n) {
|
|
1215
1232
|
const e = n.target, t = se(e == null ? null : e.nodeType === 9 ? e.defaultView : e.ownerDocument.defaultView);
|
|
1216
1233
|
if (t === null) return;
|
|
1217
1234
|
const r = Zr(t.anchorNode);
|
|
1218
1235
|
if (r === null) return;
|
|
1219
|
-
|
|
1220
|
-
const
|
|
1236
|
+
Tn && (Tn = !1, X(r, () => {
|
|
1237
|
+
const c = ot(), f = t.anchorNode;
|
|
1221
1238
|
if (f === null) return;
|
|
1222
1239
|
const h = f.nodeType;
|
|
1223
|
-
h !==
|
|
1240
|
+
h !== rt && h !== Te || ue(Ht(c, t, r, n));
|
|
1224
1241
|
}));
|
|
1225
|
-
const s =
|
|
1226
|
-
|
|
1242
|
+
const s = Wn(r), i = s[s.length - 1], o = i._key, l = Ie.get(o), a = l || i;
|
|
1243
|
+
a !== r && yr(t, a, !1), yr(t, r, !0), r !== i ? Ie.set(o, r) : l && Ie.delete(o);
|
|
1227
1244
|
}
|
|
1228
1245
|
function mr(n) {
|
|
1229
1246
|
n._lexicalHandled = !0;
|
|
@@ -1231,61 +1248,61 @@ function mr(n) {
|
|
|
1231
1248
|
function xr(n) {
|
|
1232
1249
|
return n._lexicalHandled === !0;
|
|
1233
1250
|
}
|
|
1234
|
-
function
|
|
1251
|
+
function Wi(n) {
|
|
1235
1252
|
const e = n.ownerDocument, t = Dt.get(e);
|
|
1236
|
-
t === void 0 &&
|
|
1253
|
+
t === void 0 && k(162);
|
|
1237
1254
|
const r = t - 1;
|
|
1238
|
-
r >= 0 ||
|
|
1255
|
+
r >= 0 || k(164), Dt.set(e, r), r === 0 && e.removeEventListener("selectionchange", xs);
|
|
1239
1256
|
const s = Wt(n);
|
|
1240
|
-
|
|
1257
|
+
Mn(s) ? (function(o) {
|
|
1241
1258
|
if (o._parentEditor !== null) {
|
|
1242
|
-
const l =
|
|
1243
|
-
|
|
1244
|
-
} else
|
|
1245
|
-
}(s), n.__lexicalEditor = null) : s &&
|
|
1246
|
-
const i =
|
|
1259
|
+
const l = Wn(o), a = l[l.length - 1]._key;
|
|
1260
|
+
Ie.get(a) === o && Ie.delete(a);
|
|
1261
|
+
} else Ie.delete(o._key);
|
|
1262
|
+
}(s), n.__lexicalEditor = null) : s && k(198);
|
|
1263
|
+
const i = ms(n);
|
|
1247
1264
|
for (let o = 0; o < i.length; o++) i[o]();
|
|
1248
1265
|
n.__lexicalEventHandles = [];
|
|
1249
1266
|
}
|
|
1250
|
-
function
|
|
1267
|
+
function Cn(n, e, t) {
|
|
1251
1268
|
q();
|
|
1252
1269
|
const r = n.__key, s = n.getParent();
|
|
1253
1270
|
if (s === null) return;
|
|
1254
1271
|
const i = function(l) {
|
|
1255
|
-
const
|
|
1256
|
-
if (!F(
|
|
1257
|
-
const { anchor:
|
|
1258
|
-
return
|
|
1272
|
+
const a = I();
|
|
1273
|
+
if (!F(a) || !S(l)) return a;
|
|
1274
|
+
const { anchor: c, focus: f } = a, h = c.getNode(), u = f.getNode();
|
|
1275
|
+
return Qe(h, l) && c.set(l.__key, 0, "element"), Qe(u, l) && f.set(l.__key, 0, "element"), a;
|
|
1259
1276
|
}(n);
|
|
1260
1277
|
let o = !1;
|
|
1261
1278
|
if (F(i) && e) {
|
|
1262
|
-
const l = i.anchor,
|
|
1263
|
-
l.key === r && (Ot(l, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0),
|
|
1279
|
+
const l = i.anchor, a = i.focus;
|
|
1280
|
+
l.key === r && (Ot(l, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0), a.key === r && (Ot(a, n, s, n.getPreviousSibling(), n.getNextSibling()), o = !0);
|
|
1264
1281
|
} else jt(i) && e && n.isSelected() && n.selectPrevious();
|
|
1265
1282
|
if (F(i) && e && !o) {
|
|
1266
1283
|
const l = n.getIndexWithinParent();
|
|
1267
1284
|
Ne(n), Lt(i, s, l, -1);
|
|
1268
1285
|
} else Ne(n);
|
|
1269
|
-
t ||
|
|
1286
|
+
t || Pe(s) || s.canBeEmpty() || !s.isEmpty() || Cn(s, e), e && Z(s) && s.isEmpty() && s.selectEnd();
|
|
1270
1287
|
}
|
|
1271
1288
|
class Ut {
|
|
1272
1289
|
static getType() {
|
|
1273
|
-
|
|
1290
|
+
k(64, this.name);
|
|
1274
1291
|
}
|
|
1275
1292
|
static clone(e) {
|
|
1276
|
-
|
|
1293
|
+
k(65, this.name);
|
|
1277
1294
|
}
|
|
1278
1295
|
afterCloneFrom(e) {
|
|
1279
1296
|
this.__parent = e.__parent, this.__next = e.__next, this.__prev = e.__prev;
|
|
1280
1297
|
}
|
|
1281
1298
|
constructor(e) {
|
|
1282
|
-
this.__type = this.constructor.getType(), this.__parent = null, this.__prev = null, this.__next = null,
|
|
1299
|
+
this.__type = this.constructor.getType(), this.__parent = null, this.__prev = null, this.__next = null, Gr(this, e);
|
|
1283
1300
|
}
|
|
1284
1301
|
getType() {
|
|
1285
1302
|
return this.__type;
|
|
1286
1303
|
}
|
|
1287
1304
|
isInline() {
|
|
1288
|
-
|
|
1305
|
+
k(137, this.constructor.name);
|
|
1289
1306
|
}
|
|
1290
1307
|
isAttached() {
|
|
1291
1308
|
let e = this.__key;
|
|
@@ -1331,20 +1348,20 @@ class Ut {
|
|
|
1331
1348
|
}
|
|
1332
1349
|
getParentOrThrow() {
|
|
1333
1350
|
const e = this.getParent();
|
|
1334
|
-
return e === null &&
|
|
1351
|
+
return e === null && k(66, this.__key), e;
|
|
1335
1352
|
}
|
|
1336
1353
|
getTopLevelElement() {
|
|
1337
1354
|
let e = this;
|
|
1338
1355
|
for (; e !== null; ) {
|
|
1339
1356
|
const t = e.getParent();
|
|
1340
|
-
if (
|
|
1357
|
+
if (Pe(t)) return S(e) || e === this && A(e) || k(194), e;
|
|
1341
1358
|
e = t;
|
|
1342
1359
|
}
|
|
1343
1360
|
return null;
|
|
1344
1361
|
}
|
|
1345
1362
|
getTopLevelElementOrThrow() {
|
|
1346
1363
|
const e = this.getTopLevelElement();
|
|
1347
|
-
return e === null &&
|
|
1364
|
+
return e === null && k(67, this.__key), e;
|
|
1348
1365
|
}
|
|
1349
1366
|
getParents() {
|
|
1350
1367
|
const e = [];
|
|
@@ -1386,8 +1403,8 @@ class Ut {
|
|
|
1386
1403
|
if (s === 0 || i === 0 || t[s - 1] !== r[i - 1]) return null;
|
|
1387
1404
|
const o = new Set(r);
|
|
1388
1405
|
for (let l = 0; l < s; l++) {
|
|
1389
|
-
const
|
|
1390
|
-
if (o.has(
|
|
1406
|
+
const a = t[l];
|
|
1407
|
+
if (o.has(a)) return a;
|
|
1391
1408
|
}
|
|
1392
1409
|
return null;
|
|
1393
1410
|
}
|
|
@@ -1439,16 +1456,16 @@ class Ut {
|
|
|
1439
1456
|
i = l;
|
|
1440
1457
|
continue;
|
|
1441
1458
|
}
|
|
1442
|
-
const
|
|
1443
|
-
if (
|
|
1444
|
-
i =
|
|
1459
|
+
const a = t ? i.getNextSibling() : i.getPreviousSibling();
|
|
1460
|
+
if (a !== null) {
|
|
1461
|
+
i = a;
|
|
1445
1462
|
continue;
|
|
1446
1463
|
}
|
|
1447
|
-
const
|
|
1448
|
-
if (s.has(
|
|
1449
|
-
let f = null, h =
|
|
1464
|
+
const c = i.getParentOrThrow();
|
|
1465
|
+
if (s.has(c.__key) || r.push(c), c === e) break;
|
|
1466
|
+
let f = null, h = c;
|
|
1450
1467
|
do {
|
|
1451
|
-
if (h === null &&
|
|
1468
|
+
if (h === null && k(68), f = t ? h.getNextSibling() : h.getPreviousSibling(), h = h.getParent(), h === null) break;
|
|
1452
1469
|
f !== null || s.has(h.__key) || r.push(h);
|
|
1453
1470
|
} while (f === null);
|
|
1454
1471
|
i = f;
|
|
@@ -1461,14 +1478,14 @@ class Ut {
|
|
|
1461
1478
|
}
|
|
1462
1479
|
getLatest() {
|
|
1463
1480
|
const e = V(this.__key);
|
|
1464
|
-
return e === null &&
|
|
1481
|
+
return e === null && k(113), e;
|
|
1465
1482
|
}
|
|
1466
1483
|
getWritable() {
|
|
1467
1484
|
q();
|
|
1468
1485
|
const e = fe(), t = M(), r = e._nodeMap, s = this.__key, i = this.getLatest(), o = t._cloneNotNeeded, l = I();
|
|
1469
1486
|
if (l !== null && l.setCachedNodes(null), o.has(s)) return wt(i), i;
|
|
1470
|
-
const
|
|
1471
|
-
return o.add(s), wt(
|
|
1487
|
+
const a = Oi(i);
|
|
1488
|
+
return o.add(s), wt(a), r.set(s, a), a;
|
|
1472
1489
|
}
|
|
1473
1490
|
getTextContent() {
|
|
1474
1491
|
return "";
|
|
@@ -1477,34 +1494,34 @@ class Ut {
|
|
|
1477
1494
|
return this.getTextContent().length;
|
|
1478
1495
|
}
|
|
1479
1496
|
createDOM(e, t) {
|
|
1480
|
-
|
|
1497
|
+
k(70);
|
|
1481
1498
|
}
|
|
1482
1499
|
updateDOM(e, t, r) {
|
|
1483
|
-
|
|
1500
|
+
k(71);
|
|
1484
1501
|
}
|
|
1485
1502
|
exportDOM(e) {
|
|
1486
1503
|
return { element: this.createDOM(e._config, e) };
|
|
1487
1504
|
}
|
|
1488
1505
|
exportJSON() {
|
|
1489
|
-
|
|
1506
|
+
k(72);
|
|
1490
1507
|
}
|
|
1491
1508
|
static importJSON(e) {
|
|
1492
|
-
|
|
1509
|
+
k(18, this.name);
|
|
1493
1510
|
}
|
|
1494
1511
|
static transform() {
|
|
1495
1512
|
return null;
|
|
1496
1513
|
}
|
|
1497
1514
|
remove(e) {
|
|
1498
|
-
|
|
1515
|
+
Cn(this, !0, e);
|
|
1499
1516
|
}
|
|
1500
1517
|
replace(e, t) {
|
|
1501
1518
|
q();
|
|
1502
1519
|
let r = I();
|
|
1503
|
-
r !== null && (r = r.clone()),
|
|
1504
|
-
const s = this.getLatest(), i = this.__key, o = e.__key, l = e.getWritable(),
|
|
1520
|
+
r !== null && (r = r.clone()), tn(this, e);
|
|
1521
|
+
const s = this.getLatest(), i = this.__key, o = e.__key, l = e.getWritable(), a = this.getParentOrThrow().getWritable(), c = a.__size;
|
|
1505
1522
|
Ne(l);
|
|
1506
1523
|
const f = s.getPreviousSibling(), h = s.getNextSibling(), u = s.__prev, d = s.__next, g = s.__parent;
|
|
1507
|
-
if (
|
|
1524
|
+
if (Cn(s, !1, !0), f === null ? a.__first = o : f.getWritable().__next = o, l.__prev = u, h === null ? a.__last = o : h.getWritable().__prev = o, l.__next = d, l.__parent = g, a.__size = c, t && (S(this) && S(l) || k(139), this.getChildren().forEach((p) => {
|
|
1508
1525
|
l.append(p);
|
|
1509
1526
|
})), F(r)) {
|
|
1510
1527
|
ue(r);
|
|
@@ -1514,33 +1531,33 @@ class Ut {
|
|
|
1514
1531
|
return ye() === i && J(o), l;
|
|
1515
1532
|
}
|
|
1516
1533
|
insertAfter(e, t = !0) {
|
|
1517
|
-
q(),
|
|
1534
|
+
q(), tn(this, e);
|
|
1518
1535
|
const r = this.getWritable(), s = e.getWritable(), i = s.getParent(), o = I();
|
|
1519
|
-
let l = !1,
|
|
1536
|
+
let l = !1, a = !1;
|
|
1520
1537
|
if (i !== null) {
|
|
1521
1538
|
const d = e.getIndexWithinParent();
|
|
1522
1539
|
if (Ne(s), F(o)) {
|
|
1523
1540
|
const g = i.__key, p = o.anchor, _ = o.focus;
|
|
1524
|
-
l = p.type === "element" && p.key === g && p.offset === d + 1,
|
|
1541
|
+
l = p.type === "element" && p.key === g && p.offset === d + 1, a = _.type === "element" && _.key === g && _.offset === d + 1;
|
|
1525
1542
|
}
|
|
1526
1543
|
}
|
|
1527
|
-
const
|
|
1528
|
-
if (
|
|
1544
|
+
const c = this.getNextSibling(), f = this.getParentOrThrow().getWritable(), h = s.__key, u = r.__next;
|
|
1545
|
+
if (c === null ? f.__last = h : c.getWritable().__prev = h, f.__size++, r.__next = h, s.__next = u, s.__prev = r.__key, s.__parent = r.__parent, t && F(o)) {
|
|
1529
1546
|
const d = this.getIndexWithinParent();
|
|
1530
1547
|
Lt(o, f, d + 1);
|
|
1531
1548
|
const g = f.__key;
|
|
1532
|
-
l && o.anchor.set(g, d + 2, "element"),
|
|
1549
|
+
l && o.anchor.set(g, d + 2, "element"), a && o.focus.set(g, d + 2, "element");
|
|
1533
1550
|
}
|
|
1534
1551
|
return e;
|
|
1535
1552
|
}
|
|
1536
1553
|
insertBefore(e, t = !0) {
|
|
1537
|
-
q(),
|
|
1554
|
+
q(), tn(this, e);
|
|
1538
1555
|
const r = this.getWritable(), s = e.getWritable(), i = s.__key;
|
|
1539
1556
|
Ne(s);
|
|
1540
|
-
const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(),
|
|
1541
|
-
o === null ? l.__first = i : o.getWritable().__next = i, l.__size++, r.__prev = i, s.__prev =
|
|
1557
|
+
const o = this.getPreviousSibling(), l = this.getParentOrThrow().getWritable(), a = r.__prev, c = this.getIndexWithinParent();
|
|
1558
|
+
o === null ? l.__first = i : o.getWritable().__next = i, l.__size++, r.__prev = i, s.__prev = a, s.__next = r.__key, s.__parent = r.__parent;
|
|
1542
1559
|
const f = I();
|
|
1543
|
-
return t && F(f) && Lt(f, this.getParentOrThrow(),
|
|
1560
|
+
return t && F(f) && Lt(f, this.getParentOrThrow(), c), e;
|
|
1544
1561
|
}
|
|
1545
1562
|
isParentRequired() {
|
|
1546
1563
|
return !1;
|
|
@@ -1620,83 +1637,83 @@ class st extends Ut {
|
|
|
1620
1637
|
if (i === t || i.previousSibling === t && dt(i)) return !0;
|
|
1621
1638
|
}
|
|
1622
1639
|
return !1;
|
|
1623
|
-
}(e) ? null : { conversion:
|
|
1640
|
+
}(e) ? null : { conversion: zi, priority: 0 } };
|
|
1624
1641
|
}
|
|
1625
1642
|
static importJSON(e) {
|
|
1626
|
-
return
|
|
1643
|
+
return nt();
|
|
1627
1644
|
}
|
|
1628
1645
|
exportJSON() {
|
|
1629
1646
|
return { type: "linebreak", version: 1 };
|
|
1630
1647
|
}
|
|
1631
1648
|
}
|
|
1632
|
-
function
|
|
1633
|
-
return { node:
|
|
1649
|
+
function zi(n) {
|
|
1650
|
+
return { node: nt() };
|
|
1634
1651
|
}
|
|
1635
|
-
function
|
|
1652
|
+
function nt() {
|
|
1636
1653
|
return $t(new st());
|
|
1637
1654
|
}
|
|
1638
|
-
function
|
|
1655
|
+
function Ae(n) {
|
|
1639
1656
|
return n instanceof st;
|
|
1640
1657
|
}
|
|
1641
1658
|
function dt(n) {
|
|
1642
1659
|
return n.nodeType === Te && /^( |\t|\r?\n)+$/.test(n.textContent || "");
|
|
1643
1660
|
}
|
|
1644
|
-
function sn(n, e) {
|
|
1645
|
-
return 16 & e ? "code" : e & Nn ? "mark" : 32 & e ? "sub" : 64 & e ? "sup" : null;
|
|
1646
|
-
}
|
|
1647
1661
|
function on(n, e) {
|
|
1662
|
+
return 16 & e ? "code" : e & En ? "mark" : 32 & e ? "sub" : 64 & e ? "sup" : null;
|
|
1663
|
+
}
|
|
1664
|
+
function ln(n, e) {
|
|
1648
1665
|
return 1 & e ? "strong" : 2 & e ? "em" : "span";
|
|
1649
1666
|
}
|
|
1650
|
-
function
|
|
1667
|
+
function vs(n, e, t, r, s) {
|
|
1651
1668
|
const i = r.classList;
|
|
1652
|
-
let o =
|
|
1653
|
-
o !== void 0 && i.add(...o), o =
|
|
1669
|
+
let o = qe(s, "base");
|
|
1670
|
+
o !== void 0 && i.add(...o), o = qe(s, "underlineStrikethrough");
|
|
1654
1671
|
let l = !1;
|
|
1655
|
-
const
|
|
1656
|
-
o !== void 0 && (t & Tt && t & St ? (l = !0,
|
|
1657
|
-
for (const
|
|
1658
|
-
const f =
|
|
1659
|
-
if (o =
|
|
1660
|
-
if (l && (
|
|
1672
|
+
const a = e & Tt && e & St;
|
|
1673
|
+
o !== void 0 && (t & Tt && t & St ? (l = !0, a || i.add(...o)) : a && i.remove(...o));
|
|
1674
|
+
for (const c in ae) {
|
|
1675
|
+
const f = ae[c];
|
|
1676
|
+
if (o = qe(s, c), o !== void 0) if (t & f) {
|
|
1677
|
+
if (l && (c === "underline" || c === "strikethrough")) {
|
|
1661
1678
|
e & f && i.remove(...o);
|
|
1662
1679
|
continue;
|
|
1663
1680
|
}
|
|
1664
|
-
e & f && (!
|
|
1681
|
+
e & f && (!a || c !== "underline") && c !== "strikethrough" || i.add(...o);
|
|
1665
1682
|
} else e & f && i.remove(...o);
|
|
1666
1683
|
}
|
|
1667
1684
|
}
|
|
1668
|
-
function
|
|
1685
|
+
function Ss(n, e, t) {
|
|
1669
1686
|
const r = e.firstChild, s = t.isComposing(), i = n + (s ? At : "");
|
|
1670
1687
|
if (r == null) e.textContent = i;
|
|
1671
1688
|
else {
|
|
1672
1689
|
const o = r.nodeValue;
|
|
1673
1690
|
if (o !== i) if (s || xe) {
|
|
1674
|
-
const [l,
|
|
1691
|
+
const [l, a, c] = function(f, h) {
|
|
1675
1692
|
const u = f.length, d = h.length;
|
|
1676
1693
|
let g = 0, p = 0;
|
|
1677
1694
|
for (; g < u && g < d && f[g] === h[g]; ) g++;
|
|
1678
1695
|
for (; p + g < u && p + g < d && f[u - p - 1] === h[d - p - 1]; ) p++;
|
|
1679
1696
|
return [g, u - g - p, h.slice(g, d - p)];
|
|
1680
1697
|
}(o, i);
|
|
1681
|
-
|
|
1698
|
+
a !== 0 && r.deleteData(l, a), r.insertData(l, c);
|
|
1682
1699
|
} else r.nodeValue = i;
|
|
1683
1700
|
}
|
|
1684
1701
|
}
|
|
1685
1702
|
function vr(n, e, t, r, s, i) {
|
|
1686
|
-
|
|
1703
|
+
Ss(s, n, e);
|
|
1687
1704
|
const o = i.theme.text;
|
|
1688
|
-
o !== void 0 &&
|
|
1705
|
+
o !== void 0 && vs(0, 0, r, n, o);
|
|
1689
1706
|
}
|
|
1690
1707
|
function ht(n, e) {
|
|
1691
1708
|
const t = document.createElement(e);
|
|
1692
1709
|
return t.appendChild(n), t;
|
|
1693
1710
|
}
|
|
1694
|
-
class
|
|
1711
|
+
class We extends Ut {
|
|
1695
1712
|
static getType() {
|
|
1696
1713
|
return "text";
|
|
1697
1714
|
}
|
|
1698
1715
|
static clone(e) {
|
|
1699
|
-
return new
|
|
1716
|
+
return new We(e.__text, e.__key);
|
|
1700
1717
|
}
|
|
1701
1718
|
afterCloneFrom(e) {
|
|
1702
1719
|
super.afterCloneFrom(e), this.__format = e.__format, this.__style = e.__style, this.__mode = e.__mode, this.__detail = e.__detail;
|
|
@@ -1712,7 +1729,7 @@ class Me extends Ut {
|
|
|
1712
1729
|
}
|
|
1713
1730
|
getMode() {
|
|
1714
1731
|
const e = this.getLatest();
|
|
1715
|
-
return
|
|
1732
|
+
return pi[e.__mode];
|
|
1716
1733
|
}
|
|
1717
1734
|
getStyle() {
|
|
1718
1735
|
return this.getLatest().__style;
|
|
@@ -1733,7 +1750,7 @@ class Me extends Ut {
|
|
|
1733
1750
|
return !!(2 & this.getLatest().__detail);
|
|
1734
1751
|
}
|
|
1735
1752
|
hasFormat(e) {
|
|
1736
|
-
const t =
|
|
1753
|
+
const t = ae[e];
|
|
1737
1754
|
return !!(this.getFormat() & t);
|
|
1738
1755
|
}
|
|
1739
1756
|
isSimpleText() {
|
|
@@ -1749,30 +1766,30 @@ class Me extends Ut {
|
|
|
1749
1766
|
return !0;
|
|
1750
1767
|
}
|
|
1751
1768
|
createDOM(e, t) {
|
|
1752
|
-
const r = this.__format, s =
|
|
1753
|
-
let
|
|
1754
|
-
this.hasFormat("code") && l.setAttribute("spellcheck", "false"), s !== null && (
|
|
1755
|
-
const
|
|
1756
|
-
return
|
|
1769
|
+
const r = this.__format, s = on(0, r), i = ln(0, r), o = s === null ? i : s, l = document.createElement(o);
|
|
1770
|
+
let a = l;
|
|
1771
|
+
this.hasFormat("code") && l.setAttribute("spellcheck", "false"), s !== null && (a = document.createElement(i), l.appendChild(a)), vr(a, this, 0, r, this.__text, e);
|
|
1772
|
+
const c = this.__style;
|
|
1773
|
+
return c !== "" && (l.style.cssText = c), l;
|
|
1757
1774
|
}
|
|
1758
1775
|
updateDOM(e, t, r) {
|
|
1759
|
-
const s = this.__text, i = e.__format, o = this.__format, l =
|
|
1760
|
-
if ((l === null ?
|
|
1761
|
-
if (l ===
|
|
1776
|
+
const s = this.__text, i = e.__format, o = this.__format, l = on(0, i), a = on(0, o), c = ln(0, i), f = ln(0, o);
|
|
1777
|
+
if ((l === null ? c : l) !== (a === null ? f : a)) return !0;
|
|
1778
|
+
if (l === a && c !== f) {
|
|
1762
1779
|
const p = t.firstChild;
|
|
1763
|
-
p == null &&
|
|
1780
|
+
p == null && k(48);
|
|
1764
1781
|
const _ = document.createElement(f);
|
|
1765
1782
|
return vr(_, this, 0, o, s, r), t.replaceChild(_, p), !1;
|
|
1766
1783
|
}
|
|
1767
1784
|
let h = t;
|
|
1768
|
-
|
|
1785
|
+
a !== null && l !== null && (h = t.firstChild, h == null && k(49)), Ss(s, h, this);
|
|
1769
1786
|
const u = r.theme.text;
|
|
1770
|
-
u !== void 0 && i !== o &&
|
|
1787
|
+
u !== void 0 && i !== o && vs(0, i, o, h, u);
|
|
1771
1788
|
const d = e.__style, g = this.__style;
|
|
1772
1789
|
return d !== g && (t.style.cssText = g), !1;
|
|
1773
1790
|
}
|
|
1774
1791
|
static importDOM() {
|
|
1775
|
-
return { "#text": () => ({ conversion:
|
|
1792
|
+
return { "#text": () => ({ conversion: $i, priority: 0 }), b: () => ({ conversion: Ri, priority: 0 }), code: () => ({ conversion: ge, priority: 0 }), em: () => ({ conversion: ge, priority: 0 }), i: () => ({ conversion: ge, priority: 0 }), s: () => ({ conversion: ge, priority: 0 }), span: () => ({ conversion: Bi, priority: 0 }), strong: () => ({ conversion: ge, priority: 0 }), sub: () => ({ conversion: ge, priority: 0 }), sup: () => ({ conversion: ge, priority: 0 }), u: () => ({ conversion: ge, priority: 0 }) };
|
|
1776
1793
|
}
|
|
1777
1794
|
static importJSON(e) {
|
|
1778
1795
|
const t = $(e.text);
|
|
@@ -1780,7 +1797,7 @@ class Me extends Ut {
|
|
|
1780
1797
|
}
|
|
1781
1798
|
exportDOM(e) {
|
|
1782
1799
|
let { element: t } = super.exportDOM(e);
|
|
1783
|
-
return t !== null &&
|
|
1800
|
+
return t !== null && $n(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 };
|
|
1784
1801
|
}
|
|
1785
1802
|
exportJSON() {
|
|
1786
1803
|
return { detail: this.getDetail(), format: this.getFormat(), mode: this.getMode(), style: this.getStyle(), text: this.getTextContent(), type: "text", version: 1 };
|
|
@@ -1789,11 +1806,11 @@ class Me extends Ut {
|
|
|
1789
1806
|
}
|
|
1790
1807
|
setFormat(e) {
|
|
1791
1808
|
const t = this.getWritable();
|
|
1792
|
-
return t.__format = typeof e == "string" ?
|
|
1809
|
+
return t.__format = typeof e == "string" ? ae[e] : e, t;
|
|
1793
1810
|
}
|
|
1794
1811
|
setDetail(e) {
|
|
1795
1812
|
const t = this.getWritable();
|
|
1796
|
-
return t.__detail = typeof e == "string" ?
|
|
1813
|
+
return t.__detail = typeof e == "string" ? hi[e] : e, t;
|
|
1797
1814
|
}
|
|
1798
1815
|
setStyle(e) {
|
|
1799
1816
|
const t = this.getWritable();
|
|
@@ -1812,7 +1829,7 @@ class Me extends Ut {
|
|
|
1812
1829
|
return e.__detail ^= 2, e;
|
|
1813
1830
|
}
|
|
1814
1831
|
setMode(e) {
|
|
1815
|
-
const t =
|
|
1832
|
+
const t = _i[e];
|
|
1816
1833
|
if (this.__mode === t) return this;
|
|
1817
1834
|
const r = this.getWritable();
|
|
1818
1835
|
return r.__mode = t, r;
|
|
@@ -1827,13 +1844,13 @@ class Me extends Ut {
|
|
|
1827
1844
|
let r = e, s = t;
|
|
1828
1845
|
const i = I(), o = this.getTextContent(), l = this.__key;
|
|
1829
1846
|
if (typeof o == "string") {
|
|
1830
|
-
const
|
|
1831
|
-
r === void 0 && (r =
|
|
1847
|
+
const a = o.length;
|
|
1848
|
+
r === void 0 && (r = a), s === void 0 && (s = a);
|
|
1832
1849
|
} else r = 0, s = 0;
|
|
1833
|
-
if (!F(i)) return
|
|
1850
|
+
if (!F(i)) return ks(l, r, l, s, "text", "text");
|
|
1834
1851
|
{
|
|
1835
|
-
const
|
|
1836
|
-
|
|
1852
|
+
const a = ye();
|
|
1853
|
+
a !== i.anchor.key && a !== i.focus.key || J(l), i.setTextNodeRange(this, r, this, s);
|
|
1837
1854
|
}
|
|
1838
1855
|
return i;
|
|
1839
1856
|
}
|
|
@@ -1846,14 +1863,14 @@ class Me extends Ut {
|
|
|
1846
1863
|
}
|
|
1847
1864
|
spliceText(e, t, r, s) {
|
|
1848
1865
|
const i = this.getWritable(), o = i.__text, l = r.length;
|
|
1849
|
-
let
|
|
1850
|
-
|
|
1851
|
-
const
|
|
1852
|
-
if (s && F(
|
|
1866
|
+
let a = e;
|
|
1867
|
+
a < 0 && (a = l + a, a < 0 && (a = 0));
|
|
1868
|
+
const c = I();
|
|
1869
|
+
if (s && F(c)) {
|
|
1853
1870
|
const h = e + l;
|
|
1854
|
-
|
|
1871
|
+
c.setTextNodeRange(i, h, i, h);
|
|
1855
1872
|
}
|
|
1856
|
-
const f = o.slice(0,
|
|
1873
|
+
const f = o.slice(0, a) + r + o.slice(a + t);
|
|
1857
1874
|
return i.__text = f, i;
|
|
1858
1875
|
}
|
|
1859
1876
|
canInsertTextBefore() {
|
|
@@ -1864,10 +1881,10 @@ class Me extends Ut {
|
|
|
1864
1881
|
}
|
|
1865
1882
|
splitText(...e) {
|
|
1866
1883
|
q();
|
|
1867
|
-
const t = this.getLatest(), r = t.getTextContent(), s = t.__key, i = ye(), o = new Set(e), l = [],
|
|
1868
|
-
let
|
|
1869
|
-
for (let
|
|
1870
|
-
|
|
1884
|
+
const t = this.getLatest(), r = t.getTextContent(), s = t.__key, i = ye(), o = new Set(e), l = [], a = r.length;
|
|
1885
|
+
let c = "";
|
|
1886
|
+
for (let b = 0; b < a; b++) c !== "" && o.has(b) && (l.push(c), c = ""), c += r[b];
|
|
1887
|
+
c !== "" && l.push(c);
|
|
1871
1888
|
const f = l.length;
|
|
1872
1889
|
if (f === 0) return [];
|
|
1873
1890
|
if (l[0] === r) return [t];
|
|
@@ -1878,8 +1895,8 @@ class Me extends Ut {
|
|
|
1878
1895
|
t.isSegmented() ? (d = $(h), d.__format = g, d.__style = p, d.__detail = _, m = !0) : (d = t.getWritable(), d.__text = h);
|
|
1879
1896
|
const y = I(), x = [d];
|
|
1880
1897
|
let C = h.length;
|
|
1881
|
-
for (let
|
|
1882
|
-
const v = l[
|
|
1898
|
+
for (let b = 1; b < f; b++) {
|
|
1899
|
+
const v = l[b], P = v.length, T = $(v).getWritable();
|
|
1883
1900
|
T.__format = g, T.__style = p, T.__detail = _;
|
|
1884
1901
|
const E = T.__key, D = C + P;
|
|
1885
1902
|
if (F(y)) {
|
|
@@ -1893,14 +1910,14 @@ class Me extends Ut {
|
|
|
1893
1910
|
const T = P.getPreviousSibling(), E = P.getNextSibling();
|
|
1894
1911
|
T !== null && wt(T), E !== null && wt(E);
|
|
1895
1912
|
})(this);
|
|
1896
|
-
const
|
|
1897
|
-
m ? (
|
|
1913
|
+
const b = u.getWritable(), v = this.getIndexWithinParent();
|
|
1914
|
+
m ? (b.splice(v, 0, x), this.remove()) : b.splice(v, 1, x), F(y) && Lt(y, u, v, f - 1);
|
|
1898
1915
|
}
|
|
1899
1916
|
return x;
|
|
1900
1917
|
}
|
|
1901
1918
|
mergeWithSibling(e) {
|
|
1902
1919
|
const t = e === this.getPreviousSibling();
|
|
1903
|
-
t || e === this.getNextSibling() ||
|
|
1920
|
+
t || e === this.getNextSibling() || k(50);
|
|
1904
1921
|
const r = this.__key, s = e.__key, i = this.__text, o = i.length;
|
|
1905
1922
|
ye() === s && J(r);
|
|
1906
1923
|
const l = I();
|
|
@@ -1908,8 +1925,8 @@ class Me extends Ut {
|
|
|
1908
1925
|
const h = l.anchor, u = l.focus;
|
|
1909
1926
|
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);
|
|
1910
1927
|
}
|
|
1911
|
-
const
|
|
1912
|
-
this.setTextContent(
|
|
1928
|
+
const a = e.__text, c = t ? a + i : i + a;
|
|
1929
|
+
this.setTextContent(c);
|
|
1913
1930
|
const f = this.getWritable();
|
|
1914
1931
|
return e.remove(), f;
|
|
1915
1932
|
}
|
|
@@ -1917,27 +1934,27 @@ class Me extends Ut {
|
|
|
1917
1934
|
return !1;
|
|
1918
1935
|
}
|
|
1919
1936
|
}
|
|
1920
|
-
function zi(n) {
|
|
1921
|
-
return { forChild: $n(n.style), node: null };
|
|
1922
|
-
}
|
|
1923
1937
|
function Bi(n) {
|
|
1924
|
-
|
|
1925
|
-
return { forChild: $n(e.style, t ? void 0 : "bold"), node: null };
|
|
1938
|
+
return { forChild: Jn(n.style), node: null };
|
|
1926
1939
|
}
|
|
1927
|
-
const Sr = /* @__PURE__ */ new WeakMap();
|
|
1928
1940
|
function Ri(n) {
|
|
1929
|
-
|
|
1941
|
+
const e = n, t = e.style.fontWeight === "normal";
|
|
1942
|
+
return { forChild: Jn(e.style, t ? void 0 : "bold"), node: null };
|
|
1930
1943
|
}
|
|
1944
|
+
const Sr = /* @__PURE__ */ new WeakMap();
|
|
1931
1945
|
function Ki(n) {
|
|
1946
|
+
return n.nodeName === "PRE" || n.nodeType === rt && n.style !== void 0 && n.style.whiteSpace !== void 0 && n.style.whiteSpace.startsWith("pre");
|
|
1947
|
+
}
|
|
1948
|
+
function $i(n) {
|
|
1932
1949
|
const e = n;
|
|
1933
|
-
n.parentElement === null &&
|
|
1950
|
+
n.parentElement === null && k(129);
|
|
1934
1951
|
let t = e.textContent || "";
|
|
1935
1952
|
if (function(r) {
|
|
1936
1953
|
let s, i = r.parentNode;
|
|
1937
1954
|
const o = [r];
|
|
1938
|
-
for (; i !== null && (s = Sr.get(i)) === void 0 && !
|
|
1955
|
+
for (; i !== null && (s = Sr.get(i)) === void 0 && !Ki(i); ) o.push(i), i = i.parentNode;
|
|
1939
1956
|
const l = s === void 0 ? i : s;
|
|
1940
|
-
for (let
|
|
1957
|
+
for (let a = 0; a < o.length; a++) Sr.set(o[a], l);
|
|
1941
1958
|
return l;
|
|
1942
1959
|
}(e) !== null) {
|
|
1943
1960
|
const r = t.split(/(\r?\n|\t)/), s = [], i = r.length;
|
|
@@ -1945,7 +1962,7 @@ function Ki(n) {
|
|
|
1945
1962
|
const l = r[o];
|
|
1946
1963
|
l === `
|
|
1947
1964
|
` || l === `\r
|
|
1948
|
-
` ? s.push(
|
|
1965
|
+
` ? s.push(nt()) : l === " " ? s.push(Un()) : l !== "" && s.push($(l));
|
|
1949
1966
|
}
|
|
1950
1967
|
return { node: s };
|
|
1951
1968
|
}
|
|
@@ -1981,9 +1998,9 @@ function Tr(n, e) {
|
|
|
1981
1998
|
if (i === null) return null;
|
|
1982
1999
|
t = i;
|
|
1983
2000
|
}
|
|
1984
|
-
if (t = r, t.nodeType ===
|
|
2001
|
+
if (t = r, t.nodeType === rt) {
|
|
1985
2002
|
const i = t.style.display;
|
|
1986
|
-
if (i === "" && !
|
|
2003
|
+
if (i === "" && !Fi(t) || i !== "" && !i.startsWith("inline")) return null;
|
|
1987
2004
|
}
|
|
1988
2005
|
let s = t;
|
|
1989
2006
|
for (; (s = e ? t.firstChild : t.lastChild) !== null; ) t = s;
|
|
@@ -1991,22 +2008,22 @@ function Tr(n, e) {
|
|
|
1991
2008
|
if (t.nodeName === "BR") return null;
|
|
1992
2009
|
}
|
|
1993
2010
|
}
|
|
1994
|
-
const
|
|
2011
|
+
const Ji = { code: "code", em: "italic", i: "italic", s: "strikethrough", strong: "bold", sub: "subscript", sup: "superscript", u: "underline" };
|
|
1995
2012
|
function ge(n) {
|
|
1996
|
-
const e =
|
|
1997
|
-
return e === void 0 ? { node: null } : { forChild:
|
|
2013
|
+
const e = Ji[n.nodeName.toLowerCase()];
|
|
2014
|
+
return e === void 0 ? { node: null } : { forChild: Jn(n.style, e), node: null };
|
|
1998
2015
|
}
|
|
1999
2016
|
function $(n = "") {
|
|
2000
|
-
return $t(new
|
|
2017
|
+
return $t(new We(n));
|
|
2001
2018
|
}
|
|
2002
2019
|
function N(n) {
|
|
2003
|
-
return n instanceof
|
|
2020
|
+
return n instanceof We;
|
|
2004
2021
|
}
|
|
2005
|
-
function
|
|
2006
|
-
const t = n.fontWeight, r = n.textDecoration.split(" "), s = t === "700" || t === "bold", i = r.includes("line-through"), o = n.fontStyle === "italic", l = r.includes("underline"),
|
|
2007
|
-
return (
|
|
2022
|
+
function Jn(n, e) {
|
|
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"), a = n.verticalAlign;
|
|
2024
|
+
return (c) => (N(c) && (s && !c.hasFormat("bold") && c.toggleFormat("bold"), i && !c.hasFormat("strikethrough") && c.toggleFormat("strikethrough"), o && !c.hasFormat("italic") && c.toggleFormat("italic"), l && !c.hasFormat("underline") && c.toggleFormat("underline"), a !== "sub" || c.hasFormat("subscript") || c.toggleFormat("subscript"), a !== "super" || c.hasFormat("superscript") || c.toggleFormat("superscript"), e && !c.hasFormat(e) && c.toggleFormat(e)), c);
|
|
2008
2025
|
}
|
|
2009
|
-
class it extends
|
|
2026
|
+
class it extends We {
|
|
2010
2027
|
static getType() {
|
|
2011
2028
|
return "tab";
|
|
2012
2029
|
}
|
|
@@ -2023,20 +2040,20 @@ class it extends Me {
|
|
|
2023
2040
|
return null;
|
|
2024
2041
|
}
|
|
2025
2042
|
static importJSON(e) {
|
|
2026
|
-
const t =
|
|
2043
|
+
const t = Un();
|
|
2027
2044
|
return t.setFormat(e.format), t.setStyle(e.style), t;
|
|
2028
2045
|
}
|
|
2029
2046
|
exportJSON() {
|
|
2030
2047
|
return { ...super.exportJSON(), type: "tab", version: 1 };
|
|
2031
2048
|
}
|
|
2032
2049
|
setTextContent(e) {
|
|
2033
|
-
|
|
2050
|
+
k(126);
|
|
2034
2051
|
}
|
|
2035
2052
|
setDetail(e) {
|
|
2036
|
-
|
|
2053
|
+
k(127);
|
|
2037
2054
|
}
|
|
2038
2055
|
setMode(e) {
|
|
2039
|
-
|
|
2056
|
+
k(128);
|
|
2040
2057
|
}
|
|
2041
2058
|
canInsertTextBefore() {
|
|
2042
2059
|
return !1;
|
|
@@ -2045,13 +2062,13 @@ class it extends Me {
|
|
|
2045
2062
|
return !1;
|
|
2046
2063
|
}
|
|
2047
2064
|
}
|
|
2048
|
-
function
|
|
2065
|
+
function Un() {
|
|
2049
2066
|
return $t(new it());
|
|
2050
2067
|
}
|
|
2051
|
-
function
|
|
2068
|
+
function Ui(n) {
|
|
2052
2069
|
return n instanceof it;
|
|
2053
2070
|
}
|
|
2054
|
-
class
|
|
2071
|
+
class Vi {
|
|
2055
2072
|
constructor(e, t, r) {
|
|
2056
2073
|
this._selection = null, this.key = e, this.offset = t, this.type = r;
|
|
2057
2074
|
}
|
|
@@ -2073,7 +2090,7 @@ class Ui {
|
|
|
2073
2090
|
}
|
|
2074
2091
|
getNode() {
|
|
2075
2092
|
const e = V(this.key);
|
|
2076
|
-
return e === null &&
|
|
2093
|
+
return e === null && k(20), e;
|
|
2077
2094
|
}
|
|
2078
2095
|
set(e, t, r) {
|
|
2079
2096
|
const s = this._selection, i = this.key;
|
|
@@ -2081,9 +2098,9 @@ class Ui {
|
|
|
2081
2098
|
}
|
|
2082
2099
|
}
|
|
2083
2100
|
function ie(n, e, t) {
|
|
2084
|
-
return new
|
|
2101
|
+
return new Vi(n, e, t);
|
|
2085
2102
|
}
|
|
2086
|
-
function
|
|
2103
|
+
function an(n, e) {
|
|
2087
2104
|
let t = e.__key, r = n.offset, s = "element";
|
|
2088
2105
|
if (N(e)) {
|
|
2089
2106
|
s = "text";
|
|
@@ -2102,8 +2119,8 @@ function ln(n, e) {
|
|
|
2102
2119
|
function Cr(n, e) {
|
|
2103
2120
|
if (S(e)) {
|
|
2104
2121
|
const t = e.getLastDescendant();
|
|
2105
|
-
S(t) || N(t) ?
|
|
2106
|
-
} else
|
|
2122
|
+
S(t) || N(t) ? an(n, t) : an(n, e);
|
|
2123
|
+
} else an(n, e);
|
|
2107
2124
|
}
|
|
2108
2125
|
function pe(n, e, t, r) {
|
|
2109
2126
|
n.key = e, n.offset = t, n.type = r;
|
|
@@ -2205,18 +2222,18 @@ class Ce {
|
|
|
2205
2222
|
const e = this._cachedNodes;
|
|
2206
2223
|
if (e !== null) return e;
|
|
2207
2224
|
const t = this.anchor, r = this.focus, s = t.isBefore(r), i = s ? t : r, o = s ? r : t;
|
|
2208
|
-
let l = i.getNode(),
|
|
2209
|
-
const
|
|
2225
|
+
let l = i.getNode(), a = o.getNode();
|
|
2226
|
+
const c = i.offset, f = o.offset;
|
|
2210
2227
|
if (S(l)) {
|
|
2211
|
-
const u = l.getDescendantByIndex(
|
|
2228
|
+
const u = l.getDescendantByIndex(c);
|
|
2212
2229
|
l = u ?? l;
|
|
2213
2230
|
}
|
|
2214
|
-
if (S(
|
|
2215
|
-
let u =
|
|
2216
|
-
u !== null && u !== l &&
|
|
2231
|
+
if (S(a)) {
|
|
2232
|
+
let u = a.getDescendantByIndex(f);
|
|
2233
|
+
u !== null && u !== l && a.getChildAtIndex(f) === u && (u = u.getPreviousSibling()), a = u ?? a;
|
|
2217
2234
|
}
|
|
2218
2235
|
let h;
|
|
2219
|
-
return h = l.is(
|
|
2236
|
+
return h = l.is(a) ? S(l) && l.getChildrenSize() > 0 ? [] : [l] : l.getNodesBetween(a), lt() || (this._cachedNodes = h), h;
|
|
2220
2237
|
}
|
|
2221
2238
|
setTextNodeRange(e, t, r, s) {
|
|
2222
2239
|
pe(this.anchor, e.__key, t, "text"), pe(this.focus, r.__key, s, "text"), this._cachedNodes = null, this.dirty = !0;
|
|
@@ -2224,21 +2241,21 @@ class Ce {
|
|
|
2224
2241
|
getTextContent() {
|
|
2225
2242
|
const e = this.getNodes();
|
|
2226
2243
|
if (e.length === 0) return "";
|
|
2227
|
-
const t = e[0], r = e[e.length - 1], s = this.anchor, i = this.focus, o = s.isBefore(i), [l,
|
|
2228
|
-
let
|
|
2244
|
+
const t = e[0], r = e[e.length - 1], s = this.anchor, i = this.focus, o = s.isBefore(i), [l, a] = br(this);
|
|
2245
|
+
let c = "", f = !0;
|
|
2229
2246
|
for (let h = 0; h < e.length; h++) {
|
|
2230
2247
|
const u = e[h];
|
|
2231
|
-
if (S(u) && !u.isInline()) f || (
|
|
2248
|
+
if (S(u) && !u.isInline()) f || (c += `
|
|
2232
2249
|
`), f = !u.isEmpty();
|
|
2233
2250
|
else if (f = !1, N(u)) {
|
|
2234
2251
|
let d = u.getTextContent();
|
|
2235
|
-
u === t ? u === r ? s.type === "element" && i.type === "element" && i.offset !== s.offset || (d = l <
|
|
2236
|
-
} else !A(u) && !
|
|
2252
|
+
u === t ? u === r ? s.type === "element" && i.type === "element" && i.offset !== s.offset || (d = l < a ? d.slice(l, a) : d.slice(a, l)) : d = o ? d.slice(l) : d.slice(a) : u === r && (d = o ? d.slice(0, a) : d.slice(0, l)), c += d;
|
|
2253
|
+
} else !A(u) && !Ae(u) || u === r && this.isCollapsed() || (c += u.getTextContent());
|
|
2237
2254
|
}
|
|
2238
|
-
return
|
|
2255
|
+
return c;
|
|
2239
2256
|
}
|
|
2240
2257
|
applyDOMRange(e) {
|
|
2241
|
-
const t = M(), r = t.getEditorState()._selection, s =
|
|
2258
|
+
const t = M(), r = t.getEditorState()._selection, s = Cs(e.startContainer, e.startOffset, e.endContainer, e.endOffset, t, r);
|
|
2242
2259
|
if (s === null) return;
|
|
2243
2260
|
const [i, o] = s;
|
|
2244
2261
|
pe(this.anchor, i.key, i.offset, i.type), pe(this.focus, o.key, o.offset, o.type), this._cachedNodes = null;
|
|
@@ -2254,7 +2271,7 @@ class Ce {
|
|
|
2254
2271
|
this.style = e, this.dirty = !0;
|
|
2255
2272
|
}
|
|
2256
2273
|
hasFormat(e) {
|
|
2257
|
-
const t =
|
|
2274
|
+
const t = ae[e];
|
|
2258
2275
|
return !!(this.format & t);
|
|
2259
2276
|
}
|
|
2260
2277
|
insertRawText(e) {
|
|
@@ -2263,7 +2280,7 @@ class Ce {
|
|
|
2263
2280
|
const o = t[i];
|
|
2264
2281
|
o === `
|
|
2265
2282
|
` || o === `\r
|
|
2266
|
-
` ? r.push(
|
|
2283
|
+
` ? r.push(nt()) : o === " " ? r.push(Un()) : r.push($(o));
|
|
2267
2284
|
}
|
|
2268
2285
|
this.insertNodes(r);
|
|
2269
2286
|
}
|
|
@@ -2271,28 +2288,28 @@ class Ce {
|
|
|
2271
2288
|
const t = this.anchor, r = this.focus, s = this.format, i = this.style;
|
|
2272
2289
|
let o = t, l = r;
|
|
2273
2290
|
!this.isCollapsed() && r.isBefore(t) && (o = r, l = t), o.type === "element" && function(_, m, y, x) {
|
|
2274
|
-
const C = _.getNode(),
|
|
2275
|
-
v.setFormat(y), v.setStyle(x),
|
|
2291
|
+
const C = _.getNode(), b = C.getChildAtIndex(_.offset), v = $(), P = Z(C) ? ve().append(v) : v;
|
|
2292
|
+
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");
|
|
2276
2293
|
}(o, l, s, i);
|
|
2277
|
-
const
|
|
2278
|
-
let
|
|
2294
|
+
const a = o.offset;
|
|
2295
|
+
let c = l.offset;
|
|
2279
2296
|
const f = this.getNodes(), h = f.length;
|
|
2280
2297
|
let u = f[0];
|
|
2281
|
-
N(u) ||
|
|
2298
|
+
N(u) || k(26);
|
|
2282
2299
|
const d = u.getTextContent().length, g = u.getParentOrThrow();
|
|
2283
2300
|
let p = f[h - 1];
|
|
2284
|
-
if (h === 1 && l.type === "element" && (
|
|
2301
|
+
if (h === 1 && l.type === "element" && (c = d, l.set(o.key, c, "text")), this.isCollapsed() && a === d && (u.isSegmented() || u.isToken() || !u.canInsertTextAfter() || !g.canInsertTextAfter() && u.getNextSibling() === null)) {
|
|
2285
2302
|
let _ = u.getNextSibling();
|
|
2286
2303
|
if (N(_) && _.canInsertTextBefore() && !be(_) || (_ = $(), _.setFormat(s), _.setStyle(i), g.canInsertTextAfter() ? u.insertAfter(_) : g.insertAfter(_)), _.select(0, 0), u = _, e !== "") return void this.insertText(e);
|
|
2287
|
-
} else if (this.isCollapsed() &&
|
|
2304
|
+
} else if (this.isCollapsed() && a === 0 && (u.isSegmented() || u.isToken() || !u.canInsertTextBefore() || !g.canInsertTextBefore() && u.getPreviousSibling() === null)) {
|
|
2288
2305
|
let _ = u.getPreviousSibling();
|
|
2289
2306
|
if (N(_) && !be(_) || (_ = $(), _.setFormat(s), g.canInsertTextBefore() ? u.insertBefore(_) : g.insertBefore(_)), _.select(), u = _, e !== "") return void this.insertText(e);
|
|
2290
|
-
} else if (u.isSegmented() &&
|
|
2307
|
+
} else if (u.isSegmented() && a !== d) {
|
|
2291
2308
|
const _ = $(u.getTextContent());
|
|
2292
2309
|
_.setFormat(s), u.replace(_), u = _;
|
|
2293
2310
|
} else if (!this.isCollapsed() && e !== "") {
|
|
2294
2311
|
const _ = p.getParent();
|
|
2295
|
-
if (!g.canInsertTextBefore() || !g.canInsertTextAfter() || S(_) && (!_.canInsertTextBefore() || !_.canInsertTextAfter())) return this.insertText(""),
|
|
2312
|
+
if (!g.canInsertTextBefore() || !g.canInsertTextAfter() || S(_) && (!_.canInsertTextBefore() || !_.canInsertTextAfter())) return this.insertText(""), Ts(this.anchor, this.focus, null), void this.insertText(e);
|
|
2296
2313
|
}
|
|
2297
2314
|
if (h === 1) {
|
|
2298
2315
|
if (u.isToken()) {
|
|
@@ -2300,47 +2317,47 @@ class Ce {
|
|
|
2300
2317
|
return x.select(), void u.replace(x);
|
|
2301
2318
|
}
|
|
2302
2319
|
const _ = u.getFormat(), m = u.getStyle();
|
|
2303
|
-
if (
|
|
2304
|
-
if (
|
|
2320
|
+
if (a !== c || _ === s && m === i) {
|
|
2321
|
+
if (Ui(u)) {
|
|
2305
2322
|
const x = $(e);
|
|
2306
2323
|
return x.setFormat(s), x.setStyle(i), x.select(), void u.replace(x);
|
|
2307
2324
|
}
|
|
2308
2325
|
} else {
|
|
2309
2326
|
if (u.getTextContent() !== "") {
|
|
2310
2327
|
const x = $(e);
|
|
2311
|
-
if (x.setFormat(s), x.setStyle(i), x.select(),
|
|
2328
|
+
if (x.setFormat(s), x.setStyle(i), x.select(), a === 0) u.insertBefore(x, !1);
|
|
2312
2329
|
else {
|
|
2313
|
-
const [C] = u.splitText(
|
|
2330
|
+
const [C] = u.splitText(a);
|
|
2314
2331
|
C.insertAfter(x, !1);
|
|
2315
2332
|
}
|
|
2316
2333
|
return void (x.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length));
|
|
2317
2334
|
}
|
|
2318
2335
|
u.setFormat(s), u.setStyle(i);
|
|
2319
2336
|
}
|
|
2320
|
-
const y =
|
|
2321
|
-
u = u.spliceText(
|
|
2337
|
+
const y = c - a;
|
|
2338
|
+
u = u.spliceText(a, y, e, !0), u.getTextContent() === "" ? u.remove() : this.anchor.type === "text" && (u.isComposing() ? this.anchor.offset -= e.length : (this.format = _, this.style = m));
|
|
2322
2339
|
} else {
|
|
2323
2340
|
const _ = /* @__PURE__ */ new Set([...u.getParentKeys(), ...p.getParentKeys()]), m = S(u) ? u : u.getParentOrThrow();
|
|
2324
2341
|
let y = S(p) ? p : p.getParentOrThrow(), x = p;
|
|
2325
2342
|
if (!m.is(y) && y.isInline()) do
|
|
2326
2343
|
x = y, y = y.getParentOrThrow();
|
|
2327
2344
|
while (y.isInline());
|
|
2328
|
-
if (l.type === "text" && (
|
|
2345
|
+
if (l.type === "text" && (c !== 0 || p.getTextContent() === "") || l.type === "element" && p.getIndexWithinParent() < c) if (N(p) && !p.isToken() && c !== p.getTextContentSize()) {
|
|
2329
2346
|
if (p.isSegmented()) {
|
|
2330
2347
|
const T = $(p.getTextContent());
|
|
2331
2348
|
p.replace(T), p = T;
|
|
2332
2349
|
}
|
|
2333
|
-
Z(l.getNode()) || l.type !== "text" || (p = p.spliceText(0,
|
|
2350
|
+
Z(l.getNode()) || l.type !== "text" || (p = p.spliceText(0, c, "")), _.add(p.__key);
|
|
2334
2351
|
} else {
|
|
2335
2352
|
const T = p.getParentOrThrow();
|
|
2336
2353
|
T.canBeEmpty() || T.getChildrenSize() !== 1 ? p.remove() : T.remove();
|
|
2337
2354
|
}
|
|
2338
2355
|
else _.add(p.__key);
|
|
2339
|
-
const C = y.getChildren(),
|
|
2356
|
+
const C = y.getChildren(), b = new Set(f), v = m.is(y), P = m.isInline() && u.getNextSibling() === null ? m : u;
|
|
2340
2357
|
for (let T = C.length - 1; T >= 0; T--) {
|
|
2341
2358
|
const E = C[T];
|
|
2342
2359
|
if (E.is(u) || S(E) && E.isParentOf(u)) break;
|
|
2343
|
-
E.isAttached() && (!
|
|
2360
|
+
E.isAttached() && (!b.has(E) || E.is(x) ? v || P.insertAfter(E, !1) : E.remove());
|
|
2344
2361
|
}
|
|
2345
2362
|
if (!v) {
|
|
2346
2363
|
let T = y, E = null;
|
|
@@ -2349,12 +2366,12 @@ class Ce {
|
|
|
2349
2366
|
(O === 0 || D[O - 1].is(E)) && (_.delete(T.__key), E = T), T = T.getParent();
|
|
2350
2367
|
}
|
|
2351
2368
|
}
|
|
2352
|
-
if (u.isToken()) if (
|
|
2369
|
+
if (u.isToken()) if (a === d) u.select();
|
|
2353
2370
|
else {
|
|
2354
2371
|
const T = $(e);
|
|
2355
2372
|
T.select(), u.replace(T);
|
|
2356
2373
|
}
|
|
2357
|
-
else u = u.spliceText(
|
|
2374
|
+
else u = u.spliceText(a, d - a, e, !0), u.getTextContent() === "" ? u.remove() : u.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length);
|
|
2358
2375
|
for (let T = 1; T < h; T++) {
|
|
2359
2376
|
const E = f[T], D = E.__key;
|
|
2360
2377
|
_.has(D) || E.remove();
|
|
@@ -2365,9 +2382,9 @@ class Ce {
|
|
|
2365
2382
|
if (this.isCollapsed()) return;
|
|
2366
2383
|
const { anchor: e, focus: t } = this, r = this.getNodes(), s = this.isBackward() ? t : e, i = this.isBackward() ? e : t;
|
|
2367
2384
|
let o = s.getNode(), l = i.getNode();
|
|
2368
|
-
const
|
|
2385
|
+
const a = Je(o, _e), c = Je(l, _e);
|
|
2369
2386
|
r.forEach((h) => {
|
|
2370
|
-
|
|
2387
|
+
Qe(o, h) || Qe(l, h) || h.getKey() === o.getKey() || h.getKey() === l.getKey() || h.remove();
|
|
2371
2388
|
});
|
|
2372
2389
|
const f = (h, u) => {
|
|
2373
2390
|
if (h.getTextContent() === "") h.remove();
|
|
@@ -2384,7 +2401,7 @@ class Ce {
|
|
|
2384
2401
|
const h = o.getTextContentSize() - s.offset;
|
|
2385
2402
|
o.spliceText(s.offset, h, ""), o = f(o, h) || o;
|
|
2386
2403
|
}
|
|
2387
|
-
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(
|
|
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(a) && S(c) && a !== c && (a.append(...c.getChildren()), c.remove(), i.set(s.key, s.offset, s.type));
|
|
2388
2405
|
}
|
|
2389
2406
|
formatText(e, t = null) {
|
|
2390
2407
|
if (this.isCollapsed()) return this.toggleFormat(e), void J(null);
|
|
@@ -2392,12 +2409,12 @@ class Ce {
|
|
|
2392
2409
|
for (const x of r) N(x) && s.push(x);
|
|
2393
2410
|
const i = s.length;
|
|
2394
2411
|
if (i === 0) return this.toggleFormat(e), void J(null);
|
|
2395
|
-
const o = this.anchor, l = this.focus,
|
|
2396
|
-
let h = 0, u = s[0], d =
|
|
2397
|
-
if (
|
|
2412
|
+
const o = this.anchor, l = this.focus, a = this.isBackward(), c = a ? l : o, f = a ? o : l;
|
|
2413
|
+
let h = 0, u = s[0], d = c.type === "element" ? 0 : c.offset;
|
|
2414
|
+
if (c.type === "text" && d === u.getTextContentSize() && (h = 1, u = s[1], d = 0), u == null) return;
|
|
2398
2415
|
const g = u.getFormatFlags(e, t);
|
|
2399
2416
|
r.forEach((x) => {
|
|
2400
|
-
if (
|
|
2417
|
+
if (kn(x)) {
|
|
2401
2418
|
const C = x.getFormatFlags(e, g);
|
|
2402
2419
|
x.setTextFormat(C);
|
|
2403
2420
|
}
|
|
@@ -2410,7 +2427,7 @@ class Ce {
|
|
|
2410
2427
|
if (be(u) || d === 0 && m === u.getTextContentSize()) u.setFormat(g);
|
|
2411
2428
|
else {
|
|
2412
2429
|
const x = u.splitText(d, m), C = d === 0 ? x[0] : x[1];
|
|
2413
|
-
C.setFormat(g),
|
|
2430
|
+
C.setFormat(g), c.type === "text" && c.set(C.__key, 0, "text"), f.type === "text" && f.set(C.__key, m - d, "text");
|
|
2414
2431
|
}
|
|
2415
2432
|
return void (this.format = g);
|
|
2416
2433
|
}
|
|
@@ -2418,19 +2435,19 @@ class Ce {
|
|
|
2418
2435
|
const y = _.getFormatFlags(e, g);
|
|
2419
2436
|
m > 0 && (m === _.getTextContentSize() || be(_) || ([_] = _.splitText(m)), _.setFormat(y));
|
|
2420
2437
|
for (let x = h + 1; x < p; x++) {
|
|
2421
|
-
const C = s[x],
|
|
2422
|
-
C.setFormat(
|
|
2438
|
+
const C = s[x], b = C.getFormatFlags(e, y);
|
|
2439
|
+
C.setFormat(b);
|
|
2423
2440
|
}
|
|
2424
|
-
|
|
2441
|
+
c.type === "text" && c.set(u.__key, d, "text"), f.type === "text" && f.set(_.__key, m, "text"), this.format = g | y;
|
|
2425
2442
|
}
|
|
2426
2443
|
insertNodes(e) {
|
|
2427
2444
|
if (e.length === 0) return;
|
|
2428
2445
|
if (this.anchor.key === "root") {
|
|
2429
2446
|
this.insertParagraph();
|
|
2430
2447
|
const d = I();
|
|
2431
|
-
return F(d) ||
|
|
2448
|
+
return F(d) || k(134), d.insertNodes(e);
|
|
2432
2449
|
}
|
|
2433
|
-
const t =
|
|
2450
|
+
const t = Je((this.isBackward() ? this.focus : this.anchor).getNode(), _e), r = e[e.length - 1];
|
|
2434
2451
|
if ("__language" in t && S(t)) {
|
|
2435
2452
|
if ("__language" in e[0]) this.insertText(e[0].getTextContent());
|
|
2436
2453
|
else {
|
|
@@ -2440,7 +2457,7 @@ class Ce {
|
|
|
2440
2457
|
return;
|
|
2441
2458
|
}
|
|
2442
2459
|
if (!e.some((d) => (S(d) || A(d)) && !d.isInline())) {
|
|
2443
|
-
S(t) ||
|
|
2460
|
+
S(t) || k(135);
|
|
2444
2461
|
const d = cn(this);
|
|
2445
2462
|
return t.splice(d, 0, e), void r.selectEnd();
|
|
2446
2463
|
}
|
|
@@ -2448,41 +2465,41 @@ class Ce {
|
|
|
2448
2465
|
const g = ve();
|
|
2449
2466
|
let p = null;
|
|
2450
2467
|
for (let _ = 0; _ < d.length; _++) {
|
|
2451
|
-
const m = d[_], y =
|
|
2468
|
+
const m = d[_], y = Ae(m);
|
|
2452
2469
|
if (y || A(m) && m.isInline() || S(m) && m.isInline() || N(m) || m.isParentRequired()) {
|
|
2453
2470
|
if (p === null && (p = m.createParentElementNode(), g.append(p), y)) continue;
|
|
2454
2471
|
p !== null && p.append(m);
|
|
2455
2472
|
} else g.append(m), p = null;
|
|
2456
2473
|
}
|
|
2457
2474
|
return g;
|
|
2458
|
-
}(e), i = s.getLastDescendant(), o = s.getChildren(), l = !S(t) || !t.isEmpty() ? this.insertParagraph() : null,
|
|
2459
|
-
let
|
|
2475
|
+
}(e), i = s.getLastDescendant(), o = s.getChildren(), l = !S(t) || !t.isEmpty() ? this.insertParagraph() : null, a = o[o.length - 1];
|
|
2476
|
+
let c = o[0];
|
|
2460
2477
|
var f;
|
|
2461
|
-
S(f =
|
|
2478
|
+
S(f = c) && _e(f) && !f.isEmpty() && S(t) && (!t.isEmpty() || t.canMergeWhenEmpty()) && (S(t) || k(135), t.append(...c.getChildren()), c = o[1]), c && function(d, g, p) {
|
|
2462
2479
|
const _ = g.getParentOrThrow().getLastChild();
|
|
2463
2480
|
let m = g;
|
|
2464
2481
|
const y = [g];
|
|
2465
|
-
for (; m !== _; ) m.getNextSibling() ||
|
|
2482
|
+
for (; m !== _; ) m.getNextSibling() || k(140), m = m.getNextSibling(), y.push(m);
|
|
2466
2483
|
let x = d;
|
|
2467
2484
|
for (const C of y) x = x.insertAfter(C);
|
|
2468
|
-
}(t,
|
|
2469
|
-
const h =
|
|
2470
|
-
l && S(h) && (l.canMergeWhenEmpty() || _e(
|
|
2485
|
+
}(t, c);
|
|
2486
|
+
const h = Je(i, _e);
|
|
2487
|
+
l && S(h) && (l.canMergeWhenEmpty() || _e(a)) && (h.append(...l.getChildren()), l.remove()), S(t) && t.isEmpty() && t.remove(), i.selectEnd();
|
|
2471
2488
|
const u = S(t) ? t.getLastChild() : null;
|
|
2472
|
-
|
|
2489
|
+
Ae(u) && h !== t && u.remove();
|
|
2473
2490
|
}
|
|
2474
2491
|
insertParagraph() {
|
|
2475
2492
|
if (this.anchor.key === "root") {
|
|
2476
2493
|
const o = ve();
|
|
2477
2494
|
return G().splice(this.anchor.offset, 0, [o]), o.select(), o;
|
|
2478
2495
|
}
|
|
2479
|
-
const e = cn(this), t =
|
|
2480
|
-
S(t) ||
|
|
2496
|
+
const e = cn(this), t = Je(this.anchor.getNode(), _e);
|
|
2497
|
+
S(t) || k(136);
|
|
2481
2498
|
const r = t.getChildAtIndex(e), s = r ? [r, ...r.getNextSiblings()] : [], i = t.insertNewAfter(this, !1);
|
|
2482
2499
|
return i ? (i.append(...s), i.selectStart(), i) : null;
|
|
2483
2500
|
}
|
|
2484
2501
|
insertLineBreak(e) {
|
|
2485
|
-
const t =
|
|
2502
|
+
const t = nt();
|
|
2486
2503
|
if (this.insertNodes([t]), e) {
|
|
2487
2504
|
const r = t.getParentOrThrow(), s = t.getIndexWithinParent();
|
|
2488
2505
|
r.select(s, s);
|
|
@@ -2491,22 +2508,22 @@ class Ce {
|
|
|
2491
2508
|
extract() {
|
|
2492
2509
|
const e = this.getNodes(), t = e.length, r = t - 1, s = this.anchor, i = this.focus;
|
|
2493
2510
|
let o = e[0], l = e[r];
|
|
2494
|
-
const [
|
|
2511
|
+
const [a, c] = br(this);
|
|
2495
2512
|
if (t === 0) return [];
|
|
2496
2513
|
if (t === 1) {
|
|
2497
2514
|
if (N(o) && !this.isCollapsed()) {
|
|
2498
|
-
const h =
|
|
2515
|
+
const h = a > c ? c : a, u = a > c ? a : c, d = o.splitText(h, u), g = h === 0 ? d[0] : d[1];
|
|
2499
2516
|
return g != null ? [g] : [];
|
|
2500
2517
|
}
|
|
2501
2518
|
return [o];
|
|
2502
2519
|
}
|
|
2503
2520
|
const f = s.isBefore(i);
|
|
2504
2521
|
if (N(o)) {
|
|
2505
|
-
const h = f ?
|
|
2522
|
+
const h = f ? a : c;
|
|
2506
2523
|
h === o.getTextContentSize() ? e.shift() : h !== 0 && ([, o] = o.splitText(h), e[0] = o);
|
|
2507
2524
|
}
|
|
2508
2525
|
if (N(l)) {
|
|
2509
|
-
const h = l.getTextContent().length, u = f ?
|
|
2526
|
+
const h = l.getTextContent().length, u = f ? c : a;
|
|
2510
2527
|
u === 0 ? e.pop() : u !== h && ([l] = l.splitText(u), e[r] = l);
|
|
2511
2528
|
}
|
|
2512
2529
|
return e;
|
|
@@ -2529,19 +2546,19 @@ class Ce {
|
|
|
2529
2546
|
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"));
|
|
2530
2547
|
}
|
|
2531
2548
|
}
|
|
2532
|
-
const
|
|
2533
|
-
if (!
|
|
2534
|
-
const f =
|
|
2535
|
-
if (h === null || f === null || !S(l) || l.isInline() || l.canBeEmpty() ||
|
|
2549
|
+
const a = M(), c = se(a._window);
|
|
2550
|
+
if (!c) return;
|
|
2551
|
+
const f = a._blockCursorElement, h = a._rootElement;
|
|
2552
|
+
if (h === null || f === null || !S(l) || l.isInline() || l.canBeEmpty() || Kn(f, a, h), function(u, d, g, p) {
|
|
2536
2553
|
u.modify(d, g, p);
|
|
2537
|
-
}(
|
|
2538
|
-
const u =
|
|
2554
|
+
}(c, e, t ? "backward" : "forward", r), c.rangeCount > 0) {
|
|
2555
|
+
const u = c.getRangeAt(0), d = this.anchor.getNode(), g = Z(d) ? d : Ni(d);
|
|
2539
2556
|
if (this.applyDOMRange(u), this.dirty = !0, !o) {
|
|
2540
2557
|
const p = this.getNodes(), _ = [];
|
|
2541
2558
|
let m = !1;
|
|
2542
2559
|
for (let y = 0; y < p.length; y++) {
|
|
2543
2560
|
const x = p[y];
|
|
2544
|
-
|
|
2561
|
+
Qe(x, g) ? _.push(x) : m = !0;
|
|
2545
2562
|
}
|
|
2546
2563
|
if (m && _.length > 0) if (t) {
|
|
2547
2564
|
const y = _[0];
|
|
@@ -2550,9 +2567,9 @@ class Ce {
|
|
|
2550
2567
|
const y = _[_.length - 1];
|
|
2551
2568
|
S(y) ? y.selectEnd() : y.getParentOrThrow().selectEnd();
|
|
2552
2569
|
}
|
|
2553
|
-
|
|
2554
|
-
const x = y.focus, C = y.anchor,
|
|
2555
|
-
pe(C, x.key, x.offset, x.type), pe(x,
|
|
2570
|
+
c.anchorNode === u.startContainer && c.anchorOffset === u.startOffset || function(y) {
|
|
2571
|
+
const x = y.focus, C = y.anchor, b = C.key, v = C.offset, P = C.type;
|
|
2572
|
+
pe(C, x.key, x.offset, x.type), pe(x, b, v, P), y._cachedNodes = null;
|
|
2556
2573
|
}(this);
|
|
2557
2574
|
}
|
|
2558
2575
|
}
|
|
@@ -2577,7 +2594,7 @@ class Ce {
|
|
|
2577
2594
|
const l = Pr();
|
|
2578
2595
|
l.add(o.__key), ue(l);
|
|
2579
2596
|
} else
|
|
2580
|
-
o.remove(), M().dispatchCommand(
|
|
2597
|
+
o.remove(), M().dispatchCommand(bn, void 0);
|
|
2581
2598
|
return;
|
|
2582
2599
|
}
|
|
2583
2600
|
if (!e && S(o) && S(s) && s.isEmpty()) return s.remove(), void o.selectStart();
|
|
@@ -2587,17 +2604,17 @@ class Ce {
|
|
|
2587
2604
|
} else {
|
|
2588
2605
|
const l = i.type === "text" ? i.getNode() : null;
|
|
2589
2606
|
if (s = r.type === "text" ? r.getNode() : null, l !== null && l.isSegmented()) {
|
|
2590
|
-
const
|
|
2591
|
-
if (l.is(s) || e &&
|
|
2607
|
+
const a = i.offset, c = l.getTextContentSize();
|
|
2608
|
+
if (l.is(s) || e && a !== c || !e && a !== 0) return void wr(l, e, a);
|
|
2592
2609
|
} else if (s !== null && s.isSegmented()) {
|
|
2593
|
-
const
|
|
2594
|
-
if (s.is(l) || e &&
|
|
2610
|
+
const a = r.offset, c = s.getTextContentSize();
|
|
2611
|
+
if (s.is(l) || e && a !== 0 || !e && a !== c) return void wr(s, e, a);
|
|
2595
2612
|
}
|
|
2596
|
-
(function(
|
|
2597
|
-
const f =
|
|
2613
|
+
(function(a, c) {
|
|
2614
|
+
const f = a.anchor, h = a.focus, u = f.getNode(), d = h.getNode();
|
|
2598
2615
|
if (u === d && f.type === "text" && h.type === "text") {
|
|
2599
2616
|
const g = f.offset, p = h.offset, _ = g < p, m = _ ? g : p, y = _ ? p : g, x = y - 1;
|
|
2600
|
-
m !== x && (
|
|
2617
|
+
m !== x && (ns(u.getTextContent().slice(m, y)) || (c ? h.offset = x : f.offset = x));
|
|
2601
2618
|
}
|
|
2602
2619
|
})(this, e);
|
|
2603
2620
|
}
|
|
@@ -2650,31 +2667,31 @@ function br(n) {
|
|
|
2650
2667
|
function wr(n, e, t) {
|
|
2651
2668
|
const r = n, s = r.getTextContent().split(/(?=\s)/g), i = s.length;
|
|
2652
2669
|
let o = 0, l = 0;
|
|
2653
|
-
for (let
|
|
2654
|
-
const f =
|
|
2655
|
-
if (l = o, o += s[
|
|
2656
|
-
s.splice(
|
|
2670
|
+
for (let c = 0; c < i; c++) {
|
|
2671
|
+
const f = c === i - 1;
|
|
2672
|
+
if (l = o, o += s[c].length, e && o === t || o > t || f) {
|
|
2673
|
+
s.splice(c, 1), f && (l = void 0);
|
|
2657
2674
|
break;
|
|
2658
2675
|
}
|
|
2659
2676
|
}
|
|
2660
|
-
const
|
|
2661
|
-
|
|
2677
|
+
const a = s.join("").trim();
|
|
2678
|
+
a === "" ? r.remove() : (r.setTextContent(a), r.select(l, l));
|
|
2662
2679
|
}
|
|
2663
2680
|
function Nr(n, e, t, r) {
|
|
2664
2681
|
let s, i = e;
|
|
2665
|
-
if (n.nodeType ===
|
|
2682
|
+
if (n.nodeType === rt) {
|
|
2666
2683
|
let o = !1;
|
|
2667
|
-
const l = n.childNodes,
|
|
2668
|
-
i ===
|
|
2684
|
+
const l = n.childNodes, a = l.length, c = r._blockCursorElement;
|
|
2685
|
+
i === a && (o = !0, i = a - 1);
|
|
2669
2686
|
let f = l[i], h = !1;
|
|
2670
|
-
if (f ===
|
|
2671
|
-
else if (
|
|
2672
|
-
const u =
|
|
2673
|
-
n === u && e > Array.prototype.indexOf.call(u.children,
|
|
2687
|
+
if (f === c) f = l[i + 1], h = !0;
|
|
2688
|
+
else if (c !== null) {
|
|
2689
|
+
const u = c.parentNode;
|
|
2690
|
+
n === u && e > Array.prototype.indexOf.call(u.children, c) && i--;
|
|
2674
2691
|
}
|
|
2675
|
-
if (s =
|
|
2692
|
+
if (s = Oe(f), N(s)) i = or(s, o);
|
|
2676
2693
|
else {
|
|
2677
|
-
let u =
|
|
2694
|
+
let u = Oe(n);
|
|
2678
2695
|
if (u === null) return null;
|
|
2679
2696
|
if (S(u)) {
|
|
2680
2697
|
i = Math.min(u.getChildrenSize(), i);
|
|
@@ -2689,11 +2706,11 @@ function Nr(n, e, t, r) {
|
|
|
2689
2706
|
N(d) ? (s = d, u = null, i = or(d, o)) : d !== u && o && !h && i++;
|
|
2690
2707
|
} else {
|
|
2691
2708
|
const d = u.getIndexWithinParent();
|
|
2692
|
-
i = e === 0 && A(u) &&
|
|
2709
|
+
i = e === 0 && A(u) && Oe(n) === u ? d : d + 1, u = u.getParentOrThrow();
|
|
2693
2710
|
}
|
|
2694
2711
|
if (S(u)) return ie(u.__key, i, "element");
|
|
2695
2712
|
}
|
|
2696
|
-
} else s =
|
|
2713
|
+
} else s = Oe(n);
|
|
2697
2714
|
return N(s) ? ie(s.__key, i, "text") : null;
|
|
2698
2715
|
}
|
|
2699
2716
|
function Er(n, e, t) {
|
|
@@ -2715,7 +2732,7 @@ function Er(n, e, t) {
|
|
|
2715
2732
|
}
|
|
2716
2733
|
}
|
|
2717
2734
|
}
|
|
2718
|
-
function
|
|
2735
|
+
function Ts(n, e, t) {
|
|
2719
2736
|
if (n.type === "text" && e.type === "text") {
|
|
2720
2737
|
const r = n.isBefore(e), s = n.is(e);
|
|
2721
2738
|
Er(n, r, s), Er(e, !r, s), s && (e.key = n.key, e.offset = n.offset, e.type = n.type);
|
|
@@ -2726,41 +2743,44 @@ function Ss(n, e, t) {
|
|
|
2726
2743
|
}
|
|
2727
2744
|
}
|
|
2728
2745
|
}
|
|
2729
|
-
function
|
|
2746
|
+
function Cs(n, e, t, r, s, i) {
|
|
2730
2747
|
if (n === null || t === null || !Mt(s, n, t)) return null;
|
|
2731
2748
|
const o = Nr(n, e, F(i) ? i.anchor : null, s);
|
|
2732
2749
|
if (o === null) return null;
|
|
2733
2750
|
const l = Nr(t, r, F(i) ? i.focus : null, s);
|
|
2734
2751
|
if (l === null) return null;
|
|
2735
2752
|
if (o.type === "element" && l.type === "element") {
|
|
2736
|
-
const
|
|
2737
|
-
if (A(
|
|
2753
|
+
const a = Oe(n), c = Oe(t);
|
|
2754
|
+
if (A(a) && A(c)) return null;
|
|
2738
2755
|
}
|
|
2739
|
-
return
|
|
2756
|
+
return Ts(o, l, i), [o, l];
|
|
2740
2757
|
}
|
|
2741
|
-
function
|
|
2758
|
+
function mo(n) {
|
|
2742
2759
|
return S(n) && !n.isInline();
|
|
2743
2760
|
}
|
|
2744
|
-
function
|
|
2761
|
+
function ks(n, e, t, r, s, i) {
|
|
2745
2762
|
const o = fe(), l = new Ce(ie(n, e, s), ie(t, r, i), 0, "");
|
|
2746
2763
|
return l.dirty = !0, o._selection = l, l;
|
|
2747
2764
|
}
|
|
2748
|
-
function
|
|
2765
|
+
function xo() {
|
|
2749
2766
|
const n = ie("root", 0, "element"), e = ie("root", 0, "element");
|
|
2750
2767
|
return new Ce(n, e, 0, "");
|
|
2751
2768
|
}
|
|
2752
2769
|
function Pr() {
|
|
2753
2770
|
return new Vt(/* @__PURE__ */ new Set());
|
|
2754
2771
|
}
|
|
2755
|
-
function
|
|
2772
|
+
function vo(n, e) {
|
|
2773
|
+
return Ht(null, n, e, null);
|
|
2774
|
+
}
|
|
2775
|
+
function Ht(n, e, t, r) {
|
|
2756
2776
|
const s = t._window;
|
|
2757
2777
|
if (s === null) return null;
|
|
2758
|
-
const i = r || s.event, o = i ? i.type : void 0, l = o === "selectionchange",
|
|
2759
|
-
let
|
|
2760
|
-
if (F(n) && !
|
|
2778
|
+
const i = r || s.event, o = i ? i.type : void 0, l = o === "selectionchange", a = !dn && (l || o === "beforeinput" || o === "compositionstart" || o === "compositionend" || o === "click" && i && i.detail === 3 || o === "drop" || o === void 0);
|
|
2779
|
+
let c, f, h, u;
|
|
2780
|
+
if (F(n) && !a) return n.clone();
|
|
2761
2781
|
if (e === null) return null;
|
|
2762
|
-
if (
|
|
2763
|
-
const d =
|
|
2782
|
+
if (c = e.anchorNode, f = e.focusNode, h = e.anchorOffset, u = e.focusOffset, l && F(n) && !Mt(t, c, f)) return n.clone();
|
|
2783
|
+
const d = Cs(c, h, f, u, t, n);
|
|
2764
2784
|
if (d === null) return null;
|
|
2765
2785
|
const [g, p] = d;
|
|
2766
2786
|
return new Ce(g, p, F(n) ? n.format : 0, F(n) ? n.style : "");
|
|
@@ -2774,22 +2794,22 @@ function ot() {
|
|
|
2774
2794
|
function Lt(n, e, t, r = 1) {
|
|
2775
2795
|
const s = n.anchor, i = n.focus, o = s.getNode(), l = i.getNode();
|
|
2776
2796
|
if (!e.is(o) && !e.is(l)) return;
|
|
2777
|
-
const
|
|
2797
|
+
const a = e.__key;
|
|
2778
2798
|
if (n.isCollapsed()) {
|
|
2779
|
-
const
|
|
2780
|
-
if (t <=
|
|
2781
|
-
const f = Math.max(0,
|
|
2782
|
-
s.set(
|
|
2799
|
+
const c = s.offset;
|
|
2800
|
+
if (t <= c && r > 0 || t < c && r < 0) {
|
|
2801
|
+
const f = Math.max(0, c + r);
|
|
2802
|
+
s.set(a, f, "element"), i.set(a, f, "element"), Fr(n);
|
|
2783
2803
|
}
|
|
2784
2804
|
} else {
|
|
2785
|
-
const
|
|
2805
|
+
const c = n.isBackward(), f = c ? i : s, h = f.getNode(), u = c ? s : i, d = u.getNode();
|
|
2786
2806
|
if (e.is(h)) {
|
|
2787
2807
|
const g = f.offset;
|
|
2788
|
-
(t <= g && r > 0 || t < g && r < 0) && f.set(
|
|
2808
|
+
(t <= g && r > 0 || t < g && r < 0) && f.set(a, Math.max(0, g + r), "element");
|
|
2789
2809
|
}
|
|
2790
2810
|
if (e.is(d)) {
|
|
2791
2811
|
const g = u.offset;
|
|
2792
|
-
(t <= g && r > 0 || t < g && r < 0) && u.set(
|
|
2812
|
+
(t <= g && r > 0 || t < g && r < 0) && u.set(a, Math.max(0, g + r), "element");
|
|
2793
2813
|
}
|
|
2794
2814
|
}
|
|
2795
2815
|
Fr(n);
|
|
@@ -2798,24 +2818,24 @@ function Fr(n) {
|
|
|
2798
2818
|
const e = n.anchor, t = e.offset, r = n.focus, s = r.offset, i = e.getNode(), o = r.getNode();
|
|
2799
2819
|
if (n.isCollapsed()) {
|
|
2800
2820
|
if (!S(i)) return;
|
|
2801
|
-
const l = i.getChildrenSize(),
|
|
2802
|
-
if (N(
|
|
2821
|
+
const l = i.getChildrenSize(), a = t >= l, c = a ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
|
|
2822
|
+
if (N(c)) {
|
|
2803
2823
|
let f = 0;
|
|
2804
|
-
|
|
2824
|
+
a && (f = c.getTextContentSize()), e.set(c.__key, f, "text"), r.set(c.__key, f, "text");
|
|
2805
2825
|
}
|
|
2806
2826
|
} else {
|
|
2807
2827
|
if (S(i)) {
|
|
2808
|
-
const l = i.getChildrenSize(),
|
|
2809
|
-
if (N(
|
|
2828
|
+
const l = i.getChildrenSize(), a = t >= l, c = a ? i.getChildAtIndex(l - 1) : i.getChildAtIndex(t);
|
|
2829
|
+
if (N(c)) {
|
|
2810
2830
|
let f = 0;
|
|
2811
|
-
|
|
2831
|
+
a && (f = c.getTextContentSize()), e.set(c.__key, f, "text");
|
|
2812
2832
|
}
|
|
2813
2833
|
}
|
|
2814
2834
|
if (S(o)) {
|
|
2815
|
-
const l = o.getChildrenSize(),
|
|
2816
|
-
if (N(
|
|
2835
|
+
const l = o.getChildrenSize(), a = s >= l, c = a ? o.getChildAtIndex(l - 1) : o.getChildAtIndex(s);
|
|
2836
|
+
if (N(c)) {
|
|
2817
2837
|
let f = 0;
|
|
2818
|
-
|
|
2838
|
+
a && (f = c.getTextContentSize()), r.set(c.__key, f, "text");
|
|
2819
2839
|
}
|
|
2820
2840
|
}
|
|
2821
2841
|
}
|
|
@@ -2827,19 +2847,19 @@ function Ot(n, e, t, r, s) {
|
|
|
2827
2847
|
function Dr(n, e, t, r, s) {
|
|
2828
2848
|
n.type === "text" ? (n.key = t, e || (n.offset += s)) : n.offset > r.getIndexWithinParent() && (n.offset -= 1);
|
|
2829
2849
|
}
|
|
2830
|
-
function
|
|
2831
|
-
const l = r.anchorNode,
|
|
2850
|
+
function ji(n, e, t, r, s, i, o) {
|
|
2851
|
+
const l = r.anchorNode, a = r.focusNode, c = r.anchorOffset, f = r.focusOffset, h = document.activeElement;
|
|
2832
2852
|
if (s.has("collaboration") && h !== i || h !== null && Xr(h)) return;
|
|
2833
|
-
if (!F(e)) return void (n !== null && Mt(t, l,
|
|
2834
|
-
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,
|
|
2853
|
+
if (!F(e)) return void (n !== null && Mt(t, l, a) && r.removeAllRanges());
|
|
2854
|
+
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();
|
|
2835
2855
|
let P = _, T = m, E = !1;
|
|
2836
2856
|
if (u.type === "text") {
|
|
2837
2857
|
P = kt(_);
|
|
2838
2858
|
const z = u.getNode();
|
|
2839
|
-
E = z.getFormat() !== C || z.getStyle() !==
|
|
2859
|
+
E = z.getFormat() !== C || z.getStyle() !== b;
|
|
2840
2860
|
} else F(n) && n.anchor.type === "text" && (E = !0);
|
|
2841
2861
|
var D, O, W, L, U;
|
|
2842
|
-
if (d.type === "text" && (T = kt(m)), P !== null && T !== null && (v && (n === null || E || F(n) && (n.format !== C || n.style !==
|
|
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]), c !== y || f !== x || l !== P || a !== T || r.type === "Range" && v || (h !== null && i.contains(h) || i.focus({ preventScroll: !0 }), u.type === "element"))) {
|
|
2843
2863
|
try {
|
|
2844
2864
|
r.setBaseAndExtent(P, y, T, x);
|
|
2845
2865
|
} catch {
|
|
@@ -2849,38 +2869,38 @@ function Vi(n, e, t, r, s, i, o) {
|
|
|
2849
2869
|
if (z !== null) {
|
|
2850
2870
|
let de;
|
|
2851
2871
|
if (z instanceof Text) {
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2872
|
+
const De = document.createRange();
|
|
2873
|
+
De.selectNode(z), de = De.getBoundingClientRect();
|
|
2854
2874
|
} else de = z.getBoundingClientRect();
|
|
2855
|
-
(function(
|
|
2875
|
+
(function(De, Be, Hn) {
|
|
2856
2876
|
const qn = Hn.ownerDocument, Qn = qn.defaultView;
|
|
2857
2877
|
if (Qn === null) return;
|
|
2858
|
-
let { top:
|
|
2878
|
+
let { top: Zt, bottom: Gt } = Be, ct = 0, ut = 0, he = Hn;
|
|
2859
2879
|
for (; he !== null; ) {
|
|
2860
|
-
const
|
|
2861
|
-
if (
|
|
2880
|
+
const Yt = he === qn.body;
|
|
2881
|
+
if (Yt) ct = 0, ut = Kt(De).innerHeight;
|
|
2862
2882
|
else {
|
|
2863
2883
|
const ft = he.getBoundingClientRect();
|
|
2864
|
-
|
|
2884
|
+
ct = ft.top, ut = ft.bottom;
|
|
2865
2885
|
}
|
|
2866
|
-
let
|
|
2867
|
-
if (
|
|
2886
|
+
let Re = 0;
|
|
2887
|
+
if (Zt < ct ? Re = -(ct - Zt) : Gt > ut && (Re = Gt - ut), Re !== 0) if (Yt) Qn.scrollBy(0, Re);
|
|
2868
2888
|
else {
|
|
2869
2889
|
const ft = he.scrollTop;
|
|
2870
|
-
he.scrollTop +=
|
|
2890
|
+
he.scrollTop += Re;
|
|
2871
2891
|
const Xn = he.scrollTop - ft;
|
|
2872
|
-
|
|
2892
|
+
Zt -= Xn, Gt -= Xn;
|
|
2873
2893
|
}
|
|
2874
|
-
if (
|
|
2894
|
+
if (Yt) break;
|
|
2875
2895
|
he = Rt(he);
|
|
2876
2896
|
}
|
|
2877
2897
|
})(t, de, i);
|
|
2878
2898
|
}
|
|
2879
2899
|
}
|
|
2880
|
-
|
|
2900
|
+
Sn = !0;
|
|
2881
2901
|
}
|
|
2882
2902
|
}
|
|
2883
|
-
function
|
|
2903
|
+
function So(n) {
|
|
2884
2904
|
let e = I() || ot();
|
|
2885
2905
|
e === null && (e = G().selectEnd()), e.insertNodes(n);
|
|
2886
2906
|
}
|
|
@@ -2888,13 +2908,13 @@ function cn(n) {
|
|
|
2888
2908
|
let e = n;
|
|
2889
2909
|
n.isCollapsed() || e.removeText();
|
|
2890
2910
|
const t = I();
|
|
2891
|
-
F(t) && (e = t), F(e) ||
|
|
2911
|
+
F(t) && (e = t), F(e) || k(161);
|
|
2892
2912
|
const r = e.anchor;
|
|
2893
2913
|
let s = r.getNode(), i = r.offset;
|
|
2894
|
-
for (; !_e(s); ) [s, i] =
|
|
2914
|
+
for (; !_e(s); ) [s, i] = Hi(s, i);
|
|
2895
2915
|
return i;
|
|
2896
2916
|
}
|
|
2897
|
-
function
|
|
2917
|
+
function Hi(n, e) {
|
|
2898
2918
|
const t = n.getParent();
|
|
2899
2919
|
if (!t) {
|
|
2900
2920
|
const s = ve();
|
|
@@ -2914,29 +2934,29 @@ function ji(n, e) {
|
|
|
2914
2934
|
}
|
|
2915
2935
|
return [t, n.getIndexWithinParent() + 1];
|
|
2916
2936
|
}
|
|
2917
|
-
let R = null, K = null, Q = !1,
|
|
2937
|
+
let R = null, K = null, Q = !1, un = !1, pt = 0;
|
|
2918
2938
|
const Lr = { characterData: !0, childList: !0, subtree: !0 };
|
|
2919
2939
|
function lt() {
|
|
2920
2940
|
return Q || R !== null && R._readOnly;
|
|
2921
2941
|
}
|
|
2922
2942
|
function q() {
|
|
2923
|
-
Q &&
|
|
2943
|
+
Q && k(13);
|
|
2924
2944
|
}
|
|
2925
|
-
function
|
|
2926
|
-
pt > 99 &&
|
|
2945
|
+
function bs() {
|
|
2946
|
+
pt > 99 && k(14);
|
|
2927
2947
|
}
|
|
2928
2948
|
function fe() {
|
|
2929
|
-
return R === null &&
|
|
2949
|
+
return R === null && k(195, ws()), R;
|
|
2930
2950
|
}
|
|
2931
2951
|
function M() {
|
|
2932
|
-
return K === null &&
|
|
2952
|
+
return K === null && k(196, ws()), K;
|
|
2933
2953
|
}
|
|
2934
|
-
function
|
|
2954
|
+
function ws() {
|
|
2935
2955
|
let n = 0;
|
|
2936
|
-
const e = /* @__PURE__ */ new Set(), t =
|
|
2956
|
+
const e = /* @__PURE__ */ new Set(), t = Xt.version;
|
|
2937
2957
|
if (typeof window < "u") for (const s of document.querySelectorAll("[contenteditable]")) {
|
|
2938
2958
|
const i = Wt(s);
|
|
2939
|
-
if (
|
|
2959
|
+
if (Mn(i)) n++;
|
|
2940
2960
|
else if (i) {
|
|
2941
2961
|
let o = String(i.constructor.version || "<0.17.1");
|
|
2942
2962
|
o === t && (o += " (separately built, likely a bundler configuration issue)"), e.add(o);
|
|
@@ -2945,13 +2965,13 @@ function bs() {
|
|
|
2945
2965
|
let r = ` Detected on the page: ${n} compatible editor(s) with version ${t}`;
|
|
2946
2966
|
return e.size && (r += ` and incompatible editors with versions ${Array.from(e).join(", ")}`), r;
|
|
2947
2967
|
}
|
|
2948
|
-
function
|
|
2968
|
+
function qi() {
|
|
2949
2969
|
return K;
|
|
2950
2970
|
}
|
|
2951
2971
|
function Or(n, e, t) {
|
|
2952
|
-
const r = e.__type, s = function(l,
|
|
2953
|
-
const
|
|
2954
|
-
return
|
|
2972
|
+
const r = e.__type, s = function(l, a) {
|
|
2973
|
+
const c = l._nodes.get(a);
|
|
2974
|
+
return c === void 0 && k(30, a), c;
|
|
2955
2975
|
}(n, r);
|
|
2956
2976
|
let i = t.get(r);
|
|
2957
2977
|
i === void 0 && (i = Array.from(s.transforms), t.set(r, i));
|
|
@@ -2961,25 +2981,25 @@ function Or(n, e, t) {
|
|
|
2961
2981
|
function Ir(n, e) {
|
|
2962
2982
|
return n !== void 0 && n.__key !== e && n.isAttached();
|
|
2963
2983
|
}
|
|
2964
|
-
function
|
|
2984
|
+
function Ns(n, e) {
|
|
2965
2985
|
if (!e) return;
|
|
2966
2986
|
const t = n._updateTags;
|
|
2967
2987
|
let r = e;
|
|
2968
2988
|
Array.isArray(e) || (r = [e]);
|
|
2969
2989
|
for (const s of r) t.add(s);
|
|
2970
2990
|
}
|
|
2971
|
-
function
|
|
2991
|
+
function To(n) {
|
|
2972
2992
|
return Vn(n, M()._nodes);
|
|
2973
2993
|
}
|
|
2974
2994
|
function Vn(n, e) {
|
|
2975
2995
|
const t = n.type, r = e.get(t);
|
|
2976
|
-
r === void 0 &&
|
|
2996
|
+
r === void 0 && k(17, t);
|
|
2977
2997
|
const s = r.klass;
|
|
2978
|
-
n.type !== s.getType() &&
|
|
2998
|
+
n.type !== s.getType() && k(18, s.name);
|
|
2979
2999
|
const i = s.importJSON(n), o = n.children;
|
|
2980
3000
|
if (S(i) && Array.isArray(o)) for (let l = 0; l < o.length; l++) {
|
|
2981
|
-
const
|
|
2982
|
-
i.append(
|
|
3001
|
+
const a = Vn(o[l], e);
|
|
3002
|
+
i.append(a);
|
|
2983
3003
|
}
|
|
2984
3004
|
return i;
|
|
2985
3005
|
}
|
|
@@ -2995,40 +3015,40 @@ function Ar(n, e, t) {
|
|
|
2995
3015
|
function me(n, e) {
|
|
2996
3016
|
const t = n._pendingEditorState, r = n._rootElement, s = n._headless || r === null;
|
|
2997
3017
|
if (t === null) return;
|
|
2998
|
-
const i = n._editorState, o = i._selection, l = t._selection,
|
|
3018
|
+
const i = n._editorState, o = i._selection, l = t._selection, a = n._dirtyType !== Ee, c = R, f = Q, h = K, u = n._updating, d = n._observer;
|
|
2999
3019
|
let g = null;
|
|
3000
|
-
if (n._pendingEditorState = null, n._editorState = t, !s &&
|
|
3020
|
+
if (n._pendingEditorState = null, n._editorState = t, !s && a && d !== null) {
|
|
3001
3021
|
K = n, R = t, Q = !1, n._updating = !0;
|
|
3002
3022
|
try {
|
|
3003
3023
|
const v = n._dirtyType, P = n._dirtyElements, T = n._dirtyLeaves;
|
|
3004
|
-
d.disconnect(), g =
|
|
3024
|
+
d.disconnect(), g = Mi(i, t, n, v, P, T);
|
|
3005
3025
|
} catch (v) {
|
|
3006
|
-
if (v instanceof Error && n._onError(v),
|
|
3007
|
-
return
|
|
3026
|
+
if (v instanceof Error && n._onError(v), un) throw v;
|
|
3027
|
+
return Ds(n, null, r, t), Qr(n), n._dirtyType = Me, un = !0, me(n, i), void (un = !1);
|
|
3008
3028
|
} finally {
|
|
3009
|
-
d.observe(r, Lr), n._updating = u, R =
|
|
3029
|
+
d.observe(r, Lr), n._updating = u, R = c, Q = f, K = h;
|
|
3010
3030
|
}
|
|
3011
3031
|
}
|
|
3012
3032
|
t._readOnly || (t._readOnly = !0);
|
|
3013
3033
|
const p = n._dirtyLeaves, _ = n._dirtyElements, m = n._normalizedNodes, y = n._updateTags, x = n._deferred;
|
|
3014
|
-
|
|
3034
|
+
a && (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) {
|
|
3015
3035
|
const T = v._decorators;
|
|
3016
3036
|
let E = v._pendingDecorators || T;
|
|
3017
3037
|
const D = P._nodeMap;
|
|
3018
3038
|
let O;
|
|
3019
|
-
for (O in E) D.has(O) || (E === T && (E =
|
|
3039
|
+
for (O in E) D.has(O) || (E === T && (E = es(v)), delete E[O]);
|
|
3020
3040
|
}(n, t);
|
|
3021
3041
|
const C = s ? null : se(n._window);
|
|
3022
|
-
if (n._editable && C !== null && (
|
|
3042
|
+
if (n._editable && C !== null && (a || l === null || l.dirty)) {
|
|
3023
3043
|
K = n, R = t;
|
|
3024
3044
|
try {
|
|
3025
|
-
if (d !== null && d.disconnect(),
|
|
3045
|
+
if (d !== null && d.disconnect(), a || l === null || l.dirty) {
|
|
3026
3046
|
const v = n._blockCursorElement;
|
|
3027
|
-
v !== null &&
|
|
3047
|
+
v !== null && Kn(v, n, r), ji(o, l, n, C, y, r);
|
|
3028
3048
|
}
|
|
3029
|
-
|
|
3049
|
+
Pi(n, r, l), d !== null && d.observe(r, Lr);
|
|
3030
3050
|
} finally {
|
|
3031
|
-
K = h, R =
|
|
3051
|
+
K = h, R = c;
|
|
3032
3052
|
}
|
|
3033
3053
|
}
|
|
3034
3054
|
g !== null && function(v, P, T, E, D) {
|
|
@@ -3037,12 +3057,12 @@ function me(n, e) {
|
|
|
3037
3057
|
const [U, z] = O[L], de = P.get(z);
|
|
3038
3058
|
de !== void 0 && U(de, { dirtyLeaves: E, prevEditorState: D, updateTags: T });
|
|
3039
3059
|
}
|
|
3040
|
-
}(n, g, y, p, i), F(l) || l === null || o !== null && o.is(l) || n.dispatchCommand(
|
|
3041
|
-
const
|
|
3042
|
-
|
|
3060
|
+
}(n, g, y, p, i), F(l) || l === null || o !== null && o.is(l) || n.dispatchCommand(bn, void 0);
|
|
3061
|
+
const b = n._pendingDecorators;
|
|
3062
|
+
b !== null && (n._decorators = b, n._pendingDecorators = null, Ge("decorator", n, !0, b)), function(v, P, T) {
|
|
3043
3063
|
const E = ir(P), D = ir(T);
|
|
3044
|
-
E !== D &&
|
|
3045
|
-
}(n, e || i, t),
|
|
3064
|
+
E !== D && Ge("textcontent", v, !0, D);
|
|
3065
|
+
}(n, e || i, t), Ge("update", n, !0, { dirtyElements: _, dirtyLeaves: p, editorState: t, normalizedNodes: m, prevEditorState: e || i, tags: y }), function(v, P) {
|
|
3046
3066
|
if (v._deferred = [], P.length !== 0) {
|
|
3047
3067
|
const T = v._updating;
|
|
3048
3068
|
v._updating = !0;
|
|
@@ -3058,12 +3078,12 @@ function me(n, e) {
|
|
|
3058
3078
|
const T = P.shift();
|
|
3059
3079
|
if (T) {
|
|
3060
3080
|
const [E, D] = T;
|
|
3061
|
-
|
|
3081
|
+
Ps(v, E, D);
|
|
3062
3082
|
}
|
|
3063
3083
|
}
|
|
3064
3084
|
}(n);
|
|
3065
3085
|
}
|
|
3066
|
-
function
|
|
3086
|
+
function Ge(n, e, t, ...r) {
|
|
3067
3087
|
const s = e._updating;
|
|
3068
3088
|
e._updating = t;
|
|
3069
3089
|
try {
|
|
@@ -3073,21 +3093,21 @@ function Ze(n, e, t, ...r) {
|
|
|
3073
3093
|
e._updating = s;
|
|
3074
3094
|
}
|
|
3075
3095
|
}
|
|
3076
|
-
function
|
|
3096
|
+
function Es(n, e, t) {
|
|
3077
3097
|
if (n._updating === !1 || K !== n) {
|
|
3078
3098
|
let s = !1;
|
|
3079
3099
|
return n.update(() => {
|
|
3080
|
-
s =
|
|
3100
|
+
s = Es(n, e, t);
|
|
3081
3101
|
}), s;
|
|
3082
3102
|
}
|
|
3083
|
-
const r =
|
|
3103
|
+
const r = Wn(n);
|
|
3084
3104
|
for (let s = 4; s >= 0; s--) for (let i = 0; i < r.length; i++) {
|
|
3085
3105
|
const o = r[i]._commands.get(e);
|
|
3086
3106
|
if (o !== void 0) {
|
|
3087
3107
|
const l = o[s];
|
|
3088
3108
|
if (l !== void 0) {
|
|
3089
|
-
const
|
|
3090
|
-
for (let f = 0; f <
|
|
3109
|
+
const a = Array.from(l), c = a.length;
|
|
3110
|
+
for (let f = 0; f < c; f++) if (a[f](t, n) === !0) return !0;
|
|
3091
3111
|
}
|
|
3092
3112
|
}
|
|
3093
3113
|
}
|
|
@@ -3103,55 +3123,55 @@ function Mr(n, e) {
|
|
|
3103
3123
|
let l;
|
|
3104
3124
|
if (o !== void 0) {
|
|
3105
3125
|
if (l = o.onUpdate, o.skipTransforms && (r = !0), o.discrete) {
|
|
3106
|
-
const
|
|
3107
|
-
|
|
3126
|
+
const a = n._pendingEditorState;
|
|
3127
|
+
a === null && k(191), a._flushSync = !0;
|
|
3108
3128
|
}
|
|
3109
|
-
l && n._deferred.push(l),
|
|
3129
|
+
l && n._deferred.push(l), Ns(n, o.tag);
|
|
3110
3130
|
}
|
|
3111
3131
|
i();
|
|
3112
3132
|
}
|
|
3113
3133
|
}
|
|
3114
3134
|
return r;
|
|
3115
3135
|
}
|
|
3116
|
-
function
|
|
3136
|
+
function Ps(n, e, t) {
|
|
3117
3137
|
const r = n._updateTags;
|
|
3118
3138
|
let s, i = !1, o = !1;
|
|
3119
|
-
t !== void 0 && (s = t.onUpdate,
|
|
3139
|
+
t !== void 0 && (s = t.onUpdate, Ns(n, t.tag), i = t.skipTransforms || !1, o = t.discrete || !1), s && n._deferred.push(s);
|
|
3120
3140
|
const l = n._editorState;
|
|
3121
|
-
let
|
|
3122
|
-
(
|
|
3141
|
+
let a = n._pendingEditorState, c = !1;
|
|
3142
|
+
(a === null || a._readOnly) && (a = n._pendingEditorState = new Qt(new Map((a || l)._nodeMap)), c = !0), a._flushSync = o;
|
|
3123
3143
|
const f = R, h = Q, u = K, d = n._updating;
|
|
3124
|
-
R =
|
|
3144
|
+
R = a, Q = !1, n._updating = !0, K = n;
|
|
3125
3145
|
try {
|
|
3126
|
-
|
|
3146
|
+
c && (n._headless ? l._selection !== null && (a._selection = l._selection.clone()) : a._selection = function(m) {
|
|
3127
3147
|
const y = m.getEditorState()._selection, x = se(m._window);
|
|
3128
|
-
return F(y) || y == null ?
|
|
3148
|
+
return F(y) || y == null ? Ht(y, x, m, null) : y.clone();
|
|
3129
3149
|
}(n));
|
|
3130
3150
|
const p = n._compositionKey;
|
|
3131
3151
|
e(), i = Mr(n, i), function(m, y) {
|
|
3132
3152
|
const x = y.getEditorState()._selection, C = m._selection;
|
|
3133
3153
|
if (F(C)) {
|
|
3134
|
-
const
|
|
3154
|
+
const b = C.anchor, v = C.focus;
|
|
3135
3155
|
let P;
|
|
3136
|
-
if (
|
|
3156
|
+
if (b.type === "text" && (P = b.getNode(), P.selectionTransform(x, C)), v.type === "text") {
|
|
3137
3157
|
const T = v.getNode();
|
|
3138
3158
|
P !== T && T.selectionTransform(x, C);
|
|
3139
3159
|
}
|
|
3140
3160
|
}
|
|
3141
|
-
}(
|
|
3161
|
+
}(a, n), n._dirtyType !== Ee && (i ? function(m, y) {
|
|
3142
3162
|
const x = y._dirtyLeaves, C = m._nodeMap;
|
|
3143
|
-
for (const
|
|
3144
|
-
const v = C.get(
|
|
3163
|
+
for (const b of x) {
|
|
3164
|
+
const v = C.get(b);
|
|
3145
3165
|
N(v) && v.isAttached() && v.isSimpleText() && !v.isUnmergeable() && rr(v);
|
|
3146
3166
|
}
|
|
3147
|
-
}(
|
|
3148
|
-
const x = y._dirtyLeaves, C = y._dirtyElements,
|
|
3167
|
+
}(a, n) : function(m, y) {
|
|
3168
|
+
const x = y._dirtyLeaves, C = y._dirtyElements, b = m._nodeMap, v = ye(), P = /* @__PURE__ */ new Map();
|
|
3149
3169
|
let T = x, E = T.size, D = C, O = D.size;
|
|
3150
3170
|
for (; E > 0 || O > 0; ) {
|
|
3151
3171
|
if (E > 0) {
|
|
3152
3172
|
y._dirtyLeaves = /* @__PURE__ */ new Set();
|
|
3153
3173
|
for (const W of T) {
|
|
3154
|
-
const L =
|
|
3174
|
+
const L = b.get(W);
|
|
3155
3175
|
N(L) && L.isAttached() && L.isSimpleText() && !L.isUnmergeable() && rr(L), L !== void 0 && Ir(L, v) && Or(y, L, P), x.add(W);
|
|
3156
3176
|
}
|
|
3157
3177
|
if (T = y._dirtyLeaves, E = T.size, E > 0) {
|
|
@@ -3163,31 +3183,31 @@ function Es(n, e, t) {
|
|
|
3163
3183
|
for (const W of D) {
|
|
3164
3184
|
const L = W[0], U = W[1];
|
|
3165
3185
|
if (L !== "root" && !U) continue;
|
|
3166
|
-
const z =
|
|
3186
|
+
const z = b.get(L);
|
|
3167
3187
|
z !== void 0 && Ir(z, v) && Or(y, z, P), C.set(L, U);
|
|
3168
3188
|
}
|
|
3169
3189
|
T = y._dirtyLeaves, E = T.size, D = y._dirtyElements, O = D.size, pt++;
|
|
3170
3190
|
}
|
|
3171
3191
|
y._dirtyLeaves = x, y._dirtyElements = C;
|
|
3172
|
-
}(
|
|
3173
|
-
const
|
|
3192
|
+
}(a, n), Mr(n), function(m, y, x, C) {
|
|
3193
|
+
const b = m._nodeMap, v = y._nodeMap, P = [];
|
|
3174
3194
|
for (const [T] of C) {
|
|
3175
3195
|
const E = v.get(T);
|
|
3176
|
-
E !== void 0 && (E.isAttached() || (S(E) &&
|
|
3196
|
+
E !== void 0 && (E.isAttached() || (S(E) && os(E, T, b, v, P, C), b.has(T) || C.delete(T), P.push(T)));
|
|
3177
3197
|
}
|
|
3178
3198
|
for (const T of P) v.delete(T);
|
|
3179
3199
|
for (const T of x) {
|
|
3180
3200
|
const E = v.get(T);
|
|
3181
|
-
E === void 0 || E.isAttached() || (
|
|
3201
|
+
E === void 0 || E.isAttached() || (b.has(T) || x.delete(T), v.delete(T));
|
|
3182
3202
|
}
|
|
3183
|
-
}(l,
|
|
3184
|
-
const _ =
|
|
3203
|
+
}(l, a, n._dirtyLeaves, n._dirtyElements)), p !== n._compositionKey && (a._flushSync = !0);
|
|
3204
|
+
const _ = a._selection;
|
|
3185
3205
|
if (F(_)) {
|
|
3186
|
-
const m =
|
|
3187
|
-
m.get(y) !== void 0 && m.get(x) !== void 0 ||
|
|
3188
|
-
} else jt(_) && _._nodes.size === 0 && (
|
|
3206
|
+
const m = a._nodeMap, y = _.anchor.key, x = _.focus.key;
|
|
3207
|
+
m.get(y) !== void 0 && m.get(x) !== void 0 || k(19);
|
|
3208
|
+
} else jt(_) && _._nodes.size === 0 && (a._selection = null);
|
|
3189
3209
|
} catch (p) {
|
|
3190
|
-
return p instanceof Error && n._onError(p), n._pendingEditorState = l, n._dirtyType =
|
|
3210
|
+
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);
|
|
3191
3211
|
} finally {
|
|
3192
3212
|
R = f, Q = h, K = u, n._updating = d, pt = 0;
|
|
3193
3213
|
}
|
|
@@ -3197,14 +3217,14 @@ function Es(n, e, t) {
|
|
|
3197
3217
|
if (y.dirty || !y.is(m)) return !0;
|
|
3198
3218
|
} else if (m !== null) return !0;
|
|
3199
3219
|
return !1;
|
|
3200
|
-
}(
|
|
3220
|
+
}(a, n) ? a._flushSync ? (a._flushSync = !1, me(n)) : c && ki(() => {
|
|
3201
3221
|
me(n);
|
|
3202
|
-
}) : (
|
|
3222
|
+
}) : (a._flushSync = !1, c && (r.clear(), n._deferred = [], n._pendingEditorState = null));
|
|
3203
3223
|
}
|
|
3204
3224
|
function X(n, e, t) {
|
|
3205
|
-
n._updating ? n._updates.push([e, t]) :
|
|
3225
|
+
n._updating ? n._updates.push([e, t]) : Ps(n, e, t);
|
|
3206
3226
|
}
|
|
3207
|
-
class
|
|
3227
|
+
class qt extends Ut {
|
|
3208
3228
|
constructor(e) {
|
|
3209
3229
|
super(e), this.__first = null, this.__last = null, this.__size = 0, this.__format = 0, this.__style = "", this.__indent = 0, this.__dir = null;
|
|
3210
3230
|
}
|
|
@@ -3216,7 +3236,7 @@ class Ht extends Ut {
|
|
|
3216
3236
|
}
|
|
3217
3237
|
getFormatType() {
|
|
3218
3238
|
const e = this.getFormat();
|
|
3219
|
-
return
|
|
3239
|
+
return gi[e] || "";
|
|
3220
3240
|
}
|
|
3221
3241
|
getStyle() {
|
|
3222
3242
|
return this.getLatest().__style;
|
|
@@ -3295,7 +3315,7 @@ class Ht extends Ut {
|
|
|
3295
3315
|
}
|
|
3296
3316
|
getFirstChildOrThrow() {
|
|
3297
3317
|
const e = this.getFirstChild();
|
|
3298
|
-
return e === null &&
|
|
3318
|
+
return e === null && k(45, this.__key), e;
|
|
3299
3319
|
}
|
|
3300
3320
|
getLastChild() {
|
|
3301
3321
|
const e = this.getLatest().__last;
|
|
@@ -3303,7 +3323,7 @@ class Ht extends Ut {
|
|
|
3303
3323
|
}
|
|
3304
3324
|
getLastChildOrThrow() {
|
|
3305
3325
|
const e = this.getLastChild();
|
|
3306
|
-
return e === null &&
|
|
3326
|
+
return e === null && k(96, this.__key), e;
|
|
3307
3327
|
}
|
|
3308
3328
|
getChildAtIndex(e) {
|
|
3309
3329
|
const t = this.getChildrenSize();
|
|
@@ -3326,7 +3346,7 @@ class Ht extends Ut {
|
|
|
3326
3346
|
const t = this.getChildren(), r = t.length;
|
|
3327
3347
|
for (let s = 0; s < r; s++) {
|
|
3328
3348
|
const i = t[s];
|
|
3329
|
-
e += i.getTextContent(), S(i) && s !== r - 1 && !i.isInline() && (e +=
|
|
3349
|
+
e += i.getTextContent(), S(i) && s !== r - 1 && !i.isInline() && (e += ce);
|
|
3330
3350
|
}
|
|
3331
3351
|
return e;
|
|
3332
3352
|
}
|
|
@@ -3335,7 +3355,7 @@ class Ht extends Ut {
|
|
|
3335
3355
|
const t = this.getChildren(), r = t.length;
|
|
3336
3356
|
for (let s = 0; s < r; s++) {
|
|
3337
3357
|
const i = t[s];
|
|
3338
|
-
e += i.getTextContentSize(), S(i) && s !== r - 1 && !i.isInline() && (e +=
|
|
3358
|
+
e += i.getTextContentSize(), S(i) && s !== r - 1 && !i.isInline() && (e += ce.length);
|
|
3339
3359
|
}
|
|
3340
3360
|
return e;
|
|
3341
3361
|
}
|
|
@@ -3356,16 +3376,16 @@ class Ht extends Ut {
|
|
|
3356
3376
|
const o = this.getChildrenSize();
|
|
3357
3377
|
if (!this.canBeEmpty()) {
|
|
3358
3378
|
if (e === 0 && t === 0) {
|
|
3359
|
-
const
|
|
3360
|
-
if (N(
|
|
3379
|
+
const a = this.getFirstChild();
|
|
3380
|
+
if (N(a) || S(a)) return a.select(0, 0);
|
|
3361
3381
|
} else if (!(e !== void 0 && e !== o || t !== void 0 && t !== o)) {
|
|
3362
|
-
const
|
|
3363
|
-
if (N(
|
|
3382
|
+
const a = this.getLastChild();
|
|
3383
|
+
if (N(a) || S(a)) return a.select();
|
|
3364
3384
|
}
|
|
3365
3385
|
}
|
|
3366
3386
|
s === void 0 && (s = o), i === void 0 && (i = o);
|
|
3367
3387
|
const l = this.__key;
|
|
3368
|
-
return F(r) ? (r.anchor.set(l, s, "element"), r.focus.set(l, i, "element"), r.dirty = !0, r) :
|
|
3388
|
+
return F(r) ? (r.anchor.set(l, s, "element"), r.focus.set(l, i, "element"), r.dirty = !0, r) : ks(l, s, l, i, "element", "element");
|
|
3369
3389
|
}
|
|
3370
3390
|
selectStart() {
|
|
3371
3391
|
const e = this.getFirstDescendant();
|
|
@@ -3396,7 +3416,7 @@ class Ht extends Ut {
|
|
|
3396
3416
|
return this.getWritable().__indent = e, this;
|
|
3397
3417
|
}
|
|
3398
3418
|
splice(e, t, r) {
|
|
3399
|
-
const s = r.length, i = this.getChildrenSize(), o = this.getWritable(), l = o.__key,
|
|
3419
|
+
const s = r.length, i = this.getChildrenSize(), o = this.getWritable(), l = o.__key, a = [], c = [], f = this.getChildAtIndex(e + t);
|
|
3400
3420
|
let h = null, u = i - t + s;
|
|
3401
3421
|
if (e !== 0) if (e === i) h = this.getLastChild();
|
|
3402
3422
|
else {
|
|
@@ -3406,9 +3426,9 @@ class Ht extends Ut {
|
|
|
3406
3426
|
if (t > 0) {
|
|
3407
3427
|
let g = h === null ? this.getFirstChild() : h.getNextSibling();
|
|
3408
3428
|
for (let p = 0; p < t; p++) {
|
|
3409
|
-
g === null &&
|
|
3429
|
+
g === null && k(100);
|
|
3410
3430
|
const _ = g.getNextSibling(), m = g.__key;
|
|
3411
|
-
Ne(g.getWritable()),
|
|
3431
|
+
Ne(g.getWritable()), c.push(m), g = _;
|
|
3412
3432
|
}
|
|
3413
3433
|
}
|
|
3414
3434
|
let d = h;
|
|
@@ -3423,7 +3443,7 @@ class Ht extends Ut {
|
|
|
3423
3443
|
const y = d.getWritable();
|
|
3424
3444
|
y.__next = m, _.__prev = y.__key;
|
|
3425
3445
|
}
|
|
3426
|
-
p.__key === l &&
|
|
3446
|
+
p.__key === l && k(76), _.__parent = l, a.push(m), d = p;
|
|
3427
3447
|
}
|
|
3428
3448
|
if (e + t === i)
|
|
3429
3449
|
d !== null && (d.getWritable().__next = null, o.__last = d.__key);
|
|
@@ -3434,11 +3454,11 @@ class Ht extends Ut {
|
|
|
3434
3454
|
g.__prev = d.__key, p.__next = f.__key;
|
|
3435
3455
|
} else g.__prev = null;
|
|
3436
3456
|
}
|
|
3437
|
-
if (o.__size = u,
|
|
3457
|
+
if (o.__size = u, c.length) {
|
|
3438
3458
|
const g = I();
|
|
3439
3459
|
if (F(g)) {
|
|
3440
|
-
const p = new Set(
|
|
3441
|
-
Wr(m, p, _) && Ot(m, m.getNode(), this, h, f), Wr(y, p, _) && Ot(y, y.getNode(), this, h, f), u !== 0 || this.canBeEmpty() ||
|
|
3460
|
+
const p = new Set(c), _ = new Set(a), { anchor: m, focus: y } = g;
|
|
3461
|
+
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();
|
|
3442
3462
|
}
|
|
3443
3463
|
}
|
|
3444
3464
|
return o;
|
|
@@ -3490,7 +3510,7 @@ class Ht extends Ut {
|
|
|
3490
3510
|
}
|
|
3491
3511
|
}
|
|
3492
3512
|
function S(n) {
|
|
3493
|
-
return n instanceof
|
|
3513
|
+
return n instanceof qt;
|
|
3494
3514
|
}
|
|
3495
3515
|
function Wr(n, e, t) {
|
|
3496
3516
|
let r = n.getNode();
|
|
@@ -3501,12 +3521,12 @@ function Wr(n, e, t) {
|
|
|
3501
3521
|
}
|
|
3502
3522
|
return !1;
|
|
3503
3523
|
}
|
|
3504
|
-
class
|
|
3524
|
+
class Qi extends Ut {
|
|
3505
3525
|
constructor(e) {
|
|
3506
3526
|
super(e);
|
|
3507
3527
|
}
|
|
3508
3528
|
decorate(e, t) {
|
|
3509
|
-
|
|
3529
|
+
k(47);
|
|
3510
3530
|
}
|
|
3511
3531
|
isIsolated() {
|
|
3512
3532
|
return !1;
|
|
@@ -3519,36 +3539,36 @@ class qi extends Ut {
|
|
|
3519
3539
|
}
|
|
3520
3540
|
}
|
|
3521
3541
|
function A(n) {
|
|
3522
|
-
return n instanceof
|
|
3542
|
+
return n instanceof Qi;
|
|
3523
3543
|
}
|
|
3524
|
-
class
|
|
3544
|
+
class at extends qt {
|
|
3525
3545
|
static getType() {
|
|
3526
3546
|
return "root";
|
|
3527
3547
|
}
|
|
3528
3548
|
static clone() {
|
|
3529
|
-
return new
|
|
3549
|
+
return new at();
|
|
3530
3550
|
}
|
|
3531
3551
|
constructor() {
|
|
3532
3552
|
super("root"), this.__cachedText = null;
|
|
3533
3553
|
}
|
|
3534
3554
|
getTopLevelElementOrThrow() {
|
|
3535
|
-
|
|
3555
|
+
k(51);
|
|
3536
3556
|
}
|
|
3537
3557
|
getTextContent() {
|
|
3538
3558
|
const e = this.__cachedText;
|
|
3539
3559
|
return !lt() && M()._dirtyType !== Ee || e === null ? super.getTextContent() : e;
|
|
3540
3560
|
}
|
|
3541
3561
|
remove() {
|
|
3542
|
-
|
|
3562
|
+
k(52);
|
|
3543
3563
|
}
|
|
3544
3564
|
replace(e) {
|
|
3545
|
-
|
|
3565
|
+
k(53);
|
|
3546
3566
|
}
|
|
3547
3567
|
insertBefore(e) {
|
|
3548
|
-
|
|
3568
|
+
k(54);
|
|
3549
3569
|
}
|
|
3550
3570
|
insertAfter(e) {
|
|
3551
|
-
|
|
3571
|
+
k(55);
|
|
3552
3572
|
}
|
|
3553
3573
|
updateDOM(e, t) {
|
|
3554
3574
|
return !1;
|
|
@@ -3556,7 +3576,7 @@ class ct extends Ht {
|
|
|
3556
3576
|
append(...e) {
|
|
3557
3577
|
for (let t = 0; t < e.length; t++) {
|
|
3558
3578
|
const r = e[t];
|
|
3559
|
-
S(r) || A(r) ||
|
|
3579
|
+
S(r) || A(r) || k(56);
|
|
3560
3580
|
}
|
|
3561
3581
|
return super.append(...e);
|
|
3562
3582
|
}
|
|
@@ -3572,25 +3592,25 @@ class ct extends Ht {
|
|
|
3572
3592
|
}
|
|
3573
3593
|
}
|
|
3574
3594
|
function Z(n) {
|
|
3575
|
-
return n instanceof
|
|
3595
|
+
return n instanceof at;
|
|
3576
3596
|
}
|
|
3577
3597
|
function jn() {
|
|
3578
|
-
return new
|
|
3598
|
+
return new Qt(/* @__PURE__ */ new Map([["root", new at()]]));
|
|
3579
3599
|
}
|
|
3580
|
-
function
|
|
3600
|
+
function Fs(n) {
|
|
3581
3601
|
const e = n.exportJSON(), t = n.constructor;
|
|
3582
|
-
if (e.type !== t.getType() &&
|
|
3602
|
+
if (e.type !== t.getType() && k(130, t.name), S(n)) {
|
|
3583
3603
|
const r = e.children;
|
|
3584
|
-
Array.isArray(r) ||
|
|
3604
|
+
Array.isArray(r) || k(59, t.name);
|
|
3585
3605
|
const s = n.getChildren();
|
|
3586
3606
|
for (let i = 0; i < s.length; i++) {
|
|
3587
|
-
const o =
|
|
3607
|
+
const o = Fs(s[i]);
|
|
3588
3608
|
r.push(o);
|
|
3589
3609
|
}
|
|
3590
3610
|
}
|
|
3591
3611
|
return e;
|
|
3592
3612
|
}
|
|
3593
|
-
class
|
|
3613
|
+
class Qt {
|
|
3594
3614
|
constructor(e, t) {
|
|
3595
3615
|
this._nodeMap = e, this._selection = t || null, this._flushSync = !1, this._readOnly = !1;
|
|
3596
3616
|
}
|
|
@@ -3601,14 +3621,14 @@ class qt {
|
|
|
3601
3621
|
return Ar(t && t.editor || null, this, e);
|
|
3602
3622
|
}
|
|
3603
3623
|
clone(e) {
|
|
3604
|
-
const t = new
|
|
3624
|
+
const t = new Qt(this._nodeMap, e === void 0 ? this._selection : e);
|
|
3605
3625
|
return t._readOnly = !0, t;
|
|
3606
3626
|
}
|
|
3607
3627
|
toJSON() {
|
|
3608
|
-
return Ar(null, this, () => ({ root:
|
|
3628
|
+
return Ar(null, this, () => ({ root: Fs(G()) }));
|
|
3609
3629
|
}
|
|
3610
3630
|
}
|
|
3611
|
-
class
|
|
3631
|
+
class Xi extends qt {
|
|
3612
3632
|
static getType() {
|
|
3613
3633
|
return "artificial";
|
|
3614
3634
|
}
|
|
@@ -3616,7 +3636,7 @@ class Qi extends Ht {
|
|
|
3616
3636
|
return document.createElement("div");
|
|
3617
3637
|
}
|
|
3618
3638
|
}
|
|
3619
|
-
class
|
|
3639
|
+
class ze extends qt {
|
|
3620
3640
|
constructor(e) {
|
|
3621
3641
|
super(e), this.__textFormat = 0, this.__textStyle = "";
|
|
3622
3642
|
}
|
|
@@ -3631,7 +3651,7 @@ class We extends Ht {
|
|
|
3631
3651
|
return t.__textFormat = e, t;
|
|
3632
3652
|
}
|
|
3633
3653
|
hasTextFormat(e) {
|
|
3634
|
-
const t =
|
|
3654
|
+
const t = ae[e];
|
|
3635
3655
|
return !!(this.getTextFormat() & t);
|
|
3636
3656
|
}
|
|
3637
3657
|
getFormatFlags(e, t) {
|
|
@@ -3645,24 +3665,24 @@ class We extends Ht {
|
|
|
3645
3665
|
return t.__textStyle = e, t;
|
|
3646
3666
|
}
|
|
3647
3667
|
static clone(e) {
|
|
3648
|
-
return new
|
|
3668
|
+
return new ze(e.__key);
|
|
3649
3669
|
}
|
|
3650
3670
|
afterCloneFrom(e) {
|
|
3651
3671
|
super.afterCloneFrom(e), this.__textFormat = e.__textFormat, this.__textStyle = e.__textStyle;
|
|
3652
3672
|
}
|
|
3653
3673
|
createDOM(e) {
|
|
3654
|
-
const t = document.createElement("p"), r =
|
|
3674
|
+
const t = document.createElement("p"), r = qe(e.theme, "paragraph");
|
|
3655
3675
|
return r !== void 0 && t.classList.add(...r), t;
|
|
3656
3676
|
}
|
|
3657
3677
|
updateDOM(e, t, r) {
|
|
3658
3678
|
return !1;
|
|
3659
3679
|
}
|
|
3660
3680
|
static importDOM() {
|
|
3661
|
-
return { p: (e) => ({ conversion:
|
|
3681
|
+
return { p: (e) => ({ conversion: Zi, priority: 0 }) };
|
|
3662
3682
|
}
|
|
3663
3683
|
exportDOM(e) {
|
|
3664
3684
|
const { element: t } = super.exportDOM(e);
|
|
3665
|
-
if (t &&
|
|
3685
|
+
if (t && $n(t)) {
|
|
3666
3686
|
this.isEmpty() && t.append(document.createElement("br"));
|
|
3667
3687
|
const r = this.getFormatType();
|
|
3668
3688
|
t.style.textAlign = r;
|
|
@@ -3695,7 +3715,7 @@ class We extends Ht {
|
|
|
3695
3715
|
return !1;
|
|
3696
3716
|
}
|
|
3697
3717
|
}
|
|
3698
|
-
function
|
|
3718
|
+
function Zi(n) {
|
|
3699
3719
|
const e = ve();
|
|
3700
3720
|
if (n.style) {
|
|
3701
3721
|
e.setFormat(n.style.textAlign);
|
|
@@ -3705,54 +3725,54 @@ function Xi(n) {
|
|
|
3705
3725
|
return { node: e };
|
|
3706
3726
|
}
|
|
3707
3727
|
function ve() {
|
|
3708
|
-
return $t(new
|
|
3728
|
+
return $t(new ze());
|
|
3709
3729
|
}
|
|
3710
|
-
function
|
|
3711
|
-
return n instanceof
|
|
3730
|
+
function kn(n) {
|
|
3731
|
+
return n instanceof ze;
|
|
3712
3732
|
}
|
|
3713
|
-
const
|
|
3714
|
-
function
|
|
3733
|
+
const Co = 0, ko = 1, bo = 3, wo = 4;
|
|
3734
|
+
function Ds(n, e, t, r) {
|
|
3715
3735
|
const s = n._keyToDOMMap;
|
|
3716
3736
|
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;
|
|
3717
3737
|
const i = n._observer;
|
|
3718
3738
|
i !== null && (i.disconnect(), n._observer = null), e !== null && (e.textContent = ""), t !== null && (t.textContent = "", s.set("root", t));
|
|
3719
3739
|
}
|
|
3720
|
-
function
|
|
3721
|
-
const e = n || {}, t =
|
|
3740
|
+
function No(n) {
|
|
3741
|
+
const e = n || {}, t = qi(), 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()), a = e.editorState, c = [at, We, st, it, ze, Xi, ...e.nodes || []], { onError: f, html: h } = e, u = e.editable === void 0 || e.editable;
|
|
3722
3742
|
let d;
|
|
3723
3743
|
if (n === void 0 && t !== null) d = t._nodes;
|
|
3724
3744
|
else {
|
|
3725
3745
|
d = /* @__PURE__ */ new Map();
|
|
3726
|
-
for (let p = 0; p <
|
|
3727
|
-
let _ =
|
|
3746
|
+
for (let p = 0; p < c.length; p++) {
|
|
3747
|
+
let _ = c[p], m = null, y = null;
|
|
3728
3748
|
if (typeof _ != "function") {
|
|
3729
3749
|
const v = _;
|
|
3730
3750
|
_ = v.replace, m = v.with, y = v.withKlass || null;
|
|
3731
3751
|
}
|
|
3732
|
-
const x = _.getType(), C = _.transform(),
|
|
3733
|
-
C !== null &&
|
|
3752
|
+
const x = _.getType(), C = _.transform(), b = /* @__PURE__ */ new Set();
|
|
3753
|
+
C !== null && b.add(C), d.set(x, { exportDOM: h && h.export ? h.export.get(_) : void 0, klass: _, replace: m, replaceWithKlass: y, transforms: b });
|
|
3734
3754
|
}
|
|
3735
3755
|
}
|
|
3736
|
-
const g = new
|
|
3756
|
+
const g = new Xt(o, s, d, { disableEvents: i, namespace: l, theme: r }, f || console.error, function(p, _) {
|
|
3737
3757
|
const m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), x = (C) => {
|
|
3738
|
-
Object.keys(C).forEach((
|
|
3739
|
-
let v = m.get(
|
|
3740
|
-
v === void 0 && (v = [], m.set(
|
|
3758
|
+
Object.keys(C).forEach((b) => {
|
|
3759
|
+
let v = m.get(b);
|
|
3760
|
+
v === void 0 && (v = [], m.set(b, v)), v.push(C[b]);
|
|
3741
3761
|
});
|
|
3742
3762
|
};
|
|
3743
3763
|
return p.forEach((C) => {
|
|
3744
|
-
const
|
|
3745
|
-
if (
|
|
3746
|
-
y.add(
|
|
3747
|
-
const v =
|
|
3764
|
+
const b = C.klass.importDOM;
|
|
3765
|
+
if (b == null || y.has(b)) return;
|
|
3766
|
+
y.add(b);
|
|
3767
|
+
const v = b.call(C.klass);
|
|
3748
3768
|
v !== null && x(v);
|
|
3749
3769
|
}), _ && x(_), m;
|
|
3750
3770
|
}(d, h ? h.import : void 0), u);
|
|
3751
|
-
return
|
|
3771
|
+
return a !== void 0 && (g._pendingEditorState = a, g._dirtyType = Me), g;
|
|
3752
3772
|
}
|
|
3753
|
-
class
|
|
3773
|
+
class Xt {
|
|
3754
3774
|
constructor(e, t, r, s, i, o, l) {
|
|
3755
|
-
this._parentEditor = t, this._rootElement = null, this._editorState = e, this._pendingEditorState = null, this._compositionKey = null, this._deferred = [], this._keyToDOMMap = /* @__PURE__ */ new Map(), this._updates = [], this._updating = !1, this._listeners = { decorator: /* @__PURE__ */ new Set(), editable: /* @__PURE__ */ new Set(), mutation: /* @__PURE__ */ new Map(), root: /* @__PURE__ */ new Set(), textcontent: /* @__PURE__ */ new Set(), update: /* @__PURE__ */ new Set() }, this._commands = /* @__PURE__ */ new Map(), this._config = s, this._nodes = r, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = Ee, this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._dirtyElements = /* @__PURE__ */ new Map(), this._normalizedNodes = /* @__PURE__ */ new Set(), this._updateTags = /* @__PURE__ */ new Set(), this._observer = null, this._key =
|
|
3775
|
+
this._parentEditor = t, this._rootElement = null, this._editorState = e, this._pendingEditorState = null, this._compositionKey = null, this._deferred = [], this._keyToDOMMap = /* @__PURE__ */ new Map(), this._updates = [], this._updating = !1, this._listeners = { decorator: /* @__PURE__ */ new Set(), editable: /* @__PURE__ */ new Set(), mutation: /* @__PURE__ */ new Map(), root: /* @__PURE__ */ new Set(), textcontent: /* @__PURE__ */ new Set(), update: /* @__PURE__ */ new Set() }, this._commands = /* @__PURE__ */ new Map(), this._config = s, this._nodes = r, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = Ee, this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._dirtyElements = /* @__PURE__ */ new Map(), this._normalizedNodes = /* @__PURE__ */ new Set(), this._updateTags = /* @__PURE__ */ new Set(), this._observer = null, this._key = rs(), this._onError = i, this._htmlConversions = o, this._editable = l, this._headless = t !== null && t._headless, this._window = null, this._blockCursorElement = null;
|
|
3756
3776
|
}
|
|
3757
3777
|
isComposing() {
|
|
3758
3778
|
return this._compositionKey != null;
|
|
@@ -3788,11 +3808,11 @@ class Qt {
|
|
|
3788
3808
|
};
|
|
3789
3809
|
}
|
|
3790
3810
|
registerCommand(e, t, r) {
|
|
3791
|
-
r === void 0 &&
|
|
3811
|
+
r === void 0 && k(35);
|
|
3792
3812
|
const s = this._commands;
|
|
3793
3813
|
s.has(e) || s.set(e, [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()]);
|
|
3794
3814
|
const i = s.get(e);
|
|
3795
|
-
i === void 0 &&
|
|
3815
|
+
i === void 0 && k(36, String(e));
|
|
3796
3816
|
const o = i[r];
|
|
3797
3817
|
return o.add(t), () => {
|
|
3798
3818
|
o.delete(t), i.every((l) => l.size === 0) && s.delete(e);
|
|
@@ -3808,14 +3828,14 @@ class Qt {
|
|
|
3808
3828
|
}
|
|
3809
3829
|
getRegisteredNode(e) {
|
|
3810
3830
|
const t = this._nodes.get(e.getType());
|
|
3811
|
-
return t === void 0 &&
|
|
3831
|
+
return t === void 0 && k(37, e.name), t;
|
|
3812
3832
|
}
|
|
3813
3833
|
resolveRegisteredNodeAfterReplacements(e) {
|
|
3814
3834
|
for (; e.replaceWithKlass; ) e = this.getRegisteredNode(e.replaceWithKlass);
|
|
3815
3835
|
return e;
|
|
3816
3836
|
}
|
|
3817
3837
|
initializeMutationListener(e, t) {
|
|
3818
|
-
const r = this._editorState, s =
|
|
3838
|
+
const r = this._editorState, s = Li(r).get(t.getType());
|
|
3819
3839
|
if (!s) return;
|
|
3820
3840
|
const i = /* @__PURE__ */ new Map();
|
|
3821
3841
|
for (const o of s.keys()) i.set(o, "created");
|
|
@@ -3828,18 +3848,18 @@ class Qt {
|
|
|
3828
3848
|
registerNodeTransform(e, t) {
|
|
3829
3849
|
const r = this.registerNodeTransformToKlass(e, t), s = [r], i = r.replaceWithKlass;
|
|
3830
3850
|
if (i != null) {
|
|
3831
|
-
const
|
|
3832
|
-
s.push(
|
|
3851
|
+
const a = this.registerNodeTransformToKlass(i, t);
|
|
3852
|
+
s.push(a);
|
|
3833
3853
|
}
|
|
3834
3854
|
var o, l;
|
|
3835
3855
|
return o = this, l = e.getType(), X(o, () => {
|
|
3836
|
-
const
|
|
3837
|
-
if (
|
|
3856
|
+
const a = fe();
|
|
3857
|
+
if (a.isEmpty()) return;
|
|
3838
3858
|
if (l === "root") return void G().markDirty();
|
|
3839
|
-
const
|
|
3840
|
-
for (const [, f] of
|
|
3859
|
+
const c = a._nodeMap;
|
|
3860
|
+
for (const [, f] of c) f.markDirty();
|
|
3841
3861
|
}, o._pendingEditorState === null ? { tag: "history-merge" } : void 0), () => {
|
|
3842
|
-
s.forEach((
|
|
3862
|
+
s.forEach((a) => a.transforms.delete(t));
|
|
3843
3863
|
};
|
|
3844
3864
|
}
|
|
3845
3865
|
hasNode(e) {
|
|
@@ -3863,42 +3883,42 @@ class Qt {
|
|
|
3863
3883
|
setRootElement(e) {
|
|
3864
3884
|
const t = this._rootElement;
|
|
3865
3885
|
if (e !== t) {
|
|
3866
|
-
const r =
|
|
3867
|
-
if (this._rootElement = e,
|
|
3886
|
+
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 || Wi(t), r != null && t.classList.remove(...r)), e !== null) {
|
|
3868
3888
|
const i = function(l) {
|
|
3869
|
-
const
|
|
3870
|
-
return
|
|
3889
|
+
const a = l.ownerDocument;
|
|
3890
|
+
return a && a.defaultView || null;
|
|
3871
3891
|
}(e), o = e.style;
|
|
3872
|
-
o.userSelect = "text", o.whiteSpace = "pre-wrap", o.wordBreak = "break-word", e.setAttribute("data-lexical-editor", "true"), this._window = i, this._dirtyType =
|
|
3873
|
-
const
|
|
3874
|
-
(f === void 0 || f < 1) &&
|
|
3875
|
-
const h =
|
|
3876
|
-
for (let u = 0; u <
|
|
3877
|
-
const [d, g] =
|
|
3878
|
-
xr(_) || (mr(_), (
|
|
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, a) {
|
|
3893
|
+
const c = l.ownerDocument, f = Dt.get(c);
|
|
3894
|
+
(f === void 0 || f < 1) && c.addEventListener("selectionchange", xs), Dt.set(c, (f || 0) + 1), l.__lexicalEditor = a;
|
|
3895
|
+
const h = ms(l);
|
|
3896
|
+
for (let u = 0; u < vn.length; u++) {
|
|
3897
|
+
const [d, g] = vn[u], p = typeof g == "function" ? (_) => {
|
|
3898
|
+
xr(_) || (mr(_), (a.isEditable() || d === "click") && g(_, a));
|
|
3879
3899
|
} : (_) => {
|
|
3880
3900
|
if (xr(_)) return;
|
|
3881
3901
|
mr(_);
|
|
3882
|
-
const m =
|
|
3902
|
+
const m = a.isEditable();
|
|
3883
3903
|
switch (d) {
|
|
3884
3904
|
case "cut":
|
|
3885
|
-
return m && w(
|
|
3905
|
+
return m && w(a, $r, _);
|
|
3886
3906
|
case "copy":
|
|
3887
|
-
return w(
|
|
3907
|
+
return w(a, Kr, _);
|
|
3888
3908
|
case "paste":
|
|
3889
|
-
return m && w(
|
|
3909
|
+
return m && w(a, zr, _);
|
|
3890
3910
|
case "dragstart":
|
|
3891
|
-
return m && w(
|
|
3911
|
+
return m && w(a, Zs, _);
|
|
3892
3912
|
case "dragover":
|
|
3893
|
-
return m && w(
|
|
3913
|
+
return m && w(a, Gs, _);
|
|
3894
3914
|
case "dragend":
|
|
3895
|
-
return m && w(
|
|
3915
|
+
return m && w(a, Ys, _);
|
|
3896
3916
|
case "focus":
|
|
3897
|
-
return m && w(
|
|
3917
|
+
return m && w(a, ei, _);
|
|
3898
3918
|
case "blur":
|
|
3899
|
-
return m && w(
|
|
3919
|
+
return m && w(a, ti, _);
|
|
3900
3920
|
case "drop":
|
|
3901
|
-
return m && w(
|
|
3921
|
+
return m && w(a, Xs, _);
|
|
3902
3922
|
}
|
|
3903
3923
|
};
|
|
3904
3924
|
l.addEventListener(d, p), h.push(() => {
|
|
@@ -3907,7 +3927,7 @@ class Qt {
|
|
|
3907
3927
|
}
|
|
3908
3928
|
}(e, this), r != null && e.classList.add(...r);
|
|
3909
3929
|
} else this._editorState = s, this._pendingEditorState = null, this._window = null;
|
|
3910
|
-
|
|
3930
|
+
Ge("root", this, !1, e, t);
|
|
3911
3931
|
}
|
|
3912
3932
|
}
|
|
3913
3933
|
getElementByKey(e) {
|
|
@@ -3917,13 +3937,13 @@ class Qt {
|
|
|
3917
3937
|
return this._editorState;
|
|
3918
3938
|
}
|
|
3919
3939
|
setEditorState(e, t) {
|
|
3920
|
-
e.isEmpty() &&
|
|
3940
|
+
e.isEmpty() && k(38), qr(this);
|
|
3921
3941
|
const r = this._pendingEditorState, s = this._updateTags, i = t !== void 0 ? t.tag : null;
|
|
3922
|
-
r === null || r.isEmpty() || (i != null && s.add(i), me(this)), this._pendingEditorState = e, this._dirtyType =
|
|
3942
|
+
r === null || r.isEmpty() || (i != null && s.add(i), me(this)), this._pendingEditorState = e, this._dirtyType = Me, this._dirtyElements.set("root", !1), this._compositionKey = null, i != null && s.add(i), me(this);
|
|
3923
3943
|
}
|
|
3924
3944
|
parseEditorState(e, t) {
|
|
3925
3945
|
return function(r, s, i) {
|
|
3926
|
-
const o = jn(), l = R,
|
|
3946
|
+
const o = jn(), l = R, a = Q, c = K, f = s._dirtyElements, h = s._dirtyLeaves, u = s._cloneNotNeeded, d = s._dirtyType;
|
|
3927
3947
|
s._dirtyElements = /* @__PURE__ */ new Map(), s._dirtyLeaves = /* @__PURE__ */ new Set(), s._cloneNotNeeded = /* @__PURE__ */ new Set(), s._dirtyType = 0, R = o, Q = !1, K = s;
|
|
3928
3948
|
try {
|
|
3929
3949
|
const g = s._nodes;
|
|
@@ -3931,7 +3951,7 @@ class Qt {
|
|
|
3931
3951
|
} catch (g) {
|
|
3932
3952
|
g instanceof Error && s._onError(g);
|
|
3933
3953
|
} finally {
|
|
3934
|
-
s._dirtyElements = f, s._dirtyLeaves = h, s._cloneNotNeeded = u, s._dirtyType = d, R = l, Q =
|
|
3954
|
+
s._dirtyElements = f, s._dirtyLeaves = h, s._cloneNotNeeded = u, s._dirtyType = d, R = l, Q = a, K = c;
|
|
3935
3955
|
}
|
|
3936
3956
|
return o;
|
|
3937
3957
|
}(typeof e == "string" ? JSON.parse(e) : e, this, t);
|
|
@@ -3961,96 +3981,106 @@ class Qt {
|
|
|
3961
3981
|
return this._editable;
|
|
3962
3982
|
}
|
|
3963
3983
|
setEditable(e) {
|
|
3964
|
-
this._editable !== e && (this._editable = e,
|
|
3984
|
+
this._editable !== e && (this._editable = e, Ge("editable", this, !0, e));
|
|
3965
3985
|
}
|
|
3966
3986
|
toJSON() {
|
|
3967
3987
|
return { editorState: this._editorState.toJSON() };
|
|
3968
3988
|
}
|
|
3969
3989
|
}
|
|
3970
|
-
|
|
3990
|
+
Xt.version = "0.18.0+prod.esm";
|
|
3971
3991
|
export {
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3992
|
+
uo as $,
|
|
3993
|
+
ot as A,
|
|
3994
|
+
To as B,
|
|
3975
3995
|
hr as C,
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3996
|
+
wo as D,
|
|
3997
|
+
mo as E,
|
|
3998
|
+
kn as F,
|
|
3979
3999
|
Mt as G,
|
|
3980
|
-
|
|
4000
|
+
yo as H,
|
|
3981
4001
|
I,
|
|
3982
|
-
|
|
4002
|
+
Ae as J,
|
|
3983
4003
|
co as K,
|
|
3984
|
-
|
|
4004
|
+
ko as L,
|
|
3985
4005
|
Kr as M,
|
|
3986
|
-
|
|
3987
|
-
|
|
4006
|
+
zt as N,
|
|
4007
|
+
Us as O,
|
|
3988
4008
|
ve as P,
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
4009
|
+
bo as Q,
|
|
4010
|
+
Js as R,
|
|
4011
|
+
po as S,
|
|
3992
4012
|
br as T,
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
4013
|
+
Ks as U,
|
|
4014
|
+
Bs as V,
|
|
4015
|
+
Hs as W,
|
|
3996
4016
|
dr as X,
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4017
|
+
We as Y,
|
|
4018
|
+
mt as Z,
|
|
4019
|
+
fo as _,
|
|
4020
|
+
Pe as a,
|
|
4021
|
+
xt as a0,
|
|
4022
|
+
yt as a1,
|
|
4023
|
+
js as a2,
|
|
4024
|
+
qs as a3,
|
|
4025
|
+
$r as a4,
|
|
4026
|
+
oo as a5,
|
|
4027
|
+
He as a6,
|
|
4028
|
+
Qs as a7,
|
|
4029
|
+
ei as a8,
|
|
4030
|
+
bn as a9,
|
|
4031
|
+
Zr as aA,
|
|
4032
|
+
ao as aB,
|
|
4033
|
+
lo as aC,
|
|
4034
|
+
ue as aa,
|
|
4035
|
+
vo as ab,
|
|
4036
|
+
V as ac,
|
|
4037
|
+
xo as ad,
|
|
4038
|
+
Ti as ae,
|
|
4039
|
+
lt as af,
|
|
4040
|
+
ie as ag,
|
|
4041
|
+
No as ah,
|
|
4042
|
+
Ms as ai,
|
|
4043
|
+
Yi as aj,
|
|
4044
|
+
zr as ak,
|
|
4045
|
+
Xr as al,
|
|
4046
|
+
Co as am,
|
|
4047
|
+
Yn as an,
|
|
4048
|
+
ho as ao,
|
|
4049
|
+
Gs as ap,
|
|
4050
|
+
Zs as aq,
|
|
4051
|
+
Xs as ar,
|
|
4052
|
+
fn as as,
|
|
4053
|
+
gt as at,
|
|
4054
|
+
io as au,
|
|
4055
|
+
so as av,
|
|
4056
|
+
ro as aw,
|
|
4057
|
+
So as ax,
|
|
4058
|
+
Gn as ay,
|
|
4059
|
+
Ws as az,
|
|
4060
|
+
go as b,
|
|
4061
|
+
Zn as c,
|
|
4032
4062
|
we as d,
|
|
4033
|
-
|
|
4063
|
+
jt as e,
|
|
4034
4064
|
$t as f,
|
|
4035
4065
|
Rr as g,
|
|
4036
4066
|
Br as h,
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4067
|
+
A as i,
|
|
4068
|
+
Z as j,
|
|
4069
|
+
Xi as k,
|
|
4040
4070
|
N as l,
|
|
4041
4071
|
F as m,
|
|
4042
|
-
|
|
4072
|
+
nt as n,
|
|
4043
4073
|
$ as o,
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4074
|
+
qt as p,
|
|
4075
|
+
Oi as q,
|
|
4076
|
+
Fi as r,
|
|
4077
|
+
Un as s,
|
|
4078
|
+
to as t,
|
|
4079
|
+
eo as u,
|
|
4080
|
+
$n as v,
|
|
4051
4081
|
G as w,
|
|
4052
|
-
|
|
4082
|
+
_o as x,
|
|
4053
4083
|
S as y,
|
|
4054
|
-
|
|
4084
|
+
no as z
|
|
4055
4085
|
};
|
|
4056
|
-
//# sourceMappingURL=Lexical.prod-
|
|
4086
|
+
//# sourceMappingURL=Lexical.prod-BiuZHlIm.js.map
|