Make sure event is properly emitted

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-04-27 12:23:49 +02:00
parent 0659038d0b
commit 7c15a17aa4
5 changed files with 30 additions and 43 deletions

View File

@@ -38,16 +38,16 @@
</a>
</div>
<Actions v-if="selectable">
<ActionButton icon="icon-confirm" @click="this.$emit('selectAttachment', attachment)">
<ActionButton icon="icon-confirm" @click="$emit('selectAttachment', attachment)">
{{ t('deck', 'Add this attachment') }}
</ActionButton>
</Actions>
<Actions v-if="removable">
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="deleteAttachment(attachment)">
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="$emit('deleteAttachment', attachment)">
{{ t('deck', 'Delete Attachment') }}
</ActionButton>
<ActionButton v-else icon="icon-history" @click="restoreAttachment(attachment)">
<ActionButton v-else icon="icon-history" @click="$emit('restoreAttachment', attachment)">
{{ t('deck', 'Restore Attachment') }}
</ActionButton>
</Actions>
@@ -73,10 +73,6 @@ export default {
type: Number,
required: true,
},
editor: {
type: Object,
required: false,
},
selectable: {
type: Boolean,
required: false,
@@ -114,24 +110,6 @@ export default {
watch: {
},
methods: {
addAttachment(attachment) {
const descString = this.editor.easymde.value()
let embed = ''
if (attachment.extendedData.mimetype.includes('image')) {
embed = '!'
}
const attachmentString = embed + '[📎 ' + attachment.data + '](' + this.attachmentUrl(attachment) + ')'
this.editor.easymde.value(descString + '\n' + attachmentString)
this.modalShow = false
},
deleteAttachment(attachment) {
this.$store.dispatch('deleteAttachment', attachment)
},
restoreAttachment(attachment) {
this.$store.dispatch('restoreAttachment', attachment)
},
},
}
</script>