From 00a282214e60ad29a3041fc35fa2196b84751d7b Mon Sep 17 00:00:00 2001 From: linqirong <609413692@qq.com> Date: Sun, 2 Apr 2023 00:12:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=B3=95=E4=B8=8Benter=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/home.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index de93510d..210e4d74 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -132,9 +132,9 @@ function useSubmitHandler() { const config = useChatStore((state) => state.config); const submitKey = config.submitKey; - const shouldSubmit = (e: KeyboardEvent) => { + const shouldSubmit = (e: React.KeyboardEvent) => { if (e.key !== "Enter") return false; - + if(e.key==='Enter' && e.nativeEvent.isComposing) return false return ( (config.submitKey === SubmitKey.AltEnter && e.altKey) || (config.submitKey === SubmitKey.CtrlEnter && e.ctrlKey) || @@ -256,7 +256,7 @@ export function Chat(props: { }; // check if should send message - const onInputKeyDown = (e: KeyboardEvent) => { + const onInputKeyDown = (e: React.KeyboardEvent) => { if (shouldSubmit(e)) { onUserSubmit(); e.preventDefault(); @@ -488,7 +488,7 @@ export function Chat(props: { rows={4} onInput={(e) => onInput(e.currentTarget.value)} value={userInput} - onKeyDown={(e) => onInputKeyDown(e as any)} + onKeyDown={onInputKeyDown} onFocus={() => setAutoScroll(true)} onBlur={() => { setAutoScroll(false);