Merge pull request #2021 from nextcloud/bugfix/noid/description
This commit is contained in:
@@ -132,11 +132,6 @@
|
||||
href="https://deck.readthedocs.io/en/latest/Markdown/"
|
||||
target="_blank"
|
||||
class="icon icon-info" />
|
||||
<Actions v-if="canEdit">
|
||||
<ActionButton v-if="descriptionEditing" icon="icon-attach" @click="showAttachmentModal()">
|
||||
{{ t('deck', 'Add Attachment') }}
|
||||
</ActionButton>
|
||||
</Actions>
|
||||
<Actions v-if="canEdit">
|
||||
<ActionButton v-if="!descriptionEditing" icon="icon-rename" @click="showEditor()">
|
||||
{{ t('deck', 'Edit description') }}
|
||||
@@ -145,6 +140,11 @@
|
||||
{{ t('deck', 'View description') }}
|
||||
</ActionButton>
|
||||
</Actions>
|
||||
<Actions v-if="canEdit">
|
||||
<ActionButton v-if="descriptionEditing" icon="icon-attach" @click="showAttachmentModal()">
|
||||
{{ t('deck', 'Add Attachment') }}
|
||||
</ActionButton>
|
||||
</Actions>
|
||||
</h5>
|
||||
|
||||
<div v-if="!descriptionEditing"
|
||||
@@ -152,10 +152,12 @@
|
||||
@click="clickedPreview"
|
||||
v-html="renderedDescription" />
|
||||
<VueEasymde v-else
|
||||
:key="copiedCard.id"
|
||||
ref="markdownEditor"
|
||||
:value="copiedCard.description"
|
||||
v-model="copiedCard.description"
|
||||
:configs="mdeConfig"
|
||||
@input="updateDescription" />
|
||||
@input="updateDescription"
|
||||
@blur="saveDescription" />
|
||||
</AppSidebarTab>
|
||||
|
||||
<AppSidebarTab id="attachments"
|
||||
@@ -356,11 +358,15 @@ export default {
|
||||
this.initialize()
|
||||
},
|
||||
methods: {
|
||||
initialize() {
|
||||
async initialize() {
|
||||
if (!this.currentCard) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.copiedCard) {
|
||||
await this.saveDescription()
|
||||
}
|
||||
|
||||
this.copiedCard = JSON.parse(JSON.stringify(this.currentCard))
|
||||
this.allLabels = this.currentCard.labels
|
||||
|
||||
@@ -431,20 +437,21 @@ export default {
|
||||
this.copiedCard.duedate = null
|
||||
this.$store.dispatch('updateCardDue', this.copiedCard)
|
||||
},
|
||||
async saveDescription() {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.copiedCard, 'descriptionLastEdit') || this.descriptionSaving) {
|
||||
return
|
||||
}
|
||||
this.descriptionSaving = true
|
||||
await this.$store.dispatch('updateCardDesc', this.copiedCard)
|
||||
delete this.copiedCard.descriptionLastEdit
|
||||
this.descriptionSaving = false
|
||||
},
|
||||
updateDescription(text) {
|
||||
this.copiedCard.description = text
|
||||
this.copiedCard.descriptionLastEdit = Date.now()
|
||||
clearTimeout(this.descriptionSaveTimeout)
|
||||
this.descriptionSaveTimeout = setTimeout(async() => {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.copiedCard, 'descriptionLastEdit') || this.descriptionSaving) {
|
||||
return
|
||||
}
|
||||
this.descriptionSaving = true
|
||||
await this.$store.dispatch('updateCardDesc', this.copiedCard)
|
||||
delete this.copiedCard.descriptionLastEdit
|
||||
this.descriptionSaving = false
|
||||
await this.saveDescription()
|
||||
}, 2500)
|
||||
|
||||
},
|
||||
|
||||
closeSidebar() {
|
||||
|
||||
Reference in New Issue
Block a user