refs #750 Switch focus between Hashtag and Toot Detail using shortcut keys
This commit is contained in:
parent
068cce09b8
commit
1edabdb50b
|
@ -14,6 +14,7 @@
|
|||
v-on:delete="deleteToot"
|
||||
@focusNext="focusNext"
|
||||
@focusPrev="focusPrev"
|
||||
@focusRight="focusSidebar"
|
||||
@selectToot="focusToot(message)"
|
||||
>
|
||||
</toot>
|
||||
|
@ -32,6 +33,7 @@ import { mapState, mapGetters } from 'vuex'
|
|||
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||
import scrollTop from '../../../utils/scroll'
|
||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||
import { Event } from '~/src/renderer/components/event'
|
||||
|
||||
export default {
|
||||
name: 'tag',
|
||||
|
@ -76,6 +78,15 @@ export default {
|
|||
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||
})
|
||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
||||
|
||||
Event.$on('focus-timeline', () => {
|
||||
// If focusedId does not change, we have to refresh focusedId because Toot component watch change events.
|
||||
const previousFocusedId = this.focusedId
|
||||
this.focusedId = 0
|
||||
this.$nextTick(function () {
|
||||
this.focusedId = previousFocusedId
|
||||
})
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
tag: function (newTag, oldTag) {
|
||||
|
@ -106,6 +117,7 @@ export default {
|
|||
beforeDestroy () {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/stopStreaming')
|
||||
this.reset()
|
||||
Event.$off('focus-timeline')
|
||||
},
|
||||
methods: {
|
||||
async load (tag) {
|
||||
|
@ -206,6 +218,9 @@ export default {
|
|||
focusToot (message) {
|
||||
this.focusedId = message.uri + message.id
|
||||
},
|
||||
focusSidebar () {
|
||||
Event.$emit('focus-sidebar')
|
||||
},
|
||||
handleKey (event) {
|
||||
switch (event.srcKey) {
|
||||
case 'next':
|
||||
|
|
Loading…
Reference in New Issue