uploads: fix drag and drop to work anywhere on page.
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user