Fixes #3165 - Drag&Drop from Outlook to Zammad removes message from Outlook

This commit is contained in:
Mantas 2021-02-10 15:53:18 +02:00 committed by Thorsten Eckel
parent e438b3b6f9
commit b706c86fde

View file

@ -76,18 +76,19 @@
inputField = manager.inputField, inputField = manager.inputField,
cancelContainer = manager.cancelContainer, cancelContainer = manager.cancelContainer,
inCounter = 0, inCounter = 0,
overEvent = function (e) { onDragEnter = function (e) {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
inCounter++ inCounter++
//console.log('in', inCounter, dropContainer) //console.log('in', inCounter, dropContainer)
showDropZone(dropContainer) showDropZone(dropContainer)
}; };
stopEvent = function (e) { onDragOver = function (e) {
e.dataTransfer.dropEffect = 'copy';
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
}; };
leaveEvent = function (e) { onDragLeave = function (e) {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
inCounter-- inCounter--
@ -96,6 +97,12 @@
hideDropZone(dropContainer) hideDropZone(dropContainer)
} }
}; };
onDrop = function (e) {
inCounter = 0
onDragEnter(e);
hideDropZone(dropContainer)
manager.processFiles(e.dataTransfer.files)
};
showDropZone = function(dropContainer) { showDropZone = function(dropContainer) {
$(dropContainer).trigger('html5Upload.dropZone.show') $(dropContainer).trigger('html5Upload.dropZone.show')
@ -112,15 +119,10 @@
} }
if (dropContainer) { if (dropContainer) {
manager.on(dropContainer, 'dragleave', leaveEvent) manager.on(dropContainer, 'dragleave', onDragLeave)
manager.on(dropContainer, 'dragover', stopEvent) manager.on(dropContainer, 'dragover', onDragOver)
manager.on(dropContainer, 'dragenter', overEvent) manager.on(dropContainer, 'dragenter', onDragEnter)
manager.on(dropContainer, 'drop', function (e) { manager.on(dropContainer, 'drop', onDrop)
inCounter = 0
stopEvent(e);
hideDropZone(dropContainer)
manager.processFiles(e.dataTransfer.files)
});
} }
if (inputField) { if (inputField) {