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

8
package-lock.json generated
View File

@@ -13962,7 +13962,7 @@
},
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true
},
@@ -13979,7 +13979,7 @@
},
"os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true
},
@@ -14181,7 +14181,7 @@
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"path-is-inside": {
@@ -17293,7 +17293,7 @@
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"

View File

@@ -24,12 +24,12 @@
<div class="board-wrapper">
<Controls :board="board" />
<transition name="fade" mode="out-in">
<div v-if="loading" class="emptycontent" key="loading">
<div v-if="loading" key="loading" class="emptycontent">
<div class="icon icon-loading" />
<h2>{{ t('deck', 'Loading board') }}</h2>
<p />
</div>
<div v-else-if="board && !loading" class="board" key="board">
<div v-else-if="board && !loading" key="board" class="board">
<Container lock-axix="y"
orientation="horizontal"
:drag-handle-selector="dragHandleSelector"
@@ -39,13 +39,12 @@
</Draggable>
</Container>
</div>
<div v-else class="emptycontent" key="notfound">
<div v-else key="notfound" class="emptycontent">
<div class="icon icon-deck" />
<h2>{{ t('deck', 'Board not found') }}</h2>
<p />
</div>
</transition>
</div>
</template>

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>

View File

@@ -178,15 +178,9 @@
<Modal v-if="modalShow" :title="t('deck', 'Choose attachment')" @close="modalShow=false">
<div class="modal__content">
<h3>{{ t('deck', 'Choose attachment') }}</h3>
<!-- <Actions>
<ActionButton icon="icon-close" @click="modalShow=false">
{{ t('deck', 'Cancel') }}
</ActionButton>
</Actions> -->
<AttachmentList
:card-id="currentCard.id"
:selectable="true"
:editor="$refs.markdownEditor"
@selectAttachment="addAttachment" />
</div>
</Modal>
@@ -376,7 +370,6 @@ export default {
this.modalShow = true
},
addAttachment(attachment) {
console.log('hier')
const descString = this.$refs.markdownEditor.easymde.value()
let embed = ''
if (attachment.extendedData.mimetype.includes('image')) {
@@ -511,7 +504,7 @@ export default {
margin-bottom: 5px;
color: var(--color-text-maxcontrast);
.icon-info, .icon-attach {
.icon-info {
display: inline-block;
width: 32px;
height: 16px;
@@ -519,6 +512,13 @@ export default {
opacity: .7;
}
.icon-attach {
background-size: 16px;
float: right;
margin-top: -14px;
opacity: .7;
}
.icon-toggle, .icon-rename {
float: right;
margin-top: -14px;
@@ -604,6 +604,7 @@ export default {
height: 120px;
text-align: center;
margin: 20px 20px 60px 20px;
padding-bottom: 20px;
}
.modal__content button {

View File

@@ -44,7 +44,11 @@
</div>
</li>
<AttachmentList :card-id="card.id" :removable="true" />
<AttachmentList
:card-id="card.id"
:removable="true"
@deleteAttachment="deleteAttachment"
@restoreAttachment="restoreAttachment" />
</ul>
</div>
</AttachmentDragAndDrop>
@@ -124,7 +128,12 @@ export default {
clickAddNewAttachmment() {
this.$refs.localAttachments.click()
},
deleteAttachment(attachment) {
this.$store.dispatch('deleteAttachment', attachment)
},
restoreAttachment(attachment) {
this.$store.dispatch('restoreAttachment', attachment)
},
},
}
</script>