Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove no longer needed special handling for Firefox
The highlighting was removed in Firefox when the cursor was no longer
moving to handle the behaviour of reporting a file drag and then
providing no files in the drop event. That behaviour (which was only
present in Firefox 48 and 49) is already handled with the "dropnofiles"
callback, so that special handling is no longer needed.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Jun 12, 2018
commit d4143af5ed6db33de2daf24159656d577ccf5258
23 changes: 8 additions & 15 deletions apps/files/js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -1131,23 +1131,8 @@ OC.Uploader.prototype = _.extend({
self.log('progress handle fileuploadfail', e, data);
self.trigger('fail', e, data);
});
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 (/Firefox/i.test(navigator.userAgent)) {
disableClassOnFirefox();
}
$('#emptycontent .icon-folder').addClass('icon-filetype-folder-drag-accept');

var filerow = $(e.delegatedEvent.target).closest('tr');
Expand All @@ -1164,6 +1149,14 @@ OC.Uploader.prototype = _.extend({
filerow.find('.thumbnail').addClass('icon-filetype-folder-drag-accept');
}
});

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');
};

fileupload.on('fileuploaddragleave fileuploaddrop', disableDropState);

// In some browsers the "drop" event can be triggered with no
Expand Down