From bd5e868483091fac16185d57e835ef2e2a96f85c Mon Sep 17 00:00:00 2001 From: Sean King <seanking2919@protonmail.com> Date: Sun, 26 Jun 2022 13:25:36 -0600 Subject: [PATCH] Use watch to change localDescription --- src/components/attachment/attachment.js | 3 +++ src/components/attachment/attachment.vue | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 5450f7a1..0568c6e2 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -132,6 +132,9 @@ const Attachment = { ...mapGetters(['mergedConfig']) }, watch: { + 'attachment.description' (newVal) { + this.localDescription = newVal + }, localDescription (newVal) { this.onEdit(newVal) } diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index d2c5531b..947b1bfc 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -166,7 +166,7 @@ :icon="placeholderIconClass" /> <p> - {{ edit ? localDescription : attachment.description }} + {{ localDescription }} </p> </a> @@ -244,7 +244,7 @@ </span> </div> <div - v-if="size !== 'hide' && !hideDescription && (edit || (attachment.description && showDescription))" + v-if="size !== 'hide' && !hideDescription && (edit || (localDescription && showDescription))" class="description-container" :class="{ '-static': !edit }" > @@ -259,7 +259,7 @@ @input="resize" /> <p v-else> - {{ attachment.description }} + {{ localDescription }} </p> </div> </div>