Merge pull request #755 from h3poteto/iss-750
refs #750 Switch focus between Timeline and Toot Detail using shortcut keys
This commit is contained in:
commit
0a039f18c1
|
@ -2,7 +2,7 @@ version: 2
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
docker:
|
docker:
|
||||||
- image: node:10-slim
|
- image: node:10.13.0-slim
|
||||||
working_directory: /var/opt/app
|
working_directory: /var/opt/app
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectToot="focusToot(message)"
|
@selectToot="focusToot(message)"
|
||||||
v-for="message in timeline"
|
v-for="message in timeline"
|
||||||
:key="message.uri + message.id"
|
:key="message.uri + message.id"
|
||||||
|
@ -33,6 +34,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'directmessages',
|
name: 'directmessages',
|
||||||
|
@ -83,6 +85,15 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
beforeUpdate () {
|
beforeUpdate () {
|
||||||
if (this.$store.state.TimelineSpace.SideMenu.unreadDirectMessagesTimeline && this.heading) {
|
if (this.$store.state.TimelineSpace.SideMenu.unreadDirectMessagesTimeline && this.heading) {
|
||||||
|
@ -94,6 +105,7 @@ export default {
|
||||||
this.$store.dispatch('TimelineSpace/stopDirectMessagesStreaming')
|
this.$store.dispatch('TimelineSpace/stopDirectMessagesStreaming')
|
||||||
this.$store.dispatch('TimelineSpace/unbindDirectMessagesStreaming')
|
this.$store.dispatch('TimelineSpace/unbindDirectMessagesStreaming')
|
||||||
}
|
}
|
||||||
|
Event.$off('focus-timeline')
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeHeading', true)
|
this.$store.commit('TimelineSpace/Contents/DirectMessages/changeHeading', true)
|
||||||
|
@ -196,6 +208,9 @@ export default {
|
||||||
focusToot (message) {
|
focusToot (message) {
|
||||||
this.focusedId = message.uri + message.id
|
this.focusedId = message.uri + message.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectToot="focusToot(message)"
|
@selectToot="focusToot(message)"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
|
@ -30,6 +31,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'favourites',
|
name: 'favourites',
|
||||||
|
@ -73,6 +75,17 @@ export default {
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
Event.$off('focus-timeline')
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
this.$store.commit('TimelineSpace/Contents/Favourites/updateFavourites', [])
|
this.$store.commit('TimelineSpace/Contents/Favourites/updateFavourites', [])
|
||||||
|
@ -163,6 +176,9 @@ export default {
|
||||||
focusToot (message) {
|
focusToot (message) {
|
||||||
this.focusedId = message.id
|
this.focusedId = message.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectToot="focusToot(message)"
|
@selectToot="focusToot(message)"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
|
@ -32,6 +33,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
import scrollTop from '../../../utils/scroll'
|
import scrollTop from '../../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'tag',
|
name: 'tag',
|
||||||
|
@ -76,6 +78,15 @@ export default {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
})
|
})
|
||||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
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: {
|
watch: {
|
||||||
tag: function (newTag, oldTag) {
|
tag: function (newTag, oldTag) {
|
||||||
|
@ -106,6 +117,7 @@ export default {
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/stopStreaming')
|
this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/stopStreaming')
|
||||||
this.reset()
|
this.reset()
|
||||||
|
Event.$off('focus-timeline')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async load (tag) {
|
async load (tag) {
|
||||||
|
@ -206,6 +218,9 @@ export default {
|
||||||
focusToot (message) {
|
focusToot (message) {
|
||||||
this.focusedId = message.uri + message.id
|
this.focusedId = message.uri + message.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectToot="focusToot(message)"
|
@selectToot="focusToot(message)"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
|
@ -33,6 +34,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'home',
|
name: 'home',
|
||||||
|
@ -85,12 +87,23 @@ export default {
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false)
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false)
|
||||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
beforeUpdate () {
|
beforeUpdate () {
|
||||||
if (this.$store.state.TimelineSpace.SideMenu.unreadHomeTimeline && this.heading) {
|
if (this.$store.state.TimelineSpace.SideMenu.unreadHomeTimeline && this.heading) {
|
||||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false)
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
Event.$off('focus-timeline')
|
||||||
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
this.$store.commit('TimelineSpace/Contents/Home/changeHeading', true)
|
this.$store.commit('TimelineSpace/Contents/Home/changeHeading', true)
|
||||||
this.$store.commit('TimelineSpace/Contents/Home/mergeTimeline')
|
this.$store.commit('TimelineSpace/Contents/Home/mergeTimeline')
|
||||||
|
@ -178,6 +191,9 @@ export default {
|
||||||
focusToot (message) {
|
focusToot (message) {
|
||||||
this.focusedId = message.uri + message.id
|
this.focusedId = message.uri + message.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectToot="focusToot(message)"
|
@selectToot="focusToot(message)"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
|
@ -32,6 +33,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
import scrollTop from '../../../utils/scroll'
|
import scrollTop from '../../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'list',
|
name: 'list',
|
||||||
|
@ -77,6 +79,16 @@ export default {
|
||||||
})
|
})
|
||||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
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: {
|
watch: {
|
||||||
list_id: function () {
|
list_id: function () {
|
||||||
this.$store.commit('TimelineSpace/changeLoading', true)
|
this.$store.commit('TimelineSpace/changeLoading', true)
|
||||||
|
@ -205,6 +217,9 @@ export default {
|
||||||
focusToot (message) {
|
focusToot (message) {
|
||||||
this.focusedId = message.uri + message.id
|
this.focusedId = message.uri + message.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectToot="focusToot(message)"
|
@selectToot="focusToot(message)"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
|
@ -33,6 +34,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'local',
|
name: 'local',
|
||||||
|
@ -83,6 +85,15 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
beforeUpdate () {
|
beforeUpdate () {
|
||||||
if (this.$store.state.TimelineSpace.SideMenu.unreadLocalTimeline && this.heading) {
|
if (this.$store.state.TimelineSpace.SideMenu.unreadLocalTimeline && this.heading) {
|
||||||
|
@ -94,6 +105,7 @@ export default {
|
||||||
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
||||||
this.$store.dispatch('TimelineSpace/unbindLocalStreaming')
|
this.$store.dispatch('TimelineSpace/unbindLocalStreaming')
|
||||||
}
|
}
|
||||||
|
Event.$off('focus-timeline')
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
this.$store.commit('TimelineSpace/Contents/Local/changeHeading', true)
|
this.$store.commit('TimelineSpace/Contents/Local/changeHeading', true)
|
||||||
|
@ -195,6 +207,9 @@ export default {
|
||||||
focusToot (message) {
|
focusToot (message) {
|
||||||
this.focusedId = message.uri + message.id
|
this.focusedId = message.uri + message.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
:overlaid="modalOpened"
|
:overlaid="modalOpened"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectNotification="focusNotification(message)"
|
@selectNotification="focusNotification(message)"
|
||||||
>
|
>
|
||||||
</notification>
|
</notification>
|
||||||
|
@ -31,6 +32,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Notification from '~/src/renderer/components/molecules/Notification'
|
import Notification from '~/src/renderer/components/molecules/Notification'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'notifications',
|
name: 'notifications',
|
||||||
|
@ -71,12 +73,24 @@ export default {
|
||||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false)
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false)
|
||||||
this.$store.dispatch('TimelineSpace/Contents/Notifications/resetBadge')
|
this.$store.dispatch('TimelineSpace/Contents/Notifications/resetBadge')
|
||||||
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
beforeUpdate () {
|
beforeUpdate () {
|
||||||
if (this.$store.state.TimelineSpace.SideMenu.unreadNotifications) {
|
if (this.$store.state.TimelineSpace.SideMenu.unreadNotifications) {
|
||||||
this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false)
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
Event.$off('focus-timeline')
|
||||||
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
this.$store.commit('TimelineSpace/Contents/Notifications/changeHeading', true)
|
this.$store.commit('TimelineSpace/Contents/Notifications/changeHeading', true)
|
||||||
this.$store.commit('TimelineSpace/Contents/Notifications/mergeNotifications')
|
this.$store.commit('TimelineSpace/Contents/Notifications/mergeNotifications')
|
||||||
|
@ -160,6 +174,9 @@ export default {
|
||||||
focusNotification (notification) {
|
focusNotification (notification) {
|
||||||
this.focusedId = notification.id
|
this.focusedId = notification.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
v-on:delete="deleteToot"
|
v-on:delete="deleteToot"
|
||||||
@focusNext="focusNext"
|
@focusNext="focusNext"
|
||||||
@focusPrev="focusPrev"
|
@focusPrev="focusPrev"
|
||||||
|
@focusRight="focusSidebar"
|
||||||
@selectToot="focusToot(message)"
|
@selectToot="focusToot(message)"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
|
@ -33,6 +34,7 @@ import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
import scrollTop from '../../utils/scroll'
|
import scrollTop from '../../utils/scroll'
|
||||||
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
import reloadable from '~/src/renderer/components/mixins/reloadable'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'public',
|
name: 'public',
|
||||||
|
@ -83,6 +85,15 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$store.commit('TimelineSpace/changeLoading', false)
|
this.$store.commit('TimelineSpace/changeLoading', false)
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
beforeUpdate () {
|
beforeUpdate () {
|
||||||
if (this.$store.state.TimelineSpace.SideMenu.unreadPublicTimeline && this.heading) {
|
if (this.$store.state.TimelineSpace.SideMenu.unreadPublicTimeline && this.heading) {
|
||||||
|
@ -94,6 +105,7 @@ export default {
|
||||||
this.$store.dispatch('TimelineSpace/stopPublicStreaming')
|
this.$store.dispatch('TimelineSpace/stopPublicStreaming')
|
||||||
this.$store.dispatch('TimelineSpace/unbindPublicStreaming')
|
this.$store.dispatch('TimelineSpace/unbindPublicStreaming')
|
||||||
}
|
}
|
||||||
|
Event.$off('focus-timeline')
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed () {
|
||||||
this.$store.commit('TimelineSpace/Contents/Public/changeHeading', true)
|
this.$store.commit('TimelineSpace/Contents/Public/changeHeading', true)
|
||||||
|
@ -195,6 +207,9 @@ export default {
|
||||||
focusToot (message) {
|
focusToot (message) {
|
||||||
this.focusedId = message.uri + message.id
|
this.focusedId = message.uri + message.id
|
||||||
},
|
},
|
||||||
|
focusSidebar () {
|
||||||
|
Event.$emit('focus-sidebar')
|
||||||
|
},
|
||||||
handleKey (event) {
|
handleKey (event) {
|
||||||
switch (event.srcKey) {
|
switch (event.srcKey) {
|
||||||
case 'next':
|
case 'next':
|
||||||
|
|
|
@ -1,39 +1,91 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="toot-detail" ref="detail">
|
<div class="toot-detail" ref="detail">
|
||||||
<div class="toot-ancestors" v-for="(message, index) in ancestors" v-bind:key="'ancestors-' + index">
|
<div class="toot-ancestors" v-for="(message, index) in ancestors" v-bind:key="'ancestors-' + index">
|
||||||
<toot :message="message" v-on:update="updateAncestorsToot" v-on:delete="deleteAncestorsToot"></toot>
|
<toot
|
||||||
|
:message="message"
|
||||||
|
:focused="message.uri + message.id === focusedId"
|
||||||
|
:overlaid="modalOpened"
|
||||||
|
v-on:update="updateAncestorsToot"
|
||||||
|
v-on:delete="deleteAncestorsToot"
|
||||||
|
@focusNext="focusNext"
|
||||||
|
@focusPrev="focusPrev"
|
||||||
|
@focusLeft="focusTimeline"
|
||||||
|
@selectToot="focusToot(message)"
|
||||||
|
>
|
||||||
|
</toot>
|
||||||
</div>
|
</div>
|
||||||
<div class="original-toot" ref="original">
|
<div class="original-toot" ref="original">
|
||||||
<toot :message="message" v-on:update="updateToot" v-on:delete="deleteToot"></toot>
|
<toot
|
||||||
|
:message="message"
|
||||||
|
:focused="message.uri + message.id === focusedId"
|
||||||
|
:overlaid="modalOpened"
|
||||||
|
v-on:update="updateToot"
|
||||||
|
v-on:delete="deleteToot"
|
||||||
|
@focusNext="focusNext"
|
||||||
|
@focusPrev="focusPrev"
|
||||||
|
@focusLeft="focusTimeline"
|
||||||
|
@selectToot="focusToot(message)"
|
||||||
|
>
|
||||||
|
</toot>
|
||||||
</div>
|
</div>
|
||||||
<div class="toot-descendants" v-for="(message, index) in descendants" v-bind:key="'descendants' + index">
|
<div class="toot-descendants" v-for="(message, index) in descendants" v-bind:key="'descendants' + index">
|
||||||
<toot :message="message" v-on:update="updateDescendantsToot" v-on:delete="deleteDescendantsToot"></toot>
|
<toot
|
||||||
|
:message="message"
|
||||||
|
:focused="message.uri + message.id === focusedId"
|
||||||
|
:overlaid="modalOpened"
|
||||||
|
v-on:update="updateDescendantsToot"
|
||||||
|
v-on:delete="deleteDescendantsToot"
|
||||||
|
@focusNext="focusNext"
|
||||||
|
@focusPrev="focusPrev"
|
||||||
|
@focusLeft="focusTimeline"
|
||||||
|
@selectToot="focusToot(message)"
|
||||||
|
>
|
||||||
|
</toot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Toot from '~/src/renderer/components/molecules/Toot'
|
import Toot from '~/src/renderer/components/molecules/Toot'
|
||||||
|
import { Event } from '~/src/renderer/components/event'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'toot-detail',
|
name: 'toot-detail',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
focusedId: null
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState('TimelineSpace/Contents/SideBar/TootDetail', {
|
||||||
message: state => state.TimelineSpace.Contents.SideBar.TootDetail.message,
|
message: state => state.message,
|
||||||
ancestors: state => state.TimelineSpace.Contents.SideBar.TootDetail.ancestors,
|
ancestors: state => state.ancestors,
|
||||||
descendants: state => state.TimelineSpace.Contents.SideBar.TootDetail.descendants
|
descendants: state => state.descendants,
|
||||||
})
|
timeline: state => state.ancestors.concat([state.message]).concat(state.descendants)
|
||||||
|
}),
|
||||||
|
...mapGetters('TimelineSpace/Modals', [
|
||||||
|
'modalOpened'
|
||||||
|
])
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.load()
|
this.load()
|
||||||
|
Event.$on('focus-sidebar', () => {
|
||||||
|
this.focusedId = 0
|
||||||
|
this.$nextTick(function () {
|
||||||
|
this.focusedId = this.timeline[0].uri + this.timeline[0].id
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
message: function () {
|
message: function () {
|
||||||
this.load()
|
this.load()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
Event.$off('focus-sidebar')
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
load () {
|
load () {
|
||||||
this.$store.dispatch('TimelineSpace/Contents/SideBar/TootDetail/fetchToot', this.message)
|
this.$store.dispatch('TimelineSpace/Contents/SideBar/TootDetail/fetchToot', this.message)
|
||||||
|
@ -65,6 +117,27 @@ export default {
|
||||||
},
|
},
|
||||||
deleteDescendantsToot (message) {
|
deleteDescendantsToot (message) {
|
||||||
this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/deleteDescendantsToot', message)
|
this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/deleteDescendantsToot', message)
|
||||||
|
},
|
||||||
|
focusNext () {
|
||||||
|
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri + toot.id)
|
||||||
|
if (currentIndex === -1) {
|
||||||
|
this.focusedId = this.timeline[0].uri + this.timeline[0].id
|
||||||
|
} else if (currentIndex < this.timeline.length - 1) {
|
||||||
|
this.focusedId = this.timeline[currentIndex + 1].uri + this.timeline[currentIndex + 1].id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusPrev () {
|
||||||
|
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri + toot.id)
|
||||||
|
if (currentIndex > 0) {
|
||||||
|
this.focusedId = this.timeline[currentIndex - 1].uri + this.timeline[currentIndex - 1].id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusToot (message) {
|
||||||
|
this.focusedId = message.uri + message.id
|
||||||
|
},
|
||||||
|
focusTimeline () {
|
||||||
|
this.focusedId = 0
|
||||||
|
Event.$emit('focus-timeline')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
export const Event = new Vue()
|
|
@ -7,6 +7,7 @@
|
||||||
:overlaid="overlaid"
|
:overlaid="overlaid"
|
||||||
@focusNext="$emit('focusNext')"
|
@focusNext="$emit('focusNext')"
|
||||||
@focusPrev="$emit('focusPrev')"
|
@focusPrev="$emit('focusPrev')"
|
||||||
|
@focusRight="$emit('focusRight')"
|
||||||
@select="$emit('selectNotification')"
|
@select="$emit('selectNotification')"
|
||||||
>
|
>
|
||||||
</favourite>
|
</favourite>
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
:overlaid="overlaid"
|
:overlaid="overlaid"
|
||||||
@focusNext="$emit('focusNext')"
|
@focusNext="$emit('focusNext')"
|
||||||
@focusPrev="$emit('focusPrev')"
|
@focusPrev="$emit('focusPrev')"
|
||||||
|
@focusRight="$emit('focusRight')"
|
||||||
@select="$emit('selectNotification')"
|
@select="$emit('selectNotification')"
|
||||||
>
|
>
|
||||||
</mention>
|
</mention>
|
||||||
|
@ -36,6 +38,7 @@
|
||||||
:overlaid="overlaid"
|
:overlaid="overlaid"
|
||||||
@focusNext="$emit('focusNext')"
|
@focusNext="$emit('focusNext')"
|
||||||
@focusPrev="$emit('focusPrev')"
|
@focusPrev="$emit('focusPrev')"
|
||||||
|
@focusRight="$emit('focusRight')"
|
||||||
@select="$emit('selectNotification')"
|
@select="$emit('selectNotification')"
|
||||||
>
|
>
|
||||||
</reblog>
|
</reblog>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div
|
<div
|
||||||
class="status"
|
class="status"
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k'], open: ['o'], profile: ['p']} : {}"
|
v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k'], right: ['l'], left: ['h'], open: ['o'], profile: ['p']} : {}"
|
||||||
@shortkey="handleStatusControl"
|
@shortkey="handleStatusControl"
|
||||||
ref="status"
|
ref="status"
|
||||||
@click="$emit('select')"
|
@click="$emit('select')"
|
||||||
|
@ -230,6 +230,12 @@ export default {
|
||||||
case 'prev':
|
case 'prev':
|
||||||
this.$emit('focusPrev')
|
this.$emit('focusPrev')
|
||||||
break
|
break
|
||||||
|
case 'right':
|
||||||
|
this.$emit('focusRight')
|
||||||
|
break
|
||||||
|
case 'left':
|
||||||
|
this.$emit('focusLeft')
|
||||||
|
break
|
||||||
case 'open':
|
case 'open':
|
||||||
this.openDetail(this.message.status)
|
this.openDetail(this.message.status)
|
||||||
break
|
break
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
v-on:update="updateToot"
|
v-on:update="updateToot"
|
||||||
@focusNext="$emit('focusNext')"
|
@focusNext="$emit('focusNext')"
|
||||||
@focusPrev="$emit('focusPrev')"
|
@focusPrev="$emit('focusPrev')"
|
||||||
|
@focusRight="$emit('focusRight')"
|
||||||
@selectToot="$emit('select')"
|
@selectToot="$emit('select')"
|
||||||
>
|
>
|
||||||
</toot>
|
</toot>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div
|
<div
|
||||||
class="status"
|
class="status"
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k'], open: ['o'], profile: ['p']} : {}"
|
v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k'], right: ['l'], left: ['h'], open: ['o'], profile: ['p']} : {}"
|
||||||
@shortkey="handleStatusControl"
|
@shortkey="handleStatusControl"
|
||||||
ref="status"
|
ref="status"
|
||||||
@click="$emit('select')"
|
@click="$emit('select')"
|
||||||
|
@ -228,6 +228,12 @@ export default {
|
||||||
case 'prev':
|
case 'prev':
|
||||||
this.$emit('focusPrev')
|
this.$emit('focusPrev')
|
||||||
break
|
break
|
||||||
|
case 'right':
|
||||||
|
this.$emit('focusRight')
|
||||||
|
break
|
||||||
|
case 'left':
|
||||||
|
this.$emit('focusLeft')
|
||||||
|
break
|
||||||
case 'open':
|
case 'open':
|
||||||
this.openDetail(this.message.status)
|
this.openDetail(this.message.status)
|
||||||
break
|
break
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div
|
<div
|
||||||
class="status"
|
class="status"
|
||||||
tabIndex="0"
|
tabIndex="0"
|
||||||
v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k'], reply: ['r'], boost: ['b'], fav: ['f'], open: ['o'], profile: ['p'], image: ['i'], cw: ['x']} : {}"
|
v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k'], right: ['l'], left: ['h'], reply: ['r'], boost: ['b'], fav: ['f'], open: ['o'], profile: ['p'], image: ['i'], cw: ['x']} : {}"
|
||||||
@shortkey="handleTootControl"
|
@shortkey="handleTootControl"
|
||||||
ref="status"
|
ref="status"
|
||||||
@click="$emit('selectToot')"
|
@click="$emit('selectToot')"
|
||||||
|
@ -452,6 +452,12 @@ export default {
|
||||||
case 'prev':
|
case 'prev':
|
||||||
this.$emit('focusPrev')
|
this.$emit('focusPrev')
|
||||||
break
|
break
|
||||||
|
case 'right':
|
||||||
|
this.$emit('focusRight')
|
||||||
|
break
|
||||||
|
case 'left':
|
||||||
|
this.$emit('focusLeft')
|
||||||
|
break
|
||||||
case 'reply':
|
case 'reply':
|
||||||
this.openReply(this.message)
|
this.openReply(this.message)
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue