]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/vues/components/dropzone.js
Removing the selected image and clearing the dropdzone on dialog close.
[bookstack] / resources / assets / js / vues / components / dropzone.js
index e0a6d8b9d138fc5b3f8fe2d6741a6b44575c0119..65717b86b00f0156b64c607bf293740ac1d62014 100644 (file)
@@ -12,7 +12,7 @@ const props = ['placeholder', 'uploadUrl', 'uploadedTo'];
 function mounted() {
    let container = this.$el;
    let _this = this;
-   new DropZone(container, {
+   this._dz = new DropZone(container, {
        addRemoveLinks: true,
        dictRemoveFile: trans('components.image_upload_remove'),
         url: function() {
@@ -51,12 +51,19 @@ function mounted() {
 }
 
 function data() {
-    return {}
+    return {};
 }
 
+const methods = {
+    onClose: function () {
+        this._dz.removeAllFiles(true);
+    }
+};
+
 module.exports = {
     template,
     props,
     mounted,
     data,
+    methods
 };