Skip to content

Commit 937d21e

Browse files
committed
properly fix folder upload to use delegatedEvent
1 parent 864c3a8 commit 937d21e

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

apps/files/js/filelist.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,20 +2514,24 @@
25142514
var self = this;
25152515

25162516
// handle upload events
2517-
var fileUploadStart = this.$el.find('#file_upload_start');
2517+
var fileUploadStart = this.$el;
2518+
var delegatedElement = '#file_upload_start';
25182519

25192520
// detect the progress bar resize
25202521
fileUploadStart.on('resized', this._onResize);
25212522

2522-
fileUploadStart.on('fileuploaddrop', function(e, data) {
2523+
fileUploadStart.on('fileuploaddrop', delegatedElement, function(e, data) {
25232524
OC.Upload.log('filelist handle fileuploaddrop', e, data);
25242525

25252526
if (self.$el.hasClass('hidden')) {
25262527
// do not upload to invisible lists
25272528
return false;
25282529
}
25292530

2530-
var dropTarget = $(e.originalEvent.target);
2531+
console.log(e);
2532+
var dropTarget = $(e.delegatedEvent.target);
2533+
console.log(dropTarget);
2534+
25312535
// check if dropped inside this container and not another one
25322536
if (dropTarget.length
25332537
&& !self.$el.is(dropTarget) // dropped on list directly

apps/files/js/jquery.fileupload.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,11 @@
12671267
e.preventDefault();
12681268
this._getDroppedFiles(dataTransfer).always(function (files) {
12691269
data.files = files;
1270-
if (that._trigger('drop', e, data) !== false) {
1270+
if (that._trigger(
1271+
'drop',
1272+
$.Event('drop', {delegatedEvent: e}),
1273+
data
1274+
) !== false) {
12711275
that._onAdd(e, data);
12721276
}
12731277
});

0 commit comments

Comments
 (0)