diff --git a/public/index.html b/public/index.html index 655ad3099..87f031e3a 100644 --- a/public/index.html +++ b/public/index.html @@ -1204,10 +1204,20 @@ printMessages(); select_selected_character(this_chid); } - $("#send_textarea").keypress(function (e) { - if(e.which === 13 && !e.shiftKey && is_send_press == false) { - is_send_press = true; - e.preventDefault(); + + //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(); //$(this).closest("form").submit(); }