lexical 0.7.9 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Lexical.dev.js +69 -22
- package/Lexical.prod.js +166 -165
- package/LexicalEditor.d.ts +4 -0
- package/LexicalEvents.d.ts +1 -1
- package/LexicalSelection.d.ts +3 -1
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -1645,8 +1645,19 @@ function destroyChildren(children, _startIndex, endIndex, dom) {
|
|
|
1645
1645
|
function setTextAlign(domStyle, value) {
|
|
1646
1646
|
domStyle.setProperty('text-align', value);
|
|
1647
1647
|
}
|
|
1648
|
+
const DEFAULT_INDENT_VALUE = '20px';
|
|
1648
1649
|
function setElementIndent(dom, indent) {
|
|
1649
|
-
|
|
1650
|
+
const indentClassName = activeEditorConfig.theme.indent;
|
|
1651
|
+
if (typeof indentClassName === 'string') {
|
|
1652
|
+
const elementHasClassName = dom.classList.contains(indentClassName);
|
|
1653
|
+
if (indent > 0 && !elementHasClassName) {
|
|
1654
|
+
dom.classList.add(indentClassName);
|
|
1655
|
+
} else if (indent < 1 && elementHasClassName) {
|
|
1656
|
+
dom.classList.remove(indentClassName);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
const indentationBaseValue = getComputedStyle(dom).getPropertyValue('--lexical-indent-base-value') || DEFAULT_INDENT_VALUE;
|
|
1660
|
+
dom.style.setProperty('padding-inline-start', indent === 0 ? '' : `calc(${indent} * ${indentationBaseValue})`);
|
|
1650
1661
|
}
|
|
1651
1662
|
function setElementFormat(dom, format) {
|
|
1652
1663
|
const domStyle = dom.style;
|
|
@@ -2184,7 +2195,7 @@ let isSelectionChangeFromDOMUpdate = false;
|
|
|
2184
2195
|
let isSelectionChangeFromMouseDown = false;
|
|
2185
2196
|
let isInsertLineBreak = false;
|
|
2186
2197
|
let isFirefoxEndingComposition = false;
|
|
2187
|
-
let collapsedSelectionFormat = [0, 0, 'root', 0];
|
|
2198
|
+
let collapsedSelectionFormat = [0, '', 0, 'root', 0];
|
|
2188
2199
|
|
|
2189
2200
|
// This function is used to determine if Lexical should attempt to override
|
|
2190
2201
|
// the default browser behavior for insertion of text and use its own internal
|
|
@@ -2221,7 +2232,7 @@ function $shouldPreventDefaultAndInsertText(selection, text, timeStamp, isBefore
|
|
|
2221
2232
|
// If the DOM selection element is not the same as the backing node during beforeinput.
|
|
2222
2233
|
(isBeforeInput || !CAN_USE_BEFORE_INPUT) && backingAnchorElement !== null && !anchorNode.isComposing() && domAnchorNode !== getDOMTextNode(backingAnchorElement) ||
|
|
2223
2234
|
// Check if we're changing from bold to italics, or some other format.
|
|
2224
|
-
anchorNode.getFormat() !== selection.format ||
|
|
2235
|
+
anchorNode.getFormat() !== selection.format || anchorNode.getStyle() !== selection.style ||
|
|
2225
2236
|
// One last set of heuristics to check against.
|
|
2226
2237
|
$shouldInsertTextAfterOrBeforeTextNode(selection, anchorNode);
|
|
2227
2238
|
}
|
|
@@ -2277,14 +2288,17 @@ function onSelectionChange(domSelection, editor, isActive) {
|
|
|
2277
2288
|
// instead of getting the format from the anchor node.
|
|
2278
2289
|
const windowEvent = getWindow(editor).event;
|
|
2279
2290
|
const currentTimeStamp = windowEvent ? windowEvent.timeStamp : performance.now();
|
|
2280
|
-
const [lastFormat, lastOffset, lastKey, timeStamp] = collapsedSelectionFormat;
|
|
2291
|
+
const [lastFormat, lastStyle, lastOffset, lastKey, timeStamp] = collapsedSelectionFormat;
|
|
2281
2292
|
if (currentTimeStamp < timeStamp + 200 && anchor.offset === lastOffset && anchor.key === lastKey) {
|
|
2282
2293
|
selection.format = lastFormat;
|
|
2294
|
+
selection.style = lastStyle;
|
|
2283
2295
|
} else {
|
|
2284
2296
|
if (anchor.type === 'text') {
|
|
2285
2297
|
selection.format = anchorNode.getFormat();
|
|
2298
|
+
selection.style = anchorNode.getStyle();
|
|
2286
2299
|
} else if (anchor.type === 'element') {
|
|
2287
2300
|
selection.format = 0;
|
|
2301
|
+
selection.style = '';
|
|
2288
2302
|
}
|
|
2289
2303
|
}
|
|
2290
2304
|
} else {
|
|
@@ -2295,6 +2309,7 @@ function onSelectionChange(domSelection, editor, isActive) {
|
|
|
2295
2309
|
for (let i = 0; i < nodesLength; i++) {
|
|
2296
2310
|
const node = nodes[i];
|
|
2297
2311
|
if ($isTextNode(node)) {
|
|
2312
|
+
// TODO: what about style?
|
|
2298
2313
|
hasTextNodes = true;
|
|
2299
2314
|
combinedFormat &= node.getFormat();
|
|
2300
2315
|
if (combinedFormat === 0) {
|
|
@@ -2399,6 +2414,7 @@ function onBeforeInput(event, editor) {
|
|
|
2399
2414
|
const anchorNode = selection.anchor.getNode();
|
|
2400
2415
|
anchorNode.markDirty();
|
|
2401
2416
|
selection.format = anchorNode.getFormat();
|
|
2417
|
+
selection.style = anchorNode.getStyle();
|
|
2402
2418
|
}
|
|
2403
2419
|
} else {
|
|
2404
2420
|
event.preventDefault();
|
|
@@ -2622,6 +2638,7 @@ function onCompositionStart(event, editor) {
|
|
|
2622
2638
|
const selection = $getSelection();
|
|
2623
2639
|
if ($isRangeSelection(selection) && !editor.isComposing()) {
|
|
2624
2640
|
const anchor = selection.anchor;
|
|
2641
|
+
const node = selection.anchor.getNode();
|
|
2625
2642
|
$setCompositionKey(anchor.key);
|
|
2626
2643
|
if (
|
|
2627
2644
|
// If it has been 30ms since the last keydown, then we should
|
|
@@ -2630,7 +2647,7 @@ function onCompositionStart(event, editor) {
|
|
|
2630
2647
|
event.timeStamp < lastKeyDownTimeStamp + ANDROID_COMPOSITION_LATENCY ||
|
|
2631
2648
|
// FF has issues around composing multibyte characters, so we also
|
|
2632
2649
|
// need to invoke the empty space heuristic below.
|
|
2633
|
-
anchor.type === 'element' || !selection.isCollapsed() ||
|
|
2650
|
+
anchor.type === 'element' || !selection.isCollapsed() || node.getFormat() !== selection.format || node.getStyle() !== selection.style) {
|
|
2634
2651
|
// We insert a zero width character, ready for the composition
|
|
2635
2652
|
// to get inserted into the new node we create. If
|
|
2636
2653
|
// we don't do this, Safari will fail on us because
|
|
@@ -2963,8 +2980,8 @@ function cleanActiveNestedEditorsMap(editor) {
|
|
|
2963
2980
|
function markSelectionChangeFromDOMUpdate() {
|
|
2964
2981
|
isSelectionChangeFromDOMUpdate = true;
|
|
2965
2982
|
}
|
|
2966
|
-
function markCollapsedSelectionFormat(format, offset, key, timeStamp) {
|
|
2967
|
-
collapsedSelectionFormat = [format, offset, key, timeStamp];
|
|
2983
|
+
function markCollapsedSelectionFormat(format, style, offset, key, timeStamp) {
|
|
2984
|
+
collapsedSelectionFormat = [format, style, offset, key, timeStamp];
|
|
2968
2985
|
}
|
|
2969
2986
|
|
|
2970
2987
|
/**
|
|
@@ -3071,12 +3088,13 @@ function $moveSelectionPointToEnd(point, node) {
|
|
|
3071
3088
|
selectPointOnNode(point, node);
|
|
3072
3089
|
}
|
|
3073
3090
|
}
|
|
3074
|
-
function $transferStartingElementPointToTextPoint(start, end, format) {
|
|
3091
|
+
function $transferStartingElementPointToTextPoint(start, end, format, style) {
|
|
3075
3092
|
const element = start.getNode();
|
|
3076
3093
|
const placementNode = element.getChildAtIndex(start.offset);
|
|
3077
3094
|
const textNode = $createTextNode();
|
|
3078
3095
|
const target = $isRootNode(element) ? $createParagraphNode().append(textNode) : textNode;
|
|
3079
3096
|
textNode.setFormat(format);
|
|
3097
|
+
textNode.setStyle(style);
|
|
3080
3098
|
if (placementNode === null) {
|
|
3081
3099
|
element.append(target);
|
|
3082
3100
|
} else {
|
|
@@ -3325,11 +3343,12 @@ function DEPRECATED_$isGridSelection(x) {
|
|
|
3325
3343
|
return x instanceof GridSelection;
|
|
3326
3344
|
}
|
|
3327
3345
|
class RangeSelection {
|
|
3328
|
-
constructor(anchor, focus, format) {
|
|
3346
|
+
constructor(anchor, focus, format, style) {
|
|
3329
3347
|
this.anchor = anchor;
|
|
3330
3348
|
this.focus = focus;
|
|
3331
3349
|
this.dirty = false;
|
|
3332
3350
|
this.format = format;
|
|
3351
|
+
this.style = style;
|
|
3333
3352
|
this._cachedNodes = null;
|
|
3334
3353
|
anchor._selection = this;
|
|
3335
3354
|
focus._selection = this;
|
|
@@ -3338,7 +3357,7 @@ class RangeSelection {
|
|
|
3338
3357
|
if (!$isRangeSelection(selection)) {
|
|
3339
3358
|
return false;
|
|
3340
3359
|
}
|
|
3341
|
-
return this.anchor.is(selection.anchor) && this.focus.is(selection.focus) && this.format === selection.format;
|
|
3360
|
+
return this.anchor.is(selection.anchor) && this.focus.is(selection.focus) && this.format === selection.format && this.style === selection.style;
|
|
3342
3361
|
}
|
|
3343
3362
|
isBackward() {
|
|
3344
3363
|
return this.focus.isBefore(this.anchor);
|
|
@@ -3452,13 +3471,17 @@ class RangeSelection {
|
|
|
3452
3471
|
clone() {
|
|
3453
3472
|
const anchor = this.anchor;
|
|
3454
3473
|
const focus = this.focus;
|
|
3455
|
-
const selection = new RangeSelection($createPoint(anchor.key, anchor.offset, anchor.type), $createPoint(focus.key, focus.offset, focus.type), this.format);
|
|
3474
|
+
const selection = new RangeSelection($createPoint(anchor.key, anchor.offset, anchor.type), $createPoint(focus.key, focus.offset, focus.type), this.format, this.style);
|
|
3456
3475
|
return selection;
|
|
3457
3476
|
}
|
|
3458
3477
|
toggleFormat(format) {
|
|
3459
3478
|
this.format = toggleTextFormatType(this.format, format, null);
|
|
3460
3479
|
this.dirty = true;
|
|
3461
3480
|
}
|
|
3481
|
+
setStyle(style) {
|
|
3482
|
+
this.style = style;
|
|
3483
|
+
this.dirty = true;
|
|
3484
|
+
}
|
|
3462
3485
|
hasFormat(type) {
|
|
3463
3486
|
const formatFlag = TEXT_TYPE_TO_FORMAT[type];
|
|
3464
3487
|
return (this.format & formatFlag) !== 0;
|
|
@@ -3487,10 +3510,11 @@ class RangeSelection {
|
|
|
3487
3510
|
const focus = this.focus;
|
|
3488
3511
|
const isBefore = this.isCollapsed() || anchor.isBefore(focus);
|
|
3489
3512
|
const format = this.format;
|
|
3513
|
+
const style = this.style;
|
|
3490
3514
|
if (isBefore && anchor.type === 'element') {
|
|
3491
|
-
$transferStartingElementPointToTextPoint(anchor, focus, format);
|
|
3515
|
+
$transferStartingElementPointToTextPoint(anchor, focus, format, style);
|
|
3492
3516
|
} else if (!isBefore && focus.type === 'element') {
|
|
3493
|
-
$transferStartingElementPointToTextPoint(focus, anchor, format);
|
|
3517
|
+
$transferStartingElementPointToTextPoint(focus, anchor, format, style);
|
|
3494
3518
|
}
|
|
3495
3519
|
const selectedNodes = this.getNodes();
|
|
3496
3520
|
const selectedNodesLength = selectedNodes.length;
|
|
@@ -3569,12 +3593,15 @@ class RangeSelection {
|
|
|
3569
3593
|
return;
|
|
3570
3594
|
}
|
|
3571
3595
|
const firstNodeFormat = firstNode.getFormat();
|
|
3572
|
-
|
|
3596
|
+
const firstNodeStyle = firstNode.getStyle();
|
|
3597
|
+
if (startOffset === endOffset && (firstNodeFormat !== format || firstNodeStyle !== style)) {
|
|
3573
3598
|
if (firstNode.getTextContent() === '') {
|
|
3574
3599
|
firstNode.setFormat(format);
|
|
3600
|
+
firstNode.setStyle(style);
|
|
3575
3601
|
} else {
|
|
3576
3602
|
const textNode = $createTextNode(text);
|
|
3577
3603
|
textNode.setFormat(format);
|
|
3604
|
+
textNode.setStyle(style);
|
|
3578
3605
|
textNode.select();
|
|
3579
3606
|
if (startOffset === 0) {
|
|
3580
3607
|
firstNode.insertBefore(textNode, false);
|
|
@@ -3601,6 +3628,7 @@ class RangeSelection {
|
|
|
3601
3628
|
this.anchor.offset -= text.length;
|
|
3602
3629
|
} else {
|
|
3603
3630
|
this.format = firstNodeFormat;
|
|
3631
|
+
this.style = firstNodeStyle;
|
|
3604
3632
|
}
|
|
3605
3633
|
}
|
|
3606
3634
|
} else {
|
|
@@ -4491,6 +4519,11 @@ class RangeSelection {
|
|
|
4491
4519
|
anchorNode.collapseAtStart(this);
|
|
4492
4520
|
}
|
|
4493
4521
|
}
|
|
4522
|
+
const anchorNode = this.anchor.getNode();
|
|
4523
|
+
if ($isTextNode(anchorNode)) {
|
|
4524
|
+
this.format = anchorNode.getFormat();
|
|
4525
|
+
this.style = anchorNode.getStyle();
|
|
4526
|
+
}
|
|
4494
4527
|
}
|
|
4495
4528
|
deleteLine(isBackward) {
|
|
4496
4529
|
if (this.isCollapsed()) {
|
|
@@ -4787,7 +4820,7 @@ function $isBlockElementNode(node) {
|
|
|
4787
4820
|
|
|
4788
4821
|
function internalMakeRangeSelection(anchorKey, anchorOffset, focusKey, focusOffset, anchorType, focusType) {
|
|
4789
4822
|
const editorState = getActiveEditorState();
|
|
4790
|
-
const selection = new RangeSelection($createPoint(anchorKey, anchorOffset, anchorType), $createPoint(focusKey, focusOffset, focusType), 0);
|
|
4823
|
+
const selection = new RangeSelection($createPoint(anchorKey, anchorOffset, anchorType), $createPoint(focusKey, focusOffset, focusType), 0, '');
|
|
4791
4824
|
selection.dirty = true;
|
|
4792
4825
|
editorState._selection = selection;
|
|
4793
4826
|
return selection;
|
|
@@ -4795,7 +4828,7 @@ function internalMakeRangeSelection(anchorKey, anchorOffset, focusKey, focusOffs
|
|
|
4795
4828
|
function $createRangeSelection() {
|
|
4796
4829
|
const anchor = $createPoint('root', 0, 'element');
|
|
4797
4830
|
const focus = $createPoint('root', 0, 'element');
|
|
4798
|
-
return new RangeSelection(anchor, focus, 0);
|
|
4831
|
+
return new RangeSelection(anchor, focus, 0, '');
|
|
4799
4832
|
}
|
|
4800
4833
|
function $createNodeSelection() {
|
|
4801
4834
|
return new NodeSelection(new Set());
|
|
@@ -4859,7 +4892,7 @@ function internalCreateRangeSelection(lastSelection, domSelection, editor) {
|
|
|
4859
4892
|
return null;
|
|
4860
4893
|
}
|
|
4861
4894
|
const [resolvedAnchorPoint, resolvedFocusPoint] = resolvedSelectionPoints;
|
|
4862
|
-
return new RangeSelection(resolvedAnchorPoint, resolvedFocusPoint, !$isRangeSelection(lastSelection) ? 0 : lastSelection.format);
|
|
4895
|
+
return new RangeSelection(resolvedAnchorPoint, resolvedFocusPoint, !$isRangeSelection(lastSelection) ? 0 : lastSelection.format, !$isRangeSelection(lastSelection) ? '' : lastSelection.style);
|
|
4863
4896
|
}
|
|
4864
4897
|
function $getSelection() {
|
|
4865
4898
|
const editorState = getActiveEditorState();
|
|
@@ -5055,6 +5088,7 @@ function updateDOMSelection(prevSelection, nextSelection, editor, domSelection,
|
|
|
5055
5088
|
const nextAnchorOffset = anchor.offset;
|
|
5056
5089
|
const nextFocusOffset = focus.offset;
|
|
5057
5090
|
const nextFormat = nextSelection.format;
|
|
5091
|
+
const nextStyle = nextSelection.style;
|
|
5058
5092
|
const isCollapsed = nextSelection.isCollapsed();
|
|
5059
5093
|
let nextAnchorNode = anchorDOM;
|
|
5060
5094
|
let nextFocusNode = focusDOM;
|
|
@@ -5072,8 +5106,8 @@ function updateDOMSelection(prevSelection, nextSelection, editor, domSelection,
|
|
|
5072
5106
|
if (nextAnchorNode === null || nextFocusNode === null) {
|
|
5073
5107
|
return;
|
|
5074
5108
|
}
|
|
5075
|
-
if (isCollapsed && (prevSelection === null || anchorFormatChanged || $isRangeSelection(prevSelection) && prevSelection.format !== nextFormat)) {
|
|
5076
|
-
markCollapsedSelectionFormat(nextFormat, nextAnchorOffset, anchorKey, performance.now());
|
|
5109
|
+
if (isCollapsed && (prevSelection === null || anchorFormatChanged || $isRangeSelection(prevSelection) && (prevSelection.format !== nextFormat || prevSelection.style !== nextStyle))) {
|
|
5110
|
+
markCollapsedSelectionFormat(nextFormat, nextStyle, nextAnchorOffset, anchorKey, performance.now());
|
|
5077
5111
|
}
|
|
5078
5112
|
|
|
5079
5113
|
// Diff against the native DOM selection to ensure we don't do
|
|
@@ -8172,10 +8206,12 @@ function createEditor(editorConfig) {
|
|
|
8172
8206
|
for (let i = 0; i < nodes.length; i++) {
|
|
8173
8207
|
let klass = nodes[i];
|
|
8174
8208
|
let replacementClass = null;
|
|
8209
|
+
let replacementKlass = null;
|
|
8175
8210
|
if (typeof klass !== 'function') {
|
|
8176
8211
|
const options = klass;
|
|
8177
8212
|
klass = options.replace;
|
|
8178
8213
|
replacementClass = options.with;
|
|
8214
|
+
replacementKlass = options.withKlass ? options.withKlass : null;
|
|
8179
8215
|
}
|
|
8180
8216
|
// Ensure custom nodes implement required methods.
|
|
8181
8217
|
{
|
|
@@ -8217,6 +8253,7 @@ function createEditor(editorConfig) {
|
|
|
8217
8253
|
registeredNodes.set(type, {
|
|
8218
8254
|
klass,
|
|
8219
8255
|
replace: replacementClass,
|
|
8256
|
+
replaceWithKlass: replacementKlass,
|
|
8220
8257
|
transforms: new Set()
|
|
8221
8258
|
});
|
|
8222
8259
|
}
|
|
@@ -8364,7 +8401,7 @@ class LexicalEditor {
|
|
|
8364
8401
|
mutations.delete(listener);
|
|
8365
8402
|
};
|
|
8366
8403
|
}
|
|
8367
|
-
|
|
8404
|
+
registerNodeTransformToKlass(klass, listener) {
|
|
8368
8405
|
const type = klass.getType();
|
|
8369
8406
|
const registeredNode = this._nodes.get(type);
|
|
8370
8407
|
if (registeredNode === undefined) {
|
|
@@ -8374,9 +8411,19 @@ class LexicalEditor {
|
|
|
8374
8411
|
}
|
|
8375
8412
|
const transforms = registeredNode.transforms;
|
|
8376
8413
|
transforms.add(listener);
|
|
8377
|
-
|
|
8414
|
+
return registeredNode;
|
|
8415
|
+
}
|
|
8416
|
+
registerNodeTransform(klass, listener) {
|
|
8417
|
+
const registeredNode = this.registerNodeTransformToKlass(klass, listener);
|
|
8418
|
+
const registeredNodes = [registeredNode];
|
|
8419
|
+
const replaceWithKlass = registeredNode.replaceWithKlass;
|
|
8420
|
+
if (replaceWithKlass != null) {
|
|
8421
|
+
const registeredReplaceWithNode = this.registerNodeTransformToKlass(replaceWithKlass, listener);
|
|
8422
|
+
registeredNodes.push(registeredReplaceWithNode);
|
|
8423
|
+
}
|
|
8424
|
+
markAllNodesAsDirty(this, klass.getType());
|
|
8378
8425
|
return () => {
|
|
8379
|
-
transforms.delete(listener);
|
|
8426
|
+
registeredNodes.forEach(node => node.transforms.delete(listener));
|
|
8380
8427
|
};
|
|
8381
8428
|
}
|
|
8382
8429
|
hasNodes(nodes) {
|
package/Lexical.prod.js
CHANGED
|
@@ -4,174 +4,175 @@
|
|
|
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 aa={},ba={},
|
|
7
|
+
'use strict';let aa={},ba={},da={},ea={},ha={},ia={},ja={},ka={},la={},ma={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},wa={},xa={},ya={},za={},Aa={},Ba={},Ca={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};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
8
|
let Na="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Oa=Na&&"documentMode"in document?document.documentMode:null,t=Na&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pa=Na&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Qa=Na&&"InputEvent"in window&&!Oa?"getTargetRanges"in new window.InputEvent("input"):!1,Ra=Na&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Sa=Na&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
|
|
9
|
-
!window.MSStream,Ta=Na&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ua=Ra||Sa?"\u00a0":"\u200b",Va=Pa?"\u00a0":Ua,
|
|
10
|
-
subscript:32,superscript:64,underline:8}
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
w&&(
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
function xb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!wb(b)&&yb(b)===a}catch(e){return!1}}function yb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=zb(a)}return null}function Ab(a){return a.isToken()||a.isSegmented()}function Bb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Cb(a,b,c){b
|
|
17
|
-
function Fb(a,b){if(null!=b)a.__key=b;else{
|
|
9
|
+
!window.MSStream,Ta=Na&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ua=Ra||Sa?"\u00a0":"\u200b",Va=Pa?"\u00a0":Ua,Ya=/^[^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]/,Za=/^[^\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]/,$a={bold:1,code:16,highlight:128,italic:2,strikethrough:4,
|
|
10
|
+
subscript:32,superscript:64,underline:8},ab={directionless:1,unmergeable:2},bb={center:2,end:6,justify:4,left:1,right:3,start:5},cb={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},db={normal:0,segmented:2,token:1},eb={0:"normal",2:"segmented",1:"token"},fb=!1,gb=0;function hb(a){gb=a.timeStamp}function ib(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}
|
|
11
|
+
function jb(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
|
|
12
|
+
function kb(a,b,c){fb=!0;let d=100<performance.now()-gb;try{v(a,()=>{let e=u()||jb(a);var f=new Map,g=a.getRootElement(),h=a._editorState,k=a._blockCursorElement;let m=!1,n="";for(var p=0;p<b.length;p++){var l=b[p],r=l.type,w=l.target,x=lb(w,h);if(!(null===x&&w!==g||z(x)))if("characterData"===r){if(l=d&&B(x))a:{l=e;r=w;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=D(a._window),r=l=null,null!==y&&y.anchorNode===
|
|
13
|
+
w&&(l=y.anchorOffset,r=y.focusOffset),w=w.nodeValue,null!==w&&mb(x,w,l,r,!1))}else if("childList"===r){m=!0;r=l.addedNodes;for(y=0;y<r.length;y++){A=r[y];var U=nb(A),J=A.parentNode;null==J||A===k||null!==U||"BR"===A.nodeName&&ib(A,J,a)||(Pa&&(U=A.innerText||A.nodeValue)&&(n+=U),J.removeChild(A))}l=l.removedNodes;r=l.length;if(0<r){y=0;for(A=0;A<r;A++)if(J=l[A],"BR"===J.nodeName&&ib(J,w,a)||k===J)w.appendChild(J),y++;r!==y&&(w===g&&(x=h._nodeMap.get("root")),f.set(w,x))}}}if(0<f.size)for(let [fa,V]of f)if(F(V))for(f=
|
|
14
|
+
V.getChildrenKeys(),g=fa.firstChild,h=0;h<f.length;h++)k=a.getElementByKey(f[h]),null!==k&&(null==g?(fa.appendChild(k),g=k):g!==k&&fa.replaceChild(k,g),g=g.nextSibling);else B(V)&&V.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],w=x.parentNode,null==w||"BR"!==x.nodeName||ib(x,k,a)||w.removeChild(x);c.takeRecords()}null!==e&&(m&&(e.dirty=!0,ob(e)),Pa&&pb(a)&&e.insertRawText(n))})}finally{fb=!1}}
|
|
15
|
+
function qb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();kb(a,c,b)}}function rb(a){0===gb&&sb(a).addEventListener("textInput",hb,!0);a._observer=new MutationObserver((b,c)=>{kb(a,b,c)})}let tb=1,ub="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function wb(a){let b=document.activeElement;if(null===b)return!1;let c=b.nodeName;return z(lb(a))&&("INPUT"===c||"TEXTAREA"===c||"true"===b.contentEditable&&null==b.__lexicalEditor)}
|
|
16
|
+
function xb(a,b,c){let d=a.getRootElement();try{return null!==d&&d.contains(b)&&d.contains(c)&&null!==b&&!wb(b)&&yb(b)===a}catch(e){return!1}}function yb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=zb(a)}return null}function Ab(a){return a.isToken()||a.isSegmented()}function Bb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Cb(a,b,c){b=$a[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Db(a){return B(a)||Eb(a)||z(a)}
|
|
17
|
+
function Fb(a,b){if(null!=b)a.__key=b;else{G();99<Gb&&q(14);b=H();var c=I(),d=""+tb++;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 Hb(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 Ib(a){99<Gb&&q(14);var b=a.getLatest(),c=b.__parent,d=
|
|
20
|
-
function
|
|
21
|
-
function Lb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Mb(a){return a.read(()=>Nb().getTextContent())}function Ob(a,b){v(a,()=>{var c=
|
|
22
|
-
function Pb(a){var b=
|
|
23
|
-
function Tb(a,b,c){b=D(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=M(c),f.replace(c),f=c)),f.setTextContent(a))}}}function Vb(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)||
|
|
19
|
+
a.__key,a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}function Ib(a){99<Gb&&q(14);var b=a.getLatest(),c=b.__parent,d=I();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 K(a){G();var b=H();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=L(c),null!==b&&b.getWritable()),null!==a&&(a=L(a),null!==a&&a.getWritable()))}function Jb(){return Kb()?null:H()._compositionKey}function L(a,b){a=(b||I())._nodeMap.get(a);return void 0===a?null:a}function nb(a,b){let c=H();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function lb(a,b){for(;null!=a;){let c=nb(a,b);if(null!==c)return c;a=zb(a)}return null}
|
|
21
|
+
function Lb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Mb(a){return a.read(()=>Nb().getTextContent())}function Ob(a,b){v(a,()=>{var c=I();if(!c.isEmpty())if("root"===b)Nb().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Nb(){return I()._nodeMap.get("root")}function ob(a){G();let b=I();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
|
|
22
|
+
function Pb(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=zb(c)}c=null}return null===c?(b=b.getRootElement(),a===b?L("root"):null):L(c)}function Qb(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function Rb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Sb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
|
23
|
+
function Tb(a,b,c){b=D(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=lb(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===Ua&&c&&(g=c.length,b=c,f=e=g);null!==b&&mb(d,b,e,f,a)}}}
|
|
24
|
+
function mb(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]===Ua&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(K(null),Ra||Sa)f.remove();else{let m=H();setTimeout(()=>{m.update(()=>{f.isAttached()&&f.remove()})},20)}else{e=f.getParent();b=Ub();var h=Jb(),k=f.getKey();f.isToken()||null!==h&&k===h&&!g||null!==e&&C(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=u(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,
|
|
25
|
+
c,f,d),f.isSegmented()&&(c=f.getTextContent(),c=M(c),f.replace(c),f=c)),f.setTextContent(a))}}}function Vb(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 Wb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Xb(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 Yb(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 Zb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Yb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Yb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function
|
|
27
|
+
function Zb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Yb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Yb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function pb(a){a=(a=sb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function $b(a){return!N(a)&&!a.isLastChild()&&!a.isInline()}
|
|
28
28
|
function ac(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(75);return a}function zb(a){a=a.assignedSlot||a.parentElement;return null!==a&&11===a.nodeType?a.host:a}
|
|
29
|
-
function bc(a,b,c){let d=c.ownerDocument,e=d.defaultView;if(null!==e){var {top:f,bottom:g}=b;for(b=c;null!==b;){if(c=b===d.body){var h=0;var k=
|
|
30
|
-
function cc(a,b=0){0!==b&&q(1);b=u();if(!C(b)||!
|
|
31
|
-
function fc(a){a=a.constructor.clone(a);Fb(a,null);return a}function gc(a){var b=
|
|
32
|
-
function D(a){return Na?(a||window).getSelection():null}function kc(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);
|
|
33
|
-
function mc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(
|
|
34
|
-
function oc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function pc(a,b){let c=a.mergeWithSibling(b),d=
|
|
29
|
+
function bc(a,b,c){let d=c.ownerDocument,e=d.defaultView;if(null!==e){var {top:f,bottom:g}=b;for(b=c;null!==b;){if(c=b===d.body){var h=0;var k=sb(a).innerHeight}else{var m=b.getBoundingClientRect();h=m.top;k=m.bottom}m=0;f<h?m=-(h-f):g>k&&(m=g-k);0!==m&&(c?e.scrollBy(0,m):(h=b.scrollTop,b.scrollTop+=m,h=b.scrollTop-h,f-=h,g-=h));if(c)break;b=zb(b)}}}
|
|
30
|
+
function cc(a,b=0){0!==b&&q(1);b=u();if(!C(b)||!F(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();dc(e,a)&&c.set(a.__key,0,"element");dc(f,a)&&d.set(a.__key,0,"element");return b}function dc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function sb(a){a=a._window;null===a&&q(78);return a}function ec(a){for(a=a.getParentOrThrow();null!==a&&!O(a);)a=a.getParentOrThrow();return a}function O(a){return N(a)||F(a)&&a.isShadowRoot()}
|
|
31
|
+
function fc(a){a=a.constructor.clone(a);Fb(a,null);return a}function gc(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 hc(a,b){a=a.getParent();!N(a)||F(b)||z(b)||q(99)}function ic(a){return(z(a)||F(a)&&!a.canBeEmpty())&&!a.isInline()}function jc(a,b,c){c.style.removeProperty("caret-color");b._blockCursorElement=null;b=a.parentElement;null!==b&&b.removeChild(a)}
|
|
32
|
+
function D(a){return Na?(a||window).getSelection():null}function kc(a,b){let c=a.getChildAtIndex(b);null==c&&(c=a);O(a)&&q(102);let d=g=>{const h=g.getParentOrThrow(),k=O(h),m=g!==c||k?fc(g):g;if(k)return g.insertAfter(m),[g,m,m];const [n,p,l]=d(h);g=g.getNextSiblings();l.append(m,...g);return[n,p,m]},[e,f]=d(c);return[e,f]}
|
|
33
|
+
function mc(a,b,c,d,e){for(a=a.getFirstChild();null!==a;){let f=a.__key;void 0!==a&&a.__parent===b&&(F(a)&&mc(a,f,c,d,e),c.has(f)||e.delete(f),d.delete(f));a=a.isAttached()?a.getNextSibling():null}}function nc(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)&&mc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
|
|
34
|
+
function oc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function pc(a,b){let c=a.mergeWithSibling(b),d=H()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
|
|
35
35
|
function qc(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{oc(b,a)&&(a=pc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{oc(a,c)&&pc(a,c);break}}}function rc(a){sc(a.anchor);sc(a.focus);return a}
|
|
36
|
-
function sc(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(!
|
|
37
|
-
function Gc(a,b){let c=Cc.get(a);if(null!==b){let d=Hc(a);d.parentNode===b&&b.removeChild(d)}Dc.has(a)||
|
|
38
|
-
function Mc(a,b){a=a.style;0===b?Kc(a,""):1===b?Kc(a,"left"):2===b?Kc(a,"center"):3===b?Kc(a,"right"):4===b?Kc(a,"justify"):5===b?Kc(a,"start"):6===b&&Kc(a,"end")}
|
|
39
|
-
function Nc(a,b,c){let d=Dc.get(a);void 0===d&&q(60);let e=d.createDOM(uc,
|
|
40
|
-
Rc(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(
|
|
36
|
+
function sc(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 P="",Q="",tc="",uc,R,vc,wc=!1,xc=!1,yc,zc=null,Ac,Bc,Cc,Dc,Ec,Fc;
|
|
37
|
+
function Gc(a,b){let c=Cc.get(a);if(null!==b){let d=Hc(a);d.parentNode===b&&b.removeChild(d)}Dc.has(a)||R._keyToDOMMap.delete(a);F(c)&&(a=Ic(c,Cc),Jc(a,0,a.length-1,null));void 0!==c&&Xb(Fc,vc,yc,c,"destroyed")}function Jc(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Gc(e,d)}}function Kc(a,b){a.setProperty("text-align",b)}
|
|
38
|
+
function Lc(a,b){var c=uc.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")||"20px";a.style.setProperty("padding-inline-start",0===b?"":`calc(${b} * ${c})`)}function Mc(a,b){a=a.style;0===b?Kc(a,""):1===b?Kc(a,"left"):2===b?Kc(a,"center"):3===b?Kc(a,"right"):4===b?Kc(a,"justify"):5===b?Kc(a,"start"):6===b&&Kc(a,"end")}
|
|
39
|
+
function Nc(a,b,c){let d=Dc.get(a);void 0===d&&q(60);let e=d.createDOM(uc,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&&Lc(e,a);if(0!==f){--f;a=Ic(d,Dc);var g=Q;Q="";Oc(a,d,0,f,e,null);Pc(d,e);Q=g}a=d.__format;0!==a&&Mc(e,a);d.isInline()||Qc(null,d,e);$b(d)&&(P+="\n\n",tc+="\n\n")}else f=d.getTextContent(),z(d)?(g=d.decorate(R,uc),null!==g&&
|
|
40
|
+
Rc(a,g),e.contentEditable="false"):B(d)&&(d.isDirectionless()||(Q+=f)),P+=f,tc+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Xb(Fc,vc,yc,d,"created");return e}function Oc(a,b,c,d,e,f){let g=P;for(P="";c<=d;++c)Nc(a[c],e,f);$b(b)&&(P+="\n\n");e.__lexicalTextContent=P;P=g+P}function Sc(a,b){a=b.get(a);return Eb(a)||z(a)&&a.isInline()}
|
|
41
41
|
function Qc(a,b,c){a=null!==a&&(0===a.__size||Sc(a.__last,Cc));b=0===b.__size||Sc(b.__last,Dc);a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
|
42
|
-
function Pc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==
|
|
43
|
-
d;b.__lexicalDirTextContent=
|
|
44
|
-
function Tc(a,b){var c=Cc.get(a),d=Dc.get(a);void 0!==c&&void 0!==d||q(61);var e=wc||Bc.has(a)||Ac.has(a);let f=ac(
|
|
45
|
-
d.__format;a!==c.__format&&Mc(f,a);if(e){a=d;e=
|
|
46
|
-
h++;else{void 0===k&&(k=new Set(
|
|
47
|
-
null!==e&&Rc(a,e)):B(d)&&!d.isDirectionless()&&(
|
|
48
|
-
let Vc=Object.freeze({}),bd=[["keydown",Wc],["pointerdown",Xc],["compositionstart",Yc],["compositionend",Zc],["input",$c],["click",ad],["cut",Vc],["copy",Vc],["dragstart",Vc],["dragover",Vc],["dragend",Vc],["paste",Vc],["focus",Vc],["blur",Vc],["drop",Vc]];Qa&&bd.push(["beforeinput",(a,b)=>cd(a,b)]);let dd=0,ed=0,fd=0,gd=0,hd=!1,id=!1,jd=!1,kd=!1,ld=[0,0,"root",0];
|
|
49
|
-
function md(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function
|
|
61
|
-
!
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function
|
|
42
|
+
function Pc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==zc){let f=""===Q;if(f)var d=zc;else d=Q,d=Ya.test(d)?"rtl":Za.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=uc.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);xc||(a.getWritable().__dir=d)}zc=
|
|
43
|
+
d;b.__lexicalDirTextContent=Q;b.__lexicalDir=d}}function Ic(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}
|
|
44
|
+
function Tc(a,b){var c=Cc.get(a),d=Dc.get(a);void 0!==c&&void 0!==d||q(61);var e=wc||Bc.has(a)||Ac.has(a);let f=ac(R,a);if(c===d&&!e)return F(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,tc+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(Q+=d),tc+=d,P+=d),f;c!==d&&e&&Xb(Fc,vc,yc,d,"updated");if(d.updateDOM(c,f,uc))return d=Nc(a,null,null),null===b&&q(62),b.replaceChild(d,f),Gc(a,null),d;if(F(c)&&F(d)){a=d.__indent;a!==c.__indent&&Lc(f,a);a=
|
|
45
|
+
d.__format;a!==c.__format&&Mc(f,a);if(e){a=d;e=Q;Q="";b=P;var g=c.__size,h=a.__size;P="";if(1===g&&1===h){var k=c.__first,m=a.__first;if(k===m)Tc(k,f);else{var n=Hc(k);m=Nc(m,null,null);f.replaceChild(m,n);Gc(k,null)}}else{m=Ic(c,Cc);var p=Ic(a,Dc);if(0===g)0!==h&&Oc(p,a,0,h-1,f,null);else if(0===h)0!==g&&(k=null==f.__lexicalLineBreak,Jc(m,0,g-1,k?null:f),k&&(f.textContent=""));else{var l=m;m=p;p=g-1;g=h-1;let w=f.firstChild,x=0;for(h=0;x<=p&&h<=g;){var r=l[x];let y=m[h];if(r===y)w=Uc(Tc(y,f)),x++,
|
|
46
|
+
h++;else{void 0===k&&(k=new Set(l));void 0===n&&(n=new Set(m));let A=n.has(r),U=k.has(y);A?(U?(r=ac(R,y),r===w?w=Uc(Tc(y,f)):(null!=w?f.insertBefore(r,w):f.appendChild(r),Tc(y,f)),x++):Nc(y,f,w),h++):(w=Uc(Hc(r)),Gc(r,f),x++)}}k=x>p;n=h>g;k&&!n?(k=m[g+1],k=void 0===k?null:R.getElementByKey(k),Oc(m,a,h,g,f,k)):n&&!k&&Jc(l,x,p,f)}}$b(a)&&(P+="\n\n");f.__lexicalTextContent=P;P=b+P;Pc(a,f);Q=e;N(d)||d.isInline()||Qc(c,d,f)}$b(d)&&(P+="\n\n",tc+="\n\n")}else c=d.getTextContent(),z(d)?(e=d.decorate(R,uc),
|
|
47
|
+
null!==e&&Rc(a,e)):B(d)&&!d.isDirectionless()&&(Q+=c),P+=c,tc+=c;!xc&&N(d)&&d.__cachedText!==tc&&(d=d.getWritable(),d.__cachedText=tc);return f}function Rc(a,b){let c=R._pendingDecorators,d=R._decorators;if(null===c){if(d[a]===b)return;c=Lb(R)}c[a]=b}function Uc(a){a=a.nextSibling;null!==a&&a===R._blockCursorElement&&(a=a.nextSibling);return a}function Hc(a){a=Ec.get(a);void 0===a&&q(75);return a}
|
|
48
|
+
let Vc=Object.freeze({}),bd=[["keydown",Wc],["pointerdown",Xc],["compositionstart",Yc],["compositionend",Zc],["input",$c],["click",ad],["cut",Vc],["copy",Vc],["dragstart",Vc],["dragover",Vc],["dragend",Vc],["paste",Vc],["focus",Vc],["blur",Vc],["drop",Vc]];Qa&&bd.push(["beforeinput",(a,b)=>cd(a,b)]);let dd=0,ed=0,fd=0,gd=0,hd=!1,id=!1,jd=!1,kd=!1,ld=[0,"",0,"root",0];
|
|
49
|
+
function md(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=H(),k=D(h._window);k=null!==k?k.anchorNode:null;let m=e.key;h=h.getElementByKey(m);let n=b.length;return m!==f.key||!B(g)||(!d&&(!Qa||fd<c+50)||g.isDirty()&&2>n||Qb(b))&&e.offset!==f.offset&&!g.isComposing()||Ab(g)||g.isDirty()&&1<n||(d||!Qa)&&null!==h&&!g.isComposing()&&k!==Bb(h)||g.getFormat()!==a.format||g.getStyle()!==a.style||Vb(a,g)}
|
|
50
|
+
function nd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
|
|
51
|
+
function od(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(hd&&(hd=!1,nd(d,e)&&nd(f,g)))return;v(b,()=>{if(!c)ob(null);else if(xb(b,d,f)){var h=u();if(C(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var n=sb(b).event;n=n?n.timeStamp:performance.now();let [p,l,r,w,x]=ld;n<x+200&&k.offset===r&&k.key===w?(h.format=p,h.style=l):"text"===k.type?(h.format=m.getFormat(),h.style=m.getStyle()):"element"===k.type&&(h.format=
|
|
52
|
+
0,h.style="")}else{k=255;m=!1;n=h.getNodes();let p=n.length;for(let l=0;l<p;l++){let r=n[l];if(B(r)&&(m=!0,k&=r.getFormat(),0===k))break}h.format=m?k:0}}S(b,aa,void 0)}})}function ad(a,b){v(b,()=>{let c=u(),d=D(b._window),e=Ub();if(C(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!N(g)&&1===Nb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}S(b,ba,a)})}
|
|
53
|
+
function Xc(a,b){let c=a.target;a=a.pointerType;c instanceof Node&&"touch"!==a&&v(b,()=>{z(lb(c))||(id=!0)})}function pd(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function qd(a,b){return a!==b||F(a)||F(b)||!a.isToken()||!b.isToken()}
|
|
54
|
+
function cd(a,b){let c=a.inputType;"deleteCompositionText"===c||Pa&&pb(b)||"insertCompositionText"!==c&&v(b,()=>{let d=u();if("deleteContentBackward"===c){if(null===d){var e=Ub();if(!C(e))return;ob(e.clone())}if(C(d)){229===ed&&a.timeStamp<dd+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),dd=0,setTimeout(()=>{v(b,()=>{K(null)})},30),C(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat(),d.style=e.getStyle())):(a.preventDefault(),S(b,da,!0));return}}if(C(d)){e=a.data;d.dirty||!d.isCollapsed()||
|
|
55
|
+
N(d.anchor.getNode())||pd(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),S(b,ea,!1)):"\n\n"===e?(a.preventDefault(),S(b,ha,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&md(d,e,a.timeStamp,!0)&&(a.preventDefault(),S(b,ia,e)),fd=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":S(b,
|
|
56
|
+
ia,a);break;case "insertFromComposition":K(null);S(b,ia,a);break;case "insertLineBreak":K(null);S(b,ea,!1);break;case "insertParagraph":K(null);jd?(jd=!1,S(b,ea,!1)):S(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":S(b,ja,a);break;case "deleteByComposition":qd(g,f)&&S(b,ka,void 0);break;case "deleteByDrag":case "deleteByCut":S(b,ka,void 0);break;case "deleteContent":S(b,da,!1);break;case "deleteWordBackward":S(b,la,!0);break;case "deleteWordForward":S(b,la,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":S(b,
|
|
57
|
+
ma,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":S(b,ma,!1);break;case "formatStrikeThrough":S(b,oa,"strikethrough");break;case "formatBold":S(b,oa,"bold");break;case "formatItalic":S(b,oa,"italic");break;case "formatUnderline":S(b,oa,"underline");break;case "historyUndo":S(b,pa,void 0);break;case "historyRedo":S(b,qa,void 0)}}})}
|
|
58
|
+
function $c(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data;if(null!=d&&C(c)&&md(c,d,a.timeStamp,!1)){kd&&(rd(b,d),kd=!1);var e=c.anchor,f=e.getNode(),g=D(b._window);if(null===g)return;let h=e.offset;if(e=Qa&&!c.isCollapsed()&&B(f)&&null!==g.anchorNode)f=f.getTextContent().slice(0,h)+d+f.getTextContent().slice(h+c.focus.offset),g=g.anchorNode,e=f===(3===g.nodeType?g.nodeValue:null);e||S(b,ia,d);d=d.length;Pa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d);
|
|
59
|
+
Ra||Sa||!b.isComposing()||(dd=0,K(null))}else Tb(!1,b,null!==d?d:void 0),kd&&(rd(b,d||void 0),kd=!1);G();c=H();qb(c)})}function Yc(a,b){v(b,()=>{let c=u();if(C(c)&&!b.isComposing()){let d=c.anchor,e=c.anchor.getNode();K(d.key);(a.timeStamp<dd+30||"element"===d.type||!c.isCollapsed()||e.getFormat()!==c.format||e.getStyle()!==c.style)&&S(b,ia,Va)}})}
|
|
60
|
+
function rd(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=Bb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&mb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);S(a,xa,null);return}}Tb(!0,a,b)}function Zc(a,b){Pa?kd=!0:v(b,()=>{rd(b,a.data)})}
|
|
61
|
+
function Wc(a,b){dd=a.timeStamp;ed=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)jd=!0,S(b,xa,a);else if(32===c)S(b,ya,a);else if(t&&e&&79===c)a.preventDefault(),jd=!0,S(b,ea,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?S(b,za,a):(a.preventDefault(),S(b,da,!0)):27===c?S(b,Aa,a):(h=t?d||g||f?
|
|
62
|
+
!1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?S(b,Ba,a):(a.preventDefault(),S(b,da,!1)):8===c&&(t?g:e)?(a.preventDefault(),S(b,la,!0)):46===c&&(t?g:e)?(a.preventDefault(),S(b,la,!1)):t&&f&&8===c?(a.preventDefault(),S(b,ma,!0)):t&&f&&46===c?(a.preventDefault(),S(b,ma,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),S(b,oa,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),S(b,oa,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),S(b,oa,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),
|
|
63
|
+
S(b,pa,void 0)):(h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),S(b,qa,void 0)):sd(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:!1,h?(a.preventDefault(),S(b,Ia,a)):(h=d?!1:88===c?t?f:e:!1,h&&(a.preventDefault(),S(b,Ja,a))))):S(b,Ca,a))}else jd=!1,S(b,xa,a);else S(b,wa,a);else S(b,va,a);else S(b,ua,a);else S(b,ta,a);else S(b,sa,a);else S(b,ra,a);(e||d||g||f)&&S(b,Ma,a)}}function td(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let ud=new Map;
|
|
64
|
+
function vd(a){a=a.target;let b=D(null==a?null:9===a.nodeType?a.defaultView:a.ownerDocument.defaultView);if(null!==b){var c=yb(b.anchorNode);if(null!==c){id&&(id=!1,v(c,()=>{var g=Ub(),h=b.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=wd(g,b,c),ob(g))}));a=Rb(c);a=a[a.length-1];var d=a._key,e=ud.get(d),f=e||a;f!==c&&od(b,f,!1);od(b,c,!0);c!==a?ud.set(d,c):e&&ud.delete(d)}}}
|
|
65
|
+
function xd(a,b){0===gd&&a.ownerDocument.addEventListener("selectionchange",vd);gd++;a.__lexicalEditor=b;let c=td(a);for(let d=0;d<bd.length;d++){let [e,f]=bd[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,Ja,h);case "copy":return S(b,Ia,h);case "paste":return S(b,ja,h);case "dragstart":return S(b,Fa,h);case "dragover":return S(b,Ga,h);case "dragend":return S(b,
|
|
66
|
+
Ha,h);case "focus":return S(b,Ka,h);case "blur":return S(b,La,h);case "drop":return S(b,Ea,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}function yd(a,b,c,d,e){ld=[a,b,c,d,e]}
|
|
67
|
+
class W{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=L(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;
|
|
68
|
+
Kb()||(Jb()===e&&K(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function zd(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 Ad(a,b){if(F(b)){let c=b.getLastDescendant();F(c)||B(c)?zd(a,c):zd(a,b)}else zd(a,b)}
|
|
69
|
+
function Bd(a,b,c,d){let e=a.getNode(),f=e.getChildAtIndex(a.offset),g=M(),h=N(e)?Cd().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 Dd(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
|
69
70
|
class Ed{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!sd(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 Ed(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
|
|
70
|
-
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=
|
|
71
|
+
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=L(c),null!==b&&a.push(b);Kb()||(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}}
|
|
71
72
|
function C(a){return a instanceof Fd}
|
|
72
73
|
class Gd{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 Hd(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 Gd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Id(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,b){let c=
|
|
73
|
-
this.focus.getNode();return rc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=
|
|
74
|
-
if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=
|
|
74
|
+
this.focus.getNode();return rc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=L(this.anchor.key);null===a&&q(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=L(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(){var a=this._cachedNodes;
|
|
75
|
+
if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=L(this.gridKey);Jd(f)||q(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);Kd(g)||q(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];Ld(h)||q(25);a.add(h);for(h=h.getChildren();0<h.length;){let n=h.shift();a.add(n);F(n)&&h.unshift(...n.getChildren())}}}a=Array.from(a);Kb()||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();
|
|
75
76
|
return b}}function Hd(a){return a instanceof Gd}
|
|
76
|
-
class Fd{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this.anchor;a=this.focus;let c=b.getNode(),d=a.getNode();
|
|
77
|
-
b?b:c);
|
|
78
|
-
[g,h]=Id(this),k="",
|
|
79
|
-
a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Dd(this.anchor,d.key,d.offset,d.type);Dd(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new Fd(new W(a.key,a.offset,a.type),new W(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Cb(this.format,a,null);this.dirty=!0}
|
|
80
|
-
for(let d=0;d<c;d++){let e=b[d];""!==e&&a.push(M(e));d!==c-1&&a.push(Nd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),e=this.format;d&&"element"===b.type?Bd(b,c,e):d||"element"!==c.type||Bd(c,b,e);var
|
|
81
|
-
null===b.getNextSibling())){var
|
|
82
|
-
return}}else if(b.isSegmented()&&c!==d)
|
|
83
|
-
0===c?b.insertBefore(
|
|
84
|
-
}"text"===
|
|
85
|
-
w.isAttached()&&(!
|
|
86
|
-
|
|
87
|
-
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=
|
|
88
|
-
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=
|
|
89
|
-
"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=
|
|
90
|
-
m.isInline())k&&!z(
|
|
91
|
-
h&&q(27),d=h)}k=!1;if(
|
|
92
|
-
d=d.
|
|
93
|
-
c.isIsolated())?
|
|
94
|
-
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(
|
|
95
|
-
f.insertNewAfter(this,!1),null===g)this.insertLineBreak();else if(
|
|
96
|
-
this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return Id(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Id(this);if(0===b)return[];
|
|
97
|
-
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=Zb(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Qd(),b.add(g.__key),
|
|
98
|
-
else if(e=
|
|
99
|
-
if(d.anchorNode!==g.startContainer||d.anchorOffset!==g.startOffset)b=this.focus,f=this.anchor,d=f.key,g=f.offset,e=f.type,Dd(f,b.key,b.offset,b.type),Dd(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=
|
|
100
|
-
Zb(c,a);if(z(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&
|
|
101
|
-
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-1;c!==f&&(b=b.getTextContent().slice(c,g),Qb(b)||(a?e.offset=
|
|
102
|
-
|
|
103
|
-
function Sd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}
|
|
104
|
-
function Rd(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],
|
|
105
|
-
function Td(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=Pb(k);if(B(d))e=h?d.getTextContentSize():0;else{f=Pb(a);if(null===f)return null;if(
|
|
106
|
-
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)&&Pb(a)===f?e:e+1,f=f.getParentOrThrow();if(
|
|
107
|
-
function Ud(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&
|
|
108
|
-
b)&&null===d&&
|
|
109
|
-
function Md(a,b,c,d,e,f){if(null===a||null===c||!xb(e,a,c))return null;b=Td(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Td(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=Pb(a),c=Pb(c),z(a)&&z(c)))return null;Od(b,d,f);return[b,d]}function Pd(a){return
|
|
77
|
+
class Fd{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;var b=this.anchor;a=this.focus;let c=b.getNode(),d=a.getNode();F(c)&&(b=
|
|
78
|
+
c.getDescendantByIndex(b.offset),c=null!=b?b:c);F(d)&&(b=d.getDescendantByIndex(a.offset),null!==b&&b!==c&&d.getChildAtIndex(a.offset)===b&&(b=b.getPreviousSibling()),d=null!=b?b:d);a=c.is(d)?F(c)&&0<c.getChildrenSize()?[]:[c]:c.getNodesBetween(d);Kb()||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){Dd(this.anchor,a.__key,b,"text");Dd(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-
|
|
79
|
+
1],d=this.anchor,e=this.focus,f=d.isBefore(e),[g,h]=Id(this),k="",m=!0;for(let n=0;n<a.length;n++){let p=a[n];if(F(p)&&!p.isInline())m||(k+="\n"),m=p.isEmpty()?!1:!0;else if(m=!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)&&!Eb(p)||p===c&&this.isCollapsed()||(k+=p.getTextContent())}return k}applyDOMRange(a){let b=
|
|
80
|
+
H(),c=b.getEditorState()._selection;a=Md(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;Dd(this.anchor,d.key,d.offset,d.type);Dd(this.focus,e.key,e.offset,e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new Fd(new W(a.key,a.offset,a.type),new W(b.key,b.offset,b.type),this.format,this.style)}toggleFormat(a){this.format=Cb(this.format,a,null);this.dirty=!0}setStyle(a){this.style=a;this.dirty=!0}hasFormat(a){return 0!==(this.format&
|
|
81
|
+
$a[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(M(e));d!==c-1&&a.push(Nd())}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?Bd(b,c,e,f):d||"element"!==c.type||Bd(c,b,e,f);var g=this.getNodes(),h=g.length,k=d?c:b;c=(d?b:c).offset;var m=k.offset;b=g[0];B(b)||q(26);d=b.getTextContent().length;var n=
|
|
82
|
+
b.getParentOrThrow(),p=g[h-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!n.canInsertTextAfter()&&null===b.getNextSibling())){var l=b.getNextSibling();if(!B(l)||Ab(l))l=M(),l.setFormat(e),n.canInsertTextAfter()?b.insertAfter(l):n.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()||!n.canInsertTextBefore()&&null===b.getPreviousSibling())){l=b.getPreviousSibling();
|
|
83
|
+
if(!B(l)||Ab(l))l=M(),l.setFormat(e),n.canInsertTextBefore()?b.insertBefore(l):n.insertBefore(l);l.select();b=l;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)n=M(b.getTextContent()),n.setFormat(e),b.replace(n),b=n;else if(!(this.isCollapsed()||""===a||(l=p.getParent(),n.canInsertTextBefore()&&n.canInsertTextAfter()&&(!F(l)||l.canInsertTextBefore()&&l.canInsertTextAfter())))){this.insertText("");Od(this.anchor,this.focus,null);this.insertText(a);return}if(1===h)if(b.isToken())a=
|
|
84
|
+
M(a),a.select(),b.replace(a);else{g=b.getFormat();h=b.getStyle();if(c===m&&(g!==e||h!==f))if(""===b.getTextContent())b.setFormat(e),b.setStyle(f);else{g=M(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,m-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:(this.format=g,this.style=
|
|
85
|
+
h))}else{e=new Set([...b.getParentKeys(),...p.getParentKeys()]);l=F(b)?b:b.getParentOrThrow();f=F(p)?p:p.getParentOrThrow();n=p;if(!l.is(f)&&f.isInline()){do n=f,f=f.getParentOrThrow();while(f.isInline())}"text"===k.type&&(0!==m||""===p.getTextContent())||"element"===k.type&&p.getIndexWithinParent()<m?B(p)&&!p.isToken()&&m!==p.getTextContentSize()?(p.isSegmented()&&(k=M(p.getTextContent()),p.replace(k),p=k),p=p.spliceText(0,m,""),e.add(p.__key)):(k=p.getParentOrThrow(),k.canBeEmpty()||1!==k.getChildrenSize()?
|
|
86
|
+
p.remove():k.remove()):e.add(p.__key);k=f.getChildren();m=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 w=k[r];if(w.is(b)||F(w)&&w.isParentOf(b))break;w.isAttached()&&(!m.has(w)||w.is(n)?p||l.insertAfter(w,!1):w.remove())}if(!p)for(k=f,m=null;null!==k;){f=k.getChildren();p=f.length;if(0===p||f[p-1].is(m))e.delete(k.__key),m=k;k=k.getParent()}b.isToken()?c===d?b.select():(a=M(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?
|
|
87
|
+
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),K(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),K(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&
|
|
88
|
+
(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var m=e-1,n=c[m];e="text"===d.type?d.offset:n.getTextContentSize();if(k.is(n))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=n.getFormatFlags(a,g);0<e&&(e!==n.getTextContentSize()&&([n]=n.splitText(e)),n.setFormat(p));for(h+=
|
|
89
|
+
1;h<m;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(n.__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=
|
|
90
|
+
M();this.focus.getNode().insertBefore(e)}else this.focus.key===c&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(e=M(),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=O(f)?null:f.getTopLevelElementOrThrow();if(B(f))if(d=f.getTextContent().length,0===c&&0!==d)d=f.getPreviousSibling(),
|
|
91
|
+
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,m=null;for(let r=0;r<a.length;r++){var n=a[r];if(O(d)||z(d)||!F(n)||n.isInline())k&&!z(n)&&O(d.getParent())&&q(28);else{if(n.is(g)){if(F(d)&&d.isEmpty()&&d.canReplaceWith(n)){d.replace(n);d=n;k=!0;continue}k=n.getFirstDescendant();if(Db(k)){for(var p=k.getParentOrThrow();p.isInline();)p=p.getParentOrThrow();m=p.getChildren();k=m.length;if(F(d)){var l=
|
|
92
|
+
d.getFirstChild();for(let w=0;w<k;w++){let x=m[w];null===l?d.append(x):l.insertAfter(x);l=x}}else{for(l=k-1;0<=l;l--)d.insertAfter(m[l]);d=d.getParentOrThrow()}m=m[k-1];p.remove();k=!0;if(p.is(n))continue}}B(d)&&(null===h&&q(27),d=h)}k=!1;if(F(d)&&!d.isInline())if(m=n,z(n)&&!n.isInline())d=d.insertAfter(n,!1);else if(F(n)){if(n.canBeEmpty()||!n.isEmpty())N(d)?(p=d.getChildAtIndex(c),null!==p?p.insertBefore(n):d.append(n),d=n):d=d.insertAfter(n,!1)}else p=d.getFirstChild(),null!==p?p.insertBefore(n):
|
|
93
|
+
d.append(n),d=n;else!F(n)||F(n)&&n.isInline()||z(d)&&!d.isInline()?(m=n,C(this)&&z(n)&&(F(d)||B(d))&&!n.isInline()?(B(d)?(p=d.getParentOrThrow(),[d]=d.splitText(c),d=d.getIndexWithinParent()+1):(p=d,d=c),[,d]=kc(p,d),d=d.insertBefore(n)):d=d.insertAfter(n,!1)):(n=d.getParentOrThrow(),Eb(d)&&d.remove(),d=n,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(m)?m:F(m)&&m.isInline()?m.getLastDescendant():d.getLastDescendant(),
|
|
94
|
+
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)||Pd(c)||z(c)&&(!c.isInline()||c.isIsolated())?F(d)||Pd(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||(B(d)?d.select():(b=d.getParentOrThrow(),
|
|
95
|
+
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(O(f)){e=Cd();c=f.getChildAtIndex(b);e.select();null!==
|
|
96
|
+
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<b)for(h=0;h<b;h++)a.append(c[h]);if(0!==
|
|
97
|
+
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=Nd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),N(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return Id(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Id(this);if(0===b)return[];
|
|
98
|
+
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=Zb(d,b);if(z(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Qd(),b.add(g.__key),ob(b)):(a=b?g.getPreviousSibling():
|
|
99
|
+
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=D(e._window)){var h=e._blockCursorElement,k=e._rootElement;null===k||null===h||!F(g)||g.isInline()||g.canBeEmpty()||jc(h,e,k);d.modify(a,b?"backward":"forward",c);if(0<d.rangeCount&&(g=d.getRangeAt(0),e=this.anchor.getNode(),
|
|
100
|
+
e=N(e)?e:ec(e),this.applyDOMRange(g),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(h=0;h<f.length;h++)k=f[h],dc(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,Dd(f,b.key,b.offset,b.type),Dd(b,d,g,e),this._cachedNodes=null}}}deleteCharacter(a){if(this.isCollapsed()){var b=
|
|
101
|
+
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.canExtractContents())return}e=Zb(c,a);if(z(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&F(d)&&0===d.getChildrenSize()?(d.remove(),a=Qd(),a.add(e.__key),ob(a)):e.remove();return}this.modify("extend",a,"character");if(!this.isCollapsed()){e="text"===c.type?
|
|
102
|
+
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){Rd(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)){Rd(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-1;c!==f&&(b=b.getTextContent().slice(c,g),Qb(b)||(a?e.offset=
|
|
103
|
+
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()&&N(a.getParent())&&0===a.getIndexWithinParent()&&a.collapseAtStart(this));a=this.anchor.getNode();B(a)&&(this.format=a.getFormat(),this.style=a.getStyle())}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&
|
|
104
|
+
this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function sd(a){return a instanceof Ed}function Sd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}
|
|
105
|
+
function Id(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]:[Sd(b),Sd(a)]}function Rd(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
|
106
|
+
function Td(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=Pb(k);if(B(d))e=h?d.getTextContentSize():0;else{f=Pb(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()));
|
|
107
|
+
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)&&Pb(a)===f?e:e+1,f=f.getParentOrThrow();if(F(f))return new W(f.__key,e,"element")}}else d=Pb(a);return B(d)?new W(d.__key,e,"text"):null}
|
|
108
|
+
function Ud(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||
|
|
109
|
+
b)&&null===d&&F(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function Od(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Ud(a,d,e);Ud(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,Dd(a,d.key,d.offset,d.type),Dd(b,c.key,c.offset,c.type))}}
|
|
110
|
+
function Md(a,b,c,d,e,f){if(null===a||null===c||!xb(e,a,c))return null;b=Td(a,b,C(f)?f.anchor:null,e);if(null===b)return null;d=Td(c,d,C(f)?f.focus:null,e);if(null===d||"element"===b.type&&"element"===d.type&&(a=Pb(a),c=Pb(c),z(a)&&z(c)))return null;Od(b,d,f);return[b,d]}function Pd(a){return F(a)&&!a.isInline()}function Vd(a,b,c,d,e,f){let g=I();a=new Fd(new W(a,b,e),new W(c,d,f),0,"");a.dirty=!0;return g._selection=a}function Qd(){return new Ed(new Set)}
|
|
110
111
|
function Wd(a){let b=a.getEditorState()._selection,c=D(a._window);return sd(b)||Hd(b)?b.clone():wd(b,c,a)}
|
|
111
|
-
function wd(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=!
|
|
112
|
-
function u(){return
|
|
113
|
-
function Xd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Yd(a));else{var k=a.isBackward();h=k?f:e;var
|
|
114
|
-
function Yd(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())
|
|
112
|
+
function wd(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=!fb&&(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)&&!xb(c,e,f))return a.clone()}else return a.clone();c=Md(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new Fd(h,k,C(a)?a.format:0,C(a)?
|
|
113
|
+
a.style:"")}function u(){return I()._selection}function Ub(){return H()._editorState._selection}
|
|
114
|
+
function Xd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Yd(a));else{var k=a.isBackward();h=k?f:e;var m=h.getNode();e=k?e:f;f=e.getNode();b.is(m)&&(m=h.offset,c<=m&&h.set(g,Math.max(0,m+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));Yd(a)}}
|
|
115
|
+
function Yd(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-
|
|
115
116
|
1):g.getChildAtIndex(e),B(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function Zd(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))}}
|
|
116
|
-
function $d(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):
|
|
117
|
-
function be(a,b,c,d,e,f,g){let h=d.anchorNode,k=d.focusNode,
|
|
118
|
-
h===
|
|
119
|
-
h,k)&&d.removeAllRanges()}let X=null,Y=null,Z=!1,ce=!1,Gb=0,de={characterData:!0,childList:!0,subtree:!0};function Kb(){return Z||null!==X&&X._readOnly}function
|
|
117
|
+
function $d(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 ae(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
|
118
|
+
function be(a,b,c,d,e,f,g){let h=d.anchorNode,k=d.focusNode,m=d.anchorOffset,n=d.focusOffset,p=document.activeElement;if(!(e.has("collaboration")&&p!==f||null!==p&&wb(p)))if(C(b)){var l=b.anchor,r=b.focus,w=l.key,x=r.key,y=ac(c,w);x=ac(c,x);var A=l.offset,U=r.offset,J=b.format,fa=b.style,V=b.isCollapsed(),T=y,E=x,ca=!1;"text"===l.type&&(T=Bb(y),ca=l.getNode().getFormat()!==J);"text"===r.type&&(E=Bb(x));if(null!==T&&null!==E){V&&(null===a||ca||C(a)&&(a.format!==J||a.style!==fa))&&yd(J,fa,A,w,performance.now());
|
|
119
|
+
if(m===A&&n===U&&h===T&&k===E&&("Range"!==d.type||!V)&&(null!==p&&f.contains(p)||f.focus({preventScroll:!0}),"element"!==l.type))return;try{Ta&&1E3<g?window.requestAnimationFrame(()=>d.setBaseAndExtent(T,A,E,U)):d.setBaseAndExtent(T,A,E,U)}catch(Wa){}!e.has("skip-scroll-into-view")&&b.isCollapsed()&&null!==f&&f===document.activeElement&&(a=b instanceof Fd&&"element"===b.anchor.type?T.childNodes[A]||null:0<d.rangeCount?d.getRangeAt(0):null,null!==a&&(a=a.getBoundingClientRect(),bc(c,a,f)));hd=!0}}else null!==
|
|
120
|
+
a&&xb(c,h,k)&&d.removeAllRanges()}let X=null,Y=null,Z=!1,ce=!1,Gb=0,de={characterData:!0,childList:!0,subtree:!0};function Kb(){return Z||null!==X&&X._readOnly}function G(){Z&&q(13)}function I(){null===X&&q(15);return X}function H(){null===Y&&q(16);return Y}function ee(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++);}
|
|
120
121
|
function fe(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()&&qc(b)}
|
|
121
|
-
function ge(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Jb(),f=new Map;var g=c;let h=g.size;for(var k=d,
|
|
122
|
-
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ee(b,g,f),d.set(k,
|
|
123
|
-
function je(a){var 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=X,
|
|
124
|
-
b._readOnly;Ec=new Map(a._keyToDOMMap);var A=new Map;Fc=A;Tc("root",null);Fc=Ec=uc=Dc=Cc=Bc=Ac=vc=
|
|
125
|
-
a._normalizedNodes=new Set,a._updateTags=new Set);var U=a._decorators,
|
|
126
|
-
|
|
127
|
-
Da.split(" ");Da=
|
|
128
|
-
(a._decorators=f,a._pendingDecorators=null,le("decorator",a,!0,f));f=Mb(e);g=Mb(b);f!==g&&le("textcontent",a,!0,g);le("update",a,!0,{dirtyElements:A,dirtyLeaves:p,editorState:b,normalizedNodes:w,prevEditorState:e,tags:
|
|
129
|
-
function le(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
|
|
122
|
+
function ge(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Jb(),f=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let n of g)g=a.get(n),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&qc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ee(b,g,f),c.add(n);g=b._dirtyLeaves;h=g.size;if(0<h){Gb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let n of k)if(k=n[0],m=n[1],"root"===k||m)g=a.get(k),void 0!==
|
|
123
|
+
g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ee(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Gb++}b._dirtyLeaves=c;b._dirtyElements=d}function he(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=he(a[d],b);c.append(e)}return c}function ie(a,b){let c=X,d=Z,e=Y;X=a;Z=!0;Y=null;try{return b()}finally{X=c,Z=d,Y=e}}
|
|
124
|
+
function je(a){var 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=X,m=Z,n=Y,p=a._updating,l=a._observer,r=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==l){Y=a;X=b;Z=!1;a._updating=!0;try{var w=a._dirtyType,x=a._dirtyElements,y=a._dirtyLeaves;l.disconnect();Q=tc=P="";wc=2===w;zc=null;R=a;uc=a._config;vc=a._nodes;yc=R._listeners.mutation;Ac=x;Bc=y;Cc=e._nodeMap;Dc=b._nodeMap;xc=
|
|
125
|
+
b._readOnly;Ec=new Map(a._keyToDOMMap);var A=new Map;Fc=A;Tc("root",null);Fc=Ec=uc=Dc=Cc=Bc=Ac=vc=R=void 0;r=A}catch(E){E instanceof Error&&a._onError(E);if(ce)throw E;ke(a,null,c,b);rb(a);a._dirtyType=2;ce=!0;je(a);ce=!1;return}finally{l.observe(c,de),a._updating=p,X=k,Z=m,Y=n}}b._readOnly||(b._readOnly=!0);p=a._dirtyLeaves;A=a._dirtyElements;w=a._normalizedNodes;y=a._updateTags;m=a._deferred;x=b._nodeMap.size;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,
|
|
126
|
+
a._normalizedNodes=new Set,a._updateTags=new Set);var U=a._decorators,J=a._pendingDecorators||U,fa=b._nodeMap,V;for(V in J)fa.has(V)||(J===U&&(J=Lb(a)),delete J[V]);d=d?null:D(a._window);if(a._editable&&null!==d&&(h||null===g||g.dirty)){Y=a;X=b;try{null!==l&&l.disconnect();if(h||null===g||g.dirty){var T=a._blockCursorElement;null!==T&&jc(T,a,c);be(f,g,a,d,y,c,x)}a:{let E=a._blockCursorElement;if(C(g)&&g.isCollapsed()&&"element"===g.anchor.type&&c.contains(document.activeElement)){let ca=g.anchor,
|
|
127
|
+
Wa=ca.getNode(),lc=ca.offset,Je=Wa.getChildrenSize();h=!1;T=null;if(lc===Je){let na=Wa.getChildAtIndex(lc-1);ic(na)&&(h=!0)}else{let na=Wa.getChildAtIndex(lc);if(ic(na)){let Xa=na.getPreviousSibling();if(null===Xa||ic(Xa))h=!0,T=a.getElementByKey(na.__key)}}if(h){let na=a.getElementByKey(Wa.__key);if(null===E){let Xa=a._config.theme,vb=document.createElement("div");vb.contentEditable="false";vb.setAttribute("data-lexical-cursor","true");let Da=Xa.blockCursor;if(void 0!==Da){if("string"===typeof Da){let Ke=
|
|
128
|
+
Da.split(" ");Da=Xa.blockCursor=Ke}void 0!==Da&&vb.classList.add(...Da)}a._blockCursorElement=E=vb}c.style.caretColor="transparent";null===T?na.appendChild(E):na.insertBefore(E,T);break a}}null!==E&&jc(E,a,c)}null!==l&&l.observe(c,de)}finally{Y=n,X=k}}if(null!==r)for(c=r,k=Array.from(a._listeners.mutation),n=k.length,l=0;l<n;l++){let [E,ca]=k[l];r=c.get(ca);void 0!==r&&E(r,{dirtyLeaves:p,updateTags:y})}C(g)||null===g||null!==f&&f.is(g)||a.dispatchCommand(aa,void 0);f=a._pendingDecorators;null!==f&&
|
|
129
|
+
(a._decorators=f,a._pendingDecorators=null,le("decorator",a,!0,f));f=Mb(e);g=Mb(b);f!==g&&le("textcontent",a,!0,g);le("update",a,!0,{dirtyElements:A,dirtyLeaves:p,editorState:b,normalizedNodes:w,prevEditorState:e,tags:y});a._deferred=[];if(0!==m.length){b=a._updating;a._updating=!0;try{for(e=0;e<m.length;e++)m[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [E,ca]=b;me(a,E,ca)}}}
|
|
130
|
+
function le(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=Rb(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}
|
|
130
131
|
function ne(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}
|
|
131
|
-
function me(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);let h=a._editorState;c=a._pendingEditorState;g=!1;if(null===c||c._readOnly)c=a._pendingEditorState=new oe(new Map((c||h)._nodeMap)),g=!0;c._flushSync=f;f=X;let k=Z,
|
|
132
|
-
b();e=ne(a,e);Zd(c,a);0!==a._dirtyType&&(e?fe(c,a):ge(c,a),ne(a),nc(h,c,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(c._flushSync=!0);let
|
|
133
|
-
a._updating=
|
|
134
|
-
function qe(a,b,c){
|
|
135
|
-
class re{static getType(){q(64)}static clone(){q(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Fb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=
|
|
136
|
-
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:
|
|
137
|
-
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:
|
|
138
|
-
this.getLatest().__next;return null===a?null:
|
|
139
|
-
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;f=
|
|
140
|
-
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=
|
|
141
|
-
return a}getWritable(){
|
|
142
|
-
f.__key=c;Ib(f);a.set(c,f);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)}remove(a){qe(this,!0,a)}replace(a,b){
|
|
143
|
-
|
|
144
|
-
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
|
|
145
|
-
hc(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;Hb(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=u();b&&C(c)&&(b=this.getParentOrThrow(),Xd(c,b,k));return a}isParentRequired(){return!1}createParentElementNode(){return Cd()}selectPrevious(a,b){
|
|
146
|
-
return null===c?d.select(0,0):
|
|
147
|
-
class te extends re{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
|
|
148
|
-
this.getChildrenSize()}isDirty(){let a=
|
|
149
|
-
this.getLastChild();for(;null!==a;){if(
|
|
150
|
-
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();
|
|
151
|
-
a?(a=
|
|
152
|
-
return
|
|
153
|
-
return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let
|
|
154
|
-
r=
|
|
155
|
-
A.getNode(),this,m
|
|
156
|
-
function
|
|
157
|
-
class ve extends te{static getType(){return"root"}static clone(){return new ve}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(51)}getTextContent(){let a=this.__cachedText;return!Kb()&&0!==
|
|
158
|
-
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
|
|
159
|
-
function xe(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&q(58);let c=b.children;if(
|
|
132
|
+
function me(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);let h=a._editorState;c=a._pendingEditorState;g=!1;if(null===c||c._readOnly)c=a._pendingEditorState=new oe(new Map((c||h)._nodeMap)),g=!0;c._flushSync=f;f=X;let k=Z,m=Y,n=a._updating;X=c;Z=!1;a._updating=!0;Y=a;try{g&&(a._headless?null!=h._selection&&(c._selection=h._selection.clone()):c._selection=Wd(a));let p=a._compositionKey;
|
|
133
|
+
b();e=ne(a,e);Zd(c,a);0!==a._dirtyType&&(e?fe(c,a):ge(c,a),ne(a),nc(h,c,a._dirtyLeaves,a._dirtyElements));p!==a._compositionKey&&(c._flushSync=!0);let l=c._selection;if(C(l)){let r=c._nodeMap,w=l.focus.key;void 0!==r.get(l.anchor.key)&&void 0!==r.get(w)||q(19)}else sd(l)&&0===l._nodes.size&&(c._selection=null)}catch(p){p instanceof Error&&a._onError(p);a._pendingEditorState=h;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();je(a);return}finally{X=f,Z=k,Y=m,
|
|
134
|
+
a._updating=n,Gb=0}b=null!==a._window?window.event:null;b=null!=b?b.type:null;0!==a._dirtyType||pe(c,a)||null!==a._blockCursorElement&&"blur"===b?c._flushSync?(c._flushSync=!1,je(a)):g&&ub(()=>{je(a)}):(c._flushSync=!1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):me(a,b,c)}
|
|
135
|
+
function qe(a,b,c){G();var d=a.__key;let e=a.getParent();if(null!==e){var f=cc(a),g=!1;if(C(f)&&b){let h=f.anchor,k=f.focus;h.key===d&&($d(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&($d(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}C(f)&&b&&!g?(d=a.getIndexWithinParent(),Hb(a),Xd(f,e,d,-1)):Hb(a);c||O(e)||e.canBeEmpty()||!e.isEmpty()||qe(e,b);b&&N(e)&&e.isEmpty()&&e.selectEnd()}}
|
|
136
|
+
class re{static getType(){q(64)}static clone(){q(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Fb(this,a)}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=L(a);if(null===a)break;a=a.__parent}return!1}isSelected(a){a=a||u();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&&
|
|
137
|
+
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:L(a)}getParentOrThrow(){let a=this.getParent();null===a&&q(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(O(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=
|
|
138
|
+
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:L(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=
|
|
139
|
+
this.getLatest().__next;return null===a?null:L(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(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;
|
|
140
|
+
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;f=F(e)?b?e.getFirstChild():e.getLastChild():
|
|
141
|
+
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=L(this.__key);if(null===a)throw Error("Lexical node does not exist in active editor state. Avoid using the same node references between nested closures from editorState.read/editor.update.");
|
|
142
|
+
return a}getWritable(){G();var a=I(),b=H();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&(f._cachedNodes=null);if(b.has(c))return Ib(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);
|
|
143
|
+
f.__key=c;Ib(f);a.set(c,f);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)}remove(a){qe(this,!0,a)}replace(a,b){G();var c=u();null!==c&&(c=c.clone());hc(this,a);let d=this.getLatest(),e=this.__key,f=a.__key,g=a.getWritable();a=this.getParentOrThrow().getWritable();let h=a.__size;Hb(g);let k=d.getPreviousSibling(),m=d.getNextSibling(),
|
|
144
|
+
n=d.__prev,p=d.__next,l=d.__parent;qe(d,!1,!0);null===k?a.__first=f:k.getWritable().__next=f;g.__prev=n;null===m?a.__last=f:m.getWritable().__prev=f;g.__next=p;g.__parent=l;a.__size=h;b&&this.getChildren().forEach(r=>{g.append(r)});C(c)&&(ob(c),b=c.anchor,c=c.focus,b.key===e&&Ad(b,g),c.key===e&&Ad(c,g));Jb()===e&&K(f);return g}insertAfter(a,b=!0){G();hc(this,a);var c=this.getWritable();let d=a.getWritable();var e=d.getParent();let f=u();var g=!1,h=!1;if(null!==e){var k=a.getIndexWithinParent();Hb(d);
|
|
145
|
+
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 m=d.__key,n=c.__next;null===e?k.__last=m:e.getWritable().__prev=m;k.__size++;c.__next=m;d.__next=n;d.__prev=c.__key;d.__parent=c.__parent;b&&C(f)&&(b=this.getIndexWithinParent(),Xd(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=!0){G();
|
|
146
|
+
hc(this,a);var c=this.getWritable();let d=a.getWritable(),e=d.__key;Hb(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=u();b&&C(c)&&(b=this.getParentOrThrow(),Xd(c,b,k));return a}isParentRequired(){return!1}createParentElementNode(){return Cd()}selectPrevious(a,b){G();let c=this.getPreviousSibling(),d=this.getParentOrThrow();
|
|
147
|
+
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()}}class se extends re{constructor(a){super(a)}decorate(){q(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function z(a){return a instanceof se}
|
|
148
|
+
class te extends re{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 cb[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===
|
|
149
|
+
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=
|
|
150
|
+
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:L(a)}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&q(45);return a}getLastChild(){let a=this.getLatest().__last;return null===a?null:L(a)}getLastChildOrThrow(){let a=
|
|
151
|
+
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}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==
|
|
152
|
+
a?(a=bb[a],0!==(this.getFormat()&a)):!1}select(a,b){G();let c=u(),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();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 Vd(f,d,f,e,"element","element");return c}selectStart(){let a=this.getFirstDescendant();
|
|
153
|
+
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(),0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?bb[a]:0;return this}setIndent(a){this.getWritable().__indent=a;
|
|
154
|
+
return this}splice(a,b,c){let d=c.length,e=this.getChildrenSize(),f=this.getWritable(),g=f.__key;var h=[],k=[];let m=this.getChildAtIndex(a+b),n=null,p=e-b+d;if(0!==a)if(a===e)n=this.getLastChild();else{var l=this.getChildAtIndex(a);null!==l&&(n=l.getPreviousSibling())}if(0<b){var r=null===n?this.getFirstChild():n.getNextSibling();for(l=0;l<b;l++){null===r&&q(100);var w=r.getNextSibling(),x=r.__key;r=r.getWritable();Hb(r);k.push(x);r=w}}l=n;for(w=0;w<d;w++){x=c[w];null!==l&&x.is(l)&&(n=l=l.getPreviousSibling());
|
|
155
|
+
r=x.getWritable();r.__parent===g&&p--;Hb(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!==m&&(a=m.getWritable(),null!==l?(b=l.getWritable(),a.__prev=l.__key,b.__next=m.__key):a.__prev=null);f.__size=p;if(k.length&&(a=u(),C(a))){k=new Set(k);h=new Set(h);let {anchor:y,focus:A}=a;ue(y,k,h)&&$d(y,y.getNode(),this,n,m);ue(A,k,h)&&$d(A,
|
|
156
|
+
A.getNode(),this,n,m);0!==p||this.canBeEmpty()||O(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}}
|
|
157
|
+
function F(a){return a instanceof te}function ue(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}
|
|
158
|
+
class ve extends te{static getType(){return"root"}static clone(){return new ve}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(51)}getTextContent(){let a=this.__cachedText;return!Kb()&&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=Nb();b.setFormat(a.format);
|
|
159
|
+
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 N(a){return a instanceof ve}function pe(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 we(){return new oe(new Map([["root",new ve]]))}
|
|
160
|
+
function xe(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=xe(a[d]);c.push(e)}}return b}
|
|
160
161
|
class oe{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 ie(this,a)}clone(a){a=new oe(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return ie(this,()=>({root:xe(Nb())}))}}
|
|
161
162
|
class ye extends re{static getType(){return"linebreak"}static clone(a){return new ye(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:ze,priority:0}}}}static importJSON(){return Nd()}exportJSON(){return{type:"linebreak",version:1}}}function ze(){return{node:Nd()}}function Nd(){return gc(new ye)}
|
|
162
163
|
function Eb(a){return a instanceof ye}function Ae(a,b){return b&16?"code":b&128?"mark":b&32?"sub":b&64?"sup":null}function Be(a,b){return b&1?"strong":b&2?"em":"span"}
|
|
163
|
-
function Ce(a,b,c,d,e){a=d.classList;d=Wb(e,"base");void 0!==d&&a.add(...d);d=Wb(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
|
|
164
|
-
function De(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Ua:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Pa){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,
|
|
165
|
-
class Fe extends re{static getType(){return"text"}static clone(a){return new Fe(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
|
|
166
|
-
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a
|
|
167
|
-
a=a.theme.text;void 0!==a&&Ce(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=Ae(this,e);let h=Ae(this,f);var k=Be(this,e);let
|
|
168
|
-
void 0!==c&&e!==f&&Ce(
|
|
164
|
+
function Ce(a,b,c,d,e){a=d.classList;d=Wb(e,"base");void 0!==d&&a.add(...d);d=Wb(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 $a)h=$a[k],d=Wb(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))}
|
|
165
|
+
function De(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Ua:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Pa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}function Ee(a,b){b=document.createElement(b);b.appendChild(a);return b}
|
|
166
|
+
class Fe extends re{static getType(){return"text"}static clone(a){return new Fe(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 eb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Jb()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
|
|
167
|
+
(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=$a[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 Cb(c,a,b)}createDOM(a){var b=this.__format,c=Ae(this,b);let d=Be(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;De(this.__text,c,this);
|
|
168
|
+
a=a.theme.text;void 0!==a&&Ce(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=Ae(this,e);let h=Ae(this,f);var k=Be(this,e);let m=Be(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&q(48),a=g=document.createElement(m),De(d,a,this),c=c.theme.text,void 0!==c&&Ce(m,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&q(49));De(d,k,this);c=c.theme.text;
|
|
169
|
+
void 0!==c&&e!==f&&Ce(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:Ge,priority:0}),b:()=>({conversion:He,priority:0}),br:()=>({conversion:Ie,priority:0}),code:()=>({conversion:Le,priority:0}),em:()=>({conversion:Le,priority:0}),i:()=>({conversion:Le,priority:0}),s:()=>({conversion:Le,priority:0}),span:()=>({conversion:Me,priority:0}),strong:()=>({conversion:Le,priority:0}),sub:()=>({conversion:Le,priority:0}),sup:()=>({conversion:Le,
|
|
169
170
|
priority:0}),u:()=>({conversion:Le,priority:0})}}static importJSON(a){let b=M(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=Ee(a,"b")),this.hasFormat("italic")&&(a=Ee(a,"i")),this.hasFormat("strikethrough")&&(a=Ee(a,"s")),this.hasFormat("underline")&&(a=Ee(a,"u")));return{element:a}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),
|
|
170
|
-
style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a
|
|
171
|
-
a.__detail^=2;return a}setMode(a){a=
|
|
172
|
-
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=u();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){
|
|
173
|
-
if(a[0]===c)return[b];var
|
|
174
|
-
A.offset>
|
|
171
|
+
style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){let b=this.getWritable();b.__format="string"===typeof a?$a[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?ab[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=$a[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();
|
|
172
|
+
a.__detail^=2;return a}setMode(a){a=db[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=u();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=Jb(),d!==c.anchor.key&&d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);else return Vd(e,a,e,b,"text","text");return c}spliceText(a,
|
|
173
|
+
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=u();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=Jb(),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[];
|
|
174
|
+
if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=b.getFormat();let n=b.getStyle(),p=b.__detail;g=!1;b.isSegmented()?(h=M(m),h.__format=k,h.__style=n,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=m);b=u();h=[h];m=m.length;for(let w=1;w<f;w++){var l=a[w],r=l.length;l=M(l).getWritable();l.__format=k;l.__style=n;l.__detail=p;let x=l.__key;r=m+r;if(C(b)){let y=b.anchor,A=b.focus;y.key===d&&"text"===y.type&&y.offset>m&&y.offset<=r&&(y.key=x,y.offset-=m,b.dirty=!0);A.key===d&&"text"===A.type&&
|
|
175
|
+
A.offset>m&&A.offset<=r&&(A.key=x,A.offset-=m,b.dirty=!0)}e===d&&K(x);m=r;h.push(l)}d=this.getPreviousSibling();e=this.getNextSibling();null!==d&&Ib(d);null!==e&&Ib(e);d=c.getWritable();e=this.getIndexWithinParent();g?(d.splice(e,0,h),this.remove()):d.splice(e,1,h);C(b)&&Xd(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;Jb()===d&&K(c);let g=u();if(C(g)){let h=g.anchor,k=g.focus;
|
|
175
176
|
null!==h&&h.key===d&&(ae(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(ae(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}}
|
|
176
177
|
function Me(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 Ie(){return{node:Nd()}}
|
|
177
178
|
function He(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Ge(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:M(a)}}let Ne={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};
|
|
@@ -184,19 +185,19 @@ function Qe(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d
|
|
|
184
185
|
class Re{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=
|
|
185
186
|
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Sb();this._onError=e;this._htmlConversions=f;this._editable=!0;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=
|
|
186
187
|
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=>
|
|
187
|
-
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)}}
|
|
188
|
-
this._rootElement;if(a!==b){let e=Wb(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;ke(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==gd&&(gd--,0===gd&&b.ownerDocument.removeEventListener("selectionchange",
|
|
189
|
-
[]}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,
|
|
190
|
-
b){a.isEmpty()&&q(38);
|
|
191
|
-
new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;X=c;Z=!1;Y=this;try{he(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=
|
|
192
|
-
a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=D(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==
|
|
193
|
-
function Ld(a){return a instanceof Se}class Te extends te{}function Jd(a){return a instanceof Te}class Ue extends te{}function Kd(a){return a instanceof Ue}exports.$addUpdateTag=function(a){
|
|
194
|
-
exports.$
|
|
195
|
-
exports.$isInlineElementOrDecoratorNode=function(a){return
|
|
196
|
-
exports.$nodesOfType=function(a){var b=
|
|
197
|
-
exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ba;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=
|
|
188
|
+
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));Ob(this,a.getType());return()=>{d.forEach(e=>e.transforms.delete(b))}}hasNodes(a){for(let b=
|
|
189
|
+
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=Wb(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;ke(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==gd&&(gd--,0===gd&&b.ownerDocument.removeEventListener("selectionchange",
|
|
190
|
+
vd));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Rb(c);d=d[d.length-1]._key;ud.get(d)===c&&ud.delete(d)}else ud.delete(c._key);b.__lexicalEditor=null}c=td(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,rb(this),
|
|
191
|
+
this._updateTags.add("history-merge"),je(this),this._config.disableEvents||xd(a,this),null!=e&&a.classList.add(...e)):this._window=null;le("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(38);qb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),je(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",
|
|
192
|
+
!1);this._compositionKey=null;null!=b&&d.add(b);je(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=we(),d=X,e=Z,f=Y,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;X=c;Z=!1;Y=this;try{he(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,X=d,Z=e,Y=f}return c}update(a,
|
|
193
|
+
b){v(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),v(this,()=>{let d=u(),e=Nb();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=D(this._window);null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==
|
|
194
|
+
a&&(this._editable=a,le("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Se extends te{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}function Ld(a){return a instanceof Se}class Te extends te{}function Jd(a){return a instanceof Te}class Ue extends te{}function Kd(a){return a instanceof Ue}exports.$addUpdateTag=function(a){G();H()._updateTags.add(a)};exports.$applyNodeReplacement=gc;
|
|
195
|
+
exports.$copyNode=fc;exports.$createLineBreakNode=Nd;exports.$createNodeSelection=Qd;exports.$createParagraphNode=Cd;exports.$createRangeSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Fd(a,b,0,"")};exports.$createTextNode=M;exports.$getAdjacentNode=Zb;exports.$getNearestNodeFromDOMNode=lb;exports.$getNearestRootOrShadowRoot=ec;exports.$getNodeByKey=L;exports.$getPreviousSelection=Ub;exports.$getRoot=Nb;exports.$getSelection=u;
|
|
196
|
+
exports.$getTextContent=function(){let a=u();return null===a?"":a.getTextContent()};exports.$hasAncestor=dc;exports.$insertNodes=function(a,b){let c=u();null===c&&(c=Nb().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=z;exports.$isElementNode=F;exports.$isInlineElementOrDecoratorNode=function(a){return F(a)&&a.isInline()||z(a)&&a.isInline()};exports.$isLeafNode=Db;exports.$isLineBreakNode=Eb;exports.$isNodeSelection=sd;exports.$isParagraphNode=function(a){return a instanceof Oe};
|
|
197
|
+
exports.$isRangeSelection=C;exports.$isRootNode=N;exports.$isRootOrShadowRoot=O;exports.$isTextNode=B;exports.$nodesOfType=function(a){var b=I();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=rc;exports.$parseSerializedNode=function(a){return he(a,H()._nodes)};exports.$setCompositionKey=K;exports.$setSelection=ob;exports.$splitNode=kc;exports.BLUR_COMMAND=La;
|
|
198
|
+
exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ba;exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ia;exports.COPY_COMMAND=Ia;exports.CUT_COMMAND=Ja;exports.DELETE_CHARACTER_COMMAND=da;exports.DELETE_LINE_COMMAND=ma;exports.DELETE_WORD_COMMAND=la;
|
|
198
199
|
exports.DEPRECATED_$createGridSelection=function(){let a=new W("root",0,"element"),b=new W("root",0,"element");return new Gd("root",a,b)};exports.DEPRECATED_$isGridCellNode=Ld;exports.DEPRECATED_$isGridNode=Jd;exports.DEPRECATED_$isGridRowNode=Kd;exports.DEPRECATED_$isGridSelection=Hd;exports.DEPRECATED_GridCellNode=Se;exports.DEPRECATED_GridNode=Te;exports.DEPRECATED_GridRowNode=Ue;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;
|
|
199
|
-
exports.DecoratorNode=se;exports.ElementNode=te;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=
|
|
200
|
-
exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=ya;exports.KEY_TAB_COMMAND=Ca;exports.LineBreakNode=ye;exports.MOVE_TO_END=
|
|
201
|
-
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=we(),h=b.namespace||(null!==e?e._config.namespace:Sb()),k=b.editorState,
|
|
202
|
-
e,a,{disableEvents:f,namespace:h,theme:d},
|
|
200
|
+
exports.DecoratorNode=se;exports.ElementNode=te;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=oa;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.KEY_ARROW_DOWN_COMMAND=wa;exports.KEY_ARROW_LEFT_COMMAND=ta;exports.KEY_ARROW_RIGHT_COMMAND=ra;exports.KEY_ARROW_UP_COMMAND=va;exports.KEY_BACKSPACE_COMMAND=za;exports.KEY_DELETE_COMMAND=Ba;exports.KEY_ENTER_COMMAND=xa;exports.KEY_ESCAPE_COMMAND=Aa;
|
|
201
|
+
exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=ya;exports.KEY_TAB_COMMAND=Ca;exports.LineBreakNode=ye;exports.MOVE_TO_END=sa;exports.MOVE_TO_START=ua;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ja;exports.ParagraphNode=Oe;exports.REDO_COMMAND=qa;exports.REMOVE_TEXT_COMMAND=ka;exports.RootNode=ve;exports.SELECTION_CHANGE_COMMAND=aa;exports.TextNode=Fe;exports.UNDO_COMMAND=pa;exports.createCommand=function(){return{}};
|
|
202
|
+
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=we(),h=b.namespace||(null!==e?e._config.namespace:Sb()),k=b.editorState,m=[ve,Fe,ye,Oe,...(b.nodes||[])],n=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let l=m[c],r=null;var p=null;"function"!==typeof l&&(p=l,l=p.replace,r=p.with,p=p.withKlass?p.withKlass:null);let w=l.getType();a.set(w,{klass:l,replace:r,
|
|
203
|
+
replaceWithKlass:p,transforms:new Set})}d=new Re(g,e,a,{disableEvents:f,namespace:h,theme:d},n?n:console.error,Qe(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d};exports.isSelectionWithinEditor=xb
|
package/LexicalEditor.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export declare type EditorThemeClasses = {
|
|
|
93
93
|
base?: EditorThemeClassName;
|
|
94
94
|
focus?: EditorThemeClassName;
|
|
95
95
|
};
|
|
96
|
+
indent?: EditorThemeClassName;
|
|
96
97
|
[key: string]: any;
|
|
97
98
|
};
|
|
98
99
|
export declare type EditorConfig = {
|
|
@@ -105,6 +106,7 @@ export declare type RegisteredNode = {
|
|
|
105
106
|
klass: Klass<LexicalNode>;
|
|
106
107
|
transforms: Set<Transform<LexicalNode>>;
|
|
107
108
|
replace: null | ((node: LexicalNode) => LexicalNode);
|
|
109
|
+
replaceWithKlass: null | Klass<LexicalNode>;
|
|
108
110
|
};
|
|
109
111
|
export declare type Transform<T extends LexicalNode> = (node: T) => void;
|
|
110
112
|
export declare type ErrorHandler = (error: Error) => void;
|
|
@@ -185,6 +187,7 @@ export declare function createEditor(editorConfig?: {
|
|
|
185
187
|
with: <T extends {
|
|
186
188
|
new (...args: any): any;
|
|
187
189
|
}>(node: InstanceType<T>) => LexicalNode;
|
|
190
|
+
withKlass?: Klass<LexicalNode>;
|
|
188
191
|
}>;
|
|
189
192
|
onError?: ErrorHandler;
|
|
190
193
|
parentEditor?: LexicalEditor;
|
|
@@ -230,6 +233,7 @@ export declare class LexicalEditor {
|
|
|
230
233
|
registerRootListener(listener: RootListener): () => void;
|
|
231
234
|
registerCommand<P>(command: LexicalCommand<P>, listener: CommandListener<P>, priority: CommandListenerPriority): () => void;
|
|
232
235
|
registerMutationListener(klass: Klass<LexicalNode>, listener: MutationListener): () => void;
|
|
236
|
+
private registerNodeTransformToKlass;
|
|
233
237
|
registerNodeTransform<T extends LexicalNode>(klass: Klass<T>, listener: Transform<T>): () => void;
|
|
234
238
|
hasNodes<T extends Klass<LexicalNode>>(nodes: Array<T>): boolean;
|
|
235
239
|
dispatchCommand<TCommand extends LexicalCommand<unknown>>(type: TCommand, payload: CommandPayloadType<TCommand>): boolean;
|
package/LexicalEvents.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export declare type EventHandler = (event: Event, editor: LexicalEditor) => void
|
|
|
11
11
|
export declare function addRootElementEvents(rootElement: HTMLElement, editor: LexicalEditor): void;
|
|
12
12
|
export declare function removeRootElementEvents(rootElement: HTMLElement): void;
|
|
13
13
|
export declare function markSelectionChangeFromDOMUpdate(): void;
|
|
14
|
-
export declare function markCollapsedSelectionFormat(format: number, offset: number, key: NodeKey, timeStamp: number): void;
|
|
14
|
+
export declare function markCollapsedSelectionFormat(format: number, style: string, offset: number, key: NodeKey, timeStamp: number): void;
|
package/LexicalSelection.d.ts
CHANGED
|
@@ -105,8 +105,9 @@ export declare class RangeSelection implements BaseSelection {
|
|
|
105
105
|
focus: PointType;
|
|
106
106
|
dirty: boolean;
|
|
107
107
|
format: number;
|
|
108
|
+
style: string;
|
|
108
109
|
_cachedNodes: null | Array<LexicalNode>;
|
|
109
|
-
constructor(anchor: PointType, focus: PointType, format: number);
|
|
110
|
+
constructor(anchor: PointType, focus: PointType, format: number, style: string);
|
|
110
111
|
is(selection: null | RangeSelection | NodeSelection | GridSelection): boolean;
|
|
111
112
|
isBackward(): boolean;
|
|
112
113
|
isCollapsed(): boolean;
|
|
@@ -116,6 +117,7 @@ export declare class RangeSelection implements BaseSelection {
|
|
|
116
117
|
applyDOMRange(range: StaticRange): void;
|
|
117
118
|
clone(): RangeSelection;
|
|
118
119
|
toggleFormat(format: TextFormatType): void;
|
|
120
|
+
setStyle(style: string): void;
|
|
119
121
|
hasFormat(type: TextFormatType): boolean;
|
|
120
122
|
insertRawText(text: string): void;
|
|
121
123
|
insertText(text: string): void;
|