|
6 | 6 | <template> |
7 | 7 | <AttachmentDragAndDrop v-if="card" :card-id="card.id" class="drop-upload--card"> |
8 | 8 | <div :ref="`card${card.id}`" |
9 | | - :class="{'compact': compactMode, 'current-card': currentCard, 'no-labels': !hasLabels, 'card__editable': canEdit, 'card__archived': card.archived, 'card__highlight': highlight}" |
| 9 | + :class="{'compact': compactMode, 'current-card': isCurrentCard, 'no-labels': !hasLabels, 'card__editable': canEdit, 'card__archived': card.archived, 'card__highlight': highlight}" |
10 | 10 | :style="{backgroundColor: color}" |
11 | 11 | tag="div" |
12 | 12 | :tabindex="0" |
|
48 | 48 | </div> |
49 | 49 |
|
50 | 50 | <div v-if="hasLabels" class="card-labels"> |
51 | | - <transition-group v-if="card.labels && card.labels.length" |
52 | | - name="zoom" |
53 | | - tag="ul" |
| 51 | + <ul v-if="card.labels && card.labels.length" |
54 | 52 | class="labels" |
55 | 53 | @click.stop="openCard"> |
56 | 54 | <li v-for="label in labelsSorted" :key="label?.id ?? label?.title" :style="labelStyle(label)"> |
57 | 55 | <span @click.stop="applyLabelFilter(label)">{{ label.title }}</span> |
58 | 56 | </li> |
59 | | - </transition-group> |
| 57 | + </ul> |
60 | 58 | <CardMenu v-if="showMenuAtLabels" |
61 | 59 | :card="card" |
62 | 60 | class="right" |
@@ -125,6 +123,7 @@ export default { |
125 | 123 | return { |
126 | 124 | highlight: false, |
127 | 125 | editingTitle: TITLE_EDITING_STATE.OFF, |
| 126 | + isCurrentCard: false, |
128 | 127 | } |
129 | 128 | }, |
130 | 129 | computed: { |
@@ -158,9 +157,6 @@ export default { |
158 | 157 | const reference = this.card?.referenceData |
159 | 158 | return reference ? reference.openGraphObject.name : this.card.title |
160 | 159 | }, |
161 | | - currentCard() { |
162 | | - return this.card && this.$route && this.$route.params.cardId === this.card.id |
163 | | - }, |
164 | 160 | labelsSorted() { |
165 | 161 | return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1) |
166 | 162 | }, |
@@ -199,10 +195,21 @@ export default { |
199 | 195 | }, |
200 | 196 | }, |
201 | 197 | watch: { |
202 | | - currentCard(newValue) { |
203 | | - if (newValue) { |
204 | | - this.$nextTick(() => this.$el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' })) |
205 | | - } |
| 198 | + '$route.params.cardId': { |
| 199 | + immediate: true, |
| 200 | + handler(cardId) { |
| 201 | + if (!this.card) { |
| 202 | + return |
| 203 | + } |
| 204 | + const newValue = cardId && parseInt(cardId, 10) === this.card.id |
| 205 | + if (newValue === this.isCurrentCard) { |
| 206 | + return |
| 207 | + } |
| 208 | + this.isCurrentCard = newValue |
| 209 | + if (newValue) { |
| 210 | + this.$nextTick(() => this.$el.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' })) |
| 211 | + } |
| 212 | + }, |
206 | 213 | }, |
207 | 214 | }, |
208 | 215 | methods: { |
|
0 commit comments