logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: a9830ff4913a56a3ff097505a4e65bb61117b4d5
parent 9a6363431d8f17cc1ee027eb498181d157fefdb7
Author: Henry Jameson <me@hjkos.com>
Date:   Thu,  3 Feb 2022 22:50:32 +0200

support width/height img attributes

Diffstat:

Msrc/components/still-image/still-image.js11++++++++++-
Msrc/components/still-image/still-image.vue1+
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/components/still-image/still-image.js b/src/components/still-image/still-image.js @@ -5,7 +5,9 @@ const StillImage = { 'mimetype', 'imageLoadError', 'imageLoadHandler', - 'alt' + 'alt', + 'height', + 'width' ], data () { return { @@ -15,6 +17,13 @@ const StillImage = { computed: { animated () { return this.stopGifs && (this.mimetype === 'image/gif' || this.src.endsWith('.gif')) + }, + style () { + const appendPx = (str) => /\d$/.test(str) ? str + 'px' : str + return { + height: this.height ? appendPx(this.height) : null, + width: this.width ? appendPx(this.width) : null + } } }, methods: { diff --git a/src/components/still-image/still-image.vue b/src/components/still-image/still-image.vue @@ -2,6 +2,7 @@ <div class="still-image" :class="{ animated: animated }" + :style="style" > <canvas v-if="animated"