From 4ce9f632bc670f0560b1464b524199394396352b Mon Sep 17 00:00:00 2001 From: Rylan Date: Wed, 1 Apr 2026 14:50:25 +0800 Subject: [PATCH] fix(chat-sender): prevent sending message during Chinese Pinyin composition --- src/chat-sender/chat-sender.tsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/chat-sender/chat-sender.tsx b/src/chat-sender/chat-sender.tsx index 48eb238e..c56b9dde 100644 --- a/src/chat-sender/chat-sender.tsx +++ b/src/chat-sender/chat-sender.tsx @@ -250,8 +250,6 @@ export default class ChatSender extends Component { onChange={this.handleChange} onKeyDown={this.handleKeyDown} onKeyUp={this.handleKeyUp} - onCompositionStart={this.handleCompositionStart} - onCompositionEnd={this.handleCompositionEnd} onFocus={this.handleFocus} onBlur={this.handleBlur} /> @@ -281,7 +279,7 @@ export default class ChatSender extends Component { private handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'Shift') this.shiftDown = true; - if (e.key === 'Enter' && !this.shiftDown) { + if (e.key === 'Enter' && !this.shiftDown && !e.isComposing) { e.preventDefault(); this.clickSend(); } @@ -291,14 +289,6 @@ export default class ChatSender extends Component { if (e.key === 'Shift') this.shiftDown = false; }; - private handleCompositionStart = () => { - this.shiftDown = true; - }; - - private handleCompositionEnd = () => { - this.shiftDown = false; - }; - private handleFocus = () => { this.fire('focus', this.inputValue, { composed: true,