From 787b3273023834d4aea44ccdee82405410a8ef8a Mon Sep 17 00:00:00 2001 From: Taro Shono Date: Tue, 15 Oct 2024 23:45:36 +0900 Subject: [PATCH] Update packages/lexical/src/LexicalSelection.ts Co-authored-by: Bob Ippolito --- packages/lexical/src/LexicalSelection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lexical/src/LexicalSelection.ts b/packages/lexical/src/LexicalSelection.ts index dd490b75be9..3af4b30d0db 100644 --- a/packages/lexical/src/LexicalSelection.ts +++ b/packages/lexical/src/LexicalSelection.ts @@ -1860,7 +1860,7 @@ export class RangeSelection implements BaseSelection { // extend the selection by one character in the specified direction. // This ensures that the parent element is deleted along with its content. // Otherwise, only the text content will be deleted, leaving an empty parent node. - if (this.anchor.offset === 0) { + if (this.isCollapsed() && this.anchor.offset === 0) { this.modify('extend', isBackward, 'character'); }