mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 19:37:47 +01:00
refac
This commit is contained in:
@@ -213,10 +213,15 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onClickOutside = (event) => {
|
const onClickOutside = (event) => {
|
||||||
if (confirmEdit && !event.target.closest(`#chat-title-input-${id}`)) {
|
if (!itemElement.contains(event.target)) {
|
||||||
confirmEdit = false;
|
if (confirmEdit) {
|
||||||
ignoreBlur = false;
|
if (chatTitle !== title) {
|
||||||
chatTitle = '';
|
editChatTitle(id, chatTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
confirmEdit = false;
|
||||||
|
chatTitle = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -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" />
|
||||||
|
|||||||
Reference in New Issue
Block a user