summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-09-14 13:44:34 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-09-14 13:44:34 +0200
commit8d4e5747f386a0899d50becb8297b4347df355db (patch)
treebca7fc1ba79383f670e25bb1261cfd8d5dcb5680 /apps/files
parentafddb138d941c26be0588b20d7b8d61524d86bf4 (diff)
downloadnextcloud-server-8d4e5747f386a0899d50becb8297b4347df355db.tar.gz
nextcloud-server-8d4e5747f386a0899d50becb8297b4347df355db.zip
Fix folder drag glitch in Firefox
issue: * drag'n'drop a folder into the files app in Firefox * the highlight stays there because Firefox doesn't trigger the drop event for folders solution: * behave like the drop event if the dragover event isn't fired for 100ms (only applied in Firefox)
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/file-upload.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index e07093dd17b..05224264c19 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -667,8 +667,23 @@ OC.Upload = {
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){
$('#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');
var filerow = $(e.delegatedEvent.target).closest('tr');
@@ -685,12 +700,7 @@ OC.Upload = {
filerow.find('.thumbnail').addClass('icon-filetype-folder-drag-accept');
}
});
- fileupload.on('fileuploaddragleave fileuploaddrop', 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');
- });
+ fileupload.on('fileuploaddragleave fileuploaddrop', disableDropState);
} else {
// for all browsers that don't support the progress bar
// IE 8 & 9