From f1d2340861b4f06073ee812fb1261dfe3bce2e48 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 27 Apr 2024 20:53:52 -0400 Subject: [PATCH] enhancement: disable submit via enter on mobile --- src/lib/components/chat/MessageInput.svelte | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index ba907f780..7911b0207 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -689,12 +689,13 @@ : $i18n.t('Send a Message')} bind:value={prompt} on:keypress={(e) => { - if (e.keyCode == 13 && !e.shiftKey) { - e.preventDefault(); - } - if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) { - // TODO: Only if screensize > xl - submitPrompt(prompt, user); + if (window.innerWidth > 1024) { + if (e.keyCode == 13 && !e.shiftKey) { + e.preventDefault(); + } + if (prompt !== '' && e.keyCode == 13 && !e.shiftKey) { + submitPrompt(prompt, user); + } } }} on:keydown={async (e) => {