Remove the focus of the bucket title element after saving the title
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-10-24 17:23:13 +02:00
parent 5e046fbd06
commit 82d54b0751
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 6 additions and 3 deletions

View File

@ -124,7 +124,7 @@ export default {
.then(r => { .then(r => {
ctx.commit('setBuckets', r) ctx.commit('setBuckets', r)
ctx.commit('setListId', listId) ctx.commit('setListId', listId)
return Promise.resolve() return Promise.resolve(r)
}) })
.catch(e => { .catch(e => {
return Promise.reject(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 { .title.input {
height: auto; height: auto;
padding: .4em .5em; padding: .4em .5em;
display: inline-block;
} }
} }

View File

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