hasMedia / mediaPreview webp

This commit is contained in:
lesion 2022-04-28 23:28:54 +02:00
parent ccdb501979
commit 6d03d7828c
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -11,12 +11,15 @@
@mouseup='handleStop' @touchend='handleStop'
)
div.focalPoint(:style="{ top, left }")
img(v-if='mediaPreview' :src='mediaPreview')
picture(v-if='hasMedia')
source(:srcset='mediaPreview("webp")')
img(:src='mediaPreview("jpg")')
v-col.col-12.col-sm-4
p {{$t('event.choose_focal_point')}}
img.mediaPreview.d-none.d-sm-block(v-if='mediaPreview'
:src='mediaPreview' :style="{ 'object-position': position }")
picture(v-if='hasMedia')
source(:srcset='mediaPreview("webp")')
img.mediaPreview.d-none.d-sm-block(:src='mediaPreview("jpg")' :style="{ 'object-position': position }")
v-textarea.mt-4(type='text'
label='Alternative text'
@ -29,12 +32,12 @@
v-btn(text @click='openMediaDetails=false' color='warning') Cancel
v-btn(text color='primary' @click='save') Save
h3.mb-3.font-weight-regular(v-if='mediaPreview') {{$t('common.media')}}
v-card-actions(v-if='mediaPreview')
h3.mb-3.font-weight-regular(v-if='hasMedia') {{$t('common.media')}}
v-card-actions(v-if='hasMedia')
v-spacer
v-btn(text color='primary' @click='openMediaDetails = true') {{$t('common.edit')}}
v-btn(text color='error' @click='remove') {{$t('common.remove')}}
div.col-12.ml-3(v-if='mediaPreview')
div.col-12.ml-3(v-if='hasMedia')
picture
source(:srcset='mediaPreview("webp")')
img.mediaPreview(:src='mediaPreview("jpg")' :style="{ 'object-position': savedPosition }")
@ -67,6 +70,9 @@ export default {
}
},
computed: {
hasMedia () {
return (this.value.url || this.value.image)
},
top () {
return ((this.focalpoint[1] + 1) * 50) + '%'
},