fix: losing focus while editing title field

Signed-off-by: Luka Trovic <luka@nextcloud.com>
This commit is contained in:
Luka Trovic
2024-07-26 13:57:57 +02:00
committed by backportbot[bot]
parent 426197f9db
commit 235034af68
2 changed files with 15 additions and 0 deletions

View File

@@ -118,6 +118,7 @@
:placeholder="t('deck', 'Card name')"
required
pattern=".*\S+.*"
@focus="onCreateCardFocus"
@keydown.esc="stopCardCreation">
<input v-show="!stateCardCreating"
class="icon-confirm"
@@ -229,6 +230,13 @@ export default {
},
},
},
watch: {
showAddCard(newValue) {
if (!newValue) {
this.$store.dispatch('toggleShortcutLock', false)
}
},
},
methods: {
stopCardCreation(e) {
@@ -318,6 +326,9 @@ export default {
this.stateCardCreating = false
}
},
onCreateCardFocus() {
this.$store.dispatch('toggleShortcutLock', true)
},
},
}
</script>

View File

@@ -130,6 +130,7 @@ export default {
showArchived: state => state.showArchived,
currentBoard: state => state.currentBoard,
showCardCover: state => state.showCardCover,
shortcutLock: state => state.shortcutLock,
}),
...mapGetters([
'isArchived',
@@ -205,6 +206,9 @@ export default {
},
methods: {
focus(card) {
if (this.shortcutLock) {
return
}
card = this.$refs[`card${card}`]
card.focus()
},