uploads: fix drag and drop to work anywhere on page.

This commit is contained in:
evazion
2019-09-22 22:53:35 -05:00
parent bf3e9e1c76
commit cdb1c5c5ae

View File

@@ -147,9 +147,11 @@ Upload.initialize_dropzone = function() {
return;
}
let dropzone = new Dropzone("#filedropzone", {
let dropzone = new Dropzone(document.body, {
paramName: "upload[file]",
url: "/uploads/preprocess",
clickable: "#filedropzone",
previewsContainer: "#filedropzone",
thumbnailHeight: 150,
thumbnailWidth: 150,
thumbnailMethod: "contain",
@@ -162,13 +164,12 @@ Upload.initialize_dropzone = function() {
previewTemplate: $("#dropzone-preview-template").html(),
init: function() {
$(".fallback").hide();
this.on("drop", function(event) {
$("#filedropzone .dropzone-hint").hide();
});
this.on("complete", function(file) {
$("#filedropzone .dz-progress").hide();
});
this.on("addedfile", function(file) {
$("#filedropzone .dropzone-hint").hide();
// replace the previous file with the new one.
dropzone.files.forEach(f => {
if (f !== file) {