mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Fix file drop, again (#504)
This commit is contained in:
@@ -143,11 +143,16 @@ export default defineComponent({
|
||||
let dragNotificationID: string;
|
||||
let fileUploadNotificationID: string;
|
||||
|
||||
let dragCounter = 0;
|
||||
|
||||
return { onDragEnter, onDragOver, onDragLeave, onDrop, showDropEffect };
|
||||
|
||||
function onDragEnter(event: DragEvent) {
|
||||
event.preventDefault();
|
||||
dragCounter++;
|
||||
|
||||
if (
|
||||
dragCounter === 1 &&
|
||||
event.dataTransfer?.types.indexOf('Files') !== -1 &&
|
||||
showDropEffect.value === false
|
||||
) {
|
||||
@@ -169,10 +174,14 @@ export default defineComponent({
|
||||
|
||||
function onDragLeave(event: DragEvent) {
|
||||
event.preventDefault();
|
||||
showDropEffect.value = false;
|
||||
dragCounter--;
|
||||
|
||||
if (dragNotificationID) {
|
||||
notificationsStore.remove(dragNotificationID);
|
||||
if (dragCounter === 0) {
|
||||
showDropEffect.value = false;
|
||||
|
||||
if (dragNotificationID) {
|
||||
notificationsStore.remove(dragNotificationID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +189,8 @@ export default defineComponent({
|
||||
event.preventDefault();
|
||||
showDropEffect.value = false;
|
||||
|
||||
dragCounter = 0;
|
||||
|
||||
if (!event.dataTransfer) return;
|
||||
if (event.dataTransfer?.types.indexOf('Files') === -1) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user