diff --git a/src/lib/components/chat/Messages/UserMessage.svelte b/src/lib/components/chat/Messages/UserMessage.svelte index b4eb193fe..4f5e97848 100644 --- a/src/lib/components/chat/Messages/UserMessage.svelte +++ b/src/lib/components/chat/Messages/UserMessage.svelte @@ -177,15 +177,15 @@ e.target.style.height = `${e.target.scrollHeight}px`; }} on:keydown={(e) => { - const isCmdOrCtrlPressed = e.metaKey || e.ctrlKey; + if (e.key === 'Escape') { + document.getElementById('close-edit-message-button')?.click(); + } - // Check if Enter key is pressed + const isCmdOrCtrlPressed = e.metaKey || e.ctrlKey; const isEnterPressed = e.key === 'Enter'; - // Check if both Cmd/Ctrl and Enter are pressed simultaneously if (isCmdOrCtrlPressed && isEnterPressed) { document.getElementById('save-edit-message-button')?.click(); - console.log('Cmd/Ctrl + Enter is pressed'); } }} /> @@ -202,6 +202,7 @@