From e2cb28ddb9ed0f35ad802131b7a736ae09a6f3a6 Mon Sep 17 00:00:00 2001 From: yuanzonghao Date: Sat, 6 Jun 2026 22:42:03 +0800 Subject: [PATCH] fix(web): prevent Enter key from firing during IME composition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add isComposing guard to the homepage prompt textarea so CJK users no longer accidentally submit while composing. Also show a subtle "Enter 发送 · Shift+Enter 换行" hint when the input has content. Co-Authored-By: Claude Opus 4.6 --- app/page.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/page.tsx b/app/page.tsx index 10e2c58..c357472 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1610,7 +1610,11 @@ export default function HomePage() { value={prompt} onChange={(e) => setPrompt(e.target.value)} onKeyDown={(e) => { - if (e.key === "Enter" && !e.shiftKey) { + if ( + e.key === "Enter" && + !e.shiftKey && + !e.nativeEvent.isComposing + ) { e.preventDefault(); start(); } @@ -1638,6 +1642,11 @@ export default function HomePage() { + {prompt && ( +

+ Enter 发送 · Shift+Enter 换行 +

+ )} {/* 类别选择器(居中) */}