From 4a23dd694a6dd853fd10ed28d79b551d3fd0d493 Mon Sep 17 00:00:00 2001 From: Luka Trovic Date: Fri, 6 Mar 2026 10:24:23 +0100 Subject: [PATCH] feat: live update card description Signed-off-by: Luka Trovic --- src/components/card/Description.vue | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/components/card/Description.vue b/src/components/card/Description.vue index 50fd6f6e25..a3d971929e 100644 --- a/src/components/card/Description.vue +++ b/src/components/card/Description.vue @@ -118,6 +118,7 @@ export default { textAppAvailable: !!window.OCA?.Text?.createEditor, editor: null, keyExitState: 0, + descriptionOld: '', description: '', markdownIt: null, descriptionEditing: false, @@ -172,6 +173,21 @@ export default { return this.card?.description?.trim?.() !== '' }, }, + watch: { + card(newCard) { + if (newCard.description !== this.descriptionOld) { + clearTimeout(this.descriptionSaveTimeout) + this.descriptionLastEdit = 0 + + this.descriptionOld = newCard.description + this.description = newCard.description + if (this.editor) { + this.editor.setContent(this.description) + } + showWarning(t('deck', 'The description has been changed by another user.'), { timeout: 3000 }) + } + }, + }, mounted() { this.setupEditor() }, @@ -182,6 +198,7 @@ export default { async setupEditor() { await this.destroyEditor() this.descriptionLastEdit = 0 + this.descriptionOld = this.card.description this.description = this.card.description this.editor = await window.OCA.Text.createEditor({ el: this.$refs.editor, @@ -296,6 +313,7 @@ export default { } this.$emit('change', this.description) this.descriptionLastEdit = 0 + this.descriptionOld = this.description this.$store.commit('setHasCardSaveError', false) } catch (e) { this.$store.commit('setHasCardSaveError', true)