Skip to content

Commit

Permalink
feat: save edited message shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
tjbck committed Apr 20, 2024
1 parent 97d68a6 commit 9451726
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Binary file modified backend/static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/lib/components/chat/Messages/UserMessage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,23 @@
e.target.style.height = '';
e.target.style.height = `${e.target.scrollHeight}px`;
}}
on:keydown={(e) => {
const isCmdOrCtrlPressed = e.metaKey || e.ctrlKey;

// Check if Enter key is pressed
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');
}
}}
/>

<div class=" mt-2 mb-1 flex justify-center space-x-2 text-sm font-medium">
<button
id="save-edit-message-button"
class="px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded-lg"
on:click={() => {
editMessageConfirmHandler();
Expand Down
Binary file modified static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9451726

Please sign in to comment.