From 47d9c9fc7449136441f9113e73ad967585000202 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 17 Jun 2024 20:46:42 -0700 Subject: [PATCH] refac --- .../components/chat/Messages/ResponseMessage.svelte | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 818e53ec0..b1c91edcc 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -463,6 +463,18 @@ e.target.style.height = ''; e.target.style.height = `${e.target.scrollHeight}px`; }} + on:keydown={(e) => { + if (e.key === 'Escape') { + document.getElementById('close-edit-message-button')?.click(); + } + + const isCmdOrCtrlPressed = e.metaKey || e.ctrlKey; + const isEnterPressed = e.key === 'Enter'; + + if (isCmdOrCtrlPressed && isEnterPressed) { + document.getElementById('save-edit-message-button')?.click(); + } + }} />