internalMarkNodeAsDirty,
removeFromParent,
} from './LexicalUtils';
+import {$insertAndSelectNewEmptyAdjacentNode} from "../../utils/nodes";
export type NodeMap = Map<NodeKey, LexicalNode>;
const prevSibling = this.getPreviousSibling();
const parent = this.getParentOrThrow();
if (prevSibling === null) {
- return parent.select(0, 0);
+ return $insertAndSelectNewEmptyAdjacentNode(this, false);
}
if ($isElementNode(prevSibling)) {
return prevSibling.select();
const nextSibling = this.getNextSibling();
const parent = this.getParentOrThrow();
if (nextSibling === null) {
- return parent.select();
+ return $insertAndSelectNewEmptyAdjacentNode(this, true);
}
if ($isElementNode(nextSibling)) {
return nextSibling.select(0, 0);