Fixes #3460 - Drop files here drag area not always hidden

This commit is contained in:
Romit Choudhary 2021-07-28 15:59:53 +02:00 committed by Thorsten Eckel
parent 520d834c1c
commit cfa3f27dc4
2 changed files with 12 additions and 4 deletions

View file

@ -102,11 +102,16 @@
} }
}; };
onDrop = function (e) { onDrop = function (e) {
inCounter = 0 e.preventDefault()
onDragEnter(e); e.stopPropagation()
hideDropZone(dropContainer)
manager.processFiles(e.dataTransfer.files) manager.processFiles(e.dataTransfer.files)
}; };
onDragEnd = function (e) {
inCounter = 0
e.preventDefault()
e.stopPropagation()
hideDropZone(dropContainer)
};
showDropZone = function(dropContainer) { showDropZone = function(dropContainer) {
$(dropContainer).trigger('html5Upload.dropZone.show') $(dropContainer).trigger('html5Upload.dropZone.show')
@ -126,6 +131,7 @@
manager.on(dropContainer, 'dragleave', onDragLeave) manager.on(dropContainer, 'dragleave', onDragLeave)
manager.on(dropContainer, 'dragover', onDragOver) manager.on(dropContainer, 'dragover', onDragOver)
manager.on(dropContainer, 'dragenter', onDragEnter) manager.on(dropContainer, 'dragenter', onDragEnter)
manager.on(dropContainer, 'dragend', onDragEnd)
manager.on(dropContainer, 'drop', onDrop) manager.on(dropContainer, 'drop', onDrop)
} }

View file

@ -432,6 +432,8 @@
y = e.clientY y = e.clientY
var file = dataTransfer.files[0] var file = dataTransfer.files[0]
if(!file) return;
// look for images // look for images
if (file.type.match('image.*')) { if (file.type.match('image.*')) {
var reader = new FileReader() var reader = new FileReader()
@ -610,4 +612,4 @@
return plugin.value() return plugin.value()
} }
}(jQuery)); }(jQuery));