mirror of
https://github.com/open-webui/open-webui
synced 2024-11-21 23:57:51 +00:00
fix: file drop
This commit is contained in:
parent
0faa39ace9
commit
ecf21de28f
@ -236,11 +236,7 @@
|
||||
dragged = false;
|
||||
};
|
||||
|
||||
let dropzoneElement;
|
||||
|
||||
onMount(async () => {
|
||||
console.log('hi');
|
||||
|
||||
if (!$tools) {
|
||||
await tools.set(await getTools(localStorage.token));
|
||||
}
|
||||
@ -254,17 +250,21 @@
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
|
||||
if (dropzoneElement) {
|
||||
dropzoneElement?.addEventListener('dragover', onDragOver);
|
||||
dropzoneElement?.addEventListener('drop', onDrop);
|
||||
dropzoneElement?.addEventListener('dragleave', onDragLeave);
|
||||
}
|
||||
await tick();
|
||||
|
||||
const dropzoneElement = document.getElementById('chat-container');
|
||||
|
||||
dropzoneElement?.addEventListener('dragover', onDragOver);
|
||||
dropzoneElement?.addEventListener('drop', onDrop);
|
||||
dropzoneElement?.addEventListener('dragleave', onDragLeave);
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('destroy');
|
||||
window.removeEventListener('keydown', handleKeyDown);
|
||||
|
||||
const dropzoneElement = document.getElementById('chat-container');
|
||||
|
||||
if (dropzoneElement) {
|
||||
dropzoneElement?.removeEventListener('dragover', onDragOver);
|
||||
dropzoneElement?.removeEventListener('drop', onDrop);
|
||||
@ -273,10 +273,6 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="absolute top-0 bottom-0 left-0 right-0 w-full h-full touch-none pointer-events-none"
|
||||
bind:this={dropzoneElement}
|
||||
></div>
|
||||
<FilesOverlay show={dragged} />
|
||||
|
||||
{#if loaded}
|
||||
|
@ -89,7 +89,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
{#key mounted}
|
||||
{#if mounted}
|
||||
<div class="m-auto w-full max-w-6xl px-2 xl:px-20 translate-y-6 py-24 text-center">
|
||||
{#if $temporaryChatEnabled}
|
||||
<Tooltip
|
||||
@ -227,4 +227,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/key}
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user