lexical 0.9.1 → 0.9.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 +59 -30
- package/Lexical.js.flow +33 -6
- package/Lexical.prod.js +152 -151
- package/LexicalNode.d.ts +1 -1
- package/LexicalUtils.d.ts +1 -0
- package/index.d.ts +1 -1
- package/nodes/LexicalGridCellNode.d.ts +3 -0
- package/nodes/LexicalLineBreakNode.d.ts +1 -4
- package/nodes/LexicalParagraphNode.d.ts +2 -5
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -1191,6 +1191,9 @@ function isEscape(keyCode) {
|
|
|
1191
1191
|
function isDelete(keyCode) {
|
|
1192
1192
|
return keyCode === 46;
|
|
1193
1193
|
}
|
|
1194
|
+
function isSelectAll(keyCode, metaKey, ctrlKey) {
|
|
1195
|
+
return keyCode === 65 && controlOrMeta(metaKey, ctrlKey);
|
|
1196
|
+
}
|
|
1194
1197
|
function getCachedClassNameArray(classNamesTheme, classNameThemeType) {
|
|
1195
1198
|
const classNames = classNamesTheme[classNameThemeType]; // As we're using classList, we need
|
|
1196
1199
|
// to handle className tokens that have spaces.
|
|
@@ -1378,6 +1381,10 @@ function scrollIntoViewIfNeeded(editor, selectionRect, rootElement) {
|
|
|
1378
1381
|
element = getParentElement(element);
|
|
1379
1382
|
}
|
|
1380
1383
|
}
|
|
1384
|
+
function $hasUpdateTag(tag) {
|
|
1385
|
+
const editor = getActiveEditor();
|
|
1386
|
+
return editor._updateTags.has(tag);
|
|
1387
|
+
}
|
|
1381
1388
|
function $addUpdateTag(tag) {
|
|
1382
1389
|
errorOnReadOnly();
|
|
1383
1390
|
const editor = getActiveEditor();
|
|
@@ -3244,6 +3251,12 @@ function onKeyDown(event, editor) {
|
|
|
3244
3251
|
} else if (isCut(keyCode, shiftKey, metaKey, ctrlKey)) {
|
|
3245
3252
|
event.preventDefault();
|
|
3246
3253
|
dispatchCommand(editor, CUT_COMMAND, event);
|
|
3254
|
+
} else if (isSelectAll(keyCode, metaKey, ctrlKey)) {
|
|
3255
|
+
event.preventDefault();
|
|
3256
|
+
editor.update(() => {
|
|
3257
|
+
const root = $getRoot();
|
|
3258
|
+
root.select(0, root.getChildrenSize());
|
|
3259
|
+
});
|
|
3247
3260
|
}
|
|
3248
3261
|
}
|
|
3249
3262
|
}
|
|
@@ -4230,7 +4243,7 @@ class LexicalNode {
|
|
|
4230
4243
|
}
|
|
4231
4244
|
/**
|
|
4232
4245
|
* Controls how the this node is deserialized from JSON. This is usually boilerplate,
|
|
4233
|
-
* but provides an abstraction
|
|
4246
|
+
* but provides an abstraction between the node implementation and serialized interface that can
|
|
4234
4247
|
* be important if you ever make breaking changes to a node schema (by adding or removing properties).
|
|
4235
4248
|
* See [Serialization & Deserialization](https://lexical.dev/docs/concepts/serialization#lexical---html).
|
|
4236
4249
|
*
|
|
@@ -6391,7 +6404,7 @@ class RangeSelection {
|
|
|
6391
6404
|
const parent = anchorNode.getParent();
|
|
6392
6405
|
const nextSibling = anchorNode.getNextSibling() || (parent === null ? null : parent.getNextSibling());
|
|
6393
6406
|
|
|
6394
|
-
if ($isElementNode(nextSibling) &&
|
|
6407
|
+
if ($isElementNode(nextSibling) && nextSibling.isShadowRoot()) {
|
|
6395
6408
|
return;
|
|
6396
6409
|
}
|
|
6397
6410
|
} // Handle the deletion around decorators.
|
|
@@ -6914,37 +6927,35 @@ function $updateElementSelectionOnCreateDeleteNode(selection, parentNode, nodeOf
|
|
|
6914
6927
|
if (selection.isCollapsed()) {
|
|
6915
6928
|
const selectionOffset = anchor.offset;
|
|
6916
6929
|
|
|
6917
|
-
if (nodeOffset <= selectionOffset) {
|
|
6930
|
+
if (nodeOffset <= selectionOffset && times > 0 || nodeOffset < selectionOffset && times < 0) {
|
|
6918
6931
|
const newSelectionOffset = Math.max(0, selectionOffset + times);
|
|
6919
6932
|
anchor.set(parentKey, newSelectionOffset, 'element');
|
|
6920
6933
|
focus.set(parentKey, newSelectionOffset, 'element'); // The new selection might point to text nodes, try to resolve them
|
|
6921
6934
|
|
|
6922
6935
|
$updateSelectionResolveTextNodes(selection);
|
|
6923
6936
|
}
|
|
6937
|
+
} else {
|
|
6938
|
+
// Multiple nodes selected. We shift or redimension selection
|
|
6939
|
+
const isBackward = selection.isBackward();
|
|
6940
|
+
const firstPoint = isBackward ? focus : anchor;
|
|
6941
|
+
const firstPointNode = firstPoint.getNode();
|
|
6942
|
+
const lastPoint = isBackward ? anchor : focus;
|
|
6943
|
+
const lastPointNode = lastPoint.getNode();
|
|
6924
6944
|
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
const isBackward = selection.isBackward();
|
|
6930
|
-
const firstPoint = isBackward ? focus : anchor;
|
|
6931
|
-
const firstPointNode = firstPoint.getNode();
|
|
6932
|
-
const lastPoint = isBackward ? anchor : focus;
|
|
6933
|
-
const lastPointNode = lastPoint.getNode();
|
|
6934
|
-
|
|
6935
|
-
if (parentNode.is(firstPointNode)) {
|
|
6936
|
-
const firstPointOffset = firstPoint.offset;
|
|
6945
|
+
if (parentNode.is(firstPointNode)) {
|
|
6946
|
+
const firstPointOffset = firstPoint.offset;
|
|
6937
6947
|
|
|
6938
|
-
|
|
6939
|
-
|
|
6948
|
+
if (nodeOffset <= firstPointOffset && times > 0 || nodeOffset < firstPointOffset && times < 0) {
|
|
6949
|
+
firstPoint.set(parentKey, Math.max(0, firstPointOffset + times), 'element');
|
|
6950
|
+
}
|
|
6940
6951
|
}
|
|
6941
|
-
}
|
|
6942
6952
|
|
|
6943
|
-
|
|
6944
|
-
|
|
6953
|
+
if (parentNode.is(lastPointNode)) {
|
|
6954
|
+
const lastPointOffset = lastPoint.offset;
|
|
6945
6955
|
|
|
6946
|
-
|
|
6947
|
-
|
|
6956
|
+
if (nodeOffset <= lastPointOffset && times > 0 || nodeOffset < lastPointOffset && times < 0) {
|
|
6957
|
+
lastPoint.set(parentKey, Math.max(0, lastPointOffset + times), 'element');
|
|
6958
|
+
}
|
|
6948
6959
|
}
|
|
6949
6960
|
} // The new selection might point to text nodes, try to resolve them
|
|
6950
6961
|
|
|
@@ -7183,8 +7194,16 @@ function updateDOMSelection(prevSelection, nextSelection, editor, domSelection,
|
|
|
7183
7194
|
const selectionTarget = nextSelection instanceof RangeSelection && nextSelection.anchor.type === 'element' ? nextAnchorNode.childNodes[nextAnchorOffset] || null : domSelection.rangeCount > 0 ? domSelection.getRangeAt(0) : null;
|
|
7184
7195
|
|
|
7185
7196
|
if (selectionTarget !== null) {
|
|
7186
|
-
|
|
7187
|
-
|
|
7197
|
+
let selectionRect;
|
|
7198
|
+
|
|
7199
|
+
if (selectionTarget instanceof Text) {
|
|
7200
|
+
const range = document.createRange();
|
|
7201
|
+
range.selectNode(selectionTarget);
|
|
7202
|
+
selectionRect = range.getBoundingClientRect();
|
|
7203
|
+
} else {
|
|
7204
|
+
selectionRect = selectionTarget.getBoundingClientRect();
|
|
7205
|
+
}
|
|
7206
|
+
|
|
7188
7207
|
scrollIntoViewIfNeeded(editor, selectionRect, rootElement);
|
|
7189
7208
|
}
|
|
7190
7209
|
}
|
|
@@ -8680,7 +8699,8 @@ class ElementNode extends LexicalNode {
|
|
|
8680
8699
|
|
|
8681
8700
|
excludeFromCopy(destination) {
|
|
8682
8701
|
return false;
|
|
8683
|
-
}
|
|
8702
|
+
} // TODO 0.10 deprecate
|
|
8703
|
+
|
|
8684
8704
|
|
|
8685
8705
|
canExtractContents() {
|
|
8686
8706
|
return true;
|
|
@@ -10356,10 +10376,8 @@ class LexicalEditor {
|
|
|
10356
10376
|
|
|
10357
10377
|
this._key = createUID();
|
|
10358
10378
|
this._onError = onError;
|
|
10359
|
-
this._htmlConversions = htmlConversions;
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
this._editable = true;
|
|
10379
|
+
this._htmlConversions = htmlConversions;
|
|
10380
|
+
this._editable = editable;
|
|
10363
10381
|
this._headless = parentEditor !== null && parentEditor._headless;
|
|
10364
10382
|
this._window = null;
|
|
10365
10383
|
this._blockCursorElement = null;
|
|
@@ -10915,15 +10933,24 @@ class DEPRECATED_GridCellNode extends ElementNode {
|
|
|
10915
10933
|
|
|
10916
10934
|
exportJSON() {
|
|
10917
10935
|
return { ...super.exportJSON(),
|
|
10918
|
-
colSpan: this.__colSpan
|
|
10936
|
+
colSpan: this.__colSpan,
|
|
10937
|
+
rowSpan: this.__rowSpan
|
|
10919
10938
|
};
|
|
10920
10939
|
}
|
|
10921
10940
|
|
|
10941
|
+
getColSpan() {
|
|
10942
|
+
return this.__colSpan;
|
|
10943
|
+
}
|
|
10944
|
+
|
|
10922
10945
|
setColSpan(colSpan) {
|
|
10923
10946
|
this.getWritable().__colSpan = colSpan;
|
|
10924
10947
|
return this;
|
|
10925
10948
|
}
|
|
10926
10949
|
|
|
10950
|
+
getRowSpan() {
|
|
10951
|
+
return this.__rowSpan;
|
|
10952
|
+
}
|
|
10953
|
+
|
|
10927
10954
|
setRowSpan(rowSpan) {
|
|
10928
10955
|
this.getWritable().__rowSpan = rowSpan;
|
|
10929
10956
|
return this;
|
|
@@ -10975,6 +11002,7 @@ exports.$getRoot = $getRoot;
|
|
|
10975
11002
|
exports.$getSelection = $getSelection;
|
|
10976
11003
|
exports.$getTextContent = $getTextContent;
|
|
10977
11004
|
exports.$hasAncestor = $hasAncestor;
|
|
11005
|
+
exports.$hasUpdateTag = $hasUpdateTag;
|
|
10978
11006
|
exports.$insertNodes = $insertNodes;
|
|
10979
11007
|
exports.$isDecoratorNode = $isDecoratorNode;
|
|
10980
11008
|
exports.$isElementNode = $isElementNode;
|
|
@@ -11059,4 +11087,5 @@ exports.UNDO_COMMAND = UNDO_COMMAND;
|
|
|
11059
11087
|
exports.createCommand = createCommand;
|
|
11060
11088
|
exports.createEditor = createEditor;
|
|
11061
11089
|
exports.getNearestEditorFromDOMNode = getNearestEditorFromDOMNode;
|
|
11090
|
+
exports.isSelectionCapturedInDecoratorInput = isSelectionCapturedInDecoratorInput;
|
|
11062
11091
|
exports.isSelectionWithinEditor = isSelectionWithinEditor;
|
package/Lexical.js.flow
CHANGED
|
@@ -375,8 +375,14 @@ declare export class LexicalNode {
|
|
|
375
375
|
): boolean;
|
|
376
376
|
remove(preserveEmptyParent?: boolean): void;
|
|
377
377
|
replace<N: LexicalNode>(replaceWith: N): N;
|
|
378
|
-
insertAfter(
|
|
379
|
-
|
|
378
|
+
insertAfter(
|
|
379
|
+
nodeToInsert: LexicalNode,
|
|
380
|
+
restoreSelection?: boolean,
|
|
381
|
+
): LexicalNode;
|
|
382
|
+
insertBefore(
|
|
383
|
+
nodeToInsert: LexicalNode,
|
|
384
|
+
restoreSelection?: boolean,
|
|
385
|
+
): LexicalNode;
|
|
380
386
|
selectPrevious(anchorOffset?: number, focusOffset?: number): RangeSelection;
|
|
381
387
|
selectNext(anchorOffset?: number, focusOffset?: number): RangeSelection;
|
|
382
388
|
markDirty(): void;
|
|
@@ -541,6 +547,20 @@ declare export function $insertNodes(
|
|
|
541
547
|
nodes: Array<LexicalNode>,
|
|
542
548
|
selectStart?: boolean,
|
|
543
549
|
): boolean;
|
|
550
|
+
export type GridMapValueType = {
|
|
551
|
+
cell: deprecated_GridCellNode,
|
|
552
|
+
startRow: number,
|
|
553
|
+
startColumn: number,
|
|
554
|
+
};
|
|
555
|
+
export type GridMapType = Array<Array<GridMapValueType>>;
|
|
556
|
+
declare export function DEPRECATED_$computeGridMap(
|
|
557
|
+
grid: deprecated_GridNode,
|
|
558
|
+
cellA: deprecated_GridCellNode,
|
|
559
|
+
cellB: deprecated_GridCellNode,
|
|
560
|
+
): [GridMapType, GridMapValueType, GridMapValueType];
|
|
561
|
+
declare export function DEPRECATED_$getNodeTriplet(
|
|
562
|
+
source: PointType | LexicalNode | deprecated_GridCellNode,
|
|
563
|
+
): [deprecated_GridCellNode, deprecated_GridRowNode, deprecated_GridNode];
|
|
544
564
|
|
|
545
565
|
/**
|
|
546
566
|
* LexicalTextNode
|
|
@@ -791,8 +811,13 @@ declare export function DEPRECATED_$isGridRowNode(
|
|
|
791
811
|
|
|
792
812
|
declare export class deprecated_GridCellNode extends ElementNode {
|
|
793
813
|
__colSpan: number;
|
|
814
|
+
__rowSpan: number;
|
|
794
815
|
|
|
795
816
|
constructor(colSpan: number, key?: NodeKey): void;
|
|
817
|
+
getColSpan(): number;
|
|
818
|
+
setColSpan(colSpan: number): this;
|
|
819
|
+
getRowSpan(): number;
|
|
820
|
+
setRowSpan(rowSpan: number): this;
|
|
796
821
|
}
|
|
797
822
|
|
|
798
823
|
declare export function DEPRECATED_$isGridCellNode(
|
|
@@ -835,7 +860,7 @@ declare export function $getNearestRootOrShadowRoot(
|
|
|
835
860
|
node: LexicalNode,
|
|
836
861
|
): RootNode | ElementNode;
|
|
837
862
|
declare export function $isRootOrShadowRoot(
|
|
838
|
-
node: LexicalNode,
|
|
863
|
+
node: ?LexicalNode,
|
|
839
864
|
): boolean %checks(node instanceof RootNode || node instanceof ElementNode);
|
|
840
865
|
declare export function $hasAncestor(
|
|
841
866
|
child: LexicalNode,
|
|
@@ -891,19 +916,21 @@ export type SerializedElementNode = {
|
|
|
891
916
|
|
|
892
917
|
export type SerializedParagraphNode = {
|
|
893
918
|
...SerializedElementNode,
|
|
894
|
-
type: 'paragraph',
|
|
895
919
|
...
|
|
896
920
|
};
|
|
897
921
|
|
|
898
922
|
export type SerializedLineBreakNode = {
|
|
899
923
|
...SerializedLexicalNode,
|
|
900
|
-
|
|
924
|
+
...
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
export type SerializedDecoratorNode = {
|
|
928
|
+
...SerializedLexicalNode,
|
|
901
929
|
...
|
|
902
930
|
};
|
|
903
931
|
|
|
904
932
|
export type SerializedRootNode = {
|
|
905
933
|
...SerializedElementNode,
|
|
906
|
-
type: 'root',
|
|
907
934
|
...
|
|
908
935
|
};
|
|
909
936
|
|
package/Lexical.prod.js
CHANGED
|
@@ -4,204 +4,205 @@
|
|
|
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
|
|
8
|
-
let
|
|
9
|
-
!window.MSStream
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
pa.getChildrenKeys(),g=oa.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(oa.appendChild(k),g=k):g!==k&&oa.replaceChild(k,g),g=g.nextSibling);else B(pa)&&pa.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)x=h[p],
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
7
|
+
'use strict';let ca={},da={},ea={},fa={},ja={},ka={},la={},na={},qa={},ra={},sa={},ta={},ua={},wa={},xa={},ya={},za={},Aa={},Ba={},Ca={},Da={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={},Na={},Oa={},Pa={},Qa={},Ra={},Sa={},Ta={};function q(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
|
+
let Ua="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Va=Ua&&"documentMode"in document?document.documentMode:null,t=Ua&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Wa=Ua&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Xa=Ua&&"InputEvent"in window&&!Va?"getTargetRanges"in new window.InputEvent("input"):!1,Ya=Ua&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Za=Ua&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
|
|
9
|
+
!window.MSStream,$a=Ua&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ab=Ua&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!$a,bb=Ya||Za||ab?"\u00a0":"\u200b",cb=Wa?"\u00a0":bb,db=/^[^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]/,eb=/^[^\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]/,
|
|
10
|
+
fb={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},gb={directionless:1,unmergeable:2},kb={center:2,end:6,justify:4,left:1,right:3,start:5},lb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},mb={normal:0,segmented:2,token:1},nb={0:"normal",2:"segmented",1:"token"},ob=!1,pb=0;function qb(a){pb=a.timeStamp}function rb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}
|
|
11
|
+
function sb(a){return a.getEditorState().read(()=>{let b=v();return null!==b?b.clone():null})}
|
|
12
|
+
function tb(a,b,c){ob=!0;let d=100<performance.now()-pb;try{w(a,()=>{let e=v()||sb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let n=!1,m="";for(var p=0;p<b.length;p++){var l=b[p],r=l.type,u=l.target,x=ub(u,h);if(!(null===x&&u!==g||z(x)))if("characterData"===r){if(l=d&&B(x))a:{l=e;r=u;var y=x;if(C(l)){var A=l.anchor.getNode();if(A.is(y)&&l.format!==A.getFormat()){l=!1;break a}}l=3===r.nodeType&&y.isAttached()}l&&(y=E(a._window),r=l=null,null!==y&&y.anchorNode===
|
|
13
|
+
u&&(l=y.anchorOffset,r=y.focusOffset),u=u.nodeValue,null!==u&&vb(x,u,l,r,!1))}else if("childList"===r){n=!0;r=l.addedNodes;for(y=0;y<r.length;y++){A=r[y];var aa=wb(A),ba=A.parentNode;null==ba||A===k||null!==aa||"BR"===A.nodeName&&rb(A,ba,a)||(Wa&&(aa=A.innerText||A.nodeValue)&&(m+=aa),ba.removeChild(A))}l=l.removedNodes;r=l.length;if(0<r){y=0;for(A=0;A<r;A++)if(ba=l[A],"BR"===ba.nodeName&&rb(ba,u,a)||k===ba)u.appendChild(ba),y++;r!==y&&(u===g&&(x=h._nodeMap.get("root")),f.set(u,x))}}}if(0<f.size)for(let [oa,
|
|
14
|
+
pa]of f)if(F(pa))for(f=pa.getChildrenKeys(),g=oa.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(oa.appendChild(k),g=k):g!==k&&oa.replaceChild(k,g),g=g.nextSibling);else B(pa)&&pa.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(k=f[g],h=k.addedNodes,k=k.target,p=0;p<h.length;p++)x=h[p],u=x.parentNode,null==u||"BR"!==x.nodeName||rb(x,k,a)||u.removeChild(x);c.takeRecords()}null!==e&&(n&&(e.dirty=!0,xb(e)),Wa&&yb(a)&&e.insertRawText(m))})}finally{ob=
|
|
15
|
+
!1}}function zb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();tb(a,c,b)}}function Ab(a){0===pb&&Bb(a).addEventListener("textInput",qb,!0);a._observer=new MutationObserver((b,c)=>{tb(a,b,c)})}let Cb=1,Db="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function Eb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return z(ub(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}
|
|
16
|
+
function Fb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!Eb(b)&&Gb(b)===a}catch(e){return!1}}function Gb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=Hb(a)}return null}function Ib(a){return a.isToken()||a.isSegmented()}function Pb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Qb(a,b,c){b=fb[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Rb(a){return B(a)||Sb(a)||z(a)}
|
|
17
|
+
function Tb(a,b){if(null!=b)a.__key=b;else{G();99<Ub&&q(14);b=H();var c=Vb(),d=""+Cb++;c._nodeMap.set(d,a);F(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}
|
|
18
18
|
function Wb(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=
|
|
19
|
-
a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function Xb(a){99<
|
|
20
|
-
function
|
|
21
|
-
function $b(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function ac(a){return a.read(()=>bc().getTextContent())}function cc(a,b){w(a,()=>{var c=
|
|
22
|
-
function dc(a){var b=H(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=
|
|
23
|
-
function hc(a,b,c){b=E(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=
|
|
24
|
-
function
|
|
25
|
-
c,f,d),f.isSegmented()&&(c=f.getTextContent(),c=
|
|
19
|
+
a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function Xb(a){99<Ub&&q(14);var b=a.getLatest(),c=b.__parent,d=Vb();let e=H(),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;F(a)?d.set(b,!0):e._dirtyLeaves.add(b)}
|
|
20
|
+
function I(a){G();var b=H();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=J(c),null!==b&&b.getWritable()),null!==a&&(a=J(a),null!==a&&a.getWritable()))}function Yb(){return Zb()?null:H()._compositionKey}function J(a,b){a=(b||Vb())._nodeMap.get(a);return void 0===a?null:a}function wb(a,b){let c=H();a=a[`__lexicalKey_${c._key}`];return void 0!==a?J(a,b):null}function ub(a,b){for(;null!=a;){let c=wb(a,b);if(null!==c)return c;a=Hb(a)}return null}
|
|
21
|
+
function $b(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function ac(a){return a.read(()=>bc().getTextContent())}function cc(a,b){w(a,()=>{var c=Vb();if(!c.isEmpty())if("root"===b)bc().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function bc(){return Vb()._nodeMap.get("root")}function xb(a){G();let b=Vb();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
|
|
22
|
+
function dc(a){var b=H(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=Hb(c)}c=null}return null===c?(b=b.getRootElement(),a===b?J("root"):null):J(c)}function ec(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function fc(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function gc(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
|
23
|
+
function hc(a,b,c){b=E(b._window);if(null!==b){var d=b.anchorNode,{anchorOffset:e,focusOffset:f}=b;if(null!==d&&(b=3===d.nodeType?d.nodeValue:null,d=ub(d),null!==b&&B(d))){if(d.canContainTabs()){var g=b.includes("\t");if(c&&0<c.length&&g){g=c.length;let h=e+g-1,k=b.slice(0,h);b=b.slice(h,b.length);b=`${k}${c}${b}`;e+=g;f+=g}}b===bb&&c&&(g=c.length,b=c,f=e=g);null!==b&&vb(d,b,e,f,a)}}}
|
|
24
|
+
function vb(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]===bb&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(I(null),Ya||Za||ab)f.remove();else{let n=H();setTimeout(()=>{n.update(()=>{f.isAttached()&&f.remove()})},20)}else{e=f.getParent();b=ic();var h=Yb(),k=f.getKey();f.isToken()||null!==h&&k===h&&!g||null!==e&&C(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=v(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,
|
|
25
|
+
c,f,d),f.isSegmented()&&(c=f.getTextContent(),c=K(c),f.replace(c),f=c)),f.setTextContent(a))}}}function jc(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=(B(b)||F(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
|
|
26
26
|
function kc(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function lc(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&q(33),d=b.klass,b=a.get(d),void 0===b&&(b=new Map,a.set(d,b)),a=b.get(c),d="destroyed"===a&&"created"===e,(void 0===a||d)&&b.set(c,d?"updated":e))}function mc(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)}
|
|
27
|
-
function nc(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),mc(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?mc(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function
|
|
28
|
-
function pc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(75);return a}function
|
|
29
|
-
function sc(a){for(a=a.getParentOrThrow();null!==a&&!
|
|
30
|
-
function xc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function E(a){return
|
|
27
|
+
function nc(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),mc(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?mc(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function yb(a){a=(a=Bb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function oc(a){return!L(a)&&!a.isLastChild()&&!a.isInline()}
|
|
28
|
+
function pc(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(75);return a}function Hb(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}function qc(a,b=0){0!==b&&q(1);b=v();if(!C(b)||!F(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();rc(e,a)&&c.set(a.__key,0,"element");rc(f,a)&&d.set(a.__key,0,"element");return b}function rc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function Bb(a){a=a._window;null===a&&q(78);return a}
|
|
29
|
+
function sc(a){for(a=a.getParentOrThrow();null!==a&&!M(a);)a=a.getParentOrThrow();return a}function M(a){return L(a)||F(a)&&a.isShadowRoot()}function tc(a){a=a.constructor.clone(a);Tb(a,null);return a}function uc(a){var b=H();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&q(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||q(98),b):a}function vc(a,b){a=a.getParent();!L(a)||F(b)||z(b)||q(99)}function wc(a){return(z(a)||F(a)&&!a.canBeEmpty())&&!a.isInline()}
|
|
30
|
+
function xc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}function E(a){return Ua?(a||window).getSelection():null}function yc(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);M(a)&&q(102);let d=g=>{const h=g.getParentOrThrow(),k=M(h),n=g!==c||k?tc(g):g;if(k)return g.insertAfter(n),[g,n,n];const [m,p,l]=d(h);g=g.getNextSiblings();l.append(n,...g);return[m,p,n]},[e,f]=d(c);return[e,f]}
|
|
31
31
|
function zc(a,b){for(;a!==bc()&&null!=a;){if(b(a))return a;a=a.getParent()}return null}function Ac(a){let b=[],c=[a];for(;0<c.length;){let d=c.pop();void 0===d&&q(112);F(d)&&c.unshift(...d.getChildren());d!==a&&b.push(d)}return b}function Bc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(F(a)&&Bc(a,f,c,d,e),c.has(f)||e.delete(f),d.delete(f));a=a.isAttached()?a.getNextSibling():null}}
|
|
32
32
|
function Cc(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()||(F(c)&&Bc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}function Dc(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)}
|
|
33
33
|
function Ec(a,b){let c=a.mergeWithSibling(b),d=H()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function Fc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Dc(b,a)&&(a=Ec(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Dc(a,c)&&Ec(a,c);break}}}
|
|
34
|
-
function Gc(a){Hc(a.anchor);Hc(a.focus);return a}function Hc(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(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!F(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let
|
|
35
|
-
function cd(a,b){let c=Zc.get(a);if(null!==b){let d=dd(a);d.parentNode===b&&b.removeChild(d)}$c.has(a)||
|
|
34
|
+
function Gc(a){Hc(a.anchor);Hc(a.focus);return a}function Hc(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(B(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!F(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let N="",O="",Ic="",Rc,R,Sc,Tc=!1,Uc=!1,Vc,Wc=null,Xc,Yc,Zc,$c,ad,bd;
|
|
35
|
+
function cd(a,b){let c=Zc.get(a);if(null!==b){let d=dd(a);d.parentNode===b&&b.removeChild(d)}$c.has(a)||R._keyToDOMMap.delete(a);F(c)&&(a=ed(c,Zc),fd(a,0,a.length-1,null));void 0!==c&&lc(bd,Sc,Vc,c,"destroyed")}function fd(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&cd(e,d)}}function gd(a,b){a.setProperty("text-align",b)}
|
|
36
36
|
function hd(a,b){var c=Rc.theme.indent;if("string"===typeof c){let d=a.classList.contains(c);0<b&&!d?a.classList.add(c):1>b&&d&&a.classList.remove(c)}c=getComputedStyle(a).getPropertyValue("--lexical-indent-base-value")||"40px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function id(a,b){a=a.style;0===b?gd(a,""):1===b?gd(a,"left"):2===b?gd(a,"center"):3===b?gd(a,"right"):4===b?gd(a,"justify"):5===b?gd(a,"start"):6===b&&gd(a,"end")}
|
|
37
|
-
function jd(a,b,c){let d=$c.get(a);void 0===d&&q(60);let e=d.createDOM(Rc,
|
|
38
|
-
nd(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(
|
|
37
|
+
function jd(a,b,c){let d=$c.get(a);void 0===d&&q(60);let e=d.createDOM(Rc,R);var f=R._keyToDOMMap;e["__lexicalKey_"+R._key]=a;f.set(a,e);B(d)?e.setAttribute("data-lexical-text","true"):z(d)&&e.setAttribute("data-lexical-decorator","true");if(F(d)){a=d.__indent;f=d.__size;0!==a&&hd(e,a);if(0!==f){--f;a=ed(d,$c);var g=O;O="";kd(a,d,0,f,e,null);ld(d,e);O=g}a=d.__format;0!==a&&id(e,a);d.isInline()||md(null,d,e);oc(d)&&(N+="\n\n",Ic+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(R,Rc),null!==g&&
|
|
38
|
+
nd(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(O+=f)),N+=f,Ic+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));lc(bd,Sc,Vc,d,"created");return e}function kd(a,b,c,d,e,f){let g=N;for(N="";c<=d;++c)jd(a[c],e,f);oc(b)&&(N+="\n\n");e.__lexicalTextContent=N;N=g+N}function od(a,b){a=b.get(a);return Sb(a)||z(a)&&a.isInline()}
|
|
39
39
|
function md(a,b,c){a=null!==a&&(0===a.__size||od(a.__last,Zc));b=0===b.__size||od(b.__last,$c);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
|
40
|
-
function ld(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==
|
|
41
|
-
d;b.__lexicalDirTextContent=
|
|
42
|
-
function pd(a,b){var c=Zc.get(a),d=$c.get(a);void 0!==c&&void 0!==d||q(61);var e=Tc||Yc.has(a)||Xc.has(a);let f=pc(
|
|
43
|
-
d.__format;a!==c.__format&&id(f,a);if(e){a=d;e=
|
|
44
|
-
h++;else{void 0===k&&(k=new Set(l));void 0===
|
|
45
|
-
null!==e&&nd(a,e)):B(d)&&!d.isDirectionless()&&(
|
|
46
|
-
let rd=Object.freeze({}),yd=[["keydown",sd],["pointerdown",td],["compositionstart",ud],["compositionend",vd],["input",wd],["click",xd],["cut",rd],["copy",rd],["dragstart",rd],["dragover",rd],["dragend",rd],["paste",rd],["focus",rd],["blur",rd],["drop",rd]];
|
|
47
|
-
function Kd(a,b,c,d,e){let f=a.anchor,g=a.focus,h=f.getNode();var k=H();let
|
|
40
|
+
function ld(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==O||c!==Wc){let f=""===O;if(f)var d=Wc;else d=O,d=db.test(d)?"rtl":eb.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=Rc.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);Uc||(a.getWritable().__dir=d)}Wc=
|
|
41
|
+
d;b.__lexicalDirTextContent=O;b.__lexicalDir=d}}function ed(a,b){let c=[];for(a=a.__first;null!==a;){let d=b.get(a);void 0===d&&q(101);c.push(a);a=d.__next}return c}
|
|
42
|
+
function pd(a,b){var c=Zc.get(a),d=$c.get(a);void 0!==c&&void 0!==d||q(61);var e=Tc||Yc.has(a)||Xc.has(a);let f=pc(R,a);if(c===d&&!e)return F(c)?(d=f.__lexicalTextContent,void 0!==d&&(N+=d,Ic+=d),d=f.__lexicalDirTextContent,void 0!==d&&(O+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(O+=d),Ic+=d,N+=d),f;c!==d&&e&&lc(bd,Sc,Vc,d,"updated");if(d.updateDOM(c,f,Rc))return d=jd(a,null,null),null===b&&q(62),b.replaceChild(d,f),cd(a,null),d;if(F(c)&&F(d)){a=d.__indent;a!==c.__indent&&hd(f,a);a=
|
|
43
|
+
d.__format;a!==c.__format&&id(f,a);if(e){a=d;e=O;O="";b=N;var g=c.__size,h=a.__size;N="";if(1===g&&1===h){var k=c.__first,n=a.__first;if(k===n)pd(k,f);else{var m=dd(k);n=jd(n,null,null);f.replaceChild(n,m);cd(k,null)}}else{n=ed(c,Zc);var p=ed(a,$c);if(0===g)0!==h&&kd(p,a,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,fd(n,0,g-1,k?null:f),k&&(f.textContent=""));else{var l=n;n=p;p=g-1;g=h-1;let u=f.firstChild,x=0;for(h=0;x<=p&&h<=g;){var r=l[x];let y=n[h];if(r===y)u=qd(pd(y,f)),x++,
|
|
44
|
+
h++;else{void 0===k&&(k=new Set(l));void 0===m&&(m=new Set(n));let A=m.has(r),aa=k.has(y);A?(aa?(r=pc(R,y),r===u?u=qd(pd(y,f)):(null!=u?f.insertBefore(r,u):f.appendChild(r),pd(y,f)),x++):jd(y,f,u),h++):(u=qd(dd(r)),cd(r,f),x++)}}k=x>p;m=h>g;k&&!m?(k=n[g+1],k=void 0===k?null:R.getElementByKey(k),kd(n,a,h,g,f,k)):m&&!k&&fd(l,x,p,f)}}oc(a)&&(N+="\n\n");f.__lexicalTextContent=N;N=b+N;ld(a,f);O=e;L(d)||d.isInline()||md(c,d,f)}oc(d)&&(N+="\n\n",Ic+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(R,
|
|
45
|
+
Rc),null!==e&&nd(a,e)):B(d)&&!d.isDirectionless()&&(O+=c),N+=c,Ic+=c;!Uc&&L(d)&&d.__cachedText!==Ic&&(d=d.getWritable(),d.__cachedText=Ic);return f}function nd(a,b){let c=R._pendingDecorators,d=R._decorators;if(null===c){if(d[a]===b)return;c=$b(R)}c[a]=b}function qd(a){a=a.nextSibling;null!==a&&a===R._blockCursorElement&&(a=a.nextSibling);return a}function dd(a){a=ad.get(a);void 0===a&&q(75);return a}
|
|
46
|
+
let rd=Object.freeze({}),yd=[["keydown",sd],["pointerdown",td],["compositionstart",ud],["compositionend",vd],["input",wd],["click",xd],["cut",rd],["copy",rd],["dragstart",rd],["dragover",rd],["dragend",rd],["paste",rd],["focus",rd],["blur",rd],["drop",rd]];Xa&&yd.push(["beforeinput",(a,b)=>zd(a,b)]);let Ad=0,Bd=0,Cd=0,Dd=null,Ed=0,Fd=!1,Gd=!1,Hd=!1,Id=!1,Jd=[0,"",0,"root",0];
|
|
47
|
+
function Kd(a,b,c,d,e){let f=a.anchor,g=a.focus,h=f.getNode();var k=H();let n=E(k._window),m=null!==n?n.anchorNode:null,p=f.key;k=k.getElementByKey(p);let l=c.length;return p!==g.key||!B(h)||(!e&&(!Xa||Cd<d+50)||h.isDirty()&&2>l||ec(c))&&f.offset!==g.offset&&!h.isComposing()||Ib(h)||h.isDirty()&&1<l||(e||!Xa)&&null!==k&&!h.isComposing()&&m!==Pb(k)||null!==n&&null!==b&&(!b.collapsed||b.startContainer!==n.anchorNode||b.startOffset!==n.anchorOffset)||h.getFormat()!==a.format||h.getStyle()!==a.style||
|
|
48
48
|
jc(a,h)}function Ld(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
|
49
|
-
function Md(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Fd&&(Fd=!1,Ld(d,e)&&Ld(f,g)))return;w(b,()=>{if(!c)
|
|
50
|
-
0,h.style="")}else{k=255;
|
|
51
|
-
function td(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&w(b,()=>{z(
|
|
52
|
-
function zd(a,b){let c=a.inputType,d=Nd(a);"deleteCompositionText"===c||
|
|
53
|
-
Dd&&hc(!1,b,Dd);e.dirty&&null===Dd||!e.isCollapsed()||
|
|
54
|
-
c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":
|
|
55
|
-
|
|
56
|
-
function wd(a,b){a.stopPropagation();w(b,()=>{var c=v(),d=a.data,e=Nd(a);if(null!=d&&C(c)&&Kd(c,e,d,a.timeStamp,!1)){Id&&(Pd(b,d),Id=!1);var f=c.anchor,g=f.getNode();e=E(b._window);if(null===e)return;let h=f.offset;if(f=
|
|
57
|
-
d);Za
|
|
58
|
-
function Pd(a,b){var c=a._compositionKey;
|
|
59
|
-
function sd(a,b){Ad=a.timeStamp;Bd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(!
|
|
60
|
-
a)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.
|
|
49
|
+
function Md(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Fd&&(Fd=!1,Ld(d,e)&&Ld(f,g)))return;w(b,()=>{if(!c)xb(null);else if(Fb(b,d,f)){var h=v();if(C(h)){var k=h.anchor,n=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var m=Bb(b).event;m=m?m.timeStamp:performance.now();let [p,l,r,u,x]=Jd;m<x+200&&k.offset===r&&k.key===u?(h.format=p,h.style=l):"text"===k.type?(h.format=n.getFormat(),h.style=n.getStyle()):"element"===k.type&&(h.format=
|
|
50
|
+
0,h.style="")}else{k=255;n=!1;m=h.getNodes();let p=m.length;for(let l=0;l<p;l++){let r=m[l];if(B(r)&&(n=!0,k&=r.getFormat(),0===k))break}h.format=n?k:0}}S(b,ca,void 0)}})}function xd(a,b){w(b,()=>{let c=v(),d=E(b._window),e=ic();if(C(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!L(g)&&1===bc().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}S(b,da,a)})}
|
|
51
|
+
function td(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&w(b,()=>{z(ub(c))||(Gd=!0)})}function Nd(a){if(!a.getTargetRanges)return null;a=a.getTargetRanges();return 0===a.length?null:a[0]}function Od(a,b){return a!==b||F(a)||F(b)||!a.isToken()||!b.isToken()}
|
|
52
|
+
function zd(a,b){let c=a.inputType,d=Nd(a);"deleteCompositionText"===c||Wa&&yb(b)||"insertCompositionText"!==c&&w(b,()=>{let e=v();if("deleteContentBackward"===c){if(null===e){var f=ic();if(!C(f))return;xb(f.clone())}if(C(e)){229===Bd&&a.timeStamp<Ad+30&&b.isComposing()&&e.anchor.key===e.focus.key?(I(null),Ad=0,setTimeout(()=>{w(b,()=>{I(null)})},30),C(e)&&(f=e.anchor.getNode(),f.markDirty(),e.format=f.getFormat(),e.style=f.getStyle())):(a.preventDefault(),S(b,ea,!0));return}}if(C(e)){f=a.data;null!==
|
|
53
|
+
Dd&&hc(!1,b,Dd);e.dirty&&null===Dd||!e.isCollapsed()||L(e.anchor.getNode())||null===d||e.applyDOMRange(d);Dd=null;var g=e.focus,h=e.anchor.getNode();g=g.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===f?(a.preventDefault(),S(b,fa,!1)):"\n\n"===f?(a.preventDefault(),S(b,ja,void 0)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),e.insertRawText(f)):null!=f&&Kd(e,d,f,a.timeStamp,!0)?(a.preventDefault(),S(b,ka,f)):Dd=f,Cd=a.timeStamp;else switch(a.preventDefault(),
|
|
54
|
+
c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":S(b,ka,a);break;case "insertFromComposition":I(null);S(b,ka,a);break;case "insertLineBreak":I(null);S(b,fa,!1);break;case "insertParagraph":I(null);Hd?(Hd=!1,S(b,fa,!1)):S(b,ja,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":S(b,la,a);break;case "deleteByComposition":Od(h,g)&&S(b,na,void 0);break;case "deleteByDrag":case "deleteByCut":S(b,na,void 0);break;case "deleteContent":S(b,ea,!1);break;case "deleteWordBackward":S(b,
|
|
55
|
+
qa,!0);break;case "deleteWordForward":S(b,qa,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":S(b,ra,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":S(b,ra,!1);break;case "formatStrikeThrough":S(b,sa,"strikethrough");break;case "formatBold":S(b,sa,"bold");break;case "formatItalic":S(b,sa,"italic");break;case "formatUnderline":S(b,sa,"underline");break;case "historyUndo":S(b,ta,void 0);break;case "historyRedo":S(b,ua,void 0)}}})}
|
|
56
|
+
function wd(a,b){a.stopPropagation();w(b,()=>{var c=v(),d=a.data,e=Nd(a);if(null!=d&&C(c)&&Kd(c,e,d,a.timeStamp,!1)){Id&&(Pd(b,d),Id=!1);var f=c.anchor,g=f.getNode();e=E(b._window);if(null===e)return;let h=f.offset;if(f=Xa&&!c.isCollapsed()&&B(g)&&null!==e.anchorNode)g=g.getTextContent().slice(0,h)+d+g.getTextContent().slice(h+c.focus.offset),e=e.anchorNode,f=g===(3===e.nodeType?e.nodeValue:null);f||S(b,ka,d);d=d.length;Wa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=
|
|
57
|
+
d);Ya||Za||ab||!b.isComposing()||(Ad=0,I(null))}else hc(!1,b,null!==d?d:void 0),Id&&(Pd(b,d||void 0),Id=!1);G();c=H();zb(c)});Dd=null}function ud(a,b){w(b,()=>{let c=v();if(C(c)&&!b.isComposing()){let d=c.anchor,e=c.anchor.getNode();I(d.key);(a.timeStamp<Ad+30||"element"===d.type||!c.isCollapsed()||e.getFormat()!==c.format||e.getStyle()!==c.style)&&S(b,ka,cb)}})}
|
|
58
|
+
function Pd(a,b){var c=a._compositionKey;I(null);if(null!==c&&null!=b){if(""===b){b=J(c);a=Pb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&vb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=v(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);S(a,Da,null);return}}hc(!0,a,b)}function vd(a,b){Wa?Id=!0:w(b,()=>{Pd(b,a.data)})}
|
|
59
|
+
function sd(a,b){Ad=a.timeStamp;Bd=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(!S(b,wa,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)Hd=!0,S(b,Da,a);else if(32===c)S(b,Ga,a);else if(t&&e&&79===c)a.preventDefault(),Hd=!0,S(b,fa,!0);else if(13!==c||d)if(t?g||f?0:8===c||72===c&&e:e||g||f?0:8===c)8===c?S(b,Ha,a):(a.preventDefault(),S(b,ea,!0));else if(27===c)S(b,Ia,
|
|
60
|
+
a);else if(t?d||g||f?0:46===c||68===c&&e:e||g||f?0:46===c)46===c?S(b,Ja,a):(a.preventDefault(),S(b,ea,!1));else if(8===c&&(t?g:e))a.preventDefault(),S(b,qa,!0);else if(46===c&&(t?g:e))a.preventDefault(),S(b,qa,!1);else if(t&&f&&8===c)a.preventDefault(),S(b,ra,!0);else if(t&&f&&46===c)a.preventDefault(),S(b,ra,!1);else if(66===c&&!g&&(t?f:e))a.preventDefault(),S(b,sa,"bold");else if(85===c&&!g&&(t?f:e))a.preventDefault(),S(b,sa,"underline");else if(73===c&&!g&&(t?f:e))a.preventDefault(),S(b,sa,"italic");
|
|
61
|
+
else if(9!==c||g||e||f)if(90===c&&!d&&(t?f:e))a.preventDefault(),S(b,ta,void 0);else{var h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d;h?(a.preventDefault(),S(b,ua,void 0)):Qd(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),S(b,Pa,a)):(h=d?!1:88===c?t?f:e:!1,h?(a.preventDefault(),S(b,Qa,a)):65===c&&(t?f:e)&&(a.preventDefault(),b.update(()=>{let k=bc();k.select(0,k.getChildrenSize())}))))}else S(b,Ka,a);else Hd=!1,S(b,Da,a);else S(b,Ca,a);else S(b,Ba,a);else S(b,Aa,a);else S(b,
|
|
62
|
+
za,a);else S(b,ya,a);else S(b,xa,a);(e||d||g||f)&&S(b,Ta,a)}}}function Rd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Sd=new Map;
|
|
63
|
+
function Td(a){a=a.target;let b=E(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=Gb(b.anchorNode);if(null!==c){Gd&&(Gd=!1,w(c,()=>{var g=ic(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=Ud(g,b,c),xb(g))}));a=fc(c);a=a[a.length-1];var d=a._key,e=Sd.get(d),f=e||a;f!==c&&Md(b,f,!1);Md(b,c,!0);c!==a?Sd.set(d,c):e&&Sd.delete(d)}}}
|
|
64
|
+
function Vd(a,b){0===Ed&&a.ownerDocument.addEventListener("selectionchange",Td);Ed++;a.__lexicalEditor=b;let c=Rd(a);for(let d=0;d<yd.length;d++){let [e,f]=yd[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return S(b,Qa,h);case "copy":return S(b,Pa,h);case "paste":return S(b,la,h);case "dragstart":return S(b,Ma,h);case "dragover":return S(b,Na,h);case "dragend":return S(b,
|
|
65
|
+
Oa,h);case "focus":return S(b,Ra,h);case "blur":return S(b,Sa,h);case "drop":return S(b,La,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
|
|
66
|
+
function Wd(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=qc(a),g=!1;if(C(f)&&b){let h=f.anchor,k=f.focus;h.key===d&&(Xd(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Xd(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}C(f)&&b&&!g?(d=a.getIndexWithinParent(),Wb(a),Yd(f,e,d,-1)):Wb(a);c||M(e)||e.canBeEmpty()||!e.isEmpty()||Wd(e,b);b&&L(e)&&e.isEmpty()&&e.selectEnd()}}
|
|
67
|
+
class Zd{static getType(){q(64)}static clone(){q(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Tb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=J(a);if(null===a)break;a=a.__parent}return!1}isSelected(a){a=a||v();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&
|
|
68
|
+
a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){var a=this.getParent();if(null===a)return-1;a=a.getFirstChild();let b=0;for(;null!==a;){if(this.is(a))return b;b++;a=a.getNextSibling()}return-1}getParent(){let a=this.getLatest().__parent;return null===a?null:J(a)}getParentOrThrow(){let a=this.getParent();null===a&&q(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(M(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=
|
|
69
|
+
this.getTopLevelElement();null===a&&q(67);return a}getParents(){let a=[],b=this.getParent();for(;null!==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(){let a=this.getLatest().__prev;return null===a?null:J(a)}getPreviousSiblings(){let a=[];var b=this.getParent();if(null===b)return a;for(b=b.getFirstChild();null!==b&&!b.is(this);)a.push(b),b=b.getNextSibling();return a}getNextSibling(){let a=
|
|
70
|
+
this.getLatest().__next;return null===a?null:J(a)}getNextSiblings(){let a=[],b=this.getNextSibling();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();F(this)&&b.unshift(this);F(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(this===a)return!1;if(a.isParentOf(this))return!0;
|
|
70
71
|
if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=c.getIndexWithinParent();break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=c.getIndexWithinParent();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===a)break;
|
|
71
|
-
f=F(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&&q(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=H()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=
|
|
72
|
-
var a=
|
|
72
|
+
f=F(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&&q(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=H()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=J(this.__key);null===a&&q(113);return a}getWritable(){G();
|
|
73
|
+
var a=Vb(),b=H();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=v();null!==f&&(f._cachedNodes=null);if(b.has(c))return Xb(d),d;f=d.constructor.clone(d);f.__parent=e;f.__next=d.__next;f.__prev=d.__prev;F(d)&&F(f)?(f.__first=d.__first,f.__last=d.__last,f.__size=d.__size,f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):B(d)&&B(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Xb(f);a.set(c,f);
|
|
73
74
|
return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){q(70)}updateDOM(){q(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){q(72)}static importJSON(){q(18)}static transform(){return null}remove(a){Wd(this,!0,a)}replace(a,b){G();var c=v();null!==c&&(c=c.clone());vc(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;Wb(g);let k=d.getPreviousSibling(),
|
|
74
|
-
|
|
75
|
-
Wb(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let
|
|
75
|
+
n=d.getNextSibling(),m=d.__prev,p=d.__next,l=d.__parent;Wd(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=m;null===n?a.__last=f:n.getWritable().__prev=f;g.__next=p;g.__parent=l;a.__size=h;b&&this.getChildren().forEach(r=>{g.append(r)});C(c)&&(xb(c),b=c.anchor,c=c.focus,b.key===e&&$d(b,g),c.key===e&&$d(c,g));Yb()===e&&I(f);return g}insertAfter(a,b=!0){G();vc(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=v();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();
|
|
76
|
+
Wb(d);C(f)&&(h=e.__key,g=f.anchor,e=f.focus,g="element"===g.type&&g.key===h&&g.offset===k+1,h="element"===e.type&&e.key===h&&e.offset===k+1)}e=this.getNextSibling();k=this.getParentOrThrow().getWritable();let n=d.__key,m=c.__next;null===e?k.__last=n:e.getWritable().__prev=n;k.__size++;c.__next=n;d.__next=m;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),Yd(f,k,b+1),c=k.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a,b=
|
|
76
77
|
!0){G();vc(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;Wb(d);let f=this.getPreviousSibling(),g=this.getParentOrThrow().getWritable(),h=c.__prev,k=this.getIndexWithinParent();null===f?g.__first=e:f.getWritable().__next=e;g.__size++;c.__prev=e;d.__prev=h;d.__next=c.__key;d.__parent=c.__parent;c=v();b&&C(c)&&(b=this.getParentOrThrow(),Yd(c,b,k));return a}isParentRequired(){return!1}createParentElementNode(){return ae()}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();
|
|
77
78
|
return null===c?d.select(0,0):F(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){G();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():F(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}
|
|
78
|
-
class be{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(F(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}F(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=
|
|
79
|
-
Zb()||(Yb()===e&&
|
|
80
|
-
function de(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=
|
|
79
|
+
class be{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(F(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}F(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=J(this.key);null===a&&q(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
|
|
80
|
+
Zb()||(Yb()===e&&I(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function ce(a,b){let c=b.__key,d=a.offset,e="element";if(B(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!F(b)){var f=b.getNextSibling();if(B(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function $d(a,b){if(F(b)){let c=b.getLastDescendant();F(c)||B(c)?ce(a,c):ce(a,b)}else ce(a,b)}
|
|
81
|
+
function de(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=K(),h=L(e)?ae().append(g):g;g.setFormat(c);g.setStyle(d);null===f?e.append(h):f.insertBefore(h);a.is(b)&&b.set(g.__key,0,"text");a.set(g.__key,0,"text")}function ee(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
|
81
82
|
class fe{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!Qd(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 fe(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
|
|
82
|
-
b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(B(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=
|
|
83
|
+
b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(B(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=J(c),null!==b&&a.push(b);Zb()||(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}}
|
|
83
84
|
function C(a){return a instanceof ge}
|
|
84
85
|
class he{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 ie(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 he(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return je(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,b){let c=
|
|
85
|
-
this.focus.getNode();return Gc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=
|
|
86
|
-
startColumn:A,startRow:
|
|
87
|
-
1),
|
|
86
|
+
this.focus.getNode();return Gc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=J(this.anchor.key);null===a&&q(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=J(this.focus.key);null===c&&q(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(){function a(x){let {cell:y,
|
|
87
|
+
startColumn:A,startRow:aa}=x;h=Math.min(h,A);k=Math.min(k,aa);n=Math.max(n,A+y.__colSpan-1);m=Math.max(m,aa+y.__rowSpan-1)}var b=this._cachedNodes;if(null!==b)return b;var c=this.anchor.getNode();b=this.focus.getNode();c=zc(c,ke);var d=zc(b,ke);ke(c)||q(103);ke(d)||q(104);b=c.getParent();le(b)||q(105);b=b.getParent();me(b)||q(106);let [e,f,g]=ne(b,c,d),h=Math.min(f.startColumn,g.startColumn),k=Math.min(f.startRow,g.startRow),n=Math.max(f.startColumn+f.cell.__colSpan-1,g.startColumn+g.cell.__colSpan-
|
|
88
|
+
1),m=Math.max(f.startRow+f.cell.__rowSpan-1,g.startRow+g.cell.__rowSpan-1);c=h;d=k;for(var p=h,l=k;h<c||k<d||n>p||m>l;){if(h<c){var r=l-d;--c;for(var u=0;u<=r;u++)a(e[d+u][c])}if(k<d)for(r=p-c,--d,u=0;u<=r;u++)a(e[d][c+u]);if(n>p)for(r=l-d,p+=1,u=0;u<=r;u++)a(e[d+u][p]);if(m>l)for(r=p-c,l+=1,u=0;u<=r;u++)a(e[l][c+u])}b=[b];c=null;for(d=k;d<=m;d++)for(p=h;p<=n;p++)({cell:l}=e[d][p]),r=l.getParent(),le(r)||q(107),r!==c&&b.push(r),b.push(l,...Ac(l)),c=r;Zb()||(this._cachedNodes=b);return b}getTextContent(){let a=
|
|
88
89
|
this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function ie(a){return a instanceof he}
|
|
89
90
|
class ge{constructor(a,b,c,d){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this.style=d;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format&&this.style===a.style:!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;a=this.anchor;var b=this.focus,c=a.isBefore(b),d=c?a:b;c=c?b:a;a=d.getNode();
|
|
90
91
|
b=c.getNode();let e=d.offset;d=c.offset;F(a)&&(c=a.getDescendantByIndex(e),a=null!=c?c:a);F(b)&&(c=b.getDescendantByIndex(d),null!==c&&c!==a&&b.getChildAtIndex(d)===c&&(c=c.getPreviousSibling()),b=null!=c?c:b);a=a.is(b)?F(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(b);Zb()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){ee(this.anchor,a.__key,b,"text");ee(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";
|
|
91
|
-
let b=a[0],c=a[a.length-1],d=this.anchor,e=this.focus,f=d.isBefore(e),[g,h]=je(this),k="",
|
|
92
|
-
H(),c=b.getEditorState()._selection;a=oe(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;ee(this.anchor,d.key,d.offset,d.type);ee(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new ge(new be(a.key,a.offset,a.type),new be(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=
|
|
93
|
-
|
|
94
|
-
b.getParentOrThrow(),p=g[h-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!
|
|
95
|
-
if(!B(l)||
|
|
96
|
-
|
|
97
|
-
h))}else{e=new Set([...b.getParentKeys(),...p.getParentKeys()]);l=F(b)?b:b.getParentOrThrow();f=F(p)?p:p.getParentOrThrow();
|
|
98
|
-
p.remove():k.remove()):e.add(p.__key);k=f.getChildren();
|
|
99
|
-
b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<h;a++)b=g[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),
|
|
100
|
-
(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var
|
|
101
|
-
1;h<
|
|
102
|
-
|
|
103
|
-
d=null!==d?d:f.getParentOrThrow(),e.push(f);else if(c===d)d=f;else{if(f.isToken())return!1;[d,f]=f.splitText(c);e.push(f)}f=d;e.push(...g);g=a[0];var k=!1,
|
|
104
|
-
d.getFirstChild();for(let
|
|
105
|
-
null!==p?p.insertBefore(
|
|
106
|
-
|
|
107
|
-
(B(d)?d.select():(b=d.getParentOrThrow(),a=d.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,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(
|
|
92
|
+
let b=a[0],c=a[a.length-1],d=this.anchor,e=this.focus,f=d.isBefore(e),[g,h]=je(this),k="",n=!0;for(let m=0;m<a.length;m++){let p=a[m];if(F(p)&&!p.isInline())n||(k+="\n"),n=p.isEmpty()?!1:!0;else if(n=!1,B(p)){let l=p.getTextContent();if(p===b)if(p===c){if("element"!==d.type||"element"!==e.type||e.offset===d.offset)l=g<h?l.slice(g,h):l.slice(h,g)}else l=f?l.slice(g):l.slice(h);else p===c&&(l=f?l.slice(0,h):l.slice(0,g));k+=l}else!z(p)&&!Sb(p)||p===c&&this.isCollapsed()||(k+=p.getTextContent())}return k}applyDOMRange(a){let b=
|
|
93
|
+
H(),c=b.getEditorState()._selection;a=oe(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;ee(this.anchor,d.key,d.offset,d.type);ee(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new ge(new be(a.key,a.offset,a.type),new be(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=Qb(this.format,a,null);this.dirty=!0}setStyle(a){this.style=a;this.dirty=!0}hasFormat(a){return 0!==(this.format&
|
|
94
|
+
fb[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(K(e));d!==c-1&&a.push(pe())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format,f=this.style;d&&"element"===b.type?de(b,c,e,f):d||"element"!==c.type||de(c,b,e,f);var g=this.getNodes(),h=g.length,k=d?c:b;c=(d?b:c).offset;var n=k.offset;b=g[0];B(b)||q(26);d=b.getTextContent().length;var m=
|
|
95
|
+
b.getParentOrThrow(),p=g[h-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!m.canInsertTextAfter()&&null===b.getNextSibling())){var l=b.getNextSibling();if(!B(l)||Ib(l))l=K(),l.setFormat(e),m.canInsertTextAfter()?b.insertAfter(l):m.insertAfter(l);l.select(0,0);b=l;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!m.canInsertTextBefore()&&null===b.getPreviousSibling())){l=b.getPreviousSibling();
|
|
96
|
+
if(!B(l)||Ib(l))l=K(),l.setFormat(e),m.canInsertTextBefore()?b.insertBefore(l):m.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)m=K(b.getTextContent()),m.setFormat(e),b.replace(m),b=m;else if(!(this.isCollapsed()||""===a||(l=p.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!F(l)||l.canInsertTextBefore()&&l.canInsertTextAfter())))){this.insertText("");qe(this.anchor,this.focus,null);this.insertText(a);return}if(1===h)if(b.isToken())a=
|
|
97
|
+
K(a),a.select(),b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===n&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=K(a);g.setFormat(e);g.setStyle(f);g.select();0===c?b.insertBefore(g,!1):([h]=b.splitText(c),h.insertAfter(g,!1));g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length);return}b=b.spliceText(c,n-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:(this.format=g,this.style=
|
|
98
|
+
h))}else{e=new Set([...b.getParentKeys(),...p.getParentKeys()]);l=F(b)?b:b.getParentOrThrow();f=F(p)?p:p.getParentOrThrow();m=p;if(!l.is(f)&&f.isInline()){do m=f,f=f.getParentOrThrow();while(f.isInline())}"text"===k.type&&(0!==n||""===p.getTextContent())||"element"===k.type&&p.getIndexWithinParent()<n?B(p)&&!p.isToken()&&n!==p.getTextContentSize()?(p.isSegmented()&&(k=K(p.getTextContent()),p.replace(k),p=k),p=p.spliceText(0,n,""),e.add(p.__key)):(k=p.getParentOrThrow(),k.canBeEmpty()||1!==k.getChildrenSize()?
|
|
99
|
+
p.remove():k.remove()):e.add(p.__key);k=f.getChildren();n=new Set(g);p=l.is(f);l=l.isInline()&&null===b.getNextSibling()?l:b;for(let r=k.length-1;0<=r;r--){let u=k[r];if(u.is(b)||F(u)&&u.isParentOf(b))break;u.isAttached()&&(!n.has(u)||u.is(m)?p||l.insertAfter(u,!1):u.remove())}if(!p)for(k=f,n=null;null!==k;){f=k.getChildren();p=f.length;if(0===p||f[p-1].is(n))e.delete(k.__key),n=k;k=k.getParent()}b.isToken()?c===d?b.select():(a=K(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?
|
|
100
|
+
b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<h;a++)b=g[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),I(null);else{var b=this.getNodes(),c=[];for(var d of b)B(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),I(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()&&
|
|
101
|
+
(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var n=e-1,m=c[n];e="text"===d.type?d.offset:m.getTextContentSize();if(k.is(m))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")),this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var p=m.getFormatFlags(a,g);0<e&&(e!==m.getTextContentSize()&&([m]=m.splitText(e)),m.setFormat(p));for(h+=
|
|
102
|
+
1;h<n;h++){let l=c[h];if(!l.isToken()){let r=l.getFormatFlags(a,p);l.setFormat(r)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(m.__key,e,"text");this.format=g|p}}}}}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=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=
|
|
103
|
+
K();this.focus.getNode().insertBefore(e)}else this.focus.key===c&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(e=K(),this.focus.getNode().insertAfter(e));e&&(this.focus.set(e.__key,0,"text"),this.anchor.set(e.__key,0,"text"))}}e=this.anchor;c=e.offset;var f=e.getNode();d=f;"element"===e.type&&(e=e.getNode(),d=e.getChildAtIndex(c-1),d=null===d?e:d);e=[];var g=f.getNextSiblings(),h=M(f)?null:f.getTopLevelElementOrThrow();if(B(f))if(d=f.getTextContent().length,0===c&&0!==d)d=f.getPreviousSibling(),
|
|
104
|
+
d=null!==d?d:f.getParentOrThrow(),e.push(f);else if(c===d)d=f;else{if(f.isToken())return!1;[d,f]=f.splitText(c);e.push(f)}f=d;e.push(...g);g=a[0];var k=!1,n=null;for(let r=0;r<a.length;r++){var m=a[r];if(M(d)||z(d)||!F(m)||m.isInline())k&&!F(m)&&!z(m)&&M(d.getParent())&&q(28);else{if(m.is(g)){if(F(d)&&d.isEmpty()&&d.canReplaceWith(m)){d.replace(m);d=m;k=!0;continue}k=m.getFirstDescendant();if(Rb(k)){for(var p=k.getParentOrThrow();p.isInline();)p=p.getParentOrThrow();n=p.getChildren();k=n.length;if(F(d)){var l=
|
|
105
|
+
d.getFirstChild();for(let u=0;u<k;u++){let x=n[u];null===l?d.append(x):l.insertAfter(x);l=x}}else{for(l=k-1;0<=l;l--)d.insertAfter(n[l]);d=d.getParentOrThrow()}n=n[k-1];p.remove();k=!0;if(p.is(m))continue}}B(d)&&(null===h&&q(27),d=h)}k=!1;if(F(d)&&!d.isInline())if(n=m,z(m)&&!m.isInline())d=d.insertAfter(m,!1);else if(F(m)){if(m.canBeEmpty()||!m.isEmpty())L(d)?(p=d.getChildAtIndex(c),null!==p?p.insertBefore(m):d.append(m),d=m):m.isInline()?(d.append(m),d=m):d=d.insertAfter(m,!1)}else p=d.getFirstChild(),
|
|
106
|
+
null!==p?p.insertBefore(m):d.append(m),d=m;else!F(m)||F(m)&&m.isInline()||z(d)&&!d.isInline()?(n=m,C(this)&&z(m)&&(F(d)||B(d))&&!m.isInline()?(B(d)?(p=d.getParentOrThrow(),[d]=d.splitText(c),d=d.getIndexWithinParent()+1):(p=d,d=c),[,d]=yc(p,d),d=d.insertBefore(m)):d=d.insertAfter(m,!1)):(m=d.getParentOrThrow(),Sb(d)&&d.remove(),d=m,r--)}b&&(B(f)?f.select():(a=d.getPreviousSibling(),B(a)?a.select():(a=d.getIndexWithinParent(),d.getParentOrThrow().select(a,a))));if(F(d)){if(a=B(n)?n:F(n)&&n.isInline()?
|
|
107
|
+
n.getLastDescendant():d.getLastDescendant(),b||(null===a?d.select():B(a)?""===a.getTextContent()?a.selectPrevious():a.select():a.selectNext()),0!==e.length)for(b=d,a=e.length-1;0<=a;a--)c=e[a],h=c.getParentOrThrow(),!F(d)||re(c)||z(c)&&(!c.isInline()||c.isIsolated())?F(d)||re(c)?F(c)&&!c.canInsertAfter(d)?(f=h.constructor.clone(h),F(f)||q(29),f.append(c),d.insertAfter(f)):d.insertAfter(c):(d.insertBefore(c),d=c):(b===d?d.append(c):d.insertBefore(c),d=c),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||
|
|
108
|
+
(B(d)?d.select():(b=d.getParentOrThrow(),a=d.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,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(M(f)){e=ae();
|
|
108
109
|
c=f.getChildAtIndex(b);e.select();null!==c?c.insertBefore(e,!1):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=f.getParentOrThrow(),e=c.insertNewAfter(this,!1),F(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this,!1),null===g)this.insertLineBreak();else if(F(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<
|
|
109
|
-
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=pe();var c=this.anchor;"element"===c.type&&(c=c.getNode(),
|
|
110
|
+
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=pe();var c=this.anchor;"element"===c.type&&(c=c.getNode(),L(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return je(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=
|
|
110
111
|
a[0];let g=a[c],[h,k]=je(this);if(0===b)return[];if(1===b)return B(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);B(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));B(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=nc(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=se(),
|
|
111
|
-
b.add(g.__key),
|
|
112
|
-
d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=
|
|
113
|
-
d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&F(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getParent();e=d.getNextSibling()||(null===e?null:e.getNextSibling());if(F(e)
|
|
112
|
+
b.add(g.__key),xb(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),F(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(e=H(),d=E(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!F(g)||g.isInline()||g.canBeEmpty()||xc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<
|
|
113
|
+
d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),e=L(e)?e:sc(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],rc(k,e)?a.push(k):c=!0;c&&0<a.length&&(b?(b=a[0],F(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],F(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,ee(f,b.key,b.offset,b.type),ee(b,
|
|
114
|
+
d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&F(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getParent();e=d.getNextSibling()||(null===e?null:e.getNextSibling());if(F(e)&&e.isShadowRoot())return}e=nc(c,a);if(z(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&F(d)&&0===d.getChildrenSize()?(d.remove(),a=se(),a.add(e.__key),xb(a)):e.remove();return}this.modify("extend",
|
|
114
115
|
a,"character");if(!this.isCollapsed()){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){te(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)){te(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;f=g-
|
|
115
|
-
1;c!==f&&(b=b.getTextContent().slice(c,g),ec(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}d=this.isCollapsed();this.removeText();a&&!d&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset&&(a=this.anchor.getNode(),a.isEmpty()&&
|
|
116
|
+
1;c!==f&&(b=b.getTextContent().slice(c,g),ec(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}d=this.isCollapsed();this.removeText();a&&!d&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset&&(a=this.anchor.getNode(),a.isEmpty()&&L(a.getParent())&&0===a.getIndexWithinParent()&&a.collapseAtStart(this))}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",
|
|
116
117
|
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()}}function Qd(a){return a instanceof fe}function ue(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}
|
|
117
|
-
function je(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]:[ue(b),ue(a)]}function te(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],
|
|
118
|
+
function je(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]:[ue(b),ue(a)]}function te(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],n=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||n){d.splice(h,1);n&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
|
118
119
|
function Ee(a,b,c,d){var e=b;if(1===a.nodeType){let h=!1;var f=a.childNodes,g=f.length;e===g&&(h=!0,e=g-1);let k=f[e];g=!1;k===d._blockCursorElement?(k=f[e+1],g=!0):null!==d._blockCursorElement&&e--;d=dc(k);if(B(d))e=h?d.getTextContentSize():0;else{f=dc(a);if(null===f)return null;if(F(f)){a=f.getChildAtIndex(e);if(b=F(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=h?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,e=0):(a=c,f=F(a)?a:a.getParentOrThrow()));
|
|
119
120
|
B(a)?(d=a,f=null,e=h?a.getTextContentSize():0):a!==f&&h&&!g&&e++}else e=f.getIndexWithinParent(),e=0===b&&z(f)&&dc(a)===f?e:e+1,f=f.getParentOrThrow();if(F(f))return new be(f.__key,e,"element")}}else d=dc(a);return B(d)?new be(d.__key,e,"text"):null}
|
|
120
121
|
function Fe(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&F(e)&&e.isInline()&&(b=e.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):F(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&F(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
|
|
121
122
|
b)&&null===d&&F(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function qe(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Fe(a,d,e);Fe(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=H();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,ee(a,d.key,d.offset,d.type),ee(b,c.key,c.offset,c.type))}}
|
|
122
|
-
function oe(a,b,c,d,e,f){if(null===a||null===c||!
|
|
123
|
+
function oe(a,b,c,d,e,f){if(null===a||null===c||!Fb(e,a,c))return null;b=Ee(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Ee(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=dc(a),c=dc(c),z(a)&&z(c)))return null;qe(b,d,f);return[b,d]}function re(a){return F(a)&&!a.isInline()}function Ge(a,b,c,d,e,f){let g=Vb();a=new ge(new be(a,b,e),new be(c,d,f),0,"");a.dirty=!0;return g._selection=a}function se(){return new fe(new Set)}
|
|
123
124
|
function He(a){let b=a.getEditorState()._selection,c=E(a._window);return Qd(b)||ie(b)?b.clone():Ud(b,c,a)}
|
|
124
|
-
function Ud(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=!
|
|
125
|
-
a.style:"")}function v(){return
|
|
126
|
-
function Yd(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))
|
|
125
|
+
function Ud(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=!ob&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!C(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&C(a)&&!Fb(c,e,f))return a.clone()}else return a.clone();c=oe(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new ge(h,k,C(a)?a.format:0,C(a)?
|
|
126
|
+
a.style:"")}function v(){return Vb()._selection}function ic(){return H()._editorState._selection}
|
|
127
|
+
function Yd(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)){g=b.__key;if(a.isCollapsed()){if(b=e.offset,c<=b&&0<d||c<b&&0>d)c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Ie(a)}else{let n=a.isBackward();h=n?f:e;var k=h.getNode();e=n?e:f;f=e.getNode();b.is(k)&&(k=h.offset,(c<=k&&0<d||c<k&&0>d)&&h.set(g,Math.max(0,k+d),"element"));b.is(f)&&(b=e.offset,(c<=b&&0<d||c<b&&0>d)&&e.set(g,Math.max(0,b+d),"element"))}Ie(a)}}
|
|
127
128
|
function Ie(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())F(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),B(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(F(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);B(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}F(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
|
|
128
129
|
1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function Je(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(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))}}
|
|
129
130
|
function Xd(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):F(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,B(e)?h="text":F(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 Ke(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
|
130
|
-
function ne(a,b,c){let d=[],e=null,f=null;a=a.getChildren();for(let
|
|
131
|
-
let
|
|
131
|
+
function ne(a,b,c){let d=[],e=null,f=null;a=a.getChildren();for(let m=0;m<a.length;m++){var g=a[m];le(g)||q(108);var h=g.getChildren();g=0;for(let p of h){for(ke(p)||q(109);void 0!==d[m]&&void 0!==d[m][g];)g++;h=m;var k=g,n=p;let l={cell:n,startColumn:k,startRow:h},r=n.__rowSpan,u=n.__colSpan;for(let x=0;x<r;x++){void 0===d[h+x]&&(d[h+x]=[]);for(let y=0;y<u;y++)d[h+x][k+y]=l}b.is(n)&&(e=l);c.is(n)&&(f=l);g+=p.__colSpan}}null===e&&q(110);null===f&&q(111);return[d,e,f]}
|
|
132
|
+
let T=null,Y=null,Z=!1,Le=!1,Ub=0,Me={characterData:!0,childList:!0,subtree:!0};function Zb(){return Z||null!==T&&T._readOnly}function G(){Z&&q(13)}function Vb(){null===T&&q(15);return T}function H(){null===Y&&q(16);return Y}function Ne(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&q(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++);}
|
|
132
133
|
function Oe(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Fc(b)}
|
|
133
|
-
function Pe(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Yb(),f=new Map;var g=c;let h=g.size;for(var k=d,
|
|
134
|
-
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&Ne(b,g,f),d.set(k,
|
|
135
|
-
function Se(a){let b=a._pendingEditorState,c=a._rootElement,d=a._headless||null===c;if(null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=
|
|
136
|
-
$c=b._nodeMap;Uc=b._readOnly;ad=new Map(a._keyToDOMMap);let
|
|
137
|
-
new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var ve=a._decorators,Jb=a._pendingDecorators||ve,qf=b._nodeMap,
|
|
138
|
-
|
|
139
|
-
ze&&
|
|
140
|
-
|
|
141
|
-
g.anchor
|
|
142
|
-
|
|
143
|
-
null!==
|
|
144
|
-
function Ue(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}}function
|
|
134
|
+
function Pe(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Yb(),f=new Map;var g=c;let h=g.size;for(var k=d,n=k.size;0<h||0<n;){if(0<h){b._dirtyLeaves=new Set;for(let m of g)g=a.get(m),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&Fc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&Ne(b,g,f),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){Ub++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let m of k)if(k=m[0],n=m[1],"root"===k||n)g=a.get(k),void 0!==
|
|
135
|
+
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&Ne(b,g,f),d.set(k,n);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;n=k.size;Ub++}b._dirtyLeaves=c;b._dirtyElements=d}function Qe(a,b){var c=b.get(a.type);void 0===c&&q(17);c=c.klass;a.type!==c.getType()&&q(18);c=c.importJSON(a);a=a.children;if(F(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=Qe(a[d],b);c.append(e)}return c}function Re(a,b){let c=T,d=Z,e=Y;T=a;Z=!0;Y=null;try{return b()}finally{T=c,Z=d,Y=e}}
|
|
136
|
+
function Se(a){let b=a._pendingEditorState,c=a._rootElement,d=a._headless||null===c;if(null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=T,n=Z,m=Y,p=a._updating,l=a._observer,r=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==l){Y=a;T=b;Z=!1;a._updating=!0;try{let D=a._dirtyType,P=a._dirtyElements,Q=a._dirtyLeaves;l.disconnect();var u=D,x=P,y=Q;O=Ic=N="";Tc=2===u;Wc=null;R=a;Rc=a._config;Sc=a._nodes;Vc=R._listeners.mutation;Xc=x;Yc=y;Zc=e._nodeMap;
|
|
137
|
+
$c=b._nodeMap;Uc=b._readOnly;ad=new Map(a._keyToDOMMap);let ha=new Map;bd=ha;pd("root",null);bd=ad=Rc=$c=Zc=Yc=Xc=Sc=R=void 0;r=ha}catch(D){D instanceof Error&&a._onError(D);if(Le)throw D;Te(a,null,c,b);Ab(a);a._dirtyType=2;Le=!0;Se(a);Le=!1;return}finally{l.observe(c,Me),a._updating=p,T=k,Z=n,Y=m}}b._readOnly||(b._readOnly=!0);var A=a._dirtyLeaves,aa=a._dirtyElements,ba=a._normalizedNodes,oa=a._updateTags,pa=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
|
|
138
|
+
new Map,a._normalizedNodes=new Set,a._updateTags=new Set);var ve=a._decorators,Jb=a._pendingDecorators||ve,qf=b._nodeMap,Jc;for(Jc in Jb)qf.has(Jc)||(Jb===ve&&(Jb=$b(a)),delete Jb[Jc]);var ia=d?null:E(a._window);if(a._editable&&null!==ia&&(h||null===g||g.dirty)){Y=a;T=b;try{null!==l&&l.disconnect();if(h||null===g||g.dirty){let D=a._blockCursorElement;null!==D&&xc(D,a,c);a:{let P=ia.anchorNode,Q=ia.focusNode,ha=ia.anchorOffset,hb=ia.focusOffset,V=document.activeElement;if(!(oa.has("collaboration")&&
|
|
139
|
+
V!==c||null!==V&&Eb(V)))if(C(g)){var ib=g.anchor,Kc=g.focus,we=ib.key,rf=Kc.key,xe=pc(a,we),ye=pc(a,rf),Kb=ib.offset,ze=Kc.offset,Lc=g.format,Mc=g.style,Ae=g.isCollapsed(),jb=xe,Lb=ye,Nc=!1;if("text"===ib.type){jb=Pb(xe);let W=ib.getNode();Nc=W.getFormat()!==Lc||W.getStyle()!==Mc}else C(f)&&"text"===f.anchor.type&&(Nc=!0);"text"===Kc.type&&(Lb=Pb(ye));if(null!==jb&&null!==Lb){if(Ae&&(null===f||Nc||C(f)&&(f.format!==Lc||f.style!==Mc))){var sf=performance.now();Jd=[Lc,Mc,Kb,we,sf]}if(ha===Kb&&hb===
|
|
140
|
+
ze&&P===jb&&Q===Lb&&("Range"!==ia.type||!Ae)&&(null!==V&&c.contains(V)||c.focus({preventScroll:!0}),"element"!==ib.type))break a;try{ia.setBaseAndExtent(jb,Kb,Lb,ze)}catch(W){}if(!oa.has("skip-scroll-into-view")&&g.isCollapsed()&&null!==c&&c===document.activeElement){let W=g instanceof ge&&"element"===g.anchor.type?jb.childNodes[Kb]||null:0<ia.rangeCount?ia.getRangeAt(0):null;if(null!==W){let X;if(W instanceof Text){let U=document.createRange();U.selectNode(W);X=U.getBoundingClientRect()}else X=W.getBoundingClientRect();
|
|
141
|
+
let va=c.ownerDocument,Ea=va.defaultView;if(null!==Ea)for(var {top:Oc,bottom:Pc}=X,Mb,Nb,ma=c;null!==ma;){let U=ma===va.body;if(U)Mb=0,Nb=Bb(a).innerHeight;else{let Ob=ma.getBoundingClientRect();Mb=Ob.top;Nb=Ob.bottom}let Fa=0;Oc<Mb?Fa=-(Mb-Oc):Pc>Nb&&(Fa=Pc-Nb);if(0!==Fa)if(U)Ea.scrollBy(0,Fa);else{let Ob=ma.scrollTop;ma.scrollTop+=Fa;let Be=ma.scrollTop-Ob;Oc-=Be;Pc-=Be}if(U)break;ma=Hb(ma)}}}Fd=!0}}else null!==f&&Fb(a,P,Q)&&ia.removeAllRanges()}}a:{let D=a._blockCursorElement;if(C(g)&&g.isCollapsed()&&
|
|
142
|
+
"element"===g.anchor.type&&c.contains(document.activeElement)){let P=g.anchor,Q=P.getNode(),ha=P.offset,hb=Q.getChildrenSize(),V=!1,W=null;if(ha===hb){let X=Q.getChildAtIndex(ha-1);wc(X)&&(V=!0)}else{let X=Q.getChildAtIndex(ha);if(wc(X)){let va=X.getPreviousSibling();if(null===va||wc(va))V=!0,W=a.getElementByKey(X.__key)}}if(V){let X=a.getElementByKey(Q.__key);if(null===D){let va=a._config.theme,Ea=document.createElement("div");Ea.contentEditable="false";Ea.setAttribute("data-lexical-cursor","true");
|
|
143
|
+
let U=va.blockCursor;if(void 0!==U){if("string"===typeof U){let Fa=U.split(" ");U=va.blockCursor=Fa}void 0!==U&&Ea.classList.add(...U)}a._blockCursorElement=D=Ea}c.style.caretColor="transparent";null===W?X.appendChild(D):X.insertBefore(D,W);break a}}null!==D&&xc(D,a,c)}null!==l&&l.observe(c,Me)}finally{Y=m,T=k}}if(null!==r){var tf=r;let D=Array.from(a._listeners.mutation),P=D.length;for(let Q=0;Q<P;Q++){let [ha,hb]=D[Q],V=tf.get(hb);void 0!==V&&ha(V,{dirtyLeaves:A,updateTags:oa})}}C(g)||null===g||
|
|
144
|
+
null!==f&&f.is(g)||a.dispatchCommand(ca,void 0);var Qc=a._pendingDecorators;null!==Qc&&(a._decorators=Qc,a._pendingDecorators=null,Ue("decorator",a,!0,Qc));var uf=ac(e),Ce=ac(b);uf!==Ce&&Ue("textcontent",a,!0,Ce);Ue("update",a,!0,{dirtyElements:aa,dirtyLeaves:A,editorState:b,normalizedNodes:ba,prevEditorState:e,tags:oa});a._deferred=[];if(0!==pa.length){let D=a._updating;a._updating=!0;try{for(let P=0;P<pa.length;P++)pa[P]()}finally{a._updating=D}}var De=a._updates;if(0!==De.length){let D=De.shift();
|
|
145
|
+
if(D){let [P,Q]=D;Ve(a,P,Q)}}}}function Ue(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}}function S(a,b,c){if(!1===a._updating||Y!==a){let f=!1;a.update(()=>{f=S(a,b,c)});return f}let d=fc(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}
|
|
145
146
|
function We(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}
|
|
146
|
-
function Ve(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 Xe(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=
|
|
147
|
-
b();e=We(a,e);Je(g,a);0!==a._dirtyType&&(e?Oe(g,a):Pe(g,a),We(a),Cc(c,g,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(g._flushSync=!0);let l=g._selection;if(C(l)){let r=g._nodeMap,
|
|
148
|
-
a._updating=
|
|
149
|
-
class $e extends Zd{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return
|
|
147
|
+
function Ve(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 Xe(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=T;let k=Z,n=Y,m=a._updating;T=g;Z=!1;a._updating=!0;Y=a;try{h&&(a._headless?null!=c._selection&&(g._selection=c._selection.clone()):g._selection=He(a));let p=a._compositionKey;
|
|
148
|
+
b();e=We(a,e);Je(g,a);0!==a._dirtyType&&(e?Oe(g,a):Pe(g,a),We(a),Cc(c,g,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(g._flushSync=!0);let l=g._selection;if(C(l)){let r=g._nodeMap,u=l.focus.key;void 0!==r.get(l.anchor.key)&&void 0!==r.get(u)||q(19)}else Qd(l)&&0===l._nodes.size&&(g._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Se(a);return}finally{T=f,Z=k,Y=n,
|
|
149
|
+
a._updating=m,Ub=0}0!==a._dirtyType||Ye(g,a)?g._flushSync?(g._flushSync=!1,Se(a)):h&&Db(()=>{Se(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function w(a,b,c){a._updating?a._updates.push([b,c]):Ve(a,b,c)}class Ze extends Zd{constructor(a){super(a)}decorate(){q(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function z(a){return a instanceof Ze}
|
|
150
|
+
class $e extends Zd{constructor(a){super(a);this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return lb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b),b=b.getNextSibling();return a}getChildrenKeys(){let a=[],b=this.getFirstChild();for(;null!==b;)a.push(b.__key),b=b.getNextSibling();return a}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===
|
|
150
151
|
this.getChildrenSize()}isDirty(){let a=H()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest(),b=this.getParentOrThrow().getLastChild();return null!==b&&b.is(a)}getAllTextNodes(){let a=[],b=this.getFirstChild();for(;null!==b;){B(b)&&a.push(b);if(F(b)){let c=b.getAllTextNodes();a.push(...c)}b=b.getNextSibling()}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(F(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
|
|
151
|
-
this.getLastChild();for(;null!==a;){if(F(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],F(a)&&a.getLastDescendant()||a||null;a=b[a];return F(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:
|
|
152
|
+
this.getLastChild();for(;null!==a;){if(F(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],F(a)&&a.getLastDescendant()||a||null;a=b[a];return F(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__first;return null===a?null:J(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&q(45);return a}getLastChild(){let a=this.getLatest().__last;return null===a?null:J(a)}getLastChildOrThrow(){let a=
|
|
152
153
|
this.getLastChild();null===a&&q(96);return a}getChildAtIndex(a){var b=this.getChildrenSize();let c;if(a<b/2){c=this.getFirstChild();for(b=0;null!==c&&b<=a;){if(b===a)return c;c=c.getNextSibling();b++}return null}c=this.getLastChild();for(--b;null!==c&&b>=a;){if(b===a)return c;c=c.getPreviousSibling();b--}return null}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();F(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getTextContentSize(){let a=
|
|
153
|
-
0,b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();F(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=
|
|
154
|
+
0,b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContentSize();F(e)&&d!==c-1&&!e.isInline()&&(a+=2)}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=kb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=v(),d=a,e=b;var f=this.getChildrenSize();if(!this.canBeEmpty())if(0===a&&0===b){if(a=this.getFirstChild(),B(a)||F(a))return a.select(0,0)}else if(!(void 0!==a&&a!==f||void 0!==b&&b!==f)&&(a=this.getLastChild(),B(a)||F(a)))return a.select();
|
|
154
155
|
void 0===d&&(d=f);void 0===e&&(e=f);f=this.__key;if(C(c))c.anchor.set(f,d,"element"),c.focus.set(f,e,"element"),c.dirty=!0;else return Ge(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return F(a)||B(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return F(a)||B(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(),
|
|
155
|
-
0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?
|
|
156
|
-
for(l=0;l<b;l++){null===r&&q(100);var
|
|
157
|
-
l.__key,b.__next=
|
|
156
|
+
0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?kb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let n=this.getChildAtIndex(a+b),m=null,p=e-b+d;if(0!==a)if(a===e)m=this.getLastChild();else{var l=this.getChildAtIndex(a);null!==l&&(m=l.getPreviousSibling())}if(0<b){var r=null===m?this.getFirstChild():m.getNextSibling();
|
|
157
|
+
for(l=0;l<b;l++){null===r&&q(100);var u=r.getNextSibling(),x=r.__key;r=r.getWritable();Wb(r);k.push(x);r=u}}l=m;for(u=0;u<d;u++){x=c[u];null!==l&&x.is(l)&&(m=l=l.getPreviousSibling());r=x.getWritable();r.__parent===g&&p--;Wb(r);let y=x.__key;null===l?(f.__first=y,r.__prev=null):(l=l.getWritable(),l.__next=y,r.__prev=l.__key);x.__key===g&&q(76);r.__parent=g;h.push(y);l=x}a+b===e?null!==l&&(l.getWritable().__next=null,f.__last=l.__key):null!==n&&(a=n.getWritable(),null!==l?(b=l.getWritable(),a.__prev=
|
|
158
|
+
l.__key,b.__next=n.__key):a.__prev=null);f.__size=p;if(k.length&&(a=v(),C(a))){k=new Set(k);h=new Set(h);let {anchor:y,focus:A}=a;af(y,k,h)&&Xd(y,y.getNode(),this,m,n);af(A,k,h)&&Xd(A,A.getNode(),this,m,n);0!==p||this.canBeEmpty()||M(this)||this.remove()}return f}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),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}}
|
|
158
159
|
function F(a){return a instanceof $e}function af(a,b,c){for(a=a.getNode();a;){let d=a.__key;if(b.has(d)&&!c.has(d))return!0;a=a.getParent()}return!1}
|
|
159
160
|
class bf extends $e{static getType(){return"root"}static clone(){return new bf}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(51)}getTextContent(){let a=this.__cachedText;return!Zb()&&0!==H()._dirtyType||null===a?super.getTextContent():a}remove(){q(52)}replace(){q(53)}insertBefore(){q(54)}insertAfter(){q(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];F(c)||z(c)||q(56)}return super.append(...a)}static importJSON(a){let b=bc();b.setFormat(a.format);
|
|
160
|
-
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}}collapseAtStart(){return!0}}function
|
|
161
|
+
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}}collapseAtStart(){return!0}}function L(a){return a instanceof bf}function Ye(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 cf(){return new Xe(new Map([["root",new bf]]))}
|
|
161
162
|
function df(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&q(58);let c=b.children;if(F(a)){Array.isArray(c)||q(59);a=a.getChildren();for(let d=0;d<a.length;d++){let e=df(a[d]);c.push(e)}}return b}
|
|
162
163
|
class Xe{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 Re(this,a)}clone(a){a=new Xe(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return Re(this,()=>({root:df(bc())}))}}
|
|
163
164
|
class ef extends Zd{static getType(){return"linebreak"}static clone(a){return new ef(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:ff,priority:0}}}}static importJSON(){return pe()}exportJSON(){return{type:"linebreak",version:1}}}function ff(){return{node:pe()}}function pe(){return uc(new ef)}
|
|
164
|
-
function
|
|
165
|
-
function jf(a,b,c,d,e){a=d.classList;d=kc(e,"base");void 0!==d&&a.add(...d);d=kc(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
|
|
166
|
-
function kf(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?
|
|
167
|
-
class mf extends Zd{static getType(){return"text"}static clone(a){return new mf(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
|
|
168
|
-
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=
|
|
169
|
-
a=a.theme.text;void 0!==a&&jf(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=gf(this,e);let h=gf(this,f);var k=hf(this,e);let
|
|
170
|
-
void 0!==c&&e!==f&&jf(
|
|
171
|
-
priority:0}),u:()=>({conversion:vf,priority:0})}}static importJSON(a){let b=
|
|
172
|
-
style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?
|
|
173
|
-
a.__detail^=2;return a}setMode(a){a=
|
|
165
|
+
function Sb(a){return a instanceof ef}function gf(a,b){return b&16?"code":b&128?"mark":b&32?"sub":b&64?"sup":null}function hf(a,b){return b&1?"strong":b&2?"em":"span"}
|
|
166
|
+
function jf(a,b,c,d,e){a=d.classList;d=kc(e,"base");void 0!==d&&a.add(...d);d=kc(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 fb)h=fb[k],d=kc(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))}
|
|
167
|
+
function kf(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?bb:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Wa){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,n]=a;0!==k&&d.deleteData(h,k);d.insertData(h,n)}else d.nodeValue=a}function lf(a,b){b=document.createElement(b);b.appendChild(a);return b}
|
|
168
|
+
class mf extends Zd{static getType(){return"text"}static clone(a){return new mf(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 nb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Yb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
|
169
|
+
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=fb[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 Qb(c,a,b)}createDOM(a){var b=this.__format,c=gf(this,b);let d=hf(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;kf(this.__text,c,this);
|
|
170
|
+
a=a.theme.text;void 0!==a&&jf(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=gf(this,e);let h=gf(this,f);var k=hf(this,e);let n=hf(this,f);if((null===g?k:g)!==(null===h?n:h))return!0;if(g===h&&k!==n)return e=b.firstChild,null==e&&q(48),a=g=document.createElement(n),kf(d,a,this),c=c.theme.text,void 0!==c&&jf(n,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&q(49));kf(d,k,this);c=c.theme.text;
|
|
171
|
+
void 0!==c&&e!==f&&jf(n,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:nf,priority:0}),b:()=>({conversion:of,priority:0}),br:()=>({conversion:pf,priority:0}),code:()=>({conversion:vf,priority:0}),em:()=>({conversion:vf,priority:0}),i:()=>({conversion:vf,priority:0}),s:()=>({conversion:vf,priority:0}),span:()=>({conversion:wf,priority:0}),strong:()=>({conversion:vf,priority:0}),sub:()=>({conversion:vf,priority:0}),sup:()=>({conversion:vf,
|
|
172
|
+
priority:0}),u:()=>({conversion:vf,priority:0})}}static importJSON(a){let b=K(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportDOM(a){({element:a}=super.exportDOM(a));null!==a&&(this.hasFormat("bold")&&(a=lf(a,"b")),this.hasFormat("italic")&&(a=lf(a,"i")),this.hasFormat("strikethrough")&&(a=lf(a,"s")),this.hasFormat("underline")&&(a=lf(a,"u")));return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),
|
|
173
|
+
style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?fb[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?gb[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=fb[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();
|
|
174
|
+
a.__detail^=2;return a}setMode(a){a=mb[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){G();let c=v();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(C(c))d=Yb(),d!==c.anchor.key&&d!==c.focus.key||I(e),c.setTextNodeRange(this,a,this,b);else return Ge(e,a,e,b,"text","text");return c}spliceText(a,
|
|
174
175
|
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=v();d&&C(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}canContainTabs(){return!1}splitText(...a){G();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Yb(),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);f=a.length;if(0===f)return[];
|
|
175
|
-
if(a[0]===c)return[b];var
|
|
176
|
-
A.offset>
|
|
176
|
+
if(a[0]===c)return[b];var n=a[0];c=b.getParentOrThrow();k=b.getFormat();let m=b.getStyle(),p=b.__detail;g=!1;b.isSegmented()?(h=K(n),h.__format=k,h.__style=m,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=n);b=v();h=[h];n=n.length;for(let u=1;u<f;u++){var l=a[u],r=l.length;l=K(l).getWritable();l.__format=k;l.__style=m;l.__detail=p;let x=l.__key;r=n+r;if(C(b)){let y=b.anchor,A=b.focus;y.key===d&&"text"===y.type&&y.offset>n&&y.offset<=r&&(y.key=x,y.offset-=n,b.dirty=!0);A.key===d&&"text"===A.type&&
|
|
177
|
+
A.offset>n&&A.offset<=r&&(A.key=x,A.offset-=n,b.dirty=!0)}e===d&&I(x);n=r;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&Xb(d);null!==e&&Xb(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Yd(b,c,e,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||q(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Yb()===d&&I(c);let g=v();if(C(g)){let h=g.anchor,k=g.focus;
|
|
177
178
|
null!==h&&h.key===d&&(Ke(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Ke(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}}
|
|
178
179
|
function wf(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(!B(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}}function pf(){return{node:pe()}}
|
|
179
|
-
function of(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function nf(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:
|
|
180
|
-
function vf(a){let b=xf[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function
|
|
180
|
+
function of(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function nf(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:K(a)}}let xf={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};
|
|
181
|
+
function vf(a){let b=xf[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&!c.hasFormat(b)&&c.toggleFormat(b);return c},node:null}}function K(a=""){return uc(new mf(a))}function B(a){return a instanceof mf}
|
|
181
182
|
class yf extends $e{static getType(){return"paragraph"}static clone(a){return new yf(a.__key)}createDOM(a){let b=document.createElement("p");a=kc(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:zf,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();
|
|
182
183
|
0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=ae();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(a,b){a=ae();let c=this.getDirection();a.setDirection(c);this.insertAfter(a,b);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),
|
|
183
184
|
this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function zf(a){let b=ae();a.style&&(b.setFormat(a.style.textAlign),a=parseInt(a.style.textIndent,10)/20,0<a&&b.setIndent(a));return{node:b}}function ae(){return uc(new yf)}
|
|
184
185
|
function Te(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=cf();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=[];a._blockCursorElement=null;d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",e.set("root",c))}
|
|
185
186
|
function Af(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}
|
|
186
|
-
class Bf{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=
|
|
187
|
-
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=gc();this._onError=e;this._htmlConversions=f;this._editable
|
|
187
|
+
class Bf{constructor(a,b,c,d,e,f,g){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=
|
|
188
|
+
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=gc();this._onError=e;this._htmlConversions=f;this._editable=g;this._headless=null!==b&&b._headless;this._blockCursorElement=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=
|
|
188
189
|
this._listeners.decorator;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&&q(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&&q(36);let f=e[c];f.add(b);return()=>{f.delete(b);e.every(g=>
|
|
189
190
|
0===g.size)&&d.delete(a)}}registerMutationListener(a,b){void 0===this._nodes.get(a.getType())&&q(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransformToKlass(a,b){a=a.getType();a=this._nodes.get(a);void 0===a&&q(37);a.transforms.add(b);return a}registerNodeTransform(a,b){var c=this.registerNodeTransformToKlass(a,b);let d=[c];c=c.replaceWithKlass;null!=c&&(c=this.registerNodeTransformToKlass(c,b),d.push(c));cc(this,a.getType());return()=>{d.forEach(e=>e.transforms.delete(b))}}hasNodes(a){for(let b=
|
|
190
|
-
0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return
|
|
191
|
-
Td));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=fc(c);d=d[d.length-1]._key;Sd.get(d)===c&&Sd.delete(d)}else Sd.delete(c._key);b.__lexicalEditor=null}c=Rd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}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,
|
|
192
|
-
this._updateTags.add("history-merge"),Se(this),this._config.disableEvents||Vd(a,this),null!=e&&a.classList.add(...e)):this._window=null;Ue("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(38);
|
|
193
|
-
!1);this._compositionKey=null;null!=b&&d.add(b);Se(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=cf(),d=
|
|
194
|
-
k,this._dirtyType=
|
|
195
|
-
null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,Ue("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}
|
|
196
|
-
class
|
|
197
|
-
exports.$
|
|
198
|
-
exports.$
|
|
199
|
-
exports.$
|
|
200
|
-
exports
|
|
201
|
-
exports.
|
|
202
|
-
exports.DEPRECATED_$
|
|
203
|
-
exports.DEPRECATED_$
|
|
204
|
-
exports.
|
|
205
|
-
exports.
|
|
206
|
-
exports.createEditor=function(a){var b=a||{},c=
|
|
207
|
-
null!==x&&y.add(x);a.set(
|
|
191
|
+
0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return S(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=this._rootElement;if(a!==b){let e=kc(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;Te(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==Ed&&(Ed--,0===Ed&&b.ownerDocument.removeEventListener("selectionchange",
|
|
192
|
+
Td));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=fc(c);d=d[d.length-1]._key;Sd.get(d)===c&&Sd.delete(d)}else Sd.delete(c._key);b.__lexicalEditor=null}c=Rd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}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,Ab(this),
|
|
193
|
+
this._updateTags.add("history-merge"),Se(this),this._config.disableEvents||Vd(a,this),null!=e&&a.classList.add(...e)):this._window=null;Ue("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(38);zb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),Se(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",
|
|
194
|
+
!1);this._compositionKey=null;null!=b&&d.add(b);Se(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=cf(),d=T,e=Z,f=Y,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,n=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;T=c;Z=!1;Y=this;try{Qe(a.root,this._nodes),b&&b(),c._readOnly=!0}catch(m){m instanceof Error&&this._onError(m)}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=
|
|
195
|
+
k,this._dirtyType=n,T=d,Z=e,Y=f}return c}update(a,b){w(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),w(this,()=>{let d=v(),e=bc();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");a&&a()},tag:"focus"}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=E(this._window);
|
|
196
|
+
null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,Ue("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}
|
|
197
|
+
class Cf extends $e{constructor(a,b){super(b);this.__colSpan=a;this.__rowSpan=1}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan,rowSpan:this.__rowSpan}}getColSpan(){return this.__colSpan}setColSpan(a){this.getWritable().__colSpan=a;return this}getRowSpan(){return this.__rowSpan}setRowSpan(a){this.getWritable().__rowSpan=a;return this}}function ke(a){return a instanceof Cf}class Df extends $e{}function me(a){return a instanceof Df}class Ef extends $e{}
|
|
198
|
+
function le(a){return a instanceof Ef}exports.$addUpdateTag=function(a){G();H()._updateTags.add(a)};exports.$applyNodeReplacement=uc;exports.$copyNode=tc;exports.$createLineBreakNode=pe;exports.$createNodeSelection=se;exports.$createParagraphNode=ae;exports.$createRangeSelection=function(){let a=new be("root",0,"element"),b=new be("root",0,"element");return new ge(a,b,0,"")};exports.$createTextNode=K;exports.$getAdjacentNode=nc;exports.$getNearestNodeFromDOMNode=ub;
|
|
199
|
+
exports.$getNearestRootOrShadowRoot=sc;exports.$getNodeByKey=J;exports.$getPreviousSelection=ic;exports.$getRoot=bc;exports.$getSelection=v;exports.$getTextContent=function(){let a=v();return null===a?"":a.getTextContent()};exports.$hasAncestor=rc;exports.$hasUpdateTag=function(a){return H()._updateTags.has(a)};exports.$insertNodes=function(a,b){let c=v();null===c&&(c=bc().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=z;exports.$isElementNode=F;
|
|
200
|
+
exports.$isInlineElementOrDecoratorNode=function(a){return F(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=Rb;exports.$isLineBreakNode=Sb;exports.$isNodeSelection=Qd;exports.$isParagraphNode=function(a){return a instanceof yf};exports.$isRangeSelection=C;exports.$isRootNode=L;exports.$isRootOrShadowRoot=M;exports.$isTextNode=B;
|
|
201
|
+
exports.$nodesOfType=function(a){var b=Vb();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=Gc;exports.$parseSerializedNode=function(a){return Qe(a,H()._nodes)};exports.$setCompositionKey=I;exports.$setSelection=xb;exports.$splitNode=yc;exports.BLUR_COMMAND=Sa;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};
|
|
202
|
+
exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=da;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=ka;exports.COPY_COMMAND=Pa;exports.CUT_COMMAND=Qa;exports.DELETE_CHARACTER_COMMAND=ea;exports.DELETE_LINE_COMMAND=ra;exports.DELETE_WORD_COMMAND=qa;exports.DEPRECATED_$computeGridMap=ne;
|
|
203
|
+
exports.DEPRECATED_$createGridSelection=function(){let a=new be("root",0,"element"),b=new be("root",0,"element");return new he("root",a,b)};exports.DEPRECATED_$getNodeTriplet=function(a){a instanceof Cf||(a instanceof Zd?(a=zc(a,ke),ke(a)||q(114)):(a=zc(a.getNode(),ke),ke(a)||q(114)));let b=a.getParent();le(b)||q(115);let c=b.getParent();me(c)||q(116);return[a,b,c]};exports.DEPRECATED_$isGridCellNode=ke;exports.DEPRECATED_$isGridNode=me;exports.DEPRECATED_$isGridRowNode=le;
|
|
204
|
+
exports.DEPRECATED_$isGridSelection=ie;exports.DEPRECATED_GridCellNode=Cf;exports.DEPRECATED_GridNode=Df;exports.DEPRECATED_GridRowNode=Ef;exports.DRAGEND_COMMAND=Oa;exports.DRAGOVER_COMMAND=Na;exports.DRAGSTART_COMMAND=Ma;exports.DROP_COMMAND=La;exports.DecoratorNode=Ze;exports.ElementNode=$e;exports.FOCUS_COMMAND=Ra;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=sa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=fa;exports.INSERT_PARAGRAPH_COMMAND=ja;
|
|
205
|
+
exports.KEY_ARROW_DOWN_COMMAND=Ca;exports.KEY_ARROW_LEFT_COMMAND=za;exports.KEY_ARROW_RIGHT_COMMAND=xa;exports.KEY_ARROW_UP_COMMAND=Ba;exports.KEY_BACKSPACE_COMMAND=Ha;exports.KEY_DELETE_COMMAND=Ja;exports.KEY_DOWN_COMMAND=wa;exports.KEY_ENTER_COMMAND=Da;exports.KEY_ESCAPE_COMMAND=Ia;exports.KEY_MODIFIER_COMMAND=Ta;exports.KEY_SPACE_COMMAND=Ga;exports.KEY_TAB_COMMAND=Ka;exports.LineBreakNode=ef;exports.MOVE_TO_END=ya;exports.MOVE_TO_START=Aa;exports.OUTDENT_CONTENT_COMMAND={};
|
|
206
|
+
exports.PASTE_COMMAND=la;exports.ParagraphNode=yf;exports.REDO_COMMAND=ua;exports.REMOVE_TEXT_COMMAND=na;exports.RootNode=bf;exports.SELECTION_CHANGE_COMMAND=ca;exports.TextNode=mf;exports.UNDO_COMMAND=ta;exports.createCommand=function(){return{}};
|
|
207
|
+
exports.createEditor=function(a){var b=a||{},c=Y,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=cf(),h=b.namespace||(null!==e?e._config.namespace:gc()),k=b.editorState,n=[bf,mf,ef,yf,...(b.nodes||[])],m=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<n.length;c++){let l=n[c],r=null;var p=null;"function"!==typeof l&&(p=l,l=p.replace,r=p.with,p=p.withKlass?p.withKlass:null);let u=l.getType(),x=l.transform(),y=new Set;
|
|
208
|
+
null!==x&&y.add(x);a.set(u,{klass:l,replace:r,replaceWithKlass:p,transforms:y})}d=new Bf(g,e,a,{disableEvents:f,namespace:h,theme:d},m?m:console.error,Af(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d};exports.getNearestEditorFromDOMNode=Gb;exports.isSelectionCapturedInDecoratorInput=Eb;exports.isSelectionWithinEditor=Fb
|
package/LexicalNode.d.ts
CHANGED
|
@@ -247,7 +247,7 @@ export declare class LexicalNode {
|
|
|
247
247
|
exportJSON(): SerializedLexicalNode;
|
|
248
248
|
/**
|
|
249
249
|
* Controls how the this node is deserialized from JSON. This is usually boilerplate,
|
|
250
|
-
* but provides an abstraction
|
|
250
|
+
* but provides an abstraction between the node implementation and serialized interface that can
|
|
251
251
|
* be important if you ever make breaking changes to a node schema (by adding or removing properties).
|
|
252
252
|
* See [Serialization & Deserialization](https://lexical.dev/docs/concepts/serialization#lexical---html).
|
|
253
253
|
*
|
package/LexicalUtils.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export declare function isReturn(keyCode: number): boolean;
|
|
|
83
83
|
export declare function isBackspace(keyCode: number): boolean;
|
|
84
84
|
export declare function isEscape(keyCode: number): boolean;
|
|
85
85
|
export declare function isDelete(keyCode: number): boolean;
|
|
86
|
+
export declare function isSelectAll(keyCode: number, metaKey: boolean, ctrlKey: boolean): boolean;
|
|
86
87
|
export declare function getCachedClassNameArray(classNamesTheme: EditorThemeClasses, classNameThemeType: string): Array<string>;
|
|
87
88
|
export declare function setMutatedNode(mutatedNodes: MutatedNodes, registeredNodes: RegisteredNodes, mutationListeners: MutationListeners, node: LexicalNode, mutation: NodeMutation): void;
|
|
88
89
|
export declare function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<T>;
|
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_$computeGridMap, DEPRECATED_$createGridSelection, DEPRECATED_$getNodeTriplet, DEPRECATED_$isGridSelection, } from './LexicalSelection';
|
|
23
23
|
export { $parseSerializedNode } from './LexicalUpdates';
|
|
24
|
-
export { $addUpdateTag, $applyNodeReplacement, $copyNode, $getAdjacentNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, $splitNode, getNearestEditorFromDOMNode, isSelectionWithinEditor, } from './LexicalUtils';
|
|
24
|
+
export { $addUpdateTag, $applyNodeReplacement, $copyNode, $getAdjacentNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $hasUpdateTag, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $setCompositionKey, $setSelection, $splitNode, getNearestEditorFromDOMNode, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, } from './LexicalUtils';
|
|
25
25
|
export { $isDecoratorNode, DecoratorNode } from './nodes/LexicalDecoratorNode';
|
|
26
26
|
export { $isElementNode, ElementNode } from './nodes/LexicalElementNode';
|
|
27
27
|
export { DEPRECATED_$isGridCellNode, DEPRECATED_GridCellNode, } from './nodes/LexicalGridCellNode';
|
|
@@ -9,6 +9,7 @@ import type { LexicalNode, NodeKey, SerializedElementNode, Spread } from 'lexica
|
|
|
9
9
|
import { ElementNode } from './LexicalElementNode';
|
|
10
10
|
export declare type SerializedGridCellNode = Spread<{
|
|
11
11
|
colSpan: number;
|
|
12
|
+
rowSpan: number;
|
|
12
13
|
}, SerializedElementNode>;
|
|
13
14
|
/** @noInheritDoc */
|
|
14
15
|
export declare class DEPRECATED_GridCellNode extends ElementNode {
|
|
@@ -17,7 +18,9 @@ export declare class DEPRECATED_GridCellNode extends ElementNode {
|
|
|
17
18
|
__rowSpan: number;
|
|
18
19
|
constructor(colSpan: number, key?: NodeKey);
|
|
19
20
|
exportJSON(): SerializedGridCellNode;
|
|
21
|
+
getColSpan(): number;
|
|
20
22
|
setColSpan(colSpan: number): this;
|
|
23
|
+
getRowSpan(): number;
|
|
21
24
|
setRowSpan(rowSpan: number): this;
|
|
22
25
|
}
|
|
23
26
|
export declare function DEPRECATED_$isGridCellNode(node: DEPRECATED_GridCellNode | LexicalNode | null | undefined): node is DEPRECATED_GridCellNode;
|
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import type { DOMConversionMap, NodeKey, SerializedLexicalNode } from '../LexicalNode';
|
|
9
|
-
import type { Spread } from 'lexical';
|
|
10
9
|
import { LexicalNode } from '../LexicalNode';
|
|
11
|
-
export declare type SerializedLineBreakNode =
|
|
12
|
-
type: 'linebreak';
|
|
13
|
-
}, SerializedLexicalNode>;
|
|
10
|
+
export declare type SerializedLineBreakNode = SerializedLexicalNode;
|
|
14
11
|
/** @noInheritDoc */
|
|
15
12
|
export declare class LineBreakNode extends LexicalNode {
|
|
16
13
|
static getType(): string;
|
|
@@ -8,12 +8,9 @@
|
|
|
8
8
|
import type { EditorConfig, LexicalEditor } from '../LexicalEditor';
|
|
9
9
|
import type { DOMConversionMap, DOMExportOutput, LexicalNode } from '../LexicalNode';
|
|
10
10
|
import type { SerializedElementNode } from './LexicalElementNode';
|
|
11
|
-
import type { RangeSelection
|
|
11
|
+
import type { RangeSelection } from 'lexical';
|
|
12
12
|
import { ElementNode } from './LexicalElementNode';
|
|
13
|
-
export declare type SerializedParagraphNode =
|
|
14
|
-
type: 'paragraph';
|
|
15
|
-
version: 1;
|
|
16
|
-
}, SerializedElementNode>;
|
|
13
|
+
export declare type SerializedParagraphNode = SerializedElementNode;
|
|
17
14
|
/** @noInheritDoc */
|
|
18
15
|
export declare class ParagraphNode extends ElementNode {
|
|
19
16
|
static getType(): string;
|