-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add Ctrl+Enter / Cmd+Enter as send shortcut #698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -352,7 +352,8 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>( | |
| } | ||
| } | ||
|
|
||
| if (e.key === "Enter" && !e.shiftKey) { | ||
| // Send: plain Enter (without Shift) or Ctrl/Cmd+Enter | ||
| if (e.key === "Enter" && (!e.shiftKey || e.ctrlKey || e.metaKey)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new condition Also note: the original A missing test case |
||
| e.preventDefault(); | ||
| handleSend(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shift+Ctrl+Enteris missing. With the new condition this combo now submits (becausectrlKeyshort-circuits!shiftKey), but the PR description says Shift+Enter should always produce a newline. Adding this case would immediately surface the regression.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!