lexical 0.6.0 → 0.6.2
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/Lexical.dev.js +102 -36
- package/Lexical.js.flow +15 -4
- package/Lexical.prod.js +172 -171
- package/LexicalEditor.d.ts +9 -2
- package/LexicalUtils.d.ts +3 -1
- package/LexicalVersion.d.ts +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -1258,38 +1258,56 @@ function getElementByKeyOrThrow(editor, key) {
|
|
|
1258
1258
|
|
|
1259
1259
|
return element;
|
|
1260
1260
|
}
|
|
1261
|
-
function scrollIntoViewIfNeeded(editor,
|
|
1262
|
-
|
|
1261
|
+
function scrollIntoViewIfNeeded(editor, selectionRect, rootElement, tags) {
|
|
1262
|
+
const doc = rootElement.ownerDocument;
|
|
1263
|
+
const defaultView = doc.defaultView;
|
|
1263
1264
|
|
|
1264
|
-
if (
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
if (descendantNode !== null) {
|
|
1268
|
-
anchorNode = descendantNode;
|
|
1269
|
-
}
|
|
1265
|
+
if (defaultView === null) {
|
|
1266
|
+
return;
|
|
1270
1267
|
}
|
|
1271
1268
|
|
|
1272
|
-
|
|
1269
|
+
let {
|
|
1270
|
+
top: currentTop,
|
|
1271
|
+
bottom: currentBottom
|
|
1272
|
+
} = selectionRect;
|
|
1273
|
+
let targetTop = 0;
|
|
1274
|
+
let targetBottom = 0;
|
|
1275
|
+
let element = rootElement;
|
|
1276
|
+
|
|
1277
|
+
while (element !== null) {
|
|
1278
|
+
const isBodyElement = element === doc.body;
|
|
1279
|
+
|
|
1280
|
+
if (isBodyElement) {
|
|
1281
|
+
targetTop = 0;
|
|
1282
|
+
targetBottom = getWindow(editor).innerHeight;
|
|
1283
|
+
} else {
|
|
1284
|
+
const targetRect = element.getBoundingClientRect();
|
|
1285
|
+
targetTop = targetRect.top;
|
|
1286
|
+
targetBottom = targetRect.bottom;
|
|
1287
|
+
}
|
|
1273
1288
|
|
|
1274
|
-
|
|
1275
|
-
const rect = element.getBoundingClientRect();
|
|
1289
|
+
let diff = 0;
|
|
1276
1290
|
|
|
1277
|
-
if (
|
|
1278
|
-
|
|
1279
|
-
} else if (
|
|
1280
|
-
|
|
1281
|
-
}
|
|
1282
|
-
const rootRect = rootElement.getBoundingClientRect(); // Rects can returning decimal numbers that differ due to rounding
|
|
1283
|
-
// differences. So let's normalize the values.
|
|
1291
|
+
if (currentTop < targetTop) {
|
|
1292
|
+
diff = -(targetTop - currentTop);
|
|
1293
|
+
} else if (currentBottom > targetBottom) {
|
|
1294
|
+
diff = currentBottom - targetBottom;
|
|
1295
|
+
}
|
|
1284
1296
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1297
|
+
if (diff !== 0) {
|
|
1298
|
+
if (isBodyElement) {
|
|
1299
|
+
// Only handles scrolling of Y axis
|
|
1300
|
+
defaultView.scrollBy(0, diff);
|
|
1301
|
+
} else {
|
|
1302
|
+
const scrollTop = element.scrollTop;
|
|
1303
|
+
element.scrollTop += diff;
|
|
1304
|
+
const yOffset = element.scrollTop - scrollTop;
|
|
1305
|
+
currentTop -= yOffset;
|
|
1306
|
+
currentBottom -= yOffset;
|
|
1289
1307
|
}
|
|
1290
1308
|
}
|
|
1291
1309
|
|
|
1292
|
-
|
|
1310
|
+
element = element.parentElement;
|
|
1293
1311
|
}
|
|
1294
1312
|
}
|
|
1295
1313
|
function $addUpdateTag(tag) {
|
|
@@ -1375,6 +1393,40 @@ function $getNearestRootOrShadowRoot(node) {
|
|
|
1375
1393
|
function $isRootOrShadowRoot(node) {
|
|
1376
1394
|
return $isRootNode(node) || $isElementNode(node) && node.isShadowRoot();
|
|
1377
1395
|
}
|
|
1396
|
+
function $copyNode(node) {
|
|
1397
|
+
// @ts-ignore
|
|
1398
|
+
const copy = node.constructor.clone(node);
|
|
1399
|
+
$setNodeKey(copy, null);
|
|
1400
|
+
return copy;
|
|
1401
|
+
}
|
|
1402
|
+
function $applyNodeReplacement(node) {
|
|
1403
|
+
const editor = getActiveEditor();
|
|
1404
|
+
const nodeType = node.constructor.getType();
|
|
1405
|
+
|
|
1406
|
+
const registeredNode = editor._nodes.get(nodeType);
|
|
1407
|
+
|
|
1408
|
+
if (registeredNode === undefined) {
|
|
1409
|
+
{
|
|
1410
|
+
throw Error(`$initializeNode failed. Ensure node has been registered to the editor. You can do this by passing the node class via the "nodes" array in the editor config.`);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
const replaceFunc = registeredNode.replace;
|
|
1415
|
+
|
|
1416
|
+
if (replaceFunc !== null) {
|
|
1417
|
+
const replacementNode = replaceFunc(node);
|
|
1418
|
+
|
|
1419
|
+
if (!(replacementNode instanceof node.constructor)) {
|
|
1420
|
+
{
|
|
1421
|
+
throw Error(`$initializeNode failed. Ensure replacement node is a subclass of the original node.`);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
return replacementNode;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
return node;
|
|
1429
|
+
}
|
|
1378
1430
|
|
|
1379
1431
|
/**
|
|
1380
1432
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -4151,7 +4203,7 @@ class RangeSelection {
|
|
|
4151
4203
|
for (let i = 0; i < nodes.length; i++) {
|
|
4152
4204
|
const node = nodes[i];
|
|
4153
4205
|
|
|
4154
|
-
if ($isElementNode(node) && !node.isInline()) {
|
|
4206
|
+
if (!$isDecoratorNode(target) && $isElementNode(node) && !node.isInline()) {
|
|
4155
4207
|
// -----
|
|
4156
4208
|
// Heuristics for the replacement or merging of elements
|
|
4157
4209
|
// -----
|
|
@@ -5453,12 +5505,9 @@ function updateDOMSelection(prevSelection, nextSelection, editor, domSelection,
|
|
|
5453
5505
|
rootElement.focus({
|
|
5454
5506
|
preventScroll: true
|
|
5455
5507
|
});
|
|
5456
|
-
}
|
|
5457
|
-
// need to additionally set the DOM selection, otherwise a selectionchange
|
|
5458
|
-
// event will not fire.
|
|
5459
|
-
|
|
5508
|
+
}
|
|
5460
5509
|
|
|
5461
|
-
if (
|
|
5510
|
+
if (anchor.type !== 'element') {
|
|
5462
5511
|
return;
|
|
5463
5512
|
}
|
|
5464
5513
|
} // Apply the updated selection to the DOM. Note: this will trigger
|
|
@@ -5469,7 +5518,13 @@ function updateDOMSelection(prevSelection, nextSelection, editor, domSelection,
|
|
|
5469
5518
|
domSelection.setBaseAndExtent(nextAnchorNode, nextAnchorOffset, nextFocusNode, nextFocusOffset);
|
|
5470
5519
|
|
|
5471
5520
|
if (!tags.has('skip-scroll-into-view') && nextSelection.isCollapsed() && rootElement !== null && rootElement === activeElement) {
|
|
5472
|
-
|
|
5521
|
+
const selectionTarget = nextSelection instanceof RangeSelection && nextSelection.anchor.type === 'element' ? nextAnchorNode.childNodes[nextAnchorOffset] || null : domSelection.rangeCount > 0 ? domSelection.getRangeAt(0) : null;
|
|
5522
|
+
|
|
5523
|
+
if (selectionTarget !== null) {
|
|
5524
|
+
// @ts-ignore Text nodes do have getBoundingClientRect
|
|
5525
|
+
const selectionRect = selectionTarget.getBoundingClientRect();
|
|
5526
|
+
scrollIntoViewIfNeeded(editor, selectionRect, rootElement);
|
|
5527
|
+
}
|
|
5473
5528
|
}
|
|
5474
5529
|
|
|
5475
5530
|
markSelectionChangeFromDOMUpdate();
|
|
@@ -6112,7 +6167,7 @@ function beginUpdate(editor, updateFn, options) {
|
|
|
6112
6167
|
let editorStateWasCloned = false;
|
|
6113
6168
|
|
|
6114
6169
|
if (pendingEditorState === null || pendingEditorState._readOnly) {
|
|
6115
|
-
pendingEditorState = editor._pendingEditorState = cloneEditorState(currentEditorState);
|
|
6170
|
+
pendingEditorState = editor._pendingEditorState = cloneEditorState(pendingEditorState || currentEditorState);
|
|
6116
6171
|
editorStateWasCloned = true;
|
|
6117
6172
|
}
|
|
6118
6173
|
|
|
@@ -7861,7 +7916,7 @@ function convertLineBreakElement(node) {
|
|
|
7861
7916
|
}
|
|
7862
7917
|
|
|
7863
7918
|
function $createLineBreakNode() {
|
|
7864
|
-
return new LineBreakNode();
|
|
7919
|
+
return $applyNodeReplacement(new LineBreakNode());
|
|
7865
7920
|
}
|
|
7866
7921
|
function $isLineBreakNode(node) {
|
|
7867
7922
|
return node instanceof LineBreakNode;
|
|
@@ -8659,7 +8714,7 @@ function convertTextFormatElement(domNode) {
|
|
|
8659
8714
|
}
|
|
8660
8715
|
|
|
8661
8716
|
function $createTextNode(text = '') {
|
|
8662
|
-
return new TextNode(text);
|
|
8717
|
+
return $applyNodeReplacement(new TextNode(text));
|
|
8663
8718
|
}
|
|
8664
8719
|
function $isTextNode(node) {
|
|
8665
8720
|
return node instanceof TextNode;
|
|
@@ -8799,7 +8854,7 @@ function convertParagraphElement() {
|
|
|
8799
8854
|
}
|
|
8800
8855
|
|
|
8801
8856
|
function $createParagraphNode() {
|
|
8802
|
-
return new ParagraphNode();
|
|
8857
|
+
return $applyNodeReplacement(new ParagraphNode());
|
|
8803
8858
|
}
|
|
8804
8859
|
function $isParagraphNode(node) {
|
|
8805
8860
|
return node instanceof ParagraphNode;
|
|
@@ -8902,7 +8957,15 @@ function createEditor(editorConfig) {
|
|
|
8902
8957
|
registeredNodes = new Map();
|
|
8903
8958
|
|
|
8904
8959
|
for (let i = 0; i < nodes.length; i++) {
|
|
8905
|
-
|
|
8960
|
+
let klass = nodes[i];
|
|
8961
|
+
let replacementClass = null;
|
|
8962
|
+
|
|
8963
|
+
if (typeof klass !== 'function') {
|
|
8964
|
+
const options = klass;
|
|
8965
|
+
klass = options.replace;
|
|
8966
|
+
replacementClass = options.with;
|
|
8967
|
+
} // Ensure custom nodes implement required methods.
|
|
8968
|
+
|
|
8906
8969
|
|
|
8907
8970
|
{
|
|
8908
8971
|
const name = klass.name;
|
|
@@ -8944,6 +9007,7 @@ function createEditor(editorConfig) {
|
|
|
8944
9007
|
const type = klass.getType();
|
|
8945
9008
|
registeredNodes.set(type, {
|
|
8946
9009
|
klass,
|
|
9010
|
+
replace: replacementClass,
|
|
8947
9011
|
transforms: new Set()
|
|
8948
9012
|
});
|
|
8949
9013
|
}
|
|
@@ -9336,7 +9400,7 @@ class LexicalEditor {
|
|
|
9336
9400
|
* LICENSE file in the root directory of this source tree.
|
|
9337
9401
|
*
|
|
9338
9402
|
*/
|
|
9339
|
-
const VERSION = '0.
|
|
9403
|
+
const VERSION = '0.6.2';
|
|
9340
9404
|
|
|
9341
9405
|
/**
|
|
9342
9406
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -9390,6 +9454,8 @@ function DEPRECATED_$isGridRowNode(node) {
|
|
|
9390
9454
|
}
|
|
9391
9455
|
|
|
9392
9456
|
exports.$addUpdateTag = $addUpdateTag;
|
|
9457
|
+
exports.$applyNodeReplacement = $applyNodeReplacement;
|
|
9458
|
+
exports.$copyNode = $copyNode;
|
|
9393
9459
|
exports.$createLineBreakNode = $createLineBreakNode;
|
|
9394
9460
|
exports.$createNodeSelection = $createNodeSelection;
|
|
9395
9461
|
exports.$createParagraphNode = $createParagraphNode;
|
package/Lexical.js.flow
CHANGED
|
@@ -266,7 +266,10 @@ declare export function createEditor(editorConfig?: {
|
|
|
266
266
|
namespace: string,
|
|
267
267
|
theme?: EditorThemeClasses,
|
|
268
268
|
parentEditor?: LexicalEditor,
|
|
269
|
-
nodes?: $ReadOnlyArray<
|
|
269
|
+
nodes?: $ReadOnlyArray<
|
|
270
|
+
| Class<LexicalNode>
|
|
271
|
+
| {replace: Class<LexicalNode>, with: (node: LexicalNode) => LexicalNode},
|
|
272
|
+
>,
|
|
270
273
|
onError: (error: Error) => void,
|
|
271
274
|
disableEvents?: boolean,
|
|
272
275
|
editable?: boolean,
|
|
@@ -354,9 +357,9 @@ declare export class LexicalNode {
|
|
|
354
357
|
isParentOf(targetNode: LexicalNode): boolean;
|
|
355
358
|
getNodesBetween(targetNode: LexicalNode): Array<LexicalNode>;
|
|
356
359
|
isDirty(): boolean;
|
|
357
|
-
// $FlowFixMe
|
|
360
|
+
// $FlowFixMe[incompatible-type]
|
|
358
361
|
getLatest<T: LexicalNode>(this: T): T;
|
|
359
|
-
// $FlowFixMe
|
|
362
|
+
// $FlowFixMe[incompatible-type]
|
|
360
363
|
getWritable<T: LexicalNode>(this: T): T;
|
|
361
364
|
getTextContent(includeDirectionless?: boolean): string;
|
|
362
365
|
getTextContentSize(includeDirectionless?: boolean): number;
|
|
@@ -458,7 +461,7 @@ declare export class RangeSelection implements BaseSelection {
|
|
|
458
461
|
focusOffset: number,
|
|
459
462
|
): void;
|
|
460
463
|
getTextContent(): string;
|
|
461
|
-
// $FlowFixMe DOM API
|
|
464
|
+
// $FlowFixMe[cannot-resolve-name] DOM API
|
|
462
465
|
applyDOMRange(range: StaticRange): void;
|
|
463
466
|
clone(): RangeSelection;
|
|
464
467
|
toggleFormat(format: TextFormatType): void;
|
|
@@ -825,6 +828,10 @@ declare export function $hasAncestor(
|
|
|
825
828
|
child: LexicalNode,
|
|
826
829
|
targetNode: LexicalNode,
|
|
827
830
|
): boolean;
|
|
831
|
+
declare export function $copyNode(
|
|
832
|
+
node: ElementNode,
|
|
833
|
+
offset: number,
|
|
834
|
+
): [ElementNode, ElementNode];
|
|
828
835
|
|
|
829
836
|
/**
|
|
830
837
|
* LexicalVersion
|
|
@@ -845,6 +852,10 @@ declare export function $parseSerializedNode(
|
|
|
845
852
|
serializedNode: InternalSerializedNode,
|
|
846
853
|
): LexicalNode;
|
|
847
854
|
|
|
855
|
+
declare export function $applyNodeReplacement<N: LexicalNode>(
|
|
856
|
+
node: LexicalNode,
|
|
857
|
+
): N;
|
|
858
|
+
|
|
848
859
|
export type SerializedLexicalNode = {
|
|
849
860
|
type: string,
|
|
850
861
|
version: number,
|
package/Lexical.prod.js
CHANGED
|
@@ -4,186 +4,187 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
'use strict';let ba={},ca={},da={},ea={},
|
|
7
|
+
'use strict';let ba={},ca={},da={},ea={},ha={},ia={},ja={},ka={},ma={},na={},p={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},ya={},za={},Aa={},Ba={},Ca={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};function r(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
|
|
8
8
|
let t="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Na=t&&"documentMode"in document?document.documentMode:null,u=t&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Oa=t&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Pa=t&&"InputEvent"in window&&!Na?"getTargetRanges"in new window.InputEvent("input"):!1,Qa=t&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ra=t&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
q=y.focusOffset),v=v.nodeValue,null!==v&&
|
|
13
|
-
g=
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
(c=f.getTextContent(),c=N(c),f.replace(c),f=c)),f.setTextContent(a))}}function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function
|
|
28
|
-
function
|
|
29
|
-
function
|
|
30
|
-
function
|
|
31
|
-
function
|
|
32
|
-
function
|
|
33
|
-
function
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
9
|
+
Ta=Qa||Ra?"\u00a0":"\u200b",Ua=Oa?"\u00a0":Ta,Va=/^[^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]/,Wa=/^[^\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]/,Xa={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},Ya={directionless:1,unmergeable:2},
|
|
10
|
+
Za={center:2,justify:4,left:1,right:3},$a={2:"center",4:"justify",1:"left",3:"right"},ab={normal:0,segmented:2,token:1},bb={0:"normal",2:"segmented",1:"token"},cb=!1,db=0;function eb(a){db=a.timeStamp}function fb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function gb(a){return a.getEditorState().read(()=>{let b=x();return null!==b?b.clone():null})}
|
|
11
|
+
function hb(a,b,c){cb=!0;let d=100<performance.now()-db;try{A(a,()=>{let e=x()||gb(a);var f=new Map,g=a.getRootElement(),h=a._editorState;let k=!1,m="";for(var l=0;l<b.length;l++){var n=b[l],q=n.type,v=n.target,w=ib(v,h);if(!(null===w&&v!==g||C(w)))if("characterData"===q){if(n=d&&D(w))a:{n=e;q=v;var y=w;if(E(n)){var z=n.anchor.getNode();if(z.is(y)&&n.format!==z.getFormat()){n=!1;break a}}n=3===q.nodeType&&y.isAttached()}n&&(y=t?window.getSelection():null,q=n=null,null!==y&&y.anchorNode===v&&(n=y.anchorOffset,
|
|
12
|
+
q=y.focusOffset),v=v.nodeValue,null!==v&&jb(w,v,n,q,!1))}else if("childList"===q){k=!0;q=n.addedNodes;for(y=0;y<q.length;y++){z=q[y];var B=kb(z),F=z.parentNode;null==F||null!==B||"BR"===z.nodeName&&fb(z,F,a)||(Oa&&(B=z.innerText||z.nodeValue)&&(m+=B),F.removeChild(z))}n=n.removedNodes;q=n.length;if(0<q){y=0;for(z=0;z<q;z++)F=n[z],"BR"===F.nodeName&&fb(F,v,a)&&(v.appendChild(F),y++);q!==y&&(v===g&&(w=h._nodeMap.get("root")),f.set(v,w))}}}if(0<f.size)for(let [S,aa]of f)if(G(aa))for(f=aa.__children,
|
|
13
|
+
g=S.firstChild,h=0;h<f.length;h++)l=a.getElementByKey(f[h]),null!==l&&(null==g?(S.appendChild(l),g=l):g!==l&&S.replaceChild(l,g),g=g.nextSibling);else D(aa)&&aa.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(l=f[g],h=l.addedNodes,l=l.target,w=0;w<h.length;w++)v=h[w],n=v.parentNode,null==n||"BR"!==v.nodeName||fb(v,l,a)||n.removeChild(v);c.takeRecords()}null!==e&&(k&&(e.dirty=!0,lb(e)),Oa&&mb(a)&&e.insertRawText(m))})}finally{cb=!1}}
|
|
14
|
+
function nb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();hb(a,c,b)}}function rb(a){0===db&&sb(a).addEventListener("textInput",eb,!0);a._observer=new MutationObserver((b,c)=>{hb(a,b,c)})}let tb=1,ub="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
|
|
15
|
+
function vb(a,b,c){let d=a.getRootElement();try{var e;if(e=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){let f=document.activeElement,g=null!==f?f.nodeName:null;e=!C(ib(b))||"INPUT"!==g&&"TEXTAREA"!==g}return e&&wb(b)===a}catch(f){return!1}}function wb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=a.parentNode}return null}function xb(a){return a.isToken()||a.isSegmented()}function yb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}
|
|
16
|
+
function zb(a,b,c){b=Xa[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Ab(a){return D(a)||Bb(a)||C(a)}function Cb(a,b){if(null!=b)a.__key=b;else{H();99<Db&&r(14);b=I();var c=J(),d=""+tb++;c._nodeMap.set(d,a);G(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}function Eb(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;let c=b.indexOf(a.__key);-1===c&&r(31);Fb(a);b.splice(c,1)}}
|
|
17
|
+
function Gb(a){99<Db&&r(14);var b=a.getLatest(),c=b.__parent,d=J();let e=I(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;G(a)?d.set(b,!0):e._dirtyLeaves.add(b)}function Fb(a){let b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Gb(b);null!==a&&Gb(a)}
|
|
18
|
+
function K(a){H();var b=I();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=L(c),null!==b&&b.getWritable()),null!==a&&(a=L(a),null!==a&&a.getWritable()))}function Hb(){return M?null:I()._compositionKey}function L(a,b){a=(b||J())._nodeMap.get(a);return void 0===a?null:a}function kb(a,b){let c=I();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function ib(a,b){for(;null!=a;){let c=kb(a,b);if(null!==c)return c;a=a.parentNode}return null}
|
|
19
|
+
function Ib(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Jb(a){return a.read(()=>Kb().getTextContent())}function Lb(a,b){A(a,()=>{var c=J();if(!c.isEmpty())if("root"===b)Kb().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Kb(){return J()._nodeMap.get("root")}function lb(a){let b=J();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
|
|
20
|
+
function Mb(a){var b=I(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?L("root"):null):L(c)}function Nb(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function Ob(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Pb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
|
21
|
+
function Qb(a,b){var c=t?window.getSelection():null;if(null!==c){var d=c.anchorNode,{anchorOffset:e,focusOffset:f}=c;if(null!==d&&3===d.nodeType&&(c=ib(d),D(c))){d=d.nodeValue;if(d===Ta&&b){let g=b.length;d=b;f=e=g}null!==d&&jb(c,d,e,f,a)}}}
|
|
22
|
+
function jb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){var g=f.isComposing();a=b;(g||e)&&b[b.length-1]===Ta&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(K(null),Qa||Ra)f.remove();else{let h=I();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=Rb(),f.isToken()||null!==Hb()&&!g||null!==e&&E(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=x(),E(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
|
|
23
|
+
(c=f.getTextContent(),c=N(c),f.replace(c),f=c)),f.setTextContent(a))}}function Sb(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(D(b)||G(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
|
|
24
|
+
function Tb(a,b){let c=a.anchor,d=a.focus,e=c.getNode();var f=t?window.getSelection():null;f=null!==f?f.anchorNode:null;let g=c.key,h=I().getElementByKey(g),k=b.length;return g!==d.key||!D(e)||(2>k||Nb(b))&&c.offset!==d.offset&&!e.isComposing()||xb(e)||e.isDirty()&&1<k||null!==h&&!e.isComposing()&&f!==yb(h)||e.getFormat()!==a.format||Sb(a,e)}function Ub(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}
|
|
25
|
+
function Vb(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&r(33),b=b.klass,d=a.get(b),void 0===d&&(d=new Map,a.set(b,d)),d.has(c)||d.set(c,e))}function Wb(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
|
|
26
|
+
function Xb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Wb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Wb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function mb(a){a=(a=sb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Yb(a){return!O(a)&&!a.isLastChild()&&!a.isInline()}
|
|
27
|
+
function Zb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&r(75);return a}function dc(a,b=0){0!==b&&r(1);b=x();if(!E(b)||!G(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();ec(e,a)&&c.set(a.__key,0,"element");ec(f,a)&&d.set(a.__key,0,"element");return b}function ec(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function sb(a){a=a._window;null===a&&r(78);return a}
|
|
28
|
+
function fc(a){for(a=a.getParentOrThrow();null!==a&&!gc(a);)a=a.getParentOrThrow();return a}function gc(a){return O(a)||G(a)&&a.isShadowRoot()}
|
|
29
|
+
function hc(a){var b=I();let c=a.constructor.getType();b=b._nodes.get(c);if(void 0===b)throw Error('$initializeNode failed. Ensure node has been registered to the editor. You can do this by passing the node class via the "nodes" array in the editor config.');b=b.replace;if(null!==b){b=b(a);if(!(b instanceof a.constructor))throw Error("$initializeNode failed. Ensure replacement node is a subclass of the original node.");return b}return a}
|
|
30
|
+
function ic(a,b,c,d,e){a=a.__children;let f=a.length;for(let g=0;g<f;g++){let h=a[g],k=d.get(h);void 0!==k&&k.__parent===b&&(G(k)&&ic(k,h,c,d,e),c.has(h)||e.delete(h),d.delete(h))}}function jc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let e of c){let f=b.get(e);void 0===f||f.isAttached()||(a.has(e)||c.delete(e),b.delete(e))}for(let [e]of d)c=b.get(e),void 0===c||c.isAttached()||(G(c)&&ic(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
|
|
31
|
+
function kc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function lc(a,b){let c=a.mergeWithSibling(b),d=I()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
|
32
|
+
function mc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&D(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{kc(b,a)&&(a=lc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&D(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{kc(a,c)&&lc(a,c);break}}}function nc(a){oc(a.anchor);oc(a.focus);return a}
|
|
33
|
+
function oc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(D(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!G(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let P="",Q="",R="",pc,T,qc,rc=!1,sc=!1,tc,uc=null,vc,wc,xc,yc,zc,Ac;
|
|
34
|
+
function Bc(a,b){let c=xc.get(a);if(null!==b){let d=Cc(a);b.removeChild(d)}yc.has(a)||T._keyToDOMMap.delete(a);G(c)&&(a=c.__children,Dc(a,0,a.length-1,null));void 0!==c&&Vb(Ac,qc,tc,c,"destroyed")}function Dc(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Bc(e,d)}}function Ec(a,b){a.setProperty("text-align",b)}function Fc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
|
|
35
|
+
function Gc(a,b){a=a.style;0===b?Ec(a,""):1===b?Ec(a,"left"):2===b?Ec(a,"center"):3===b?Ec(a,"right"):4===b&&Ec(a,"justify")}
|
|
36
|
+
function Hc(a,b,c){let d=yc.get(a);void 0===d&&r(60);let e=d.createDOM(pc,T);var f=T._keyToDOMMap;e["__lexicalKey_"+T._key]=a;f.set(a,e);D(d)?e.setAttribute("data-lexical-text","true"):C(d)&&e.setAttribute("data-lexical-decorator","true");if(G(d)){a=d.__indent;0!==a&&Fc(e,a);a=d.__children;var g=a.length;if(0!==g){f=a;--g;let h=Q;Q="";Ic(f,0,g,e,null);Jc(d,e);Q=h}f=d.__format;0!==f&&Gc(e,f);d.isInline()||Kc(null,a,e);Yb(d)&&(P+="\n\n",R+="\n\n")}else f=d.getTextContent(),C(d)?(g=d.decorate(T,pc),
|
|
37
|
+
null!==g&&Lc(a,g),e.contentEditable="false"):D(d)&&(d.isDirectionless()||(Q+=f)),P+=f,R+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Vb(Ac,qc,tc,d,"created");return e}function Ic(a,b,c,d,e){let f=P;for(P="";b<=c;++b)Hc(a[b],d,e);d.__lexicalTextContent=P;P=f+P}function Mc(a,b){a=b.get(a[a.length-1]);return Bb(a)||C(a)}
|
|
38
|
+
function Kc(a,b,c){a=null!==a&&(0===a.length||Mc(a,xc));b=null!==b&&(0===b.length||Mc(b,yc));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
|
39
|
+
function Jc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==uc){let f=""===Q;if(f)var d=uc;else d=Q,d=Va.test(d)?"rtl":Wa.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=pc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);sc||(a.getWritable().__dir=d)}uc=
|
|
38
40
|
d;b.__lexicalDirTextContent=Q;b.__lexicalDir=d}}
|
|
39
|
-
function
|
|
40
|
-
a!==c.__format&&
|
|
41
|
-
z++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let
|
|
42
|
-
d.decorate(T,
|
|
43
|
-
let U=Object.freeze({}),
|
|
44
|
-
function
|
|
45
|
-
let n=l.length;for(let q=0;q<n;q++){let v=l[q];if(D(v)&&(m=!0,k&=v.getFormat(),0===k))break}h.format=m?k:0}}V(b,ba,void 0)}})}function
|
|
46
|
-
function
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function
|
|
52
|
-
function
|
|
53
|
-
function
|
|
54
|
-
function
|
|
55
|
-
V(b,da,!0)):27===c?V(b,Ba,a):(h=u?d||g||f?!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?V(b,Ca,a):(a.preventDefault(),V(b,da,!1)):8===c&&(u?g:e)?(a.preventDefault(),V(b,
|
|
56
|
-
f?90===c&&!d&&(u?f:e)?(a.preventDefault(),V(b,
|
|
57
|
-
function
|
|
58
|
-
function
|
|
41
|
+
function Nc(a,b){var c=xc.get(a),d=yc.get(a);void 0!==c&&void 0!==d||r(61);var e=rc||wc.has(a)||vc.has(a);let f=Zb(T,a);if(c===d&&!e)return G(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,R+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),D(c)&&!c.isDirectionless()&&(Q+=d),R+=d,P+=d),f;c!==d&&e&&Vb(Ac,qc,tc,d,"updated");if(d.updateDOM(c,f,pc))return d=Hc(a,null,null),null===b&&r(62),b.replaceChild(d,f),Bc(a,null),d;if(G(c)&&G(d)){a=d.__indent;a!==c.__indent&&Fc(f,a);a=d.__format;
|
|
42
|
+
a!==c.__format&&Gc(f,a);a=c.__children;c=d.__children;if(a!==c||e){var g=a,h=c;e=d;b=Q;Q="";let v=P;P="";var k=g.length,m=h.length;if(1===k&&1===m){var l=g[0];h=h[0];if(l===h)Nc(l,f);else{var n=Cc(l);h=Hc(h,null,null);f.replaceChild(h,n);Bc(l,null)}}else if(0===k)0!==m&&Ic(h,0,m-1,f,null);else if(0===m)0!==k&&(l=null==f.__lexicalLineBreak,Dc(g,0,k-1,l?null:f),l&&(f.textContent=""));else{let w=k-1;k=m-1;let y=f.firstChild,z=0;for(m=0;z<=w&&m<=k;){var q=g[z];let B=h[m];if(q===B)y=Nc(B,f).nextSibling,
|
|
43
|
+
z++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let F=n.has(q),S=l.has(B);F?(S?(q=Zb(T,B),q===y?y=Nc(B,f).nextSibling:(null!=y?f.insertBefore(q,y):f.appendChild(q),Nc(B,f)),z++):Hc(B,f,y),m++):(y=Cc(q).nextSibling,Bc(q,f),z++)}}l=z>w;n=m>k;l&&!n?(l=h[k+1],l=void 0===l?null:T.getElementByKey(l),Ic(h,m,k,f,l)):n&&!l&&Dc(g,z,w,f)}Yb(e)&&(P+="\n\n");f.__lexicalTextContent=P;P=v+P;Jc(e,f);Q=b;O(d)||d.isInline()||Kc(a,c,f)}Yb(d)&&(P+="\n\n",R+="\n\n")}else c=d.getTextContent(),C(d)?(e=
|
|
44
|
+
d.decorate(T,pc),null!==e&&Lc(a,e)):D(d)&&!d.isDirectionless()&&(Q+=c),P+=c,R+=c;!sc&&O(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return f}function Lc(a,b){let c=T._pendingDecorators,d=T._decorators;if(null===c){if(d[a]===b)return;c=Ib(T)}c[a]=b}function Cc(a){a=zc.get(a);void 0===a&&r(75);return a}
|
|
45
|
+
let U=Object.freeze({}),Uc=[["keydown",Oc],["mousedown",Pc],["compositionstart",Qc],["compositionend",Rc],["input",Sc],["click",Tc],["cut",U],["copy",U],["dragstart",U],["dragover",U],["dragend",U],["paste",U],["focus",U],["blur",U],["drop",U]];Pa&&Uc.push(["beforeinput",(a,b)=>Vc(a,b)]);let Wc=0,Xc=0,Yc=0,Zc=!1,$c=!1,ad=!1,bd=!1,cd=[0,0,"root",0];function dd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
|
46
|
+
function ed(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Zc&&(Zc=!1,dd(d,e)&&dd(f,g)))return;A(b,()=>{if(!c)lb(null);else if(vb(b,d,f)){var h=x();if(E(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var l=sb(b).event;l=l?l.timeStamp:performance.now();let [n,q,v,w]=cd;l<w+200&&k.offset===q&&k.key===v?h.format=n:"text"===k.type?h.format=m.getFormat():"element"===k.type&&(h.format=0)}else{k=127;m=!1;l=h.getNodes();
|
|
47
|
+
let n=l.length;for(let q=0;q<n;q++){let v=l[q];if(D(v)&&(m=!0,k&=v.getFormat(),0===k))break}h.format=m?k:0}}V(b,ba,void 0)}})}function Tc(a,b){A(b,()=>{let c=x(),d=t?window.getSelection():null,e=Rb();if(E(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Kb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}V(b,ca,a)})}
|
|
48
|
+
function Pc(a,b){let c=a.target;c instanceof Node&&A(b,()=>{C(ib(c))||($c=!0)})}function fd(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function gd(a,b){return a!==b||G(a)||G(b)||!a.isToken()||!b.isToken()}
|
|
49
|
+
function Vc(a,b){let c=a.inputType;"deleteCompositionText"===c||Oa&&mb(b)||"insertCompositionText"!==c&&A(b,()=>{let d=x();if("deleteContentBackward"===c){if(null===d){var e=Rb();if(!E(e))return;lb(e.clone())}if(E(d)){229===Xc&&a.timeStamp<Wc+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),Wc=0,setTimeout(()=>{A(b,()=>{K(null)})},30),E(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),V(b,da,!0));return}}if(E(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
|
|
50
|
+
fd(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),V(b,ea,!1)):"\n\n"===e?(a.preventDefault(),V(b,ha,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&Tb(d,e)&&(a.preventDefault(),V(b,ia,e));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,ia,a);break;case "insertFromComposition":K(null);V(b,
|
|
51
|
+
ia,a);break;case "insertLineBreak":K(null);V(b,ea,!1);break;case "insertParagraph":K(null);ad?(ad=!1,V(b,ea,!1)):V(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,ja,a);break;case "deleteByComposition":gd(g,f)&&V(b,ka,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,ka,void 0);break;case "deleteContent":V(b,da,!1);break;case "deleteWordBackward":V(b,ma,!0);break;case "deleteWordForward":V(b,ma,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,
|
|
52
|
+
na,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,na,!1);break;case "formatStrikeThrough":V(b,p,"strikethrough");break;case "formatBold":V(b,p,"bold");break;case "formatItalic":V(b,p,"italic");break;case "formatUnderline":V(b,p,"underline");break;case "historyUndo":V(b,oa,void 0);break;case "historyRedo":V(b,pa,void 0)}}})}
|
|
53
|
+
function Sc(a,b){a.stopPropagation();A(b,()=>{var c=x(),d=a.data;null!=d&&E(c)&&Tb(c,d)?(bd&&(hd(b,d),bd=!1),V(b,ia,d),d=d.length,Oa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d),Qa||Ra||!b.isComposing()||(Wc=0,K(null))):(Qb(!1),bd&&(hd(b,d||void 0),bd=!1));H();c=I();nb(c)})}
|
|
54
|
+
function Qc(a,b){A(b,()=>{let c=x();if(E(c)&&!b.isComposing()){let d=c.anchor;K(d.key);(a.timeStamp<Wc+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&V(b,ia,Ua)}})}
|
|
55
|
+
function hd(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=yb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&D(b)&&jb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=x(),E(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);V(a,ya,null);return}}Qb(!0,b)}function Rc(a,b){Oa?bd=!0:A(b,()=>{hd(b,a.data)})}
|
|
56
|
+
function Oc(a,b){if(!0!==a._lexicalHandled&&(a._lexicalHandled=!0,Wc=a.timeStamp,Xc=a.keyCode,!b.isComposing())){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)ad=!0,V(b,ya,a);else if(32===c)V(b,za,a);else if(u&&e&&79===c)a.preventDefault(),ad=!0,V(b,ea,!0);else if(13!==c||d){var h=u?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?V(b,Aa,a):(a.preventDefault(),
|
|
57
|
+
V(b,da,!0)):27===c?V(b,Ba,a):(h=u?d||g||f?!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?V(b,Ca,a):(a.preventDefault(),V(b,da,!1)):8===c&&(u?g:e)?(a.preventDefault(),V(b,ma,!0)):46===c&&(u?g:e)?(a.preventDefault(),V(b,ma,!1)):u&&f&&8===c?(a.preventDefault(),V(b,na,!0)):u&&f&&46===c?(a.preventDefault(),V(b,na,!1)):66===c&&!g&&(u?f:e)?(a.preventDefault(),V(b,p,"bold")):85===c&&!g&&(u?f:e)?(a.preventDefault(),V(b,p,"underline")):73===c&&!g&&(u?f:e)?(a.preventDefault(),V(b,p,"italic")):9!==c||g||e||
|
|
58
|
+
f?90===c&&!d&&(u?f:e)?(a.preventDefault(),V(b,oa,void 0)):(h=u?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),V(b,pa,void 0)):id(b._editorState._selection)&&(h=d?!1:67===c?u?f:e:!1,h?(a.preventDefault(),V(b,Ia,a)):(h=d?!1:88===c?u?f:e:!1,h&&(a.preventDefault(),V(b,Ja,a))))):V(b,Da,a))}else ad=!1,V(b,ya,a);else V(b,va,a);else V(b,ua,a);else V(b,ta,a);else V(b,sa,a);else V(b,ra,a);else V(b,qa,a);(e||d||g||f)&&V(b,Ma,a)}}
|
|
59
|
+
function jd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let kd=new Map;function ld(){let a=t?window.getSelection():null;if(null!==a){var b=wb(a.anchorNode);if(null!==b){$c&&($c=!1,A(b,()=>{var g=Rb(),h=a.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=md(g,a,b),lb(g))}));var c=Ob(b);c=c[c.length-1];var d=c._key,e=kd.get(d),f=e||c;f!==b&&ed(a,f,!1);ed(a,b,!0);b!==c?kd.set(d,b):e&&kd.delete(d)}}}
|
|
60
|
+
function nd(a,b){0===Yc&&a.ownerDocument.addEventListener("selectionchange",ld);Yc++;a.__lexicalEditor=b;let c=jd(a);for(let d=0;d<Uc.length;d++){let [e,f]=Uc[d],g="function"===typeof f?h=>{b.isEditable()&&f(h,b)}:h=>{if(b.isEditable())switch(e){case "cut":return V(b,Ja,h);case "copy":return V(b,Ia,h);case "paste":return V(b,ja,h);case "dragstart":return V(b,Fa,h);case "dragover":return V(b,Ga,h);case "dragend":return V(b,Ha,h);case "focus":return V(b,Ka,h);case "blur":return V(b,La,h);case "drop":return V(b,
|
|
59
61
|
Ea,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
|
|
60
62
|
class X{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(G(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}G(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=L(this.key);null===a&&r(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
|
|
61
|
-
M||(
|
|
62
|
-
function
|
|
63
|
-
class
|
|
64
|
-
b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(D(e))e=e.select();else{let f=e.getIndexWithinParent()+1;e=e.getParentOrThrow().select(f,f)}e.insertNodes(a,b);for(a=0;a<d;a++)c[a].remove();return!0}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=L(c),null!==b&&a.push(b);M||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function
|
|
65
|
-
class
|
|
66
|
-
b){let c=this.focus.getNode();return
|
|
67
|
-
this._cachedNodes;if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=L(this.gridKey);
|
|
68
|
-
a[c].getTextContent();return b}}function
|
|
69
|
-
class
|
|
70
|
-
b?b:a);G(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?G(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);M||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){
|
|
71
|
-
(g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,D(m)){let l=m.getTextContent();m===b?l=m===c?e<f?l.slice(e,f):l.slice(f,e):d?l.slice(e):l.slice(f):m===c&&(l=d?l.slice(0,f):l.slice(0,e));g+=l}else!C(m)&&!
|
|
72
|
-
null}}clone(){let a=this.anchor,b=this.focus;return new
|
|
73
|
-
b.isBefore(c),e=this.format;d&&"element"===b.type?
|
|
74
|
-
n.select(0,0);b=n;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!m.canInsertTextBefore()&&null===b.getPreviousSibling())){n=b.getPreviousSibling();if(!D(n)||
|
|
75
|
-
a||(n=l.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!G(n)||n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");
|
|
63
|
+
M||(Hb()===e&&K(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function od(a,b){let c=b.__key,d=a.offset,e="element";if(D(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!G(b)){var f=b.getNextSibling();if(D(f))c=f.__key,d=0;else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function pd(a,b){if(G(b)){let c=b.getLastDescendant();G(c)||D(c)?od(a,c):od(a,b)}else od(a,b)}
|
|
64
|
+
function qd(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=N(),g=O(d)?rd().append(f):f;f.setFormat(c);null===e?d.append(g):e.insertBefore(g);a.is(b)&&b.set(f.__key,0,"text");a.set(f.__key,0,"text")}function sd(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
|
65
|
+
class td{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!id(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new td(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
|
|
66
|
+
b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(D(e))e=e.select();else{let f=e.getIndexWithinParent()+1;e=e.getParentOrThrow().select(f,f)}e.insertNodes(a,b);for(a=0;a<d;a++)c[a].remove();return!0}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=L(c),null!==b&&a.push(b);M||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function E(a){return a instanceof ud}
|
|
67
|
+
class vd{constructor(a,b,c){this.gridKey=a;this.anchor=b;this.focus=c;this.dirty=!1;this._cachedNodes=null;b._selection=this;c._selection=this}is(a){return wd(a)?this.gridKey===a.gridKey&&this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new vd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return xd(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
|
|
68
|
+
b){let c=this.focus.getNode();return nc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=L(this.anchor.key);null===a&&r(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=L(this.focus.key);null===c&&r(22);var d=c.getIndexWithinParent();let e=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,e);a=Math.max(a,e);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){var a=
|
|
69
|
+
this._cachedNodes;if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=L(this.gridKey);yd(f)||r(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);zd(g)||r(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];Ad(h)||r(25);a.add(h);for(h=h.getChildren();0<h.length;){let l=h.shift();a.add(l);G(l)&&h.unshift(...l.getChildren())}}}a=Array.from(a);M||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=
|
|
70
|
+
a[c].getTextContent();return b}}function wd(a){return a instanceof vd}
|
|
71
|
+
class ud{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return E(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this.anchor,c=this.focus;a=b.getNode();let d=c.getNode();G(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
|
|
72
|
+
b?b:a);G(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?G(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);M||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){sd(this.anchor,a.__key,b,"text");sd(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[e,f]=xd(this),g="",h=!0;for(let k=0;k<a.length;k++){let m=a[k];if(G(m)&&!m.isInline())h||
|
|
73
|
+
(g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,D(m)){let l=m.getTextContent();m===b?l=m===c?e<f?l.slice(e,f):l.slice(f,e):d?l.slice(e):l.slice(f):m===c&&(l=d?l.slice(0,f):l.slice(0,e));g+=l}else!C(m)&&!Bb(m)||m===c&&this.isCollapsed()||(g+=m.getTextContent())}return g}applyDOMRange(a){let b=I(),c=b.getEditorState()._selection;a=Bd(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;sd(this.anchor,d.key,d.offset,d.type);sd(this.focus,e.key,e.offset,e.type);this._cachedNodes=
|
|
74
|
+
null}}clone(){let a=this.anchor,b=this.focus;return new ud(new X(a.key,a.offset,a.type),new X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=zb(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&Xa[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let e=b[d];""!==e&&a.push(N(e));d!==c-1&&a.push(Cd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
|
|
75
|
+
b.isBefore(c),e=this.format;d&&"element"===b.type?qd(b,c,e):d||"element"!==c.type||qd(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=f[0];D(b)||r(26);d=b.getTextContent().length;var m=b.getParentOrThrow(),l=f[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!m.canInsertTextAfter()&&null===b.getNextSibling())){var n=b.getNextSibling();if(!D(n)||xb(n))n=N(),n.setFormat(e),m.canInsertTextAfter()?b.insertAfter(n):m.insertAfter(n);
|
|
76
|
+
n.select(0,0);b=n;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!m.canInsertTextBefore()&&null===b.getPreviousSibling())){n=b.getPreviousSibling();if(!D(n)||xb(n))n=N(),n.setFormat(e),m.canInsertTextBefore()?b.insertBefore(n):m.insertBefore(n);n.select();b=n;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)m=N(b.getTextContent()),m.setFormat(e),b.replace(m),b=m;else if(!(this.isCollapsed()||""===
|
|
77
|
+
a||(n=l.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!G(n)||n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");Dd(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(b.isToken())a=N(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=N(a);f.setFormat(e);f.select();0===c?b.insertBefore(f):([g]=b.splitText(c),g.insertAfter(f));f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
|
|
76
78
|
a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:this.format=f)}else{e=new Set([...b.getParentKeys(),...l.getParentKeys()]);var q=G(b)?b:b.getParentOrThrow();m=G(l)?l:l.getParentOrThrow();n=l;if(!q.is(m)&&m.isInline()){do n=m,m=m.getParentOrThrow();while(m.isInline())}"text"===h.type&&(0!==k||""===l.getTextContent())||"element"===h.type&&l.getIndexWithinParent()<k?D(l)&&!l.isToken()&&k!==l.getTextContentSize()?
|
|
77
79
|
(l.isSegmented()&&(h=N(l.getTextContent()),l.replace(h),l=h),l=l.spliceText(0,k,""),e.add(l.__key)):(h=l.getParentOrThrow(),h.canBeEmpty()||1!==h.getChildrenSize()?l.remove():h.remove()):e.add(l.__key);h=m.getChildren();k=new Set(f);l=q.is(m);q=q.isInline()&&null===b.getNextSibling()?q:b;for(let v=h.length-1;0<=v;v--){let w=h[v];if(w.is(b)||G(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(n)?l||q.insertAfter(w):w.remove())}if(!l)for(h=m,k=null;null!==h;){l=h.getChildren();m=l.length;if(0===
|
|
78
|
-
m||l[m-1].is(k))e.delete(h.__key),k=h;h=h.getParent()}b.isToken()?c===d?b.select():(a=N(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),
|
|
79
|
-
|
|
80
|
+
m||l[m-1].is(k))e.delete(h.__key),k=h;h=h.getParent()}b.isToken()?c===d?b.select():(a=N(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=f[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),K(null);else{var b=this.getNodes(),c=[];for(var d of b)D(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),
|
|
81
|
+
K(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var m=e-1,l=c[m];e="text"===d.type?d.offset:l.getTextContentSize();if(k.is(l))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),
|
|
80
82
|
this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var n=l.getFormatFlags(a,g);0<e&&(e!==l.getTextContentSize()&&([l]=l.splitText(e)),l.setFormat(n));for(h+=1;h<m;h++){let q=c[h];if(!q.isToken()){let v=q.getFormatFlags(a,n);q.setFormat(v)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(l.__key,e,"text");this.format=g|n}}}}}insertNodes(a,b){if(!this.isCollapsed()){var c=this.isBackward()?this.anchor:this.focus,d=c.getNode().getNextSibling();d=d?d.getKey():null;c=(c=
|
|
81
83
|
c.getNode().getPreviousSibling())?c.getKey():null;this.removeText();if(this.isCollapsed()&&"element"===this.focus.type){if(this.focus.key===d&&0===this.focus.offset){var e=N();this.focus.getNode().insertBefore(e)}else this.focus.key===c&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(e=N(),this.focus.getNode().insertAfter(e));e&&(this.focus.set(e.__key,0,"text"),this.anchor.set(e.__key,0,"text"))}}d=this.anchor;c=d.offset;var f=d.getNode();e=f;"element"===d.type&&(e=d.getNode(),d=e.getChildAtIndex(c-
|
|
82
|
-
1),e=null===d?e:d);d=[];var g=f.getNextSiblings(),h=
|
|
83
|
-
if(
|
|
84
|
-
e.append(l),e=l):e=e.insertAfter(l)}else n=e.getFirstChild(),null!==n?n.insertBefore(l):e.append(l),e=l;else!G(l)||G(l)&&l.isInline()||C(e)&&!e.isInline()?(m=l,e=e.insertAfter(l)):(l=e.getParentOrThrow(),
|
|
85
|
-
d.length)for(b=e,a=d.length-1;0<=a;a--)c=d[a],h=c.getParentOrThrow(),!G(e)||
|
|
86
|
-
b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var e=d.getNextSiblings().reverse();var f=d.getParentOrThrow();var g=f.isInline(),h=g?f.getTextContentSize():d.getTextContentSize();0===b?e.push(d):(g&&(c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(
|
|
84
|
+
1),e=null===d?e:d);d=[];var g=f.getNextSiblings(),h=gc(f)?null:f.getTopLevelElementOrThrow();if(D(f))if(e=f.getTextContent().length,0===c&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),d.push(f);else if(c===e)e=f;else{if(f.isToken())return!1;[e,f]=f.splitText(c);d.push(f)}f=e;d.push(...g);g=a[0];var k=!1,m=null;for(let v=0;v<a.length;v++){var l=a[v];if(C(e)||!G(l)||l.isInline())k&&!C(l)&&gc(e.getParent())&&r(28);else{if(l.is(g)){if(G(e)&&e.isEmpty()&&e.canReplaceWith(l)){e.replace(l);
|
|
85
|
+
e=l;k=!0;continue}var n=l.getFirstDescendant();if(Ab(n)){for(n=n.getParentOrThrow();n.isInline();)n=n.getParentOrThrow();m=n.getChildren();k=m.length;if(G(e))for(var q=0;q<k;q++)e.append(m[q]);else{for(q=k-1;0<=q;q--)e.insertAfter(m[q]);e=e.getParentOrThrow()}m=m[k-1];n.remove();k=!0;if(n.is(l))continue}}D(e)&&(null===h&&r(27),e=h)}k=!1;if(G(e)&&!e.isInline())if(m=l,C(l)&&!l.isInline())e=e.insertAfter(l);else if(G(l)){if(l.canBeEmpty()||!l.isEmpty())O(e)?(n=e.getChildAtIndex(c),null!==n?n.insertBefore(l):
|
|
86
|
+
e.append(l),e=l):e=e.insertAfter(l)}else n=e.getFirstChild(),null!==n?n.insertBefore(l):e.append(l),e=l;else!G(l)||G(l)&&l.isInline()||C(e)&&!e.isInline()?(m=l,e=e.insertAfter(l)):(l=e.getParentOrThrow(),Bb(e)&&e.remove(),e=l,v--)}b&&(D(f)?f.select():(a=e.getPreviousSibling(),D(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(G(e)){if(a=D(m)?m:G(m)&&m.isInline()?m.getLastDescendant():e.getLastDescendant(),b||(null===a?e.select():D(a)?a.select():a.selectNext()),0!==
|
|
87
|
+
d.length)for(b=e,a=d.length-1;0<=a;a--)c=d[a],h=c.getParentOrThrow(),!G(e)||Ed(c)||C(c)&&!c.isInline()?G(e)||Ed(c)?G(c)&&!c.canInsertAfter(e)?(f=h.constructor.clone(h),G(f)||r(29),f.append(c),e.insertAfter(f)):e.insertAfter(c):(e.insertBefore(c),e=c):(b===e?e.append(c):e.insertBefore(c),e=c),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(D(e)?e.select():(b=e.getParentOrThrow(),a=e.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,
|
|
88
|
+
b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var e=d.getNextSiblings().reverse();var f=d.getParentOrThrow();var g=f.isInline(),h=g?f.getTextContentSize():d.getTextContentSize();0===b?e.push(d):(g&&(c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(gc(f)){e=rd();c=f.getChildAtIndex(b);e.select();null!==c?c.insertBefore(e):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=f.getParentOrThrow(),
|
|
87
89
|
e=c.insertNewAfter(this),G(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this),null===g)this.insertLineBreak();else if(G(g))if(h=f.getFirstChild(),0===b&&(f.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)f.insertBefore(g);else{f=null;b=c.length;a=g.getParentOrThrow();if(0<b)for(h=0;h<b;h++)a.append(c[h]);if(0!==d)for(c=0;c<d;c++)b=e[c],null===f?g.append(b):f.insertBefore(b),f=b;g.canBeEmpty()||0!==g.getChildrenSize()?g.selectStart():(g.selectPrevious(),g.remove())}}insertLineBreak(a){let b=
|
|
88
|
-
|
|
89
|
-
a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));D(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=
|
|
90
|
-
(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(d=t?window.getSelection():null)if(d.modify(a,b?"backward":"forward",c),0<d.rangeCount&&(e=d.getRangeAt(0),g=
|
|
91
|
-
if(d.anchorNode!==e.startContainer||d.anchorOffset!==e.startOffset)b=this.focus,f=this.anchor,d=f.key,e=f.offset,g=f.type,
|
|
92
|
-
a,"character");if(!this.isCollapsed()){var e="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){
|
|
93
|
-
f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),
|
|
94
|
-
function
|
|
95
|
-
function
|
|
96
|
-
function
|
|
97
|
-
d=0===b&&C(f)&&
|
|
98
|
-
function
|
|
99
|
-
b)&&null===d&&G(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),D(b)&&(a.key=b.__key,a.offset=0)))}function
|
|
100
|
-
function
|
|
101
|
-
function
|
|
102
|
-
function
|
|
103
|
-
function x(){return
|
|
104
|
-
function
|
|
105
|
-
function
|
|
106
|
-
1):g.getChildAtIndex(e),D(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function
|
|
107
|
-
function
|
|
108
|
-
function
|
|
109
|
-
function
|
|
110
|
-
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);z=a._decorators;y=a._pendingDecorators||z;var
|
|
114
|
-
|
|
115
|
-
g.isCollapsed()&&null!==c&&c===
|
|
116
|
-
f&&
|
|
117
|
-
a._updating=!0;try{for(e=0;e<m.length;e++)m[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [W,
|
|
118
|
-
function V(a,b,c){if(!1===a._updating||Z!==a){let f=!1;a.update(()=>{f=V(a,b,c)});return f}let d=
|
|
119
|
-
function
|
|
120
|
-
function
|
|
121
|
-
e=
|
|
122
|
-
l,
|
|
123
|
-
function
|
|
124
|
-
function
|
|
125
|
-
class
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
d=
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
class
|
|
137
|
-
class ie extends ge{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return ab[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){let d=L(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===
|
|
90
|
+
Cd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),O(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return xd(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=xd(this);if(0===b)return[];if(1===b)return D(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);D(f)&&(d=b?h:k,d===f.getTextContentSize()?
|
|
91
|
+
a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));D(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=Xb(d,b);if(C(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Fd(),b.add(g.__key),lb(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),D(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),G(a)?(c=a.__key,g=b?a.getChildrenSize():0):
|
|
92
|
+
(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(d=t?window.getSelection():null)if(d.modify(a,b?"backward":"forward",c),0<d.rangeCount&&(e=d.getRangeAt(0),g=fc(this.anchor.getNode()),this.applyDOMRange(e),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(let h=0;h<f.length;h++){let k=f[h];ec(k,g)?a.push(k):c=!0}c&&0<a.length&&(b?(b=a[0],G(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],G(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));
|
|
93
|
+
if(d.anchorNode!==e.startContainer||d.anchorOffset!==e.startOffset)b=this.focus,f=this.anchor,d=f.key,e=f.offset,g=f.type,sd(f,b.key,b.offset,b.type),sd(b,d,e,g),this._cachedNodes=null}}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&G(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),G(d)&&!d.canExtractContents()))return;this.modify("extend",
|
|
94
|
+
a,"character");if(!this.isCollapsed()){var e="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){Gd(e,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){Gd(d,a,b);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;let h=f<g;c=h?f:g;g=h?g:f;
|
|
95
|
+
f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),Nb(b)||(a?e.offset=f:d.offset=f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}
|
|
96
|
+
function id(a){return a instanceof td}function Hd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function xd(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[Hd(b),Hd(a)]}
|
|
97
|
+
function Gd(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
|
98
|
+
function Id(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var e=a.childNodes;var f=e.length;d===f&&(g=!0,d=f-1);e=Mb(e[d]);if(D(e))d=g?e.getTextContentSize():0;else{f=Mb(a);if(null===f)return null;if(G(f)){a=f.getChildAtIndex(d);if(b=G(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,d=0):(a=c,f=a.getParentOrThrow()));D(a)?(e=a,f=null,d=g?a.getTextContentSize():0):a!==f&&g&&d++}else d=f.getIndexWithinParent(),
|
|
99
|
+
d=0===b&&C(f)&&Mb(a)===f?d:d+1,f=f.getParentOrThrow();if(G(f))return new X(f.__key,d,"element")}}else e=Mb(a);return D(e)?new X(e.__key,d,"text"):null}
|
|
100
|
+
function Sd(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&G(e)&&e.isInline()&&(b=e.getPreviousSibling(),D(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):G(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):D(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&G(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
|
|
101
|
+
b)&&null===d&&G(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),D(b)&&(a.key=b.__key,a.offset=0)))}function Dd(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Sd(a,d,e);Sd(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=I();d.isComposing()&&d._compositionKey!==a.key&&E(c)&&(d=c.anchor,c=c.focus,sd(a,d.key,d.offset,d.type),sd(b,c.key,c.offset,c.type))}}
|
|
102
|
+
function Bd(a,b,c,d,e,f){if(null===a||null===c||!vb(e,a,c))return null;b=Id(a,b,E(f)?f.anchor:null);if(null===b)return null;d=Id(c,d,E(f)?f.focus:null);if(null===d||"element"===b.type&&"element"===d.type&&(a=Mb(a),c=Mb(c),C(a)&&C(c)))return null;Dd(b,d,f);return[b,d]}function Ed(a){return G(a)&&!a.isInline()}function Td(a,b,c,d,e,f){let g=J();a=new ud(new X(a,b,e),new X(c,d,f),0);a.dirty=!0;return g._selection=a}function Fd(){return new td(new Set)}
|
|
103
|
+
function Ud(a){let b=a.getEditorState()._selection,c=t?window.getSelection():null;return id(b)||wd(b)?b.clone():md(b,c,a)}
|
|
104
|
+
function md(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!cb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!E(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&E(a)&&!vb(c,e,f))return a.clone()}else return a.clone();c=Bd(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new ud(h,k,E(a)?a.format:0)}
|
|
105
|
+
function x(){return J()._selection}function Rb(){return I()._editorState._selection}
|
|
106
|
+
function Vd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Wd(a));else{var k=a.isBackward();h=k?f:e;var m=h.getNode();e=k?e:f;f=e.getNode();b.is(m)&&(m=h.offset,c<=m&&h.set(g,Math.max(0,m+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));Wd(a)}}
|
|
107
|
+
function Wd(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())G(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),D(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(G(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);D(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}G(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
|
|
108
|
+
1):g.getChildAtIndex(e),D(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function Xd(a,b){b=b.getEditorState()._selection;a=a._selection;if(E(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
|
|
109
|
+
function Yd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,D(d)?(g=d.getTextContentSize(),h="text"):G(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,D(e)?h="text":G(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Zd(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}let Y=null,Z=null,M=!1,$d=!1,Db=0;function H(){M&&r(13)}
|
|
110
|
+
function J(){null===Y&&r(15);return Y}function I(){null===Z&&r(16);return Z}function ae(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&r(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function be(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),D(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&mc(b)}
|
|
111
|
+
function ce(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Hb(),f=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let l of g)g=a.get(l),D(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&mc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ae(b,g,f),c.add(l);g=b._dirtyLeaves;h=g.size;if(0<h){Db++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let l of k)if(k=l[0],m=l[1],"root"===k||m)g=a.get(k),void 0!==
|
|
112
|
+
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ae(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Db++}b._dirtyLeaves=c;b._dirtyElements=d}function de(a,b){var c=b.get(a.type);void 0===c&&r(17);c=c.klass;a.type!==c.getType()&&r(18);c=c.importJSON(a);a=a.children;if(G(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=de(a[d],b);c.append(e)}return c}function ee(a,b){let c=Y,d=M,e=Z;Y=a;M=!0;Z=null;try{return b()}finally{Y=c,M=d,Z=e}}
|
|
113
|
+
function fe(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless;if((null!==c||d)&&null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=Y,m=M,l=Z,n=a._updating,q=a._observer,v=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==q){Z=a;Y=b;M=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,z=a._dirtyLeaves;q.disconnect();Q=R=P="";rc=2===w;uc=null;T=a;pc=a._config;qc=a._nodes;tc=T._listeners.mutation;vc=y;wc=z;xc=e._nodeMap;yc=b._nodeMap;
|
|
114
|
+
sc=b._readOnly;zc=new Map(a._keyToDOMMap);var B=new Map;Ac=B;Nc("root",null);Ac=zc=pc=yc=xc=wc=vc=qc=T=void 0;v=B}catch(W){W instanceof Error&&a._onError(W);if($d)throw W;ge(a,null,c,b);rb(a);a._dirtyType=2;$d=!0;fe(a);$d=!1;return}finally{q.observe(c,{characterData:!0,childList:!0,subtree:!0}),a._updating=n,Y=k,M=m,Z=l}}b._readOnly||(b._readOnly=!0);n=a._dirtyLeaves;q=a._dirtyElements;B=a._normalizedNodes;w=a._updateTags;m=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,
|
|
115
|
+
a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);z=a._decorators;y=a._pendingDecorators||z;var F=b._nodeMap;for(Sa in y)F.has(Sa)||(y===z&&(y=Ib(a)),delete y[Sa]);d=d?null:t?window.getSelection():null;if(a._editable&&null!==d&&(h||null===g||g.dirty)){Z=a;Y=b;try{a:{let W=d.anchorNode,wa=d.focusNode,Ee=d.anchorOffset,Fe=d.focusOffset,ob=document.activeElement;if(!w.has("collaboration")||ob===c)if(E(g)){var S=g.anchor,aa=g.focus,Jd=S.key,xa=aa.key,Kd=Zb(a,Jd),Ld=Zb(a,xa),pb=
|
|
116
|
+
S.offset,Md=aa.offset,$b=g.format,Nd=g.isCollapsed();h=Kd;xa=Ld;var Sa=!1;"text"===S.type&&(h=yb(Kd),Sa=S.getNode().getFormat()!==$b);"text"===aa.type&&(xa=yb(Ld));if(null!==h&&null!==xa){if(Nd&&(null===f||Sa||E(f)&&f.format!==$b)){var Ge=performance.now();cd=[$b,pb,Jd,Ge]}if(Ee===pb&&Fe===Md&&W===h&&wa===xa&&("Range"!==d.type||!Nd)&&(null===c||null!==ob&&c.contains(ob)||c.focus({preventScroll:!0}),"element"!==S.type))break a;try{d.setBaseAndExtent(h,pb,xa,Md);if(!w.has("skip-scroll-into-view")&&
|
|
117
|
+
g.isCollapsed()&&null!==c&&c===ob){let ac=g instanceof ud&&"element"===g.anchor.type?h.childNodes[pb]||null:0<d.rangeCount?d.getRangeAt(0):null;if(null!==ac){let He=ac.getBoundingClientRect(),Od=c.ownerDocument,Pd=Od.defaultView;if(null!==Pd)for(var {top:bc,bottom:cc}=He,fa,la;null!==c;){let Qd=c===Od.body;if(Qd)fa=0,la=sb(a).innerHeight;else{let qb=c.getBoundingClientRect();fa=qb.top;la=qb.bottom}f=0;bc<fa?f=-(fa-bc):cc>la&&(f=cc-la);if(0!==f)if(Qd)Pd.scrollBy(0,f);else{let qb=c.scrollTop;c.scrollTop+=
|
|
118
|
+
f;let Rd=c.scrollTop-qb;bc-=Rd;cc-=Rd}c=c.parentElement}}}Zc=!0}catch(ac){}}}else null!==f&&vb(a,W,wa)&&d.removeAllRanges()}}finally{Z=l,Y=k}}if(null!==v)for(k=v,l=Array.from(a._listeners.mutation),v=l.length,fa=0;fa<v;fa++){let [W,wa]=l[fa];la=k.get(wa);void 0!==la&&W(la,{dirtyLeaves:n,updateTags:w})}k=a._pendingDecorators;null!==k&&(a._decorators=k,a._pendingDecorators=null,he("decorator",a,!0,k));k=Jb(e);l=Jb(b);k!==l&&he("textcontent",a,!0,l);he("update",a,!0,{dirtyElements:q,dirtyLeaves:n,editorState:b,
|
|
119
|
+
normalizedNodes:B,prevEditorState:e,tags:w});a._deferred=[];if(0!==m.length){b=a._updating;a._updating=!0;try{for(e=0;e<m.length;e++)m[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [W,wa]=b;ie(a,W,wa)}}}function he(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
|
|
120
|
+
function V(a,b,c){if(!1===a._updating||Z!==a){let f=!1;a.update(()=>{f=V(a,b,c)});return f}let d=Ob(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
|
|
121
|
+
function je(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
|
|
122
|
+
function ie(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new ke(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=Y;let k=M,m=Z,l=a._updating;Y=g;M=!1;a._updating=!0;Z=a;try{h&&(a._headless?null!=c._selection&&(g._selection=c._selection.clone()):g._selection=Ud(a));let n=a._compositionKey;
|
|
123
|
+
b();e=je(a,e);Xd(g,a);0!==a._dirtyType&&(e?be(g,a):ce(g,a),je(a),jc(c,g,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&(g._flushSync=!0);let q=g._selection;if(E(q)){let v=g._nodeMap,w=q.focus.key;void 0!==v.get(q.anchor.key)&&void 0!==v.get(w)||r(19)}else id(q)&&0===q._nodes.size&&(g._selection=null)}catch(n){n instanceof Error&&a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();fe(a);return}finally{Y=f,M=k,Z=m,
|
|
124
|
+
a._updating=l,Db=0}0!==a._dirtyType||le(g,a)?g._flushSync?(g._flushSync=!1,fe(a)):h&&ub(()=>{fe(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function A(a,b,c){a._updating?a._updates.push([b,c]):ie(a,b,c)}
|
|
125
|
+
function me(a,b,c){H();var d=a.__key;let e=a.getParent();if(null!==e){var f=dc(a),g=!1;if(E(f)&&b){var h=f.anchor;let k=f.focus;h.key===d&&(Yd(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Yd(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}h=e.getWritable().__children;d=h.indexOf(d);-1===d&&r(31);Fb(a);h.splice(d,1);a.getWritable().__parent=null;E(f)&&b&&!g&&Vd(f,e,d,-1);c||gc(e)||e.canBeEmpty()||!e.isEmpty()||me(e,b);O(e)&&e.isEmpty()&&e.selectEnd()}}
|
|
126
|
+
function ne(a){a=L(a);null===a&&r(63);return a}
|
|
127
|
+
class oe{static getType(){r(64)}static clone(){r(65)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;Cb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=L(a);if(null===a)break;a=a.__parent}return!1}isSelected(){let a=x();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return D(this)?b:E(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?
|
|
128
|
+
!1:b}getKey(){return this.__key}getIndexWithinParent(){let a=this.getParent();return null===a?-1:a.__children.indexOf(this.__key)}getParent(){let a=this.getLatest().__parent;return null===a?null:L(a)}getParentOrThrow(){let a=this.getParent();null===a&&r(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(gc(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=this.getTopLevelElement();null===a&&r(67);return a}getParents(){let a=[],b=this.getParent();for(;null!==
|
|
129
|
+
b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;let b=a.indexOf(this.__key);return 0>=b?null:L(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(0,b).map(c=>ne(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;let b=
|
|
130
|
+
a.length,c=a.indexOf(this.__key);return c>=b-1?null:L(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(b+1).map(c=>ne(c))}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();G(this)&&b.unshift(this);G(a)&&c.unshift(a);a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){let e=b[d];if(c.has(e))return e}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(a.isParentOf(this))return!0;
|
|
131
|
+
if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=d.__children.indexOf(c.__key);break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){let b=this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){let b=this.isBefore(a),c=[],d=new Set;for(var e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===
|
|
132
|
+
a)break;f=G(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&r(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}b||c.reverse();return c}isDirty(){let a=I()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=L(this.__key);null===a&&r(69);return a}getWritable(){H();
|
|
133
|
+
var a=J(),b=I();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=x();null!==f&&(f._cachedNodes=null);if(b.has(c))return Gb(d),d;f=d.constructor.clone(d);f.__parent=e;G(d)&&G(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):D(d)&&D(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Gb(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){r(70)}updateDOM(){r(71)}exportDOM(a){return{element:this.createDOM(a._config,
|
|
134
|
+
a)}}exportJSON(){r(72)}static importJSON(){r(18)}remove(a){me(this,!0,a)}replace(a){H();let b=this.__key;a=a.getWritable();Eb(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;let e=d.indexOf(this.__key),f=a.__key;-1===e&&r(31);d.splice(e,0,f);a.__parent=c.__key;me(this,!1);Fb(a);d=x();E(d)&&(c=d.anchor,d=d.focus,c.key===b&&pd(c,a),d.key===b&&pd(d,a));Hb()===b&&K(f);return a}insertAfter(a){H();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();let e=x();var f=a.getIndexWithinParent(),
|
|
135
|
+
g=!1,h=!1;null!==d&&(Eb(c),E(e)&&(h=d.__key,g=e.anchor,d=e.focus,g="element"===g.type&&g.key===h&&g.offset===f+1,h="element"===d.type&&d.key===h&&d.offset===f+1));f=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;let k=f.__children;b=k.indexOf(b.__key);-1===b&&r(31);k.splice(b+1,0,d);Fb(c);E(e)&&(Vd(e,f,b+1),c=f.__key,g&&e.anchor.set(c,b+2,"element"),h&&e.focus.set(c,b+2,"element"));return a}insertBefore(a){var b=this.getWritable(),c=a.getWritable();Eb(c);let d=this.getParentOrThrow().getWritable(),
|
|
136
|
+
e=c.__key;c.__parent=b.__parent;let f=d.__children;b=f.indexOf(b.__key);-1===b&&r(31);f.splice(b,0,e);Fb(c);c=x();E(c)&&Vd(c,d,b);return a}selectPrevious(a,b){H();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):G(c)?c.select():D(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){H();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():G(c)?c.select(0,0):D(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,
|
|
137
|
+
a))}markDirty(){this.getWritable()}}class pe extends oe{constructor(a){super(a)}decorate(){r(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function C(a){return a instanceof pe}
|
|
138
|
+
class qe extends oe{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return $a[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){let d=L(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===
|
|
138
139
|
this.getChildrenSize()}isDirty(){let a=I()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest();return a.getParentOrThrow().getLastChild()===a}getAllTextNodes(){let a=[],b=this.getLatest().__children;for(let d=0;d<b.length;d++){var c=L(b[d]);D(c)?a.push(c):G(c)&&(c=c.getAllTextNodes(),a.push(...c))}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(G(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
|
|
139
140
|
this.getLastChild();for(;null!==a;){if(G(a)){let b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],G(a)&&a.getLastDescendant()||a||null;a=b[a];return G(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__children;return 0===a.length?null:L(a[0])}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&r(45);return a}getLastChild(){let a=this.getLatest().__children,b=a.length;
|
|
140
|
-
return 0===b?null:L(a[b-1])}getLastChildOrThrow(){let a=this.getLastChild();null===a&&r(96);return a}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:L(a)}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();G(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a
|
|
141
|
-
void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(
|
|
142
|
-
0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a
|
|
143
|
-
b,...h);if(a.length&&(b=x(),
|
|
144
|
-
type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function G(a){return a instanceof
|
|
145
|
-
class
|
|
146
|
-
b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}}function O(a){return a instanceof
|
|
147
|
-
function
|
|
148
|
-
class
|
|
149
|
-
class
|
|
150
|
-
function
|
|
151
|
-
function
|
|
152
|
-
function
|
|
153
|
-
class
|
|
154
|
-
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=
|
|
155
|
-
a=a.theme.text;void 0!==a&&
|
|
156
|
-
void 0!==c&&e!==f&&
|
|
157
|
-
b.setStyle(a.style);return b}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?
|
|
158
|
-
a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=
|
|
159
|
-
else return
|
|
160
|
-
f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=c.__key;let l=b.getFormat(),n=b.getStyle(),q=b.__detail;g=!1;b.isSegmented()?(h=N(m),h.__parent=k,h.__format=l,h.__style=n,h.__detail=q,g=!0):(h=b.getWritable(),h.__text=m);b=x();h=[h];m=m.length;for(let y=1;y<f;y++){var v=a[y],w=v.length;v=N(v).getWritable();v.__format=l;v.__style=n;v.__detail=q;let z=v.__key;w=m+w;if(
|
|
161
|
-
B.offset-=m,b.dirty=!0);
|
|
162
|
-
k=g.focus;null!==h&&h.key===d&&(
|
|
163
|
-
function
|
|
164
|
-
function
|
|
165
|
-
function N(a=""){return new
|
|
166
|
-
class
|
|
167
|
-
0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=
|
|
168
|
-
!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function
|
|
169
|
-
function
|
|
170
|
-
function
|
|
171
|
-
class
|
|
172
|
-
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=
|
|
141
|
+
return 0===b?null:L(a[b-1])}getLastChildOrThrow(){let a=this.getLastChild();null===a&&r(96);return a}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:L(a)}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();G(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=Za[a],0!==(this.getFormat()&a)):!1}select(a,b){H();let c=x();var d=this.getChildrenSize();
|
|
142
|
+
void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(E(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return Td(d,a,d,b,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return G(a)||D(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return G(a)||D(a)?a.select():null!==a?a.selectNext():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),
|
|
143
|
+
0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?Za[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=this.getWritable();var e=d.__key;let f=d.__children,g=c.length;var h=[];for(let k=0;k<g;k++){let m=c[k],l=m.getWritable();m.__key===e&&r(76);Eb(l);l.__parent=e;h.push(l.__key)}(c=this.getChildAtIndex(a-1))&&Gb(c);(e=this.getChildAtIndex(a+b))&&Gb(e);a===f.length?(f.push(...h),a=[]):a=f.splice(a,
|
|
144
|
+
b,...h);if(a.length&&(b=x(),E(b))){let k=new Set(a),m=new Set(h);h=q=>{for(q=q.getNode();q;){const v=q.__key;if(k.has(v)&&!m.has(v))return!0;q=q.getParent()}return!1};let {anchor:l,focus:n}=b;h(l)&&Yd(l,l.getNode(),this,c,e);h(n)&&Yd(n,n.getNode(),this,c,e);h=a.length;for(b=0;b<h;b++)c=L(a[b]),null!=c&&(c.getWritable().__parent=null);0!==f.length||this.canBeEmpty()||gc(this)||this.remove()}return d}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),
|
|
145
|
+
type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function G(a){return a instanceof qe}
|
|
146
|
+
class re extends qe{static getType(){return"root"}static clone(){return new re}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){r(51)}getTextContent(){let a=this.__cachedText;return!M&&0!==I()._dirtyType||null===a?super.getTextContent():a}remove(){r(52)}replace(){r(53)}insertBefore(){r(54)}insertAfter(){r(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];G(c)||C(c)||r(56)}return super.append(...a)}static importJSON(a){let b=Kb();b.setFormat(a.format);
|
|
147
|
+
b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}}function O(a){return a instanceof re}function le(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function se(){return new ke(new Map([["root",new re]]))}
|
|
148
|
+
function te(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&r(58);let c=b.children;if(G(a)){Array.isArray(c)||r(59);a=a.getChildren();for(let d=0;d<a.length;d++){let e=te(a[d]);c.push(e)}}return b}
|
|
149
|
+
class ke{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return ee(this,a)}clone(a){a=new ke(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return ee(this,()=>({root:te(Kb())}))}}
|
|
150
|
+
class ue extends oe{static getType(){return"linebreak"}static clone(a){return new ue(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement;return null!=b&&b.firstChild===a&&b.lastChild===a?null:{conversion:ve,priority:0}}}}static importJSON(){return Cd()}exportJSON(){return{type:"linebreak",version:1}}}function ve(){return{node:Cd()}}function Cd(){return hc(new ue)}
|
|
151
|
+
function Bb(a){return a instanceof ue}function we(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function xe(a,b){return b&1?"strong":b&2?"em":"span"}
|
|
152
|
+
function ye(a,b,c,d,e){a=d.classList;d=Ub(e,"base");void 0!==d&&a.add(...d);d=Ub(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in Xa)h=Xa[k],d=Ub(e,k),void 0!==d&&(c&h?!f||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
|
153
|
+
function ze(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Ta:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Oa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}
|
|
154
|
+
class Ae extends oe{static getType(){return"text"}static clone(a){return new Ae(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return bb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Hb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
|
155
|
+
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=Xa[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return zb(c,a,b)}createDOM(a){var b=this.__format,c=we(this,b);let d=xe(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;ze(this.__text,c,this);
|
|
156
|
+
a=a.theme.text;void 0!==a&&ye(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=we(this,e);let h=we(this,f);var k=xe(this,e);let m=xe(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&r(48),a=g=document.createElement(m),ze(d,a,this),c=c.theme.text,void 0!==c&&ye(m,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&r(49));ze(d,k,this);c=c.theme.text;
|
|
157
|
+
void 0!==c&&e!==f&&ye(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:Be,priority:0}),b:()=>({conversion:Ce,priority:0}),code:()=>({conversion:De,priority:0}),em:()=>({conversion:De,priority:0}),i:()=>({conversion:De,priority:0}),span:()=>({conversion:Ie,priority:0}),strong:()=>({conversion:De,priority:0}),u:()=>({conversion:De,priority:0})}}static importJSON(a){let b=N(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);
|
|
158
|
+
b.setStyle(a.style);return b}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?Xa[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?Ya[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=Xa[a];return this.setFormat(this.getFormat()^
|
|
159
|
+
a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=ab[a];let b=this.getWritable();b.__mode=a;return b}setTextContent(a){let b=this.getWritable();b.__text=a;return b}select(a,b){H();let c=x();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(E(c))d=Hb(),d!==c.anchor.key&&d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);
|
|
160
|
+
else return Td(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=x();d&&E(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){H();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Hb(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);
|
|
161
|
+
f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=c.__key;let l=b.getFormat(),n=b.getStyle(),q=b.__detail;g=!1;b.isSegmented()?(h=N(m),h.__parent=k,h.__format=l,h.__style=n,h.__detail=q,g=!0):(h=b.getWritable(),h.__text=m);b=x();h=[h];m=m.length;for(let y=1;y<f;y++){var v=a[y],w=v.length;v=N(v).getWritable();v.__format=l;v.__style=n;v.__detail=q;let z=v.__key;w=m+w;if(E(b)){let B=b.anchor,F=b.focus;B.key===d&&"text"===B.type&&B.offset>m&&B.offset<=w&&(B.key=z,
|
|
162
|
+
B.offset-=m,b.dirty=!0);F.key===d&&"text"===F.type&&F.offset>m&&F.offset<=w&&(F.key=z,F.offset-=m,b.dirty=!0)}e===d&&K(z);m=w;v.__parent=k;h.push(v)}Fb(this);e=c.getWritable().__children;d=e.indexOf(d);a=h.map(y=>y.__key);g?(e.splice(d,0,...a),this.remove()):e.splice(d,1,...a);E(b)&&Vd(b,c,d,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||r(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Hb()===d&&K(c);let g=x();if(E(g)){let h=g.anchor,
|
|
163
|
+
k=g.focus;null!==h&&h.key===d&&(Zd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Zd(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
|
|
164
|
+
function Ie(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!D(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
|
|
165
|
+
function Ce(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{D(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Be(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:N(a)}}let Je={code:"code",em:"italic",i:"italic",strong:"bold",u:"underline"};function De(a){let b=Je[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{D(c)&&c.toggleFormat(b);return c},node:null}}
|
|
166
|
+
function N(a=""){return hc(new Ae(a))}function D(a){return a instanceof Ae}
|
|
167
|
+
class Ke extends qe{static getType(){return"paragraph"}static clone(a){return new Ke(a.__key)}createDOM(a){let b=document.createElement("p");a=Ub(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Le,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
|
|
168
|
+
0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=rd();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let a=rd(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||D(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),
|
|
169
|
+
!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Le(){return{node:rd()}}function rd(){return hc(new Ke)}
|
|
170
|
+
function ge(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=se();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
|
171
|
+
function Me(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d.klass.importDOM.bind(d.klass):null;if(null!=d&&!c.has(d)){c.add(d);var e=d();null!==e&&Object.keys(e).forEach(f=>{let g=b.get(f);void 0===g&&(g=[],b.set(f,g));g.push(e[f])})}});return b}
|
|
172
|
+
class Ne{constructor(a,b,c,d,e,f){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
|
|
173
|
+
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Pb();this._onError=e;this._htmlConversions=f;this._editable=!0;this._headless=!1;this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=this._listeners.decorator;
|
|
173
174
|
b.add(a);return()=>{b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&r(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&r(36);let f=e[c];f.add(b);return()=>{f.delete(b);e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,
|
|
174
|
-
b){void 0===this._nodes.get(a.getType())&&r(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&r(37);let d=c.transforms;d.add(b);
|
|
175
|
-
this._rootElement;if(a!==b){let e=
|
|
176
|
-
[]}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,
|
|
177
|
-
b){a.isEmpty()&&r(38);
|
|
178
|
-
new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;M=!1;Z=this;try{
|
|
179
|
-
a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=t?window.getSelection():null;null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a
|
|
180
|
-
function
|
|
181
|
-
exports.$getNearestNodeFromDOMNode=
|
|
182
|
-
exports.$isInlineElementOrDecoratorNode=function(a){return G(a)&&a.isInline()||C(a)&&a.isInline()};exports.$isLeafNode=
|
|
183
|
-
exports.$nodesOfType=function(a){var b=
|
|
184
|
-
exports.CLICK_COMMAND=ca;exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=
|
|
185
|
-
exports.DEPRECATED_$createGridSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new
|
|
186
|
-
exports.DecoratorNode=
|
|
187
|
-
exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=
|
|
188
|
-
exports.createEditor=function(a){var b=a||{},c=Z,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=
|
|
189
|
-
k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
|
|
175
|
+
b){void 0===this._nodes.get(a.getType())&&r(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&r(37);let d=c.transforms;d.add(b);Lb(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
|
|
176
|
+
this._rootElement;if(a!==b){let e=Ub(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;ge(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==Yc&&(Yc--,0===Yc&&b.ownerDocument.removeEventListener("selectionchange",ld));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Ob(c);d=d[d.length-1]._key;kd.get(d)===c&&kd.delete(d)}else kd.delete(c._key);b.__lexicalEditor=null}c=jd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=
|
|
177
|
+
[]}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,rb(this),this._updateTags.add("history-merge"),fe(this),this._config.disableEvents||nd(a,this),null!=e&&a.classList.add(...e)):this._window=null;he("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
|
|
178
|
+
b){a.isEmpty()&&r(38);nb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),fe(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);fe(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=se(),d=Y,e=M,f=Z,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
|
|
179
|
+
new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;M=!1;Z=this;try{de(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,Y=d,M=e,Z=f}return c}update(a,b){A(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),A(this,()=>{let d=x(),e=Kb();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
|
|
180
|
+
a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=t?window.getSelection():null;null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,he("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Oe extends qe{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
|
|
181
|
+
function Ad(a){return a instanceof Oe}class Pe extends qe{}function yd(a){return a instanceof Pe}class Qe extends qe{}function zd(a){return a instanceof Qe}exports.$addUpdateTag=function(a){H();I()._updateTags.add(a)};exports.$applyNodeReplacement=hc;exports.$copyNode=function(a){a=a.constructor.clone(a);Cb(a,null);return a};exports.$createLineBreakNode=Cd;exports.$createNodeSelection=Fd;exports.$createParagraphNode=rd;
|
|
182
|
+
exports.$createRangeSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new ud(a,b,0)};exports.$createTextNode=N;exports.$getDecoratorNode=Xb;exports.$getNearestNodeFromDOMNode=ib;exports.$getNearestRootOrShadowRoot=fc;exports.$getNodeByKey=L;exports.$getPreviousSelection=Rb;exports.$getRoot=Kb;exports.$getSelection=x;exports.$getTextContent=function(){let a=x();return null===a?"":a.getTextContent()};exports.$hasAncestor=ec;
|
|
183
|
+
exports.$insertNodes=function(a,b){let c=x();null===c&&(c=Kb().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=C;exports.$isElementNode=G;exports.$isInlineElementOrDecoratorNode=function(a){return G(a)&&a.isInline()||C(a)&&a.isInline()};exports.$isLeafNode=Ab;exports.$isLineBreakNode=Bb;exports.$isNodeSelection=id;exports.$isParagraphNode=function(a){return a instanceof Ke};exports.$isRangeSelection=E;exports.$isRootNode=O;exports.$isRootOrShadowRoot=gc;exports.$isTextNode=D;
|
|
184
|
+
exports.$nodesOfType=function(a){var b=J();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=nc;exports.$parseSerializedNode=function(a){return de(a,I()._nodes)};exports.$setCompositionKey=K;exports.$setSelection=lb;exports.BLUR_COMMAND=La;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
|
|
185
|
+
exports.CLICK_COMMAND=ca;exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ia;exports.COPY_COMMAND=Ia;exports.CUT_COMMAND=Ja;exports.DELETE_CHARACTER_COMMAND=da;exports.DELETE_LINE_COMMAND=na;exports.DELETE_WORD_COMMAND=ma;
|
|
186
|
+
exports.DEPRECATED_$createGridSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new vd("root",a,b)};exports.DEPRECATED_$isGridCellNode=Ad;exports.DEPRECATED_$isGridNode=yd;exports.DEPRECATED_$isGridRowNode=zd;exports.DEPRECATED_$isGridSelection=wd;exports.DEPRECATED_GridCellNode=Oe;exports.DEPRECATED_GridNode=Pe;exports.DEPRECATED_GridRowNode=Qe;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;
|
|
187
|
+
exports.DecoratorNode=pe;exports.ElementNode=qe;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=p;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.KEY_ARROW_DOWN_COMMAND=va;exports.KEY_ARROW_LEFT_COMMAND=sa;exports.KEY_ARROW_RIGHT_COMMAND=qa;exports.KEY_ARROW_UP_COMMAND=ua;exports.KEY_BACKSPACE_COMMAND=Aa;exports.KEY_DELETE_COMMAND=Ca;exports.KEY_ENTER_COMMAND=ya;exports.KEY_ESCAPE_COMMAND=Ba;
|
|
188
|
+
exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=ue;exports.MOVE_TO_END=ra;exports.MOVE_TO_START=ta;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ja;exports.ParagraphNode=Ke;exports.REDO_COMMAND=pa;exports.REMOVE_TEXT_COMMAND=ka;exports.RootNode=re;exports.SELECTION_CHANGE_COMMAND=ba;exports.TextNode=Ae;exports.UNDO_COMMAND=oa;exports.VERSION="0.6.2";exports.createCommand=function(){return{}};
|
|
189
|
+
exports.createEditor=function(a){var b=a||{},c=Z,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=se(),h=b.namespace||(null!==e?e._config.namespace:Pb()),k=b.editorState,m=[re,Ae,ue,Ke,...(b.nodes||[])],l=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let q=m[c];var n=null;"function"!==typeof q&&(n=q,q=n.replace,n=n.with);let v=q.getType();a.set(v,{klass:q,replace:n,transforms:new Set})}d=new Ne(g,
|
|
190
|
+
e,a,{disableEvents:f,namespace:h,theme:d},l?l:console.error,Me(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
|
package/LexicalEditor.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import type { EditorState, SerializedEditorState } from './LexicalEditorState';
|
|
9
|
-
import type { DOMConversion,
|
|
9
|
+
import type { DOMConversion, NodeKey } from './LexicalNode';
|
|
10
|
+
import { LexicalNode } from './LexicalNode';
|
|
10
11
|
export declare type Spread<T1, T2> = Omit<T2, keyof T1> & T1;
|
|
11
12
|
export declare type Klass<T extends LexicalNode> = {
|
|
12
13
|
new (...args: any[]): T;
|
|
@@ -101,6 +102,7 @@ export declare type RegisteredNodes = Map<string, RegisteredNode>;
|
|
|
101
102
|
export declare type RegisteredNode = {
|
|
102
103
|
klass: Klass<LexicalNode>;
|
|
103
104
|
transforms: Set<Transform<LexicalNode>>;
|
|
105
|
+
replace: null | ((node: LexicalNode) => LexicalNode);
|
|
104
106
|
};
|
|
105
107
|
export declare type Transform<T extends LexicalNode> = (node: T) => void;
|
|
106
108
|
export declare type ErrorHandler = (error: Error) => void;
|
|
@@ -176,7 +178,12 @@ export declare function createEditor(editorConfig?: {
|
|
|
176
178
|
disableEvents?: boolean;
|
|
177
179
|
editorState?: EditorState;
|
|
178
180
|
namespace?: string;
|
|
179
|
-
nodes?: ReadonlyArray<Klass<LexicalNode
|
|
181
|
+
nodes?: ReadonlyArray<Klass<LexicalNode> | {
|
|
182
|
+
replace: Klass<LexicalNode>;
|
|
183
|
+
with: <T extends {
|
|
184
|
+
new (...args: any): any;
|
|
185
|
+
}>(node: InstanceType<T>) => LexicalNode;
|
|
186
|
+
}>;
|
|
180
187
|
onError?: ErrorHandler;
|
|
181
188
|
parentEditor?: LexicalEditor;
|
|
182
189
|
editable?: boolean;
|
package/LexicalUtils.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ export declare function isFirefoxClipboardEvents(editor: LexicalEditor): boolean
|
|
|
90
90
|
export declare function dispatchCommand<TCommand extends LexicalCommand<unknown>>(editor: LexicalEditor, command: TCommand, payload: CommandPayloadType<TCommand>): boolean;
|
|
91
91
|
export declare function $textContentRequiresDoubleLinebreakAtEnd(node: ElementNode): boolean;
|
|
92
92
|
export declare function getElementByKeyOrThrow(editor: LexicalEditor, key: NodeKey): HTMLElement;
|
|
93
|
-
export declare function scrollIntoViewIfNeeded(editor: LexicalEditor,
|
|
93
|
+
export declare function scrollIntoViewIfNeeded(editor: LexicalEditor, selectionRect: DOMRect, rootElement: HTMLElement, tags: Set<string>): void;
|
|
94
94
|
export declare function $hasUpdateTag(tag: string): boolean;
|
|
95
95
|
export declare function $addUpdateTag(tag: string): void;
|
|
96
96
|
export declare function $maybeMoveChildrenSelectionToParent(parentNode: LexicalNode, offset?: number): RangeSelection | NodeSelection | GridSelection | null;
|
|
@@ -100,3 +100,5 @@ export declare function getWindow(editor: LexicalEditor): Window;
|
|
|
100
100
|
export declare function $isInlineElementOrDecoratorNode(node: LexicalNode): boolean;
|
|
101
101
|
export declare function $getNearestRootOrShadowRoot(node: LexicalNode): RootNode | ElementNode;
|
|
102
102
|
export declare function $isRootOrShadowRoot(node: null | LexicalNode): boolean;
|
|
103
|
+
export declare function $copyNode<T extends LexicalNode>(node: T): T;
|
|
104
|
+
export declare function $applyNodeReplacement<N extends LexicalNode>(node: LexicalNode): N;
|
package/LexicalVersion.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type { EventHandler } from './LexicalEvents';
|
|
|
21
21
|
export { $normalizeSelection as $normalizeSelection__EXPERIMENTAL } from './LexicalNormalization';
|
|
22
22
|
export { $createNodeSelection, $createRangeSelection, $getPreviousSelection, $getSelection, $getTextContent, $insertNodes, $isNodeSelection, $isRangeSelection, DEPRECATED_$createGridSelection, DEPRECATED_$isGridSelection, } from './LexicalSelection';
|
|
23
23
|
export { $parseSerializedNode } from './LexicalUpdates';
|
|
24
|
-
export { $addUpdateTag, $getDecoratorNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, } from './LexicalUtils';
|
|
24
|
+
export { $addUpdateTag, $applyNodeReplacement, $copyNode, $getDecoratorNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, } from './LexicalUtils';
|
|
25
25
|
export { VERSION } from './LexicalVersion';
|
|
26
26
|
export { $isDecoratorNode, DecoratorNode } from './nodes/LexicalDecoratorNode';
|
|
27
27
|
export { $isElementNode, ElementNode } from './nodes/LexicalElementNode';
|