From f5aae2958248e33ceeeaad2e7f9312b6596f5381 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Fri, 23 Dec 2022 13:38:31 -0800 Subject: [PATCH] Only send message when enter is pressed with ctrl/cmd --- src/App.svelte | 8 +++++++- src/partials/Note.svelte | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 57ca56f8..935c3475 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -112,7 +112,13 @@ }) - e.key === 'Escape' && modal.set(null)} /> + { + if (e.key === 'Escape') { + modal.set(null) + menuIsOpen.set(false) + } + }} />
diff --git a/src/partials/Note.svelte b/src/partials/Note.svelte index b10abd46..5710d513 100644 --- a/src/partials/Note.svelte +++ b/src/partials/Note.svelte @@ -91,8 +91,8 @@ } } - const onReplyKeyPress = e => { - if (e.key === 'Enter' && !e.shiftKey) { + const onReplyKeyDown = e => { + if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault() sendReply() } @@ -170,7 +170,7 @@ autofocus placeholder="Type something..." bind:value={reply} - on:keypress={onReplyKeyPress} + on:keydown={onReplyKeyDown} class="w-full p-2 text-white bg-medium placeholder:text-light outline-0 resize-none" />