|
|
|
@ -8,7 +8,6 @@ const Attachment = {
|
|
|
|
|
props: [
|
|
|
|
|
'attachment',
|
|
|
|
|
'nsfw',
|
|
|
|
|
'statusId',
|
|
|
|
|
'size',
|
|
|
|
|
'allowPlay',
|
|
|
|
|
'setMedia',
|
|
|
|
@ -30,9 +29,21 @@ const Attachment = {
|
|
|
|
|
VideoAttachment
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
usePlaceHolder () {
|
|
|
|
|
usePlaceholder () {
|
|
|
|
|
return this.size === 'hide' || this.type === 'unknown'
|
|
|
|
|
},
|
|
|
|
|
placeholderName () {
|
|
|
|
|
if (this.attachment.description === '' || !this.attachment.description) {
|
|
|
|
|
return this.type.toUpperCase()
|
|
|
|
|
}
|
|
|
|
|
return this.attachment.description
|
|
|
|
|
},
|
|
|
|
|
placeholderIconClass () {
|
|
|
|
|
if (this.type === 'image') return 'icon-picture'
|
|
|
|
|
if (this.type === 'video') return 'icon-video'
|
|
|
|
|
if (this.type === 'audio') return 'icon-music'
|
|
|
|
|
return 'icon-link'
|
|
|
|
|
},
|
|
|
|
|
referrerpolicy () {
|
|
|
|
|
return this.$store.state.instance.mediaProxyAvailable ? '' : 'no-referrer'
|
|
|
|
|
},
|
|
|
|
@ -51,6 +62,12 @@ const Attachment = {
|
|
|
|
|
fullwidth () {
|
|
|
|
|
return this.type === 'html' || this.type === 'audio'
|
|
|
|
|
},
|
|
|
|
|
useModal () {
|
|
|
|
|
return this.size === 'hide' ? ['image', 'video', 'audio']
|
|
|
|
|
: this.mergedConfig.playVideosInModal
|
|
|
|
|
? ['image', 'video']
|
|
|
|
|
: ['image']
|
|
|
|
|
},
|
|
|
|
|
...mapGetters(['mergedConfig'])
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
@ -60,12 +77,7 @@ const Attachment = {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
openModal (event) {
|
|
|
|
|
const modalTypes = this.mergedConfig.playVideosInModal
|
|
|
|
|
? ['image', 'video']
|
|
|
|
|
: ['image']
|
|
|
|
|
if (fileTypeService.fileMatchesSomeType(modalTypes, this.attachment) ||
|
|
|
|
|
this.usePlaceHolder
|
|
|
|
|
) {
|
|
|
|
|
if (this.useModal) {
|
|
|
|
|
event.stopPropagation()
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
this.setMedia()
|
|
|
|
|