Skip to content

Commit 6ff2f7f

Browse files
committed
Update drag listeners (:global-drop-zone="false")
1 parent 9bbe869 commit 6ff2f7f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

demo/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- just for tests -->
33
<video src="#" style="background-color: aqua"> TEST </video>
44

5-
<FileInput :state="state" :global-drop-zone="true">
5+
<FileInput :state="state" :global-drop-zone="false">
66
<!-- <FileInputSelectedInfo :state="state"/>-->
77
</FileInput>
88

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alttiri/vue-file-input",
3-
"version": "1.5.0-20240819",
3+
"version": "1.5.1-20240819",
44
"type": "module",
55
"description": "Vue.js file input with Drag and Drop support.",
66
"homepage": "https://github.com/alttiri/vue-file-input",

src/components/FileInput.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function onDragOver(event: DragEvent) {
117117
}
118118
function onDragEnter(event: DragEvent) {
119119
stopEvent(event);
120-
if (event.relatedTarget !== null) {
120+
if (globalDropZone.value && event.relatedTarget !== null) {
121121
return;
122122
}
123123
if (!dropHover.value) {
@@ -129,7 +129,11 @@ function onDragEnter(event: DragEvent) {
129129
}
130130
function onDragLeave(event: DragEvent) {
131131
stopEvent(event);
132-
if (event.relatedTarget !== null) {
132+
if (globalDropZone.value) {
133+
if (event.relatedTarget !== null) {
134+
return;
135+
}
136+
} else if (dropHover.value && dropZone.value?.contains(event.relatedTarget as Node)) {
133137
return;
134138
}
135139
dropHover.value = false;

0 commit comments

Comments
 (0)