fix Dropzone.js integration (#7445) (#7448)

This commit is contained in:
silverwind 2019-07-12 23:27:36 +02:00 committed by zeripath
parent f52840623c
commit cc8e7dd355

View file

@ -10,6 +10,9 @@ function htmlEncode(text) {
var csrf; var csrf;
var suburl; var suburl;
// Disable Dropzone auto-discover because it's manually initialized
Dropzone.autoDiscover = false;
// Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) // Polyfill for IE9+ support (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)
if (!Array.from) { if (!Array.from) {
Array.from = (function () { Array.from = (function () {
@ -1972,13 +1975,11 @@ $(document).ready(function () {
} }
// Dropzone // Dropzone
var $dropzone = $('#dropzone'); const $dropzone = $('#dropzone');
if ($dropzone.length > 0) { if ($dropzone.length > 0) {
// Disable auto discover for all elements: const filenameDict = {};
Dropzone.autoDiscover = false;
var filenameDict = {}; new Dropzone("#dropzone", {
$dropzone.dropzone({
url: $dropzone.data('upload-url'), url: $dropzone.data('upload-url'),
headers: {"X-Csrf-Token": csrf}, headers: {"X-Csrf-Token": csrf},
maxFiles: $dropzone.data('max-file'), maxFiles: $dropzone.data('max-file'),
@ -2006,7 +2007,7 @@ $(document).ready(function () {
}); });
} }
}) })
} },
}); });
} }