mirror of
https://github.com/facebook/lexical.git
synced 2025-08-06 16:39:33 +08:00

committed by
acywatson

parent
22a5d8511f
commit
d9559c07a4
@ -16,6 +16,7 @@ import {
|
||||
$getRoot,
|
||||
$getSelection,
|
||||
$isLeafNode,
|
||||
$isRangeSelection,
|
||||
$isTextNode,
|
||||
$setSelection,
|
||||
} from 'lexical';
|
||||
@ -142,7 +143,7 @@ function $wrapOverflowedNodes(offset: number): void {
|
||||
const selection = $getSelection();
|
||||
// Restore selection when the overflow children are removed
|
||||
if (
|
||||
selection !== null &&
|
||||
$isRangeSelection(selection) &&
|
||||
(!selection.anchor.getNode().isAttached() ||
|
||||
!selection.focus.getNode().isAttached())
|
||||
) {
|
||||
@ -237,7 +238,7 @@ export function mergePrevious(overflowNode: OverflowNode): void {
|
||||
}
|
||||
|
||||
const selection = $getSelection();
|
||||
if (selection !== null) {
|
||||
if ($isRangeSelection(selection)) {
|
||||
const anchor = selection.anchor;
|
||||
const anchorNode = anchor.getNode();
|
||||
const focus = selection.focus;
|
||||
|
Reference in New Issue
Block a user