From e11c87aba6f8a148b1bff0e8a367e5f043fc0f65 Mon Sep 17 00:00:00 2001 From: Brent Vardy Date: Thu, 12 Dec 2019 15:59:00 +0000 Subject: [PATCH] WIP - co-authored-by: mattwr18 --- .../ContributionForm/ContributionForm.vue | 1 + webapp/components/TeaserImage/TeaserImage.vue | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index ec9fe9616..2be7257cd 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -198,6 +198,7 @@ export default { imageAspectRatio, categoryIds, } = this.form + console.log(teaserImage) this.loading = true this.$apollo .mutate({ diff --git a/webapp/components/TeaserImage/TeaserImage.vue b/webapp/components/TeaserImage/TeaserImage.vue index 95d94d70f..2055ae8b1 100644 --- a/webapp/components/TeaserImage/TeaserImage.vue +++ b/webapp/components/TeaserImage/TeaserImage.vue @@ -85,6 +85,16 @@ export default { }, transformImage(file) { this.file = file + this.thumbnailElement = document.querySelectorAll('#postdropzone')[0] + if (this.file.type === 'image/svg+xml') { + console.log(this.file) + this.image = new Image() + this.image.src = this.file.dataURL + this.image.classList.add('thumbnail-preview') + this.thumbnailElement.appendChild(this.image) + this.$emit('addTeaserImage', this.file) + return + } this.showCropper = true this.initEditor() this.initCropper() @@ -95,7 +105,7 @@ export default { this.thumbnailElement.appendChild(this.editor) }, clearImages() { - this.thumbnailElement = document.querySelectorAll('#postdropzone')[0] + //this.thumbnailElement = document.querySelectorAll('#postdropzone')[0] const thumbnailPreview = document.querySelectorAll('.thumbnail-preview')[0] if (thumbnailPreview) thumbnailPreview.remove() const contributionImage = document.querySelectorAll('.contribution-image')[0] @@ -118,7 +128,7 @@ export default { const croppedImageFile = new File([blob], this.file.name, { type: this.file.type }) this.$emit('addTeaserImage', croppedImageFile) this.$emit('addImageAspectRatio', imageAspectRatio) - }, 'image/jpeg') + }, this.file.type) }, setupPreview(canvas) { this.image = new Image()