Merge pull request #1528 from nextcloud/stable10-backport-1406
[stable10] Fix folder drag glitch in Firefox
This commit is contained in:
commit
cb2da786e2
|
@ -667,8 +667,23 @@ OC.Upload = {
|
||||||
OC.Upload._hideProgressBar();
|
OC.Upload._hideProgressBar();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
var disableDropState = function() {
|
||||||
|
$('#app-content').removeClass('file-drag');
|
||||||
|
$('.dropping-to-dir').removeClass('dropping-to-dir');
|
||||||
|
$('.dir-drop').removeClass('dir-drop');
|
||||||
|
$('.icon-filetype-folder-drag-accept').removeClass('icon-filetype-folder-drag-accept');
|
||||||
|
};
|
||||||
|
var disableClassOnFirefox = _.debounce(function() {
|
||||||
|
disableDropState();
|
||||||
|
}, 100);
|
||||||
fileupload.on('fileuploaddragover', function(e){
|
fileupload.on('fileuploaddragover', function(e){
|
||||||
$('#app-content').addClass('file-drag');
|
$('#app-content').addClass('file-drag');
|
||||||
|
// dropping a folder in firefox doesn't cause a drop event
|
||||||
|
// this is simulated by simply invoke disabling all classes
|
||||||
|
// once no dragover event isn't noticed anymore
|
||||||
|
if ($.browser['mozilla']) {
|
||||||
|
disableClassOnFirefox();
|
||||||
|
}
|
||||||
$('#emptycontent .icon-folder').addClass('icon-filetype-folder-drag-accept');
|
$('#emptycontent .icon-folder').addClass('icon-filetype-folder-drag-accept');
|
||||||
|
|
||||||
var filerow = $(e.delegatedEvent.target).closest('tr');
|
var filerow = $(e.delegatedEvent.target).closest('tr');
|
||||||
|
@ -685,12 +700,7 @@ OC.Upload = {
|
||||||
filerow.find('.thumbnail').addClass('icon-filetype-folder-drag-accept');
|
filerow.find('.thumbnail').addClass('icon-filetype-folder-drag-accept');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fileupload.on('fileuploaddragleave fileuploaddrop', function (){
|
fileupload.on('fileuploaddragleave fileuploaddrop', disableDropState);
|
||||||
$('#app-content').removeClass('file-drag');
|
|
||||||
$('.dropping-to-dir').removeClass('dropping-to-dir');
|
|
||||||
$('.dir-drop').removeClass('dir-drop');
|
|
||||||
$('.icon-filetype-folder-drag-accept').removeClass('icon-filetype-folder-drag-accept');
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// for all browsers that don't support the progress bar
|
// for all browsers that don't support the progress bar
|
||||||
// IE 8 & 9
|
// IE 8 & 9
|
||||||
|
|
Loading…
Reference in New Issue