Permalink
Browse files

Fixing 2532690 and 2532680

  • Loading branch information...
1 parent 95c7f18 commit f84692791491efe4c2ad80c7711e37f9f7382a29 @allenrabinovich committed Nov 10, 2012
Showing with 44 additions and 42 deletions.
  1. +42 −40 src/uploader/js/uploader-html5.js
  2. +2 −2 src/uploader/js/uploader-queue.js
View
82 src/uploader/js/uploader-html5.js
@@ -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;
+ }
}
},
View
4 src/uploader/js/uploader-queue.js
@@ -240,7 +240,7 @@
updatedEvent.originEvent = event;
updatedEvent.file = event.target;
- this.fire("uploadcacel", updatedEvent);
+ this.fire("uploadcancel", updatedEvent);
},
@@ -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.