mirror of
https://github.com/open-webui/open-webui
synced 2025-02-20 12:00:22 +00:00
refac: dragged overlay behaviour to only activate for files
This commit is contained in:
parent
f8bb77324d
commit
93dab86e8d
@ -184,7 +184,13 @@
|
||||
|
||||
const onDragOver = (e) => {
|
||||
e.preventDefault();
|
||||
dragged = true;
|
||||
|
||||
// Check if a file is being dragged.
|
||||
if (e.dataTransfer?.types?.includes('Files')) {
|
||||
dragged = true;
|
||||
} else {
|
||||
dragged = false;
|
||||
}
|
||||
};
|
||||
|
||||
const onDragLeave = () => {
|
||||
@ -200,8 +206,6 @@
|
||||
if (inputFiles && inputFiles.length > 0) {
|
||||
console.log(inputFiles);
|
||||
inputFilesHandler(inputFiles);
|
||||
} else {
|
||||
toast.error($i18n.t(`File not found.`));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,14 +177,8 @@
|
||||
const tagEventHandler = async (type, tagName, chatId) => {
|
||||
console.log(type, tagName, chatId);
|
||||
if (type === 'delete') {
|
||||
if (selectedTagName === tagName) {
|
||||
if ($tags.map((t) => t.name).includes(tagName)) {
|
||||
await chats.set(await getChatListByTagName(localStorage.token, tagName));
|
||||
} else {
|
||||
selectedTagName = null;
|
||||
await initChatList();
|
||||
}
|
||||
}
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatListBySearchText(localStorage.token, search));
|
||||
}
|
||||
};
|
||||
|
||||
@ -192,7 +186,13 @@
|
||||
|
||||
const onDragOver = (e) => {
|
||||
e.preventDefault();
|
||||
dragged = true;
|
||||
|
||||
// Check if a file is being dragged.
|
||||
if (e.dataTransfer?.types?.includes('Files')) {
|
||||
dragged = true;
|
||||
} else {
|
||||
dragged = false;
|
||||
}
|
||||
};
|
||||
|
||||
const onDragLeave = () => {
|
||||
@ -201,19 +201,19 @@
|
||||
|
||||
const onDrop = async (e) => {
|
||||
e.preventDefault();
|
||||
console.log(e);
|
||||
console.log(e); // Log the drop event
|
||||
|
||||
// Perform file drop check and handle it accordingly
|
||||
if (e.dataTransfer?.files) {
|
||||
const inputFiles = Array.from(e.dataTransfer?.files);
|
||||
|
||||
if (inputFiles && inputFiles.length > 0) {
|
||||
console.log(inputFiles);
|
||||
inputFilesHandler(inputFiles);
|
||||
} else {
|
||||
toast.error($i18n.t(`File not found.`));
|
||||
console.log(inputFiles); // Log the dropped files
|
||||
inputFilesHandler(inputFiles); // Handle the dropped files
|
||||
}
|
||||
}
|
||||
|
||||
dragged = false;
|
||||
dragged = false; // Reset dragged status after drop
|
||||
};
|
||||
|
||||
let touchstart;
|
||||
|
@ -90,7 +90,7 @@
|
||||
|
||||
<ShareChatModal bind:show={showShareChatModal} chatId={chat.id} />
|
||||
|
||||
<div class=" w-full pr-2 relative group">
|
||||
<div class=" w-full pr-2 relative group" draggable="true">
|
||||
{#if confirmEdit}
|
||||
<div
|
||||
class=" w-full flex justify-between rounded-xl px-3 py-2 {chat.id === $chatId || confirmEdit
|
||||
|
@ -146,7 +146,6 @@
|
||||
type: 'delete',
|
||||
name: e.detail.name
|
||||
});
|
||||
show = false;
|
||||
}}
|
||||
on:close={() => {
|
||||
show = false;
|
||||
|
Loading…
Reference in New Issue
Block a user