fix(web): prevent Enter key from firing during IME composition
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 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -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() {
|
||||
<i className="fa-solid fa-arrow-right text-xs" />
|
||||
</button>
|
||||
</div>
|
||||
{prompt && (
|
||||
<p className="mt-2 text-right text-xs text-clay-400">
|
||||
Enter 发送 · Shift+Enter 换行
|
||||
</p>
|
||||
)}
|
||||
</form>
|
||||
|
||||
{/* 类别选择器(居中) */}
|
||||
|
||||
Reference in New Issue
Block a user