From: Dan Brown Date: Sat, 24 Mar 2018 14:54:50 +0000 (+0000) Subject: Merge branch 'bug/gif-image-740' of git://github.com/Abijeet/BookStack X-Git-Tag: v0.20.1~1^2~8 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/5ad9c5d3193180075d85b9cfd447da5a21deb85c?ds=inline;hp=-c Merge branch 'bug/gif-image-740' of git://github.com/Abijeet/BookStack Also removed console.logs in dropzone.js --- 5ad9c5d3193180075d85b9cfd447da5a21deb85c diff --combined resources/assets/js/vues/components/dropzone.js index 65717b86b,3e6e6c730..0e40b20ca --- a/resources/assets/js/vues/components/dropzone.js +++ b/resources/assets/js/vues/components/dropzone.js @@@ -12,9 -12,7 +12,9 @@@ const props = ['placeholder', 'uploadUr 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() { return _this.uploadUrl; }, @@@ -37,33 -35,26 +37,33 @@@ dz.on('error', function (file, errorMessage, xhr) { _this.$emit('error', {file, errorMessage, xhr}); -- console.log(errorMessage); -- console.log(xhr); ++ function setMessage(message) { $(file.previewElement).find('[data-dz-errormessage]').text(message); } - if (xhr.status === 413) setMessage(trans('errors.server_upload_limit')); + if (xhr && xhr.status === 413) setMessage(trans('errors.server_upload_limit')); - if (errorMessage.file) setMessage(errorMessage.file[0]); + else if (errorMessage.file) setMessage(errorMessage.file); ++ }); } }); } function data() { - return {} + return {}; } +const methods = { + onClose: function () { + this._dz.removeAllFiles(true); + } +}; + module.exports = { template, props, mounted, data, -}; + methods +};