display images, videos & files in text body

This commit is contained in:
axolotle
2022-01-22 17:06:37 +01:00
parent 25b5055d5f
commit d66230f8d3
4 changed files with 40 additions and 23 deletions
+3 -16
View File
@@ -1,7 +1,7 @@
<template>
<figure class="node-view-figure mt-2 mb-4">
<div class="node-view-img-wrapper">
<img :src="image.url" :alt="image.alt">
<img :src="node.image.url" :alt="node.image.alt">
<button-expand @click="onImageExpand" v-b-modal="'modal-image-' + node.id" />
<b-button variant="creation" class="btn-shadow btn-artwork" @click="onCreationClick">
@@ -31,29 +31,16 @@ export default {
node: { type: Object, required: true }
},
data () {
return {
image: undefined
}
},
methods: {
trim,
toCommaList,
onImageExpand () {
this.$emit('expand-image', this.image)
this.$emit('expand-image', this.node.image)
},
onCreationClick () {
this.$store.dispatch('OPEN_CREATION', this.node.id)
}
},
created () {
if (this.node.images && this.node.images.length) {
const { url, alt, id } = this.node.images[0]
this.image = { alt, id, url }
this.$store.dispatch('OPEN_CREATION', { id: this.node.id, map: false })
}
}
}