lexical 0.27.3-nightly.20250317.0 → 0.28.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 +95 -3
- package/Lexical.dev.mjs +94 -4
- package/Lexical.js.flow +16 -1
- package/Lexical.mjs +2 -0
- package/Lexical.node.mjs +2 -0
- package/Lexical.prod.js +1 -1
- package/Lexical.prod.mjs +1 -1
- package/caret/LexicalCaret.d.ts +5 -1
- package/caret/LexicalCaretUtils.d.ts +37 -0
- package/index.d.ts +2 -2
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -7701,11 +7701,19 @@ function $applyAllTransforms(editorState, editor) {
|
|
|
7701
7701
|
// new ones caused by element transforms
|
|
7702
7702
|
editor._dirtyLeaves = new Set();
|
|
7703
7703
|
editor._dirtyElements = new Map();
|
|
7704
|
+
|
|
7705
|
+
// The root is always considered intentionally dirty if any attached node
|
|
7706
|
+
// is dirty and by deleting and re-inserting we will apply its transforms
|
|
7707
|
+
// last (e.g. its transform can be used as a sort of "update finalizer")
|
|
7708
|
+
const rootDirty = untransformedDirtyElements.delete('root');
|
|
7709
|
+
if (rootDirty) {
|
|
7710
|
+
untransformedDirtyElements.set('root', true);
|
|
7711
|
+
}
|
|
7704
7712
|
for (const currentUntransformedDirtyElement of untransformedDirtyElements) {
|
|
7705
7713
|
const nodeKey = currentUntransformedDirtyElement[0];
|
|
7706
7714
|
const intentionallyMarkedAsDirty = currentUntransformedDirtyElement[1];
|
|
7707
7715
|
dirtyElements.set(nodeKey, intentionallyMarkedAsDirty);
|
|
7708
|
-
if (
|
|
7716
|
+
if (!intentionallyMarkedAsDirty) {
|
|
7709
7717
|
continue;
|
|
7710
7718
|
}
|
|
7711
7719
|
const node = nodeMap.get(nodeKey);
|
|
@@ -10247,7 +10255,7 @@ class LexicalEditor {
|
|
|
10247
10255
|
};
|
|
10248
10256
|
}
|
|
10249
10257
|
}
|
|
10250
|
-
LexicalEditor.version = "0.
|
|
10258
|
+
LexicalEditor.version = "0.28.0+dev.cjs";
|
|
10251
10259
|
|
|
10252
10260
|
let keyCounter = 1;
|
|
10253
10261
|
function resetRandomKey() {
|
|
@@ -12221,6 +12229,13 @@ function $extendCaretToRange(anchor) {
|
|
|
12221
12229
|
return $getCaretRange(anchor, $getSiblingCaret($getRoot(), anchor.direction));
|
|
12222
12230
|
}
|
|
12223
12231
|
|
|
12232
|
+
/**
|
|
12233
|
+
* Construct a collapsed CaretRange that starts and ends at anchor.
|
|
12234
|
+
*/
|
|
12235
|
+
function $getCollapsedCaretRange(anchor) {
|
|
12236
|
+
return $getCaretRange(anchor, anchor);
|
|
12237
|
+
}
|
|
12238
|
+
|
|
12224
12239
|
/**
|
|
12225
12240
|
* Construct a CaretRange from anchor and focus carets pointing in the
|
|
12226
12241
|
* same direction. In order to get the expected behavior,
|
|
@@ -12683,7 +12698,7 @@ function $removeTextFromCaretRange(initialRange, sliceMode = 'removeEmptySlices'
|
|
|
12683
12698
|
const bestCandidate = [anchorCandidate, focusCandidate, ...anchorCandidates, ...focusCandidates].find($isCaretAttached);
|
|
12684
12699
|
if (bestCandidate) {
|
|
12685
12700
|
const anchor = $getCaretInDirection($normalizeCaret(bestCandidate), initialRange.direction);
|
|
12686
|
-
return $
|
|
12701
|
+
return $getCollapsedCaretRange(anchor);
|
|
12687
12702
|
}
|
|
12688
12703
|
{
|
|
12689
12704
|
formatDevErrorMessage(`$removeTextFromCaretRange: selection was lost, could not find a new anchor given candidates with keys: ${JSON.stringify(anchorCandidates.map(n => n.origin.__key))}`);
|
|
@@ -12871,6 +12886,81 @@ function $getAdjacentSiblingOrParentSiblingCaret(startCaret, rootMode = 'root')
|
|
|
12871
12886
|
return nextCaret && [nextCaret, depthDiff];
|
|
12872
12887
|
}
|
|
12873
12888
|
|
|
12889
|
+
/**
|
|
12890
|
+
* Get the adjacent nodes to initialCaret in the given direction.
|
|
12891
|
+
*
|
|
12892
|
+
* @example
|
|
12893
|
+
* ```ts
|
|
12894
|
+
* expect($getAdjacentNodes($getChildCaret(parent, 'next'))).toEqual(parent.getChildren());
|
|
12895
|
+
* expect($getAdjacentNodes($getChildCaret(parent, 'previous'))).toEqual(parent.getChildren().reverse());
|
|
12896
|
+
* expect($getAdjacentNodes($getSiblingCaret(node, 'next'))).toEqual(node.getNextSiblings());
|
|
12897
|
+
* expect($getAdjacentNodes($getSiblingCaret(node, 'previous'))).toEqual(node.getPreviousSiblings().reverse());
|
|
12898
|
+
* ```
|
|
12899
|
+
*
|
|
12900
|
+
* @param initialCaret The caret to start at (the origin will not be included)
|
|
12901
|
+
* @returns An array of siblings.
|
|
12902
|
+
*/
|
|
12903
|
+
function $getAdjacentNodes(initialCaret) {
|
|
12904
|
+
const siblings = [];
|
|
12905
|
+
for (let caret = initialCaret.getAdjacentCaret(); caret; caret = caret.getAdjacentCaret()) {
|
|
12906
|
+
siblings.push(caret.origin);
|
|
12907
|
+
}
|
|
12908
|
+
return siblings;
|
|
12909
|
+
}
|
|
12910
|
+
function $splitTextPointCaret(textPointCaret) {
|
|
12911
|
+
const {
|
|
12912
|
+
origin,
|
|
12913
|
+
offset,
|
|
12914
|
+
direction
|
|
12915
|
+
} = textPointCaret;
|
|
12916
|
+
if (offset === $getTextNodeOffset(origin, direction)) {
|
|
12917
|
+
return textPointCaret.getSiblingCaret();
|
|
12918
|
+
} else if (offset === $getTextNodeOffset(origin, flipDirection(direction))) {
|
|
12919
|
+
return $rewindSiblingCaret(textPointCaret.getSiblingCaret());
|
|
12920
|
+
}
|
|
12921
|
+
const [textNode] = origin.splitText(offset);
|
|
12922
|
+
if (!$isTextNode(textNode)) {
|
|
12923
|
+
formatDevErrorMessage(`$splitTextPointCaret: splitText must return at least one TextNode`);
|
|
12924
|
+
}
|
|
12925
|
+
return $getCaretInDirection($getSiblingCaret(textNode, 'next'), direction);
|
|
12926
|
+
}
|
|
12927
|
+
function $alwaysSplit(_node, _edge) {
|
|
12928
|
+
return true;
|
|
12929
|
+
}
|
|
12930
|
+
|
|
12931
|
+
/**
|
|
12932
|
+
* Split a node at a PointCaret and return a NodeCaret at that point, or null if the
|
|
12933
|
+
* node can't be split. This is non-recursive and will only perform at most one split.
|
|
12934
|
+
*
|
|
12935
|
+
* @returns The NodeCaret pointing to the location of the split (or null if a split is not possible)
|
|
12936
|
+
*/
|
|
12937
|
+
function $splitAtPointCaretNext(pointCaret, {
|
|
12938
|
+
$copyElementNode = $copyNode,
|
|
12939
|
+
$splitTextPointCaretNext = $splitTextPointCaret,
|
|
12940
|
+
rootMode = 'shadowRoot',
|
|
12941
|
+
$shouldSplit = $alwaysSplit
|
|
12942
|
+
} = {}) {
|
|
12943
|
+
if ($isTextPointCaret(pointCaret)) {
|
|
12944
|
+
return $splitTextPointCaretNext(pointCaret);
|
|
12945
|
+
}
|
|
12946
|
+
const parentCaret = pointCaret.getParentCaret(rootMode);
|
|
12947
|
+
if (parentCaret) {
|
|
12948
|
+
const {
|
|
12949
|
+
origin
|
|
12950
|
+
} = parentCaret;
|
|
12951
|
+
if ($isChildCaret(pointCaret) && !(origin.canBeEmpty() && $shouldSplit(origin, 'first'))) {
|
|
12952
|
+
// No split necessary, the left side would be empty
|
|
12953
|
+
return $rewindSiblingCaret(parentCaret);
|
|
12954
|
+
}
|
|
12955
|
+
const siblings = $getAdjacentNodes(pointCaret);
|
|
12956
|
+
if (siblings.length > 0 || origin.canBeEmpty() && $shouldSplit(origin, 'last')) {
|
|
12957
|
+
// Split and insert the siblings into the new tree
|
|
12958
|
+
parentCaret.insert($copyElementNode(origin).splice(0, 0, siblings));
|
|
12959
|
+
}
|
|
12960
|
+
}
|
|
12961
|
+
return parentCaret;
|
|
12962
|
+
}
|
|
12963
|
+
|
|
12874
12964
|
exports.$addUpdateTag = $addUpdateTag;
|
|
12875
12965
|
exports.$applyNodeReplacement = $applyNodeReplacement;
|
|
12876
12966
|
exports.$caretFromPoint = $caretFromPoint;
|
|
@@ -12897,6 +12987,7 @@ exports.$getCharacterOffsets = $getCharacterOffsets;
|
|
|
12897
12987
|
exports.$getChildCaret = $getChildCaret;
|
|
12898
12988
|
exports.$getChildCaretAtIndex = $getChildCaretAtIndex;
|
|
12899
12989
|
exports.$getChildCaretOrSelf = $getChildCaretOrSelf;
|
|
12990
|
+
exports.$getCollapsedCaretRange = $getCollapsedCaretRange;
|
|
12900
12991
|
exports.$getCommonAncestor = $getCommonAncestor;
|
|
12901
12992
|
exports.$getCommonAncestorResultBranchOrder = $getCommonAncestorResultBranchOrder;
|
|
12902
12993
|
exports.$getEditor = $getEditor;
|
|
@@ -12951,6 +13042,7 @@ exports.$setPointFromCaret = $setPointFromCaret;
|
|
|
12951
13042
|
exports.$setSelection = $setSelection;
|
|
12952
13043
|
exports.$setSelectionFromCaretRange = $setSelectionFromCaretRange;
|
|
12953
13044
|
exports.$setState = $setState;
|
|
13045
|
+
exports.$splitAtPointCaretNext = $splitAtPointCaretNext;
|
|
12954
13046
|
exports.$splitNode = $splitNode;
|
|
12955
13047
|
exports.$updateRangeSelectionFromCaretRange = $updateRangeSelectionFromCaretRange;
|
|
12956
13048
|
exports.ArtificialNode__DO_NOT_USE = ArtificialNode__DO_NOT_USE;
|
package/Lexical.dev.mjs
CHANGED
|
@@ -7699,11 +7699,19 @@ function $applyAllTransforms(editorState, editor) {
|
|
|
7699
7699
|
// new ones caused by element transforms
|
|
7700
7700
|
editor._dirtyLeaves = new Set();
|
|
7701
7701
|
editor._dirtyElements = new Map();
|
|
7702
|
+
|
|
7703
|
+
// The root is always considered intentionally dirty if any attached node
|
|
7704
|
+
// is dirty and by deleting and re-inserting we will apply its transforms
|
|
7705
|
+
// last (e.g. its transform can be used as a sort of "update finalizer")
|
|
7706
|
+
const rootDirty = untransformedDirtyElements.delete('root');
|
|
7707
|
+
if (rootDirty) {
|
|
7708
|
+
untransformedDirtyElements.set('root', true);
|
|
7709
|
+
}
|
|
7702
7710
|
for (const currentUntransformedDirtyElement of untransformedDirtyElements) {
|
|
7703
7711
|
const nodeKey = currentUntransformedDirtyElement[0];
|
|
7704
7712
|
const intentionallyMarkedAsDirty = currentUntransformedDirtyElement[1];
|
|
7705
7713
|
dirtyElements.set(nodeKey, intentionallyMarkedAsDirty);
|
|
7706
|
-
if (
|
|
7714
|
+
if (!intentionallyMarkedAsDirty) {
|
|
7707
7715
|
continue;
|
|
7708
7716
|
}
|
|
7709
7717
|
const node = nodeMap.get(nodeKey);
|
|
@@ -10245,7 +10253,7 @@ class LexicalEditor {
|
|
|
10245
10253
|
};
|
|
10246
10254
|
}
|
|
10247
10255
|
}
|
|
10248
|
-
LexicalEditor.version = "0.
|
|
10256
|
+
LexicalEditor.version = "0.28.0+dev.esm";
|
|
10249
10257
|
|
|
10250
10258
|
let keyCounter = 1;
|
|
10251
10259
|
function resetRandomKey() {
|
|
@@ -12219,6 +12227,13 @@ function $extendCaretToRange(anchor) {
|
|
|
12219
12227
|
return $getCaretRange(anchor, $getSiblingCaret($getRoot(), anchor.direction));
|
|
12220
12228
|
}
|
|
12221
12229
|
|
|
12230
|
+
/**
|
|
12231
|
+
* Construct a collapsed CaretRange that starts and ends at anchor.
|
|
12232
|
+
*/
|
|
12233
|
+
function $getCollapsedCaretRange(anchor) {
|
|
12234
|
+
return $getCaretRange(anchor, anchor);
|
|
12235
|
+
}
|
|
12236
|
+
|
|
12222
12237
|
/**
|
|
12223
12238
|
* Construct a CaretRange from anchor and focus carets pointing in the
|
|
12224
12239
|
* same direction. In order to get the expected behavior,
|
|
@@ -12681,7 +12696,7 @@ function $removeTextFromCaretRange(initialRange, sliceMode = 'removeEmptySlices'
|
|
|
12681
12696
|
const bestCandidate = [anchorCandidate, focusCandidate, ...anchorCandidates, ...focusCandidates].find($isCaretAttached);
|
|
12682
12697
|
if (bestCandidate) {
|
|
12683
12698
|
const anchor = $getCaretInDirection($normalizeCaret(bestCandidate), initialRange.direction);
|
|
12684
|
-
return $
|
|
12699
|
+
return $getCollapsedCaretRange(anchor);
|
|
12685
12700
|
}
|
|
12686
12701
|
{
|
|
12687
12702
|
formatDevErrorMessage(`$removeTextFromCaretRange: selection was lost, could not find a new anchor given candidates with keys: ${JSON.stringify(anchorCandidates.map(n => n.origin.__key))}`);
|
|
@@ -12869,4 +12884,79 @@ function $getAdjacentSiblingOrParentSiblingCaret(startCaret, rootMode = 'root')
|
|
|
12869
12884
|
return nextCaret && [nextCaret, depthDiff];
|
|
12870
12885
|
}
|
|
12871
12886
|
|
|
12872
|
-
|
|
12887
|
+
/**
|
|
12888
|
+
* Get the adjacent nodes to initialCaret in the given direction.
|
|
12889
|
+
*
|
|
12890
|
+
* @example
|
|
12891
|
+
* ```ts
|
|
12892
|
+
* expect($getAdjacentNodes($getChildCaret(parent, 'next'))).toEqual(parent.getChildren());
|
|
12893
|
+
* expect($getAdjacentNodes($getChildCaret(parent, 'previous'))).toEqual(parent.getChildren().reverse());
|
|
12894
|
+
* expect($getAdjacentNodes($getSiblingCaret(node, 'next'))).toEqual(node.getNextSiblings());
|
|
12895
|
+
* expect($getAdjacentNodes($getSiblingCaret(node, 'previous'))).toEqual(node.getPreviousSiblings().reverse());
|
|
12896
|
+
* ```
|
|
12897
|
+
*
|
|
12898
|
+
* @param initialCaret The caret to start at (the origin will not be included)
|
|
12899
|
+
* @returns An array of siblings.
|
|
12900
|
+
*/
|
|
12901
|
+
function $getAdjacentNodes(initialCaret) {
|
|
12902
|
+
const siblings = [];
|
|
12903
|
+
for (let caret = initialCaret.getAdjacentCaret(); caret; caret = caret.getAdjacentCaret()) {
|
|
12904
|
+
siblings.push(caret.origin);
|
|
12905
|
+
}
|
|
12906
|
+
return siblings;
|
|
12907
|
+
}
|
|
12908
|
+
function $splitTextPointCaret(textPointCaret) {
|
|
12909
|
+
const {
|
|
12910
|
+
origin,
|
|
12911
|
+
offset,
|
|
12912
|
+
direction
|
|
12913
|
+
} = textPointCaret;
|
|
12914
|
+
if (offset === $getTextNodeOffset(origin, direction)) {
|
|
12915
|
+
return textPointCaret.getSiblingCaret();
|
|
12916
|
+
} else if (offset === $getTextNodeOffset(origin, flipDirection(direction))) {
|
|
12917
|
+
return $rewindSiblingCaret(textPointCaret.getSiblingCaret());
|
|
12918
|
+
}
|
|
12919
|
+
const [textNode] = origin.splitText(offset);
|
|
12920
|
+
if (!$isTextNode(textNode)) {
|
|
12921
|
+
formatDevErrorMessage(`$splitTextPointCaret: splitText must return at least one TextNode`);
|
|
12922
|
+
}
|
|
12923
|
+
return $getCaretInDirection($getSiblingCaret(textNode, 'next'), direction);
|
|
12924
|
+
}
|
|
12925
|
+
function $alwaysSplit(_node, _edge) {
|
|
12926
|
+
return true;
|
|
12927
|
+
}
|
|
12928
|
+
|
|
12929
|
+
/**
|
|
12930
|
+
* Split a node at a PointCaret and return a NodeCaret at that point, or null if the
|
|
12931
|
+
* node can't be split. This is non-recursive and will only perform at most one split.
|
|
12932
|
+
*
|
|
12933
|
+
* @returns The NodeCaret pointing to the location of the split (or null if a split is not possible)
|
|
12934
|
+
*/
|
|
12935
|
+
function $splitAtPointCaretNext(pointCaret, {
|
|
12936
|
+
$copyElementNode = $copyNode,
|
|
12937
|
+
$splitTextPointCaretNext = $splitTextPointCaret,
|
|
12938
|
+
rootMode = 'shadowRoot',
|
|
12939
|
+
$shouldSplit = $alwaysSplit
|
|
12940
|
+
} = {}) {
|
|
12941
|
+
if ($isTextPointCaret(pointCaret)) {
|
|
12942
|
+
return $splitTextPointCaretNext(pointCaret);
|
|
12943
|
+
}
|
|
12944
|
+
const parentCaret = pointCaret.getParentCaret(rootMode);
|
|
12945
|
+
if (parentCaret) {
|
|
12946
|
+
const {
|
|
12947
|
+
origin
|
|
12948
|
+
} = parentCaret;
|
|
12949
|
+
if ($isChildCaret(pointCaret) && !(origin.canBeEmpty() && $shouldSplit(origin, 'first'))) {
|
|
12950
|
+
// No split necessary, the left side would be empty
|
|
12951
|
+
return $rewindSiblingCaret(parentCaret);
|
|
12952
|
+
}
|
|
12953
|
+
const siblings = $getAdjacentNodes(pointCaret);
|
|
12954
|
+
if (siblings.length > 0 || origin.canBeEmpty() && $shouldSplit(origin, 'last')) {
|
|
12955
|
+
// Split and insert the siblings into the new tree
|
|
12956
|
+
parentCaret.insert($copyElementNode(origin).splice(0, 0, siblings));
|
|
12957
|
+
}
|
|
12958
|
+
}
|
|
12959
|
+
return parentCaret;
|
|
12960
|
+
}
|
|
12961
|
+
|
|
12962
|
+
export { $addUpdateTag, $applyNodeReplacement, $caretFromPoint, $caretRangeFromSelection, $cloneWithProperties, $comparePointCaretNext, $copyNode, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createPoint, $createRangeSelection, $createRangeSelectionFromDom, $createTabNode, $createTextNode, $extendCaretToRange, $getAdjacentChildCaret, $getAdjacentNode, $getAdjacentSiblingOrParentSiblingCaret, $getCaretInDirection, $getCaretRange, $getCaretRangeInDirection, $getCharacterOffsets, $getChildCaret, $getChildCaretAtIndex, $getChildCaretOrSelf, $getCollapsedCaretRange, $getCommonAncestor, $getCommonAncestorResultBranchOrder, $getEditor, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getNodeByKeyOrThrow, $getPreviousSelection, $getRoot, $getSelection, $getSiblingCaret, $getState, $getStateChange, $getTextContent, $getTextNodeOffset, $getTextPointCaret, $getTextPointCaretSlice, $getWritableNodeState, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isChildCaret, $isDecoratorNode, $isElementNode, $isExtendableTextPointCaret, $isInlineElementOrDecoratorNode, $isLeafNode, $isLineBreakNode, $isNodeCaret, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isRootOrShadowRoot, $isSiblingCaret, $isTabNode, $isTextNode, $isTextPointCaret, $isTextPointCaretSlice, $isTokenOrSegmented, $nodesOfType, $normalizeCaret, $normalizeSelection as $normalizeSelection__EXPERIMENTAL, $onUpdate, $parseSerializedNode, $removeTextFromCaretRange, $rewindSiblingCaret, $selectAll, $setCompositionKey, $setPointFromCaret, $setSelection, $setSelectionFromCaretRange, $setState, $splitAtPointCaretNext, $splitNode, $updateRangeSelectionFromCaretRange, ArtificialNode__DO_NOT_USE, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, CUT_COMMAND, 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, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, INTERNAL_$isBlock, IS_ALL_FORMATTING, IS_BOLD, IS_CODE, IS_HIGHLIGHT, IS_ITALIC, 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, ParagraphNode, REDO_COMMAND, REMOVE_TEXT_COMMAND, RootNode, SELECTION_CHANGE_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, SELECT_ALL_COMMAND, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, createCommand, createEditor, createState, flipDirection, getDOMOwnerDocument, getDOMSelection, getDOMSelectionFromTarget, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMDocumentNode, isDOMNode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, isLexicalEditor, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, makeStepwiseIterator, resetRandomKey, setDOMUnmanaged, setNodeIndentFromDOM };
|
package/Lexical.js.flow
CHANGED
|
@@ -1227,7 +1227,22 @@ declare export function $getCommonAncestor<
|
|
|
1227
1227
|
declare export function $extendCaretToRange<D: CaretDirection>(
|
|
1228
1228
|
anchor: PointCaret<D>,
|
|
1229
1229
|
): CaretRange<D>;
|
|
1230
|
-
|
|
1230
|
+
declare export function $getCollapsedCaretRange<D: CaretDirection>(
|
|
1231
|
+
anchor: PointCaret<D>,
|
|
1232
|
+
): CaretRange<D>;
|
|
1231
1233
|
declare export function $isExtendableTextPointCaret<D: CaretDirection>(
|
|
1232
1234
|
caret: PointCaret<D>
|
|
1233
1235
|
): implies caret is TextPointCaret<TextNode, D>;
|
|
1236
|
+
|
|
1237
|
+
export interface SplitAtPointCaretNextOptions {
|
|
1238
|
+
$copyElementNode?: (node: ElementNode) => ElementNode;
|
|
1239
|
+
$splitTextPointCaretNext?: (
|
|
1240
|
+
caret: TextPointCaret<TextNode, 'next'>,
|
|
1241
|
+
) => NodeCaret<'next'>;
|
|
1242
|
+
rootMode?: RootMode;
|
|
1243
|
+
$shouldSplit?: (node: ElementNode, edge: 'first' | 'last') => boolean;
|
|
1244
|
+
}
|
|
1245
|
+
declare export function $splitAtPointCaretNext(
|
|
1246
|
+
pointCaret: PointCaret<'next'>,
|
|
1247
|
+
options?: SplitAtPointCaretNextOptions,
|
|
1248
|
+
): null | NodeCaret<'next'>;
|
package/Lexical.mjs
CHANGED
|
@@ -35,6 +35,7 @@ export const $getCharacterOffsets = mod.$getCharacterOffsets;
|
|
|
35
35
|
export const $getChildCaret = mod.$getChildCaret;
|
|
36
36
|
export const $getChildCaretAtIndex = mod.$getChildCaretAtIndex;
|
|
37
37
|
export const $getChildCaretOrSelf = mod.$getChildCaretOrSelf;
|
|
38
|
+
export const $getCollapsedCaretRange = mod.$getCollapsedCaretRange;
|
|
38
39
|
export const $getCommonAncestor = mod.$getCommonAncestor;
|
|
39
40
|
export const $getCommonAncestorResultBranchOrder = mod.$getCommonAncestorResultBranchOrder;
|
|
40
41
|
export const $getEditor = mod.$getEditor;
|
|
@@ -89,6 +90,7 @@ export const $setPointFromCaret = mod.$setPointFromCaret;
|
|
|
89
90
|
export const $setSelection = mod.$setSelection;
|
|
90
91
|
export const $setSelectionFromCaretRange = mod.$setSelectionFromCaretRange;
|
|
91
92
|
export const $setState = mod.$setState;
|
|
93
|
+
export const $splitAtPointCaretNext = mod.$splitAtPointCaretNext;
|
|
92
94
|
export const $splitNode = mod.$splitNode;
|
|
93
95
|
export const $updateRangeSelectionFromCaretRange = mod.$updateRangeSelectionFromCaretRange;
|
|
94
96
|
export const ArtificialNode__DO_NOT_USE = mod.ArtificialNode__DO_NOT_USE;
|
package/Lexical.node.mjs
CHANGED
|
@@ -33,6 +33,7 @@ export const $getCharacterOffsets = mod.$getCharacterOffsets;
|
|
|
33
33
|
export const $getChildCaret = mod.$getChildCaret;
|
|
34
34
|
export const $getChildCaretAtIndex = mod.$getChildCaretAtIndex;
|
|
35
35
|
export const $getChildCaretOrSelf = mod.$getChildCaretOrSelf;
|
|
36
|
+
export const $getCollapsedCaretRange = mod.$getCollapsedCaretRange;
|
|
36
37
|
export const $getCommonAncestor = mod.$getCommonAncestor;
|
|
37
38
|
export const $getCommonAncestorResultBranchOrder = mod.$getCommonAncestorResultBranchOrder;
|
|
38
39
|
export const $getEditor = mod.$getEditor;
|
|
@@ -87,6 +88,7 @@ export const $setPointFromCaret = mod.$setPointFromCaret;
|
|
|
87
88
|
export const $setSelection = mod.$setSelection;
|
|
88
89
|
export const $setSelectionFromCaretRange = mod.$setSelectionFromCaretRange;
|
|
89
90
|
export const $setState = mod.$setState;
|
|
91
|
+
export const $splitAtPointCaretNext = mod.$splitAtPointCaretNext;
|
|
90
92
|
export const $splitNode = mod.$splitNode;
|
|
91
93
|
export const $updateRangeSelectionFromCaretRange = mod.$updateRangeSelectionFromCaretRange;
|
|
92
94
|
export const ArtificialNode__DO_NOT_USE = mod.ArtificialNode__DO_NOT_USE;
|