mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
a20a920ca4
commit
aa374823ce
@ -66,7 +66,6 @@
|
|||||||
|
|
||||||
let showShareChatModal = false;
|
let showShareChatModal = false;
|
||||||
let confirmEdit = false;
|
let confirmEdit = false;
|
||||||
let editInputFocused = false;
|
|
||||||
|
|
||||||
let chatTitle = title;
|
let chatTitle = title;
|
||||||
|
|
||||||
@ -137,6 +136,7 @@
|
|||||||
|
|
||||||
let itemElement;
|
let itemElement;
|
||||||
|
|
||||||
|
let doubleClicked = false;
|
||||||
let dragged = false;
|
let dragged = false;
|
||||||
let x = 0;
|
let x = 0;
|
||||||
let y = 0;
|
let y = 0;
|
||||||
@ -212,19 +212,17 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const focusEditInput = async () => {
|
const renameHandler = async () => {
|
||||||
console.log('focusEditInput');
|
chatTitle = title;
|
||||||
|
confirmEdit = true;
|
||||||
|
|
||||||
await tick();
|
await tick();
|
||||||
|
|
||||||
const input = document.getElementById(`chat-title-input-${id}`);
|
setTimeout(() => {
|
||||||
if (input) {
|
const input = document.getElementById(`chat-title-input-${id}`);
|
||||||
input.focus();
|
if (input) input.focus();
|
||||||
}
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
$: if (confirmEdit) {
|
|
||||||
focusEditInput();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ShareChatModal bind:show={showShareChatModal} chatId={id} />
|
<ShareChatModal bind:show={showShareChatModal} chatId={id} />
|
||||||
@ -273,18 +271,27 @@
|
|||||||
bind:value={chatTitle}
|
bind:value={chatTitle}
|
||||||
class=" bg-transparent w-full outline-hidden mr-10"
|
class=" bg-transparent w-full outline-hidden mr-10"
|
||||||
on:keydown={chatTitleInputKeydownHandler}
|
on:keydown={chatTitleInputKeydownHandler}
|
||||||
on:focus={() => {
|
on:blur={async (e) => {
|
||||||
editInputFocused = true;
|
if (doubleClicked) {
|
||||||
}}
|
e.preventDefault();
|
||||||
on:blur={() => {
|
e.stopPropagation();
|
||||||
if (editInputFocused) {
|
|
||||||
if (chatTitle !== title) {
|
|
||||||
editChatTitle(id, chatTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
confirmEdit = false;
|
await tick();
|
||||||
chatTitle = '';
|
setTimeout(() => {
|
||||||
|
const input = document.getElementById(`chat-title-input-${id}`);
|
||||||
|
if (input) input.focus();
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
doubleClicked = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chatTitle !== title) {
|
||||||
|
editChatTitle(id, chatTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
confirmEdit = false;
|
||||||
|
chatTitle = '';
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -304,9 +311,12 @@
|
|||||||
showSidebar.set(false);
|
showSidebar.set(false);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
on:dblclick={() => {
|
on:dblclick={async (e) => {
|
||||||
chatTitle = title;
|
e.preventDefault();
|
||||||
confirmEdit = true;
|
e.stopPropagation();
|
||||||
|
|
||||||
|
doubleClicked = true;
|
||||||
|
renameHandler();
|
||||||
}}
|
}}
|
||||||
on:mouseenter={(e) => {
|
on:mouseenter={(e) => {
|
||||||
mouseOver = true;
|
mouseOver = true;
|
||||||
@ -394,16 +404,7 @@
|
|||||||
archiveChatHandler={() => {
|
archiveChatHandler={() => {
|
||||||
archiveChatHandler(id);
|
archiveChatHandler(id);
|
||||||
}}
|
}}
|
||||||
renameHandler={async () => {
|
{renameHandler}
|
||||||
chatTitle = title;
|
|
||||||
confirmEdit = true;
|
|
||||||
|
|
||||||
await tick();
|
|
||||||
const input = document.getElementById(`chat-title-input-${id}`);
|
|
||||||
if (input) {
|
|
||||||
input.focus();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
deleteHandler={() => {
|
deleteHandler={() => {
|
||||||
showDeleteConfirm = true;
|
showDeleteConfirm = true;
|
||||||
}}
|
}}
|
||||||
|
Loading…
Reference in New Issue
Block a user