@tryghost/koenig-lexical 0.0.14 → 0.0.16
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/koenig-lexical.js
CHANGED
|
@@ -1,52 +1,97 @@
|
|
|
1
1
|
var ga = Object.defineProperty;
|
|
2
2
|
var fa = (n, e, t) => e in n ? ga(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
-
var
|
|
3
|
+
var Sr = (n, e, t) => (fa(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
4
|
import * as ye from "react";
|
|
5
|
-
import G, { useEffect as
|
|
5
|
+
import G, { useEffect as Br } from "react";
|
|
6
6
|
import ha, { createPortal as pa } from "react-dom";
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var Fi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, di = { exports: {} }, sr = {};
|
|
8
|
+
/**
|
|
9
|
+
* @license React
|
|
10
|
+
* react-jsx-runtime.production.min.js
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
var _a = G, ma = Symbol.for("react.element"), ya = Symbol.for("react.fragment"), Na = Object.prototype.hasOwnProperty, va = _a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Ca = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
|
+
function Ho(n, e, t) {
|
|
19
|
+
var r, i = {}, o = null, s = null;
|
|
20
|
+
t !== void 0 && (o = "" + t), e.key !== void 0 && (o = "" + e.key), e.ref !== void 0 && (s = e.ref);
|
|
21
|
+
for (r in e)
|
|
22
|
+
Na.call(e, r) && !Ca.hasOwnProperty(r) && (i[r] = e[r]);
|
|
23
|
+
if (n && n.defaultProps)
|
|
24
|
+
for (r in e = n.defaultProps, e)
|
|
25
|
+
i[r] === void 0 && (i[r] = e[r]);
|
|
26
|
+
return { $$typeof: ma, type: n, key: o, ref: s, props: i, _owner: va.current };
|
|
27
|
+
}
|
|
28
|
+
sr.Fragment = ya;
|
|
29
|
+
sr.jsx = Ho;
|
|
30
|
+
sr.jsxs = Ho;
|
|
31
|
+
(function(n) {
|
|
32
|
+
n.exports = sr;
|
|
33
|
+
})(di);
|
|
34
|
+
const b = di.exports.jsx, Gn = di.exports.jsxs, bc = () => /* @__PURE__ */ b("div", {
|
|
35
|
+
className: "koenig-lexical",
|
|
36
|
+
children: /* @__PURE__ */ Gn("div", {
|
|
37
|
+
className: "text-slate-700 ring-slate-700/10 hover:bg-slate-50 hover:text-slate-900 pointer-events-auto relative inline-flex rounded-md bg-white text-[0.8125rem] font-medium leading-5 shadow-sm ring-1",
|
|
38
|
+
children: [/* @__PURE__ */ Gn("div", {
|
|
39
|
+
className: "flex py-2 px-3",
|
|
40
|
+
children: [/* @__PURE__ */ b("svg", {
|
|
41
|
+
className: "fill-slate-400 mr-2.5 h-5 w-5 flex-none",
|
|
42
|
+
children: /* @__PURE__ */ b("path", {
|
|
43
|
+
d: "M5 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v14l-5-2.5L5 18V4Z"
|
|
44
|
+
})
|
|
45
|
+
}), "Bookmark"]
|
|
46
|
+
}), /* @__PURE__ */ b("div", {
|
|
47
|
+
className: "border-slate-400/20 border-l py-2 px-2.5",
|
|
48
|
+
children: "12k"
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
var Uo = {}, lr = {}, Wo = G;
|
|
53
|
+
let Yo = Wo.createContext(null);
|
|
54
|
+
lr.LexicalComposerContext = Yo;
|
|
55
|
+
lr.createLexicalComposerContext = function(n, e) {
|
|
11
56
|
let t = null;
|
|
12
57
|
return n != null && (t = n[1]), { getTheme: function() {
|
|
13
58
|
return e != null ? e : t != null ? t.getTheme() : null;
|
|
14
59
|
} };
|
|
15
60
|
};
|
|
16
|
-
|
|
17
|
-
let n =
|
|
61
|
+
lr.useLexicalComposerContext = function() {
|
|
62
|
+
let n = Wo.useContext(Yo);
|
|
18
63
|
if (n == null)
|
|
19
64
|
throw Error("Minified Lexical error #8; visit https://lexical.dev/docs/error?code=8 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");
|
|
20
65
|
return n;
|
|
21
66
|
};
|
|
22
|
-
const
|
|
23
|
-
var ke =
|
|
24
|
-
let
|
|
67
|
+
const Ea = lr;
|
|
68
|
+
var ke = Ea, E = {};
|
|
69
|
+
let Go = {}, Vo = {}, tn = {}, Vt = {}, zr = {}, Nt = {}, ci = {}, Kr = {}, nn = {}, rn = {}, We = {}, gi = {}, fi = {}, jo = {}, Jo = {}, Xo = {}, Zo = {}, Qo = {}, qo = {}, Vn = {}, es = {}, ts = {}, ns = {}, rs = {}, is = {}, os = {}, ss = {}, ls = {}, as = {}, hi = {}, pi = {}, us = {}, ds = {}, cs = {};
|
|
25
70
|
function R(n) {
|
|
26
71
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?code=${n} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
27
72
|
}
|
|
28
|
-
let Ot = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u",
|
|
73
|
+
let Ot = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Ta = Ot && "documentMode" in document ? document.documentMode : null, he = Ot && /Mac|iPod|iPhone|iPad/.test(navigator.platform), lt = Ot && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent), xa = Ot && "InputEvent" in window && !Ta ? "getTargetRanges" in new window.InputEvent("input") : !1, ar = Ot && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), ur = Ot && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, dr = ar || ur ? "\xA0" : "\u200B", Sa = lt ? "\xA0" : dr, $a = /^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/, Oa = /^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/, it = { bold: 1, code: 16, italic: 2, strikethrough: 4, subscript: 32, superscript: 64, underline: 8 }, Aa = {
|
|
29
74
|
directionless: 1,
|
|
30
75
|
unmergeable: 2
|
|
31
|
-
},
|
|
32
|
-
function
|
|
33
|
-
|
|
76
|
+
}, bi = { center: 2, justify: 4, left: 1, right: 3 }, Ra = { 2: "center", 4: "justify", 1: "left", 3: "right" }, wa = { normal: 0, segmented: 2, token: 1 }, Da = { 0: "normal", 2: "segmented", 1: "token" }, Hr = !1, _i = 0;
|
|
77
|
+
function La(n) {
|
|
78
|
+
_i = n.timeStamp;
|
|
34
79
|
}
|
|
35
|
-
function
|
|
80
|
+
function $r(n, e, t) {
|
|
36
81
|
return e.__lexicalLineBreak === n || n[`__lexicalKey_${t._key}`] !== void 0;
|
|
37
82
|
}
|
|
38
|
-
function
|
|
83
|
+
function Ma(n) {
|
|
39
84
|
return n.getEditorState().read(() => {
|
|
40
85
|
let e = Y();
|
|
41
86
|
return e !== null ? e.clone() : null;
|
|
42
87
|
});
|
|
43
88
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
let r = 100 < performance.now() -
|
|
89
|
+
function gs(n, e, t) {
|
|
90
|
+
Hr = !0;
|
|
91
|
+
let r = 100 < performance.now() - _i;
|
|
47
92
|
try {
|
|
48
93
|
Ne(n, () => {
|
|
49
|
-
let i = Y() ||
|
|
94
|
+
let i = Y() || Ma(n);
|
|
50
95
|
var o = /* @__PURE__ */ new Map(), s = n.getRootElement(), l = n._editorState;
|
|
51
96
|
let a = !1, u = "";
|
|
52
97
|
for (var d = 0; d < e.length; d++) {
|
|
@@ -66,16 +111,16 @@ function ds(n, e, t) {
|
|
|
66
111
|
}
|
|
67
112
|
c = g.nodeType === 3 && m.isAttached();
|
|
68
113
|
}
|
|
69
|
-
c && (m = window.getSelection(), g = c = null, m !== null && m.anchorNode === f && (c = m.anchorOffset, g = m.focusOffset), f = f.nodeValue, f !== null &&
|
|
114
|
+
c && (m = window.getSelection(), g = c = null, m !== null && m.anchorNode === f && (c = m.anchorOffset, g = m.focusOffset), f = f.nodeValue, f !== null && yi(p, f, c, g, !1));
|
|
70
115
|
} else if (g === "childList") {
|
|
71
116
|
for (a = !0, g = c.addedNodes, m = 0; m < g.length; m++) {
|
|
72
117
|
v = g[m];
|
|
73
|
-
var S =
|
|
74
|
-
h == null || S !== null || v.nodeName === "BR" &&
|
|
118
|
+
var S = ys(v), h = v.parentNode;
|
|
119
|
+
h == null || S !== null || v.nodeName === "BR" && $r(v, h, n) || (lt && (S = v.innerText || v.nodeValue) && (u += S), h.removeChild(v));
|
|
75
120
|
}
|
|
76
121
|
if (c = c.removedNodes, g = c.length, 0 < g) {
|
|
77
122
|
for (m = 0, v = 0; v < g; v++)
|
|
78
|
-
h = c[v], h.nodeName === "BR" &&
|
|
123
|
+
h = c[v], h.nodeName === "BR" && $r(h, f, n) && (f.appendChild(h), m++);
|
|
79
124
|
g !== m && (f === s && (p = l._nodeMap.get("root")), o.set(f, p));
|
|
80
125
|
}
|
|
81
126
|
}
|
|
@@ -91,31 +136,31 @@ function ds(n, e, t) {
|
|
|
91
136
|
if (o = t.takeRecords(), 0 < o.length) {
|
|
92
137
|
for (s = 0; s < o.length; s++)
|
|
93
138
|
for (d = o[s], l = d.addedNodes, d = d.target, p = 0; p < l.length; p++)
|
|
94
|
-
f = l[p], c = f.parentNode, c == null || f.nodeName !== "BR" ||
|
|
139
|
+
f = l[p], c = f.parentNode, c == null || f.nodeName !== "BR" || $r(f, d, n) || c.removeChild(f);
|
|
95
140
|
t.takeRecords();
|
|
96
141
|
}
|
|
97
|
-
i !== null && (a && (i.dirty = !0, At(i)), lt &&
|
|
142
|
+
i !== null && (a && (i.dirty = !0, At(i)), lt && Ss(n) && i.insertRawText(u));
|
|
98
143
|
});
|
|
99
144
|
} finally {
|
|
100
|
-
|
|
145
|
+
Hr = !1;
|
|
101
146
|
}
|
|
102
147
|
}
|
|
103
|
-
function
|
|
148
|
+
function fs(n) {
|
|
104
149
|
let e = n._observer;
|
|
105
150
|
if (e !== null) {
|
|
106
151
|
let t = e.takeRecords();
|
|
107
|
-
|
|
152
|
+
gs(n, t, e);
|
|
108
153
|
}
|
|
109
154
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
155
|
+
function hs(n) {
|
|
156
|
+
_i === 0 && gr(n).addEventListener("textInput", La, !0), n._observer = new MutationObserver((e, t) => {
|
|
157
|
+
gs(n, e, t);
|
|
113
158
|
});
|
|
114
159
|
}
|
|
115
|
-
let
|
|
160
|
+
let ka = 1, Ia = typeof queueMicrotask == "function" ? queueMicrotask : (n) => {
|
|
116
161
|
Promise.resolve().then(n);
|
|
117
162
|
};
|
|
118
|
-
function
|
|
163
|
+
function cr(n, e, t) {
|
|
119
164
|
let r = n.getRootElement();
|
|
120
165
|
try {
|
|
121
166
|
var i;
|
|
@@ -123,12 +168,12 @@ function ur(n, e, t) {
|
|
|
123
168
|
let o = document.activeElement, s = o !== null ? o.nodeName : null;
|
|
124
169
|
i = !J(pn(e)) || s !== "INPUT" && s !== "TEXTAREA";
|
|
125
170
|
}
|
|
126
|
-
return i &&
|
|
171
|
+
return i && ps(e) === n;
|
|
127
172
|
} catch {
|
|
128
173
|
return !1;
|
|
129
174
|
}
|
|
130
175
|
}
|
|
131
|
-
function
|
|
176
|
+
function ps(n) {
|
|
132
177
|
for (; n != null; ) {
|
|
133
178
|
let e = n.__lexicalEditor;
|
|
134
179
|
if (e != null)
|
|
@@ -137,10 +182,10 @@ function fs(n) {
|
|
|
137
182
|
}
|
|
138
183
|
return null;
|
|
139
184
|
}
|
|
140
|
-
function
|
|
185
|
+
function Ur(n) {
|
|
141
186
|
return n.isToken() || n.isSegmented();
|
|
142
187
|
}
|
|
143
|
-
function
|
|
188
|
+
function jn(n) {
|
|
144
189
|
for (; n != null; ) {
|
|
145
190
|
if (n.nodeType === 3)
|
|
146
191
|
return n;
|
|
@@ -148,10 +193,10 @@ function Vn(n) {
|
|
|
148
193
|
}
|
|
149
194
|
return null;
|
|
150
195
|
}
|
|
151
|
-
function
|
|
196
|
+
function _s(n, e, t) {
|
|
152
197
|
return e = it[e], n & e && (t === null || (t & e) === 0) ? n ^ e : t === null || t & e ? n | e : n;
|
|
153
198
|
}
|
|
154
|
-
function
|
|
199
|
+
function ms(n) {
|
|
155
200
|
return A(n) || cn(n) || J(n);
|
|
156
201
|
}
|
|
157
202
|
function bn(n) {
|
|
@@ -194,27 +239,27 @@ function Ye() {
|
|
|
194
239
|
function W(n, e) {
|
|
195
240
|
return n = (e || Le())._nodeMap.get(n), n === void 0 ? null : n;
|
|
196
241
|
}
|
|
197
|
-
function
|
|
242
|
+
function ys(n, e) {
|
|
198
243
|
let t = Q();
|
|
199
244
|
return n = n[`__lexicalKey_${t._key}`], n !== void 0 ? W(n, e) : null;
|
|
200
245
|
}
|
|
201
246
|
function pn(n, e) {
|
|
202
247
|
for (; n != null; ) {
|
|
203
|
-
let t =
|
|
248
|
+
let t = ys(n, e);
|
|
204
249
|
if (t !== null)
|
|
205
250
|
return t;
|
|
206
251
|
n = n.parentNode;
|
|
207
252
|
}
|
|
208
253
|
return null;
|
|
209
254
|
}
|
|
210
|
-
function
|
|
255
|
+
function Ns(n) {
|
|
211
256
|
let e = Object.assign({}, n._decorators);
|
|
212
257
|
return n._pendingDecorators = e;
|
|
213
258
|
}
|
|
214
|
-
function
|
|
259
|
+
function Bi(n) {
|
|
215
260
|
return n.read(() => Ze().getTextContent());
|
|
216
261
|
}
|
|
217
|
-
function
|
|
262
|
+
function Pa(n, e) {
|
|
218
263
|
Ne(n, () => {
|
|
219
264
|
var t = Le();
|
|
220
265
|
if (!t.isEmpty())
|
|
@@ -249,38 +294,38 @@ function mt(n) {
|
|
|
249
294
|
}
|
|
250
295
|
return t === null ? (e = e.getRootElement(), n === e ? W("root") : null) : W(t);
|
|
251
296
|
}
|
|
252
|
-
function
|
|
297
|
+
function vs(n) {
|
|
253
298
|
return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n);
|
|
254
299
|
}
|
|
255
|
-
function
|
|
300
|
+
function mi(n) {
|
|
256
301
|
let e = [];
|
|
257
302
|
for (; n !== null; )
|
|
258
303
|
e.push(n), n = n._parentEditor;
|
|
259
304
|
return e;
|
|
260
305
|
}
|
|
261
|
-
function
|
|
306
|
+
function Cs() {
|
|
262
307
|
return Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 5);
|
|
263
308
|
}
|
|
264
|
-
function
|
|
309
|
+
function Es(n, e) {
|
|
265
310
|
var t = window.getSelection();
|
|
266
311
|
if (t !== null) {
|
|
267
312
|
var r = t.anchorNode, { anchorOffset: i, focusOffset: o } = t;
|
|
268
313
|
if (r !== null && r.nodeType === 3 && (t = pn(r), A(t))) {
|
|
269
|
-
if (r = r.nodeValue, r ===
|
|
314
|
+
if (r = r.nodeValue, r === dr && e) {
|
|
270
315
|
let s = e.length;
|
|
271
316
|
r = e, o = i = s;
|
|
272
317
|
}
|
|
273
|
-
r !== null &&
|
|
318
|
+
r !== null && yi(t, r, i, o, n);
|
|
274
319
|
}
|
|
275
320
|
}
|
|
276
321
|
}
|
|
277
|
-
function
|
|
322
|
+
function yi(n, e, t, r, i) {
|
|
278
323
|
let o = n;
|
|
279
324
|
if (o.isAttached() && (i || !o.isDirty())) {
|
|
280
325
|
var s = o.isComposing();
|
|
281
|
-
if (n = e, (s || i) && e[e.length - 1] ===
|
|
326
|
+
if (n = e, (s || i) && e[e.length - 1] === dr && (n = e.slice(0, -1)), e = o.getTextContent(), i || n !== e)
|
|
282
327
|
if (n === "")
|
|
283
|
-
if (ie(null),
|
|
328
|
+
if (ie(null), ar || ur)
|
|
284
329
|
o.remove();
|
|
285
330
|
else {
|
|
286
331
|
let l = Q();
|
|
@@ -294,7 +339,7 @@ function _i(n, e, t, r, i) {
|
|
|
294
339
|
i = o.getParent(), e = mn(), o.isToken() || Ye() !== null && !s || i !== null && P(e) && !i.canInsertTextBefore() && e.anchor.offset === 0 ? o.markDirty() : (s = Y(), P(s) && t !== null && r !== null && (s.setTextNodeRange(o, t, o, r), o.isSegmented() && (t = o.getTextContent(), t = ce(t), o.replace(t), o = t)), o.setTextContent(n));
|
|
295
340
|
}
|
|
296
341
|
}
|
|
297
|
-
function
|
|
342
|
+
function Fa(n, e) {
|
|
298
343
|
if (e.isSegmented())
|
|
299
344
|
return !0;
|
|
300
345
|
if (!n.isCollapsed())
|
|
@@ -303,44 +348,44 @@ function Da(n, e) {
|
|
|
303
348
|
let t = e.getParentOrThrow(), r = e.isToken();
|
|
304
349
|
return n === 0 ? ((n = !e.canInsertTextBefore() || !t.canInsertTextBefore() || r) || (e = e.getPreviousSibling(), n = (A(e) || x(e) && e.isInline()) && !e.canInsertTextAfter()), n) : n === e.getTextContentSize() ? !e.canInsertTextAfter() || !t.canInsertTextAfter() || r : !1;
|
|
305
350
|
}
|
|
306
|
-
function
|
|
351
|
+
function Ts(n, e) {
|
|
307
352
|
let t = n.anchor, r = n.focus, i = t.getNode();
|
|
308
353
|
var o = window.getSelection();
|
|
309
354
|
o = o !== null ? o.anchorNode : null;
|
|
310
355
|
let s = t.key, l = Q().getElementByKey(s), a = e.length;
|
|
311
|
-
return s !== r.key || !A(i) || (2 > a ||
|
|
356
|
+
return s !== r.key || !A(i) || (2 > a || vs(e)) && t.offset !== r.offset && !i.isComposing() || Ur(i) || i.isDirty() && 1 < a || l !== null && !i.isComposing() && o !== jn(l) || i.getFormat() !== n.format || Fa(n, i);
|
|
312
357
|
}
|
|
313
358
|
function Bn(n, e) {
|
|
314
359
|
var t = n[e];
|
|
315
360
|
return typeof t == "string" ? (t = t.split(" "), n[e] = t) : t;
|
|
316
361
|
}
|
|
317
|
-
function
|
|
362
|
+
function Ni(n, e, t, r, i) {
|
|
318
363
|
t.size !== 0 && (t = r.__key, e = e.get(r.__type), e === void 0 && R(33), e = e.klass, r = n.get(e), r === void 0 && (r = /* @__PURE__ */ new Map(), n.set(e, r)), r.has(t) || r.set(t, i));
|
|
319
364
|
}
|
|
320
|
-
function
|
|
365
|
+
function zi(n, e, t) {
|
|
321
366
|
let r = n.getParent(), i = t;
|
|
322
367
|
return r !== null && (e && t === 0 ? (i = n.getIndexWithinParent(), n = r) : e || t !== n.getChildrenSize() || (i = n.getIndexWithinParent() + 1, n = r)), n.getChildAtIndex(e ? i - 1 : i);
|
|
323
368
|
}
|
|
324
|
-
function
|
|
369
|
+
function xs(n, e) {
|
|
325
370
|
var t = n.offset;
|
|
326
|
-
return n.type === "element" ? (n = n.getNode(),
|
|
371
|
+
return n.type === "element" ? (n = n.getNode(), zi(n, e, t)) : (n = n.getNode(), e && t === 0 || !e && t === n.getTextContentSize() ? (t = e ? n.getPreviousSibling() : n.getNextSibling(), t === null ? zi(n.getParentOrThrow(), e, n.getIndexWithinParent() + (e ? 0 : 1)) : t) : null);
|
|
327
372
|
}
|
|
328
|
-
function
|
|
329
|
-
return n = (n =
|
|
373
|
+
function Ss(n) {
|
|
374
|
+
return n = (n = gr(n).event) && n.inputType, n === "insertFromPaste" || n === "insertFromPasteAsQuotation";
|
|
330
375
|
}
|
|
331
|
-
function
|
|
376
|
+
function Wr(n) {
|
|
332
377
|
return !Me(n) && !n.isLastChild() && !n.isInline();
|
|
333
378
|
}
|
|
334
|
-
function
|
|
379
|
+
function Jn(n, e) {
|
|
335
380
|
return n = n._keyToDOMMap.get(e), n === void 0 && R(75), n;
|
|
336
381
|
}
|
|
337
|
-
function
|
|
382
|
+
function ba(n, e = 0) {
|
|
338
383
|
if (e !== 0 && R(1), e = Y(), !P(e) || !x(n))
|
|
339
384
|
return e;
|
|
340
385
|
let { anchor: t, focus: r } = e, i = t.getNode(), o = r.getNode();
|
|
341
|
-
return
|
|
386
|
+
return Yr(i, n) && t.set(n.__key, 0, "element"), Yr(o, n) && r.set(n.__key, 0, "element"), e;
|
|
342
387
|
}
|
|
343
|
-
function
|
|
388
|
+
function Yr(n, e) {
|
|
344
389
|
for (n = n.getParent(); n !== null; ) {
|
|
345
390
|
if (n.is(e))
|
|
346
391
|
return !0;
|
|
@@ -348,40 +393,40 @@ function Wr(n, e) {
|
|
|
348
393
|
}
|
|
349
394
|
return !1;
|
|
350
395
|
}
|
|
351
|
-
function
|
|
396
|
+
function gr(n) {
|
|
352
397
|
return n = n._window, n === null && R(78), n;
|
|
353
398
|
}
|
|
354
399
|
function Ge(n) {
|
|
355
400
|
return Me(n) || x(n) && n.isShadowRoot();
|
|
356
401
|
}
|
|
357
|
-
function
|
|
402
|
+
function $s(n, e, t, r, i) {
|
|
358
403
|
n = n.__children;
|
|
359
404
|
let o = n.length;
|
|
360
405
|
for (let s = 0; s < o; s++) {
|
|
361
406
|
let l = n[s], a = r.get(l);
|
|
362
|
-
a !== void 0 && a.__parent === e && (x(a) &&
|
|
407
|
+
a !== void 0 && a.__parent === e && (x(a) && $s(a, l, t, r, i), t.has(l) || i.delete(l), r.delete(l));
|
|
363
408
|
}
|
|
364
409
|
}
|
|
365
|
-
function
|
|
410
|
+
function Ba(n, e, t, r) {
|
|
366
411
|
n = n._nodeMap, e = e._nodeMap;
|
|
367
412
|
for (let i of t) {
|
|
368
413
|
let o = e.get(i);
|
|
369
414
|
o === void 0 || o.isAttached() || (n.has(i) || t.delete(i), e.delete(i));
|
|
370
415
|
}
|
|
371
416
|
for (let [i] of r)
|
|
372
|
-
t = e.get(i), t === void 0 || t.isAttached() || (x(t) &&
|
|
417
|
+
t = e.get(i), t === void 0 || t.isAttached() || (x(t) && $s(t, i, n, e, r), n.has(i) || r.delete(i), e.delete(i));
|
|
373
418
|
}
|
|
374
|
-
function
|
|
419
|
+
function Ki(n, e) {
|
|
375
420
|
let t = n.__mode, r = n.__format;
|
|
376
421
|
n = n.__style;
|
|
377
422
|
let i = e.__mode, o = e.__format;
|
|
378
423
|
return e = e.__style, (t === null || t === i) && (r === null || r === o) && (n === null || n === e);
|
|
379
424
|
}
|
|
380
|
-
function
|
|
425
|
+
function Hi(n, e) {
|
|
381
426
|
let t = n.mergeWithSibling(e), r = Q()._normalizedNodes;
|
|
382
427
|
return r.add(n.__key), r.add(e.__key), t;
|
|
383
428
|
}
|
|
384
|
-
function
|
|
429
|
+
function Os(n) {
|
|
385
430
|
if (n.__text === "" && n.isSimpleText() && !n.isUnmergeable())
|
|
386
431
|
n.remove();
|
|
387
432
|
else {
|
|
@@ -389,19 +434,19 @@ function Ss(n) {
|
|
|
389
434
|
if (e.__text === "")
|
|
390
435
|
e.remove();
|
|
391
436
|
else {
|
|
392
|
-
|
|
437
|
+
Ki(e, n) && (n = Hi(e, n));
|
|
393
438
|
break;
|
|
394
439
|
}
|
|
395
440
|
for (var t; (t = n.getNextSibling()) !== null && A(t) && t.isSimpleText() && !t.isUnmergeable(); )
|
|
396
441
|
if (t.__text === "")
|
|
397
442
|
t.remove();
|
|
398
443
|
else {
|
|
399
|
-
|
|
444
|
+
Ki(n, t) && Hi(n, t);
|
|
400
445
|
break;
|
|
401
446
|
}
|
|
402
447
|
}
|
|
403
448
|
}
|
|
404
|
-
function
|
|
449
|
+
function Ui(n) {
|
|
405
450
|
for (; n.type === "element"; ) {
|
|
406
451
|
var e = n.getNode(), t = n.offset;
|
|
407
452
|
if (t === e.getChildrenSize() ? (e = e.getChildAtIndex(t - 1), t = !0) : (e = e.getChildAtIndex(t), t = !1), A(e)) {
|
|
@@ -412,16 +457,16 @@ function Hi(n) {
|
|
|
412
457
|
n.set(e.__key, t ? e.getChildrenSize() : 0, "element");
|
|
413
458
|
}
|
|
414
459
|
}
|
|
415
|
-
let ne = "", ge = "", Fe = "", at, fe, on,
|
|
460
|
+
let ne = "", ge = "", Fe = "", at, fe, on, As = !1, vi = !1, fr, zn = null, Gr, Vr, sn, St, jr, ln;
|
|
416
461
|
function Kn(n, e) {
|
|
417
462
|
let t = sn.get(n);
|
|
418
463
|
if (e !== null) {
|
|
419
|
-
let r =
|
|
464
|
+
let r = Zr(n);
|
|
420
465
|
e.removeChild(r);
|
|
421
466
|
}
|
|
422
|
-
St.has(n) || fe._keyToDOMMap.delete(n), x(t) && (n = t.__children,
|
|
467
|
+
St.has(n) || fe._keyToDOMMap.delete(n), x(t) && (n = t.__children, Jr(n, 0, n.length - 1, null)), t !== void 0 && Ni(ln, on, fr, t, "destroyed");
|
|
423
468
|
}
|
|
424
|
-
function
|
|
469
|
+
function Jr(n, e, t, r) {
|
|
425
470
|
for (; e <= t; ++e) {
|
|
426
471
|
let i = n[e];
|
|
427
472
|
i !== void 0 && Kn(i, r);
|
|
@@ -430,10 +475,10 @@ function jr(n, e, t, r) {
|
|
|
430
475
|
function Bt(n, e) {
|
|
431
476
|
n.setProperty("text-align", e);
|
|
432
477
|
}
|
|
433
|
-
function
|
|
478
|
+
function Rs(n, e) {
|
|
434
479
|
n.style.setProperty("padding-inline-start", e === 0 ? "" : 20 * e + "px");
|
|
435
480
|
}
|
|
436
|
-
function
|
|
481
|
+
function ws(n, e) {
|
|
437
482
|
n = n.style, e === 0 ? Bt(n, "") : e === 1 ? Bt(n, "left") : e === 2 ? Bt(n, "center") : e === 3 ? Bt(n, "right") : e === 4 && Bt(n, "justify");
|
|
438
483
|
}
|
|
439
484
|
function Hn(n, e, t) {
|
|
@@ -442,50 +487,50 @@ function Hn(n, e, t) {
|
|
|
442
487
|
let i = r.createDOM(at, fe);
|
|
443
488
|
var o = fe._keyToDOMMap;
|
|
444
489
|
if (i["__lexicalKey_" + fe._key] = n, o.set(n, i), A(r) ? i.setAttribute("data-lexical-text", "true") : J(r) && i.setAttribute("data-lexical-decorator", "true"), x(r)) {
|
|
445
|
-
n = r.__indent, n !== 0 &&
|
|
490
|
+
n = r.__indent, n !== 0 && Rs(i, n), n = r.__children;
|
|
446
491
|
var s = n.length;
|
|
447
492
|
if (s !== 0) {
|
|
448
493
|
o = n, --s;
|
|
449
494
|
let l = ge;
|
|
450
|
-
ge = "",
|
|
495
|
+
ge = "", Xr(o, 0, s, i, null), Ls(r, i), ge = l;
|
|
451
496
|
}
|
|
452
|
-
o = r.__format, o !== 0 &&
|
|
497
|
+
o = r.__format, o !== 0 && ws(i, o), Ds(null, n, i), Wr(r) && (ne += `
|
|
453
498
|
|
|
454
499
|
`, Fe += `
|
|
455
500
|
|
|
456
501
|
`);
|
|
457
502
|
} else
|
|
458
|
-
o = r.getTextContent(), J(r) ? (s = r.decorate(fe, at), s !== null &&
|
|
503
|
+
o = r.getTextContent(), J(r) ? (s = r.decorate(fe, at), s !== null && Ms(
|
|
459
504
|
n,
|
|
460
505
|
s
|
|
461
506
|
), i.contentEditable = "false") : A(r) && (r.isDirectionless() || (ge += o)), ne += o, Fe += o;
|
|
462
|
-
return e !== null && (t != null ? e.insertBefore(i, t) : (t = e.__lexicalLineBreak, t != null ? e.insertBefore(i, t) : e.appendChild(i))),
|
|
507
|
+
return e !== null && (t != null ? e.insertBefore(i, t) : (t = e.__lexicalLineBreak, t != null ? e.insertBefore(i, t) : e.appendChild(i))), Ni(ln, on, fr, r, "created"), i;
|
|
463
508
|
}
|
|
464
|
-
function
|
|
509
|
+
function Xr(n, e, t, r, i) {
|
|
465
510
|
let o = ne;
|
|
466
511
|
for (ne = ""; e <= t; ++e)
|
|
467
512
|
Hn(n[e], r, i);
|
|
468
513
|
r.__lexicalTextContent = ne, ne = o + ne;
|
|
469
514
|
}
|
|
470
|
-
function
|
|
515
|
+
function Wi(n, e) {
|
|
471
516
|
return n = e.get(n[n.length - 1]), cn(n) || J(n);
|
|
472
517
|
}
|
|
473
|
-
function
|
|
474
|
-
n = n !== null && (n.length === 0 ||
|
|
518
|
+
function Ds(n, e, t) {
|
|
519
|
+
n = n !== null && (n.length === 0 || Wi(n, sn)), e = e !== null && (e.length === 0 || Wi(e, St)), n ? e || (e = t.__lexicalLineBreak, e != null && t.removeChild(e), t.__lexicalLineBreak = null) : e && (e = document.createElement("br"), t.__lexicalLineBreak = e, t.appendChild(e));
|
|
475
520
|
}
|
|
476
|
-
function
|
|
521
|
+
function Ls(n, e) {
|
|
477
522
|
var t = e.__lexicalDir;
|
|
478
523
|
if (e.__lexicalDirTextContent !== ge || t !== zn) {
|
|
479
524
|
let o = ge === "";
|
|
480
525
|
if (o)
|
|
481
526
|
var r = zn;
|
|
482
527
|
else
|
|
483
|
-
r = ge, r =
|
|
528
|
+
r = ge, r = $a.test(r) ? "rtl" : Oa.test(r) ? "ltr" : null;
|
|
484
529
|
if (r !== t) {
|
|
485
530
|
let s = e.classList, l = at.theme;
|
|
486
531
|
var i = t !== null ? l[t] : void 0;
|
|
487
532
|
let a = r !== null ? l[r] : void 0;
|
|
488
|
-
i !== void 0 && (typeof i == "string" && (i = i.split(" "), i = l[t] = i), s.remove(...i)), r === null || o && r === "ltr" ? e.removeAttribute("dir") : (a !== void 0 && (typeof a == "string" && (t = a.split(" "), a = l[r] = t), a !== void 0 && s.add(...a)), e.dir = r),
|
|
533
|
+
i !== void 0 && (typeof i == "string" && (i = i.split(" "), i = l[t] = i), s.remove(...i)), r === null || o && r === "ltr" ? e.removeAttribute("dir") : (a !== void 0 && (typeof a == "string" && (t = a.split(" "), a = l[r] = t), a !== void 0 && s.add(...a)), e.dir = r), vi || (n.getWritable().__dir = r);
|
|
489
534
|
}
|
|
490
535
|
zn = r, e.__lexicalDirTextContent = ge, e.__lexicalDir = r;
|
|
491
536
|
}
|
|
@@ -493,14 +538,14 @@ function ws(n, e) {
|
|
|
493
538
|
function Ut(n, e) {
|
|
494
539
|
var t = sn.get(n), r = St.get(n);
|
|
495
540
|
t !== void 0 && r !== void 0 || R(61);
|
|
496
|
-
var i =
|
|
497
|
-
let o =
|
|
541
|
+
var i = As || Vr.has(n) || Gr.has(n);
|
|
542
|
+
let o = Jn(fe, n);
|
|
498
543
|
if (t === r && !i)
|
|
499
544
|
return x(t) ? (r = o.__lexicalTextContent, r !== void 0 && (ne += r, Fe += r), r = o.__lexicalDirTextContent, r !== void 0 && (ge += r)) : (r = t.getTextContent(), A(t) && !t.isDirectionless() && (ge += r), Fe += r, ne += r), o;
|
|
500
|
-
if (t !== r && i &&
|
|
545
|
+
if (t !== r && i && Ni(ln, on, fr, r, "updated"), r.updateDOM(t, o, at))
|
|
501
546
|
return r = Hn(n, null, null), e === null && R(62), e.replaceChild(r, o), Kn(n, null), r;
|
|
502
547
|
if (x(t) && x(r)) {
|
|
503
|
-
if (n = r.__indent, n !== t.__indent &&
|
|
548
|
+
if (n = r.__indent, n !== t.__indent && Rs(o, n), n = r.__format, n !== t.__format && ws(o, n), n = t.__children, t = r.__children, n !== t || i) {
|
|
504
549
|
var s = n, l = t;
|
|
505
550
|
i = r, e = ge, ge = "";
|
|
506
551
|
let f = ne;
|
|
@@ -511,13 +556,13 @@ function Ut(n, e) {
|
|
|
511
556
|
if (l = l[0], d === l)
|
|
512
557
|
Ut(d, o);
|
|
513
558
|
else {
|
|
514
|
-
var c =
|
|
559
|
+
var c = Zr(d);
|
|
515
560
|
l = Hn(l, null, null), o.replaceChild(l, c), Kn(d, null);
|
|
516
561
|
}
|
|
517
562
|
} else if (a === 0)
|
|
518
|
-
u !== 0 &&
|
|
563
|
+
u !== 0 && Xr(l, 0, u - 1, o, null);
|
|
519
564
|
else if (u === 0)
|
|
520
|
-
a !== 0 && (d = o.__lexicalLineBreak == null,
|
|
565
|
+
a !== 0 && (d = o.__lexicalLineBreak == null, Jr(s, 0, a - 1, d ? null : o), d && (o.textContent = ""));
|
|
521
566
|
else {
|
|
522
567
|
let p = a - 1;
|
|
523
568
|
a = u - 1;
|
|
@@ -530,16 +575,16 @@ function Ut(n, e) {
|
|
|
530
575
|
else {
|
|
531
576
|
d === void 0 && (d = new Set(s)), c === void 0 && (c = new Set(l));
|
|
532
577
|
let h = c.has(g), _ = d.has(S);
|
|
533
|
-
h ? (_ ? (g =
|
|
578
|
+
h ? (_ ? (g = Jn(fe, S), g === m ? m = Ut(S, o).nextSibling : (m != null ? o.insertBefore(g, m) : o.appendChild(g), Ut(S, o)), v++) : Hn(S, o, m), u++) : (m = Zr(g).nextSibling, Kn(g, o), v++);
|
|
534
579
|
}
|
|
535
580
|
}
|
|
536
|
-
d = v > p, c = u > a, d && !c ? (d = l[a + 1], d = d === void 0 ? null : fe.getElementByKey(d),
|
|
581
|
+
d = v > p, c = u > a, d && !c ? (d = l[a + 1], d = d === void 0 ? null : fe.getElementByKey(d), Xr(l, u, a, o, d)) : c && !d && Jr(s, v, p, o);
|
|
537
582
|
}
|
|
538
|
-
|
|
583
|
+
Wr(i) && (ne += `
|
|
539
584
|
|
|
540
|
-
`), o.__lexicalTextContent = ne, ne = f + ne,
|
|
585
|
+
`), o.__lexicalTextContent = ne, ne = f + ne, Ls(i, o), ge = e, Me(r) || Ds(n, t, o);
|
|
541
586
|
}
|
|
542
|
-
|
|
587
|
+
Wr(r) && (ne += `
|
|
543
588
|
|
|
544
589
|
`, Fe += `
|
|
545
590
|
|
|
@@ -548,41 +593,41 @@ function Ut(n, e) {
|
|
|
548
593
|
t = r.getTextContent(), J(r) ? (i = r.decorate(
|
|
549
594
|
fe,
|
|
550
595
|
at
|
|
551
|
-
), i !== null &&
|
|
552
|
-
return !
|
|
596
|
+
), i !== null && Ms(n, i)) : A(r) && !r.isDirectionless() && (ge += t), ne += t, Fe += t;
|
|
597
|
+
return !vi && Me(r) && r.__cachedText !== Fe && (r = r.getWritable(), r.__cachedText = Fe), o;
|
|
553
598
|
}
|
|
554
|
-
function
|
|
599
|
+
function Ms(n, e) {
|
|
555
600
|
let t = fe._pendingDecorators, r = fe._decorators;
|
|
556
601
|
if (t === null) {
|
|
557
602
|
if (r[n] === e)
|
|
558
603
|
return;
|
|
559
|
-
t =
|
|
604
|
+
t = Ns(fe);
|
|
560
605
|
}
|
|
561
606
|
t[n] = e;
|
|
562
607
|
}
|
|
563
|
-
function
|
|
564
|
-
return n =
|
|
608
|
+
function Zr(n) {
|
|
609
|
+
return n = jr.get(n), n === void 0 && R(75), n;
|
|
565
610
|
}
|
|
566
|
-
let Ie = Object.freeze({}),
|
|
567
|
-
|
|
568
|
-
let an = 0,
|
|
569
|
-
function
|
|
611
|
+
let Ie = Object.freeze({}), Qr = [["keydown", ja], ["mousedown", Ka], ["compositionstart", Ga], ["compositionend", Va], ["input", Ya], ["click", za], ["cut", Ie], ["copy", Ie], ["dragstart", Ie], ["dragover", Ie], ["dragend", Ie], ["paste", Ie], ["focus", Ie], ["blur", Ie], ["drop", Ie]];
|
|
612
|
+
xa && Qr.push(["beforeinput", (n, e) => Wa(n, e)]);
|
|
613
|
+
let an = 0, ks = 0, jt = 0, qr = !1, ei = !1, Jt = !1, Wt = !1, Is = [0, 0, "root", 0];
|
|
614
|
+
function Yi(n, e) {
|
|
570
615
|
return n !== null && n.nodeValue !== null && n.nodeType === 3 && e !== 0 && e !== n.nodeValue.length;
|
|
571
616
|
}
|
|
572
|
-
function
|
|
617
|
+
function Gi(n, e, t) {
|
|
573
618
|
let { anchorNode: r, anchorOffset: i, focusNode: o, focusOffset: s } = n;
|
|
574
|
-
|
|
619
|
+
qr && (qr = !1, Yi(r, i) && Yi(o, s)) || Ne(e, () => {
|
|
575
620
|
if (!t)
|
|
576
621
|
At(null);
|
|
577
|
-
else if (
|
|
622
|
+
else if (cr(e, r, o)) {
|
|
578
623
|
var l = Y();
|
|
579
624
|
if (P(l)) {
|
|
580
625
|
var a = l.anchor, u = a.getNode();
|
|
581
626
|
if (l.isCollapsed()) {
|
|
582
627
|
n.type === "Range" && n.anchorNode === n.focusNode && (l.dirty = !0);
|
|
583
|
-
var d =
|
|
628
|
+
var d = gr(e).event;
|
|
584
629
|
d = d ? d.timeStamp : performance.now();
|
|
585
|
-
let [c, g, f, p] =
|
|
630
|
+
let [c, g, f, p] = Is;
|
|
586
631
|
d < p + 200 && a.offset === g && a.key === f ? l.format = c : a.type === "text" ? l.format = u.getFormat() : a.type === "element" && (l.format = 0);
|
|
587
632
|
} else {
|
|
588
633
|
a = 127, u = !1, d = l.getNodes();
|
|
@@ -595,35 +640,35 @@ function Yi(n, e, t) {
|
|
|
595
640
|
l.format = u ? a : 0;
|
|
596
641
|
}
|
|
597
642
|
}
|
|
598
|
-
$(e,
|
|
643
|
+
$(e, Go, void 0);
|
|
599
644
|
}
|
|
600
645
|
});
|
|
601
646
|
}
|
|
602
|
-
function
|
|
647
|
+
function za(n, e) {
|
|
603
648
|
Ne(e, () => {
|
|
604
649
|
let t = Y(), r = window.getSelection(), i = mn();
|
|
605
650
|
if (P(t)) {
|
|
606
651
|
let o = t.anchor, s = o.getNode();
|
|
607
652
|
r && o.type === "element" && o.offset === 0 && t.isCollapsed() && !Me(s) && Ze().getChildrenSize() === 1 && s.getTopLevelElementOrThrow().isEmpty() && i !== null && t.is(i) && (r.removeAllRanges(), t.dirty = !0);
|
|
608
653
|
}
|
|
609
|
-
$(e,
|
|
654
|
+
$(e, Vo, n);
|
|
610
655
|
});
|
|
611
656
|
}
|
|
612
|
-
function
|
|
657
|
+
function Ka(n, e) {
|
|
613
658
|
let t = n.target;
|
|
614
659
|
t instanceof Node && Ne(e, () => {
|
|
615
|
-
J(pn(t)) || (
|
|
660
|
+
J(pn(t)) || (ei = !0);
|
|
616
661
|
});
|
|
617
662
|
}
|
|
618
|
-
function
|
|
663
|
+
function Ha(n, e) {
|
|
619
664
|
e.getTargetRanges && (e = e.getTargetRanges()[0]) && n.applyDOMRange(e);
|
|
620
665
|
}
|
|
621
|
-
function
|
|
666
|
+
function Ua(n, e) {
|
|
622
667
|
return n !== e || x(n) || x(e) || !n.isToken() || !e.isToken();
|
|
623
668
|
}
|
|
624
|
-
function
|
|
669
|
+
function Wa(n, e) {
|
|
625
670
|
let t = n.inputType;
|
|
626
|
-
t === "deleteCompositionText" || lt &&
|
|
671
|
+
t === "deleteCompositionText" || lt && Ss(e) || t !== "insertCompositionText" && Ne(e, () => {
|
|
627
672
|
let r = Y();
|
|
628
673
|
if (t === "deleteContentBackward") {
|
|
629
674
|
if (r === null) {
|
|
@@ -633,7 +678,7 @@ function ba(n, e) {
|
|
|
633
678
|
At(i.clone());
|
|
634
679
|
}
|
|
635
680
|
if (P(r)) {
|
|
636
|
-
|
|
681
|
+
ks === 229 && n.timeStamp < an + 30 && e.isComposing() && r.anchor.key === r.focus.key ? (ie(null), an = 0, setTimeout(() => {
|
|
637
682
|
Ne(e, () => {
|
|
638
683
|
ie(null);
|
|
639
684
|
});
|
|
@@ -642,13 +687,13 @@ function ba(n, e) {
|
|
|
642
687
|
}
|
|
643
688
|
}
|
|
644
689
|
if (P(r)) {
|
|
645
|
-
i = n.data, r.dirty || !r.isCollapsed() || Me(r.anchor.getNode()) ||
|
|
690
|
+
i = n.data, r.dirty || !r.isCollapsed() || Me(r.anchor.getNode()) || Ha(r, n);
|
|
646
691
|
var o = r.focus, s = r.anchor.getNode();
|
|
647
692
|
if (o = o.getNode(), t === "insertText" || t === "insertTranspose")
|
|
648
693
|
i === `
|
|
649
694
|
` ? (n.preventDefault(), $(e, Vt, !1)) : i === `
|
|
650
695
|
|
|
651
|
-
` ? (n.preventDefault(), $(e,
|
|
696
|
+
` ? (n.preventDefault(), $(e, zr, void 0)) : i == null && n.dataTransfer ? (i = n.dataTransfer.getData("text/plain"), n.preventDefault(), r.insertRawText(i)) : i != null && Ts(r, i) && (n.preventDefault(), $(e, Nt, i));
|
|
652
697
|
else
|
|
653
698
|
switch (n.preventDefault(), t) {
|
|
654
699
|
case "insertFromYank":
|
|
@@ -667,18 +712,18 @@ function ba(n, e) {
|
|
|
667
712
|
ie(null), $(e, Vt, !1);
|
|
668
713
|
break;
|
|
669
714
|
case "insertParagraph":
|
|
670
|
-
ie(null), Jt ? (Jt = !1, $(e, Vt, !1)) : $(e,
|
|
715
|
+
ie(null), Jt ? (Jt = !1, $(e, Vt, !1)) : $(e, zr, void 0);
|
|
671
716
|
break;
|
|
672
717
|
case "insertFromPaste":
|
|
673
718
|
case "insertFromPasteAsQuotation":
|
|
674
|
-
$(e,
|
|
719
|
+
$(e, ci, n);
|
|
675
720
|
break;
|
|
676
721
|
case "deleteByComposition":
|
|
677
|
-
|
|
722
|
+
Ua(s, o) && $(e, Kr, void 0);
|
|
678
723
|
break;
|
|
679
724
|
case "deleteByDrag":
|
|
680
725
|
case "deleteByCut":
|
|
681
|
-
$(e,
|
|
726
|
+
$(e, Kr, void 0);
|
|
682
727
|
break;
|
|
683
728
|
case "deleteContent":
|
|
684
729
|
$(e, tn, !1);
|
|
@@ -715,51 +760,51 @@ function ba(n, e) {
|
|
|
715
760
|
$(e, We, "underline");
|
|
716
761
|
break;
|
|
717
762
|
case "historyUndo":
|
|
718
|
-
$(e,
|
|
763
|
+
$(e, gi, void 0);
|
|
719
764
|
break;
|
|
720
765
|
case "historyRedo":
|
|
721
|
-
$(e,
|
|
766
|
+
$(e, fi, void 0);
|
|
722
767
|
}
|
|
723
768
|
}
|
|
724
769
|
});
|
|
725
770
|
}
|
|
726
|
-
function
|
|
771
|
+
function Ya(n, e) {
|
|
727
772
|
n.stopPropagation(), Ne(e, () => {
|
|
728
773
|
var t = Y(), r = n.data;
|
|
729
|
-
r != null && P(t) &&
|
|
774
|
+
r != null && P(t) && Ts(t, r) ? (Wt && (ti(e, r), Wt = !1), $(e, Nt, r), r = r.length, lt && 1 < r && n.inputType === "insertCompositionText" && !e.isComposing() && (t.anchor.offset -= r), ar || ur || !e.isComposing() || (an = 0, ie(null))) : (Es(!1), Wt && (ti(e, r || void 0), Wt = !1)), _e(), t = Q(), fs(t);
|
|
730
775
|
});
|
|
731
776
|
}
|
|
732
|
-
function
|
|
777
|
+
function Ga(n, e) {
|
|
733
778
|
Ne(e, () => {
|
|
734
779
|
let t = Y();
|
|
735
780
|
if (P(t) && !e.isComposing()) {
|
|
736
781
|
let r = t.anchor;
|
|
737
|
-
ie(r.key), (n.timeStamp < an + 30 || r.type === "element" || !t.isCollapsed() || t.anchor.getNode().getFormat() !== t.format) && $(e, Nt,
|
|
782
|
+
ie(r.key), (n.timeStamp < an + 30 || r.type === "element" || !t.isCollapsed() || t.anchor.getNode().getFormat() !== t.format) && $(e, Nt, Sa);
|
|
738
783
|
}
|
|
739
784
|
});
|
|
740
785
|
}
|
|
741
|
-
function
|
|
786
|
+
function ti(n, e) {
|
|
742
787
|
var t = n._compositionKey;
|
|
743
788
|
if (ie(null), t !== null && e != null) {
|
|
744
789
|
if (e === "") {
|
|
745
|
-
e = W(t), n =
|
|
790
|
+
e = W(t), n = jn(n.getElementByKey(t)), n !== null && n.nodeValue !== null && A(e) && yi(e, n.nodeValue, null, null, !0);
|
|
746
791
|
return;
|
|
747
792
|
}
|
|
748
793
|
if (e[e.length - 1] === `
|
|
749
794
|
` && (t = Y(), P(t))) {
|
|
750
|
-
e = t.focus, t.anchor.set(e.key, e.offset, e.type), $(n,
|
|
795
|
+
e = t.focus, t.anchor.set(e.key, e.offset, e.type), $(n, Vn, null);
|
|
751
796
|
return;
|
|
752
797
|
}
|
|
753
798
|
}
|
|
754
|
-
|
|
799
|
+
Es(!0, e);
|
|
755
800
|
}
|
|
756
|
-
function
|
|
801
|
+
function Va(n, e) {
|
|
757
802
|
lt ? Wt = !0 : Ne(e, () => {
|
|
758
|
-
|
|
803
|
+
ti(e, n.data);
|
|
759
804
|
});
|
|
760
805
|
}
|
|
761
|
-
function
|
|
762
|
-
if (n._lexicalHandled !== !0 && (n._lexicalHandled = !0, an = n.timeStamp,
|
|
806
|
+
function ja(n, e) {
|
|
807
|
+
if (n._lexicalHandled !== !0 && (n._lexicalHandled = !0, an = n.timeStamp, ks = n.keyCode, !e.isComposing())) {
|
|
763
808
|
var { keyCode: t, shiftKey: r, ctrlKey: i, metaKey: o, altKey: s } = n;
|
|
764
809
|
if (t !== 39 || i || o || s)
|
|
765
810
|
if (t !== 39 || s || r || !i && !o)
|
|
@@ -768,81 +813,81 @@ function Ha(n, e) {
|
|
|
768
813
|
if (t !== 38 || i || o)
|
|
769
814
|
if (t !== 40 || i || o)
|
|
770
815
|
if (t === 13 && r)
|
|
771
|
-
Jt = !0, $(e,
|
|
816
|
+
Jt = !0, $(e, Vn, n);
|
|
772
817
|
else if (t === 32)
|
|
773
|
-
$(e,
|
|
818
|
+
$(e, es, n);
|
|
774
819
|
else if (he && i && t === 79)
|
|
775
820
|
n.preventDefault(), Jt = !0, $(e, Vt, !0);
|
|
776
821
|
else if (t !== 13 || r) {
|
|
777
822
|
var l = he ? s || o ? !1 : t === 8 || t === 72 && i : i || s || o ? !1 : t === 8;
|
|
778
|
-
l ? t === 8 ? $(e,
|
|
823
|
+
l ? t === 8 ? $(e, ts, n) : (n.preventDefault(), $(e, tn, !0)) : t === 27 ? $(e, ns, n) : (l = he ? r || s || o ? !1 : t === 46 || t === 68 && i : i || s || o ? !1 : t === 46, l ? t === 46 ? $(e, rs, n) : (n.preventDefault(), $(e, tn, !1)) : t === 8 && (he ? s : i) ? (n.preventDefault(), $(e, nn, !0)) : t === 46 && (he ? s : i) ? (n.preventDefault(), $(e, nn, !1)) : he && o && t === 8 ? (n.preventDefault(), $(e, rn, !0)) : he && o && t === 46 ? (n.preventDefault(), $(e, rn, !1)) : t === 66 && !s && (he ? o : i) ? (n.preventDefault(), $(e, We, "bold")) : t === 85 && !s && (he ? o : i) ? (n.preventDefault(), $(e, We, "underline")) : t === 73 && !s && (he ? o : i) ? (n.preventDefault(), $(e, We, "italic")) : t !== 9 || s || i || o ? t === 90 && !r && (he ? o : i) ? (n.preventDefault(), $(e, gi, void 0)) : (l = he ? t === 90 && o && r : t === 89 && i || t === 90 && i && r, l ? (n.preventDefault(), $(e, fi, void 0)) : _n(e._editorState._selection) && (l = r ? !1 : t === 67 ? he ? o : i : !1, l ? (n.preventDefault(), $(e, hi, n)) : (l = r ? !1 : t === 88 ? he ? o : i : !1, l && (n.preventDefault(), $(e, pi, n))))) : $(e, is, n));
|
|
779
824
|
} else
|
|
780
|
-
Jt = !1, $(e,
|
|
825
|
+
Jt = !1, $(e, Vn, n);
|
|
781
826
|
else
|
|
782
|
-
$(e,
|
|
827
|
+
$(e, qo, n);
|
|
783
828
|
else
|
|
784
|
-
$(e,
|
|
829
|
+
$(e, Qo, n);
|
|
785
830
|
else
|
|
786
|
-
$(e,
|
|
831
|
+
$(e, Zo, n);
|
|
787
832
|
else
|
|
788
|
-
$(e,
|
|
833
|
+
$(e, Xo, n);
|
|
789
834
|
else
|
|
790
|
-
$(e,
|
|
835
|
+
$(e, Jo, n);
|
|
791
836
|
else
|
|
792
|
-
$(e,
|
|
793
|
-
(i || r || s || o) && $(e,
|
|
837
|
+
$(e, jo, n);
|
|
838
|
+
(i || r || s || o) && $(e, cs, n);
|
|
794
839
|
}
|
|
795
840
|
}
|
|
796
|
-
function
|
|
841
|
+
function Ps(n) {
|
|
797
842
|
let e = n.__lexicalEventHandles;
|
|
798
843
|
return e === void 0 && (e = [], n.__lexicalEventHandles = e), e;
|
|
799
844
|
}
|
|
800
845
|
let Ct = /* @__PURE__ */ new Map();
|
|
801
|
-
function
|
|
846
|
+
function Fs() {
|
|
802
847
|
let n = window.getSelection();
|
|
803
848
|
if (n !== null) {
|
|
804
|
-
var e =
|
|
849
|
+
var e = ps(n.anchorNode);
|
|
805
850
|
if (e !== null) {
|
|
806
|
-
|
|
851
|
+
ei && (ei = !1, Ne(e, () => {
|
|
807
852
|
var s = mn(), l = n.anchorNode;
|
|
808
|
-
l !== null && (l = l.nodeType, l === 1 || l === 3) && (s =
|
|
853
|
+
l !== null && (l = l.nodeType, l === 1 || l === 3) && (s = Hs(s, n, e), At(s));
|
|
809
854
|
}));
|
|
810
|
-
var t =
|
|
855
|
+
var t = mi(e);
|
|
811
856
|
t = t[t.length - 1];
|
|
812
857
|
var r = t._key, i = Ct.get(r), o = i || t;
|
|
813
|
-
o !== e &&
|
|
858
|
+
o !== e && Gi(n, o, !1), Gi(n, e, !0), e !== t ? Ct.set(r, e) : i && Ct.delete(r);
|
|
814
859
|
}
|
|
815
860
|
}
|
|
816
861
|
}
|
|
817
|
-
function
|
|
818
|
-
jt === 0 && n.ownerDocument.addEventListener("selectionchange",
|
|
819
|
-
let t =
|
|
820
|
-
for (let r = 0; r <
|
|
821
|
-
let [i, o] =
|
|
862
|
+
function Ja(n, e) {
|
|
863
|
+
jt === 0 && n.ownerDocument.addEventListener("selectionchange", Fs), jt++, n.__lexicalEditor = e;
|
|
864
|
+
let t = Ps(n);
|
|
865
|
+
for (let r = 0; r < Qr.length; r++) {
|
|
866
|
+
let [i, o] = Qr[r], s = typeof o == "function" ? (l) => {
|
|
822
867
|
e.isEditable() && o(l, e);
|
|
823
868
|
} : (l) => {
|
|
824
869
|
if (e.isEditable())
|
|
825
870
|
switch (i) {
|
|
826
871
|
case "cut":
|
|
827
|
-
return $(e,
|
|
872
|
+
return $(e, pi, l);
|
|
828
873
|
case "copy":
|
|
829
|
-
return $(e,
|
|
874
|
+
return $(e, hi, l);
|
|
830
875
|
case "paste":
|
|
831
|
-
return $(e,
|
|
876
|
+
return $(e, ci, l);
|
|
832
877
|
case "dragstart":
|
|
833
|
-
return $(e,
|
|
878
|
+
return $(e, ss, l);
|
|
834
879
|
case "dragover":
|
|
835
|
-
return $(e,
|
|
880
|
+
return $(e, ls, l);
|
|
836
881
|
case "dragend":
|
|
837
|
-
return $(e,
|
|
882
|
+
return $(e, as, l);
|
|
838
883
|
case "focus":
|
|
839
|
-
return $(e,
|
|
884
|
+
return $(e, us, l);
|
|
840
885
|
case "blur":
|
|
841
|
-
return $(e,
|
|
886
|
+
return $(e, ds, l);
|
|
842
887
|
case "drop":
|
|
843
888
|
return $(
|
|
844
889
|
e,
|
|
845
|
-
|
|
890
|
+
os,
|
|
846
891
|
l
|
|
847
892
|
);
|
|
848
893
|
}
|
|
@@ -876,7 +921,7 @@ class De {
|
|
|
876
921
|
this.key = e, this.offset = t, this.type = r, Z || (Ye() === o && ie(e), i !== null && (i._cachedNodes = null, i.dirty = !0));
|
|
877
922
|
}
|
|
878
923
|
}
|
|
879
|
-
function
|
|
924
|
+
function Or(n, e) {
|
|
880
925
|
let t = e.__key, r = n.offset, i = "element";
|
|
881
926
|
if (A(e))
|
|
882
927
|
i = "text", e = e.getTextContentSize(), r > e && (r = e);
|
|
@@ -886,21 +931,21 @@ function $r(n, e) {
|
|
|
886
931
|
}
|
|
887
932
|
n.set(t, r, i);
|
|
888
933
|
}
|
|
889
|
-
function
|
|
934
|
+
function Vi(n, e) {
|
|
890
935
|
if (x(e)) {
|
|
891
936
|
let t = e.getLastDescendant();
|
|
892
|
-
x(t) || A(t) ?
|
|
937
|
+
x(t) || A(t) ? Or(n, t) : Or(n, e);
|
|
893
938
|
} else
|
|
894
|
-
|
|
939
|
+
Or(n, e);
|
|
895
940
|
}
|
|
896
|
-
function
|
|
941
|
+
function ji(n, e, t) {
|
|
897
942
|
let r = n.getNode(), i = r.getChildAtIndex(n.offset), o = ce(), s = Me(r) ? $t().append(o) : o;
|
|
898
943
|
o.setFormat(t), i === null ? r.append(s) : i.insertBefore(s), n.is(e) && e.set(o.__key, 0, "text"), n.set(o.__key, 0, "text");
|
|
899
944
|
}
|
|
900
945
|
function Ue(n, e, t, r) {
|
|
901
946
|
n.key = e, n.offset = t, n.type = r;
|
|
902
947
|
}
|
|
903
|
-
class
|
|
948
|
+
class hr {
|
|
904
949
|
constructor(e) {
|
|
905
950
|
this.dirty = !1, this._nodes = e, this._cachedNodes = null;
|
|
906
951
|
}
|
|
@@ -923,7 +968,7 @@ class gr {
|
|
|
923
968
|
return this._nodes.has(e);
|
|
924
969
|
}
|
|
925
970
|
clone() {
|
|
926
|
-
return new
|
|
971
|
+
return new hr(new Set(this._nodes));
|
|
927
972
|
}
|
|
928
973
|
extract() {
|
|
929
974
|
return this.getNodes();
|
|
@@ -965,18 +1010,18 @@ class gr {
|
|
|
965
1010
|
function P(n) {
|
|
966
1011
|
return n instanceof Rt;
|
|
967
1012
|
}
|
|
968
|
-
class
|
|
1013
|
+
class pr {
|
|
969
1014
|
constructor(e, t, r) {
|
|
970
1015
|
this.gridKey = e, this.anchor = t, this.focus = r, this.dirty = !1, this._cachedNodes = null, t._selection = this, r._selection = this;
|
|
971
1016
|
}
|
|
972
1017
|
is(e) {
|
|
973
|
-
return
|
|
1018
|
+
return Ci(e) ? this.gridKey === e.gridKey && this.anchor.is(this.focus) : !1;
|
|
974
1019
|
}
|
|
975
1020
|
set(e, t, r) {
|
|
976
1021
|
this.dirty = !0, this.gridKey = e, this.anchor.key = t, this.focus.key = r, this._cachedNodes = null;
|
|
977
1022
|
}
|
|
978
1023
|
clone() {
|
|
979
|
-
return new
|
|
1024
|
+
return new pr(this.gridKey, this.anchor, this.focus);
|
|
980
1025
|
}
|
|
981
1026
|
isCollapsed() {
|
|
982
1027
|
return !1;
|
|
@@ -996,7 +1041,7 @@ class fr {
|
|
|
996
1041
|
}
|
|
997
1042
|
insertNodes(e, t) {
|
|
998
1043
|
var r = this.focus.getNode();
|
|
999
|
-
return r = r.select(0, r.getChildrenSize()),
|
|
1044
|
+
return r = r.select(0, r.getChildrenSize()), Ui(r.anchor), Ui(r.focus), r.insertNodes(e, t);
|
|
1000
1045
|
}
|
|
1001
1046
|
getShape() {
|
|
1002
1047
|
var e = W(this.anchor.key);
|
|
@@ -1019,13 +1064,13 @@ class fr {
|
|
|
1019
1064
|
e = /* @__PURE__ */ new Set();
|
|
1020
1065
|
let { fromX: t, fromY: r, toX: i, toY: o } = this.getShape();
|
|
1021
1066
|
var s = W(this.gridKey);
|
|
1022
|
-
|
|
1067
|
+
Xs(s) || R(23), e.add(s), s = s.getChildren();
|
|
1023
1068
|
for (let u = r; u <= o; u++) {
|
|
1024
1069
|
var l = s[u];
|
|
1025
|
-
e.add(l),
|
|
1070
|
+
e.add(l), Qs(l) || R(24), l = l.getChildren();
|
|
1026
1071
|
for (let d = t; d <= i; d++) {
|
|
1027
1072
|
var a = l[d];
|
|
1028
|
-
for (
|
|
1073
|
+
for (js(a) || R(25), e.add(a), a = a.getChildren(); 0 < a.length; ) {
|
|
1029
1074
|
let c = a.shift();
|
|
1030
1075
|
e.add(c), x(c) && a.unshift(...c.getChildren());
|
|
1031
1076
|
}
|
|
@@ -1040,8 +1085,8 @@ class fr {
|
|
|
1040
1085
|
return t;
|
|
1041
1086
|
}
|
|
1042
1087
|
}
|
|
1043
|
-
function
|
|
1044
|
-
return n instanceof
|
|
1088
|
+
function Ci(n) {
|
|
1089
|
+
return n instanceof pr;
|
|
1045
1090
|
}
|
|
1046
1091
|
class Rt {
|
|
1047
1092
|
constructor(e, t, r) {
|
|
@@ -1088,7 +1133,7 @@ class Rt {
|
|
|
1088
1133
|
}
|
|
1089
1134
|
applyDOMRange(e) {
|
|
1090
1135
|
let t = Q(), r = t.getEditorState()._selection;
|
|
1091
|
-
if (e =
|
|
1136
|
+
if (e = Bs(e.startContainer, e.startOffset, e.endContainer, e.endOffset, t, r), e !== null) {
|
|
1092
1137
|
var [i, o] = e;
|
|
1093
1138
|
Ue(this.anchor, i.key, i.offset, i.type), Ue(
|
|
1094
1139
|
this.focus,
|
|
@@ -1103,7 +1148,7 @@ class Rt {
|
|
|
1103
1148
|
return new Rt(new De(e.key, e.offset, e.type), new De(t.key, t.offset, t.type), this.format);
|
|
1104
1149
|
}
|
|
1105
1150
|
toggleFormat(e) {
|
|
1106
|
-
this.format =
|
|
1151
|
+
this.format = _s(this.format, e, null), this.dirty = !0;
|
|
1107
1152
|
}
|
|
1108
1153
|
hasFormat(e) {
|
|
1109
1154
|
return (this.format & it[e]) !== 0;
|
|
@@ -1124,7 +1169,7 @@ class Rt {
|
|
|
1124
1169
|
}
|
|
1125
1170
|
insertText(e) {
|
|
1126
1171
|
var t = this.anchor, r = this.focus, i = this.isCollapsed() || t.isBefore(r), o = this.format;
|
|
1127
|
-
i && t.type === "element" ?
|
|
1172
|
+
i && t.type === "element" ? ji(t, r, o) : i || r.type !== "element" || ji(r, t, o);
|
|
1128
1173
|
var s = this.getNodes(), l = s.length, a = i ? r : t;
|
|
1129
1174
|
r = (i ? t : r).offset;
|
|
1130
1175
|
var u = a.offset;
|
|
@@ -1132,19 +1177,19 @@ class Rt {
|
|
|
1132
1177
|
var d = t.getParentOrThrow(), c = s[l - 1];
|
|
1133
1178
|
if (this.isCollapsed() && r === i && (t.isSegmented() || t.isToken() || !t.canInsertTextAfter() || !d.canInsertTextAfter() && t.getNextSibling() === null)) {
|
|
1134
1179
|
var g = t.getNextSibling();
|
|
1135
|
-
if ((!A(g) ||
|
|
1180
|
+
if ((!A(g) || Ur(g)) && (g = ce(), g.setFormat(o), d.canInsertTextAfter() ? t.insertAfter(g) : d.insertAfter(g)), g.select(0, 0), t = g, e !== "") {
|
|
1136
1181
|
this.insertText(e);
|
|
1137
1182
|
return;
|
|
1138
1183
|
}
|
|
1139
1184
|
} else if (this.isCollapsed() && r === 0 && (t.isSegmented() || t.isToken() || !t.canInsertTextBefore() || !d.canInsertTextBefore() && t.getPreviousSibling() === null)) {
|
|
1140
|
-
if (g = t.getPreviousSibling(), (!A(g) ||
|
|
1185
|
+
if (g = t.getPreviousSibling(), (!A(g) || Ur(g)) && (g = ce(), g.setFormat(o), d.canInsertTextBefore() ? t.insertBefore(g) : d.insertBefore(g)), g.select(), t = g, e !== "") {
|
|
1141
1186
|
this.insertText(e);
|
|
1142
1187
|
return;
|
|
1143
1188
|
}
|
|
1144
1189
|
} else if (t.isSegmented() && r !== i)
|
|
1145
1190
|
d = ce(t.getTextContent()), d.setFormat(o), t.replace(d), t = d;
|
|
1146
1191
|
else if (!(this.isCollapsed() || e === "" || (g = c.getParent(), d.canInsertTextBefore() && d.canInsertTextAfter() && (!x(g) || g.canInsertTextBefore() && g.canInsertTextAfter())))) {
|
|
1147
|
-
this.insertText(""),
|
|
1192
|
+
this.insertText(""), bs(this.anchor, this.focus, null), this.insertText(e);
|
|
1148
1193
|
return;
|
|
1149
1194
|
}
|
|
1150
1195
|
if (l === 1)
|
|
@@ -1250,7 +1295,7 @@ class Rt {
|
|
|
1250
1295
|
continue;
|
|
1251
1296
|
}
|
|
1252
1297
|
var g = c.getFirstDescendant();
|
|
1253
|
-
if (
|
|
1298
|
+
if (ms(g)) {
|
|
1254
1299
|
for (g = g.getParentOrThrow(); g.isInline(); )
|
|
1255
1300
|
g = g.getParentOrThrow();
|
|
1256
1301
|
if (d = g.getChildren(), u = d.length, x(s))
|
|
@@ -1273,7 +1318,7 @@ class Rt {
|
|
|
1273
1318
|
if (t && (A(o) ? o.select() : (e = s.getPreviousSibling(), A(e) ? e.select() : (e = s.getIndexWithinParent(), s.getParentOrThrow().select(e, e)))), x(s)) {
|
|
1274
1319
|
if (e = A(d) ? d : x(d) && d.isInline() ? d.getLastDescendant() : s.getLastDescendant(), t || (e === null ? s.select() : A(e) ? e.select() : e.selectNext()), r.length !== 0)
|
|
1275
1320
|
for (t = s, e = r.length - 1; 0 <= e; e--)
|
|
1276
|
-
i = r[e], a = i.getParentOrThrow(), !x(s) ||
|
|
1321
|
+
i = r[e], a = i.getParentOrThrow(), !x(s) || qi(i) || J(i) && !i.isInline() ? x(s) || qi(i) ? x(i) && !i.canInsertAfter(s) ? (o = a.constructor.clone(a), x(o) || R(29), o.append(i), s.insertAfter(o)) : s.insertAfter(i) : (s.insertBefore(i), s = i) : (t === s ? s.append(i) : s.insertBefore(i), s = i), a.isEmpty() && !a.canBeEmpty() && a.remove();
|
|
1277
1322
|
} else
|
|
1278
1323
|
t || (A(s) ? s.select() : (r = s.getParentOrThrow(), s = s.getIndexWithinParent() + 1, r.select(s, s)));
|
|
1279
1324
|
return !0;
|
|
@@ -1326,8 +1371,8 @@ class Rt {
|
|
|
1326
1371
|
return t === 0 ? [] : t === 1 ? A(s) && !this.isCollapsed() ? (e = a > u ? u : a, r = s.splitText(e, a > u ? a : u), e = e === 0 ? r[0] : r[1], e != null ? [e] : []) : [s] : (t = i.isBefore(o), A(s) && (i = t ? a : u, i === s.getTextContentSize() ? e.shift() : i !== 0 && ([, s] = s.splitText(i), e[0] = s)), A(l) && (s = l.getTextContent().length, t = t ? u : a, t === 0 ? e.pop() : t !== s && ([l] = l.splitText(t), e[r] = l)), e);
|
|
1327
1372
|
}
|
|
1328
1373
|
modify(e, t, r) {
|
|
1329
|
-
var i = this.focus, o = this.anchor, s = e === "move", l =
|
|
1330
|
-
J(l) && !l.isIsolated() ? s ? (s =
|
|
1374
|
+
var i = this.focus, o = this.anchor, s = e === "move", l = xs(i, t);
|
|
1375
|
+
J(l) && !l.isIsolated() ? s ? (s = Ks(), s.add(l.__key), At(s)) : (e = t ? l.getPreviousSibling() : l.getNextSibling(), A(e) ? (l = e.__key, t = t ? e.getTextContent().length : 0, i.set(l, t, "text"), s && o.set(l, t, "text")) : (r = l.getParentOrThrow(), x(e) ? (r = e.__key, l = t ? e.getChildrenSize() : 0) : (l = l.getIndexWithinParent(), r = r.__key, t || l++), i.set(r, l, "element"), s && o.set(r, l, "element"))) : (i = window.getSelection()) && (i.modify(e, t ? "backward" : "forward", r), 0 < i.rangeCount && (t = i.getRangeAt(0), this.applyDOMRange(t), this.dirty = !0, s || i.anchorNode === t.startContainer && i.anchorOffset === t.startOffset || (s = this.focus, t = this.anchor, i = t.key, o = t.offset, l = t.type, Ue(t, s.key, s.offset, s.type), Ue(s, i, o, l), this._cachedNodes = null)));
|
|
1331
1376
|
}
|
|
1332
1377
|
deleteCharacter(e) {
|
|
1333
1378
|
if (this.isCollapsed()) {
|
|
@@ -1341,17 +1386,17 @@ class Rt {
|
|
|
1341
1386
|
var o = r.type === "text" ? r.getNode() : null;
|
|
1342
1387
|
if (i = t.type === "text" ? t.getNode() : null, o !== null && o.isSegmented()) {
|
|
1343
1388
|
if (t = r.offset, r = o.getTextContentSize(), o.is(i) || e && t !== r || !e && t !== 0) {
|
|
1344
|
-
|
|
1389
|
+
Xi(o, e, t);
|
|
1345
1390
|
return;
|
|
1346
1391
|
}
|
|
1347
1392
|
} else if (i !== null && i.isSegmented() && (t = t.offset, r = i.getTextContentSize(), i.is(o) || e && t !== 0 || !e && t !== r)) {
|
|
1348
|
-
|
|
1393
|
+
Xi(i, e, t);
|
|
1349
1394
|
return;
|
|
1350
1395
|
}
|
|
1351
1396
|
if (i = this.anchor, o = this.focus, t = i.getNode(), r = o.getNode(), t === r && i.type === "text" && o.type === "text") {
|
|
1352
1397
|
var s = i.offset, l = o.offset;
|
|
1353
1398
|
let a = s < l;
|
|
1354
|
-
r = a ? s : l, l = a ? l : s, s = l - 1, r !== s && (t = t.getTextContent().slice(r, l),
|
|
1399
|
+
r = a ? s : l, l = a ? l : s, s = l - 1, r !== s && (t = t.getTextContent().slice(r, l), vs(t) || (e ? o.offset = s : i.offset = s));
|
|
1355
1400
|
}
|
|
1356
1401
|
}
|
|
1357
1402
|
}
|
|
@@ -1365,17 +1410,17 @@ class Rt {
|
|
|
1365
1410
|
}
|
|
1366
1411
|
}
|
|
1367
1412
|
function _n(n) {
|
|
1368
|
-
return n instanceof
|
|
1413
|
+
return n instanceof hr;
|
|
1369
1414
|
}
|
|
1370
|
-
function
|
|
1415
|
+
function Ji(n) {
|
|
1371
1416
|
let e = n.offset;
|
|
1372
1417
|
return n.type === "text" ? e : (n = n.getNode(), e === n.getChildrenSize() ? n.getTextContent().length : 0);
|
|
1373
1418
|
}
|
|
1374
1419
|
function Un(n) {
|
|
1375
1420
|
let e = n.anchor;
|
|
1376
|
-
return n = n.focus, e.type === "element" && n.type === "element" && e.key === n.key && e.offset === n.offset ? [0, 0] : [
|
|
1421
|
+
return n = n.focus, e.type === "element" && n.type === "element" && e.key === n.key && e.offset === n.offset ? [0, 0] : [Ji(e), Ji(n)];
|
|
1377
1422
|
}
|
|
1378
|
-
function
|
|
1423
|
+
function Xi(n, e, t) {
|
|
1379
1424
|
let r = n.getTextContent().split(/(?=\s)/g), i = r.length, o = 0, s = 0;
|
|
1380
1425
|
for (let l = 0; l < i; l++) {
|
|
1381
1426
|
let a = r[l], u = l === i - 1;
|
|
@@ -1386,7 +1431,7 @@ function Ji(n, e, t) {
|
|
|
1386
1431
|
}
|
|
1387
1432
|
e = r.join("").trim(), e === "" ? n.remove() : (n.setTextContent(e), n.select(s, s));
|
|
1388
1433
|
}
|
|
1389
|
-
function
|
|
1434
|
+
function Zi(n, e, t) {
|
|
1390
1435
|
var r = e;
|
|
1391
1436
|
if (n.nodeType === 1) {
|
|
1392
1437
|
let s = !1;
|
|
@@ -1403,49 +1448,49 @@ function Xi(n, e, t) {
|
|
|
1403
1448
|
i = mt(n);
|
|
1404
1449
|
return A(i) ? new De(i.__key, r, "text") : null;
|
|
1405
1450
|
}
|
|
1406
|
-
function
|
|
1451
|
+
function Qi(n, e, t) {
|
|
1407
1452
|
var r = n.offset, i = n.getNode();
|
|
1408
1453
|
r === 0 ? (r = i.getPreviousSibling(), i = i.getParent(), e ? (t || !e) && r === null && x(i) && i.isInline() && (e = i.getPreviousSibling(), A(e) && (n.key = e.__key, n.offset = e.getTextContent().length)) : x(r) && !t && r.isInline() ? (n.key = r.__key, n.offset = r.getChildrenSize(), n.type = "element") : A(r) && (n.key = r.__key, n.offset = r.getTextContent().length)) : r === i.getTextContent().length && (r = i.getNextSibling(), i = i.getParent(), e && x(r) && r.isInline() ? (n.key = r.__key, n.offset = 0, n.type = "element") : (t || e) && r === null && x(i) && i.isInline() && !i.canInsertTextAfter() && (e = i.getNextSibling(), A(e) && (n.key = e.__key, n.offset = 0)));
|
|
1409
1454
|
}
|
|
1410
|
-
function
|
|
1455
|
+
function bs(n, e, t) {
|
|
1411
1456
|
if (n.type === "text" && e.type === "text") {
|
|
1412
1457
|
var r = n.isBefore(e);
|
|
1413
1458
|
let i = n.is(e);
|
|
1414
|
-
|
|
1459
|
+
Qi(n, r, i), Qi(e, !r, i), i && (e.key = n.key, e.offset = n.offset, e.type = n.type), r = Q(), r.isComposing() && r._compositionKey !== n.key && P(t) && (r = t.anchor, t = t.focus, Ue(n, r.key, r.offset, r.type), Ue(e, t.key, t.offset, t.type));
|
|
1415
1460
|
}
|
|
1416
1461
|
}
|
|
1417
|
-
function
|
|
1418
|
-
return n === null || t === null || !
|
|
1462
|
+
function Bs(n, e, t, r, i, o) {
|
|
1463
|
+
return n === null || t === null || !cr(i, n, t) || (e = Zi(n, e, P(o) ? o.anchor : null), e === null) || (r = Zi(t, r, P(o) ? o.focus : null), r === null || e.type === "element" && r.type === "element" && (n = mt(n), t = mt(t), J(n) && J(t))) ? null : (bs(e, r, o), [e, r]);
|
|
1419
1464
|
}
|
|
1420
|
-
function
|
|
1465
|
+
function qi(n) {
|
|
1421
1466
|
return x(n) && !n.isInline();
|
|
1422
1467
|
}
|
|
1423
|
-
function
|
|
1468
|
+
function zs(n, e, t, r, i, o) {
|
|
1424
1469
|
let s = Le();
|
|
1425
1470
|
return n = new Rt(new De(n, e, i), new De(t, r, o), 0), n.dirty = !0, s._selection = n;
|
|
1426
1471
|
}
|
|
1427
|
-
function
|
|
1428
|
-
return new
|
|
1472
|
+
function Ks() {
|
|
1473
|
+
return new hr(/* @__PURE__ */ new Set());
|
|
1429
1474
|
}
|
|
1430
|
-
function
|
|
1475
|
+
function Xa(n) {
|
|
1431
1476
|
let e = n.getEditorState()._selection, t = window.getSelection();
|
|
1432
|
-
return _n(e) ||
|
|
1477
|
+
return _n(e) || Ci(e) ? e.clone() : Hs(e, t, n);
|
|
1433
1478
|
}
|
|
1434
|
-
function
|
|
1479
|
+
function Hs(n, e, t) {
|
|
1435
1480
|
var r = t._window;
|
|
1436
1481
|
if (r === null)
|
|
1437
1482
|
return null;
|
|
1438
1483
|
var i = r.event, o = i ? i.type : void 0;
|
|
1439
|
-
r = o === "selectionchange", i = !
|
|
1484
|
+
r = o === "selectionchange", i = !Hr && (r || o === "beforeinput" || o === "compositionstart" || o === "compositionend" || o === "click" && i && i.detail === 3 || o === void 0);
|
|
1440
1485
|
let s;
|
|
1441
1486
|
if (!P(n) || i) {
|
|
1442
1487
|
if (e === null)
|
|
1443
1488
|
return null;
|
|
1444
|
-
if (i = e.anchorNode, o = e.focusNode, s = e.anchorOffset, e = e.focusOffset, r && P(n) && !
|
|
1489
|
+
if (i = e.anchorNode, o = e.focusNode, s = e.anchorOffset, e = e.focusOffset, r && P(n) && !cr(t, i, o))
|
|
1445
1490
|
return n.clone();
|
|
1446
1491
|
} else
|
|
1447
1492
|
return n.clone();
|
|
1448
|
-
if (t =
|
|
1493
|
+
if (t = Bs(i, s, o, e, t, n), t === null)
|
|
1449
1494
|
return null;
|
|
1450
1495
|
let [l, a] = t;
|
|
1451
1496
|
return new Rt(l, a, P(n) ? n.format : 0);
|
|
@@ -1456,19 +1501,19 @@ function Y() {
|
|
|
1456
1501
|
function mn() {
|
|
1457
1502
|
return Q()._editorState._selection;
|
|
1458
1503
|
}
|
|
1459
|
-
function
|
|
1504
|
+
function Xn(n, e, t, r = 1) {
|
|
1460
1505
|
var i = n.anchor, o = n.focus, s = i.getNode(), l = o.getNode();
|
|
1461
1506
|
if (e.is(s) || e.is(l))
|
|
1462
1507
|
if (s = e.__key, n.isCollapsed())
|
|
1463
|
-
e = i.offset, t <= e && (t = Math.max(0, e + r), i.set(s, t, "element"), o.set(s, t, "element"),
|
|
1508
|
+
e = i.offset, t <= e && (t = Math.max(0, e + r), i.set(s, t, "element"), o.set(s, t, "element"), eo(n));
|
|
1464
1509
|
else {
|
|
1465
1510
|
var a = n.isBackward();
|
|
1466
1511
|
l = a ? o : i;
|
|
1467
1512
|
var u = l.getNode();
|
|
1468
|
-
i = a ? i : o, o = i.getNode(), e.is(u) && (u = l.offset, t <= u && l.set(s, Math.max(0, u + r), "element")), e.is(o) && (e = i.offset, t <= e && i.set(s, Math.max(0, e + r), "element")),
|
|
1513
|
+
i = a ? i : o, o = i.getNode(), e.is(u) && (u = l.offset, t <= u && l.set(s, Math.max(0, u + r), "element")), e.is(o) && (e = i.offset, t <= e && i.set(s, Math.max(0, e + r), "element")), eo(n);
|
|
1469
1514
|
}
|
|
1470
1515
|
}
|
|
1471
|
-
function
|
|
1516
|
+
function eo(n) {
|
|
1472
1517
|
var e = n.anchor, t = e.offset;
|
|
1473
1518
|
let r = n.focus;
|
|
1474
1519
|
var i = r.offset, o = e.getNode(), s = r.getNode();
|
|
@@ -1482,21 +1527,21 @@ function qi(n) {
|
|
|
1482
1527
|
x(s) && (t = s.getChildrenSize(), i = (e = i >= t) ? s.getChildAtIndex(t - 1) : s.getChildAtIndex(i), A(i) && (s = 0, e && (s = i.getTextContentSize()), r.set(i.__key, s, "text")));
|
|
1483
1528
|
}
|
|
1484
1529
|
}
|
|
1485
|
-
function
|
|
1530
|
+
function Za(n, e) {
|
|
1486
1531
|
if (e = e.getEditorState()._selection, n = n._selection, P(n)) {
|
|
1487
1532
|
var t = n.anchor;
|
|
1488
1533
|
let r = n.focus, i;
|
|
1489
1534
|
t.type === "text" && (i = t.getNode(), i.selectionTransform(e, n)), r.type === "text" && (t = r.getNode(), i !== t && t.selectionTransform(e, n));
|
|
1490
1535
|
}
|
|
1491
1536
|
}
|
|
1492
|
-
function
|
|
1537
|
+
function Zn(n, e, t, r, i) {
|
|
1493
1538
|
let o = null, s = 0, l = null;
|
|
1494
1539
|
r !== null ? (o = r.__key, A(r) ? (s = r.getTextContentSize(), l = "text") : x(r) && (s = r.getChildrenSize(), l = "element")) : i !== null && (o = i.__key, A(i) ? l = "text" : x(i) && (l = "element")), o !== null && l !== null ? n.set(o, s, l) : (s = e.getIndexWithinParent(), s === -1 && (s = t.getChildrenSize()), n.set(t.__key, s, "element"));
|
|
1495
1540
|
}
|
|
1496
|
-
function
|
|
1541
|
+
function to(n, e, t, r, i) {
|
|
1497
1542
|
n.type === "text" ? (n.key = t, e || (n.offset += i)) : n.offset > r.getIndexWithinParent() && --n.offset;
|
|
1498
1543
|
}
|
|
1499
|
-
let ue = null, re = null, Z = !1,
|
|
1544
|
+
let ue = null, re = null, Z = !1, Ar = !1, un = 0;
|
|
1500
1545
|
function _e() {
|
|
1501
1546
|
Z && R(13);
|
|
1502
1547
|
}
|
|
@@ -1506,18 +1551,18 @@ function Le() {
|
|
|
1506
1551
|
function Q() {
|
|
1507
1552
|
return re === null && R(16), re;
|
|
1508
1553
|
}
|
|
1509
|
-
function
|
|
1554
|
+
function no(n, e, t) {
|
|
1510
1555
|
var r = e.__type;
|
|
1511
1556
|
let i = n._nodes.get(r);
|
|
1512
1557
|
for (i === void 0 && R(30), n = t.get(r), n === void 0 && (n = Array.from(i.transforms), t.set(r, n)), t = n.length, r = 0; r < t && (n[r](e), e.isAttached()); r++)
|
|
1513
1558
|
;
|
|
1514
1559
|
}
|
|
1515
|
-
function
|
|
1560
|
+
function Qa(n, e) {
|
|
1516
1561
|
e = e._dirtyLeaves, n = n._nodeMap;
|
|
1517
1562
|
for (let t of e)
|
|
1518
|
-
e = n.get(t), A(e) && e.isAttached() && e.isSimpleText() && !e.isUnmergeable() &&
|
|
1563
|
+
e = n.get(t), A(e) && e.isAttached() && e.isSimpleText() && !e.isUnmergeable() && Os(e);
|
|
1519
1564
|
}
|
|
1520
|
-
function
|
|
1565
|
+
function qa(n, e) {
|
|
1521
1566
|
let t = e._dirtyLeaves, r = e._dirtyElements;
|
|
1522
1567
|
n = n._nodeMap;
|
|
1523
1568
|
let i = Ye(), o = /* @__PURE__ */ new Map();
|
|
@@ -1527,7 +1572,7 @@ function Va(n, e) {
|
|
|
1527
1572
|
if (0 < l) {
|
|
1528
1573
|
e._dirtyLeaves = /* @__PURE__ */ new Set();
|
|
1529
1574
|
for (let d of s)
|
|
1530
|
-
s = n.get(d), A(s) && s.isAttached() && s.isSimpleText() && !s.isUnmergeable() &&
|
|
1575
|
+
s = n.get(d), A(s) && s.isAttached() && s.isSimpleText() && !s.isUnmergeable() && Os(s), s !== void 0 && s !== void 0 && s.__key !== i && s.isAttached() && no(e, s, o), t.add(d);
|
|
1531
1576
|
if (s = e._dirtyLeaves, l = s.size, 0 < l) {
|
|
1532
1577
|
un++;
|
|
1533
1578
|
continue;
|
|
@@ -1535,21 +1580,21 @@ function Va(n, e) {
|
|
|
1535
1580
|
}
|
|
1536
1581
|
e._dirtyLeaves = /* @__PURE__ */ new Set(), e._dirtyElements = /* @__PURE__ */ new Map();
|
|
1537
1582
|
for (let d of a)
|
|
1538
|
-
a = d[0], u = d[1], (a === "root" || u) && (s = n.get(a), s !== void 0 && s !== void 0 && s.__key !== i && s.isAttached() &&
|
|
1583
|
+
a = d[0], u = d[1], (a === "root" || u) && (s = n.get(a), s !== void 0 && s !== void 0 && s.__key !== i && s.isAttached() && no(e, s, o), r.set(a, u));
|
|
1539
1584
|
s = e._dirtyLeaves, l = s.size, a = e._dirtyElements, u = a.size, un++;
|
|
1540
1585
|
}
|
|
1541
1586
|
e._dirtyLeaves = t, e._dirtyElements = r;
|
|
1542
1587
|
}
|
|
1543
|
-
function
|
|
1588
|
+
function Ei(n, e) {
|
|
1544
1589
|
var t = e.get(n.type);
|
|
1545
1590
|
if (t === void 0 && R(17), t = t.klass, n.type !== t.getType() && R(18), t = t.importJSON(n), n = n.children, x(t) && Array.isArray(n))
|
|
1546
1591
|
for (let r = 0; r < n.length; r++) {
|
|
1547
|
-
let i =
|
|
1592
|
+
let i = Ei(n[r], e);
|
|
1548
1593
|
t.append(i);
|
|
1549
1594
|
}
|
|
1550
1595
|
return t;
|
|
1551
1596
|
}
|
|
1552
|
-
function
|
|
1597
|
+
function ro(n, e) {
|
|
1553
1598
|
let t = ue, r = Z, i = re;
|
|
1554
1599
|
ue = n, Z = !0, re = null;
|
|
1555
1600
|
try {
|
|
@@ -1566,13 +1611,13 @@ function ot(n) {
|
|
|
1566
1611
|
re = n, ue = e, Z = !1, n._updating = !0;
|
|
1567
1612
|
try {
|
|
1568
1613
|
var p = n._dirtyType, m = n._dirtyElements, v = n._dirtyLeaves;
|
|
1569
|
-
g.disconnect(), ge = Fe = ne = "",
|
|
1614
|
+
g.disconnect(), ge = Fe = ne = "", As = p === 2, zn = null, fe = n, at = n._config, on = n._nodes, fr = fe._listeners.mutation, Gr = m, Vr = v, sn = i._nodeMap, St = e._nodeMap, vi = e._readOnly, jr = new Map(n._keyToDOMMap);
|
|
1570
1615
|
var S = /* @__PURE__ */ new Map();
|
|
1571
|
-
ln = S, Ut("root", null), ln =
|
|
1616
|
+
ln = S, Ut("root", null), ln = jr = at = St = sn = Vr = Gr = on = fe = void 0, f = S;
|
|
1572
1617
|
} catch (Te) {
|
|
1573
|
-
if (Te instanceof Error && n._onError(Te),
|
|
1618
|
+
if (Te instanceof Error && n._onError(Te), Ar)
|
|
1574
1619
|
throw Te;
|
|
1575
|
-
|
|
1620
|
+
Gs(n, null, t, e), hs(n), n._dirtyType = 2, Ar = !0, ot(n), Ar = !1;
|
|
1576
1621
|
return;
|
|
1577
1622
|
} finally {
|
|
1578
1623
|
g.observe(t, { characterData: !0, childList: !0, subtree: !0 }), n._updating = c, ue = a, Z = u, re = d;
|
|
@@ -1581,7 +1626,7 @@ function ot(n) {
|
|
|
1581
1626
|
e._readOnly || (e._readOnly = !0), c = n._dirtyLeaves, g = n._dirtyElements, S = n._normalizedNodes, p = n._updateTags, u = n._deferred, l && (n._dirtyType = 0, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements = /* @__PURE__ */ new Map(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set()), v = n._decorators, m = n._pendingDecorators || v;
|
|
1582
1627
|
var h = e._nodeMap;
|
|
1583
1628
|
for (ze in m)
|
|
1584
|
-
h.has(ze) || (m === v && (m =
|
|
1629
|
+
h.has(ze) || (m === v && (m = Ns(n)), delete m[ze]);
|
|
1585
1630
|
if (r = r ? null : window.getSelection(), n._editable && r !== null && (l || s === null || s.dirty)) {
|
|
1586
1631
|
re = n, ue = e;
|
|
1587
1632
|
try {
|
|
@@ -1589,15 +1634,15 @@ function ot(n) {
|
|
|
1589
1634
|
let Te = r.anchorNode, Ke = r.focusNode, An = r.anchorOffset, te = r.focusOffset, de = document.activeElement;
|
|
1590
1635
|
if (!p.has("collaboration") || de === t)
|
|
1591
1636
|
if (P(s)) {
|
|
1592
|
-
var _ = s.anchor, N = s.focus, C = _.key, T = N.key, O =
|
|
1637
|
+
var _ = s.anchor, N = s.focus, C = _.key, T = N.key, O = Jn(n, C), M = Jn(n, T), D = _.offset, K = N.offset, j = s.format, $e = s.isCollapsed();
|
|
1593
1638
|
l = O, T = M;
|
|
1594
1639
|
var ze = !1;
|
|
1595
|
-
if (_.type === "text" && (l =
|
|
1640
|
+
if (_.type === "text" && (l = jn(O), ze = _.getNode().getFormat() !== j), N.type === "text" && (T = jn(M)), l !== null && T !== null) {
|
|
1596
1641
|
if ($e && (o === null || ze || P(o) && o.format !== j)) {
|
|
1597
1642
|
var On = performance.now();
|
|
1598
|
-
|
|
1643
|
+
Is = [j, D, C, On];
|
|
1599
1644
|
}
|
|
1600
|
-
if (An === D && te === K && Te === l && Ke === T && (r.type !== "Range" || !$e) && (t === null || de !== null && t.contains(de) || t.focus({ preventScroll: !0 }), !
|
|
1645
|
+
if (An === D && te === K && Te === l && Ke === T && (r.type !== "Range" || !$e) && (t === null || de !== null && t.contains(de) || t.focus({ preventScroll: !0 }), !ur && !ar || _.type !== "element"))
|
|
1601
1646
|
break e;
|
|
1602
1647
|
try {
|
|
1603
1648
|
if (r.setBaseAndExtent(l, D, T, K), s.isCollapsed() && t !== null && t === de) {
|
|
@@ -1609,7 +1654,7 @@ function ot(n) {
|
|
|
1609
1654
|
let Oe = n.getElementByKey(xe.__key);
|
|
1610
1655
|
if (Oe !== null) {
|
|
1611
1656
|
let X = Oe.getBoundingClientRect();
|
|
1612
|
-
if (X.bottom >
|
|
1657
|
+
if (X.bottom > gr(n).innerHeight)
|
|
1613
1658
|
Oe.scrollIntoView(!1);
|
|
1614
1659
|
else if (0 > X.top)
|
|
1615
1660
|
Oe.scrollIntoView();
|
|
@@ -1620,12 +1665,12 @@ function ot(n) {
|
|
|
1620
1665
|
p.add("scroll-into-view");
|
|
1621
1666
|
}
|
|
1622
1667
|
}
|
|
1623
|
-
|
|
1668
|
+
qr = !0;
|
|
1624
1669
|
} catch {
|
|
1625
1670
|
}
|
|
1626
1671
|
}
|
|
1627
1672
|
} else
|
|
1628
|
-
o !== null &&
|
|
1673
|
+
o !== null && cr(n, Te, Ke) && r.removeAllRanges();
|
|
1629
1674
|
}
|
|
1630
1675
|
} finally {
|
|
1631
1676
|
re = d, ue = a;
|
|
@@ -1636,7 +1681,7 @@ function ot(n) {
|
|
|
1636
1681
|
let [Te, Ke] = o[a];
|
|
1637
1682
|
d = t.get(Ke), d !== void 0 && Te(d, { dirtyLeaves: c, updateTags: p });
|
|
1638
1683
|
}
|
|
1639
|
-
if (t = n._pendingDecorators, t !== null && (n._decorators = t, n._pendingDecorators = null, Xt("decorator", n, !0, t)), t =
|
|
1684
|
+
if (t = n._pendingDecorators, t !== null && (n._decorators = t, n._pendingDecorators = null, Xt("decorator", n, !0, t)), t = Bi(i), o = Bi(e), t !== o && Xt("textcontent", n, !0, o), Xt("update", n, !0, { dirtyElements: g, dirtyLeaves: c, editorState: e, normalizedNodes: S, prevEditorState: i, tags: p }), n._deferred = [], u.length !== 0) {
|
|
1640
1685
|
e = n._updating, n._updating = !0;
|
|
1641
1686
|
try {
|
|
1642
1687
|
for (i = 0; i < u.length; i++)
|
|
@@ -1647,7 +1692,7 @@ function ot(n) {
|
|
|
1647
1692
|
}
|
|
1648
1693
|
if (e = n._updates, e.length !== 0 && (e = e.shift())) {
|
|
1649
1694
|
let [Te, Ke] = e;
|
|
1650
|
-
|
|
1695
|
+
Us(n, Te, Ke);
|
|
1651
1696
|
}
|
|
1652
1697
|
}
|
|
1653
1698
|
}
|
|
@@ -1669,7 +1714,7 @@ function $(n, e, t) {
|
|
|
1669
1714
|
o = $(n, e, t);
|
|
1670
1715
|
}), o;
|
|
1671
1716
|
}
|
|
1672
|
-
let r =
|
|
1717
|
+
let r = mi(n);
|
|
1673
1718
|
for (let o = 4; 0 <= o; o--)
|
|
1674
1719
|
for (let s = 0; s < r.length; s++) {
|
|
1675
1720
|
var i = r[s]._commands.get(e);
|
|
@@ -1683,7 +1728,7 @@ function $(n, e, t) {
|
|
|
1683
1728
|
}
|
|
1684
1729
|
return !1;
|
|
1685
1730
|
}
|
|
1686
|
-
function
|
|
1731
|
+
function io(n, e) {
|
|
1687
1732
|
let t = n._updates;
|
|
1688
1733
|
for (e = e || !1; t.length !== 0; ) {
|
|
1689
1734
|
var r = t.shift();
|
|
@@ -1694,7 +1739,7 @@ function ro(n, e) {
|
|
|
1694
1739
|
}
|
|
1695
1740
|
return e;
|
|
1696
1741
|
}
|
|
1697
|
-
function
|
|
1742
|
+
function Us(n, e, t) {
|
|
1698
1743
|
let r = n._updateTags;
|
|
1699
1744
|
var i = !1;
|
|
1700
1745
|
if (t !== void 0) {
|
|
@@ -1703,13 +1748,13 @@ function Ks(n, e, t) {
|
|
|
1703
1748
|
}
|
|
1704
1749
|
o && n._deferred.push(o), t = n._editorState, o = n._pendingEditorState;
|
|
1705
1750
|
let s = !1;
|
|
1706
|
-
(o === null || o._readOnly) && (o = n._pendingEditorState = new
|
|
1751
|
+
(o === null || o._readOnly) && (o = n._pendingEditorState = new mr(new Map(t._nodeMap)), s = !0);
|
|
1707
1752
|
let l = ue, a = Z, u = re, d = n._updating;
|
|
1708
1753
|
ue = o, Z = !1, n._updating = !0, re = n;
|
|
1709
1754
|
try {
|
|
1710
|
-
s && !n._headless && (o._selection =
|
|
1755
|
+
s && !n._headless && (o._selection = Xa(n));
|
|
1711
1756
|
let c = n._compositionKey;
|
|
1712
|
-
e(), i =
|
|
1757
|
+
e(), i = io(n, i), Za(o, n), n._dirtyType !== 0 && (i ? Qa(o, n) : qa(o, n), io(n), Ba(t, o, n._dirtyLeaves, n._dirtyElements)), c !== n._compositionKey && (o._flushSync = !0);
|
|
1713
1758
|
let g = o._selection;
|
|
1714
1759
|
if (P(g)) {
|
|
1715
1760
|
let f = o._nodeMap, p = g.focus.key;
|
|
@@ -1722,31 +1767,31 @@ function Ks(n, e, t) {
|
|
|
1722
1767
|
} finally {
|
|
1723
1768
|
ue = l, Z = a, re = u, n._updating = d, un = 0;
|
|
1724
1769
|
}
|
|
1725
|
-
n._dirtyType !== 0 ||
|
|
1770
|
+
n._dirtyType !== 0 || eu(o, n) ? o._flushSync ? (o._flushSync = !1, ot(n)) : s && Ia(() => {
|
|
1726
1771
|
ot(n);
|
|
1727
1772
|
}) : (o._flushSync = !1, s && (r.clear(), n._deferred = [], n._pendingEditorState = null));
|
|
1728
1773
|
}
|
|
1729
1774
|
function Ne(n, e, t) {
|
|
1730
|
-
n._updating ? n._updates.push([e, t]) :
|
|
1775
|
+
n._updating ? n._updates.push([e, t]) : Us(n, e, t);
|
|
1731
1776
|
}
|
|
1732
|
-
function
|
|
1777
|
+
function ni(n, e, t) {
|
|
1733
1778
|
_e();
|
|
1734
1779
|
var r = n.__key;
|
|
1735
1780
|
let i = n.getParent();
|
|
1736
1781
|
if (i !== null) {
|
|
1737
|
-
var o =
|
|
1782
|
+
var o = ba(n), s = !1;
|
|
1738
1783
|
if (P(o) && e) {
|
|
1739
1784
|
var l = o.anchor;
|
|
1740
1785
|
let a = o.focus;
|
|
1741
|
-
l.key === r && (
|
|
1786
|
+
l.key === r && (Zn(l, n, i, n.getPreviousSibling(), n.getNextSibling()), s = !0), a.key === r && (Zn(a, n, i, n.getPreviousSibling(), n.getNextSibling()), s = !0);
|
|
1742
1787
|
}
|
|
1743
|
-
l = i.getWritable().__children, r = l.indexOf(r), r === -1 && R(31), vt(n), l.splice(r, 1), n.getWritable().__parent = null, P(o) && e && !s &&
|
|
1788
|
+
l = i.getWritable().__children, r = l.indexOf(r), r === -1 && R(31), vt(n), l.splice(r, 1), n.getWritable().__parent = null, P(o) && e && !s && Xn(o, i, r, -1), t || Ge(i) || i.canBeEmpty() || !i.isEmpty() || ni(i, e), Me(i) && i.isEmpty() && i.selectEnd();
|
|
1744
1789
|
}
|
|
1745
1790
|
}
|
|
1746
|
-
function
|
|
1791
|
+
function oo(n) {
|
|
1747
1792
|
return n = W(n), n === null && R(63), n;
|
|
1748
1793
|
}
|
|
1749
|
-
class
|
|
1794
|
+
class _r {
|
|
1750
1795
|
static getType() {
|
|
1751
1796
|
R(64);
|
|
1752
1797
|
}
|
|
@@ -1758,7 +1803,7 @@ class hr {
|
|
|
1758
1803
|
this.__key = e;
|
|
1759
1804
|
else {
|
|
1760
1805
|
_e(), 99 < un && R(14), e = Q();
|
|
1761
|
-
var t = Le(), r = "" +
|
|
1806
|
+
var t = Le(), r = "" + ka++;
|
|
1762
1807
|
t._nodeMap.set(r, this), x(this) ? e._dirtyElements.set(r, !0) : e._dirtyLeaves.add(r), e._cloneNotNeeded.add(r), e._dirtyType = 1, this.__key = r;
|
|
1763
1808
|
}
|
|
1764
1809
|
}
|
|
@@ -1837,7 +1882,7 @@ class hr {
|
|
|
1837
1882
|
return [];
|
|
1838
1883
|
e = e.__children;
|
|
1839
1884
|
let t = e.indexOf(this.__key);
|
|
1840
|
-
return e.slice(0, t).map((r) =>
|
|
1885
|
+
return e.slice(0, t).map((r) => oo(r));
|
|
1841
1886
|
}
|
|
1842
1887
|
getNextSibling() {
|
|
1843
1888
|
var e = this.getParent();
|
|
@@ -1853,7 +1898,7 @@ class hr {
|
|
|
1853
1898
|
return [];
|
|
1854
1899
|
e = e.__children;
|
|
1855
1900
|
let t = e.indexOf(this.__key);
|
|
1856
|
-
return e.slice(t + 1).map((r) =>
|
|
1901
|
+
return e.slice(t + 1).map((r) => oo(r));
|
|
1857
1902
|
}
|
|
1858
1903
|
getCommonAncestor(e) {
|
|
1859
1904
|
let t = this.getParents();
|
|
@@ -1967,7 +2012,7 @@ class hr {
|
|
|
1967
2012
|
R(18);
|
|
1968
2013
|
}
|
|
1969
2014
|
remove(e) {
|
|
1970
|
-
|
|
2015
|
+
ni(this, !0, e);
|
|
1971
2016
|
}
|
|
1972
2017
|
replace(e) {
|
|
1973
2018
|
_e();
|
|
@@ -1975,7 +2020,7 @@ class hr {
|
|
|
1975
2020
|
e = e.getWritable(), bn(e);
|
|
1976
2021
|
var r = this.getParentOrThrow(), i = r.getWritable().__children;
|
|
1977
2022
|
let o = i.indexOf(this.__key), s = e.__key;
|
|
1978
|
-
return o === -1 && R(31), i.splice(o, 0, s), e.__parent = r.__key,
|
|
2023
|
+
return o === -1 && R(31), i.splice(o, 0, s), e.__parent = r.__key, ni(this, !1), vt(e), i = Y(), P(i) && (r = i.anchor, i = i.focus, r.key === t && Vi(r, e), i.key === t && Vi(i, e)), Ye() === t && ie(s), e;
|
|
1979
2024
|
}
|
|
1980
2025
|
insertAfter(e) {
|
|
1981
2026
|
_e();
|
|
@@ -1984,7 +2029,7 @@ class hr {
|
|
|
1984
2029
|
var s = e.getIndexWithinParent(), l = !1, a = !1;
|
|
1985
2030
|
i !== null && (bn(r), P(o) && (a = i.__key, l = o.anchor, i = o.focus, l = l.type === "element" && l.key === a && l.offset === s + 1, a = i.type === "element" && i.key === a && i.offset === s + 1)), s = this.getParentOrThrow().getWritable(), i = r.__key, r.__parent = t.__parent;
|
|
1986
2031
|
let u = s.__children;
|
|
1987
|
-
return t = u.indexOf(t.__key), t === -1 && R(31), u.splice(t + 1, 0, i), vt(r), P(o) && (
|
|
2032
|
+
return t = u.indexOf(t.__key), t === -1 && R(31), u.splice(t + 1, 0, i), vt(r), P(o) && (Xn(o, s, t + 1), r = s.__key, l && o.anchor.set(r, t + 2, "element"), a && o.focus.set(r, t + 2, "element")), e;
|
|
1988
2033
|
}
|
|
1989
2034
|
insertBefore(e) {
|
|
1990
2035
|
var t = this.getWritable(), r = e.getWritable();
|
|
@@ -1992,7 +2037,7 @@ class hr {
|
|
|
1992
2037
|
let i = this.getParentOrThrow().getWritable(), o = r.__key;
|
|
1993
2038
|
r.__parent = t.__parent;
|
|
1994
2039
|
let s = i.__children;
|
|
1995
|
-
return t = s.indexOf(t.__key), t === -1 && R(31), s.splice(t, 0, o), vt(r), r = Y(), P(r) &&
|
|
2040
|
+
return t = s.indexOf(t.__key), t === -1 && R(31), s.splice(t, 0, o), vt(r), r = Y(), P(r) && Xn(r, i, t), e;
|
|
1996
2041
|
}
|
|
1997
2042
|
selectPrevious(e, t) {
|
|
1998
2043
|
_e();
|
|
@@ -2008,7 +2053,7 @@ class hr {
|
|
|
2008
2053
|
this.getWritable();
|
|
2009
2054
|
}
|
|
2010
2055
|
}
|
|
2011
|
-
class
|
|
2056
|
+
class Ws extends _r {
|
|
2012
2057
|
constructor(e) {
|
|
2013
2058
|
super(e);
|
|
2014
2059
|
}
|
|
@@ -2023,9 +2068,9 @@ class Hs extends hr {
|
|
|
2023
2068
|
}
|
|
2024
2069
|
}
|
|
2025
2070
|
function J(n) {
|
|
2026
|
-
return n instanceof
|
|
2071
|
+
return n instanceof Ws;
|
|
2027
2072
|
}
|
|
2028
|
-
class ht extends
|
|
2073
|
+
class ht extends _r {
|
|
2029
2074
|
constructor(e) {
|
|
2030
2075
|
super(e), this.__children = [], this.__indent = this.__format = 0, this.__dir = null;
|
|
2031
2076
|
}
|
|
@@ -2034,7 +2079,7 @@ class ht extends hr {
|
|
|
2034
2079
|
}
|
|
2035
2080
|
getFormatType() {
|
|
2036
2081
|
let e = this.getFormat();
|
|
2037
|
-
return
|
|
2082
|
+
return Ra[e] || "";
|
|
2038
2083
|
}
|
|
2039
2084
|
getIndent() {
|
|
2040
2085
|
return this.getLatest().__indent;
|
|
@@ -2139,7 +2184,7 @@ class ht extends hr {
|
|
|
2139
2184
|
return this.getLatest().__dir;
|
|
2140
2185
|
}
|
|
2141
2186
|
hasFormat(e) {
|
|
2142
|
-
return e !== "" ? (e =
|
|
2187
|
+
return e !== "" ? (e = bi[e], (this.getFormat() & e) !== 0) : !1;
|
|
2143
2188
|
}
|
|
2144
2189
|
select(e, t) {
|
|
2145
2190
|
_e();
|
|
@@ -2148,7 +2193,7 @@ class ht extends hr {
|
|
|
2148
2193
|
if (e === void 0 && (e = i), t === void 0 && (t = i), i = this.__key, P(r))
|
|
2149
2194
|
r.anchor.set(i, e, "element"), r.focus.set(i, t, "element"), r.dirty = !0;
|
|
2150
2195
|
else
|
|
2151
|
-
return
|
|
2196
|
+
return zs(i, e, i, t, "element", "element");
|
|
2152
2197
|
return r;
|
|
2153
2198
|
}
|
|
2154
2199
|
selectStart() {
|
|
@@ -2175,7 +2220,7 @@ class ht extends hr {
|
|
|
2175
2220
|
return t.__dir = e, t;
|
|
2176
2221
|
}
|
|
2177
2222
|
setFormat(e) {
|
|
2178
|
-
return this.getWritable().__format = e !== "" ?
|
|
2223
|
+
return this.getWritable().__format = e !== "" ? bi[e] : 0, this;
|
|
2179
2224
|
}
|
|
2180
2225
|
setIndent(e) {
|
|
2181
2226
|
return this.getWritable().__indent = e, this;
|
|
@@ -2205,7 +2250,7 @@ class ht extends hr {
|
|
|
2205
2250
|
return !1;
|
|
2206
2251
|
};
|
|
2207
2252
|
let { anchor: c, focus: g } = t;
|
|
2208
|
-
for (a(c) &&
|
|
2253
|
+
for (a(c) && Zn(c, c.getNode(), this, r, o), a(g) && Zn(g, g.getNode(), this, r, o), a = e.length, t = 0; t < a; t++)
|
|
2209
2254
|
r = W(e[t]), r != null && (r.getWritable().__parent = null);
|
|
2210
2255
|
s.length !== 0 || this.canBeEmpty() || Ge(this) || this.remove();
|
|
2211
2256
|
}
|
|
@@ -2320,7 +2365,7 @@ class wt extends ht {
|
|
|
2320
2365
|
function Me(n) {
|
|
2321
2366
|
return n instanceof wt;
|
|
2322
2367
|
}
|
|
2323
|
-
function
|
|
2368
|
+
function eu(n, e) {
|
|
2324
2369
|
if (e = e.getEditorState()._selection, n = n._selection, n !== null) {
|
|
2325
2370
|
if (n.dirty || !n.is(e))
|
|
2326
2371
|
return !0;
|
|
@@ -2328,23 +2373,23 @@ function ja(n, e) {
|
|
|
2328
2373
|
return !0;
|
|
2329
2374
|
return !1;
|
|
2330
2375
|
}
|
|
2331
|
-
function
|
|
2332
|
-
return new
|
|
2376
|
+
function Ti() {
|
|
2377
|
+
return new mr(/* @__PURE__ */ new Map([["root", new wt()]]));
|
|
2333
2378
|
}
|
|
2334
|
-
function
|
|
2379
|
+
function Ys(n) {
|
|
2335
2380
|
let e = n.exportJSON();
|
|
2336
2381
|
e.type !== n.constructor.getType() && R(58);
|
|
2337
2382
|
let t = e.children;
|
|
2338
2383
|
if (x(n)) {
|
|
2339
2384
|
Array.isArray(t) || R(59), n = n.getChildren();
|
|
2340
2385
|
for (let r = 0; r < n.length; r++) {
|
|
2341
|
-
let i =
|
|
2386
|
+
let i = Ys(n[r]);
|
|
2342
2387
|
t.push(i);
|
|
2343
2388
|
}
|
|
2344
2389
|
}
|
|
2345
2390
|
return e;
|
|
2346
2391
|
}
|
|
2347
|
-
class
|
|
2392
|
+
class mr {
|
|
2348
2393
|
constructor(e, t) {
|
|
2349
2394
|
this._nodeMap = e, this._selection = t || null, this._readOnly = this._flushSync = !1;
|
|
2350
2395
|
}
|
|
@@ -2352,16 +2397,16 @@ class pr {
|
|
|
2352
2397
|
return this._nodeMap.size === 1 && this._selection === null;
|
|
2353
2398
|
}
|
|
2354
2399
|
read(e) {
|
|
2355
|
-
return
|
|
2400
|
+
return ro(this, e);
|
|
2356
2401
|
}
|
|
2357
2402
|
clone(e) {
|
|
2358
|
-
return e = new
|
|
2403
|
+
return e = new mr(this._nodeMap, e === void 0 ? this._selection : e), e._readOnly = !0, e;
|
|
2359
2404
|
}
|
|
2360
2405
|
toJSON() {
|
|
2361
|
-
return
|
|
2406
|
+
return ro(this, () => ({ root: Ys(Ze()) }));
|
|
2362
2407
|
}
|
|
2363
2408
|
}
|
|
2364
|
-
class Dt extends
|
|
2409
|
+
class Dt extends _r {
|
|
2365
2410
|
static getType() {
|
|
2366
2411
|
return "linebreak";
|
|
2367
2412
|
}
|
|
@@ -2384,7 +2429,7 @@ class Dt extends hr {
|
|
|
2384
2429
|
static importDOM() {
|
|
2385
2430
|
return { br: (e) => {
|
|
2386
2431
|
let t = e.parentElement;
|
|
2387
|
-
return t != null && t.firstChild === e && t.lastChild === e ? null : { conversion:
|
|
2432
|
+
return t != null && t.firstChild === e && t.lastChild === e ? null : { conversion: tu, priority: 0 };
|
|
2388
2433
|
} };
|
|
2389
2434
|
}
|
|
2390
2435
|
static importJSON() {
|
|
@@ -2394,7 +2439,7 @@ class Dt extends hr {
|
|
|
2394
2439
|
return { type: "linebreak", version: 1 };
|
|
2395
2440
|
}
|
|
2396
2441
|
}
|
|
2397
|
-
function
|
|
2442
|
+
function tu() {
|
|
2398
2443
|
return { node: dn() };
|
|
2399
2444
|
}
|
|
2400
2445
|
function dn() {
|
|
@@ -2403,13 +2448,13 @@ function dn() {
|
|
|
2403
2448
|
function cn(n) {
|
|
2404
2449
|
return n instanceof Dt;
|
|
2405
2450
|
}
|
|
2406
|
-
function
|
|
2451
|
+
function Rr(n, e) {
|
|
2407
2452
|
return e & 16 ? "code" : e & 32 ? "sub" : e & 64 ? "sup" : null;
|
|
2408
2453
|
}
|
|
2409
|
-
function
|
|
2454
|
+
function wr(n, e) {
|
|
2410
2455
|
return e & 1 ? "strong" : e & 2 ? "em" : "span";
|
|
2411
2456
|
}
|
|
2412
|
-
function
|
|
2457
|
+
function Dr(n, e, t, r, i) {
|
|
2413
2458
|
n = r.classList, r = Bn(i, "base"), r !== void 0 && n.add(...r), r = Bn(i, "underlineStrikethrough");
|
|
2414
2459
|
let o = !1, s = e & 8 && e & 4;
|
|
2415
2460
|
var l = t & 8 && t & 4;
|
|
@@ -2417,9 +2462,9 @@ function wr(n, e, t, r, i) {
|
|
|
2417
2462
|
for (let a in it)
|
|
2418
2463
|
l = it[a], r = Bn(i, a), r !== void 0 && (t & l ? !o || a !== "underline" && a !== "strikethrough" ? ((e & l) === 0 || s && a === "underline" || a === "strikethrough") && n.add(...r) : e & l && n.remove(...r) : e & l && n.remove(...r));
|
|
2419
2464
|
}
|
|
2420
|
-
function
|
|
2465
|
+
function Lr(n, e, t) {
|
|
2421
2466
|
let r = e.firstChild;
|
|
2422
|
-
if (t = t.isComposing(), n += t ?
|
|
2467
|
+
if (t = t.isComposing(), n += t ? dr : "", r == null)
|
|
2423
2468
|
e.textContent = n;
|
|
2424
2469
|
else if (e = r.nodeValue, e !== n)
|
|
2425
2470
|
if (t || lt) {
|
|
@@ -2435,7 +2480,7 @@ function Dr(n, e, t) {
|
|
|
2435
2480
|
} else
|
|
2436
2481
|
r.nodeValue = n;
|
|
2437
2482
|
}
|
|
2438
|
-
class Lt extends
|
|
2483
|
+
class Lt extends _r {
|
|
2439
2484
|
static getType() {
|
|
2440
2485
|
return "text";
|
|
2441
2486
|
}
|
|
@@ -2453,7 +2498,7 @@ class Lt extends hr {
|
|
|
2453
2498
|
}
|
|
2454
2499
|
getMode() {
|
|
2455
2500
|
let e = this.getLatest();
|
|
2456
|
-
return
|
|
2501
|
+
return Da[e.__mode];
|
|
2457
2502
|
}
|
|
2458
2503
|
getStyle() {
|
|
2459
2504
|
return this.getLatest().__style;
|
|
@@ -2484,23 +2529,23 @@ class Lt extends hr {
|
|
|
2484
2529
|
}
|
|
2485
2530
|
getFormatFlags(e, t) {
|
|
2486
2531
|
let r = this.getLatest().__format;
|
|
2487
|
-
return
|
|
2532
|
+
return _s(r, e, t);
|
|
2488
2533
|
}
|
|
2489
2534
|
createDOM(e) {
|
|
2490
|
-
var t = this.__format, r =
|
|
2491
|
-
let i =
|
|
2492
|
-
return r !== null && (s = document.createElement(i), o.appendChild(s)), r = s,
|
|
2535
|
+
var t = this.__format, r = Rr(this, t);
|
|
2536
|
+
let i = wr(this, t), o = document.createElement(r === null ? i : r), s = o;
|
|
2537
|
+
return r !== null && (s = document.createElement(i), o.appendChild(s)), r = s, Lr(this.__text, r, this), e = e.theme.text, e !== void 0 && Dr(i, 0, t, r, e), t = this.__style, t !== "" && (o.style.cssText = t), o;
|
|
2493
2538
|
}
|
|
2494
2539
|
updateDOM(e, t, r) {
|
|
2495
2540
|
let i = this.__text;
|
|
2496
|
-
var o = e.__format, s = this.__format, l =
|
|
2497
|
-
let a =
|
|
2498
|
-
var u =
|
|
2499
|
-
let d =
|
|
2500
|
-
return (l === null ? u : l) !== (a === null ? d : a) ? !0 : l === a && u !== d ? (o = t.firstChild, o == null && R(48), e = l = document.createElement(d),
|
|
2541
|
+
var o = e.__format, s = this.__format, l = Rr(this, o);
|
|
2542
|
+
let a = Rr(this, s);
|
|
2543
|
+
var u = wr(this, o);
|
|
2544
|
+
let d = wr(this, s);
|
|
2545
|
+
return (l === null ? u : l) !== (a === null ? d : a) ? !0 : l === a && u !== d ? (o = t.firstChild, o == null && R(48), e = l = document.createElement(d), Lr(i, e, this), r = r.theme.text, r !== void 0 && Dr(d, 0, s, e, r), t.replaceChild(l, o), !1) : (u = t, a !== null && l !== null && (u = t.firstChild, u == null && R(49)), Lr(i, u, this), r = r.theme.text, r !== void 0 && o !== s && Dr(d, o, s, u, r), s = this.__style, e.__style !== s && (t.style.cssText = s), !1);
|
|
2501
2546
|
}
|
|
2502
2547
|
static importDOM() {
|
|
2503
|
-
return { "#text": () => ({ conversion:
|
|
2548
|
+
return { "#text": () => ({ conversion: iu, priority: 0 }), b: () => ({ conversion: ru, priority: 0 }), code: () => ({ conversion: zt, priority: 0 }), em: () => ({ conversion: zt, priority: 0 }), i: () => ({ conversion: zt, priority: 0 }), span: () => ({ conversion: nu, priority: 0 }), strong: () => ({ conversion: zt, priority: 0 }), u: () => ({ conversion: zt, priority: 0 }) };
|
|
2504
2549
|
}
|
|
2505
2550
|
static importJSON(e) {
|
|
2506
2551
|
let t = ce(e.text);
|
|
@@ -2517,7 +2562,7 @@ class Lt extends hr {
|
|
|
2517
2562
|
}
|
|
2518
2563
|
setDetail(e) {
|
|
2519
2564
|
let t = this.getWritable();
|
|
2520
|
-
return t.__detail = typeof e == "string" ?
|
|
2565
|
+
return t.__detail = typeof e == "string" ? Aa[e] : e, t;
|
|
2521
2566
|
}
|
|
2522
2567
|
setStyle(e) {
|
|
2523
2568
|
let t = this.getWritable();
|
|
@@ -2535,7 +2580,7 @@ class Lt extends hr {
|
|
|
2535
2580
|
return e.__detail ^= 2, e;
|
|
2536
2581
|
}
|
|
2537
2582
|
setMode(e) {
|
|
2538
|
-
e =
|
|
2583
|
+
e = wa[e];
|
|
2539
2584
|
let t = this.getWritable();
|
|
2540
2585
|
return t.__mode = e, t;
|
|
2541
2586
|
}
|
|
@@ -2551,7 +2596,7 @@ class Lt extends hr {
|
|
|
2551
2596
|
if (typeof i == "string" ? (i = i.length, e === void 0 && (e = i), t === void 0 && (t = i)) : t = e = 0, P(r))
|
|
2552
2597
|
i = Ye(), i !== r.anchor.key && i !== r.focus.key || ie(o), r.setTextNodeRange(this, e, this, t);
|
|
2553
2598
|
else
|
|
2554
|
-
return
|
|
2599
|
+
return zs(o, e, o, t, "text", "text");
|
|
2555
2600
|
return r;
|
|
2556
2601
|
}
|
|
2557
2602
|
spliceText(e, t, r, i) {
|
|
@@ -2590,7 +2635,7 @@ class Lt extends hr {
|
|
|
2590
2635
|
}
|
|
2591
2636
|
o === i && ie(S), d = m, p.__parent = u, a.push(p);
|
|
2592
2637
|
}
|
|
2593
|
-
return vt(this), o = r.getWritable().__children, i = o.indexOf(i), e = a.map((v) => v.__key), l ? (o.splice(i, 0, ...e), this.remove()) : o.splice(i, 1, ...e), P(t) &&
|
|
2638
|
+
return vt(this), o = r.getWritable().__children, i = o.indexOf(i), e = a.map((v) => v.__key), l ? (o.splice(i, 0, ...e), this.remove()) : o.splice(i, 1, ...e), P(t) && Xn(t, r, i, s - 1), a;
|
|
2594
2639
|
}
|
|
2595
2640
|
mergeWithSibling(e) {
|
|
2596
2641
|
var t = e === this.getPreviousSibling();
|
|
@@ -2601,7 +2646,7 @@ class Lt extends hr {
|
|
|
2601
2646
|
let l = Y();
|
|
2602
2647
|
if (P(l)) {
|
|
2603
2648
|
let a = l.anchor, u = l.focus;
|
|
2604
|
-
a !== null && a.key === i && (
|
|
2649
|
+
a !== null && a.key === i && (to(a, t, r, e, s), l.dirty = !0), u !== null && u.key === i && (to(u, t, r, e, s), l.dirty = !0);
|
|
2605
2650
|
}
|
|
2606
2651
|
return r = e.__text, this.setTextContent(t ? r + o : o + r), t = this.getWritable(), e.remove(), t;
|
|
2607
2652
|
}
|
|
@@ -2609,20 +2654,20 @@ class Lt extends hr {
|
|
|
2609
2654
|
return !1;
|
|
2610
2655
|
}
|
|
2611
2656
|
}
|
|
2612
|
-
function
|
|
2657
|
+
function nu(n) {
|
|
2613
2658
|
let e = n.style.fontWeight === "700", t = n.style.textDecoration === "line-through", r = n.style.fontStyle === "italic", i = n.style.textDecoration === "underline", o = n.style.verticalAlign;
|
|
2614
2659
|
return { forChild: (s) => (A(s) && (e && s.toggleFormat("bold"), t && s.toggleFormat("strikethrough"), r && s.toggleFormat("italic"), i && s.toggleFormat("underline"), o === "sub" && s.toggleFormat("subscript"), o === "super" && s.toggleFormat("superscript")), s), node: null };
|
|
2615
2660
|
}
|
|
2616
|
-
function
|
|
2661
|
+
function ru(n) {
|
|
2617
2662
|
let e = n.style.fontWeight === "normal";
|
|
2618
2663
|
return { forChild: (t) => (A(t) && !e && t.toggleFormat("bold"), t), node: null };
|
|
2619
2664
|
}
|
|
2620
|
-
function
|
|
2665
|
+
function iu(n, e, t) {
|
|
2621
2666
|
return n = n.textContent || "", !t && /\n/.test(n) && (n = n.replace(/\r?\n/gm, " "), n.trim().length === 0) ? { node: null } : { node: ce(n) };
|
|
2622
2667
|
}
|
|
2623
|
-
let
|
|
2668
|
+
let ou = { code: "code", em: "italic", i: "italic", strong: "bold", u: "underline" };
|
|
2624
2669
|
function zt(n) {
|
|
2625
|
-
let e =
|
|
2670
|
+
let e = ou[n.nodeName.toLowerCase()];
|
|
2626
2671
|
return e === void 0 ? { node: null } : { forChild: (t) => (A(t) && t.toggleFormat(e), t), node: null };
|
|
2627
2672
|
}
|
|
2628
2673
|
function ce(n = "") {
|
|
@@ -2646,7 +2691,7 @@ class Mt extends ht {
|
|
|
2646
2691
|
return !1;
|
|
2647
2692
|
}
|
|
2648
2693
|
static importDOM() {
|
|
2649
|
-
return { p: () => ({ conversion:
|
|
2694
|
+
return { p: () => ({ conversion: su, priority: 0 }) };
|
|
2650
2695
|
}
|
|
2651
2696
|
exportDOM(e) {
|
|
2652
2697
|
if ({ element: e } = super.exportDOM(e), e && this.isEmpty() && e.append(document.createElement("br")), e) {
|
|
@@ -2677,17 +2722,17 @@ class Mt extends ht {
|
|
|
2677
2722
|
return !1;
|
|
2678
2723
|
}
|
|
2679
2724
|
}
|
|
2680
|
-
function
|
|
2725
|
+
function su() {
|
|
2681
2726
|
return { node: $t() };
|
|
2682
2727
|
}
|
|
2683
2728
|
function $t() {
|
|
2684
2729
|
return new Mt();
|
|
2685
2730
|
}
|
|
2686
|
-
function
|
|
2731
|
+
function Gs(n, e, t, r) {
|
|
2687
2732
|
let i = n._keyToDOMMap;
|
|
2688
|
-
i.clear(), n._editorState =
|
|
2733
|
+
i.clear(), n._editorState = Ti(), n._pendingEditorState = r, n._compositionKey = null, n._dirtyType = 0, n._cloneNotNeeded.clear(), n._dirtyLeaves = /* @__PURE__ */ new Set(), n._dirtyElements.clear(), n._normalizedNodes = /* @__PURE__ */ new Set(), n._updateTags = /* @__PURE__ */ new Set(), n._updates = [], r = n._observer, r !== null && (r.disconnect(), n._observer = null), e !== null && (e.textContent = ""), t !== null && (t.textContent = "", i.set("root", t));
|
|
2689
2734
|
}
|
|
2690
|
-
function
|
|
2735
|
+
function lu(n) {
|
|
2691
2736
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
|
|
2692
2737
|
return n.forEach((r) => {
|
|
2693
2738
|
if (r = r.klass.importDOM != null ? r.klass.importDOM.bind(r.klass) : null, r != null && !t.has(r)) {
|
|
@@ -2700,9 +2745,9 @@ function tu(n) {
|
|
|
2700
2745
|
}
|
|
2701
2746
|
}), e;
|
|
2702
2747
|
}
|
|
2703
|
-
class
|
|
2748
|
+
class au {
|
|
2704
2749
|
constructor(e, t, r, i, o, s) {
|
|
2705
|
-
this._parentEditor = t, this._rootElement = null, this._editorState = e, this._compositionKey = this._pendingEditorState = 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 = i, this._nodes = r, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = 0, 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 =
|
|
2750
|
+
this._parentEditor = t, this._rootElement = null, this._editorState = e, this._compositionKey = this._pendingEditorState = 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 = i, this._nodes = r, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = 0, 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 = Cs(), this._onError = o, this._htmlConversions = s, this._editable = !0, this._headless = !1, this._window = null;
|
|
2706
2751
|
}
|
|
2707
2752
|
isComposing() {
|
|
2708
2753
|
return this._compositionKey != null;
|
|
@@ -2760,7 +2805,7 @@ class nu {
|
|
|
2760
2805
|
let r = this._nodes.get(e);
|
|
2761
2806
|
r === void 0 && R(37);
|
|
2762
2807
|
let i = r.transforms;
|
|
2763
|
-
return i.add(t),
|
|
2808
|
+
return i.add(t), Pa(this, e), () => {
|
|
2764
2809
|
i.delete(t);
|
|
2765
2810
|
};
|
|
2766
2811
|
}
|
|
@@ -2788,20 +2833,20 @@ class nu {
|
|
|
2788
2833
|
let t = this._rootElement;
|
|
2789
2834
|
if (e !== t) {
|
|
2790
2835
|
var r = this._pendingEditorState || this._editorState;
|
|
2791
|
-
if (this._rootElement = e,
|
|
2792
|
-
if (jt !== 0 && (jt--, jt === 0 && t.ownerDocument.removeEventListener("selectionchange",
|
|
2836
|
+
if (this._rootElement = e, Gs(this, t, e, r), t !== null && !this._config.disableEvents) {
|
|
2837
|
+
if (jt !== 0 && (jt--, jt === 0 && t.ownerDocument.removeEventListener("selectionchange", Fs)), r = t.__lexicalEditor, r != null) {
|
|
2793
2838
|
if (r._parentEditor !== null) {
|
|
2794
|
-
var i =
|
|
2839
|
+
var i = mi(r);
|
|
2795
2840
|
i = i[i.length - 1]._key, Ct.get(i) === r && Ct.delete(i);
|
|
2796
2841
|
} else
|
|
2797
2842
|
Ct.delete(r._key);
|
|
2798
2843
|
t.__lexicalEditor = null;
|
|
2799
2844
|
}
|
|
2800
|
-
for (r =
|
|
2845
|
+
for (r = Ps(t), i = 0; i < r.length; i++)
|
|
2801
2846
|
r[i]();
|
|
2802
2847
|
t.__lexicalEventHandles = [];
|
|
2803
2848
|
}
|
|
2804
|
-
e !== null ? (r = (r = e.ownerDocument) && r.defaultView || null, i = e.style, i.userSelect = "text", i.whiteSpace = "pre-wrap", i.wordBreak = "break-word", e.setAttribute("data-lexical-editor", "true"), this._window = r, this._dirtyType = 2,
|
|
2849
|
+
e !== null ? (r = (r = e.ownerDocument) && r.defaultView || null, i = e.style, i.userSelect = "text", i.whiteSpace = "pre-wrap", i.wordBreak = "break-word", e.setAttribute("data-lexical-editor", "true"), this._window = r, this._dirtyType = 2, hs(this), this._updateTags.add("history-merge"), ot(this), this._config.disableEvents || Ja(e, this)) : this._window = null, Xt("root", this, !1, e, t);
|
|
2805
2850
|
}
|
|
2806
2851
|
}
|
|
2807
2852
|
getElementByKey(e) {
|
|
@@ -2811,16 +2856,16 @@ class nu {
|
|
|
2811
2856
|
return this._editorState;
|
|
2812
2857
|
}
|
|
2813
2858
|
setEditorState(e, t) {
|
|
2814
|
-
e.isEmpty() && R(38),
|
|
2859
|
+
e.isEmpty() && R(38), fs(this);
|
|
2815
2860
|
let r = this._pendingEditorState, i = this._updateTags;
|
|
2816
2861
|
t = t !== void 0 ? t.tag : null, r === null || r.isEmpty() || (t != null && i.add(t), ot(this)), this._pendingEditorState = e, this._dirtyType = 2, this._dirtyElements.set("root", !1), this._compositionKey = null, t != null && i.add(t), ot(this);
|
|
2817
2862
|
}
|
|
2818
2863
|
parseEditorState(e, t) {
|
|
2819
2864
|
e = typeof e == "string" ? JSON.parse(e) : e;
|
|
2820
|
-
let r =
|
|
2865
|
+
let r = Ti(), i = ue, o = Z, s = re, l = this._dirtyElements, a = this._dirtyLeaves, u = this._cloneNotNeeded, d = this._dirtyType;
|
|
2821
2866
|
this._dirtyElements = /* @__PURE__ */ new Map(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyType = 0, ue = r, Z = !1, re = this;
|
|
2822
2867
|
try {
|
|
2823
|
-
|
|
2868
|
+
Ei(
|
|
2824
2869
|
e.root,
|
|
2825
2870
|
this._nodes
|
|
2826
2871
|
), t && t(), r._readOnly = !0;
|
|
@@ -2855,7 +2900,7 @@ class nu {
|
|
|
2855
2900
|
return { editorState: this._editorState.toJSON() };
|
|
2856
2901
|
}
|
|
2857
2902
|
}
|
|
2858
|
-
class
|
|
2903
|
+
class Vs extends ht {
|
|
2859
2904
|
constructor(e, t) {
|
|
2860
2905
|
super(t), this.__colSpan = e;
|
|
2861
2906
|
}
|
|
@@ -2863,11 +2908,6 @@ class Ys extends ht {
|
|
|
2863
2908
|
return { ...super.exportJSON(), colSpan: this.__colSpan };
|
|
2864
2909
|
}
|
|
2865
2910
|
}
|
|
2866
|
-
function Gs(n) {
|
|
2867
|
-
return n instanceof Ys;
|
|
2868
|
-
}
|
|
2869
|
-
class Vs extends ht {
|
|
2870
|
-
}
|
|
2871
2911
|
function js(n) {
|
|
2872
2912
|
return n instanceof Vs;
|
|
2873
2913
|
}
|
|
@@ -2876,24 +2916,29 @@ class Js extends ht {
|
|
|
2876
2916
|
function Xs(n) {
|
|
2877
2917
|
return n instanceof Js;
|
|
2878
2918
|
}
|
|
2919
|
+
class Zs extends ht {
|
|
2920
|
+
}
|
|
2921
|
+
function Qs(n) {
|
|
2922
|
+
return n instanceof Zs;
|
|
2923
|
+
}
|
|
2879
2924
|
E.$addUpdateTag = function(n) {
|
|
2880
2925
|
_e(), Q()._updateTags.add(n);
|
|
2881
2926
|
};
|
|
2882
2927
|
E.$createLineBreakNode = dn;
|
|
2883
|
-
E.$createNodeSelection =
|
|
2928
|
+
E.$createNodeSelection = Ks;
|
|
2884
2929
|
E.$createParagraphNode = $t;
|
|
2885
2930
|
E.$createRangeSelection = function() {
|
|
2886
2931
|
let n = new De("root", 0, "element"), e = new De("root", 0, "element");
|
|
2887
2932
|
return new Rt(n, e, 0);
|
|
2888
2933
|
};
|
|
2889
2934
|
E.$createTextNode = ce;
|
|
2890
|
-
E.$getDecoratorNode =
|
|
2935
|
+
E.$getDecoratorNode = xs;
|
|
2891
2936
|
E.$getNearestNodeFromDOMNode = pn;
|
|
2892
2937
|
E.$getNodeByKey = W;
|
|
2893
2938
|
E.$getPreviousSelection = mn;
|
|
2894
2939
|
E.$getRoot = Ze;
|
|
2895
2940
|
E.$getSelection = Y;
|
|
2896
|
-
E.$hasAncestor =
|
|
2941
|
+
E.$hasAncestor = Yr;
|
|
2897
2942
|
E.$insertNodes = function(n, e) {
|
|
2898
2943
|
let t = Y();
|
|
2899
2944
|
return t === null && (t = Ze().selectEnd()), t.insertNodes(n, e);
|
|
@@ -2903,7 +2948,7 @@ E.$isElementNode = x;
|
|
|
2903
2948
|
E.$isInlineElementOrDecoratorNode = function(n) {
|
|
2904
2949
|
return x(n) && n.isInline() || J(n) && n.isInline();
|
|
2905
2950
|
};
|
|
2906
|
-
E.$isLeafNode =
|
|
2951
|
+
E.$isLeafNode = ms;
|
|
2907
2952
|
E.$isLineBreakNode = cn;
|
|
2908
2953
|
E.$isNodeSelection = _n;
|
|
2909
2954
|
E.$isParagraphNode = function(n) {
|
|
@@ -2923,80 +2968,80 @@ E.$nodesOfType = function(n) {
|
|
|
2923
2968
|
return i;
|
|
2924
2969
|
};
|
|
2925
2970
|
E.$parseSerializedNode = function(n) {
|
|
2926
|
-
return
|
|
2971
|
+
return Ei(n, Q()._nodes);
|
|
2927
2972
|
};
|
|
2928
2973
|
E.$setCompositionKey = ie;
|
|
2929
2974
|
E.$setSelection = At;
|
|
2930
|
-
E.BLUR_COMMAND =
|
|
2975
|
+
E.BLUR_COMMAND = ds;
|
|
2931
2976
|
E.CAN_REDO_COMMAND = {};
|
|
2932
2977
|
E.CAN_UNDO_COMMAND = {};
|
|
2933
2978
|
E.CLEAR_EDITOR_COMMAND = {};
|
|
2934
2979
|
E.CLEAR_HISTORY_COMMAND = {};
|
|
2935
|
-
E.CLICK_COMMAND =
|
|
2980
|
+
E.CLICK_COMMAND = Vo;
|
|
2936
2981
|
E.COMMAND_PRIORITY_CRITICAL = 4;
|
|
2937
2982
|
E.COMMAND_PRIORITY_EDITOR = 0;
|
|
2938
2983
|
E.COMMAND_PRIORITY_HIGH = 3;
|
|
2939
2984
|
E.COMMAND_PRIORITY_LOW = 1;
|
|
2940
2985
|
E.COMMAND_PRIORITY_NORMAL = 2;
|
|
2941
2986
|
E.CONTROLLED_TEXT_INSERTION_COMMAND = Nt;
|
|
2942
|
-
E.COPY_COMMAND =
|
|
2943
|
-
E.CUT_COMMAND =
|
|
2987
|
+
E.COPY_COMMAND = hi;
|
|
2988
|
+
E.CUT_COMMAND = pi;
|
|
2944
2989
|
E.DELETE_CHARACTER_COMMAND = tn;
|
|
2945
2990
|
E.DELETE_LINE_COMMAND = rn;
|
|
2946
2991
|
E.DELETE_WORD_COMMAND = nn;
|
|
2947
2992
|
E.DEPRECATED_$createGridSelection = function() {
|
|
2948
2993
|
let n = new De("root", 0, "element"), e = new De("root", 0, "element");
|
|
2949
|
-
return new
|
|
2994
|
+
return new pr("root", n, e);
|
|
2950
2995
|
};
|
|
2951
|
-
E.DEPRECATED_$isGridCellNode =
|
|
2952
|
-
E.DEPRECATED_$isGridNode =
|
|
2953
|
-
E.DEPRECATED_$isGridRowNode =
|
|
2954
|
-
E.DEPRECATED_$isGridSelection =
|
|
2955
|
-
E.DEPRECATED_GridCellNode =
|
|
2956
|
-
E.DEPRECATED_GridNode =
|
|
2957
|
-
E.DEPRECATED_GridRowNode =
|
|
2958
|
-
E.DRAGEND_COMMAND =
|
|
2959
|
-
E.DRAGOVER_COMMAND =
|
|
2960
|
-
E.DRAGSTART_COMMAND =
|
|
2961
|
-
E.DROP_COMMAND =
|
|
2962
|
-
E.DecoratorNode =
|
|
2996
|
+
E.DEPRECATED_$isGridCellNode = js;
|
|
2997
|
+
E.DEPRECATED_$isGridNode = Xs;
|
|
2998
|
+
E.DEPRECATED_$isGridRowNode = Qs;
|
|
2999
|
+
E.DEPRECATED_$isGridSelection = Ci;
|
|
3000
|
+
E.DEPRECATED_GridCellNode = Vs;
|
|
3001
|
+
E.DEPRECATED_GridNode = Js;
|
|
3002
|
+
E.DEPRECATED_GridRowNode = Zs;
|
|
3003
|
+
E.DRAGEND_COMMAND = as;
|
|
3004
|
+
E.DRAGOVER_COMMAND = ls;
|
|
3005
|
+
E.DRAGSTART_COMMAND = ss;
|
|
3006
|
+
E.DROP_COMMAND = os;
|
|
3007
|
+
E.DecoratorNode = Ws;
|
|
2963
3008
|
E.ElementNode = ht;
|
|
2964
|
-
E.FOCUS_COMMAND =
|
|
3009
|
+
E.FOCUS_COMMAND = us;
|
|
2965
3010
|
E.FORMAT_ELEMENT_COMMAND = {};
|
|
2966
3011
|
E.FORMAT_TEXT_COMMAND = We;
|
|
2967
3012
|
E.INDENT_CONTENT_COMMAND = {};
|
|
2968
3013
|
E.INSERT_LINE_BREAK_COMMAND = Vt;
|
|
2969
|
-
E.INSERT_PARAGRAPH_COMMAND =
|
|
2970
|
-
E.KEY_ARROW_DOWN_COMMAND =
|
|
2971
|
-
E.KEY_ARROW_LEFT_COMMAND =
|
|
2972
|
-
E.KEY_ARROW_RIGHT_COMMAND =
|
|
2973
|
-
E.KEY_ARROW_UP_COMMAND =
|
|
2974
|
-
E.KEY_BACKSPACE_COMMAND =
|
|
2975
|
-
E.KEY_DELETE_COMMAND =
|
|
2976
|
-
E.KEY_ENTER_COMMAND =
|
|
2977
|
-
E.KEY_ESCAPE_COMMAND =
|
|
2978
|
-
E.KEY_MODIFIER_COMMAND =
|
|
2979
|
-
E.KEY_SPACE_COMMAND =
|
|
2980
|
-
E.KEY_TAB_COMMAND =
|
|
3014
|
+
E.INSERT_PARAGRAPH_COMMAND = zr;
|
|
3015
|
+
E.KEY_ARROW_DOWN_COMMAND = qo;
|
|
3016
|
+
E.KEY_ARROW_LEFT_COMMAND = Xo;
|
|
3017
|
+
E.KEY_ARROW_RIGHT_COMMAND = jo;
|
|
3018
|
+
E.KEY_ARROW_UP_COMMAND = Qo;
|
|
3019
|
+
E.KEY_BACKSPACE_COMMAND = ts;
|
|
3020
|
+
E.KEY_DELETE_COMMAND = rs;
|
|
3021
|
+
E.KEY_ENTER_COMMAND = Vn;
|
|
3022
|
+
E.KEY_ESCAPE_COMMAND = ns;
|
|
3023
|
+
E.KEY_MODIFIER_COMMAND = cs;
|
|
3024
|
+
E.KEY_SPACE_COMMAND = es;
|
|
3025
|
+
E.KEY_TAB_COMMAND = is;
|
|
2981
3026
|
E.LineBreakNode = Dt;
|
|
2982
|
-
E.MOVE_TO_END =
|
|
2983
|
-
E.MOVE_TO_START =
|
|
3027
|
+
E.MOVE_TO_END = Jo;
|
|
3028
|
+
E.MOVE_TO_START = Zo;
|
|
2984
3029
|
E.OUTDENT_CONTENT_COMMAND = {};
|
|
2985
|
-
E.PASTE_COMMAND =
|
|
3030
|
+
E.PASTE_COMMAND = ci;
|
|
2986
3031
|
E.ParagraphNode = Mt;
|
|
2987
|
-
E.REDO_COMMAND =
|
|
2988
|
-
E.REMOVE_TEXT_COMMAND =
|
|
3032
|
+
E.REDO_COMMAND = fi;
|
|
3033
|
+
E.REMOVE_TEXT_COMMAND = Kr;
|
|
2989
3034
|
E.RootNode = wt;
|
|
2990
|
-
E.SELECTION_CHANGE_COMMAND =
|
|
3035
|
+
E.SELECTION_CHANGE_COMMAND = Go;
|
|
2991
3036
|
E.TextNode = Lt;
|
|
2992
|
-
E.UNDO_COMMAND =
|
|
3037
|
+
E.UNDO_COMMAND = gi;
|
|
2993
3038
|
E.VERSION = "0.4.1";
|
|
2994
3039
|
E.createCommand = function() {
|
|
2995
3040
|
return {};
|
|
2996
3041
|
};
|
|
2997
3042
|
E.createEditor = function(n) {
|
|
2998
3043
|
var e = n || {}, t = re, r = e.theme || {};
|
|
2999
|
-
let i = n === void 0 ? t : e.parentEditor || null, o = e.disableEvents || !1, s =
|
|
3044
|
+
let i = n === void 0 ? t : e.parentEditor || null, o = e.disableEvents || !1, s = Ti(), l = e.namespace || (i !== null ? i._config.namespace : Cs()), a = e.editorState, u = [wt, Lt, Dt, Mt, ...e.nodes || []], d = e.onError;
|
|
3000
3045
|
if (e = e.editable !== void 0 ? e.editable : !0, n === void 0 && t !== null)
|
|
3001
3046
|
n = t._nodes;
|
|
3002
3047
|
else
|
|
@@ -3004,12 +3049,12 @@ E.createEditor = function(n) {
|
|
|
3004
3049
|
let c = u[t], g = c.getType();
|
|
3005
3050
|
n.set(g, { klass: c, transforms: /* @__PURE__ */ new Set() });
|
|
3006
3051
|
}
|
|
3007
|
-
return r = new
|
|
3052
|
+
return r = new au(s, i, n, { disableEvents: o, namespace: l, theme: r }, d || console.error, lu(n), e), a !== void 0 && (r._pendingEditorState = a, r._dirtyType = 2), r;
|
|
3008
3053
|
};
|
|
3009
|
-
const
|
|
3010
|
-
var I =
|
|
3054
|
+
const uu = E;
|
|
3055
|
+
var I = uu, so = ke, Yt = I, Qn = G, du = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? Qn.useLayoutEffect : Qn.useEffect;
|
|
3011
3056
|
let Mn = { tag: "history-merge" };
|
|
3012
|
-
function
|
|
3057
|
+
function cu(n, e) {
|
|
3013
3058
|
if (e !== null) {
|
|
3014
3059
|
if (e === void 0)
|
|
3015
3060
|
n.update(() => {
|
|
@@ -3035,27 +3080,27 @@ function ou(n, e) {
|
|
|
3035
3080
|
}
|
|
3036
3081
|
}
|
|
3037
3082
|
}
|
|
3038
|
-
|
|
3039
|
-
let t =
|
|
3040
|
-
const { theme: r, namespace: i, editor__DEPRECATED: o, nodes: s, onError: l, editorState: a } = n, u =
|
|
3083
|
+
Uo.LexicalComposer = function({ initialConfig: n, children: e }) {
|
|
3084
|
+
let t = Qn.useMemo(() => {
|
|
3085
|
+
const { theme: r, namespace: i, editor__DEPRECATED: o, nodes: s, onError: l, editorState: a } = n, u = so.createLexicalComposerContext(null, r);
|
|
3041
3086
|
let d = o || null;
|
|
3042
3087
|
if (d === null) {
|
|
3043
3088
|
const c = Yt.createEditor({ editable: !1, namespace: i, nodes: s, onError: (g) => l(g, c), theme: r });
|
|
3044
|
-
|
|
3089
|
+
cu(c, a), d = c;
|
|
3045
3090
|
}
|
|
3046
3091
|
return [d, u];
|
|
3047
3092
|
}, []);
|
|
3048
|
-
return
|
|
3093
|
+
return du(() => {
|
|
3049
3094
|
let r = n.editable, [i] = t;
|
|
3050
3095
|
i.setEditable(r !== void 0 ? r : !0);
|
|
3051
|
-
}, []),
|
|
3096
|
+
}, []), Qn.createElement(so.LexicalComposerContext.Provider, { value: t }, e);
|
|
3052
3097
|
};
|
|
3053
|
-
const
|
|
3054
|
-
var
|
|
3055
|
-
function
|
|
3098
|
+
const gu = Uo;
|
|
3099
|
+
var fu = gu, le = {}, Ce = {}, ae = I;
|
|
3100
|
+
function qs(n) {
|
|
3056
3101
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?code=${n} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
3057
3102
|
}
|
|
3058
|
-
function
|
|
3103
|
+
function el(n, e) {
|
|
3059
3104
|
for (; n !== ae.$getRoot() && n != null; ) {
|
|
3060
3105
|
if (e(n))
|
|
3061
3106
|
return n;
|
|
@@ -3063,25 +3108,25 @@ function Qs(n, e) {
|
|
|
3063
3108
|
}
|
|
3064
3109
|
return null;
|
|
3065
3110
|
}
|
|
3066
|
-
function
|
|
3111
|
+
function tl(n, e, t, r, i) {
|
|
3067
3112
|
var o = t._nodes.get(n.__type);
|
|
3068
|
-
o === void 0 &&
|
|
3113
|
+
o === void 0 && qs(5);
|
|
3069
3114
|
for (var s in n) {
|
|
3070
3115
|
var l = n[s];
|
|
3071
3116
|
if (l != null && typeof l == "object" && (l = l.editorState, l != null)) {
|
|
3072
3117
|
var a = ae.createEditor({ namespace: l.namespace });
|
|
3073
|
-
a._nodes = t._nodes, a._parentEditor = t._parentEditor, a._pendingEditorState =
|
|
3118
|
+
a._nodes = t._nodes, a._parentEditor = t._parentEditor, a._pendingEditorState = nl(a, l), n[s] = a;
|
|
3074
3119
|
}
|
|
3075
3120
|
}
|
|
3076
3121
|
if (o = o.klass, s = n.__key, n.__key = void 0, o = o.clone(n), n.__key = s, s = o.__key, i._nodeMap.set(s, o), o.__parent = r, ae.$isElementNode(o)) {
|
|
3077
3122
|
for (r = n.__children, l = 0; l < r.length; l++)
|
|
3078
|
-
a = e.get(r[l]), a !== void 0 && (a =
|
|
3123
|
+
a = e.get(r[l]), a !== void 0 && (a = tl(a, e, t, s, i).__key, o.__children.push(a));
|
|
3079
3124
|
o.__indent = n.__indent, o.__format = n.__format, o.__dir = n.__dir;
|
|
3080
3125
|
} else
|
|
3081
3126
|
ae.$isTextNode(o) && (o.__format = n.__format, o.__style = n.__style, o.__mode = n.__mode, o.__detail = n.__detail);
|
|
3082
3127
|
return o;
|
|
3083
3128
|
}
|
|
3084
|
-
function
|
|
3129
|
+
function hu(n, e) {
|
|
3085
3130
|
let t = e._editorState.constructor, r = /* @__PURE__ */ new Map(), i = new t(r), o = new Map(n._nodeMap), s = o.get("root");
|
|
3086
3131
|
n = e._updating;
|
|
3087
3132
|
try {
|
|
@@ -3089,7 +3134,7 @@ function au(n, e) {
|
|
|
3089
3134
|
let l = e._dirtyElements, a = e._dirtyLeaves, u = e._dirtyType;
|
|
3090
3135
|
e._dirtyElements = /* @__PURE__ */ new Map(), e._dirtyLeaves = /* @__PURE__ */ new Set(), e._dirtyType = 0;
|
|
3091
3136
|
try {
|
|
3092
|
-
|
|
3137
|
+
tl(s, o, e, null, i);
|
|
3093
3138
|
} finally {
|
|
3094
3139
|
e._dirtyElements = l, e._dirtyLeaves = a, e._dirtyType = u;
|
|
3095
3140
|
}
|
|
@@ -3099,8 +3144,8 @@ function au(n, e) {
|
|
|
3099
3144
|
}
|
|
3100
3145
|
return i._readOnly = !0, i;
|
|
3101
3146
|
}
|
|
3102
|
-
function
|
|
3103
|
-
return e = typeof e == "string" ? JSON.parse(e) : e,
|
|
3147
|
+
function nl(n, e) {
|
|
3148
|
+
return e = typeof e == "string" ? JSON.parse(e) : e, hu(e, n);
|
|
3104
3149
|
}
|
|
3105
3150
|
Ce.$dfs = function(n, e) {
|
|
3106
3151
|
let t = [];
|
|
@@ -3115,9 +3160,9 @@ Ce.$dfs = function(n, e) {
|
|
|
3115
3160
|
i = n.getNextSibling(), i === null ? (n = n.getParent(), r--) : n = i;
|
|
3116
3161
|
return n !== null && n.is(e) && t.push({ depth: r, node: n }), t;
|
|
3117
3162
|
};
|
|
3118
|
-
Ce.$findMatchingParent =
|
|
3163
|
+
Ce.$findMatchingParent = el;
|
|
3119
3164
|
Ce.$getNearestBlockElementAncestorOrThrow = function(n) {
|
|
3120
|
-
return n =
|
|
3165
|
+
return n = el(n, (e) => ae.$isElementNode(e) && !e.isInline()), ae.$isElementNode(n) || qs(4), n;
|
|
3121
3166
|
};
|
|
3122
3167
|
Ce.$getNearestNodeOfType = function(n, e) {
|
|
3123
3168
|
for (; n != null; ) {
|
|
@@ -3181,13 +3226,13 @@ Ce.removeClassNamesFromElement = function(n, ...e) {
|
|
|
3181
3226
|
typeof t == "string" && n.classList.remove(...t.split(" "));
|
|
3182
3227
|
});
|
|
3183
3228
|
};
|
|
3184
|
-
Ce.unstable_convertLegacyJSONEditorState =
|
|
3185
|
-
const
|
|
3186
|
-
var Ee =
|
|
3229
|
+
Ce.unstable_convertLegacyJSONEditorState = nl;
|
|
3230
|
+
const pu = Ce;
|
|
3231
|
+
var Ee = pu, z = I, gn = Ee;
|
|
3187
3232
|
function yn(n) {
|
|
3188
3233
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?code=${n} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
3189
3234
|
}
|
|
3190
|
-
function
|
|
3235
|
+
function rl(n) {
|
|
3191
3236
|
let e = 1;
|
|
3192
3237
|
for (n = n.getParent(); n != null; ) {
|
|
3193
3238
|
if (U(n)) {
|
|
@@ -3201,26 +3246,26 @@ function tl(n) {
|
|
|
3201
3246
|
}
|
|
3202
3247
|
return e;
|
|
3203
3248
|
}
|
|
3204
|
-
function
|
|
3249
|
+
function ri(n) {
|
|
3205
3250
|
n = n.getParent(), F(n) || yn(40);
|
|
3206
3251
|
let e = n;
|
|
3207
3252
|
for (; e !== null; )
|
|
3208
3253
|
e = e.getParent(), F(e) && (n = e);
|
|
3209
3254
|
return n;
|
|
3210
3255
|
}
|
|
3211
|
-
function
|
|
3256
|
+
function il(n) {
|
|
3212
3257
|
let e = [];
|
|
3213
3258
|
n = n.getChildren().filter(U);
|
|
3214
3259
|
for (let t = 0; t < n.length; t++) {
|
|
3215
3260
|
let r = n[t], i = r.getFirstChild();
|
|
3216
|
-
F(i) ? e = e.concat(
|
|
3261
|
+
F(i) ? e = e.concat(il(i)) : e.push(r);
|
|
3217
3262
|
}
|
|
3218
3263
|
return e;
|
|
3219
3264
|
}
|
|
3220
3265
|
function _t(n) {
|
|
3221
3266
|
return U(n) && F(n.getFirstChild());
|
|
3222
3267
|
}
|
|
3223
|
-
function
|
|
3268
|
+
function _u(n) {
|
|
3224
3269
|
for (; n.getNextSibling() == null && n.getPreviousSibling() == null; ) {
|
|
3225
3270
|
let e = n.getParent();
|
|
3226
3271
|
if (e == null || !U(n) && !F(n))
|
|
@@ -3229,16 +3274,16 @@ function du(n) {
|
|
|
3229
3274
|
}
|
|
3230
3275
|
n.remove();
|
|
3231
3276
|
}
|
|
3232
|
-
function
|
|
3277
|
+
function lo(n) {
|
|
3233
3278
|
return Se().append(n);
|
|
3234
3279
|
}
|
|
3235
|
-
function
|
|
3280
|
+
function ol(n, e) {
|
|
3236
3281
|
return U(n) && (e.length === 0 || e.length === 1 && n.is(e[0]) && n.getChildrenSize() === 0);
|
|
3237
3282
|
}
|
|
3238
3283
|
function ut(n, e) {
|
|
3239
3284
|
n.splice(n.getChildrenSize(), 0, e);
|
|
3240
3285
|
}
|
|
3241
|
-
function
|
|
3286
|
+
function ao(n, e) {
|
|
3242
3287
|
if (F(n))
|
|
3243
3288
|
return n;
|
|
3244
3289
|
let t = n.getPreviousSibling(), r = n.getNextSibling(), i = Se();
|
|
@@ -3256,7 +3301,7 @@ function me(n, e) {
|
|
|
3256
3301
|
r !== o && t.setValue(o);
|
|
3257
3302
|
});
|
|
3258
3303
|
}
|
|
3259
|
-
function
|
|
3304
|
+
function sl(n) {
|
|
3260
3305
|
let e = /* @__PURE__ */ new Set();
|
|
3261
3306
|
n.forEach((t) => {
|
|
3262
3307
|
if (!_t(t) && !e.has(t.getKey())) {
|
|
@@ -3275,7 +3320,7 @@ function il(n) {
|
|
|
3275
3320
|
}
|
|
3276
3321
|
});
|
|
3277
3322
|
}
|
|
3278
|
-
function
|
|
3323
|
+
function ll(n) {
|
|
3279
3324
|
n.forEach((e) => {
|
|
3280
3325
|
if (!_t(e)) {
|
|
3281
3326
|
var t = e.getParent(), r = t ? t.getParent() : void 0, i = r ? r.getParent() : void 0;
|
|
@@ -3296,7 +3341,7 @@ function ol(n) {
|
|
|
3296
3341
|
}
|
|
3297
3342
|
});
|
|
3298
3343
|
}
|
|
3299
|
-
function
|
|
3344
|
+
function al(n) {
|
|
3300
3345
|
var e = z.$getSelection();
|
|
3301
3346
|
if (z.$isRangeSelection(e)) {
|
|
3302
3347
|
var t = e.getNodes(), r = [];
|
|
@@ -3317,7 +3362,7 @@ function sl(n) {
|
|
|
3317
3362
|
}
|
|
3318
3363
|
r = Array.from(r);
|
|
3319
3364
|
}
|
|
3320
|
-
0 < r.length && (n === "indent" ?
|
|
3365
|
+
0 < r.length && (n === "indent" ? sl(r) : ll(r));
|
|
3321
3366
|
}
|
|
3322
3367
|
}
|
|
3323
3368
|
class dt extends z.ElementNode {
|
|
@@ -3332,15 +3377,15 @@ class dt extends z.ElementNode {
|
|
|
3332
3377
|
}
|
|
3333
3378
|
createDOM(e) {
|
|
3334
3379
|
let t = document.createElement("li"), r = this.getParent();
|
|
3335
|
-
return F(r) && (me(r),
|
|
3380
|
+
return F(r) && (me(r), co(t, this, null, r)), t.value = this.__value, uo(t, e.theme, this), t;
|
|
3336
3381
|
}
|
|
3337
3382
|
updateDOM(e, t, r) {
|
|
3338
3383
|
let i = this.getParent();
|
|
3339
|
-
return F(i) && (me(i),
|
|
3384
|
+
return F(i) && (me(i), co(t, this, e, i)), t.value = this.__value, uo(t, r.theme, this), !1;
|
|
3340
3385
|
}
|
|
3341
3386
|
static importDOM() {
|
|
3342
3387
|
return { li: () => ({
|
|
3343
|
-
conversion:
|
|
3388
|
+
conversion: mu,
|
|
3344
3389
|
priority: 0
|
|
3345
3390
|
}) };
|
|
3346
3391
|
}
|
|
@@ -3445,7 +3490,7 @@ class dt extends z.ElementNode {
|
|
|
3445
3490
|
setIndent(e) {
|
|
3446
3491
|
let t = this.getIndent();
|
|
3447
3492
|
for (; t !== e; )
|
|
3448
|
-
t < e ? (
|
|
3493
|
+
t < e ? (sl([this]), t++) : (ll([this]), t--);
|
|
3449
3494
|
return this;
|
|
3450
3495
|
}
|
|
3451
3496
|
canIndent() {
|
|
@@ -3478,7 +3523,7 @@ class dt extends z.ElementNode {
|
|
|
3478
3523
|
return this.isParentOf(e) && this.isParentOf(r) && this.getTextContent().length === t.getTextContent().length;
|
|
3479
3524
|
}
|
|
3480
3525
|
}
|
|
3481
|
-
function
|
|
3526
|
+
function uo(n, e, t) {
|
|
3482
3527
|
let r = [], i = [];
|
|
3483
3528
|
var o = (e = e.list) ? e.listitem : void 0;
|
|
3484
3529
|
if (e && e.nested)
|
|
@@ -3493,10 +3538,10 @@ function ao(n, e, t) {
|
|
|
3493
3538
|
...r
|
|
3494
3539
|
);
|
|
3495
3540
|
}
|
|
3496
|
-
function
|
|
3541
|
+
function co(n, e, t, r) {
|
|
3497
3542
|
r.getListType() === "check" ? F(e.getFirstChild()) ? (n.removeAttribute("role"), n.removeAttribute("tabIndex"), n.removeAttribute("aria-checked")) : (n.setAttribute("role", "checkbox"), n.setAttribute("tabIndex", "-1"), t && e.__checked === t.__checked || n.setAttribute("aria-checked", e.getChecked() ? "true" : "false")) : e.getChecked() != null && e.setChecked(void 0);
|
|
3498
3543
|
}
|
|
3499
|
-
function
|
|
3544
|
+
function mu() {
|
|
3500
3545
|
return { node: Se() };
|
|
3501
3546
|
}
|
|
3502
3547
|
function Se(n) {
|
|
@@ -3510,10 +3555,10 @@ class Nn extends z.ElementNode {
|
|
|
3510
3555
|
return "list";
|
|
3511
3556
|
}
|
|
3512
3557
|
static clone(e) {
|
|
3513
|
-
return new Nn(e.__listType ||
|
|
3558
|
+
return new Nn(e.__listType || ho[e.__tag], e.__start, e.__key);
|
|
3514
3559
|
}
|
|
3515
3560
|
constructor(e, t, r) {
|
|
3516
|
-
super(r), this.__listType = e =
|
|
3561
|
+
super(r), this.__listType = e = ho[e] || e, this.__tag = e === "number" ? "ol" : "ul", this.__start = t;
|
|
3517
3562
|
}
|
|
3518
3563
|
getTag() {
|
|
3519
3564
|
return this.__tag;
|
|
@@ -3526,13 +3571,13 @@ class Nn extends z.ElementNode {
|
|
|
3526
3571
|
}
|
|
3527
3572
|
createDOM(e) {
|
|
3528
3573
|
let t = document.createElement(this.__tag);
|
|
3529
|
-
return this.__start !== 1 && t.setAttribute("start", String(this.__start)), t.__lexicalListType = this.__listType,
|
|
3574
|
+
return this.__start !== 1 && t.setAttribute("start", String(this.__start)), t.__lexicalListType = this.__listType, go(t, e.theme, this), t;
|
|
3530
3575
|
}
|
|
3531
3576
|
updateDOM(e, t, r) {
|
|
3532
|
-
return e.__tag !== this.__tag ? !0 : (
|
|
3577
|
+
return e.__tag !== this.__tag ? !0 : (go(t, r.theme, this), !1);
|
|
3533
3578
|
}
|
|
3534
3579
|
static importDOM() {
|
|
3535
|
-
return { ol: () => ({ conversion:
|
|
3580
|
+
return { ol: () => ({ conversion: fo, priority: 0 }), ul: () => ({ conversion: fo, priority: 0 }) };
|
|
3536
3581
|
}
|
|
3537
3582
|
static importJSON(e) {
|
|
3538
3583
|
let t = ve(e.listType, e.start);
|
|
@@ -3563,12 +3608,12 @@ class Nn extends z.ElementNode {
|
|
|
3563
3608
|
return U(e);
|
|
3564
3609
|
}
|
|
3565
3610
|
}
|
|
3566
|
-
function
|
|
3611
|
+
function go(n, e, t) {
|
|
3567
3612
|
let r = [], i = [];
|
|
3568
3613
|
var o = e.list;
|
|
3569
3614
|
if (o !== void 0) {
|
|
3570
3615
|
let l = o[`${t.__tag}Depth`] || [];
|
|
3571
|
-
e =
|
|
3616
|
+
e = rl(t) - 1;
|
|
3572
3617
|
let a = e % l.length;
|
|
3573
3618
|
var s = l[a];
|
|
3574
3619
|
let u = o[t.__tag], d;
|
|
@@ -3579,37 +3624,37 @@ function co(n, e, t) {
|
|
|
3579
3624
|
}
|
|
3580
3625
|
0 < i.length && gn.removeClassNamesFromElement(n, ...i), 0 < r.length && gn.addClassNamesToElement(n, ...r);
|
|
3581
3626
|
}
|
|
3582
|
-
function
|
|
3627
|
+
function yu(n) {
|
|
3583
3628
|
let e = [];
|
|
3584
3629
|
for (let t = 0; t < n.length; t++) {
|
|
3585
3630
|
let r = n[t];
|
|
3586
3631
|
U(r) ? (e.push(r), r.getChildren().forEach((i) => {
|
|
3587
|
-
F(i) && e.push(
|
|
3588
|
-
})) : e.push(
|
|
3632
|
+
F(i) && e.push(lo(i));
|
|
3633
|
+
})) : e.push(lo(r));
|
|
3589
3634
|
}
|
|
3590
3635
|
return e;
|
|
3591
3636
|
}
|
|
3592
|
-
function
|
|
3637
|
+
function fo(n) {
|
|
3593
3638
|
n = n.nodeName.toLowerCase();
|
|
3594
3639
|
let e = null;
|
|
3595
|
-
return n === "ol" ? e = ve("number") : n === "ul" && (e = ve("bullet")), { after:
|
|
3640
|
+
return n === "ol" ? e = ve("number") : n === "ul" && (e = ve("bullet")), { after: yu, node: e };
|
|
3596
3641
|
}
|
|
3597
|
-
let
|
|
3642
|
+
let ho = { ol: "number", ul: "bullet" };
|
|
3598
3643
|
function ve(n, e = 1) {
|
|
3599
3644
|
return new Nn(n, e);
|
|
3600
3645
|
}
|
|
3601
3646
|
function F(n) {
|
|
3602
3647
|
return n instanceof Nn;
|
|
3603
3648
|
}
|
|
3604
|
-
let
|
|
3649
|
+
let Nu = z.createCommand(), vu = z.createCommand(), Cu = z.createCommand(), Eu = z.createCommand();
|
|
3605
3650
|
le.$createListItemNode = Se;
|
|
3606
3651
|
le.$createListNode = ve;
|
|
3607
|
-
le.$getListDepth =
|
|
3652
|
+
le.$getListDepth = rl;
|
|
3608
3653
|
le.$handleListInsertParagraph = function() {
|
|
3609
3654
|
var n = z.$getSelection();
|
|
3610
3655
|
if (!z.$isRangeSelection(n) || !n.isCollapsed() || (n = n.anchor.getNode(), !U(n) || n.getTextContent() !== ""))
|
|
3611
3656
|
return !1;
|
|
3612
|
-
var e =
|
|
3657
|
+
var e = ri(n), t = n.getParent();
|
|
3613
3658
|
F(t) || yn(40);
|
|
3614
3659
|
let r = t.getParent(), i;
|
|
3615
3660
|
if (z.$isRootOrShadowRoot(r))
|
|
@@ -3624,18 +3669,18 @@ le.$handleListInsertParagraph = function() {
|
|
|
3624
3669
|
s.remove(), o.append(s);
|
|
3625
3670
|
});
|
|
3626
3671
|
}
|
|
3627
|
-
return
|
|
3672
|
+
return _u(n), !0;
|
|
3628
3673
|
};
|
|
3629
3674
|
le.$isListItemNode = U;
|
|
3630
3675
|
le.$isListNode = F;
|
|
3631
|
-
le.INSERT_CHECK_LIST_COMMAND =
|
|
3632
|
-
le.INSERT_ORDERED_LIST_COMMAND =
|
|
3633
|
-
le.INSERT_UNORDERED_LIST_COMMAND =
|
|
3676
|
+
le.INSERT_CHECK_LIST_COMMAND = Cu;
|
|
3677
|
+
le.INSERT_ORDERED_LIST_COMMAND = vu;
|
|
3678
|
+
le.INSERT_UNORDERED_LIST_COMMAND = Nu;
|
|
3634
3679
|
le.ListItemNode = dt;
|
|
3635
3680
|
le.ListNode = Nn;
|
|
3636
|
-
le.REMOVE_LIST_COMMAND =
|
|
3681
|
+
le.REMOVE_LIST_COMMAND = Eu;
|
|
3637
3682
|
le.indentList = function() {
|
|
3638
|
-
|
|
3683
|
+
al("indent");
|
|
3639
3684
|
};
|
|
3640
3685
|
le.insertList = function(n, e) {
|
|
3641
3686
|
n.update(() => {
|
|
@@ -3644,13 +3689,13 @@ le.insertList = function(n, e) {
|
|
|
3644
3689
|
var r = t.getNodes();
|
|
3645
3690
|
t = t.anchor.getNode();
|
|
3646
3691
|
var i = t.getParent();
|
|
3647
|
-
if (
|
|
3692
|
+
if (ol(t, r))
|
|
3648
3693
|
r = ve(e), z.$isRootOrShadowRoot(i) ? (t.replace(r), i = Se(), z.$isElementNode(t) && (i.setFormat(t.getFormatType()), i.setIndent(t.getIndent())), r.append(i)) : U(t) && (t = t.getParentOrThrow(), ut(r, t.getChildren()), t.replace(r));
|
|
3649
3694
|
else
|
|
3650
3695
|
for (t = /* @__PURE__ */ new Set(), i = 0; i < r.length; i++) {
|
|
3651
3696
|
var o = r[i];
|
|
3652
3697
|
if (z.$isElementNode(o) && o.isEmpty() && !t.has(o.getKey()))
|
|
3653
|
-
|
|
3698
|
+
ao(o, e);
|
|
3654
3699
|
else if (z.$isLeafNode(o))
|
|
3655
3700
|
for (o = o.getParent(); o != null; ) {
|
|
3656
3701
|
let l = o.getKey();
|
|
@@ -3662,7 +3707,7 @@ le.insertList = function(n, e) {
|
|
|
3662
3707
|
break;
|
|
3663
3708
|
} else {
|
|
3664
3709
|
if (s = o.getParent(), z.$isRootOrShadowRoot(s) && !t.has(l)) {
|
|
3665
|
-
t.add(l),
|
|
3710
|
+
t.add(l), ao(o, e);
|
|
3666
3711
|
break;
|
|
3667
3712
|
}
|
|
3668
3713
|
o = s;
|
|
@@ -3673,22 +3718,22 @@ le.insertList = function(n, e) {
|
|
|
3673
3718
|
});
|
|
3674
3719
|
};
|
|
3675
3720
|
le.outdentList = function() {
|
|
3676
|
-
|
|
3721
|
+
al("outdent");
|
|
3677
3722
|
};
|
|
3678
3723
|
le.removeList = function(n) {
|
|
3679
3724
|
n.update(() => {
|
|
3680
3725
|
let e = z.$getSelection();
|
|
3681
3726
|
if (z.$isRangeSelection(e)) {
|
|
3682
3727
|
var t = /* @__PURE__ */ new Set(), r = e.getNodes(), i = e.anchor.getNode();
|
|
3683
|
-
if (
|
|
3684
|
-
t.add(
|
|
3728
|
+
if (ol(i, r))
|
|
3729
|
+
t.add(ri(i));
|
|
3685
3730
|
else
|
|
3686
3731
|
for (i = 0; i < r.length; i++) {
|
|
3687
3732
|
var o = r[i];
|
|
3688
|
-
z.$isLeafNode(o) && (o = gn.$getNearestNodeOfType(o, dt), o != null && t.add(
|
|
3733
|
+
z.$isLeafNode(o) && (o = gn.$getNearestNodeOfType(o, dt), o != null && t.add(ri(o)));
|
|
3689
3734
|
}
|
|
3690
3735
|
for (let s of t) {
|
|
3691
|
-
t = s, r =
|
|
3736
|
+
t = s, r = il(s);
|
|
3692
3737
|
for (let l of r)
|
|
3693
3738
|
r = z.$createParagraphNode(), ut(r, l.getChildren()), t.insertAfter(r), t = r, l.__key === e.anchor.key && e.anchor.set(r.getKey(), 0, "element"), l.__key === e.focus.key && e.focus.set(r.getKey(), 0, "element"), l.remove();
|
|
3694
3739
|
s.remove();
|
|
@@ -3696,15 +3741,15 @@ le.removeList = function(n) {
|
|
|
3696
3741
|
}
|
|
3697
3742
|
});
|
|
3698
3743
|
};
|
|
3699
|
-
const
|
|
3700
|
-
var ct =
|
|
3701
|
-
let
|
|
3702
|
-
function
|
|
3744
|
+
const Tu = le;
|
|
3745
|
+
var ct = Tu, Qe = {}, qe = {}, xi = {}, q = {}, L = I;
|
|
3746
|
+
let qn = /* @__PURE__ */ new Map();
|
|
3747
|
+
function er(n) {
|
|
3703
3748
|
n = n.getLatest();
|
|
3704
3749
|
let e = n.constructor.clone(n);
|
|
3705
3750
|
return e.__parent = n.__parent, L.$isElementNode(n) && L.$isElementNode(e) ? (e.__children = Array.from(n.__children), e.__format = n.__format, e.__indent = n.__indent, e.__dir = n.__dir) : L.$isTextNode(n) && L.$isTextNode(e) && (e.__format = n.__format, e.__style = n.__style, e.__mode = n.__mode, e.__detail = n.__detail), e;
|
|
3706
3751
|
}
|
|
3707
|
-
function
|
|
3752
|
+
function po(n, e, t, r, i, o) {
|
|
3708
3753
|
for (var s = e; n !== null; ) {
|
|
3709
3754
|
for (e = n.getParent(); e !== null && e.excludeFromCopy("clone"); )
|
|
3710
3755
|
e = e.getParent();
|
|
@@ -3712,7 +3757,7 @@ function ho(n, e, t, r, i, o) {
|
|
|
3712
3757
|
break;
|
|
3713
3758
|
if (!L.$isElementNode(n) || !n.excludeFromCopy("clone")) {
|
|
3714
3759
|
let l = n.getKey(), a = o.get(l), u = a === void 0;
|
|
3715
|
-
if (u && (a =
|
|
3760
|
+
if (u && (a = er(n), o.set(l, a)), !L.$isTextNode(a) || a.isSegmented() || a.isToken() ? L.$isElementNode(a) && (a.__children = a.__children.slice(r ? s : 0, r ? void 0 : (s || 0) + 1)) : a.__text = a.__text.slice(r ? s : 0, r ? t : s), L.$isRootNode(e)) {
|
|
3716
3761
|
u && i.push(l);
|
|
3717
3762
|
break;
|
|
3718
3763
|
}
|
|
@@ -3720,7 +3765,7 @@ function ho(n, e, t, r, i, o) {
|
|
|
3720
3765
|
s = o.get(e.getKey()), s = L.$isElementNode(s) ? s.__children.indexOf(n.getKey()) : n.getIndexWithinParent(), n = e;
|
|
3721
3766
|
}
|
|
3722
3767
|
}
|
|
3723
|
-
function
|
|
3768
|
+
function xu(n) {
|
|
3724
3769
|
if (L.$isRangeSelection(n)) {
|
|
3725
3770
|
var e = n.anchor, t = n.focus;
|
|
3726
3771
|
let [a, u] = n.getCharacterOffsets();
|
|
@@ -3739,28 +3784,28 @@ function yu(n) {
|
|
|
3739
3784
|
s && (d++, n.push(i));
|
|
3740
3785
|
}
|
|
3741
3786
|
}
|
|
3742
|
-
for (i = n[d - 1], e = e.isBefore(t), t = /* @__PURE__ */ new Map(), o = [], s = L.$isTextNode(r) && d === 1,
|
|
3787
|
+
for (i = n[d - 1], e = e.isBefore(t), t = /* @__PURE__ */ new Map(), o = [], s = L.$isTextNode(r) && d === 1, po(r, e ? a : u, s ? e ? u : a : void 0, !0, o, t), r = 0; r < d; r++) {
|
|
3743
3788
|
l = n[r];
|
|
3744
3789
|
let c = l.getKey();
|
|
3745
3790
|
if (!(t.has(c) || L.$isElementNode(l) && l.excludeFromCopy("clone"))) {
|
|
3746
|
-
let g =
|
|
3791
|
+
let g = er(l);
|
|
3747
3792
|
L.$isRootNode(l.getParent()) && o.push(l.getKey()), c !== "root" && t.set(c, g);
|
|
3748
3793
|
}
|
|
3749
3794
|
}
|
|
3750
|
-
return
|
|
3795
|
+
return po(i, s ? void 0 : e ? u : a, void 0, !1, o, t), { nodeMap: Array.from(t.entries()), range: o };
|
|
3751
3796
|
}
|
|
3752
3797
|
if (L.DEPRECATED_$isGridSelection(n))
|
|
3753
3798
|
return { nodeMap: n.getNodes().map((a) => {
|
|
3754
3799
|
const u = a.getKey();
|
|
3755
|
-
return a =
|
|
3800
|
+
return a = er(a), [u, a];
|
|
3756
3801
|
}), range: [n.gridKey] };
|
|
3757
3802
|
throw Error("Minified Lexical error #1; visit https://lexical.dev/docs/error?code=1 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");
|
|
3758
3803
|
}
|
|
3759
|
-
function
|
|
3760
|
-
let e =
|
|
3761
|
-
return e === void 0 && (e =
|
|
3804
|
+
function Si(n) {
|
|
3805
|
+
let e = qn.get(n);
|
|
3806
|
+
return e === void 0 && (e = ul(n), qn.set(n, e)), e;
|
|
3762
3807
|
}
|
|
3763
|
-
function
|
|
3808
|
+
function ul(n) {
|
|
3764
3809
|
let e = {};
|
|
3765
3810
|
n = n.split(";");
|
|
3766
3811
|
for (let t of n)
|
|
@@ -3771,20 +3816,20 @@ function ll(n) {
|
|
|
3771
3816
|
return e;
|
|
3772
3817
|
}
|
|
3773
3818
|
function Kt(n, e) {
|
|
3774
|
-
var t =
|
|
3819
|
+
var t = Si(n.getStyle());
|
|
3775
3820
|
e = t ? { ...t, ...e } : e, t = "";
|
|
3776
3821
|
for (r in e)
|
|
3777
3822
|
r && (t += `${r}: ${e[r]};`);
|
|
3778
3823
|
var r = t;
|
|
3779
|
-
n.setStyle(r),
|
|
3824
|
+
n.setStyle(r), qn.set(r, e);
|
|
3780
3825
|
}
|
|
3781
|
-
function
|
|
3826
|
+
function dl(n, e, t, r) {
|
|
3782
3827
|
n.modify(e ? "extend" : "move", t, r);
|
|
3783
3828
|
}
|
|
3784
|
-
function
|
|
3829
|
+
function cl(n) {
|
|
3785
3830
|
return n = n.anchor.getNode(), (L.$isRootNode(n) ? n : n.getParentOrThrow()).getDirection() === "rtl";
|
|
3786
3831
|
}
|
|
3787
|
-
function
|
|
3832
|
+
function Su(n) {
|
|
3788
3833
|
for (; n !== null && !L.$isRootOrShadowRoot(n); ) {
|
|
3789
3834
|
let e = n.getLatest(), t = n.getParent();
|
|
3790
3835
|
e.__children.length === 0 && n.remove(!0), n = t;
|
|
@@ -3817,7 +3862,7 @@ function Wn(n, e, t, r, i = null) {
|
|
|
3817
3862
|
let p = r();
|
|
3818
3863
|
p.setFormat(f.getFormatType()), p.setIndent(f.getIndent()), l.push(p), s.set(c, p), f.getChildren().forEach((m) => {
|
|
3819
3864
|
p.append(m), g.add(m.getKey());
|
|
3820
|
-
}),
|
|
3865
|
+
}), Su(f);
|
|
3821
3866
|
}
|
|
3822
3867
|
} else
|
|
3823
3868
|
u.has(c.getKey()) && (f = r(), f.setFormat(c.getFormatType()), f.setIndent(c.getIndent()), l.push(f), c.remove(!0));
|
|
@@ -3851,7 +3896,7 @@ function Wn(n, e, t, r, i = null) {
|
|
|
3851
3896
|
l = L.$getPreviousSelection(), L.$isRangeSelection(l) && l.anchor.getNode().isAttached() && l.focus.getNode().isAttached() ? L.$setSelection(l.clone()) : n.dirty = !0;
|
|
3852
3897
|
}
|
|
3853
3898
|
}
|
|
3854
|
-
function
|
|
3899
|
+
function _o(n) {
|
|
3855
3900
|
for (; n != null; ) {
|
|
3856
3901
|
if (n.nodeType === Node.TEXT_NODE)
|
|
3857
3902
|
return n;
|
|
@@ -3859,7 +3904,7 @@ function po(n) {
|
|
|
3859
3904
|
}
|
|
3860
3905
|
return null;
|
|
3861
3906
|
}
|
|
3862
|
-
function
|
|
3907
|
+
function mo(n) {
|
|
3863
3908
|
let e = n.parentNode;
|
|
3864
3909
|
if (e == null)
|
|
3865
3910
|
throw Error("Should never happen");
|
|
@@ -3867,13 +3912,13 @@ function _o(n) {
|
|
|
3867
3912
|
}
|
|
3868
3913
|
q.$addNodeStyle = function(n) {
|
|
3869
3914
|
n = n.getStyle();
|
|
3870
|
-
let e =
|
|
3871
|
-
|
|
3915
|
+
let e = ul(n);
|
|
3916
|
+
qn.set(n, e);
|
|
3872
3917
|
};
|
|
3873
3918
|
q.$cloneContents = function(n) {
|
|
3874
|
-
return
|
|
3919
|
+
return xu(n);
|
|
3875
3920
|
};
|
|
3876
|
-
q.$cloneWithProperties =
|
|
3921
|
+
q.$cloneWithProperties = er;
|
|
3877
3922
|
q.$getSelectionStyleValueForProperty = function(n, e, t = "") {
|
|
3878
3923
|
let r = null, i = n.getNodes();
|
|
3879
3924
|
var o = n.anchor, s = n.focus, l = n.isBackward();
|
|
@@ -3882,7 +3927,7 @@ q.$getSelectionStyleValueForProperty = function(n, e, t = "") {
|
|
|
3882
3927
|
if ((s === 0 || n !== 0 || !a.is(o)) && L.$isTextNode(a)) {
|
|
3883
3928
|
l = e;
|
|
3884
3929
|
var u = t;
|
|
3885
|
-
if (a = a.getStyle(), a =
|
|
3930
|
+
if (a = a.getStyle(), a = Si(a), l = a !== null && a[l] || u, r === null)
|
|
3886
3931
|
r = l;
|
|
3887
3932
|
else if (r !== l) {
|
|
3888
3933
|
r = "";
|
|
@@ -3895,11 +3940,11 @@ q.$getSelectionStyleValueForProperty = function(n, e, t = "") {
|
|
|
3895
3940
|
q.$isAtNodeEnd = function(n) {
|
|
3896
3941
|
return n.type === "text" ? n.offset === n.getNode().getTextContentSize() : n.offset === n.getNode().getChildrenSize();
|
|
3897
3942
|
};
|
|
3898
|
-
q.$isParentElementRTL =
|
|
3899
|
-
q.$moveCaretSelection =
|
|
3943
|
+
q.$isParentElementRTL = cl;
|
|
3944
|
+
q.$moveCaretSelection = dl;
|
|
3900
3945
|
q.$moveCharacter = function(n, e, t) {
|
|
3901
|
-
let r =
|
|
3902
|
-
|
|
3946
|
+
let r = cl(n);
|
|
3947
|
+
dl(n, e, t ? !r : r, "character");
|
|
3903
3948
|
};
|
|
3904
3949
|
q.$patchStyleText = function(n, e) {
|
|
3905
3950
|
var t = n.getNodes();
|
|
@@ -3968,9 +4013,9 @@ q.$wrapNodes = function(n, e, t = null) {
|
|
|
3968
4013
|
q.$wrapNodesImpl = Wn;
|
|
3969
4014
|
q.createDOMRange = function(n, e, t, r, i) {
|
|
3970
4015
|
let o = e.getKey(), s = r.getKey(), l = document.createRange(), a = n.getElementByKey(o);
|
|
3971
|
-
if (n = n.getElementByKey(s), L.$isTextNode(e) && (a =
|
|
4016
|
+
if (n = n.getElementByKey(s), L.$isTextNode(e) && (a = _o(a)), L.$isTextNode(r) && (n = _o(n)), e === void 0 || r === void 0 || a === null || n === null)
|
|
3972
4017
|
return null;
|
|
3973
|
-
a.nodeName === "BR" && ([a, t] =
|
|
4018
|
+
a.nodeName === "BR" && ([a, t] = mo(a)), n.nodeName === "BR" && ([n, i] = mo(n)), e = a.firstChild, a === n && e != null && e.nodeName === "BR" && t === 0 && i === 0 && (i = 1);
|
|
3974
4019
|
try {
|
|
3975
4020
|
l.setStart(a, t), l.setEnd(n, i);
|
|
3976
4021
|
} catch {
|
|
@@ -3993,7 +4038,7 @@ q.createRectsFromDOMRange = function(n, e) {
|
|
|
3993
4038
|
}
|
|
3994
4039
|
return e;
|
|
3995
4040
|
};
|
|
3996
|
-
q.getStyleObjectFromCSS =
|
|
4041
|
+
q.getStyleObjectFromCSS = Si;
|
|
3997
4042
|
q.trimTextContentFromAnchor = function(n, e, t) {
|
|
3998
4043
|
let r = e.getNode();
|
|
3999
4044
|
if (L.$isElementNode(r)) {
|
|
@@ -4029,18 +4074,18 @@ q.trimTextContentFromAnchor = function(n, e, t) {
|
|
|
4029
4074
|
}
|
|
4030
4075
|
}
|
|
4031
4076
|
};
|
|
4032
|
-
const
|
|
4033
|
-
var we =
|
|
4034
|
-
function
|
|
4077
|
+
const $u = q;
|
|
4078
|
+
var we = $u, yo = we, yt = I;
|
|
4079
|
+
function gl(n, e, t, r = null) {
|
|
4035
4080
|
let i = r != null ? e.isSelected() : !0, o = yt.$isElementNode(e) && e.excludeFromCopy("html");
|
|
4036
4081
|
var s = e;
|
|
4037
|
-
r !== null && (s =
|
|
4082
|
+
r !== null && (s = yo.$cloneWithProperties(e), s = yt.$isTextNode(s) && r != null ? yo.$sliceSelectedTextNodeContent(r, s) : s);
|
|
4038
4083
|
let l = yt.$isElementNode(s) ? s.getChildren() : [], { element: a, after: u } = s.exportDOM(n);
|
|
4039
4084
|
if (!a)
|
|
4040
4085
|
return !1;
|
|
4041
4086
|
let d = new DocumentFragment();
|
|
4042
4087
|
for (let c = 0; c < l.length; c++) {
|
|
4043
|
-
let g = l[c], f =
|
|
4088
|
+
let g = l[c], f = gl(n, g, d, r);
|
|
4044
4089
|
!i && yt.$isElementNode(e) && f && e.extractWithChild(g, r, "html") && (i = !0);
|
|
4045
4090
|
}
|
|
4046
4091
|
return i && !o ? (a.append(d), t.append(a), u && (n = u.call(
|
|
@@ -4048,10 +4093,10 @@ function dl(n, e, t, r = null) {
|
|
|
4048
4093
|
a
|
|
4049
4094
|
)) && a.replaceWith(n)) : t.append(d), i;
|
|
4050
4095
|
}
|
|
4051
|
-
let
|
|
4052
|
-
function
|
|
4096
|
+
let fl = /* @__PURE__ */ new Set(["STYLE"]);
|
|
4097
|
+
function hl(n, e, t = /* @__PURE__ */ new Map(), r, i = !1) {
|
|
4053
4098
|
let o = [];
|
|
4054
|
-
if (
|
|
4099
|
+
if (fl.has(n.nodeName))
|
|
4055
4100
|
return o;
|
|
4056
4101
|
let s = null;
|
|
4057
4102
|
var { nodeName: l } = n, a = e._htmlConversions.get(l.toLowerCase());
|
|
@@ -4069,7 +4114,7 @@ function gl(n, e, t = /* @__PURE__ */ new Map(), r, i = !1) {
|
|
|
4069
4114
|
u.forChild != null && t.set(n.nodeName, u.forChild);
|
|
4070
4115
|
}
|
|
4071
4116
|
for (n = n.childNodes, r = [], d = 0; d < n.length; d++)
|
|
4072
|
-
r.push(...
|
|
4117
|
+
r.push(...hl(
|
|
4073
4118
|
n[d],
|
|
4074
4119
|
e,
|
|
4075
4120
|
new Map(t),
|
|
@@ -4078,41 +4123,41 @@ function gl(n, e, t = /* @__PURE__ */ new Map(), r, i = !1) {
|
|
|
4078
4123
|
));
|
|
4079
4124
|
return l != null && (r = l(r)), s == null ? o = o.concat(r) : yt.$isElementNode(s) && s.append(...r), o;
|
|
4080
4125
|
}
|
|
4081
|
-
|
|
4126
|
+
xi.$generateHtmlFromNodes = function(n, e) {
|
|
4082
4127
|
if (document == null || window == null)
|
|
4083
4128
|
throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
|
|
4084
4129
|
let t = document.createElement("div"), r = yt.$getRoot().getChildren();
|
|
4085
4130
|
for (let i = 0; i < r.length; i++)
|
|
4086
|
-
|
|
4131
|
+
gl(n, r[i], t, e);
|
|
4087
4132
|
return t.innerHTML;
|
|
4088
4133
|
};
|
|
4089
|
-
|
|
4134
|
+
xi.$generateNodesFromDOM = function(n, e) {
|
|
4090
4135
|
let t = [];
|
|
4091
4136
|
e = e.body ? Array.from(e.body.childNodes) : [];
|
|
4092
4137
|
let r = e.length;
|
|
4093
4138
|
for (let o = 0; o < r; o++) {
|
|
4094
4139
|
var i = e[o];
|
|
4095
|
-
|
|
4140
|
+
fl.has(i.nodeName) || (i = hl(i, n), i !== null && (t = t.concat(i)));
|
|
4096
4141
|
}
|
|
4097
4142
|
return t;
|
|
4098
4143
|
};
|
|
4099
|
-
const
|
|
4100
|
-
var
|
|
4144
|
+
const Ou = xi;
|
|
4145
|
+
var Au = Ou, pl = Au, No = ct, ii = we, Zt = Ee, k = I;
|
|
4101
4146
|
function be(n) {
|
|
4102
4147
|
throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?code=${n} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
4103
4148
|
}
|
|
4104
|
-
function
|
|
4105
|
-
(k.DEPRECATED_$isGridSelection(t) || Zt.$findMatchingParent(t.anchor.getNode(), (r) => k.DEPRECATED_$isGridCellNode(r)) !== null && Zt.$findMatchingParent(t.focus.getNode(), (r) => k.DEPRECATED_$isGridCellNode(r)) !== null) && e.length === 1 && k.DEPRECATED_$isGridNode(e[0]) ?
|
|
4149
|
+
function oi(n, e, t) {
|
|
4150
|
+
(k.DEPRECATED_$isGridSelection(t) || Zt.$findMatchingParent(t.anchor.getNode(), (r) => k.DEPRECATED_$isGridCellNode(r)) !== null && Zt.$findMatchingParent(t.focus.getNode(), (r) => k.DEPRECATED_$isGridCellNode(r)) !== null) && e.length === 1 && k.DEPRECATED_$isGridNode(e[0]) ? wu(e, t, !1, n) : Ru(e, t);
|
|
4106
4151
|
}
|
|
4107
|
-
function
|
|
4152
|
+
function Ru(n, e) {
|
|
4108
4153
|
let t = [], r = null, i = null;
|
|
4109
4154
|
for (let o = 0; o < n.length; o++) {
|
|
4110
4155
|
let s = n[o];
|
|
4111
|
-
|
|
4156
|
+
No.$isListItemNode(s) ? (i == null && (i = No.$createListNode("bullet"), t.push(i)), i.append(s)) : (i != null && (i = null), k.$isDecoratorNode(s) && s.isInline() || k.$isElementNode(s) && s.isInline() || k.$isTextNode(s) || k.$isLineBreakNode(s) ? (r === null && (r = k.$createParagraphNode(), t.push(r)), r !== null && r.append(s)) : (t.push(s), r = null));
|
|
4112
4157
|
}
|
|
4113
4158
|
k.$isRangeSelection(e) ? e.insertNodes(t) : k.DEPRECATED_$isGridSelection(e) && (n = e.anchor.getNode(), k.DEPRECATED_$isGridCellNode(n) || be(41), n.append(...t));
|
|
4114
4159
|
}
|
|
4115
|
-
function
|
|
4160
|
+
function wu(n, e, t, r) {
|
|
4116
4161
|
n.length === 1 && k.DEPRECATED_$isGridNode(n[0]) || be(42);
|
|
4117
4162
|
var i = n[0];
|
|
4118
4163
|
n = i.getChildren(), t = i.getFirstChildOrThrow().getChildrenSize();
|
|
@@ -4141,19 +4186,19 @@ function xu(n, e, t, r) {
|
|
|
4141
4186
|
}
|
|
4142
4187
|
u && d && (n = k.DEPRECATED_$createGridSelection(), n.set(e.getKey(), u, d), k.$setSelection(n), r.dispatchCommand(k.SELECTION_CHANGE_COMMAND, void 0));
|
|
4143
4188
|
}
|
|
4144
|
-
function
|
|
4189
|
+
function _l(n, e, t, r = []) {
|
|
4145
4190
|
let i = e != null ? t.isSelected() : !0, o = k.$isElementNode(t) && t.excludeFromCopy("html");
|
|
4146
4191
|
var s = t;
|
|
4147
4192
|
if (e !== null) {
|
|
4148
|
-
var l =
|
|
4149
|
-
s = l = k.$isTextNode(l) && e != null ?
|
|
4193
|
+
var l = ii.$cloneWithProperties(t);
|
|
4194
|
+
s = l = k.$isTextNode(l) && e != null ? ii.$sliceSelectedTextNodeContent(e, l) : l;
|
|
4150
4195
|
}
|
|
4151
4196
|
let a = k.$isElementNode(s) ? s.getChildren() : [];
|
|
4152
4197
|
var u = s;
|
|
4153
4198
|
l = u.exportJSON(), l.type !== u.constructor.getType() && be(58);
|
|
4154
4199
|
var d = l.children;
|
|
4155
4200
|
for (k.$isElementNode(u) && (Array.isArray(d) || be(59)), k.$isTextNode(s) && (l.text = s.__text), s = 0; s < a.length; s++)
|
|
4156
|
-
u = a[s], d =
|
|
4201
|
+
u = a[s], d = _l(n, e, u, l.children), !i && k.$isElementNode(t) && d && t.extractWithChild(u, e, "clone") && (i = !0);
|
|
4157
4202
|
if (i && !o)
|
|
4158
4203
|
r.push(l);
|
|
4159
4204
|
else if (Array.isArray(l.children))
|
|
@@ -4161,33 +4206,33 @@ function hl(n, e, t, r = []) {
|
|
|
4161
4206
|
r.push(l.children[n]);
|
|
4162
4207
|
return i;
|
|
4163
4208
|
}
|
|
4164
|
-
function
|
|
4209
|
+
function ml(n, e) {
|
|
4165
4210
|
let t = [], r = k.$getRoot().getChildren();
|
|
4166
4211
|
for (let i = 0; i < r.length; i++)
|
|
4167
|
-
|
|
4212
|
+
_l(n, e, r[i], t);
|
|
4168
4213
|
return { namespace: n._config.namespace, nodes: t };
|
|
4169
4214
|
}
|
|
4170
|
-
function
|
|
4215
|
+
function yl(n) {
|
|
4171
4216
|
let e = [];
|
|
4172
4217
|
for (let t = 0; t < n.length; t++) {
|
|
4173
4218
|
let r = k.$parseSerializedNode(n[t]);
|
|
4174
|
-
k.$isTextNode(r) &&
|
|
4219
|
+
k.$isTextNode(r) && ii.$addNodeStyle(r), e.push(r);
|
|
4175
4220
|
}
|
|
4176
4221
|
return e;
|
|
4177
4222
|
}
|
|
4178
|
-
qe.$generateJSONFromSelectedNodes =
|
|
4179
|
-
qe.$generateNodesFromSerializedNodes =
|
|
4223
|
+
qe.$generateJSONFromSelectedNodes = ml;
|
|
4224
|
+
qe.$generateNodesFromSerializedNodes = yl;
|
|
4180
4225
|
qe.$getHtmlContent = function(n) {
|
|
4181
4226
|
let e = k.$getSelection();
|
|
4182
4227
|
if (e == null)
|
|
4183
4228
|
throw Error("Expected valid LexicalSelection");
|
|
4184
|
-
return k.$isRangeSelection(e) && e.isCollapsed() || e.getNodes().length === 0 ? null :
|
|
4229
|
+
return k.$isRangeSelection(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : pl.$generateHtmlFromNodes(n, e);
|
|
4185
4230
|
};
|
|
4186
4231
|
qe.$getLexicalContent = function(n) {
|
|
4187
4232
|
let e = k.$getSelection();
|
|
4188
4233
|
if (e == null)
|
|
4189
4234
|
throw Error("Expected valid LexicalSelection");
|
|
4190
|
-
return k.$isRangeSelection(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(
|
|
4235
|
+
return k.$isRangeSelection(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(ml(n, e));
|
|
4191
4236
|
};
|
|
4192
4237
|
qe.$insertDataTransferForPlainText = function(n, e) {
|
|
4193
4238
|
n = n.getData("text/plain"), n != null && e.insertRawText(n);
|
|
@@ -4198,16 +4243,16 @@ qe.$insertDataTransferForRichText = function(n, e, t) {
|
|
|
4198
4243
|
try {
|
|
4199
4244
|
let o = JSON.parse(r);
|
|
4200
4245
|
if (o.namespace === t._config.namespace && Array.isArray(o.nodes)) {
|
|
4201
|
-
let s =
|
|
4202
|
-
return
|
|
4246
|
+
let s = yl(o.nodes);
|
|
4247
|
+
return oi(t, s, e);
|
|
4203
4248
|
}
|
|
4204
4249
|
} catch {
|
|
4205
4250
|
}
|
|
4206
4251
|
if (r = n.getData("text/html"))
|
|
4207
4252
|
try {
|
|
4208
4253
|
var i = new DOMParser().parseFromString(r, "text/html");
|
|
4209
|
-
let o =
|
|
4210
|
-
return
|
|
4254
|
+
let o = pl.$generateNodesFromDOM(t, i);
|
|
4255
|
+
return oi(t, o, e);
|
|
4211
4256
|
} catch {
|
|
4212
4257
|
}
|
|
4213
4258
|
if (n = n.getData("text/plain"), n != null)
|
|
@@ -4217,13 +4262,13 @@ qe.$insertDataTransferForRichText = function(n, e, t) {
|
|
|
4217
4262
|
else
|
|
4218
4263
|
e.insertRawText(n);
|
|
4219
4264
|
};
|
|
4220
|
-
qe.$insertGeneratedNodes =
|
|
4221
|
-
const
|
|
4222
|
-
var
|
|
4223
|
-
let kt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u",
|
|
4265
|
+
qe.$insertGeneratedNodes = oi;
|
|
4266
|
+
const Du = qe;
|
|
4267
|
+
var Lu = Du, tr = Lu, kn = we, Et = Ee, y = I;
|
|
4268
|
+
let kt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Mu = kt && "documentMode" in document ? document.documentMode : null;
|
|
4224
4269
|
kt && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
4225
4270
|
kt && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
4226
|
-
let
|
|
4271
|
+
let ku = kt && "InputEvent" in window && !Mu ? "getTargetRanges" in new window.InputEvent("input") : !1, Iu = kt && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), Pu = kt && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
4227
4272
|
class vn extends y.ElementNode {
|
|
4228
4273
|
static getType() {
|
|
4229
4274
|
return "quote";
|
|
@@ -4242,10 +4287,10 @@ class vn extends y.ElementNode {
|
|
|
4242
4287
|
return !1;
|
|
4243
4288
|
}
|
|
4244
4289
|
static importDOM() {
|
|
4245
|
-
return { blockquote: () => ({ conversion:
|
|
4290
|
+
return { blockquote: () => ({ conversion: Fu, priority: 0 }) };
|
|
4246
4291
|
}
|
|
4247
4292
|
static importJSON(e) {
|
|
4248
|
-
let t =
|
|
4293
|
+
let t = $i();
|
|
4249
4294
|
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
|
|
4250
4295
|
}
|
|
4251
4296
|
exportJSON() {
|
|
@@ -4260,7 +4305,7 @@ class vn extends y.ElementNode {
|
|
|
4260
4305
|
return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
|
|
4261
4306
|
}
|
|
4262
4307
|
}
|
|
4263
|
-
function
|
|
4308
|
+
function $i() {
|
|
4264
4309
|
return new vn();
|
|
4265
4310
|
}
|
|
4266
4311
|
class Cn extends y.ElementNode {
|
|
@@ -4287,10 +4332,10 @@ class Cn extends y.ElementNode {
|
|
|
4287
4332
|
return { h1: () => ({ conversion: pt, priority: 0 }), h2: () => ({ conversion: pt, priority: 0 }), h3: () => ({ conversion: pt, priority: 0 }), h4: () => ({ conversion: pt, priority: 0 }), h5: () => ({
|
|
4288
4333
|
conversion: pt,
|
|
4289
4334
|
priority: 0
|
|
4290
|
-
}), h6: () => ({ conversion: pt, priority: 0 }), p: (e) => (e = e.firstChild, e !== null &&
|
|
4335
|
+
}), h6: () => ({ conversion: pt, priority: 0 }), p: (e) => (e = e.firstChild, e !== null && vo(e) ? { conversion: () => ({ node: null }), priority: 3 } : null), span: (e) => vo(e) ? { conversion: () => ({ node: nr("h1") }), priority: 3 } : null };
|
|
4291
4336
|
}
|
|
4292
4337
|
static importJSON(e) {
|
|
4293
|
-
let t =
|
|
4338
|
+
let t = nr(e.tag);
|
|
4294
4339
|
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
|
|
4295
4340
|
}
|
|
4296
4341
|
exportJSON() {
|
|
@@ -4308,38 +4353,38 @@ class Cn extends y.ElementNode {
|
|
|
4308
4353
|
return !0;
|
|
4309
4354
|
}
|
|
4310
4355
|
}
|
|
4311
|
-
function
|
|
4356
|
+
function vo(n) {
|
|
4312
4357
|
return n.nodeName.toLowerCase() === "span" ? n.style.fontSize === "26pt" : !1;
|
|
4313
4358
|
}
|
|
4314
4359
|
function pt(n) {
|
|
4315
4360
|
n = n.nodeName.toLowerCase();
|
|
4316
4361
|
let e = null;
|
|
4317
|
-
return (n === "h1" || n === "h2" || n === "h3" || n === "h4" || n === "h5" || n === "h6") && (e =
|
|
4362
|
+
return (n === "h1" || n === "h2" || n === "h3" || n === "h4" || n === "h5" || n === "h6") && (e = nr(n)), { node: e };
|
|
4318
4363
|
}
|
|
4319
|
-
function
|
|
4320
|
-
return { node:
|
|
4364
|
+
function Fu() {
|
|
4365
|
+
return { node: $i() };
|
|
4321
4366
|
}
|
|
4322
|
-
function
|
|
4367
|
+
function nr(n) {
|
|
4323
4368
|
return new Cn(n);
|
|
4324
4369
|
}
|
|
4325
|
-
function
|
|
4370
|
+
function bu(n, e) {
|
|
4326
4371
|
n.preventDefault(), e.update(() => {
|
|
4327
4372
|
let t = y.$getSelection(), r = n instanceof InputEvent || n instanceof KeyboardEvent ? null : n.clipboardData;
|
|
4328
|
-
r != null && (y.$isRangeSelection(t) || y.DEPRECATED_$isGridSelection(t)) &&
|
|
4373
|
+
r != null && (y.$isRangeSelection(t) || y.DEPRECATED_$isGridSelection(t)) && tr.$insertDataTransferForRichText(r, t, e);
|
|
4329
4374
|
}, { tag: "paste" });
|
|
4330
4375
|
}
|
|
4331
|
-
function
|
|
4376
|
+
function Nl(n, e) {
|
|
4332
4377
|
var t = y.$getSelection();
|
|
4333
4378
|
if (t !== null) {
|
|
4334
4379
|
n.preventDefault(), n = n instanceof KeyboardEvent ? null : n.clipboardData;
|
|
4335
|
-
let r =
|
|
4336
|
-
e =
|
|
4380
|
+
let r = tr.$getHtmlContent(e);
|
|
4381
|
+
e = tr.$getLexicalContent(e), n != null ? (r !== null && n.setData("text/html", r), e !== null && n.setData("application/x-lexical-editor", e), t = t.getTextContent(), n.setData("text/plain", t)) : (t = navigator.clipboard, t != null && (n = [new ClipboardItem({ "text/html": new Blob([r], { type: "text/html" }) })], t.write(n)));
|
|
4337
4382
|
}
|
|
4338
4383
|
}
|
|
4339
|
-
function
|
|
4340
|
-
|
|
4384
|
+
function Bu(n, e) {
|
|
4385
|
+
Nl(n, e), n = y.$getSelection(), y.$isRangeSelection(n) ? n.removeText() : y.$isNodeSelection(n) && n.getNodes().forEach((t) => t.remove());
|
|
4341
4386
|
}
|
|
4342
|
-
function
|
|
4387
|
+
function Co(n, e) {
|
|
4343
4388
|
var t = y.$getSelection();
|
|
4344
4389
|
if (y.$isRangeSelection(t)) {
|
|
4345
4390
|
var r = /* @__PURE__ */ new Set();
|
|
@@ -4354,8 +4399,8 @@ function vo(n, e) {
|
|
|
4354
4399
|
function In(n) {
|
|
4355
4400
|
return n = y.$getNearestNodeFromDOMNode(n), y.$isDecoratorNode(n);
|
|
4356
4401
|
}
|
|
4357
|
-
Qe.$createHeadingNode =
|
|
4358
|
-
Qe.$createQuoteNode =
|
|
4402
|
+
Qe.$createHeadingNode = nr;
|
|
4403
|
+
Qe.$createQuoteNode = $i;
|
|
4359
4404
|
Qe.$isHeadingNode = function(n) {
|
|
4360
4405
|
return n instanceof Cn;
|
|
4361
4406
|
};
|
|
@@ -4390,7 +4435,7 @@ Qe.registerRichText = function(n) {
|
|
|
4390
4435
|
if (!y.$isRangeSelection(t) && !y.DEPRECATED_$isGridSelection(t))
|
|
4391
4436
|
return !1;
|
|
4392
4437
|
const r = e.dataTransfer;
|
|
4393
|
-
r != null ?
|
|
4438
|
+
r != null ? tr.$insertDataTransferForRichText(r, t, n) : y.$isRangeSelection(t) && (e = e.data) && t.insertText(e);
|
|
4394
4439
|
}
|
|
4395
4440
|
return !0;
|
|
4396
4441
|
}, y.COMMAND_PRIORITY_EDITOR),
|
|
@@ -4421,7 +4466,7 @@ Qe.registerRichText = function(n) {
|
|
|
4421
4466
|
}, y.COMMAND_PRIORITY_EDITOR),
|
|
4422
4467
|
n.registerCommand(
|
|
4423
4468
|
y.INDENT_CONTENT_COMMAND,
|
|
4424
|
-
() => (
|
|
4469
|
+
() => (Co(() => {
|
|
4425
4470
|
n.dispatchCommand(y.CONTROLLED_TEXT_INSERTION_COMMAND, " ");
|
|
4426
4471
|
}, (e) => {
|
|
4427
4472
|
const t = e.getIndent();
|
|
@@ -4429,7 +4474,7 @@ Qe.registerRichText = function(n) {
|
|
|
4429
4474
|
}), !0),
|
|
4430
4475
|
y.COMMAND_PRIORITY_EDITOR
|
|
4431
4476
|
),
|
|
4432
|
-
n.registerCommand(y.OUTDENT_CONTENT_COMMAND, () => (
|
|
4477
|
+
n.registerCommand(y.OUTDENT_CONTENT_COMMAND, () => (Co((e) => {
|
|
4433
4478
|
y.$isTextNode(e) && (e = e.getTextContent(), e[e.length - 1] === " " && n.dispatchCommand(y.DELETE_CHARACTER_COMMAND, !0));
|
|
4434
4479
|
}, (e) => {
|
|
4435
4480
|
const t = e.getIndent();
|
|
@@ -4489,7 +4534,7 @@ Qe.registerRichText = function(n) {
|
|
|
4489
4534
|
if (!y.$isRangeSelection(t))
|
|
4490
4535
|
return !1;
|
|
4491
4536
|
if (e !== null) {
|
|
4492
|
-
if ((
|
|
4537
|
+
if ((Pu || Iu) && ku)
|
|
4493
4538
|
return !1;
|
|
4494
4539
|
if (e.preventDefault(), e.shiftKey)
|
|
4495
4540
|
return n.dispatchCommand(y.INSERT_LINE_BREAK_COMMAND, !1);
|
|
@@ -4512,16 +4557,16 @@ Qe.registerRichText = function(n) {
|
|
|
4512
4557
|
const t = y.$getSelection();
|
|
4513
4558
|
return y.$isRangeSelection(t) ? (e.preventDefault(), !0) : !1;
|
|
4514
4559
|
}, y.COMMAND_PRIORITY_EDITOR),
|
|
4515
|
-
n.registerCommand(y.COPY_COMMAND, (e) => (
|
|
4516
|
-
n.registerCommand(y.CUT_COMMAND, (e) => (
|
|
4560
|
+
n.registerCommand(y.COPY_COMMAND, (e) => (Nl(e, n), !0), y.COMMAND_PRIORITY_EDITOR),
|
|
4561
|
+
n.registerCommand(y.CUT_COMMAND, (e) => (Bu(e, n), !0), y.COMMAND_PRIORITY_EDITOR),
|
|
4517
4562
|
n.registerCommand(y.PASTE_COMMAND, (e) => {
|
|
4518
4563
|
const t = y.$getSelection();
|
|
4519
|
-
return y.$isRangeSelection(t) || y.DEPRECATED_$isGridSelection(t) ? (
|
|
4564
|
+
return y.$isRangeSelection(t) || y.DEPRECATED_$isGridSelection(t) ? (bu(e, n), !0) : !1;
|
|
4520
4565
|
}, y.COMMAND_PRIORITY_EDITOR)
|
|
4521
4566
|
);
|
|
4522
4567
|
};
|
|
4523
|
-
const
|
|
4524
|
-
var gt =
|
|
4568
|
+
const zu = Qe;
|
|
4569
|
+
var gt = zu, Be = {}, Ku = Ee, je = I;
|
|
4525
4570
|
class It extends je.ElementNode {
|
|
4526
4571
|
static getType() {
|
|
4527
4572
|
return "link";
|
|
@@ -4536,14 +4581,14 @@ class It extends je.ElementNode {
|
|
|
4536
4581
|
}
|
|
4537
4582
|
createDOM(e) {
|
|
4538
4583
|
let t = document.createElement("a");
|
|
4539
|
-
return t.href = this.__url, this.__target !== null && (t.target = this.__target), this.__rel !== null && (t.rel = this.__rel),
|
|
4584
|
+
return t.href = this.__url, this.__target !== null && (t.target = this.__target), this.__rel !== null && (t.rel = this.__rel), Ku.addClassNamesToElement(t, e.theme.link), t;
|
|
4540
4585
|
}
|
|
4541
4586
|
updateDOM(e, t) {
|
|
4542
4587
|
let r = this.__url, i = this.__target, o = this.__rel;
|
|
4543
4588
|
return r !== e.__url && (t.href = r), i !== e.__target && (i ? t.target = i : t.removeAttribute("target")), o !== e.__rel && (o ? t.rel = o : t.removeAttribute("rel")), !1;
|
|
4544
4589
|
}
|
|
4545
4590
|
static importDOM() {
|
|
4546
|
-
return { a: () => ({ conversion:
|
|
4591
|
+
return { a: () => ({ conversion: Hu, priority: 1 }) };
|
|
4547
4592
|
}
|
|
4548
4593
|
static importJSON(e) {
|
|
4549
4594
|
let t = fn(e.url, { rel: e.rel, target: e.target });
|
|
@@ -4597,7 +4642,7 @@ class It extends je.ElementNode {
|
|
|
4597
4642
|
return this.isParentOf(e) && this.isParentOf(r) && 0 < t.getTextContent().length;
|
|
4598
4643
|
}
|
|
4599
4644
|
}
|
|
4600
|
-
function
|
|
4645
|
+
function Hu(n) {
|
|
4601
4646
|
let e = null;
|
|
4602
4647
|
return n instanceof HTMLAnchorElement && (e = fn(n.getAttribute("href") || "", { rel: n.getAttribute("rel"), target: n.getAttribute("target") })), { node: e };
|
|
4603
4648
|
}
|
|
@@ -4615,7 +4660,7 @@ class En extends It {
|
|
|
4615
4660
|
return new En(e.__url, { rel: e.__rel, target: e.__target }, e.__key);
|
|
4616
4661
|
}
|
|
4617
4662
|
static importJSON(e) {
|
|
4618
|
-
let t =
|
|
4663
|
+
let t = si(e.url, { rel: e.rel, target: e.target });
|
|
4619
4664
|
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
|
|
4620
4665
|
}
|
|
4621
4666
|
static importDOM() {
|
|
@@ -4626,25 +4671,25 @@ class En extends It {
|
|
|
4626
4671
|
}
|
|
4627
4672
|
insertNewAfter(e) {
|
|
4628
4673
|
if (e = this.getParentOrThrow().insertNewAfter(e), je.$isElementNode(e)) {
|
|
4629
|
-
let t =
|
|
4674
|
+
let t = si(this.__url, { rel: this._rel, target: this.__target });
|
|
4630
4675
|
return e.append(t), t;
|
|
4631
4676
|
}
|
|
4632
4677
|
return null;
|
|
4633
4678
|
}
|
|
4634
4679
|
}
|
|
4635
|
-
function
|
|
4680
|
+
function si(n, e) {
|
|
4636
4681
|
return new En(n, e);
|
|
4637
4682
|
}
|
|
4638
|
-
let
|
|
4639
|
-
function
|
|
4640
|
-
return
|
|
4683
|
+
let Uu = je.createCommand();
|
|
4684
|
+
function Wu(n) {
|
|
4685
|
+
return Yu(n, (e) => nt(e));
|
|
4641
4686
|
}
|
|
4642
|
-
function
|
|
4687
|
+
function Yu(n, e) {
|
|
4643
4688
|
for (; n !== null && (n = n.getParent()) !== null && !e(n); )
|
|
4644
4689
|
;
|
|
4645
4690
|
return n;
|
|
4646
4691
|
}
|
|
4647
|
-
Be.$createAutoLinkNode =
|
|
4692
|
+
Be.$createAutoLinkNode = si;
|
|
4648
4693
|
Be.$createLinkNode = fn;
|
|
4649
4694
|
Be.$isAutoLinkNode = function(n) {
|
|
4650
4695
|
return n instanceof En;
|
|
@@ -4652,7 +4697,7 @@ Be.$isAutoLinkNode = function(n) {
|
|
|
4652
4697
|
Be.$isLinkNode = nt;
|
|
4653
4698
|
Be.AutoLinkNode = En;
|
|
4654
4699
|
Be.LinkNode = It;
|
|
4655
|
-
Be.TOGGLE_LINK_COMMAND =
|
|
4700
|
+
Be.TOGGLE_LINK_COMMAND = Uu;
|
|
4656
4701
|
Be.toggleLink = function(n, e = {}) {
|
|
4657
4702
|
let { target: t, rel: r } = e;
|
|
4658
4703
|
if (e = je.$getSelection(), je.$isRangeSelection(e))
|
|
@@ -4668,7 +4713,7 @@ Be.toggleLink = function(n, e = {}) {
|
|
|
4668
4713
|
else {
|
|
4669
4714
|
if (e.length === 1) {
|
|
4670
4715
|
var i = e[0];
|
|
4671
|
-
if (i = nt(i) ? i :
|
|
4716
|
+
if (i = nt(i) ? i : Wu(i), i !== null) {
|
|
4672
4717
|
i.setURL(n), t !== void 0 && i.setTarget(t), r !== void 0 && i.setRel(r);
|
|
4673
4718
|
return;
|
|
4674
4719
|
}
|
|
@@ -4693,14 +4738,14 @@ Be.toggleLink = function(n, e = {}) {
|
|
|
4693
4738
|
});
|
|
4694
4739
|
}
|
|
4695
4740
|
};
|
|
4696
|
-
const
|
|
4697
|
-
var
|
|
4698
|
-
class
|
|
4741
|
+
const Gu = Be;
|
|
4742
|
+
var vl = Gu;
|
|
4743
|
+
class yr extends I.ElementNode {
|
|
4699
4744
|
static getType() {
|
|
4700
4745
|
return "aside";
|
|
4701
4746
|
}
|
|
4702
4747
|
static clone(e) {
|
|
4703
|
-
return new
|
|
4748
|
+
return new yr(e.__key);
|
|
4704
4749
|
}
|
|
4705
4750
|
createDOM(e) {
|
|
4706
4751
|
const t = document.createElement("aside");
|
|
@@ -4712,13 +4757,13 @@ class _r extends I.ElementNode {
|
|
|
4712
4757
|
static importDOM() {
|
|
4713
4758
|
return {
|
|
4714
4759
|
aside: (e) => ({
|
|
4715
|
-
conversion:
|
|
4760
|
+
conversion: Vu,
|
|
4716
4761
|
priority: 0
|
|
4717
4762
|
})
|
|
4718
4763
|
};
|
|
4719
4764
|
}
|
|
4720
4765
|
static importJSON(e) {
|
|
4721
|
-
const t =
|
|
4766
|
+
const t = Oi();
|
|
4722
4767
|
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
|
|
4723
4768
|
}
|
|
4724
4769
|
exportJSON() {
|
|
@@ -4736,50 +4781,23 @@ class _r extends I.ElementNode {
|
|
|
4736
4781
|
return this.getChildren().forEach((r) => e.append(r)), this.replace(e), !0;
|
|
4737
4782
|
}
|
|
4738
4783
|
}
|
|
4739
|
-
function
|
|
4740
|
-
return { node:
|
|
4741
|
-
}
|
|
4742
|
-
function Si() {
|
|
4743
|
-
return new _r();
|
|
4784
|
+
function Vu() {
|
|
4785
|
+
return { node: Oi };
|
|
4744
4786
|
}
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
* @license React
|
|
4748
|
-
* react-jsx-runtime.production.min.js
|
|
4749
|
-
*
|
|
4750
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4751
|
-
*
|
|
4752
|
-
* This source code is licensed under the MIT license found in the
|
|
4753
|
-
* LICENSE file in the root directory of this source tree.
|
|
4754
|
-
*/
|
|
4755
|
-
var Hu = G, Uu = Symbol.for("react.element"), Wu = Symbol.for("react.fragment"), Yu = Object.prototype.hasOwnProperty, Gu = Hu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Vu = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
4756
|
-
function Nl(n, e, t) {
|
|
4757
|
-
var r, i = {}, o = null, s = null;
|
|
4758
|
-
t !== void 0 && (o = "" + t), e.key !== void 0 && (o = "" + e.key), e.ref !== void 0 && (s = e.ref);
|
|
4759
|
-
for (r in e)
|
|
4760
|
-
Yu.call(e, r) && !Vu.hasOwnProperty(r) && (i[r] = e[r]);
|
|
4761
|
-
if (n && n.defaultProps)
|
|
4762
|
-
for (r in e = n.defaultProps, e)
|
|
4763
|
-
i[r] === void 0 && (i[r] = e[r]);
|
|
4764
|
-
return { $$typeof: Uu, type: n, key: o, ref: s, props: i, _owner: Gu.current };
|
|
4787
|
+
function Oi() {
|
|
4788
|
+
return new yr();
|
|
4765
4789
|
}
|
|
4766
|
-
|
|
4767
|
-
mr.jsx = Nl;
|
|
4768
|
-
mr.jsxs = Nl;
|
|
4769
|
-
(function(n) {
|
|
4770
|
-
n.exports = mr;
|
|
4771
|
-
})($i);
|
|
4772
|
-
const B = $i.exports.jsx, vl = $i.exports.jsxs, Cl = ({
|
|
4790
|
+
const Cl = ({
|
|
4773
4791
|
children: n
|
|
4774
|
-
}) => /* @__PURE__ */
|
|
4775
|
-
className: "caret-grey-800 hover:shadow-
|
|
4792
|
+
}) => /* @__PURE__ */ b("div", {
|
|
4793
|
+
className: "relative caret-grey-800 hover:shadow-[0_0_0_1px] hover:shadow-green",
|
|
4776
4794
|
"data-kg-card": !0,
|
|
4777
4795
|
children: n
|
|
4778
4796
|
});
|
|
4779
4797
|
I.createCommand();
|
|
4780
4798
|
function ju() {
|
|
4781
|
-
return /* @__PURE__ */
|
|
4782
|
-
children: /* @__PURE__ */
|
|
4799
|
+
return /* @__PURE__ */ b(Cl, {
|
|
4800
|
+
children: /* @__PURE__ */ b("hr", {})
|
|
4783
4801
|
});
|
|
4784
4802
|
}
|
|
4785
4803
|
class Tn extends I.DecoratorNode {
|
|
@@ -4813,7 +4831,7 @@ class Tn extends I.DecoratorNode {
|
|
|
4813
4831
|
return !1;
|
|
4814
4832
|
}
|
|
4815
4833
|
decorate() {
|
|
4816
|
-
return /* @__PURE__ */
|
|
4834
|
+
return /* @__PURE__ */ b(ju, {});
|
|
4817
4835
|
}
|
|
4818
4836
|
}
|
|
4819
4837
|
function El() {
|
|
@@ -4823,7 +4841,7 @@ function Ju(n) {
|
|
|
4823
4841
|
return n instanceof Tn;
|
|
4824
4842
|
}
|
|
4825
4843
|
const Xu = ({ el: n, value: e }) => {
|
|
4826
|
-
|
|
4844
|
+
Br(() => {
|
|
4827
4845
|
const t = n.current;
|
|
4828
4846
|
if (t) {
|
|
4829
4847
|
t.style.height = "0px";
|
|
@@ -4844,18 +4862,18 @@ function Zu({
|
|
|
4844
4862
|
return Xu({
|
|
4845
4863
|
el: o,
|
|
4846
4864
|
value: e
|
|
4847
|
-
}), /* @__PURE__ */
|
|
4865
|
+
}), /* @__PURE__ */ b(Cl, {
|
|
4848
4866
|
className: n,
|
|
4849
4867
|
nodeKey: r,
|
|
4850
|
-
children: /* @__PURE__ */
|
|
4851
|
-
children: /* @__PURE__ */
|
|
4868
|
+
children: /* @__PURE__ */ b("code", {
|
|
4869
|
+
children: /* @__PURE__ */ b("textarea", {
|
|
4852
4870
|
ref: o,
|
|
4853
4871
|
autoCorrect: "off",
|
|
4854
4872
|
autoCapitalize: "off",
|
|
4855
4873
|
spellCheck: "false",
|
|
4856
4874
|
tabIndex: "0",
|
|
4857
4875
|
autoFocus: !0,
|
|
4858
|
-
className: "
|
|
4876
|
+
className: "min-h-170 w-full bg-grey-50 p-3",
|
|
4859
4877
|
value: e,
|
|
4860
4878
|
onChange: (l) => {
|
|
4861
4879
|
i.update(() => {
|
|
@@ -4869,8 +4887,8 @@ function Zu({
|
|
|
4869
4887
|
class Pt extends I.DecoratorNode {
|
|
4870
4888
|
constructor(t, r, i) {
|
|
4871
4889
|
super(i);
|
|
4872
|
-
|
|
4873
|
-
|
|
4890
|
+
Sr(this, "__code", "");
|
|
4891
|
+
Sr(this, "__language", "");
|
|
4874
4892
|
this.__language = t, this.__code = r;
|
|
4875
4893
|
}
|
|
4876
4894
|
static getType() {
|
|
@@ -4918,7 +4936,7 @@ class Pt extends I.DecoratorNode {
|
|
|
4918
4936
|
base: i.base || "",
|
|
4919
4937
|
focus: i.focus || ""
|
|
4920
4938
|
};
|
|
4921
|
-
return /* @__PURE__ */
|
|
4939
|
+
return /* @__PURE__ */ b(Zu, {
|
|
4922
4940
|
className: o,
|
|
4923
4941
|
code: this.__code,
|
|
4924
4942
|
language: this.__language,
|
|
@@ -4941,8 +4959,8 @@ const qu = [
|
|
|
4941
4959
|
ct.ListNode,
|
|
4942
4960
|
ct.ListItemNode,
|
|
4943
4961
|
gt.QuoteNode,
|
|
4944
|
-
|
|
4945
|
-
|
|
4962
|
+
yr,
|
|
4963
|
+
vl.LinkNode,
|
|
4946
4964
|
Pt,
|
|
4947
4965
|
Tn
|
|
4948
4966
|
], ed = {
|
|
@@ -4984,7 +5002,7 @@ function td(n) {
|
|
|
4984
5002
|
const nd = {
|
|
4985
5003
|
namespace: "KoenigEditor",
|
|
4986
5004
|
theme: ed
|
|
4987
|
-
},
|
|
5005
|
+
}, Bc = ({
|
|
4988
5006
|
initialEditorState: n,
|
|
4989
5007
|
nodes: e = [...qu],
|
|
4990
5008
|
onError: t = td,
|
|
@@ -4995,20 +5013,20 @@ const nd = {
|
|
|
4995
5013
|
editorState: n,
|
|
4996
5014
|
onError: t
|
|
4997
5015
|
}), [n, e, t]);
|
|
4998
|
-
return /* @__PURE__ */
|
|
5016
|
+
return /* @__PURE__ */ b(fu.LexicalComposer, {
|
|
4999
5017
|
initialConfig: i,
|
|
5000
5018
|
children: r
|
|
5001
5019
|
});
|
|
5002
5020
|
};
|
|
5003
5021
|
var xl = {}, et = {}, pe = I;
|
|
5004
|
-
function
|
|
5022
|
+
function Ai(n, e = !0) {
|
|
5005
5023
|
return n ? !1 : (n = Sl(), e && (n = n.trim()), n === "");
|
|
5006
5024
|
}
|
|
5007
5025
|
function Sl() {
|
|
5008
5026
|
return pe.$getRoot().getTextContent();
|
|
5009
5027
|
}
|
|
5010
5028
|
function $l(n, e) {
|
|
5011
|
-
if (!e || !
|
|
5029
|
+
if (!e || !Ai(n, !1) || (n = pe.$getRoot().getChildren(), e = n.length, 1 < e))
|
|
5012
5030
|
return !1;
|
|
5013
5031
|
for (let r = 0; r < e; r++) {
|
|
5014
5032
|
var t = n[r];
|
|
@@ -5059,9 +5077,9 @@ et.$findTextIntersectionFromCharacters = function(n, e) {
|
|
|
5059
5077
|
}
|
|
5060
5078
|
return null;
|
|
5061
5079
|
};
|
|
5062
|
-
et.$isRootTextContentEmpty =
|
|
5080
|
+
et.$isRootTextContentEmpty = Ai;
|
|
5063
5081
|
et.$isRootTextContentEmptyCurry = function(n, e) {
|
|
5064
|
-
return () =>
|
|
5082
|
+
return () => Ai(n, e);
|
|
5065
5083
|
};
|
|
5066
5084
|
et.$rootTextContent = Sl;
|
|
5067
5085
|
et.registerLexicalTextEntity = function(n, e, t, r) {
|
|
@@ -5141,15 +5159,15 @@ Ol.registerDragonSupport = function(n) {
|
|
|
5141
5159
|
};
|
|
5142
5160
|
};
|
|
5143
5161
|
const od = Ol;
|
|
5144
|
-
var sd = od, ld = ke, Je = G, ad = id, Al = Ee,
|
|
5145
|
-
function
|
|
5162
|
+
var sd = od, ld = ke, Je = G, ad = id, Al = Ee, Eo = ha, ud = sd, dd = gt, Ri = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? Je.useLayoutEffect : Je.useEffect;
|
|
5163
|
+
function To(n) {
|
|
5146
5164
|
return n.getEditorState().read(ad.$canShowPlaceholderCurry(n.isComposing(), n.isEditable()));
|
|
5147
5165
|
}
|
|
5148
5166
|
function cd(n) {
|
|
5149
|
-
let [e, t] = Je.useState(() =>
|
|
5150
|
-
return
|
|
5167
|
+
let [e, t] = Je.useState(() => To(n));
|
|
5168
|
+
return Ri(() => {
|
|
5151
5169
|
function r() {
|
|
5152
|
-
let i =
|
|
5170
|
+
let i = To(n);
|
|
5153
5171
|
t(i);
|
|
5154
5172
|
}
|
|
5155
5173
|
return r(), Al.mergeRegister(n.registerUpdateListener(() => {
|
|
@@ -5161,8 +5179,8 @@ function cd(n) {
|
|
|
5161
5179
|
}
|
|
5162
5180
|
function gd(n) {
|
|
5163
5181
|
let [e, t] = Je.useState(() => n.getDecorators());
|
|
5164
|
-
return
|
|
5165
|
-
|
|
5182
|
+
return Ri(() => n.registerDecoratorListener((r) => {
|
|
5183
|
+
Eo.flushSync(() => {
|
|
5166
5184
|
t(r);
|
|
5167
5185
|
});
|
|
5168
5186
|
}), [n]), Je.useEffect(() => {
|
|
@@ -5172,13 +5190,13 @@ function gd(n) {
|
|
|
5172
5190
|
for (let s = 0; s < i.length; s++) {
|
|
5173
5191
|
var o = i[s];
|
|
5174
5192
|
let l = e[o];
|
|
5175
|
-
o = n.getElementByKey(o), o !== null && r.push(
|
|
5193
|
+
o = n.getElementByKey(o), o !== null && r.push(Eo.createPortal(l, o));
|
|
5176
5194
|
}
|
|
5177
5195
|
return r;
|
|
5178
5196
|
}, [e, n]);
|
|
5179
5197
|
}
|
|
5180
5198
|
function fd(n) {
|
|
5181
|
-
|
|
5199
|
+
Ri(() => Al.mergeRegister(dd.registerRichText(n), ud.registerDragonSupport(n)), [n]);
|
|
5182
5200
|
}
|
|
5183
5201
|
xl.RichTextPlugin = function({ contentEditable: n, placeholder: e }) {
|
|
5184
5202
|
let [t] = ld.useLexicalComposerContext(), r = cd(t), i = gd(t);
|
|
@@ -5198,7 +5216,7 @@ Rl.ContentEditable = function({ ariaActiveDescendantID: n, ariaAutoComplete: e,
|
|
|
5198
5216
|
), Qt.createElement("div", { "aria-activedescendant": C ? n : null, "aria-autocomplete": C ? e : null, "aria-controls": C ? t : null, "aria-describedby": r, "aria-expanded": C && m === "combobox" ? !!i : null, "aria-label": o, "aria-labelledby": s, "aria-multiline": l, "aria-owns": C ? a : null, "aria-required": u, autoCapitalize: d !== void 0 ? String(d) : void 0, autoComplete: c, autoCorrect: g !== void 0 ? String(g) : void 0, className: f, contentEditable: C, "data-testid": _, id: p, ref: O, role: C ? m : void 0, spellCheck: v, style: S, tabIndex: h });
|
|
5199
5217
|
};
|
|
5200
5218
|
const yd = Rl;
|
|
5201
|
-
var Nd = yd,
|
|
5219
|
+
var Nd = yd, wi = {}, Di = {}, vd = Ee, H = I;
|
|
5202
5220
|
function Cd(n, e, t, r, i) {
|
|
5203
5221
|
if (n === null || t.size === 0 && r.size === 0 && !i)
|
|
5204
5222
|
return 0;
|
|
@@ -5233,10 +5251,10 @@ function Ed(n, e) {
|
|
|
5233
5251
|
return t = d, r = c, g;
|
|
5234
5252
|
};
|
|
5235
5253
|
}
|
|
5236
|
-
|
|
5254
|
+
Di.createEmptyHistoryState = function() {
|
|
5237
5255
|
return { current: null, redoStack: [], undoStack: [] };
|
|
5238
5256
|
};
|
|
5239
|
-
|
|
5257
|
+
Di.registerHistory = function(n, e, t) {
|
|
5240
5258
|
let r = Ed(n, t);
|
|
5241
5259
|
t = ({ editorState: s, prevEditorState: l, dirtyLeaves: a, dirtyElements: u, tags: d }) => {
|
|
5242
5260
|
const c = e.current, g = e.redoStack, f = e.undoStack, p = c === null ? null : c.editorState;
|
|
@@ -5278,19 +5296,19 @@ wi.registerHistory = function(n, e, t) {
|
|
|
5278
5296
|
i(), o();
|
|
5279
5297
|
};
|
|
5280
5298
|
};
|
|
5281
|
-
const Td =
|
|
5282
|
-
var xd = Td, Sd = ke,
|
|
5299
|
+
const Td = Di;
|
|
5300
|
+
var xd = Td, Sd = ke, li = xd, xo = G;
|
|
5283
5301
|
function $d(n, e, t = 1e3) {
|
|
5284
|
-
let r =
|
|
5285
|
-
|
|
5302
|
+
let r = xo.useMemo(() => e || li.createEmptyHistoryState(), [e]);
|
|
5303
|
+
xo.useEffect(() => li.registerHistory(n, r, t), [t, n, r]);
|
|
5286
5304
|
}
|
|
5287
|
-
|
|
5288
|
-
|
|
5305
|
+
wi.createEmptyHistoryState = li.createEmptyHistoryState;
|
|
5306
|
+
wi.HistoryPlugin = function({ externalHistoryState: n }) {
|
|
5289
5307
|
let [e] = Sd.useLexicalComposerContext();
|
|
5290
5308
|
return $d(e, n), null;
|
|
5291
5309
|
};
|
|
5292
|
-
const Od =
|
|
5293
|
-
var Ad = Od, wl = {}, Rd = ke,
|
|
5310
|
+
const Od = wi;
|
|
5311
|
+
var Ad = Od, wl = {}, Rd = ke, So = G, wd = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? So.useLayoutEffect : So.useEffect;
|
|
5294
5312
|
wl.OnChangePlugin = function({ ignoreHistoryMergeTagChange: n = !0, ignoreSelectionChange: e = !1, onChange: t }) {
|
|
5295
5313
|
let [r] = Rd.useLexicalComposerContext();
|
|
5296
5314
|
return wd(() => {
|
|
@@ -5317,7 +5335,7 @@ Dl.ListPlugin = function() {
|
|
|
5317
5335
|
}, [n]), Id(n), null;
|
|
5318
5336
|
};
|
|
5319
5337
|
const Pd = Dl;
|
|
5320
|
-
var Fd = Pd,
|
|
5338
|
+
var Fd = Pd, Li = {}, V = {}, ee = {}, Ml = { exports: {} };
|
|
5321
5339
|
(function(n) {
|
|
5322
5340
|
var e = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {};
|
|
5323
5341
|
/**
|
|
@@ -5591,17 +5609,17 @@ var Fd = Pd, Di = {}, V = {}, ee = {}, Ml = { exports: {} };
|
|
|
5591
5609
|
Oe--, xe = h.slice(de, He), X.index -= de;
|
|
5592
5610
|
} else if (X = u(An, 0, xe, ze), !X)
|
|
5593
5611
|
continue;
|
|
5594
|
-
var wn = X.index, Dn = X[0],
|
|
5595
|
-
O &&
|
|
5612
|
+
var wn = X.index, Dn = X[0], Er = xe.slice(0, wn), Pi = xe.slice(wn + Dn.length), Tr = de + xe.length;
|
|
5613
|
+
O && Tr > O.reach && (O.reach = Tr);
|
|
5596
5614
|
var Ln = te.prev;
|
|
5597
|
-
|
|
5615
|
+
Er && (Ln = g(_, Ln, Er), de += Er.length), f(_, Ln, Oe);
|
|
5598
5616
|
var ca = new a(M, $e ? l.tokenize(Dn, $e) : Dn, Te, Dn);
|
|
5599
|
-
if (te = g(_, Ln, ca),
|
|
5600
|
-
var
|
|
5617
|
+
if (te = g(_, Ln, ca), Pi && g(_, te, Pi), Oe > 1) {
|
|
5618
|
+
var xr = {
|
|
5601
5619
|
cause: M + "," + K,
|
|
5602
|
-
reach:
|
|
5620
|
+
reach: Tr
|
|
5603
5621
|
};
|
|
5604
|
-
d(h, _, N, te.prev, de,
|
|
5622
|
+
d(h, _, N, te.prev, de, xr), O && xr.reach > O.reach && (O.reach = xr.reach);
|
|
5605
5623
|
}
|
|
5606
5624
|
}
|
|
5607
5625
|
}
|
|
@@ -5642,7 +5660,7 @@ var Fd = Pd, Di = {}, V = {}, ee = {}, Ml = { exports: {} };
|
|
|
5642
5660
|
}
|
|
5643
5661
|
return l;
|
|
5644
5662
|
}(e);
|
|
5645
|
-
n.exports && (n.exports = t), typeof
|
|
5663
|
+
n.exports && (n.exports = t), typeof Fi < "u" && (Fi.Prism = t), t.languages.markup = {
|
|
5646
5664
|
comment: {
|
|
5647
5665
|
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
5648
5666
|
greedy: !0
|
|
@@ -7063,11 +7081,11 @@ class ft extends w.TextNode {
|
|
|
7063
7081
|
}
|
|
7064
7082
|
createDOM(e) {
|
|
7065
7083
|
let t = super.createDOM(e);
|
|
7066
|
-
return e =
|
|
7084
|
+
return e = Mr(e.theme, this.__highlightType), qt.addClassNamesToElement(t, e), t;
|
|
7067
7085
|
}
|
|
7068
7086
|
updateDOM(e, t, r) {
|
|
7069
7087
|
let i = super.updateDOM(e, t, r);
|
|
7070
|
-
return e =
|
|
7088
|
+
return e = Mr(r.theme, e.__highlightType), r = Mr(r.theme, this.__highlightType), e !== r && (e && qt.removeClassNamesFromElement(
|
|
7071
7089
|
t,
|
|
7072
7090
|
e
|
|
7073
7091
|
), r && qt.addClassNamesToElement(t, r)), i;
|
|
@@ -7083,7 +7101,7 @@ class ft extends w.TextNode {
|
|
|
7083
7101
|
return this;
|
|
7084
7102
|
}
|
|
7085
7103
|
}
|
|
7086
|
-
function
|
|
7104
|
+
function Mr(n, e) {
|
|
7087
7105
|
return e && n && n.codeHighlight && n.codeHighlight[e];
|
|
7088
7106
|
}
|
|
7089
7107
|
function st(n, e) {
|
|
@@ -7098,13 +7116,13 @@ function hn(n) {
|
|
|
7098
7116
|
;
|
|
7099
7117
|
return e;
|
|
7100
7118
|
}
|
|
7101
|
-
function
|
|
7119
|
+
function ai(n) {
|
|
7102
7120
|
let e = null, t = n.getNextSiblings();
|
|
7103
7121
|
for (t.unshift(n); 0 < t.length && (n = t.shift(), oe(n) && (e = n), !w.$isLineBreakNode(n)); )
|
|
7104
7122
|
;
|
|
7105
7123
|
return e;
|
|
7106
7124
|
}
|
|
7107
|
-
let
|
|
7125
|
+
let $o = (n) => n != null && Tt.languages.hasOwnProperty(n) ? n : void 0;
|
|
7108
7126
|
class Xe extends w.ElementNode {
|
|
7109
7127
|
static getType() {
|
|
7110
7128
|
return "code";
|
|
@@ -7113,7 +7131,7 @@ class Xe extends w.ElementNode {
|
|
|
7113
7131
|
return new Xe(e.__language, e.__key);
|
|
7114
7132
|
}
|
|
7115
7133
|
constructor(e, t) {
|
|
7116
|
-
super(t), this.__language =
|
|
7134
|
+
super(t), this.__language = $o(e);
|
|
7117
7135
|
}
|
|
7118
7136
|
createDOM(e) {
|
|
7119
7137
|
let t = document.createElement("code");
|
|
@@ -7124,10 +7142,10 @@ class Xe extends w.ElementNode {
|
|
|
7124
7142
|
return e = e.__language, r ? r !== e && t.setAttribute("data-highlight-language", r) : e && t.removeAttribute("data-highlight-language"), !1;
|
|
7125
7143
|
}
|
|
7126
7144
|
static importDOM() {
|
|
7127
|
-
return { code: (e) => e.textContent != null && /\r?\n/.test(e.textContent) ? { conversion:
|
|
7145
|
+
return { code: (e) => e.textContent != null && /\r?\n/.test(e.textContent) ? { conversion: Oo, priority: 1 } : null, div: () => ({ conversion: bd, priority: 1 }), pre: () => ({ conversion: Oo, priority: 0 }), table: (e) => kr(e) ? { conversion: Bd, priority: 4 } : null, td: (e) => {
|
|
7128
7146
|
let t = e.closest("table");
|
|
7129
|
-
return e.classList.contains("js-file-line") ? { conversion: zd, priority: 4 } : t &&
|
|
7130
|
-
}, tr: (e) => (e = e.closest("table")) &&
|
|
7147
|
+
return e.classList.contains("js-file-line") ? { conversion: zd, priority: 4 } : t && kr(t) ? { conversion: Ao, priority: 4 } : null;
|
|
7148
|
+
}, tr: (e) => (e = e.closest("table")) && kr(e) ? { conversion: Ao, priority: 4 } : null };
|
|
7131
7149
|
}
|
|
7132
7150
|
static importJSON(e) {
|
|
7133
7151
|
let t = xn(e.language);
|
|
@@ -7164,7 +7182,7 @@ class Xe extends w.ElementNode {
|
|
|
7164
7182
|
return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
|
|
7165
7183
|
}
|
|
7166
7184
|
setLanguage(e) {
|
|
7167
|
-
this.getWritable().__language =
|
|
7185
|
+
this.getWritable().__language = $o(e);
|
|
7168
7186
|
}
|
|
7169
7187
|
getLanguage() {
|
|
7170
7188
|
return this.getLatest().__language;
|
|
@@ -7173,10 +7191,10 @@ class Xe extends w.ElementNode {
|
|
|
7173
7191
|
function xn(n) {
|
|
7174
7192
|
return new Xe(n);
|
|
7175
7193
|
}
|
|
7176
|
-
function
|
|
7194
|
+
function Nr(n) {
|
|
7177
7195
|
return n instanceof Xe;
|
|
7178
7196
|
}
|
|
7179
|
-
function
|
|
7197
|
+
function Oo() {
|
|
7180
7198
|
return { node: xn(), preformatted: !0 };
|
|
7181
7199
|
}
|
|
7182
7200
|
function bd(n) {
|
|
@@ -7189,16 +7207,16 @@ function bd(n) {
|
|
|
7189
7207
|
function Bd() {
|
|
7190
7208
|
return { node: xn(), preformatted: !0 };
|
|
7191
7209
|
}
|
|
7192
|
-
function
|
|
7210
|
+
function Ao() {
|
|
7193
7211
|
return { node: null };
|
|
7194
7212
|
}
|
|
7195
7213
|
function zd(n) {
|
|
7196
7214
|
return { after: (e) => (n.parentNode && n.parentNode.nextSibling && e.push(w.$createLineBreakNode()), e), node: null };
|
|
7197
7215
|
}
|
|
7198
|
-
function
|
|
7216
|
+
function kr(n) {
|
|
7199
7217
|
return n.classList.contains("js-file-line-container");
|
|
7200
7218
|
}
|
|
7201
|
-
function
|
|
7219
|
+
function rr(n, e) {
|
|
7202
7220
|
var t = n.length;
|
|
7203
7221
|
let r = -1;
|
|
7204
7222
|
if (e)
|
|
@@ -7224,14 +7242,14 @@ function Fl(n) {
|
|
|
7224
7242
|
var i = r.pop();
|
|
7225
7243
|
if (oe(i)) {
|
|
7226
7244
|
var o = i.getTextContent();
|
|
7227
|
-
o =
|
|
7245
|
+
o = rr(o, !0), o !== -1 && (e = i, t = o);
|
|
7228
7246
|
}
|
|
7229
7247
|
if (w.$isLineBreakNode(i))
|
|
7230
7248
|
break;
|
|
7231
7249
|
}
|
|
7232
7250
|
if (e === null)
|
|
7233
7251
|
for (n = n.getNextSiblings(); 0 < n.length; ) {
|
|
7234
|
-
if (r = n.shift(), oe(r) && (i = r.getTextContent(), i =
|
|
7252
|
+
if (r = n.shift(), oe(r) && (i = r.getTextContent(), i = rr(i, !0), i !== -1)) {
|
|
7235
7253
|
e = r, t = i;
|
|
7236
7254
|
break;
|
|
7237
7255
|
}
|
|
@@ -7247,14 +7265,14 @@ function bl(n) {
|
|
|
7247
7265
|
var i = r.shift();
|
|
7248
7266
|
if (oe(i)) {
|
|
7249
7267
|
var o = i.getTextContent();
|
|
7250
|
-
o =
|
|
7268
|
+
o = rr(o, !1), o !== -1 && (e = i, t = o + 1);
|
|
7251
7269
|
}
|
|
7252
7270
|
if (w.$isLineBreakNode(i))
|
|
7253
7271
|
break;
|
|
7254
7272
|
}
|
|
7255
7273
|
if (e === null)
|
|
7256
7274
|
for (n = n.getPreviousSiblings(); 0 < n.length; ) {
|
|
7257
|
-
if (r = n.pop(), oe(r) && (i = r.getTextContent(), i =
|
|
7275
|
+
if (r = n.pop(), oe(r) && (i = r.getTextContent(), i = rr(i, !1), i !== -1)) {
|
|
7258
7276
|
e = r, t = i + 1;
|
|
7259
7277
|
break;
|
|
7260
7278
|
}
|
|
@@ -7263,29 +7281,29 @@ function bl(n) {
|
|
|
7263
7281
|
}
|
|
7264
7282
|
return { node: e, offset: t };
|
|
7265
7283
|
}
|
|
7266
|
-
function
|
|
7284
|
+
function Ro(n, e) {
|
|
7267
7285
|
let t = n.getParent();
|
|
7268
|
-
|
|
7286
|
+
Nr(t) ? Bl(t, e) : oe(n) && n.replace(w.$createTextNode(n.__text));
|
|
7269
7287
|
}
|
|
7270
|
-
let
|
|
7288
|
+
let Ir = !1;
|
|
7271
7289
|
function Bl(n, e) {
|
|
7272
|
-
if (!
|
|
7273
|
-
|
|
7290
|
+
if (!Ir) {
|
|
7291
|
+
Ir = !0, n.getLanguage() === void 0 && n.setLanguage("javascript");
|
|
7274
7292
|
var t = n.getKey();
|
|
7275
7293
|
e.update(() => {
|
|
7276
7294
|
Kd(t, () => {
|
|
7277
7295
|
var r = w.$getNodeByKey(t);
|
|
7278
|
-
if (!
|
|
7296
|
+
if (!Nr(r) || !r.isAttached())
|
|
7279
7297
|
return !1;
|
|
7280
7298
|
var i = r.getTextContent();
|
|
7281
7299
|
i = Tt.tokenize(i, Tt.languages[r.getLanguage() || ""] || Tt.languages.javascript), i = zl(i);
|
|
7282
7300
|
var o = r.getChildren();
|
|
7283
|
-
for (r = 0; r < o.length &&
|
|
7301
|
+
for (r = 0; r < o.length && wo(o[r], i[r]); )
|
|
7284
7302
|
r++;
|
|
7285
7303
|
var s = o.length;
|
|
7286
7304
|
let l = i.length, a = Math.min(s, l) - r, u = 0;
|
|
7287
7305
|
for (; u < a; )
|
|
7288
|
-
if (u++, !
|
|
7306
|
+
if (u++, !wo(o[s - u], i[l - u])) {
|
|
7289
7307
|
u--;
|
|
7290
7308
|
break;
|
|
7291
7309
|
}
|
|
@@ -7294,7 +7312,7 @@ function Bl(n, e) {
|
|
|
7294
7312
|
return d !== c || g.length ? (n.splice(d, c - d, g), !0) : !1;
|
|
7295
7313
|
});
|
|
7296
7314
|
}, { onUpdate: () => {
|
|
7297
|
-
|
|
7315
|
+
Ir = !1;
|
|
7298
7316
|
}, skipTransforms: !0 });
|
|
7299
7317
|
}
|
|
7300
7318
|
}
|
|
@@ -7313,7 +7331,7 @@ function zl(n) {
|
|
|
7313
7331
|
}), e;
|
|
7314
7332
|
}
|
|
7315
7333
|
function Kd(n, e) {
|
|
7316
|
-
if (n = w.$getNodeByKey(n),
|
|
7334
|
+
if (n = w.$getNodeByKey(n), Nr(n) && n.isAttached()) {
|
|
7317
7335
|
var t = w.$getSelection();
|
|
7318
7336
|
if (w.$isRangeSelection(t)) {
|
|
7319
7337
|
t = t.anchor;
|
|
@@ -7335,10 +7353,10 @@ function Kd(n, e) {
|
|
|
7335
7353
|
e();
|
|
7336
7354
|
}
|
|
7337
7355
|
}
|
|
7338
|
-
function
|
|
7356
|
+
function wo(n, e) {
|
|
7339
7357
|
return oe(n) && oe(e) ? n.__text === e.__text && n.__highlightType === e.__highlightType : !!(w.$isLineBreakNode(n) && w.$isLineBreakNode(e));
|
|
7340
7358
|
}
|
|
7341
|
-
function
|
|
7359
|
+
function Do(n) {
|
|
7342
7360
|
var e = w.$getSelection();
|
|
7343
7361
|
if (!w.$isRangeSelection(e) || e.isCollapsed())
|
|
7344
7362
|
return !1;
|
|
@@ -7348,15 +7366,15 @@ function wo(n) {
|
|
|
7348
7366
|
if (!oe(r) && !w.$isLineBreakNode(r))
|
|
7349
7367
|
return !1;
|
|
7350
7368
|
}
|
|
7351
|
-
for (t = hn(e[0]), t != null &&
|
|
7352
|
-
r = e[t], w.$isLineBreakNode(e[t - 1]) && oe(r) &&
|
|
7369
|
+
for (t = hn(e[0]), t != null && Lo(t, n), t = 1; t < e.length; t++)
|
|
7370
|
+
r = e[t], w.$isLineBreakNode(e[t - 1]) && oe(r) && Lo(r, n);
|
|
7353
7371
|
return !0;
|
|
7354
7372
|
}
|
|
7355
|
-
function
|
|
7373
|
+
function Lo(n, e) {
|
|
7356
7374
|
let t = n.getTextContent();
|
|
7357
7375
|
e === w.INDENT_CONTENT_COMMAND ? 0 < t.length && /\s/.test(t[0]) ? n.setTextContent(" " + t) : (e = st(" "), n.insertBefore(e)) : t.indexOf(" ") === 0 && (t.length === 1 ? n.remove() : n.setTextContent(t.substring(1)));
|
|
7358
7376
|
}
|
|
7359
|
-
function
|
|
7377
|
+
function Mo(n, e) {
|
|
7360
7378
|
let t = w.$getSelection();
|
|
7361
7379
|
if (!w.$isRangeSelection(t))
|
|
7362
7380
|
return !1;
|
|
@@ -7375,7 +7393,7 @@ function Lo(n, e) {
|
|
|
7375
7393
|
return !1;
|
|
7376
7394
|
}
|
|
7377
7395
|
var d = hn(l);
|
|
7378
|
-
let c =
|
|
7396
|
+
let c = ai(a);
|
|
7379
7397
|
if (d == null || c == null)
|
|
7380
7398
|
return !1;
|
|
7381
7399
|
let g = d.getNodesBetween(c);
|
|
@@ -7386,13 +7404,13 @@ function Lo(n, e) {
|
|
|
7386
7404
|
}
|
|
7387
7405
|
if (e.preventDefault(), e.stopPropagation(), e = u ? d.getPreviousSibling() : c.getNextSibling(), !w.$isLineBreakNode(e) || (d = u ? e.getPreviousSibling() : e.getNextSibling(), d == null))
|
|
7388
7406
|
return !0;
|
|
7389
|
-
u = u ? hn(d) :
|
|
7407
|
+
u = u ? hn(d) : ai(d);
|
|
7390
7408
|
let f = u != null ? u : d;
|
|
7391
7409
|
return e.remove(), g.forEach((p) => p.remove()), n === w.KEY_ARROW_UP_COMMAND ? (g.forEach((p) => f.insertBefore(p)), f.insertBefore(e)) : (f.insertAfter(e), f = e, g.forEach((p) => {
|
|
7392
7410
|
f.insertAfter(p), f = p;
|
|
7393
7411
|
})), t.setTextNodeRange(l, o, a, s), !0;
|
|
7394
7412
|
}
|
|
7395
|
-
function
|
|
7413
|
+
function ko(n, e) {
|
|
7396
7414
|
let t = w.$getSelection();
|
|
7397
7415
|
if (!w.$isRangeSelection(t))
|
|
7398
7416
|
return !1;
|
|
@@ -7405,7 +7423,7 @@ function Mo(n, e) {
|
|
|
7405
7423
|
ee.$createCodeHighlightNode = st;
|
|
7406
7424
|
ee.$createCodeNode = xn;
|
|
7407
7425
|
ee.$isCodeHighlightNode = oe;
|
|
7408
|
-
ee.$isCodeNode =
|
|
7426
|
+
ee.$isCodeNode = Nr;
|
|
7409
7427
|
ee.CODE_LANGUAGE_FRIENDLY_NAME_MAP = kl;
|
|
7410
7428
|
ee.CODE_LANGUAGE_MAP = Il;
|
|
7411
7429
|
ee.CodeHighlightNode = ft;
|
|
@@ -7418,7 +7436,7 @@ ee.getFirstCodeHighlightNodeOfLine = hn;
|
|
|
7418
7436
|
ee.getLanguageFriendlyName = function(n) {
|
|
7419
7437
|
return n = Pl(n), kl[n] || n;
|
|
7420
7438
|
};
|
|
7421
|
-
ee.getLastCodeHighlightNodeOfLine =
|
|
7439
|
+
ee.getLastCodeHighlightNodeOfLine = ai;
|
|
7422
7440
|
ee.getStartOfCodeInLine = Fl;
|
|
7423
7441
|
ee.normalizeCodeLang = Pl;
|
|
7424
7442
|
ee.registerCodeHighlighting = function(n) {
|
|
@@ -7447,29 +7465,29 @@ ee.registerCodeHighlighting = function(n) {
|
|
|
7447
7465
|
}
|
|
7448
7466
|
}
|
|
7449
7467
|
});
|
|
7450
|
-
}), n.registerNodeTransform(Xe, (e) => Bl(e, n)), n.registerNodeTransform(w.TextNode, (e) =>
|
|
7468
|
+
}), n.registerNodeTransform(Xe, (e) => Bl(e, n)), n.registerNodeTransform(w.TextNode, (e) => Ro(e, n)), n.registerNodeTransform(ft, (e) => Ro(e, n)), n.registerCommand(w.INDENT_CONTENT_COMMAND, () => Do(w.INDENT_CONTENT_COMMAND), w.COMMAND_PRIORITY_LOW), n.registerCommand(w.OUTDENT_CONTENT_COMMAND, () => Do(w.OUTDENT_CONTENT_COMMAND), w.COMMAND_PRIORITY_LOW), n.registerCommand(w.KEY_ARROW_UP_COMMAND, (e) => Mo(w.KEY_ARROW_UP_COMMAND, e), w.COMMAND_PRIORITY_LOW), n.registerCommand(
|
|
7451
7469
|
w.KEY_ARROW_DOWN_COMMAND,
|
|
7452
|
-
(e) =>
|
|
7470
|
+
(e) => Mo(w.KEY_ARROW_DOWN_COMMAND, e),
|
|
7453
7471
|
w.COMMAND_PRIORITY_LOW
|
|
7454
|
-
), n.registerCommand(w.MOVE_TO_END, (e) =>
|
|
7472
|
+
), n.registerCommand(w.MOVE_TO_END, (e) => ko(w.MOVE_TO_END, e), w.COMMAND_PRIORITY_LOW), n.registerCommand(w.MOVE_TO_START, (e) => ko(w.MOVE_TO_START, e), w.COMMAND_PRIORITY_LOW));
|
|
7455
7473
|
};
|
|
7456
7474
|
const Hd = ee;
|
|
7457
|
-
var Ud = Hd,
|
|
7458
|
-
function
|
|
7475
|
+
var Ud = Hd, B = I, en = Ud, se = ct, Ve = gt, Wd = Ee, Pr = vl;
|
|
7476
|
+
function ui(n, e) {
|
|
7459
7477
|
let t = {};
|
|
7460
7478
|
for (let r of n)
|
|
7461
7479
|
n = e(r), t[n] ? t[n].push(r) : t[n] = [r];
|
|
7462
7480
|
return t;
|
|
7463
7481
|
}
|
|
7464
|
-
function
|
|
7465
|
-
return n =
|
|
7482
|
+
function Mi(n) {
|
|
7483
|
+
return n = ui(n, (e) => e.type), { element: n.element || [], textFormat: n["text-format"] || [], textMatch: n["text-match"] || [] };
|
|
7466
7484
|
}
|
|
7467
|
-
let
|
|
7485
|
+
let ir = /[!-/:-@[-`{-~\s]/;
|
|
7468
7486
|
function Yd(n) {
|
|
7469
|
-
let e =
|
|
7487
|
+
let e = Mi(n), t = e.textFormat.filter((r) => r.format.length === 1);
|
|
7470
7488
|
return () => {
|
|
7471
7489
|
let r = [];
|
|
7472
|
-
var i =
|
|
7490
|
+
var i = B.$getRoot().getChildren();
|
|
7473
7491
|
for (let o of i)
|
|
7474
7492
|
i = Gd(o, e.element, t, e.textMatch), i != null && r.push(i);
|
|
7475
7493
|
return r.join(`
|
|
@@ -7479,77 +7497,77 @@ function Yd(n) {
|
|
|
7479
7497
|
}
|
|
7480
7498
|
function Gd(n, e, t, r) {
|
|
7481
7499
|
for (let i of e)
|
|
7482
|
-
if (e = i.export(n, (o) =>
|
|
7500
|
+
if (e = i.export(n, (o) => or(o, t, r)), e != null)
|
|
7483
7501
|
return e;
|
|
7484
|
-
return
|
|
7502
|
+
return B.$isElementNode(n) ? or(n, t, r) : null;
|
|
7485
7503
|
}
|
|
7486
|
-
function
|
|
7504
|
+
function or(n, e, t) {
|
|
7487
7505
|
let r = [];
|
|
7488
7506
|
n = n.getChildren();
|
|
7489
7507
|
e:
|
|
7490
7508
|
for (let i of n) {
|
|
7491
7509
|
for (let o of t)
|
|
7492
|
-
if (n = o.export(i, (s) =>
|
|
7510
|
+
if (n = o.export(i, (s) => or(s, e, t), (s, l) => Io(s, l, e)), n != null) {
|
|
7493
7511
|
r.push(n);
|
|
7494
7512
|
continue e;
|
|
7495
7513
|
}
|
|
7496
|
-
|
|
7497
|
-
`) :
|
|
7514
|
+
B.$isLineBreakNode(i) ? r.push(`
|
|
7515
|
+
`) : B.$isTextNode(i) ? r.push(Io(i, i.getTextContent(), e)) : B.$isElementNode(i) && r.push(or(i, e, t));
|
|
7498
7516
|
}
|
|
7499
7517
|
return r.join("");
|
|
7500
7518
|
}
|
|
7501
|
-
function
|
|
7519
|
+
function Io(n, e, t) {
|
|
7502
7520
|
let r = e.trim(), i = r, o = /* @__PURE__ */ new Set();
|
|
7503
7521
|
for (let l of t) {
|
|
7504
7522
|
t = l.format[0];
|
|
7505
7523
|
let a = l.tag;
|
|
7506
|
-
if (
|
|
7524
|
+
if (Fr(n, t) && !o.has(t)) {
|
|
7507
7525
|
o.add(t);
|
|
7508
|
-
var s =
|
|
7509
|
-
|
|
7526
|
+
var s = Po(n, !0);
|
|
7527
|
+
Fr(s, t) || (i = a + i), s = Po(n, !1), Fr(s, t) || (i += a);
|
|
7510
7528
|
}
|
|
7511
7529
|
}
|
|
7512
7530
|
return e.replace(r, i);
|
|
7513
7531
|
}
|
|
7514
|
-
function
|
|
7532
|
+
function Po(n, e) {
|
|
7515
7533
|
let t = e ? n.getPreviousSibling() : n.getNextSibling();
|
|
7516
7534
|
for (t || (n = n.getParentOrThrow(), n.isInline() && (t = e ? n.getPreviousSibling() : n.getNextSibling())); t; ) {
|
|
7517
|
-
if (
|
|
7535
|
+
if (B.$isElementNode(t)) {
|
|
7518
7536
|
if (!t.isInline())
|
|
7519
7537
|
break;
|
|
7520
|
-
if (n = e ? t.getLastDescendant() : t.getFirstDescendant(),
|
|
7538
|
+
if (n = e ? t.getLastDescendant() : t.getFirstDescendant(), B.$isTextNode(n))
|
|
7521
7539
|
return n;
|
|
7522
7540
|
t = e ? t.getPreviousSibling() : t.getNextSibling();
|
|
7523
7541
|
}
|
|
7524
|
-
if (
|
|
7542
|
+
if (B.$isTextNode(t))
|
|
7525
7543
|
return t;
|
|
7526
|
-
if (!
|
|
7544
|
+
if (!B.$isElementNode(t))
|
|
7527
7545
|
break;
|
|
7528
7546
|
}
|
|
7529
7547
|
return null;
|
|
7530
7548
|
}
|
|
7531
|
-
function
|
|
7532
|
-
return
|
|
7549
|
+
function Fr(n, e) {
|
|
7550
|
+
return B.$isTextNode(n) && n.hasFormat(e);
|
|
7533
7551
|
}
|
|
7534
7552
|
let Ft = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Vd = Ft && "documentMode" in document ? document.documentMode : null;
|
|
7535
7553
|
Ft && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
7536
7554
|
Ft && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
7537
7555
|
Ft && "InputEvent" in window && !Vd && "getTargetRanges" in new window.InputEvent("input");
|
|
7538
|
-
let
|
|
7556
|
+
let Fo = Ft && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), bo = Ft && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, jd = /^\s{0,3}$/, Bo = /^```(\w{1,10})?\s?$/;
|
|
7539
7557
|
function Jd(n) {
|
|
7540
|
-
let e =
|
|
7558
|
+
let e = Mi(n), t = Zd(e.textFormat);
|
|
7541
7559
|
return (r) => {
|
|
7542
7560
|
var i = r.split(`
|
|
7543
7561
|
`), o = i.length;
|
|
7544
|
-
r =
|
|
7562
|
+
r = B.$getRoot(), r.clear();
|
|
7545
7563
|
for (let p = 0; p < o; p++) {
|
|
7546
7564
|
var s = i[p];
|
|
7547
7565
|
e: {
|
|
7548
|
-
var l = i, a = p, u = r, d = l[a].match(
|
|
7566
|
+
var l = i, a = p, u = r, d = l[a].match(Bo);
|
|
7549
7567
|
if (d) {
|
|
7550
7568
|
for (var c = a, g = l.length; ++c < g; )
|
|
7551
|
-
if (l[c].match(
|
|
7552
|
-
d = en.$createCodeNode(d[1]), l =
|
|
7569
|
+
if (l[c].match(Bo)) {
|
|
7570
|
+
d = en.$createCodeNode(d[1]), l = B.$createTextNode(l.slice(a + 1, c).join(`
|
|
7553
7571
|
`)), d.append(l), u.append(d), u = [d, c];
|
|
7554
7572
|
break e;
|
|
7555
7573
|
}
|
|
@@ -7562,18 +7580,18 @@ function Jd(n) {
|
|
|
7562
7580
|
else {
|
|
7563
7581
|
u = s, g = r;
|
|
7564
7582
|
var f = e.element;
|
|
7565
|
-
c = t, l = e.textMatch, a = u.trim(), d =
|
|
7583
|
+
c = t, l = e.textMatch, a = u.trim(), d = B.$createTextNode(a), s = B.$createParagraphNode(), s.append(d), g.append(s);
|
|
7566
7584
|
for (let { regExp: S, replace: h } of f)
|
|
7567
7585
|
if (g = u.match(S)) {
|
|
7568
7586
|
d.setTextContent(u.slice(g[0].length)), h(s, [d], g, !0);
|
|
7569
7587
|
break;
|
|
7570
7588
|
}
|
|
7571
|
-
Yn(d, c, l), s.isAttached() && 0 < a.length && (u = s.getPreviousSibling(),
|
|
7589
|
+
Yn(d, c, l), s.isAttached() && 0 < a.length && (u = s.getPreviousSibling(), B.$isParagraphNode(u) || Ve.$isQuoteNode(u) || se.$isListNode(u)) && (c = u, se.$isListNode(u) && (u = u.getLastDescendant(), c = u == null ? null : Wd.$findMatchingParent(u, se.$isListItemNode)), c != null && 0 < c.getTextContentSize() && (c.splice(c.getChildrenSize(), 0, [B.$createLineBreakNode(), ...s.getChildren()]), s.remove()));
|
|
7572
7590
|
}
|
|
7573
7591
|
}
|
|
7574
7592
|
i = r.getChildren();
|
|
7575
7593
|
for (let p of i)
|
|
7576
|
-
i = p,
|
|
7594
|
+
i = p, B.$isParagraphNode(i) ? (o = i.getFirstChild(), i = o == null || i.getChildrenSize() === 1 && B.$isTextNode(o) && jd.test(o.getTextContent())) : i = !1, i && p.remove();
|
|
7577
7595
|
r.selectEnd();
|
|
7578
7596
|
};
|
|
7579
7597
|
}
|
|
@@ -7615,7 +7633,7 @@ function Xd(n, e) {
|
|
|
7615
7633
|
if (r.intraword !== !1)
|
|
7616
7634
|
return t;
|
|
7617
7635
|
var { index: i = 0 } = t;
|
|
7618
|
-
if (r = n[i - 1], i = n[i + t[0].length], !(r && !
|
|
7636
|
+
if (r = n[i - 1], i = n[i + t[0].length], !(r && !ir.test(r) || i && !ir.test(i)))
|
|
7619
7637
|
return t;
|
|
7620
7638
|
}
|
|
7621
7639
|
}
|
|
@@ -7626,11 +7644,11 @@ function Zd(n) {
|
|
|
7626
7644
|
for (let i of n) {
|
|
7627
7645
|
({ tag: n } = i), e[n] = i;
|
|
7628
7646
|
let o = n.replace(/(\*|\^)/g, "\\$1");
|
|
7629
|
-
r.push(o), t[n] =
|
|
7647
|
+
r.push(o), t[n] = Fo || bo ? new RegExp(`(${o})(?![${o}\\s])(.*?[^${o}\\s])${o}(?!${o})`) : new RegExp(`(?<![\\\\${o}])(${o})((\\\\${o})?.*?[^${o}\\s](\\\\${o})?)((?<!\\\\)|(?<=\\\\\\\\))(${o})(?![\\\\${o}])`);
|
|
7630
7648
|
}
|
|
7631
|
-
return { fullMatchRegExpByTag: t, openTagsRegExp: new RegExp((
|
|
7649
|
+
return { fullMatchRegExpByTag: t, openTagsRegExp: new RegExp((Fo || bo ? "" : "(?<![\\\\])") + "(" + r.join("|") + ")", "g"), transformersByTag: e };
|
|
7632
7650
|
}
|
|
7633
|
-
function
|
|
7651
|
+
function zo(n, e, t) {
|
|
7634
7652
|
let r = t.length;
|
|
7635
7653
|
for (; e >= r; e--) {
|
|
7636
7654
|
let i = e - r;
|
|
@@ -7647,18 +7665,18 @@ function Kl(n, e, t, r, i) {
|
|
|
7647
7665
|
}
|
|
7648
7666
|
let Hl = (n) => (e, t, r) => {
|
|
7649
7667
|
r = n(r), r.append(...t), e.replace(r), r.select(0, 0);
|
|
7650
|
-
},
|
|
7668
|
+
}, ki = (n) => (e, t, r) => {
|
|
7651
7669
|
var i = e.getPreviousSibling();
|
|
7652
7670
|
const o = se.$createListItemNode(n === "check" ? r[3] === "x" : void 0);
|
|
7653
7671
|
se.$isListNode(i) && i.getListType() === n ? (i.append(o), e.remove()) : (i = se.$createListNode(n, n === "number" ? Number(r[2]) : void 0), i.append(o), e.replace(i)), o.append(...t), o.select(0, 0), (e = Math.floor(r[1].length / 4)) && o.setIndent(e);
|
|
7654
|
-
},
|
|
7672
|
+
}, vr = (n, e, t) => {
|
|
7655
7673
|
const r = [];
|
|
7656
7674
|
var i = n.getChildren();
|
|
7657
7675
|
let o = 0;
|
|
7658
7676
|
for (const l of i)
|
|
7659
7677
|
if (se.$isListItemNode(l)) {
|
|
7660
7678
|
if (l.getChildrenSize() === 1 && (i = l.getFirstChild(), se.$isListNode(i))) {
|
|
7661
|
-
r.push(
|
|
7679
|
+
r.push(vr(i, e, t + 1));
|
|
7662
7680
|
continue;
|
|
7663
7681
|
}
|
|
7664
7682
|
i = " ".repeat(4 * t);
|
|
@@ -7687,7 +7705,7 @@ let Hl = (n) => (e, t, r) => {
|
|
|
7687
7705
|
regExp: /^>\s/,
|
|
7688
7706
|
replace: (n, e, t, r) => {
|
|
7689
7707
|
if (r && (t = n.getPreviousSibling(), Ve.$isQuoteNode(t))) {
|
|
7690
|
-
t.splice(t.getChildrenSize(), 0, [
|
|
7708
|
+
t.splice(t.getChildrenSize(), 0, [B.$createLineBreakNode(), ...e]), t.select(0, 0), n.remove();
|
|
7691
7709
|
return;
|
|
7692
7710
|
}
|
|
7693
7711
|
t = Ve.$createQuoteNode(), t.append(...e), n.replace(t), t.select(0, 0);
|
|
@@ -7699,27 +7717,27 @@ let Hl = (n) => (e, t, r) => {
|
|
|
7699
7717
|
const e = n.getTextContent();
|
|
7700
7718
|
return "```" + (n.getLanguage() || "") + (e ? `
|
|
7701
7719
|
` + e : "") + "\n```";
|
|
7702
|
-
}, regExp: /^```(\w{1,10})?\s/, replace: Hl((n) => en.$createCodeNode(n ? n[1] : void 0)), type: "element" }, Gl = { dependencies: [se.ListNode, se.ListItemNode], export: (n, e) => se.$isListNode(n) ?
|
|
7720
|
+
}, regExp: /^```(\w{1,10})?\s/, replace: Hl((n) => en.$createCodeNode(n ? n[1] : void 0)), type: "element" }, Gl = { dependencies: [se.ListNode, se.ListItemNode], export: (n, e) => se.$isListNode(n) ? vr(n, e, 0) : null, regExp: /^(\s*)[-*+]\s/, replace: ki("bullet"), type: "element" }, Qd = { dependencies: [se.ListNode, se.ListItemNode], export: (n, e) => se.$isListNode(n) ? vr(n, e, 0) : null, regExp: /^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i, replace: ki("check"), type: "element" }, Vl = { dependencies: [se.ListNode, se.ListItemNode], export: (n, e) => se.$isListNode(n) ? vr(n, e, 0) : null, regExp: /^(\s*)(\d{1,})\.\s/, replace: ki("number"), type: "element" }, jl = { format: ["code"], tag: "`", type: "text-format" }, Jl = { format: ["bold", "italic"], tag: "***", type: "text-format" }, Xl = { format: ["bold", "italic"], intraword: !1, tag: "___", type: "text-format" }, Zl = { format: ["bold"], tag: "**", type: "text-format" }, Ql = { format: ["bold"], intraword: !1, tag: "__", type: "text-format" }, ql = { format: ["strikethrough"], tag: "~~", type: "text-format" }, ea = { format: ["italic"], tag: "*", type: "text-format" }, ta = {
|
|
7703
7721
|
format: ["italic"],
|
|
7704
7722
|
intraword: !1,
|
|
7705
7723
|
tag: "_",
|
|
7706
7724
|
type: "text-format"
|
|
7707
|
-
}, na = { dependencies: [
|
|
7708
|
-
if (!
|
|
7725
|
+
}, na = { dependencies: [Pr.LinkNode], export: (n, e, t) => {
|
|
7726
|
+
if (!Pr.$isLinkNode(n))
|
|
7709
7727
|
return null;
|
|
7710
7728
|
e = `[${n.getTextContent()}](${n.getURL()})`;
|
|
7711
7729
|
const r = n.getFirstChild();
|
|
7712
|
-
return n.getChildrenSize() === 1 &&
|
|
7730
|
+
return n.getChildrenSize() === 1 && B.$isTextNode(r) ? t(r, e) : e;
|
|
7713
7731
|
}, importRegExp: /(?:\[([^[]+)\])(?:\(([^(]+)\))/, regExp: /(?:\[([^[]+)\])(?:\(([^(]+)\))$/, replace: (n, e) => {
|
|
7714
7732
|
const [, t, r] = e;
|
|
7715
|
-
e =
|
|
7716
|
-
const i =
|
|
7733
|
+
e = Pr.$createLinkNode(r);
|
|
7734
|
+
const i = B.$createTextNode(t);
|
|
7717
7735
|
i.setFormat(n.getFormat()), e.append(i), n.replace(e);
|
|
7718
|
-
}, trigger: ")", type: "text-match" }, ra = [Ul, Wl, Yl, Gl, Vl], ia = [jl, Jl, Xl, Zl, Ql, ea, ta, ql], oa = [na],
|
|
7719
|
-
V.$convertFromMarkdownString = function(n, e =
|
|
7736
|
+
}, trigger: ")", type: "text-match" }, ra = [Ul, Wl, Yl, Gl, Vl], ia = [jl, Jl, Xl, Zl, Ql, ea, ta, ql], oa = [na], Cr = [...ra, ...ia, ...oa];
|
|
7737
|
+
V.$convertFromMarkdownString = function(n, e = Cr) {
|
|
7720
7738
|
return Jd(e)(n);
|
|
7721
7739
|
};
|
|
7722
|
-
V.$convertToMarkdownString = function(n =
|
|
7740
|
+
V.$convertToMarkdownString = function(n = Cr) {
|
|
7723
7741
|
return Yd(n)();
|
|
7724
7742
|
};
|
|
7725
7743
|
V.BOLD_ITALIC_STAR = Jl;
|
|
@@ -7739,27 +7757,27 @@ V.QUOTE = Wl;
|
|
|
7739
7757
|
V.STRIKETHROUGH = ql;
|
|
7740
7758
|
V.TEXT_FORMAT_TRANSFORMERS = ia;
|
|
7741
7759
|
V.TEXT_MATCH_TRANSFORMERS = oa;
|
|
7742
|
-
V.TRANSFORMERS =
|
|
7760
|
+
V.TRANSFORMERS = Cr;
|
|
7743
7761
|
V.UNORDERED_LIST = Gl;
|
|
7744
|
-
V.registerMarkdownShortcuts = function(n, e =
|
|
7745
|
-
let t =
|
|
7762
|
+
V.registerMarkdownShortcuts = function(n, e = Cr) {
|
|
7763
|
+
let t = Mi(e), r = ui(t.textFormat, ({ tag: o }) => o[o.length - 1]), i = ui(t.textMatch, ({ trigger: o }) => o);
|
|
7746
7764
|
for (let o of e)
|
|
7747
7765
|
if (e = o.type, (e === "element" || e === "text-match") && !n.hasNodes(o.dependencies))
|
|
7748
7766
|
throw Error("Minified Lexical error #79; visit https://lexical.dev/docs/error?code=79 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");
|
|
7749
7767
|
return n.registerUpdateListener(({ tags: o, dirtyLeaves: s, editorState: l, prevEditorState: a }) => {
|
|
7750
7768
|
if (!o.has("historic")) {
|
|
7751
|
-
var u = l.read(
|
|
7752
|
-
if (o = a.read(
|
|
7769
|
+
var u = l.read(B.$getSelection);
|
|
7770
|
+
if (o = a.read(B.$getSelection), B.$isRangeSelection(o) && B.$isRangeSelection(u) && u.isCollapsed()) {
|
|
7753
7771
|
a = u.anchor.key;
|
|
7754
7772
|
var d = u.anchor.offset, c = l._nodeMap.get(a);
|
|
7755
|
-
|
|
7773
|
+
B.$isTextNode(c) && s.has(a) && (d === 1 || d === o.anchor.offset + 1) && n.update(() => {
|
|
7756
7774
|
if (!c.hasFormat("code")) {
|
|
7757
7775
|
var g = c.getParent();
|
|
7758
7776
|
if (g !== null && !en.$isCodeNode(g)) {
|
|
7759
7777
|
var f = u.anchor.offset;
|
|
7760
7778
|
e: {
|
|
7761
7779
|
var p = t.element, m = g.getParent();
|
|
7762
|
-
if (
|
|
7780
|
+
if (B.$isRootOrShadowRoot(m) && g.getFirstChild() === c && (m = c.getTextContent(), m[f - 1] === " ")) {
|
|
7763
7781
|
for (let {
|
|
7764
7782
|
regExp: C,
|
|
7765
7783
|
replace: T
|
|
@@ -7797,18 +7815,18 @@ V.registerMarkdownShortcuts = function(n, e = vr) {
|
|
|
7797
7815
|
var { tag: _ } = C;
|
|
7798
7816
|
S = _.length;
|
|
7799
7817
|
let T = f - S + 1;
|
|
7800
|
-
if (!(1 < S && !Kl(m, T, _, 0, S) || m[T - 1] === " ") && (v = m[f + 1], C.intraword !== !1 || !v ||
|
|
7801
|
-
g = v = c, p =
|
|
7802
|
-
for (var N = g; 0 > p && (N = N.getPreviousSibling()) && !
|
|
7803
|
-
|
|
7804
|
-
if (!(0 > p || g === v && p + S === T || (_ = g.getTextContent(), 0 < p && _[p - 1] === h || (N = _[p - 1], C.intraword === !1 && N && !
|
|
7805
|
-
m = v.getTextContent(), m = m.slice(0, T) + m.slice(f + 1), v.setTextContent(m), m = g === v ? m : _, g.setTextContent(m.slice(0, p) + m.slice(p + S)), m =
|
|
7818
|
+
if (!(1 < S && !Kl(m, T, _, 0, S) || m[T - 1] === " ") && (v = m[f + 1], C.intraword !== !1 || !v || ir.test(v))) {
|
|
7819
|
+
g = v = c, p = zo(m, T, _);
|
|
7820
|
+
for (var N = g; 0 > p && (N = N.getPreviousSibling()) && !B.$isLineBreakNode(N); )
|
|
7821
|
+
B.$isTextNode(N) && (p = N.getTextContent(), g = N, p = zo(p, p.length, _));
|
|
7822
|
+
if (!(0 > p || g === v && p + S === T || (_ = g.getTextContent(), 0 < p && _[p - 1] === h || (N = _[p - 1], C.intraword === !1 && N && !ir.test(N))))) {
|
|
7823
|
+
m = v.getTextContent(), m = m.slice(0, T) + m.slice(f + 1), v.setTextContent(m), m = g === v ? m : _, g.setTextContent(m.slice(0, p) + m.slice(p + S)), m = B.$getSelection(), h = B.$createRangeSelection(), B.$setSelection(h), f = f - S * (g === v ? 2 : 1) + 1, h.anchor.set(g.__key, p, "text"), h.focus.set(v.__key, f, "text");
|
|
7806
7824
|
for (let O of C.format)
|
|
7807
7825
|
h.hasFormat(O) || h.formatText(O);
|
|
7808
7826
|
h.anchor.set(h.focus.key, h.focus.offset, h.focus.type);
|
|
7809
7827
|
for (let O of C.format)
|
|
7810
7828
|
h.hasFormat(O) && h.toggleFormat(O);
|
|
7811
|
-
|
|
7829
|
+
B.$isRangeSelection(m) && (h.format = m.format);
|
|
7812
7830
|
break e;
|
|
7813
7831
|
}
|
|
7814
7832
|
}
|
|
@@ -7824,16 +7842,16 @@ V.registerMarkdownShortcuts = function(n, e = vr) {
|
|
|
7824
7842
|
};
|
|
7825
7843
|
const qd = V;
|
|
7826
7844
|
var rt = qd, Sn = {}, sa = {}, ec = ke, tt = I, Fn = G;
|
|
7827
|
-
function
|
|
7845
|
+
function Ko(n, e) {
|
|
7828
7846
|
return n.getEditorState().read(() => {
|
|
7829
7847
|
let t = tt.$getNodeByKey(e);
|
|
7830
7848
|
return t === null ? !1 : t.isSelected();
|
|
7831
7849
|
});
|
|
7832
7850
|
}
|
|
7833
7851
|
sa.useLexicalNodeSelection = function(n) {
|
|
7834
|
-
let [e] = ec.useLexicalComposerContext(), [t, r] = Fn.useState(() =>
|
|
7852
|
+
let [e] = ec.useLexicalComposerContext(), [t, r] = Fn.useState(() => Ko(e, n));
|
|
7835
7853
|
Fn.useEffect(() => e.registerUpdateListener(() => {
|
|
7836
|
-
r(
|
|
7854
|
+
r(Ko(e, n));
|
|
7837
7855
|
}), [e, n]);
|
|
7838
7856
|
let i = Fn.useCallback((s) => {
|
|
7839
7857
|
e.update(() => {
|
|
@@ -7867,7 +7885,7 @@ class $n extends Re.DecoratorNode {
|
|
|
7867
7885
|
return new $n(e.__key);
|
|
7868
7886
|
}
|
|
7869
7887
|
static importJSON() {
|
|
7870
|
-
return
|
|
7888
|
+
return Ii();
|
|
7871
7889
|
}
|
|
7872
7890
|
static importDOM() {
|
|
7873
7891
|
return { hr: () => ({ conversion: ac, priority: 0 }) };
|
|
@@ -7897,29 +7915,29 @@ class $n extends Re.DecoratorNode {
|
|
|
7897
7915
|
}
|
|
7898
7916
|
}
|
|
7899
7917
|
function ac() {
|
|
7900
|
-
return { node:
|
|
7918
|
+
return { node: Ii() };
|
|
7901
7919
|
}
|
|
7902
|
-
function
|
|
7920
|
+
function Ii() {
|
|
7903
7921
|
return new $n();
|
|
7904
7922
|
}
|
|
7905
7923
|
function la(n) {
|
|
7906
7924
|
return n instanceof $n;
|
|
7907
7925
|
}
|
|
7908
|
-
Sn.$createHorizontalRuleNode =
|
|
7926
|
+
Sn.$createHorizontalRuleNode = Ii;
|
|
7909
7927
|
Sn.$isHorizontalRuleNode = la;
|
|
7910
7928
|
Sn.HorizontalRuleNode = $n;
|
|
7911
7929
|
Sn.INSERT_HORIZONTAL_RULE_COMMAND = sc;
|
|
7912
7930
|
const uc = Sn;
|
|
7913
|
-
var dc = uc, aa = rt, cc = ke,
|
|
7914
|
-
let ua = [{ dependencies: [
|
|
7915
|
-
e =
|
|
7931
|
+
var dc = uc, aa = rt, cc = ke, br = dc, gc = G;
|
|
7932
|
+
let ua = [{ dependencies: [br.HorizontalRuleNode], export: (n) => br.$isHorizontalRuleNode(n) ? "***" : null, regExp: /^(---|\*\*\*|___)\s?$/, replace: (n, e, t, r) => {
|
|
7933
|
+
e = br.$createHorizontalRuleNode(), r || n.getNextSibling() != null ? n.replace(e) : n.insertBefore(e), e.selectNext();
|
|
7916
7934
|
}, type: "element" }, ...aa.TRANSFORMERS];
|
|
7917
|
-
|
|
7918
|
-
|
|
7935
|
+
Li.DEFAULT_TRANSFORMERS = ua;
|
|
7936
|
+
Li.MarkdownShortcutPlugin = function({ transformers: n = ua }) {
|
|
7919
7937
|
let [e] = cc.useLexicalComposerContext();
|
|
7920
7938
|
return gc.useEffect(() => aa.registerMarkdownShortcuts(e, n), [e, n]), null;
|
|
7921
7939
|
};
|
|
7922
|
-
const fc =
|
|
7940
|
+
const fc = Li;
|
|
7923
7941
|
var hc = fc;
|
|
7924
7942
|
const pc = {
|
|
7925
7943
|
dependencies: [],
|
|
@@ -8072,24 +8090,24 @@ function Ht({
|
|
|
8072
8090
|
Icon: r,
|
|
8073
8091
|
...i
|
|
8074
8092
|
}) {
|
|
8075
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ b("li", {
|
|
8076
8094
|
className: "m-0 flex p-0 first:m-0",
|
|
8077
8095
|
...i,
|
|
8078
|
-
children: /* @__PURE__ */
|
|
8096
|
+
children: /* @__PURE__ */ b("button", {
|
|
8079
8097
|
type: "button",
|
|
8080
8098
|
className: "flex h-9 w-9 items-center justify-center",
|
|
8081
8099
|
onClick: t,
|
|
8082
8100
|
"aria-label": n,
|
|
8083
8101
|
"data-kg-active": e,
|
|
8084
|
-
children: /* @__PURE__ */
|
|
8102
|
+
children: /* @__PURE__ */ b(r, {
|
|
8085
8103
|
className: e ? "fill-green" : "fill-white"
|
|
8086
8104
|
})
|
|
8087
8105
|
})
|
|
8088
8106
|
});
|
|
8089
8107
|
}
|
|
8090
8108
|
function Dc() {
|
|
8091
|
-
return /* @__PURE__ */
|
|
8092
|
-
className: "
|
|
8109
|
+
return /* @__PURE__ */ b("li", {
|
|
8110
|
+
className: "m-0 mx-1 h-5 w-px bg-grey-900"
|
|
8093
8111
|
});
|
|
8094
8112
|
}
|
|
8095
8113
|
function Lc({
|
|
@@ -8112,7 +8130,7 @@ function Lc({
|
|
|
8112
8130
|
}, a = () => {
|
|
8113
8131
|
n.update(() => {
|
|
8114
8132
|
const d = I.$getSelection();
|
|
8115
|
-
I.$isRangeSelection(d) && (t === "quote" ? we.$wrapNodes(d, () =>
|
|
8133
|
+
I.$isRangeSelection(d) && (t === "quote" ? we.$wrapNodes(d, () => Oi()) : t === "aside" ? we.$wrapNodes(d, () => I.$createParagraphNode()) : we.$wrapNodes(d, () => gt.$createQuoteNode()));
|
|
8116
8134
|
});
|
|
8117
8135
|
}, u = G.useCallback(() => {
|
|
8118
8136
|
const d = o.current;
|
|
@@ -8141,37 +8159,37 @@ function Lc({
|
|
|
8141
8159
|
d.read(() => {
|
|
8142
8160
|
u();
|
|
8143
8161
|
});
|
|
8144
|
-
}), n.registerCommand(I.SELECTION_CHANGE_COMMAND, () => (u(), !1), I.COMMAND_PRIORITY_LOW))), [n, u]), /* @__PURE__ */
|
|
8162
|
+
}), n.registerCommand(I.SELECTION_CHANGE_COMMAND, () => (u(), !1), I.COMMAND_PRIORITY_LOW))), [n, u]), /* @__PURE__ */ b("div", {
|
|
8145
8163
|
className: "absolute",
|
|
8146
8164
|
ref: o,
|
|
8147
8165
|
"data-kg-floating-toolbar": !0,
|
|
8148
|
-
children: /* @__PURE__ */
|
|
8149
|
-
className: "
|
|
8150
|
-
children: [/* @__PURE__ */
|
|
8166
|
+
children: /* @__PURE__ */ Gn("ul", {
|
|
8167
|
+
className: "m-0 flex items-center justify-evenly rounded bg-black px-1 py-0 font-sans text-md font-normal text-white",
|
|
8168
|
+
children: [/* @__PURE__ */ b(Ht, {
|
|
8151
8169
|
label: "Format text as bold",
|
|
8152
8170
|
isActive: r,
|
|
8153
8171
|
Icon: xc,
|
|
8154
8172
|
onClick: () => n.dispatchCommand(I.FORMAT_TEXT_COMMAND, "bold"),
|
|
8155
8173
|
"data-kg-toolbar-button": "bold"
|
|
8156
|
-
}), /* @__PURE__ */
|
|
8174
|
+
}), /* @__PURE__ */ b(Ht, {
|
|
8157
8175
|
label: "Format text as italics",
|
|
8158
8176
|
isActive: i,
|
|
8159
8177
|
Icon: Sc,
|
|
8160
8178
|
onClick: () => n.dispatchCommand(I.FORMAT_TEXT_COMMAND, "italic"),
|
|
8161
8179
|
"data-kg-toolbar-button": "italic"
|
|
8162
|
-
}), /* @__PURE__ */
|
|
8180
|
+
}), /* @__PURE__ */ b(Ht, {
|
|
8163
8181
|
label: "Toggle heading 1",
|
|
8164
8182
|
isActive: t === "h2",
|
|
8165
8183
|
Icon: $c,
|
|
8166
8184
|
onClick: () => t === "h2" ? s() : l("h2"),
|
|
8167
8185
|
"data-kg-toolbar-button": "h2"
|
|
8168
|
-
}), /* @__PURE__ */
|
|
8186
|
+
}), /* @__PURE__ */ b(Ht, {
|
|
8169
8187
|
label: "Toggle heading 2",
|
|
8170
8188
|
isActive: t === "h3",
|
|
8171
8189
|
Icon: Oc,
|
|
8172
8190
|
onClick: () => t === "h3" ? s() : l("h3"),
|
|
8173
8191
|
"data-kg-toolbar-button": "h3"
|
|
8174
|
-
}), /* @__PURE__ */
|
|
8192
|
+
}), /* @__PURE__ */ b(Dc, {}), /* @__PURE__ */ b(Ht, {
|
|
8175
8193
|
label: "Toggle blockquote",
|
|
8176
8194
|
isActive: t === "quote" || t === "aside",
|
|
8177
8195
|
Icon: t === "aside" ? Rc : Ac,
|
|
@@ -8205,12 +8223,12 @@ function Mc(n, e) {
|
|
|
8205
8223
|
c.getTextContent() !== "" ? r(I.$isTextNode(p)) : r(!1);
|
|
8206
8224
|
});
|
|
8207
8225
|
}, [n]);
|
|
8208
|
-
if (
|
|
8226
|
+
if (Br(() => (document.addEventListener("selectionchange", d), () => {
|
|
8209
8227
|
document.removeEventListener("selectionchange", d);
|
|
8210
|
-
}), [d]),
|
|
8228
|
+
}), [d]), Br(() => n.registerUpdateListener(() => {
|
|
8211
8229
|
d();
|
|
8212
8230
|
}), [n, d]), !!t)
|
|
8213
|
-
return pa(/* @__PURE__ */
|
|
8231
|
+
return pa(/* @__PURE__ */ b(Lc, {
|
|
8214
8232
|
editor: n,
|
|
8215
8233
|
anchorElem: e,
|
|
8216
8234
|
blockType: a,
|
|
@@ -8224,7 +8242,7 @@ function kc({
|
|
|
8224
8242
|
const [e] = ke.useLexicalComposerContext();
|
|
8225
8243
|
return Mc(e, n);
|
|
8226
8244
|
}
|
|
8227
|
-
const
|
|
8245
|
+
const zc = ({
|
|
8228
8246
|
onChange: n,
|
|
8229
8247
|
markdownTransformers: e
|
|
8230
8248
|
}) => {
|
|
@@ -8234,24 +8252,24 @@ const Bc = ({
|
|
|
8234
8252
|
}, [n]), [r, i] = G.useState(null), o = (s) => {
|
|
8235
8253
|
s !== null && i(s);
|
|
8236
8254
|
};
|
|
8237
|
-
return /* @__PURE__ */
|
|
8255
|
+
return /* @__PURE__ */ Gn("div", {
|
|
8238
8256
|
className: "koenig-lexical",
|
|
8239
|
-
children: [/* @__PURE__ */
|
|
8240
|
-
contentEditable: /* @__PURE__ */
|
|
8257
|
+
children: [/* @__PURE__ */ b(pd.RichTextPlugin, {
|
|
8258
|
+
contentEditable: /* @__PURE__ */ b("div", {
|
|
8241
8259
|
ref: o,
|
|
8242
|
-
children: /* @__PURE__ */
|
|
8260
|
+
children: /* @__PURE__ */ b(Nd.ContentEditable, {
|
|
8243
8261
|
className: "kg-prose"
|
|
8244
8262
|
})
|
|
8245
8263
|
}),
|
|
8246
|
-
placeholder: /* @__PURE__ */
|
|
8247
|
-
className: "
|
|
8264
|
+
placeholder: /* @__PURE__ */ b("div", {
|
|
8265
|
+
className: "pointer-events-none absolute top-0 left-0 min-w-full cursor-text font-serif text-xl text-grey-500",
|
|
8248
8266
|
children: "Begin writing your post..."
|
|
8249
8267
|
})
|
|
8250
|
-
}), /* @__PURE__ */
|
|
8268
|
+
}), /* @__PURE__ */ b(Ld.OnChangePlugin, {
|
|
8251
8269
|
onChange: t
|
|
8252
|
-
}), /* @__PURE__ */
|
|
8270
|
+
}), /* @__PURE__ */ b(Ad.HistoryPlugin, {}), " ", /* @__PURE__ */ b(Fd.ListPlugin, {}), " ", /* @__PURE__ */ b(Nc, {
|
|
8253
8271
|
transformers: e
|
|
8254
|
-
}), r && /* @__PURE__ */
|
|
8272
|
+
}), r && /* @__PURE__ */ b(kc, {
|
|
8255
8273
|
anchorElem: r
|
|
8256
8274
|
})]
|
|
8257
8275
|
});
|
|
@@ -8260,10 +8278,11 @@ export {
|
|
|
8260
8278
|
_c as CODE_BLOCK_TRANSFORMER,
|
|
8261
8279
|
qu as DEFAULT_NODES,
|
|
8262
8280
|
yc as DEFAULT_TRANSFORMERS,
|
|
8281
|
+
bc as DesignSandbox,
|
|
8263
8282
|
mc as ELEMENT_TRANSFORMERS,
|
|
8264
8283
|
pc as HR_TRANSFORMER,
|
|
8265
|
-
|
|
8266
|
-
|
|
8284
|
+
Bc as KoenigComposer,
|
|
8285
|
+
zc as KoenigEditor,
|
|
8267
8286
|
Nc as MarkdownShortcutPlugin
|
|
8268
8287
|
};
|
|
8269
8288
|
//# sourceMappingURL=koenig-lexical.js.map
|