Fix Pleroma compability issue (#829)

* Now image and video modals width and height will fallback to "auto" instead of 300x200. Allows proper image visualization in modals when there's no attachment metadata.

* Move background-image in gifv modal to the computed property videoStyle

fixes #750
This commit is contained in:
Carlos Fernández 2018-12-17 22:13:27 +01:00 committed by Nolan Lawson
parent 049bbba639
commit 669be2e32b
3 changed files with 18 additions and 9 deletions

View File

@ -9,9 +9,7 @@
<video <video
class="image-modal-dialog-autoplay-video" class="image-modal-dialog-autoplay-video"
aria-label="Animated GIF: {description || ''}" aria-label="Animated GIF: {description || ''}"
style="background-image: url({poster}); " style="{videoStyle}"
{width}
{height}
{src} {src}
autoplay autoplay
muted muted
@ -22,8 +20,7 @@
{:else} {:else}
<img <img
{src} {src}
{width} {style}
{height}
alt={description || ''} alt={description || ''}
title={description || ''} title={description || ''}
/> />
@ -54,6 +51,14 @@
components: { components: {
ModalDialog ModalDialog
}, },
computed: {
style: ({ width, height }) => `
width: ${width ? width + 'px' : 'auto'};
height: ${height ? height + 'px' : 'auto'};`,
videoStyle: ({ style, poster }) => `
${style}
background-image: url(${poster});`
},
methods: { methods: {
show show
} }

View File

@ -8,8 +8,7 @@
> >
<video {poster} <video {poster}
{src} {src}
{width} {style}
{height}
aria-label="Video: {description || ''}" aria-label="Video: {description || ''}"
controls controls
ref:video ref:video
@ -33,6 +32,11 @@
components: { components: {
ModalDialog ModalDialog
}, },
computed: {
style: ({ width, height }) => `
width: ${width ? width + 'px' : 'auto'};
height: ${height ? height + 'px' : 'auto'};`
},
methods: { methods: {
show, show,
onClose () { onClose () {

View File

@ -116,8 +116,8 @@
return smallHeight || DEFAULT_MEDIA_HEIGHT return smallHeight || DEFAULT_MEDIA_HEIGHT
}, },
// width/height to show in a modal // width/height to show in a modal
modalWidth: ({ originalWidth, inlineWidth }) => originalWidth || inlineWidth, modalWidth: ({ originalWidth, smallWidth }) => originalWidth || smallWidth || 0,
modalHeight: ({ originalHeight, inlineHeight }) => originalHeight || inlineHeight, modalHeight: ({ originalHeight, smallHeight }) => originalHeight || smallHeight || 0,
meta: ({ media }) => media.meta, meta: ({ media }) => media.meta,
small: ({ meta }) => meta && meta.small, small: ({ meta }) => meta && meta.small,
original: ({ meta }) => meta && meta.original, original: ({ meta }) => meta && meta.original,