forked from cybrespace/pinafore
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:
parent
049bbba639
commit
669be2e32b
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 () {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue