diff --git a/src/components/card/CardSidebar.vue b/src/components/card/CardSidebar.vue index c6b1fe0a0..be97d440b 100644 --- a/src/components/card/CardSidebar.vue +++ b/src/components/card/CardSidebar.vue @@ -121,13 +121,18 @@
{{ t('deck', 'Description') }} + {{ t('deck', '(Unsaved)') }} + {{ t('deck', '(Saving…)') }}
- + import { Avatar, Actions, ActionButton, Multiselect, AppSidebar, AppSidebarTab, DatetimePicker } from '@nextcloud/vue' import { mapState, mapGetters } from 'vuex' -import VueEasymde from 'vue-easymde/dist/VueEasyMDE.common' import Color from '../../mixins/color' import { CollectionList } from 'nextcloud-vue-collections' import CardSidebarTabAttachments from './CardSidebarTabAttachments' @@ -174,7 +178,7 @@ export default { AppSidebarTab, Multiselect, DatetimePicker, - VueEasymde, + VueEasymde: () => import('vue-easymde/dist/VueEasyMDE.common'), Actions, ActionButton, Avatar, @@ -209,6 +213,8 @@ export default { }, lastModifiedRelative: null, lastCreatedRemative: null, + descriptionSaveTimeout: null, + descriptionSaving: false, hasActivity: capabilities && capabilities.activity, hasComments: window.OCP && window.OCP.Comments, } @@ -299,8 +305,20 @@ export default { this.copiedCard.duedate = null this.$store.dispatch('updateCardDue', this.copiedCard) }, - saveDesc() { - this.$store.dispatch('updateCardDesc', this.copiedCard) + 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 + }, 2500) + }, closeSidebar() { diff --git a/src/components/cards/CardBadges.vue b/src/components/cards/CardBadges.vue index 6c41d54d5..1f73cf583 100644 --- a/src/components/cards/CardBadges.vue +++ b/src/components/cards/CardBadges.vue @@ -22,7 +22,7 @@