lexical 0.45.0 → 0.45.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Lexical.dev.js +213 -148
- package/dist/Lexical.dev.mjs +210 -149
- package/dist/Lexical.js.flow +9 -1
- package/dist/Lexical.mjs +4 -0
- package/dist/Lexical.node.mjs +4 -0
- package/dist/Lexical.prod.js +1 -1
- package/dist/Lexical.prod.mjs +1 -1
- package/dist/LexicalNode.d.ts +8 -0
- package/dist/LexicalUpdates.d.ts +2 -0
- package/dist/LexicalUtils.d.ts +41 -5
- package/dist/index.d.ts +3 -3
- package/dist/nodes/LexicalLineBreakNode.d.ts +18 -0
- package/package.json +2 -2
- package/src/LexicalEditor.ts +10 -9
- package/src/LexicalEvents.ts +4 -5
- package/src/LexicalMutations.ts +0 -6
- package/src/LexicalNode.ts +8 -0
- package/src/LexicalReconciler.ts +8 -0
- package/src/LexicalSelection.ts +10 -11
- package/src/LexicalUpdates.ts +12 -0
- package/src/LexicalUtils.ts +66 -15
- package/src/index.ts +5 -0
- package/src/nodes/LexicalLineBreakNode.ts +18 -2
- package/src/nodes/LexicalTextNode.ts +2 -16
package/dist/Lexical.dev.mjs
CHANGED
|
@@ -532,9 +532,9 @@ function indexPath(root, child) {
|
|
|
532
532
|
*
|
|
533
533
|
*/
|
|
534
534
|
|
|
535
|
-
// `"0.45.0+dev.esm"` is statically replaced with the build-specific
|
|
535
|
+
// `"0.45.1-dev.0+dev.esm"` is statically replaced with the build-specific
|
|
536
536
|
// version string in a Rollup build, and a consumer's bundler `define` can
|
|
537
|
-
// inject it the same way — so the exact `"0.45.0+dev.esm"` member
|
|
537
|
+
// inject it the same way — so the exact `"0.45.1-dev.0+dev.esm"` member
|
|
538
538
|
// expression must be preserved for that substitution to match. Reading it
|
|
539
539
|
// inside a try/catch lets the source be consumed directly (via the `source`
|
|
540
540
|
// export condition) in a browser bundle, where `process` is undefined and
|
|
@@ -543,11 +543,11 @@ function indexPath(root, child) {
|
|
|
543
543
|
// `pnpm run update-version`.
|
|
544
544
|
let envLexicalVersion;
|
|
545
545
|
try {
|
|
546
|
-
envLexicalVersion = "0.45.0+dev.esm";
|
|
546
|
+
envLexicalVersion = "0.45.1-dev.0+dev.esm";
|
|
547
547
|
} catch (_unused) {
|
|
548
548
|
// `process` is not defined in some browser bundles; use the fallback.
|
|
549
549
|
}
|
|
550
|
-
const LEXICAL_VERSION = envLexicalVersion ?? '0.45.0+source';
|
|
550
|
+
const LEXICAL_VERSION = envLexicalVersion ?? '0.45.1-dev.0+source';
|
|
551
551
|
|
|
552
552
|
/**
|
|
553
553
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -966,7 +966,7 @@ function shouldUpdateTextNodeFromMutation(selection, targetDOM, targetNode) {
|
|
|
966
966
|
}
|
|
967
967
|
return isDOMTextNode(targetDOM) && targetNode.isAttached();
|
|
968
968
|
}
|
|
969
|
-
function $getNearestManagedNodePairFromDOMNode(startingDOM, editor, editorState
|
|
969
|
+
function $getNearestManagedNodePairFromDOMNode(startingDOM, editor, editorState) {
|
|
970
970
|
for (let dom = startingDOM; dom && !isDOMUnmanaged(dom); dom = getParentElement(dom)) {
|
|
971
971
|
const key = getNodeKeyFromDOMNode(dom, editor);
|
|
972
972
|
if (key !== undefined) {
|
|
@@ -975,8 +975,6 @@ function $getNearestManagedNodePairFromDOMNode(startingDOM, editor, editorState,
|
|
|
975
975
|
// All decorator nodes are unmanaged
|
|
976
976
|
return $isDecoratorNode(node) || !isHTMLElement(dom) ? undefined : [dom, node];
|
|
977
977
|
}
|
|
978
|
-
} else if (dom === rootElement) {
|
|
979
|
-
return [rootElement, internalGetRoot(editorState)];
|
|
980
978
|
}
|
|
981
979
|
}
|
|
982
980
|
}
|
|
@@ -987,7 +985,6 @@ function flushMutations(editor, mutations, observer) {
|
|
|
987
985
|
updateEditorSync(editor, () => {
|
|
988
986
|
const selection = $getSelection() || getLastSelection(editor);
|
|
989
987
|
const badDOMTargets = new Map();
|
|
990
|
-
const rootElement = editor.getRootElement();
|
|
991
988
|
// We use the current editor state, as that reflects what is
|
|
992
989
|
// actually "on screen".
|
|
993
990
|
const currentEditorState = editor._editorState;
|
|
@@ -998,7 +995,7 @@ function flushMutations(editor, mutations, observer) {
|
|
|
998
995
|
const mutation = mutations[i];
|
|
999
996
|
const type = mutation.type;
|
|
1000
997
|
const targetDOM = mutation.target;
|
|
1001
|
-
const pair = $getNearestManagedNodePairFromDOMNode(targetDOM, editor, currentEditorState
|
|
998
|
+
const pair = $getNearestManagedNodePairFromDOMNode(targetDOM, editor, currentEditorState);
|
|
1002
999
|
if (!pair) {
|
|
1003
1000
|
continue;
|
|
1004
1001
|
}
|
|
@@ -2300,6 +2297,15 @@ function $createNode(key, slot) {
|
|
|
2300
2297
|
dom.setAttribute('data-lexical-text', 'true');
|
|
2301
2298
|
} else if ($isDecoratorNode(node)) {
|
|
2302
2299
|
dom.setAttribute('data-lexical-decorator', 'true');
|
|
2300
|
+
// DecoratorNode DOM is selection-captured: window selection inside
|
|
2301
|
+
// a decorator subtree (e.g. an embedded input) is owned by the
|
|
2302
|
+
// decorator, not by Lexical's caret management. Marking it via
|
|
2303
|
+
// setDOMUnmanaged unifies the decorator case with extension-owned
|
|
2304
|
+
// unmanaged subtrees so callers only need isDOMCapturingSelection /
|
|
2305
|
+
// isDOMUnmanaged.
|
|
2306
|
+
setDOMUnmanaged(dom, {
|
|
2307
|
+
captureSelection: true
|
|
2308
|
+
});
|
|
2303
2309
|
}
|
|
2304
2310
|
if ($isElementNode(node)) {
|
|
2305
2311
|
const indent = node.__indent;
|
|
@@ -3804,7 +3810,7 @@ function onPointerDown(event, editor) {
|
|
|
3804
3810
|
updateEditorSync(editor, () => {
|
|
3805
3811
|
// Drag & drop should not recompute selection until mouse up; otherwise the initially
|
|
3806
3812
|
// selected content is lost.
|
|
3807
|
-
if (
|
|
3813
|
+
if (!isDOMCapturingSelection(target, editor)) {
|
|
3808
3814
|
isSelectionChangeFromMouseDown = true;
|
|
3809
3815
|
}
|
|
3810
3816
|
});
|
|
@@ -4209,10 +4215,10 @@ function onInput(event, editor) {
|
|
|
4209
4215
|
unprocessedBeforeInputData = null;
|
|
4210
4216
|
}
|
|
4211
4217
|
function $handleInput(event) {
|
|
4212
|
-
|
|
4218
|
+
const editor = getActiveEditor();
|
|
4219
|
+
if (isHTMLElement(event.target) && isDOMCapturingSelection(event.target, editor)) {
|
|
4213
4220
|
return true;
|
|
4214
4221
|
}
|
|
4215
|
-
const editor = getActiveEditor();
|
|
4216
4222
|
const selection = $getSelection();
|
|
4217
4223
|
const data = event.data;
|
|
4218
4224
|
const targetRange = getTargetRange(event);
|
|
@@ -6196,101 +6202,6 @@ function setDOMStyleFromCSS(domStyle, cssText, prevCSSText = '') {
|
|
|
6196
6202
|
}
|
|
6197
6203
|
}
|
|
6198
6204
|
|
|
6199
|
-
/**
|
|
6200
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6201
|
-
*
|
|
6202
|
-
* This source code is licensed under the MIT license found in the
|
|
6203
|
-
* LICENSE file in the root directory of this source tree.
|
|
6204
|
-
*
|
|
6205
|
-
*/
|
|
6206
|
-
|
|
6207
|
-
/** @noInheritDoc */
|
|
6208
|
-
class LineBreakNode extends LexicalNode {
|
|
6209
|
-
/** @internal */
|
|
6210
|
-
|
|
6211
|
-
static getType() {
|
|
6212
|
-
return 'linebreak';
|
|
6213
|
-
}
|
|
6214
|
-
static clone(node) {
|
|
6215
|
-
return new LineBreakNode(node.__key);
|
|
6216
|
-
}
|
|
6217
|
-
constructor(key) {
|
|
6218
|
-
super(key);
|
|
6219
|
-
}
|
|
6220
|
-
getTextContent() {
|
|
6221
|
-
return '\n';
|
|
6222
|
-
}
|
|
6223
|
-
createDOM() {
|
|
6224
|
-
return document.createElement('br');
|
|
6225
|
-
}
|
|
6226
|
-
updateDOM() {
|
|
6227
|
-
return false;
|
|
6228
|
-
}
|
|
6229
|
-
isInline() {
|
|
6230
|
-
return true;
|
|
6231
|
-
}
|
|
6232
|
-
static importDOM() {
|
|
6233
|
-
return {
|
|
6234
|
-
br: node => {
|
|
6235
|
-
if (isOnlyChildInBlockNode(node) || isLastChildInBlockNode(node)) {
|
|
6236
|
-
return null;
|
|
6237
|
-
}
|
|
6238
|
-
return {
|
|
6239
|
-
conversion: $convertLineBreakElement,
|
|
6240
|
-
priority: 0
|
|
6241
|
-
};
|
|
6242
|
-
}
|
|
6243
|
-
};
|
|
6244
|
-
}
|
|
6245
|
-
static importJSON(serializedLineBreakNode) {
|
|
6246
|
-
return $createLineBreakNode().updateFromJSON(serializedLineBreakNode);
|
|
6247
|
-
}
|
|
6248
|
-
}
|
|
6249
|
-
function $convertLineBreakElement(node) {
|
|
6250
|
-
return {
|
|
6251
|
-
node: $createLineBreakNode()
|
|
6252
|
-
};
|
|
6253
|
-
}
|
|
6254
|
-
function $createLineBreakNode() {
|
|
6255
|
-
return $applyNodeReplacement(new LineBreakNode());
|
|
6256
|
-
}
|
|
6257
|
-
function $isLineBreakNode(node) {
|
|
6258
|
-
return node instanceof LineBreakNode;
|
|
6259
|
-
}
|
|
6260
|
-
function isOnlyChildInBlockNode(node) {
|
|
6261
|
-
const parentElement = node.parentElement;
|
|
6262
|
-
if (parentElement !== null && isBlockDomNode(parentElement)) {
|
|
6263
|
-
const firstChild = parentElement.firstChild;
|
|
6264
|
-
if (firstChild === node || firstChild.nextSibling === node && isWhitespaceDomTextNode(firstChild)) {
|
|
6265
|
-
const lastChild = parentElement.lastChild;
|
|
6266
|
-
if (lastChild === node || lastChild.previousSibling === node && isWhitespaceDomTextNode(lastChild)) {
|
|
6267
|
-
return true;
|
|
6268
|
-
}
|
|
6269
|
-
}
|
|
6270
|
-
}
|
|
6271
|
-
return false;
|
|
6272
|
-
}
|
|
6273
|
-
function isLastChildInBlockNode(node) {
|
|
6274
|
-
const parentElement = node.parentElement;
|
|
6275
|
-
if (parentElement !== null && isBlockDomNode(parentElement)) {
|
|
6276
|
-
// check if node is first child, because only child dont count
|
|
6277
|
-
const firstChild = parentElement.firstChild;
|
|
6278
|
-
if (firstChild === node || firstChild.nextSibling === node && isWhitespaceDomTextNode(firstChild)) {
|
|
6279
|
-
return false;
|
|
6280
|
-
}
|
|
6281
|
-
|
|
6282
|
-
// check if its last child
|
|
6283
|
-
const lastChild = parentElement.lastChild;
|
|
6284
|
-
if (lastChild === node || lastChild.previousSibling === node && isWhitespaceDomTextNode(lastChild)) {
|
|
6285
|
-
return true;
|
|
6286
|
-
}
|
|
6287
|
-
}
|
|
6288
|
-
return false;
|
|
6289
|
-
}
|
|
6290
|
-
function isWhitespaceDomTextNode(node) {
|
|
6291
|
-
return isDOMTextNode(node) && /^( |\t|\r?\n)+$/.test(node.textContent || '');
|
|
6292
|
-
}
|
|
6293
|
-
|
|
6294
6205
|
function getElementOuterTag(node, format) {
|
|
6295
6206
|
if (format & IS_CODE) {
|
|
6296
6207
|
return 'code';
|
|
@@ -7266,21 +7177,8 @@ function $convertTextDOMNode(domNode) {
|
|
|
7266
7177
|
let textContent = domNode_.textContent || '';
|
|
7267
7178
|
// No collapse and preserve segment break for pre, pre-wrap and pre-line
|
|
7268
7179
|
if (findParentPreDOMNode(domNode_) !== null) {
|
|
7269
|
-
const parts = textContent.split(/(\r?\n|\t)/);
|
|
7270
|
-
const nodes = [];
|
|
7271
|
-
const length = parts.length;
|
|
7272
|
-
for (let i = 0; i < length; i++) {
|
|
7273
|
-
const part = parts[i];
|
|
7274
|
-
if (part === '\n' || part === '\r\n') {
|
|
7275
|
-
nodes.push($createLineBreakNode());
|
|
7276
|
-
} else if (part === '\t') {
|
|
7277
|
-
nodes.push($createTabNode());
|
|
7278
|
-
} else if (part !== '') {
|
|
7279
|
-
nodes.push($createTextNode(part));
|
|
7280
|
-
}
|
|
7281
|
-
}
|
|
7282
7180
|
return {
|
|
7283
|
-
node:
|
|
7181
|
+
node: $generateNodesFromRawText(textContent)
|
|
7284
7182
|
};
|
|
7285
7183
|
}
|
|
7286
7184
|
textContent = textContent.replace(/\r/g, '').replace(/[ \t\n]+/g, ' ');
|
|
@@ -9219,7 +9117,7 @@ function $internalResolveSelectionPoint(dom, offset, lastPoint, editor) {
|
|
|
9219
9117
|
moveSelectionToEnd = true;
|
|
9220
9118
|
resolvedOffset = childNodesLength - 1;
|
|
9221
9119
|
}
|
|
9222
|
-
if (getNodeKeyFromDOMNode(dom, editor) === undefined && dom
|
|
9120
|
+
if (getNodeKeyFromDOMNode(dom, editor) === undefined && !isDOMCapturingSelection(dom, editor)) {
|
|
9223
9121
|
// The DOM caret is sitting on a node that has no Lexical key
|
|
9224
9122
|
// (e.g. <col> inside an unmanaged <colgroup>, or any unmanaged
|
|
9225
9123
|
// scaffolding around a DOMSlot — wrap elements, contenteditable=false
|
|
@@ -9229,14 +9127,14 @@ function $internalResolveSelectionPoint(dom, offset, lastPoint, editor) {
|
|
|
9229
9127
|
// selection dirty so the reconciler writes a valid DOM caret back
|
|
9230
9128
|
// at the resolved Lexical position.
|
|
9231
9129
|
//
|
|
9232
|
-
//
|
|
9233
|
-
//
|
|
9234
|
-
//
|
|
9235
|
-
//
|
|
9236
|
-
// -
|
|
9237
|
-
//
|
|
9238
|
-
//
|
|
9239
|
-
//
|
|
9130
|
+
// Exclusions split across the two guard clauses:
|
|
9131
|
+
// - The first clause (`key !== undefined`) covers any DOM node
|
|
9132
|
+
// with a `__lexicalKey_*` attribute — Lexical-managed elements
|
|
9133
|
+
// and the editor root (stashed in `resetEditor`).
|
|
9134
|
+
// - `isDOMCapturingSelection` covers DecoratorNode subtrees (which
|
|
9135
|
+
// own their own DOM) and subtrees marked via
|
|
9136
|
+
// `setDOMUnmanaged(dom, {captureSelection: true})` —
|
|
9137
|
+
// extension-owned widgets that keep a native caret.
|
|
9240
9138
|
//
|
|
9241
9139
|
// Void elements that ARE Lexical nodes (LineBreakNode <br>,
|
|
9242
9140
|
// empty decorator containers, etc.) have keys, so this check
|
|
@@ -10157,6 +10055,17 @@ function getActiveEditorState() {
|
|
|
10157
10055
|
}
|
|
10158
10056
|
return activeEditorState;
|
|
10159
10057
|
}
|
|
10058
|
+
|
|
10059
|
+
/** @internal */
|
|
10060
|
+
function $assumeActiveEditor(editor) {
|
|
10061
|
+
// Throw if called outside of an update
|
|
10062
|
+
if (getActiveEditorState() !== null && activeEditor === null) {
|
|
10063
|
+
activeEditor = editor;
|
|
10064
|
+
}
|
|
10065
|
+
if (!(activeEditor === editor)) {
|
|
10066
|
+
formatDevErrorMessage(`The given editor argument does not match $getEditor() in this context. Use editor.getEditorState().read(..., {editor}) if this cross-editor call is intentional.`);
|
|
10067
|
+
}
|
|
10068
|
+
}
|
|
10160
10069
|
function getActiveEditor() {
|
|
10161
10070
|
if (activeEditor === null) {
|
|
10162
10071
|
{
|
|
@@ -11772,6 +11681,119 @@ class ArtificialNode__DO_NOT_USE extends ElementNode {
|
|
|
11772
11681
|
}
|
|
11773
11682
|
}
|
|
11774
11683
|
|
|
11684
|
+
/**
|
|
11685
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11686
|
+
*
|
|
11687
|
+
* This source code is licensed under the MIT license found in the
|
|
11688
|
+
* LICENSE file in the root directory of this source tree.
|
|
11689
|
+
*
|
|
11690
|
+
*/
|
|
11691
|
+
|
|
11692
|
+
/** @noInheritDoc */
|
|
11693
|
+
class LineBreakNode extends LexicalNode {
|
|
11694
|
+
/** @internal */
|
|
11695
|
+
|
|
11696
|
+
static getType() {
|
|
11697
|
+
return 'linebreak';
|
|
11698
|
+
}
|
|
11699
|
+
static clone(node) {
|
|
11700
|
+
return new LineBreakNode(node.__key);
|
|
11701
|
+
}
|
|
11702
|
+
constructor(key) {
|
|
11703
|
+
super(key);
|
|
11704
|
+
}
|
|
11705
|
+
getTextContent() {
|
|
11706
|
+
return '\n';
|
|
11707
|
+
}
|
|
11708
|
+
createDOM() {
|
|
11709
|
+
return document.createElement('br');
|
|
11710
|
+
}
|
|
11711
|
+
updateDOM() {
|
|
11712
|
+
return false;
|
|
11713
|
+
}
|
|
11714
|
+
isInline() {
|
|
11715
|
+
return true;
|
|
11716
|
+
}
|
|
11717
|
+
static importDOM() {
|
|
11718
|
+
return {
|
|
11719
|
+
br: node => {
|
|
11720
|
+
if (isOnlyChildInBlockNode(node) || isLastChildInBlockNode(node)) {
|
|
11721
|
+
return null;
|
|
11722
|
+
}
|
|
11723
|
+
return {
|
|
11724
|
+
conversion: $convertLineBreakElement,
|
|
11725
|
+
priority: 0
|
|
11726
|
+
};
|
|
11727
|
+
}
|
|
11728
|
+
};
|
|
11729
|
+
}
|
|
11730
|
+
static importJSON(serializedLineBreakNode) {
|
|
11731
|
+
return $createLineBreakNode().updateFromJSON(serializedLineBreakNode);
|
|
11732
|
+
}
|
|
11733
|
+
}
|
|
11734
|
+
function $convertLineBreakElement(node) {
|
|
11735
|
+
return {
|
|
11736
|
+
node: $createLineBreakNode()
|
|
11737
|
+
};
|
|
11738
|
+
}
|
|
11739
|
+
function $createLineBreakNode() {
|
|
11740
|
+
return $applyNodeReplacement(new LineBreakNode());
|
|
11741
|
+
}
|
|
11742
|
+
function $isLineBreakNode(node) {
|
|
11743
|
+
return node instanceof LineBreakNode;
|
|
11744
|
+
}
|
|
11745
|
+
|
|
11746
|
+
/**
|
|
11747
|
+
* True when `node` is the sole non-whitespace child of a block DOM
|
|
11748
|
+
* element. Used by the LineBreak importer to drop stray `<br>` elements
|
|
11749
|
+
* that the legacy `$generateNodesFromDOM` also skipped (matches the
|
|
11750
|
+
* behavior of `LineBreakNode.importDOM`).
|
|
11751
|
+
*
|
|
11752
|
+
* @experimental
|
|
11753
|
+
*/
|
|
11754
|
+
function isOnlyChildInBlockNode(node) {
|
|
11755
|
+
const parentElement = node.parentElement;
|
|
11756
|
+
if (parentElement !== null && isBlockDomNode(parentElement)) {
|
|
11757
|
+
const firstChild = parentElement.firstChild;
|
|
11758
|
+
if (firstChild === node || firstChild.nextSibling === node && isWhitespaceDomTextNode(firstChild)) {
|
|
11759
|
+
const lastChild = parentElement.lastChild;
|
|
11760
|
+
if (lastChild === node || lastChild.previousSibling === node && isWhitespaceDomTextNode(lastChild)) {
|
|
11761
|
+
return true;
|
|
11762
|
+
}
|
|
11763
|
+
}
|
|
11764
|
+
}
|
|
11765
|
+
return false;
|
|
11766
|
+
}
|
|
11767
|
+
|
|
11768
|
+
/**
|
|
11769
|
+
* True when `node` is the trailing non-whitespace child of a block DOM
|
|
11770
|
+
* element (excluding the only-child case). Used by the LineBreak
|
|
11771
|
+
* importer to drop trailing `<br>` elements like the Apple-interchange
|
|
11772
|
+
* clipboard artifact (matches `LineBreakNode.importDOM`).
|
|
11773
|
+
*
|
|
11774
|
+
* @experimental
|
|
11775
|
+
*/
|
|
11776
|
+
function isLastChildInBlockNode(node) {
|
|
11777
|
+
const parentElement = node.parentElement;
|
|
11778
|
+
if (parentElement !== null && isBlockDomNode(parentElement)) {
|
|
11779
|
+
// check if node is first child, because only child dont count
|
|
11780
|
+
const firstChild = parentElement.firstChild;
|
|
11781
|
+
if (firstChild === node || firstChild.nextSibling === node && isWhitespaceDomTextNode(firstChild)) {
|
|
11782
|
+
return false;
|
|
11783
|
+
}
|
|
11784
|
+
|
|
11785
|
+
// check if its last child
|
|
11786
|
+
const lastChild = parentElement.lastChild;
|
|
11787
|
+
if (lastChild === node || lastChild.previousSibling === node && isWhitespaceDomTextNode(lastChild)) {
|
|
11788
|
+
return true;
|
|
11789
|
+
}
|
|
11790
|
+
}
|
|
11791
|
+
return false;
|
|
11792
|
+
}
|
|
11793
|
+
function isWhitespaceDomTextNode(node) {
|
|
11794
|
+
return isDOMTextNode(node) && /^( |\t|\r?\n)+$/.test(node.textContent || '');
|
|
11795
|
+
}
|
|
11796
|
+
|
|
11775
11797
|
/**
|
|
11776
11798
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11777
11799
|
*
|
|
@@ -12067,10 +12089,18 @@ function resetEditor(editor, prevRootElement, nextRootElement, pendingEditorStat
|
|
|
12067
12089
|
// Remove all the DOM nodes from the root element
|
|
12068
12090
|
if (prevRootElement !== null) {
|
|
12069
12091
|
prevRootElement.textContent = '';
|
|
12092
|
+
clearNodeKeyOnDOMNode(prevRootElement, editor);
|
|
12070
12093
|
}
|
|
12071
12094
|
if (nextRootElement !== null) {
|
|
12072
12095
|
nextRootElement.textContent = '';
|
|
12073
12096
|
keyNodeMap.set('root', nextRootElement);
|
|
12097
|
+
// Stash __lexicalKey_${editor._key} = 'root' on the root element so it
|
|
12098
|
+
// participates in the unified key lookup (selection resolution in
|
|
12099
|
+
// $internalResolveSelectionPoint, mutation handling in
|
|
12100
|
+
// $getNearestManagedNodePairFromDOMNode, $getNodeFromDOM, and
|
|
12101
|
+
// $getNearestNodeFromDOMNode) instead of requiring a dedicated
|
|
12102
|
+
// editor.getRootElement() carveout at each call site.
|
|
12103
|
+
setNodeKeyOnDOMNode(nextRootElement, editor, 'root');
|
|
12074
12104
|
}
|
|
12075
12105
|
}
|
|
12076
12106
|
function initializeConversionCache(nodes, additionalConversions) {
|
|
@@ -12212,9 +12242,6 @@ function createEditor(editorConfig) {
|
|
|
12212
12242
|
console.warn(`${name} must implement static "${method}" method`);
|
|
12213
12243
|
}
|
|
12214
12244
|
});
|
|
12215
|
-
if (!hasOwnStaticMethod(klass, 'importDOM') && hasOwnExportDOM(klass)) {
|
|
12216
|
-
console.warn(`${name} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`);
|
|
12217
|
-
}
|
|
12218
12245
|
if (!hasOwnStaticMethod(klass, 'importJSON')) {
|
|
12219
12246
|
console.warn(`${name} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`);
|
|
12220
12247
|
}
|
|
@@ -12982,9 +13009,6 @@ const scheduleMicroTask = typeof queueMicrotask === 'function' ? queueMicrotask
|
|
|
12982
13009
|
// No window prefix intended (#1400)
|
|
12983
13010
|
Promise.resolve().then(fn);
|
|
12984
13011
|
};
|
|
12985
|
-
function $isSelectionCapturedInDecorator(node) {
|
|
12986
|
-
return $isDecoratorNode($getNearestNodeFromDOMNode(node));
|
|
12987
|
-
}
|
|
12988
13012
|
function isSelectionCapturedInDecoratorInput(anchorDOM) {
|
|
12989
13013
|
const activeElement = document.activeElement;
|
|
12990
13014
|
if (!isHTMLElement(activeElement)) {
|
|
@@ -13310,6 +13334,10 @@ function setNodeKeyOnDOMNode(dom, editor, key) {
|
|
|
13310
13334
|
const prop = `__lexicalKey_${editor._key}`;
|
|
13311
13335
|
dom[prop] = key;
|
|
13312
13336
|
}
|
|
13337
|
+
function clearNodeKeyOnDOMNode(dom, editor) {
|
|
13338
|
+
const prop = `__lexicalKey_${editor._key}`;
|
|
13339
|
+
delete dom[prop];
|
|
13340
|
+
}
|
|
13313
13341
|
function getNodeKeyFromDOMNode(dom, editor) {
|
|
13314
13342
|
const prop = `__lexicalKey_${editor._key}`;
|
|
13315
13343
|
return dom[prop];
|
|
@@ -13396,10 +13424,6 @@ function $getNodeFromDOM(dom) {
|
|
|
13396
13424
|
const editor = getActiveEditor();
|
|
13397
13425
|
const nodeKey = getNodeKeyFromDOMTree(dom, editor);
|
|
13398
13426
|
if (nodeKey === null) {
|
|
13399
|
-
const rootElement = editor.getRootElement();
|
|
13400
|
-
if (dom === rootElement) {
|
|
13401
|
-
return $getNodeByKey('root');
|
|
13402
|
-
}
|
|
13403
13427
|
return null;
|
|
13404
13428
|
}
|
|
13405
13429
|
return $getNodeByKey(nodeKey);
|
|
@@ -14585,16 +14609,29 @@ function $setFormatFromDOM(node, domNode) {
|
|
|
14585
14609
|
return alignment && alignment in ELEMENT_TYPE_TO_FORMAT ? node.setFormat(alignment) : node;
|
|
14586
14610
|
}
|
|
14587
14611
|
|
|
14612
|
+
/**
|
|
14613
|
+
* Options accepted by {@link setDOMUnmanaged}.
|
|
14614
|
+
*
|
|
14615
|
+
* @experimental
|
|
14616
|
+
*/
|
|
14617
|
+
|
|
14588
14618
|
/**
|
|
14589
14619
|
* Mark this DOM element as unmanaged by lexical's mutation observer (like
|
|
14590
14620
|
* decorator nodes are). Extensions that inject non-lexical decoration
|
|
14591
14621
|
* elements into a node's DOM should mark them so the mutation observer
|
|
14592
14622
|
* doesn't evict them as "unknown DOM children" during cleanup.
|
|
14593
14623
|
*
|
|
14624
|
+
* Pass `{captureSelection: true}` to additionally treat the subtree's
|
|
14625
|
+
* window selection as decorator-like, so resolution does not force-sync
|
|
14626
|
+
* the caret out of unmanaged DOM (see {@link isDOMCapturingSelection}).
|
|
14627
|
+
*
|
|
14594
14628
|
* @experimental
|
|
14595
14629
|
*/
|
|
14596
|
-
function setDOMUnmanaged(elementDom) {
|
|
14630
|
+
function setDOMUnmanaged(elementDom, options) {
|
|
14597
14631
|
elementDom.__lexicalUnmanaged = true;
|
|
14632
|
+
if (options && options.captureSelection !== undefined) {
|
|
14633
|
+
elementDom.__lexicalCapturedSelection = options.captureSelection;
|
|
14634
|
+
}
|
|
14598
14635
|
}
|
|
14599
14636
|
|
|
14600
14637
|
/**
|
|
@@ -14606,6 +14643,37 @@ function isDOMUnmanaged(elementDom) {
|
|
|
14606
14643
|
return elementDom.__lexicalUnmanaged === true;
|
|
14607
14644
|
}
|
|
14608
14645
|
|
|
14646
|
+
/**
|
|
14647
|
+
* True if the DOM node sits inside a subtree marked with
|
|
14648
|
+
* `{captureSelection: true}` via {@link setDOMUnmanaged}. Walks ancestors
|
|
14649
|
+
* so any descendant of a marked subtree (e.g. an `<input>` inside a marked
|
|
14650
|
+
* `<div>`) reports as captured too.
|
|
14651
|
+
*
|
|
14652
|
+
* The walk aborts at the first DOM node that corresponds to a Lexical
|
|
14653
|
+
* node in `editor` — that boundary is the implicit owner of the subtree's
|
|
14654
|
+
* selection, so a captureSelection marker above it (in non-Lexical
|
|
14655
|
+
* scaffolding around the editor) does not leak in.
|
|
14656
|
+
*
|
|
14657
|
+
* DecoratorNode DOM is marked with `setDOMUnmanaged({captureSelection:
|
|
14658
|
+
* true})` by the reconciler, so decorator subtrees also report as
|
|
14659
|
+
* captured here.
|
|
14660
|
+
*
|
|
14661
|
+
* @experimental
|
|
14662
|
+
*/
|
|
14663
|
+
function isDOMCapturingSelection(elementDom, editor) {
|
|
14664
|
+
let dom = elementDom;
|
|
14665
|
+
while (dom != null) {
|
|
14666
|
+
if (dom.__lexicalCapturedSelection === true) {
|
|
14667
|
+
return true;
|
|
14668
|
+
}
|
|
14669
|
+
if (getNodeKeyFromDOMNode(dom, editor) !== undefined) {
|
|
14670
|
+
return false;
|
|
14671
|
+
}
|
|
14672
|
+
dom = getParentElement(dom);
|
|
14673
|
+
}
|
|
14674
|
+
return false;
|
|
14675
|
+
}
|
|
14676
|
+
|
|
14609
14677
|
/**
|
|
14610
14678
|
* @internal
|
|
14611
14679
|
*
|
|
@@ -14622,13 +14690,6 @@ function hasOwnStaticMethod(klass, k) {
|
|
|
14622
14690
|
return hasOwn(klass, k) && klass[k] !== LexicalNode[k];
|
|
14623
14691
|
}
|
|
14624
14692
|
|
|
14625
|
-
/**
|
|
14626
|
-
* @internal
|
|
14627
|
-
*/
|
|
14628
|
-
function hasOwnExportDOM(klass) {
|
|
14629
|
-
return hasOwn(klass.prototype, 'exportDOM');
|
|
14630
|
-
}
|
|
14631
|
-
|
|
14632
14693
|
/** @internal */
|
|
14633
14694
|
function isAbstractNodeClass(klass) {
|
|
14634
14695
|
if (!(klass === LexicalNode || klass.prototype instanceof LexicalNode)) {
|
|
@@ -16387,4 +16448,4 @@ function mergeRegister(...func) {
|
|
|
16387
16448
|
};
|
|
16388
16449
|
}
|
|
16389
16450
|
|
|
16390
|
-
export { $addUpdateTag, $applyNodeReplacement, $caretFromPoint, $caretRangeFromSelection, $cloneWithProperties, $cloneWithPropertiesEphemeral, $comparePointCaretNext, $copyNode, $create, $createChildrenArray, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createPoint, $createRangeSelection, $createRangeSelectionFromDom, $createTabNode, $createTextNode, $extendCaretToRange, $findMatchingParent, $fullReconcile, $generateNodesFromRawText, $getAdjacentChildCaret, $getAdjacentNode, $getAdjacentSiblingOrParentSiblingCaret, $getCaretInDirection, $getCaretRange, $getCaretRangeInDirection, $getCharacterOffsets, $getChildCaret, $getChildCaretAtIndex, $getChildCaretOrSelf, $getCollapsedCaretRange, $getCommonAncestor, $getCommonAncestorResultBranchOrder, $getDOMSlot, $getDOMTextNode, $getEditor, $getEditorDOMRenderConfig, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getNodeByKeyOrThrow, $getNodeFromDOMNode, $getPreviousSelection, $getRoot, $getSelection, $getSiblingCaret, $getState, $getStateChange, $getTextContent, $getTextNodeOffset, $getTextPointCaret, $getTextPointCaretSlice, $getWritableNodeState, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isChildCaret, $isDecoratorNode, $isEditorState, $isElementDOMSlot, $isElementNode, $isExtendableTextPointCaret, $isInlineElementOrDecoratorNode, $isLeafNode, $isLexicalNode, $isLineBreakNode, $isNodeCaret, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isRootOrShadowRoot, $isSiblingCaret, $isTabNode, $isTextNode, $isTextPointCaret, $isTextPointCaretSlice, $isTokenOrSegmented, $isTokenOrTab, $nodesOfType, $normalizeCaret, $normalizeSelection as $normalizeSelection__EXPERIMENTAL, $onUpdate, $parseSerializedNode, $removeTextFromCaretRange, $rewindSiblingCaret, $selectAll, $setCompositionKey, $setDirectionFromDOM, $setFormatFromDOM, $setPointFromCaret, $setSelection, $setSelectionFromCaretRange, $setState, $splitAtPointCaretNext, $splitNode, $updateDOMSelection, $updateRangeSelectionFromCaretRange, ArtificialNode__DO_NOT_USE, BEFORE_INPUT_COMMAND, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CAN_USE_BEFORE_INPUT, CAN_USE_DOM, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, COLLABORATION_TAG, COMMAND_PRIORITY_BEFORE_CRITICAL, COMMAND_PRIORITY_BEFORE_EDITOR, COMMAND_PRIORITY_BEFORE_HIGH, COMMAND_PRIORITY_BEFORE_LOW, COMMAND_PRIORITY_BEFORE_NORMAL, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, COMPOSITION_END_COMMAND, COMPOSITION_END_TAG, COMPOSITION_START_COMMAND, COMPOSITION_START_TAG, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, CUT_COMMAND, DEFAULT_EDITOR_DOM_CONFIG, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, DecoratorNode, ElementNode, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, HISTORIC_TAG, HISTORY_MERGE_TAG, HISTORY_PUSH_TAG, INDENT_CONTENT_COMMAND, INPUT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, INTERNAL_$isBlock, IS_ALL_FORMATTING, IS_ANDROID, IS_ANDROID_CHROME, IS_APPLE, IS_APPLE_WEBKIT, IS_BOLD, IS_CHROME, IS_CODE, IS_FIREFOX, IS_HIGHLIGHT, IS_IOS, IS_ITALIC, IS_SAFARI, IS_STRIKETHROUGH, IS_SUBSCRIPT, IS_SUPERSCRIPT, IS_UNDERLINE, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, LineBreakNode, MOVE_TO_END, MOVE_TO_START, NODE_STATE_KEY, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, PASTE_TAG, ParagraphNode, REDO_COMMAND, REMOVE_TEXT_COMMAND, RootNode, SELECTION_CHANGE_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, SELECT_ALL_COMMAND, SKIP_COLLAB_TAG, SKIP_DOM_SELECTION_TAG, SKIP_SCROLL_INTO_VIEW_TAG, SKIP_SELECTION_FOCUS_TAG, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, addClassNamesToElement, buildImportMap, configExtension, createCommand, createEditor, createSharedNodeState, createState, declarePeerDependency, defineExtension, flipDirection, getDOMOwnerDocument, getDOMSelection, getDOMSelectionFromTarget, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, getRegisteredNode, getRegisteredNodeOrThrow, getStaticNodeConfig, getStyleObjectFromCSS, getTextDirection, getTransformSetFromKlass, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMDocumentNode, isDOMNode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isExactShortcutMatch, isHTMLAnchorElement, isHTMLElement, isHTMLTableCellElement, isHTMLTableRowElement, isInlineDomNode, isLexicalEditor, isModifierMatch, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, makeStepwiseIterator, mergeRegister, normalizeClassNames, removeClassNamesFromElement, removeFromParent, resetRandomKey, safeCast, setDOMStyleFromCSS, setDOMStyleObject, setDOMUnmanaged, setNodeIndentFromDOM, shallowMergeConfig, stopLexicalPropagation, toggleTextFormatType, tokenizeRawText };
|
|
16451
|
+
export { $addUpdateTag, $applyNodeReplacement, $assumeActiveEditor, $caretFromPoint, $caretRangeFromSelection, $cloneWithProperties, $cloneWithPropertiesEphemeral, $comparePointCaretNext, $copyNode, $create, $createChildrenArray, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createPoint, $createRangeSelection, $createRangeSelectionFromDom, $createTabNode, $createTextNode, $extendCaretToRange, $findMatchingParent, $fullReconcile, $generateNodesFromRawText, $getAdjacentChildCaret, $getAdjacentNode, $getAdjacentSiblingOrParentSiblingCaret, $getCaretInDirection, $getCaretRange, $getCaretRangeInDirection, $getCharacterOffsets, $getChildCaret, $getChildCaretAtIndex, $getChildCaretOrSelf, $getCollapsedCaretRange, $getCommonAncestor, $getCommonAncestorResultBranchOrder, $getDOMSlot, $getDOMTextNode, $getEditor, $getEditorDOMRenderConfig, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getNodeByKeyOrThrow, $getNodeFromDOMNode, $getPreviousSelection, $getRoot, $getSelection, $getSiblingCaret, $getState, $getStateChange, $getTextContent, $getTextNodeOffset, $getTextPointCaret, $getTextPointCaretSlice, $getWritableNodeState, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isChildCaret, $isDecoratorNode, $isEditorState, $isElementDOMSlot, $isElementNode, $isExtendableTextPointCaret, $isInlineElementOrDecoratorNode, $isLeafNode, $isLexicalNode, $isLineBreakNode, $isNodeCaret, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isRootOrShadowRoot, $isSiblingCaret, $isTabNode, $isTextNode, $isTextPointCaret, $isTextPointCaretSlice, $isTokenOrSegmented, $isTokenOrTab, $nodesOfType, $normalizeCaret, $normalizeSelection as $normalizeSelection__EXPERIMENTAL, $onUpdate, $parseSerializedNode, $removeTextFromCaretRange, $rewindSiblingCaret, $selectAll, $setCompositionKey, $setDirectionFromDOM, $setFormatFromDOM, $setPointFromCaret, $setSelection, $setSelectionFromCaretRange, $setState, $splitAtPointCaretNext, $splitNode, $updateDOMSelection, $updateRangeSelectionFromCaretRange, ArtificialNode__DO_NOT_USE, BEFORE_INPUT_COMMAND, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CAN_USE_BEFORE_INPUT, CAN_USE_DOM, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, COLLABORATION_TAG, COMMAND_PRIORITY_BEFORE_CRITICAL, COMMAND_PRIORITY_BEFORE_EDITOR, COMMAND_PRIORITY_BEFORE_HIGH, COMMAND_PRIORITY_BEFORE_LOW, COMMAND_PRIORITY_BEFORE_NORMAL, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, COMPOSITION_END_COMMAND, COMPOSITION_END_TAG, COMPOSITION_START_COMMAND, COMPOSITION_START_TAG, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, CUT_COMMAND, DEFAULT_EDITOR_DOM_CONFIG, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, DecoratorNode, ElementNode, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, HISTORIC_TAG, HISTORY_MERGE_TAG, HISTORY_PUSH_TAG, INDENT_CONTENT_COMMAND, INPUT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, INTERNAL_$isBlock, IS_ALL_FORMATTING, IS_ANDROID, IS_ANDROID_CHROME, IS_APPLE, IS_APPLE_WEBKIT, IS_BOLD, IS_CHROME, IS_CODE, IS_FIREFOX, IS_HIGHLIGHT, IS_IOS, IS_ITALIC, IS_SAFARI, IS_STRIKETHROUGH, IS_SUBSCRIPT, IS_SUPERSCRIPT, IS_UNDERLINE, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, LineBreakNode, MOVE_TO_END, MOVE_TO_START, NODE_STATE_KEY, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, PASTE_TAG, ParagraphNode, REDO_COMMAND, REMOVE_TEXT_COMMAND, RootNode, SELECTION_CHANGE_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, SELECT_ALL_COMMAND, SKIP_COLLAB_TAG, SKIP_DOM_SELECTION_TAG, SKIP_SCROLL_INTO_VIEW_TAG, SKIP_SELECTION_FOCUS_TAG, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, addClassNamesToElement, buildImportMap, configExtension, createCommand, createEditor, createSharedNodeState, createState, declarePeerDependency, defineExtension, flipDirection, getDOMOwnerDocument, getDOMSelection, getDOMSelectionFromTarget, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, getRegisteredNode, getRegisteredNodeOrThrow, getStaticNodeConfig, getStyleObjectFromCSS, getTextDirection, getTransformSetFromKlass, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMCapturingSelection, isDOMDocumentNode, isDOMNode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isExactShortcutMatch, isHTMLAnchorElement, isHTMLElement, isHTMLTableCellElement, isHTMLTableRowElement, isInlineDomNode, isLastChildInBlockNode, isLexicalEditor, isModifierMatch, isOnlyChildInBlockNode, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, makeStepwiseIterator, mergeRegister, normalizeClassNames, removeClassNamesFromElement, removeFromParent, resetRandomKey, safeCast, setDOMStyleFromCSS, setDOMStyleObject, setDOMUnmanaged, setNodeIndentFromDOM, shallowMergeConfig, stopLexicalPropagation, toggleTextFormatType, tokenizeRawText };
|
package/dist/Lexical.js.flow
CHANGED
|
@@ -941,8 +941,16 @@ declare export class ElementDOMSlot<out T extends HTMLElement> extends DOMSlot<T
|
|
|
941
941
|
resolveChildIndex(element: ElementNode, elementDOM: HTMLElement, initialDOM: Node, initialOffset: number): [node: ElementNode, idx: number];
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
|
|
944
|
+
export type SetDOMUnmanagedOptions = {captureSelection?: boolean};
|
|
945
|
+
declare export function setDOMUnmanaged(
|
|
946
|
+
elementDOM: HTMLElement,
|
|
947
|
+
options?: SetDOMUnmanagedOptions,
|
|
948
|
+
): void;
|
|
945
949
|
declare export function isDOMUnmanaged(elementDOM: HTMLElement): boolean;
|
|
950
|
+
declare export function isDOMCapturingSelection(
|
|
951
|
+
elementDOM: Node,
|
|
952
|
+
editor: LexicalEditor,
|
|
953
|
+
): boolean;
|
|
946
954
|
|
|
947
955
|
/**
|
|
948
956
|
* LexicalDecoratorNode
|
package/dist/Lexical.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import * as modProd from './Lexical.prod.mjs';
|
|
|
11
11
|
const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
|
|
12
12
|
export const $addUpdateTag = mod.$addUpdateTag;
|
|
13
13
|
export const $applyNodeReplacement = mod.$applyNodeReplacement;
|
|
14
|
+
export const $assumeActiveEditor = mod.$assumeActiveEditor;
|
|
14
15
|
export const $caretFromPoint = mod.$caretFromPoint;
|
|
15
16
|
export const $caretRangeFromSelection = mod.$caretRangeFromSelection;
|
|
16
17
|
export const $cloneWithProperties = mod.$cloneWithProperties;
|
|
@@ -235,6 +236,7 @@ export const getTextDirection = mod.getTextDirection;
|
|
|
235
236
|
export const getTransformSetFromKlass = mod.getTransformSetFromKlass;
|
|
236
237
|
export const isBlockDomNode = mod.isBlockDomNode;
|
|
237
238
|
export const isCurrentlyReadOnlyMode = mod.isCurrentlyReadOnlyMode;
|
|
239
|
+
export const isDOMCapturingSelection = mod.isDOMCapturingSelection;
|
|
238
240
|
export const isDOMDocumentNode = mod.isDOMDocumentNode;
|
|
239
241
|
export const isDOMNode = mod.isDOMNode;
|
|
240
242
|
export const isDOMTextNode = mod.isDOMTextNode;
|
|
@@ -246,8 +248,10 @@ export const isHTMLElement = mod.isHTMLElement;
|
|
|
246
248
|
export const isHTMLTableCellElement = mod.isHTMLTableCellElement;
|
|
247
249
|
export const isHTMLTableRowElement = mod.isHTMLTableRowElement;
|
|
248
250
|
export const isInlineDomNode = mod.isInlineDomNode;
|
|
251
|
+
export const isLastChildInBlockNode = mod.isLastChildInBlockNode;
|
|
249
252
|
export const isLexicalEditor = mod.isLexicalEditor;
|
|
250
253
|
export const isModifierMatch = mod.isModifierMatch;
|
|
254
|
+
export const isOnlyChildInBlockNode = mod.isOnlyChildInBlockNode;
|
|
251
255
|
export const isSelectionCapturedInDecoratorInput = mod.isSelectionCapturedInDecoratorInput;
|
|
252
256
|
export const isSelectionWithinEditor = mod.isSelectionWithinEditor;
|
|
253
257
|
export const makeStepwiseIterator = mod.makeStepwiseIterator;
|
package/dist/Lexical.node.mjs
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
const mod = await (process.env.NODE_ENV !== 'production' ? import('./Lexical.dev.mjs') : import('./Lexical.prod.mjs'));
|
|
10
10
|
export const $addUpdateTag = mod.$addUpdateTag;
|
|
11
11
|
export const $applyNodeReplacement = mod.$applyNodeReplacement;
|
|
12
|
+
export const $assumeActiveEditor = mod.$assumeActiveEditor;
|
|
12
13
|
export const $caretFromPoint = mod.$caretFromPoint;
|
|
13
14
|
export const $caretRangeFromSelection = mod.$caretRangeFromSelection;
|
|
14
15
|
export const $cloneWithProperties = mod.$cloneWithProperties;
|
|
@@ -233,6 +234,7 @@ export const getTextDirection = mod.getTextDirection;
|
|
|
233
234
|
export const getTransformSetFromKlass = mod.getTransformSetFromKlass;
|
|
234
235
|
export const isBlockDomNode = mod.isBlockDomNode;
|
|
235
236
|
export const isCurrentlyReadOnlyMode = mod.isCurrentlyReadOnlyMode;
|
|
237
|
+
export const isDOMCapturingSelection = mod.isDOMCapturingSelection;
|
|
236
238
|
export const isDOMDocumentNode = mod.isDOMDocumentNode;
|
|
237
239
|
export const isDOMNode = mod.isDOMNode;
|
|
238
240
|
export const isDOMTextNode = mod.isDOMTextNode;
|
|
@@ -244,8 +246,10 @@ export const isHTMLElement = mod.isHTMLElement;
|
|
|
244
246
|
export const isHTMLTableCellElement = mod.isHTMLTableCellElement;
|
|
245
247
|
export const isHTMLTableRowElement = mod.isHTMLTableRowElement;
|
|
246
248
|
export const isInlineDomNode = mod.isInlineDomNode;
|
|
249
|
+
export const isLastChildInBlockNode = mod.isLastChildInBlockNode;
|
|
247
250
|
export const isLexicalEditor = mod.isLexicalEditor;
|
|
248
251
|
export const isModifierMatch = mod.isModifierMatch;
|
|
252
|
+
export const isOnlyChildInBlockNode = mod.isOnlyChildInBlockNode;
|
|
249
253
|
export const isSelectionCapturedInDecoratorInput = mod.isSelectionCapturedInDecoratorInput;
|
|
250
254
|
export const isSelectionWithinEditor = mod.isSelectionWithinEditor;
|
|
251
255
|
export const makeStepwiseIterator = mod.makeStepwiseIterator;
|