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