mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
hotkey switch
enter = new line shift+enter = send (imperfect solution but slightly better for mobile users)
This commit is contained in:
@@ -1204,8 +1204,18 @@
|
||||
printMessages();
|
||||
select_selected_character(this_chid);
|
||||
}
|
||||
$("#send_textarea").keypress(function (e) {
|
||||
if(e.which === 13 && !e.shiftKey && is_send_press == false) {
|
||||
|
||||
//hotkey to send input with shift+enter (normal enter keypress generates a new line in the chat input box)
|
||||
//problem for mobile: default iOS keyboard function is to make AutoCapitalization happen on new lines.
|
||||
//AutoCapitization effectively presses the virtual Shift key when it thinks a new line/sentence is happening.
|
||||
//iOS result: First Enter press will make a new line, but the second will act like shift+enter, sending the prompt to AI.
|
||||
//ideally we would detect if the user is using a virtual keyboard, and disable this shortcut for them.
|
||||
//because mobile users' hands are always near the screen, tapping the send button is better for them.
|
||||
//caveat: people on an iPad using a Bluetooth keyboard will need to be treated as PC users for this purpose.
|
||||
//note: CAI seems to have this handled. PC: shift+enter = new line, enter = send. iOS: shift+enter AND enter both make new lines, and only the send button sends.
|
||||
|
||||
$("#send_textarea").keydown(function (e) {
|
||||
if(e.which === 13 && e.shiftKey && is_send_press == false) {
|
||||
is_send_press = true;
|
||||
e.preventDefault();
|
||||
Generate();
|
||||
|
Reference in New Issue
Block a user