From 10996aea5ce614cfea39d32e8632fe35d0313cc6 Mon Sep 17 00:00:00 2001 From: matsuyama-k1 <111737064+matsuyama-k1@users.noreply.github.com> Date: Sat, 30 Mar 2024 06:15:40 +0900 Subject: [PATCH] fix: Double input of text when composing at TextNode boundaries (#5762) --- packages/lexical/src/LexicalUtils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/lexical/src/LexicalUtils.ts b/packages/lexical/src/LexicalUtils.ts index ff3eff86643..5df7b99c954 100644 --- a/packages/lexical/src/LexicalUtils.ts +++ b/packages/lexical/src/LexicalUtils.ts @@ -713,13 +713,15 @@ export function $shouldInsertTextAfterOrBeforeTextNode( if (offset === 0) { return ( !node.canInsertTextBefore() || - !parent.canInsertTextBefore() || + (!parent.canInsertTextBefore() && !node.isComposing()) || isToken || $previousSiblingDoesNotAcceptText(node) ); } else if (offset === node.getTextContentSize()) { return ( - !node.canInsertTextAfter() || !parent.canInsertTextAfter() || isToken + !node.canInsertTextAfter() || + (!parent.canInsertTextAfter() && !node.isComposing()) || + isToken ); } else { return false;