Skip to content

Commit

Permalink
Fixing 2532690 and 2532680
Browse files Browse the repository at this point in the history
  • Loading branch information
allenrabinovich committed Nov 10, 2012
1 parent 95c7f18 commit f846927
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
82 changes: 42 additions & 40 deletions src/uploader/js/uploader-html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,46 +342,48 @@ Y.UploaderHTML5 = Y.extend( UploaderHTML5, Y.Widget, {

event.stopPropagation();
event.preventDefault();

switch (event.type) {
case "dragenter":
this.fire("dragenter");
break;
case "dragover":
this.fire("dragover");
break;
case "dragleave":
this.fire("dragleave");
break;
case "drop":

var newfiles = event._event.dataTransfer.files,
parsedFiles = [],
filterFunc = this.get("fileFilterFunction");

if (filterFunc) {
Y.each(newfiles, function (value) {
var newfile = new Y.FileHTML5(value);
if (filterFunc(newfile)) {
parsedFiles.push(newfile);
}
});
}
else {
Y.each(newfiles, function (value) {
parsedFiles.push(new Y.FileHTML5(value));
});
}

if (parsedFiles.length > 0) {
var oldfiles = this.get("fileList");
this.set("fileList",
this.get("appendNewFiles") ? oldfiles.concat(parsedFiles) : parsedFiles);
this.fire("fileselect", {fileList: parsedFiles});
}

this.fire("drop");
break;

if (Y.Array.indexOf(event._event.dataTransfer.types, 'Files') > -1) {
switch (event.type) {
case "dragenter":
this.fire("dragenter");
break;
case "dragover":
this.fire("dragover");
break;
case "dragleave":
this.fire("dragleave");
break;
case "drop":

var newfiles = event._event.dataTransfer.files,
parsedFiles = [],
filterFunc = this.get("fileFilterFunction");

if (filterFunc) {
Y.each(newfiles, function (value) {
var newfile = new Y.FileHTML5(value);
if (filterFunc(newfile)) {
parsedFiles.push(newfile);
}
});
}
else {
Y.each(newfiles, function (value) {
parsedFiles.push(new Y.FileHTML5(value));
});
}

if (parsedFiles.length > 0) {
var oldfiles = this.get("fileList");
this.set("fileList",
this.get("appendNewFiles") ? oldfiles.concat(parsedFiles) : parsedFiles);
this.fire("fileselect", {fileList: parsedFiles});
}

this.fire("drop");
break;
}
}
},

Expand Down
4 changes: 2 additions & 2 deletions src/uploader/js/uploader-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
updatedEvent.originEvent = event;
updatedEvent.file = event.target;

this.fire("uploadcacel", updatedEvent);
this.fire("uploadcancel", updatedEvent);
},


Expand Down Expand Up @@ -648,4 +648,4 @@


Y.namespace('Uploader');
Y.Uploader.Queue = UploaderQueue;
Y.Uploader.Queue = UploaderQueue;

0 comments on commit f846927

Please sign in to comment.