From da6a6dfcc5132f41d6e47ccafc3b0b40ea0ca557 Mon Sep 17 00:00:00 2001 From: trendschau Date: Mon, 13 Jun 2022 22:47:00 +0200 Subject: [PATCH] Version 1.5.3.3: Fix error image size in blox editor --- system/Controllers/ControllerAuthorMediaApi.php | 2 +- system/author/js/vue-blox.js | 17 ++++++++++++++++- system/author/layouts/layout.twig | 4 ++-- system/author/layouts/layoutBlox.twig | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/system/Controllers/ControllerAuthorMediaApi.php b/system/Controllers/ControllerAuthorMediaApi.php index 3ef8590..c4fdc4c 100644 --- a/system/Controllers/ControllerAuthorMediaApi.php +++ b/system/Controllers/ControllerAuthorMediaApi.php @@ -205,7 +205,7 @@ class ControllerAuthorMediaApi extends ControllerAuthor } # publish image directly, used for example by image field for meta-tabs - if($this->params['publish']) + if(isset($this->params['publish']) && $this->params['publish']) { $imageProcessor->publishImage(); } diff --git a/system/author/js/vue-blox.js b/system/author/js/vue-blox.js index 322c607..47f2ff9 100644 --- a/system/author/js/vue-blox.js +++ b/system/author/js/vue-blox.js @@ -1591,6 +1591,7 @@ const imageComponent = Vue.component('image-component', { originalwidth: 0, originalheight: 0, imgloading: 'lazy', + imagestandardwidth: 820, imgattr: '', imgfile: '', showresize: true, @@ -1598,6 +1599,11 @@ const imageComponent = Vue.component('image-component', { } }, mounted: function(){ + + if(this.isInt(imagestandardwidth)) + { + this.imagestandardwidth = imagestandardwidth; + } this.$refs.markdown.focus(); @@ -1701,6 +1707,11 @@ const imageComponent = Vue.component('image-component', { } }, methods: { + isInt: function(value) { + return !isNaN(value) && + parseInt(Number(value)) == value && + !isNaN(parseInt(value, 10)); + }, createmarkdown: function() { if(this.imgpreview) @@ -1718,6 +1729,11 @@ const imageComponent = Vue.component('image-component', { self.calculatewidth(); self.calculateheight(); + if(self.imgwidth > self.imagestandardwidth) + { + self.imgwidth = self.imagestandardwidth; + self.calculateheight(); + } self.createmarkdownimageloaded(); } } @@ -1896,7 +1912,6 @@ const imageComponent = Vue.component('image-component', { } else { - console.info(imgmarkdown); publishController.errors.message = false; this.$parent.activatePage(); this.$emit('updatedMarkdown', imgmarkdown); diff --git a/system/author/layouts/layout.twig b/system/author/layouts/layout.twig index a1910b2..d08dfb9 100644 --- a/system/author/layouts/layout.twig +++ b/system/author/layouts/layout.twig @@ -47,8 +47,8 @@ diff --git a/system/author/layouts/layoutBlox.twig b/system/author/layouts/layoutBlox.twig index 3ebdf62..3c0aa42 100644 --- a/system/author/layouts/layoutBlox.twig +++ b/system/author/layouts/layoutBlox.twig @@ -58,6 +58,7 @@