mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-02 02:12:25 +00:00
fix: honor Ctrl+Enter to Send in the channel message input (#31319)
This commit is contained in:
parent
3c47f0d7e7
commit
06bc8cb91e
1 changed files with 9 additions and 11 deletions
|
|
@ -943,19 +943,17 @@
|
|||
navigator.msMaxTouchPoints > 0
|
||||
)
|
||||
) {
|
||||
// Prevent Enter key from creating a new line
|
||||
// Uses keyCode '13' for Enter key for chinese/japanese keyboards
|
||||
if (e.keyCode === 13 && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
}
|
||||
const enterPressed =
|
||||
($settings?.ctrlEnterToSend ?? false)
|
||||
? (e.key === 'Enter' || e.keyCode === 13) && isCtrlPressed
|
||||
: (e.key === 'Enter' || e.keyCode === 13) && !e.shiftKey;
|
||||
|
||||
// Submit the content when Enter key is pressed
|
||||
if (
|
||||
(content !== '' || files.length > 0) &&
|
||||
e.keyCode === 13 &&
|
||||
!e.shiftKey
|
||||
) {
|
||||
submitHandler();
|
||||
if (enterPressed) {
|
||||
e.preventDefault();
|
||||
if (content !== '' || files.length > 0) {
|
||||
submitHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue