mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°3670 Fix drag and drop glitching in Chrome
This commit is contained in:
@@ -264,6 +264,11 @@ abstract class AbstractAttachmentsRenderer
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('drag dragstart dragend dragover dragenter dragleave drop', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
})
|
||||||
|
|
||||||
$(document).bind('dragover', function (e) {
|
$(document).bind('dragover', function (e) {
|
||||||
var bFiles = false;
|
var bFiles = false;
|
||||||
if (e.dataTransfer && e.dataTransfer.types)
|
if (e.dataTransfer && e.dataTransfer.types)
|
||||||
@@ -297,11 +302,20 @@ abstract class AbstractAttachmentsRenderer
|
|||||||
window.dropZone.addClass('ibo-drag-in');
|
window.dropZone.addClass('ibo-drag-in');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).bind('dragleave dragend drop', function(){
|
// Counter used to fix chrome firing dragenter/dragleave on each $(document) child it encounter
|
||||||
if(window.dropZone){
|
window.dropZoneCnt = 0;
|
||||||
|
|
||||||
|
$(document).on('dragenter', function(ev) {
|
||||||
|
ev.preventDefault(); // needed for IE
|
||||||
|
window.dropZoneCnt++;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).bind('dragend dragleave drop', function(event){
|
||||||
|
window.dropZoneCnt--;
|
||||||
|
if(window.dropZone && window.dropZoneCnt === 0){
|
||||||
window.dropZone.removeClass('ibo-drag-in');
|
window.dropZone.removeClass('ibo-drag-in');
|
||||||
}
|
|
||||||
window.dropZone = null;
|
window.dropZone = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// check if the attachments are used by inline images
|
// check if the attachments are used by inline images
|
||||||
|
|||||||
Reference in New Issue
Block a user