diff options
author | silverwind <me@silverwind.io> | 2019-07-12 23:27:36 +0200 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-07-12 22:27:36 +0100 |
commit | cc8e7dd355c9c625b895a1b633a3a7fa5016f718 (patch) | |
tree | e21673dfca3948c702afc18d5e691513a55eb443 | |
parent | f52840623c5408eadc3ccdecdd748bed96cee609 (diff) | |
download | gitea-cc8e7dd355c9c625b895a1b633a3a7fa5016f718.tar.gz gitea-cc8e7dd355c9c625b895a1b633a3a7fa5016f718.zip |
fix Dropzone.js integration (#7445) (#7448)
-rw-r--r-- | public/js/index.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/public/js/index.js b/public/js/index.js index de0536dbaa..ea51141cc7 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -10,6 +10,9 @@ function htmlEncode(text) { var csrf; 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) if (!Array.from) { Array.from = (function () { @@ -1972,13 +1975,11 @@ $(document).ready(function () { } // Dropzone - var $dropzone = $('#dropzone'); + const $dropzone = $('#dropzone'); if ($dropzone.length > 0) { - // Disable auto discover for all elements: - Dropzone.autoDiscover = false; + const filenameDict = {}; - var filenameDict = {}; - $dropzone.dropzone({ + new Dropzone("#dropzone", { url: $dropzone.data('upload-url'), headers: {"X-Csrf-Token": csrf}, maxFiles: $dropzone.data('max-file'), @@ -2006,7 +2007,7 @@ $(document).ready(function () { }); } }) - } + }, }); } |