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