Merge pull request #2021 from nextcloud/bugfix/noid/description

This commit is contained in:
Julius Härtl
2020-06-16 09:59:15 +02:00
committed by GitHub
2 changed files with 26 additions and 18 deletions

View File

@@ -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() {

View File

@@ -10,7 +10,8 @@ module.exports = {
filename: '[name].js',
path: __dirname + '/js',
publicPath: '/js/',
jsonpFunction: 'webpackJsonpOCADeck'
jsonpFunction: 'webpackJsonpOCADeck',
chunkFilename: '[name].js?v=[contenthash]',
},
module: {
rules: [