refs #601 Fix losting focused toot in timeline

This commit is contained in:
AkiraFukushima 2018-09-13 23:03:47 +09:00
parent 0094915feb
commit 2d2aa38416
5 changed files with 45 additions and 5 deletions

View File

@ -55,7 +55,15 @@ export default {
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
if (this.modalOpened) {
return false
}
if (!this.focusedId) {
return true
}
// Sometimes toots are deleted, so perhaps focused toot don't exist.
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri)
return currentIndex === -1
}
},
mounted () {

View File

@ -55,7 +55,15 @@ export default {
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
if (this.modalOpened) {
return false
}
if (!this.focusedId) {
return true
}
// Sometimes toots are deleted, so perhaps focused toot don't exist.
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri)
return currentIndex === -1
}
},
mounted () {

View File

@ -55,7 +55,15 @@ export default {
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
if (this.modalOpened) {
return false
}
if (!this.focusedId) {
return true
}
// Sometimes toots are deleted, so perhaps focused toot don't exist.
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri)
return currentIndex === -1
}
},
created () {

View File

@ -55,7 +55,15 @@ export default {
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
if (this.modalOpened) {
return false
}
if (!this.focusedId) {
return true
}
// Sometimes toots are deleted, so perhaps focused toot don't exist.
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri)
return currentIndex === -1
}
},
mounted () {

View File

@ -55,7 +55,15 @@ export default {
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
if (this.modalOpened) {
return false
}
if (!this.focusedId) {
return true
}
// Sometimes toots are deleted, so perhaps focused toot don't exist.
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri)
return currentIndex === -1
}
},
created () {