Commit 18579931 authored by Dmitrii Metelkin's avatar Dmitrii Metelkin Committed by Aaron Wells
Browse files

Bug 1606086: upgrade dropzone.js to v.4.3.0

behatnotneeded: Can't test drag-drop files in Behat

Change-Id: I7951c70ab932f17ad30e088e526ad4fbd1930176
parent cd9247b4
......@@ -2,7 +2,7 @@ dropzonejs
-----
Website: https://github.com/enyo/dropzone
Version: 4.2.0
Version: 4.3.0
Modifications:
......
......@@ -27,9 +27,9 @@
(function() {
var Dropzone, Emitter, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
__slice = [].slice,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
noop = function() {};
......@@ -104,11 +104,11 @@
/*
This is a list of all available events you can register on a dropzone object.
You can register an event handler like this:
dropzone.on("dragEnter", function() { });
This is a list of all available events you can register on a dropzone object.
You can register an event handler like this:
dropzone.on("dragEnter", function() { });
*/
Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "addedfiles", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"];
......@@ -138,6 +138,7 @@
previewsContainer: null,
hiddenInputContainer: "body",
capture: null,
renameFilename: null,
dictDefaultMessage: "Drop files here to upload",
dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
......@@ -220,12 +221,12 @@
},
/*
Those functions register themselves to the events on init and handle all
the user interface specific stuff. Overwriting them won't break the upload
but can break the way it's displayed.
You can overwrite them if you don't like the default behavior. If you just
want to add an additional event handler, register it on the dropzone object
and don't overwrite those options.
Those functions register themselves to the events on init and handle all
the user interface specific stuff. Overwriting them won't break the upload
but can break the way it's displayed.
You can overwrite them if you don't like the default behavior. If you just
want to add an additional event handler, register it on the dropzone object
and don't overwrite those options.
*/
drop: function(e) {
return this.element.classList.remove("dz-drag-hover");
......@@ -259,7 +260,7 @@
_ref = file.previewElement.querySelectorAll("[data-dz-name]");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
node = _ref[_i];
node.textContent = file.name;
node.textContent = this._renameFilename(file.name);
}
_ref1 = file.previewElement.querySelectorAll("[data-dz-size]");
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
......@@ -720,6 +721,13 @@
}
};
Dropzone.prototype._renameFilename = function(name) {
if (typeof this.options.renameFilename !== "function") {
return name;
}
return this.options.renameFilename(name);
};
Dropzone.prototype.getFallbackForm = function() {
var existingFallback, fields, fieldsString, form;
if (existingFallback = this.getExistingFallback()) {
......@@ -921,30 +929,37 @@
};
Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
var dirReader, entriesReader;
var dirReader, errorHandler, readEntries;
dirReader = directory.createReader();
entriesReader = (function(_this) {
return function(entries) {
var entry, _i, _len;
for (_i = 0, _len = entries.length; _i < _len; _i++) {
entry = entries[_i];
if (entry.isFile) {
entry.file(function(file) {
if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
return;
errorHandler = function(error) {
return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
};
readEntries = (function(_this) {
return function() {
return dirReader.readEntries(function(entries) {
var entry, _i, _len;
if (entries.length > 0) {
for (_i = 0, _len = entries.length; _i < _len; _i++) {
entry = entries[_i];
if (entry.isFile) {
entry.file(function(file) {
if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
return;
}
file.fullPath = "" + path + "/" + file.name;
return _this.addFile(file);
});
} else if (entry.isDirectory) {
_this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
}
file.fullPath = "" + path + "/" + file.name;
return _this.addFile(file);
});
} else if (entry.isDirectory) {
_this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
}
readEntries();
}
}
return null;
}, errorHandler);
};
})(this);
return dirReader.readEntries(entriesReader, function(error) {
return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
});
return readEntries();
};
Dropzone.prototype.accept = function(file, done) {
......@@ -1362,7 +1377,7 @@
}
}
for (i = _m = 0, _ref5 = files.length - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; i = 0 <= _ref5 ? ++_m : --_m) {
formData.append(this._getParamName(i), files[i], files[i].name);
formData.append(this._getParamName(i), files[i], this._renameFilename(files[i].name));
}
return this.submitRequest(xhr, formData, files);
};
......@@ -1409,7 +1424,7 @@
})(Emitter);
Dropzone.version = "4.2.0";
Dropzone.version = "4.3.0";
Dropzone.options = {};
......@@ -1640,10 +1655,10 @@
/*
Bugfix for iOS 6 and 7
Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
based on the work of https://github.com/stomita/ios-imagefile-megapixel
Bugfix for iOS 6 and 7
Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
based on the work of https://github.com/stomita/ios-imagefile-megapixel
*/
detectVerticalSquash = function(img) {
......@@ -1749,4 +1764,4 @@
contentLoaded(window, Dropzone._autoDiscoverFunction);
}).call(this);
}).call(this);
\ No newline at end of file
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment