Skip to content

Commit fc59610

Browse files
committed
fix for IME composing bug (Enter should not submit)
1 parent e510f35 commit fc59610

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

frontend/app/aipanel/aipanelinput.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export const AIPanelInput = memo(({ onSubmit, status, model }: AIPanelInputProps
5252
}, [model, resizeTextarea]);
5353

5454
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
55-
if (e.key === "Enter" && !e.shiftKey) {
55+
const isComposing = e.nativeEvent?.isComposing || e.keyCode == 229;
56+
if (e.key === "Enter" && !e.shiftKey && !isComposing) {
5657
e.preventDefault();
5758
onSubmit(e as any);
5859
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)