mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
07aafa5fea
commit
e16251c473
1 changed files with 3 additions and 21 deletions
|
|
@ -136,6 +136,7 @@
|
||||||
|
|
||||||
const initTags = async () => {
|
const initTags = async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
await tags.set(await getAllTags(localStorage.token));
|
await tags.set(await getAllTags(localStorage.token));
|
||||||
loading = false;
|
loading = false;
|
||||||
};
|
};
|
||||||
|
|
@ -144,26 +145,6 @@
|
||||||
value = '';
|
value = '';
|
||||||
dispatch('input');
|
dispatch('input');
|
||||||
};
|
};
|
||||||
|
|
||||||
const documentClickHandler = (e) => {
|
|
||||||
const searchContainer = document.getElementById('search-container');
|
|
||||||
const chatSearch = document.getElementById('chat-search');
|
|
||||||
|
|
||||||
if (!searchContainer.contains(e.target) && !chatSearch.contains(e.target)) {
|
|
||||||
if (e.target.id.startsWith('search-tag-') || e.target.id.startsWith('search-option-')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
focused = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
document.addEventListener('click', documentClickHandler);
|
|
||||||
});
|
|
||||||
|
|
||||||
onDestroy(() => {
|
|
||||||
document.removeEventListener('click', documentClickHandler);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="px-1 mb-1 flex justify-center space-x-2 relative z-10" id="search-container">
|
<div class="px-1 mb-1 flex justify-center space-x-2 relative z-10" id="search-container">
|
||||||
|
|
@ -182,6 +163,7 @@
|
||||||
dispatch('input');
|
dispatch('input');
|
||||||
}}
|
}}
|
||||||
on:focus={() => {
|
on:focus={() => {
|
||||||
|
hovering = false;
|
||||||
focused = true;
|
focused = true;
|
||||||
initTags();
|
initTags();
|
||||||
}}
|
}}
|
||||||
|
|
@ -258,8 +240,8 @@
|
||||||
selectedIdx = null;
|
selectedIdx = null;
|
||||||
}}
|
}}
|
||||||
on:mouseleave={() => {
|
on:mouseleave={() => {
|
||||||
selectedIdx = 0;
|
|
||||||
hovering = false;
|
hovering = false;
|
||||||
|
selectedIdx = 0;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="px-2 py-2 text-xs group">
|
<div class="px-2 py-2 text-xs group">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue