From 137ba0789bd38ee812676e53e13ae959e024daf9 Mon Sep 17 00:00:00 2001 From: cuhong Date: Thu, 12 Dec 2024 15:30:14 +0900 Subject: [PATCH 1/2] Add check for isComposing to ensure events are not triggered prematurely. --- .../Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx index 7166e39753..f784e7ac03 100644 --- a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx +++ b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx @@ -314,7 +314,7 @@ const RichTextEditor = ({ const handleKeyDown = useCallback( (event: React.KeyboardEvent) => { - if (event.key === 'Enter' && !event.shiftKey) { + if (event.key === 'Enter' && !event.shiftKey && event.nativeEvent.isComposing === false) { event.preventDefault() if (messages[messages.length - 1]?.status !== MessageStatus.Pending) { sendChatMessage(currentPrompt) From 6efdb74027994af2e34f53d56039a4984afa4732 Mon Sep 17 00:00:00 2001 From: hongchan-ui Date: Mon, 16 Dec 2024 18:47:30 +0900 Subject: [PATCH 2/2] chore: Fix linter issue by adjusting `onKeyDown` logic formatting to Prettier standard - Refactored condition in `onKeyDown` function for better readability. - Resolved Prettier lint error by adding line breaks and proper indentation. --- .../Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx index 74377063ad..66c0d890ea 100644 --- a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx +++ b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx @@ -225,7 +225,11 @@ const RichTextEditor = ({ const handleKeyDown = useCallback( (event: React.KeyboardEvent) => { - if (event.key === 'Enter' && !event.shiftKey && event.nativeEvent.isComposing === false) { + if ( + event.key === 'Enter' && + !event.shiftKey && + event.nativeEvent.isComposing === false + ) { event.preventDefault() if (messages[messages.length - 1]?.status !== MessageStatus.Pending) { sendChatMessage(currentPrompt)