Merge pull request #11830 from hurxxxx/feat/chat-title-rename-enter-submit

feat: submit chat title rename with Enter, cancel with ESC
This commit is contained in:
Timothy Jaeryang Baek 2025-03-20 14:03:59 -07:00 committed by GitHub
commit 1813bb509b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -198,6 +198,19 @@
});
let showDeleteConfirm = false;
const chatTitleInputKeydownHandler = (e) => {
if (e.key === 'Enter') {
e.preventDefault();
editChatTitle(id, chatTitle);
confirmEdit = false;
chatTitle = '';
} else if (e.key === 'Escape') {
e.preventDefault();
confirmEdit = false;
chatTitle = '';
}
};
</script>
<ShareChatModal bind:show={showShareChatModal} chatId={id} />
@ -246,6 +259,7 @@
bind:value={chatTitle}
id="chat-title-input-{id}"
class=" bg-transparent w-full outline-hidden mr-10"
on:keydown={chatTitleInputKeydownHandler}
/>
</div>
{:else}