diff --git a/src/components/cards/CardItem.vue b/src/components/cards/CardItem.vue index bb4969a5c..4ad86443c 100644 --- a/src/components/cards/CardItem.vue +++ b/src/components/cards/CardItem.vue @@ -19,12 +19,12 @@
-

- {{ card.title }} +

+ {{ card.title }}

- +

@@ -51,7 +54,10 @@ {{ label.title }} - +
$2$5', + ) + }, + }, }, mixins: [Color, labelStyle], props: { @@ -106,6 +120,7 @@ export default { data() { return { highlight: false, + editingTitle: false, } }, computed: { @@ -189,15 +204,22 @@ export default { }, }, methods: { + hasSelection() { + const selection = window.getSelection() + return selection.toString() !== '' + }, focus(card) { - if (this.shortcutLock) { + if (this.shortcutLock || this.hasSelection()) { return } card = this.$refs[`card${card}`] card.focus() }, - openCard() { - if (this.dragging) { + openCard(event) { + if (event.target.tagName.toLowerCase() === 'a') { + return + } + if (this.dragging || this.hasSelection()) { return } const boardId = this.card && this.card.boardId ? this.card.boardId : (this.$route?.params.id ?? this.currentBoard.id) @@ -209,7 +231,11 @@ export default { this.$root.$emit('open-card', this.card.id) }, + triggerEditTitle() { + this.editingTitle = true + }, onTitleBlur(e) { + this.editingTitle = false // TODO Handle empty title if (e.target.innerText !== this.card.title) { this.$store.dispatch('updateCardTitle', { @@ -336,6 +362,11 @@ export default { word-wrap: break-word; padding-left: 4px; align-self: center; + + :deep(a) { + text-decoration: underline; + } + &.editable { span { cursor: text; diff --git a/src/components/cards/CardMenu.vue b/src/components/cards/CardMenu.vue index d2857b35a..621881239 100644 --- a/src/components/cards/CardMenu.vue +++ b/src/components/cards/CardMenu.vue @@ -6,7 +6,7 @@ @@ -23,5 +23,6 @@ export default { default: null, }, }, + emits: ['edit-title'], } diff --git a/src/components/cards/CardMenuEntries.vue b/src/components/cards/CardMenuEntries.vue index ce8da18c7..f5593deed 100644 --- a/src/components/cards/CardMenuEntries.vue +++ b/src/components/cards/CardMenuEntries.vue @@ -9,6 +9,12 @@ {{ t('deck', 'Card details') }} + + + {{ t('deck', 'Edit title') }} +