Remove the focus of the bucket title element after saving the title

This commit is contained in:
kolaente 2020-10-24 17:23:13 +02:00
parent 5e046fbd06
commit 82d54b0751
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 6 additions and 3 deletions

View file

@ -124,7 +124,7 @@ export default {
.then(r => {
ctx.commit('setBuckets', r)
ctx.commit('setListId', listId)
return Promise.resolve()
return Promise.resolve(r)
})
.catch(e => {
return Promise.reject(e)

View file

@ -245,6 +245,7 @@ $crazy-height-calculation: '100vh - 4.5rem - 1.5rem - 1em - 1.5em - 8px';
.title.input {
height: auto;
padding: .4em .5em;
display: inline-block;
}
}

View file

@ -5,7 +5,7 @@
<h2
:ref="`bucket${bucket.id}title`"
@focusout="() => saveBucketTitle(bucket.id)"
@keyup.ctrl.enter="() => saveBucketTitle(bucket.id)"
@keyup.enter="() => saveBucketTitle(bucket.id)"
class="title input"
contenteditable="true"
spellcheck="false">{{ bucket.title }}</h2>
@ -497,7 +497,8 @@ export default {
})
},
saveBucketTitle(bucketId) {
const bucketTitle = this.$refs[`bucket${bucketId}title`][0].textContent
const bucketTitleElement = this.$refs[`bucket${bucketId}title`][0]
const bucketTitle = bucketTitleElement.textContent
const bucket = new BucketModel({
id: bucketId,
title: bucketTitle,
@ -515,6 +516,7 @@ export default {
this.$store.dispatch('kanban/updateBucket', bucket)
.then(r => {
realBucket.title = r.title
bucketTitleElement.blur()
})
.catch(e => {
this.error(e, this)