mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac
This commit is contained in:
parent
9d87688ecc
commit
11efb982c1
1 changed files with 10 additions and 30 deletions
|
|
@ -213,11 +213,16 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClickOutside = (event) => {
|
const onClickOutside = (event) => {
|
||||||
if (confirmEdit && !event.target.closest(`#chat-title-input-${id}`)) {
|
if (!itemElement.contains(event.target)) {
|
||||||
|
if (confirmEdit) {
|
||||||
|
if (chatTitle !== title) {
|
||||||
|
editChatTitle(id, chatTitle);
|
||||||
|
}
|
||||||
|
|
||||||
confirmEdit = false;
|
confirmEdit = false;
|
||||||
ignoreBlur = false;
|
|
||||||
chatTitle = '';
|
chatTitle = '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
|
@ -365,16 +370,6 @@
|
||||||
disabled={generating}
|
disabled={generating}
|
||||||
on:keydown={chatTitleInputKeydownHandler}
|
on:keydown={chatTitleInputKeydownHandler}
|
||||||
on:blur={async (e) => {
|
on:blur={async (e) => {
|
||||||
// check if target is generate button
|
|
||||||
if (ignoreBlur) {
|
|
||||||
ignoreBlur = false;
|
|
||||||
|
|
||||||
if (e.relatedTarget?.id === 'generate-title-button') {
|
|
||||||
generateTitleHandler();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doubleClicked) {
|
if (doubleClicked) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
@ -388,13 +383,6 @@
|
||||||
doubleClicked = false;
|
doubleClicked = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatTitle !== title) {
|
|
||||||
editChatTitle(id, chatTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
confirmEdit = false;
|
|
||||||
chatTitle = '';
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -473,16 +461,8 @@
|
||||||
class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed"
|
class=" self-center dark:hover:text-white transition disabled:cursor-not-allowed"
|
||||||
id="generate-title-button"
|
id="generate-title-button"
|
||||||
disabled={generating}
|
disabled={generating}
|
||||||
on:mouseenter={() => {
|
on:click={() => {
|
||||||
ignoreBlur = true;
|
|
||||||
}}
|
|
||||||
on:click={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
generateTitleHandler();
|
generateTitleHandler();
|
||||||
ignoreBlur = false;
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Sparkles strokeWidth="2" />
|
<Sparkles strokeWidth="2" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue