enh: title edit should auto focus to input

This commit is contained in:
Timothy Jaeryang Baek 2025-01-20 22:44:59 -08:00
parent a863f98c53
commit 006208f9a9

View File

@ -234,6 +234,7 @@
<input <input
use:focusEdit use:focusEdit
bind:value={chatTitle} bind:value={chatTitle}
id="chat-title-input-{id}"
class=" bg-transparent w-full outline-none mr-10" class=" bg-transparent w-full outline-none mr-10"
/> />
</div> </div>
@ -362,10 +363,15 @@
archiveChatHandler={() => { archiveChatHandler={() => {
archiveChatHandler(id); archiveChatHandler(id);
}} }}
renameHandler={() => { renameHandler={async () => {
chatTitle = title; chatTitle = title;
confirmEdit = true; confirmEdit = true;
await tick();
const input = document.getElementById(`chat-title-input-${id}`);
if (input) {
input.focus();
}
}} }}
deleteHandler={() => { deleteHandler={() => {
showDeleteConfirm = true; showDeleteConfirm = true;