1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-02-08 15:58:42 +01:00

fixes: Stop toot shortcut when modal is opened

This commit is contained in:
AkiraFukushima 2018-08-24 00:14:37 +09:00
parent 9c84ff0da1
commit 7e0a0510da
14 changed files with 150 additions and 44 deletions

View File

@ -4,6 +4,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="focused" :focused="focused"
:overlaid="overlaid"
@focusNext="$emit('focusNext')" @focusNext="$emit('focusNext')"
@focusPrev="$emit('focusPrev')" @focusPrev="$emit('focusPrev')"
@select="$emit('selectNotification')" @select="$emit('selectNotification')"
@ -12,6 +13,7 @@
<follow v-else-if="message.type === 'follow'" <follow v-else-if="message.type === 'follow'"
:message="message" :message="message"
:focused="focused" :focused="focused"
:overlaid="overlaid"
@focusNext="$emit('focusNext')" @focusNext="$emit('focusNext')"
@focusPrev="$emit('focusPrev')" @focusPrev="$emit('focusPrev')"
@select="$emit('selectNotification')" @select="$emit('selectNotification')"
@ -21,6 +23,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="focused" :focused="focused"
:overlaid="overlaid"
@focusNext="$emit('focusNext')" @focusNext="$emit('focusNext')"
@focusPrev="$emit('focusPrev')" @focusPrev="$emit('focusPrev')"
@select="$emit('selectNotification')" @select="$emit('selectNotification')"
@ -30,6 +33,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="focused" :focused="focused"
:overlaid="overlaid"
@focusNext="$emit('focusNext')" @focusNext="$emit('focusNext')"
@focusPrev="$emit('focusPrev')" @focusPrev="$emit('focusPrev')"
@select="$emit('selectNotification')" @select="$emit('selectNotification')"
@ -58,6 +62,10 @@ export default {
focused: { focused: {
type: Boolean, type: Boolean,
defalt: false defalt: false
},
overlaid: {
type: Boolean,
default: false
} }
}, },
components: { Favourite, Follow, Mention, Reblog } components: { Favourite, Follow, Mention, Reblog }

View File

@ -2,7 +2,7 @@
<div <div
class="status" class="status"
tabIndex="0" tabIndex="0"
v-shortkey="focused ? {next: ['j'], prev: ['k']} : {}" v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k']} : {}"
@shortkey="handleStatusControl" @shortkey="handleStatusControl"
ref="status" ref="status"
@click="$emit('select')" @click="$emit('select')"
@ -91,6 +91,10 @@ export default {
focused: { focused: {
type: Boolean, type: Boolean,
default: false default: false
},
overlaid: {
type: Boolean,
default: false
} }
}, },
data () { data () {
@ -99,6 +103,11 @@ export default {
showAttachments: false showAttachments: false
} }
}, },
computed: {
shortcutEnabled: function () {
return this.focused && !this.overlaid
}
},
mounted () { mounted () {
if (this.focused) { if (this.focused) {
this.$refs.status.focus() this.$refs.status.focus()

View File

@ -2,7 +2,7 @@
<div <div
class="follow" class="follow"
tabIndex="0" tabIndex="0"
v-shortkey="focused ? {next: ['j'], prev: ['k']} : {}" v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k']} : {}"
@shortkey="handleStatusControl" @shortkey="handleStatusControl"
ref="status" ref="status"
@click="$emit('select')" @click="$emit('select')"
@ -34,6 +34,15 @@ export default {
focused: { focused: {
type: Boolean, type: Boolean,
default: false default: false
},
overlaid: {
type: Boolean,
default: false
}
},
computed: {
shortcutEnabled: function () {
return this.focused && !this.overlaid
} }
}, },
mounted () { mounted () {

View File

@ -4,6 +4,7 @@
:message="message.status" :message="message.status"
:filter="filter" :filter="filter"
:focused="focused" :focused="focused"
:overlaid="overlaid"
v-on:update="updateToot" v-on:update="updateToot"
@focusNext="$emit('focusNext')" @focusNext="$emit('focusNext')"
@focusPrev="$emit('focusPrev')" @focusPrev="$emit('focusPrev')"
@ -30,6 +31,10 @@ export default {
focused: { focused: {
type: Boolean, type: Boolean,
default: false default: false
},
overlaid: {
type: Boolean,
default: false
} }
}, },
components: { Toot }, components: { Toot },

View File

@ -2,7 +2,7 @@
<div <div
class="status" class="status"
tabIndex="0" tabIndex="0"
v-shortkey="focused ? {next: ['j'], prev: ['k']} : {}" v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k']} : {}"
@shortkey="handleStatusControl" @shortkey="handleStatusControl"
ref="status" ref="status"
@click="$emit('select')" @click="$emit('select')"
@ -91,6 +91,10 @@ export default {
focused: { focused: {
type: Boolean, type: Boolean,
default: false default: false
},
overlaid: {
type: Boolean,
default: false
} }
}, },
data () { data () {
@ -99,6 +103,11 @@ export default {
showAttachments: false showAttachments: false
} }
}, },
computed: {
shortcutEnabled: function () {
return this.focused && !this.overlaid
}
},
mounted () { mounted () {
if (this.focused) { if (this.focused) {
this.$refs.status.focus() this.$refs.status.focus()

View File

@ -2,7 +2,7 @@
<div <div
class="status" class="status"
tabIndex="0" tabIndex="0"
v-shortkey="focused ? {next: ['j'], prev: ['k'], reply: ['r'], boost: ['b'], fav: ['f'], open: ['o'], profile: ['p']} : {}" v-shortkey="shortcutEnabled ? {next: ['j'], prev: ['k'], reply: ['r'], boost: ['b'], fav: ['f'], open: ['o'], profile: ['p']} : {}"
@shortkey="handleTootControl" @shortkey="handleTootControl"
ref="status" ref="status"
@click="$emit('selectToot')" @click="$emit('selectToot')"
@ -142,12 +142,19 @@ export default {
focused: { focused: {
type: Boolean, type: Boolean,
default: false default: false
},
overlaid: {
type: Boolean,
default: false
} }
}, },
computed: { computed: {
...mapState({ ...mapState({
displayNameStyle: state => state.App.displayNameStyle displayNameStyle: state => state.App.displayNameStyle
}) }),
shortcutEnabled: function () {
return this.focused && !this.overlaid
}
}, },
mounted () { mounted () {
if (this.focused) { if (this.focused) {
@ -387,6 +394,7 @@ export default {
handleTootControl (event) { handleTootControl (event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'next': case 'next':
console.log(this.shortcutEnabled)
this.$emit('focusNext') this.$emit('focusNext')
break break
case 'prev': case 'prev':

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="favourites" v-shortkey="{next: ['j']}" @shortkey="handleKey"> <div id="favourites" v-shortkey="shortcutEnabled ? {next: ['j']} : {}" @shortkey="handleKey">
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()"> <div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div> </div>
<div class="fav" v-for="message in favourites" v-bind:key="message.id"> <div class="fav" v-for="message in favourites" v-bind:key="message.id">
@ -7,6 +7,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="message.uri === focusedId" :focused="message.uri === focusedId"
:overlaid="modalOpened"
v-on:update="updateToot" v-on:update="updateToot"
v-on:delete="deleteToot" v-on:delete="deleteToot"
@focusNext="focusNext" @focusNext="focusNext"
@ -25,7 +26,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Toot from './Cards/Toot' import Toot from './Cards/Toot'
import scrollTop from '../../utils/scroll' import scrollTop from '../../utils/scroll'
@ -46,7 +47,13 @@ export default {
favourites: state => state.TimelineSpace.Contents.Favourites.favourites, favourites: state => state.TimelineSpace.Contents.Favourites.favourites,
lazyLoading: state => state.TimelineSpace.Contents.Favourites.lazyLoading, lazyLoading: state => state.TimelineSpace.Contents.Favourites.lazyLoading,
filter: state => state.TimelineSpace.Contents.Favourites.filter filter: state => state.TimelineSpace.Contents.Favourites.filter
}) }),
...mapGetters('TimelineSpace/Modals', [
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
}
}, },
created () { created () {
this.$store.commit('TimelineSpace/changeLoading', true) this.$store.commit('TimelineSpace/changeLoading', true)
@ -171,9 +178,7 @@ export default {
handleKey (event) { handleKey (event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'next': case 'next':
if (!this.focusedId) { this.focusedId = this.favourites[0].uri
this.focusedId = this.favourites[0].uri
}
break break
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<div name="tag" v-shortkey="{next:['j']}" @shortkey="handleKey"> <div name="tag" v-shortkey="shortcutEnabled ? {next:['j']} : {}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div> <div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()"> <div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div> </div>
@ -9,6 +9,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="message.uri === focusedId" :focused="message.uri === focusedId"
:overlaid="modalOpened"
v-on:update="updateToot" v-on:update="updateToot"
v-on:delete="deleteToot" v-on:delete="deleteToot"
@focusNext="focusNext" @focusNext="focusNext"
@ -27,7 +28,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Toot from '../Cards/Toot' import Toot from '../Cards/Toot'
import scrollTop from '../../../utils/scroll' import scrollTop from '../../../utils/scroll'
@ -49,7 +50,13 @@ export default {
heading: state => state.TimelineSpace.Contents.Hashtag.Tag.heading, heading: state => state.TimelineSpace.Contents.Hashtag.Tag.heading,
unread: state => state.TimelineSpace.Contents.Hashtag.Tag.unreadTimeline, unread: state => state.TimelineSpace.Contents.Hashtag.Tag.unreadTimeline,
filter: state => state.TimelineSpace.Contents.Hashtag.Tag.filter filter: state => state.TimelineSpace.Contents.Hashtag.Tag.filter
}) }),
...mapGetters('TimelineSpace/Modals', [
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
}
}, },
mounted () { mounted () {
this.$store.commit('TimelineSpace/changeLoading', true) this.$store.commit('TimelineSpace/changeLoading', true)
@ -209,9 +216,7 @@ export default {
handleKey (event) { handleKey (event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'next': case 'next':
if (!this.focusedId) { this.focusedId = this.timeline[0].uri
this.focusedId = this.timeline[0].uri
}
break break
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="home" v-shortkey="{next: ['j']}" @shortkey="handleKey"> <div id="home" v-shortkey="shortcutEnabled ? {next: ['j']} : {}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div> <div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()"> <div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div> </div>
@ -9,6 +9,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="message.uri === focusedId" :focused="message.uri === focusedId"
:overlaid="modalOpened"
v-on:update="updateToot" v-on:update="updateToot"
v-on:delete="deleteToot" v-on:delete="deleteToot"
@focusNext="focusNext" @focusNext="focusNext"
@ -28,7 +29,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Toot from './Cards/Toot' import Toot from './Cards/Toot'
import scrollTop from '../../utils/scroll' import scrollTop from '../../utils/scroll'
@ -49,7 +50,13 @@ export default {
heading: state => state.TimelineSpace.Contents.Home.heading, heading: state => state.TimelineSpace.Contents.Home.heading,
unread: state => state.TimelineSpace.Contents.Home.unreadTimeline, unread: state => state.TimelineSpace.Contents.Home.unreadTimeline,
filter: state => state.TimelineSpace.Contents.Home.filter filter: state => state.TimelineSpace.Contents.Home.filter
}) }),
...mapGetters('TimelineSpace/Modals', [
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
}
}, },
mounted () { mounted () {
this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false) this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false)
@ -176,9 +183,7 @@ export default {
handleKey (event) { handleKey (event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'next': case 'next':
if (!this.focusedId) { this.focusedId = this.timeline[0].uri
this.focusedId = this.timeline[0].uri
}
break break
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<div name="list"> <div name="list" v-shortkey="shortcutEnabled ? {next:['j']} : {}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div> <div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()"> <div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div> </div>
@ -9,6 +9,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="message.uri === focusedId" :focused="message.uri === focusedId"
:overlaid="modalOpened"
v-on:update="updateToot" v-on:update="updateToot"
v-on:delete="deleteToot" v-on:delete="deleteToot"
@focusNext="focusNext" @focusNext="focusNext"
@ -27,7 +28,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Toot from '../Cards/Toot' import Toot from '../Cards/Toot'
import scrollTop from '../../../utils/scroll' import scrollTop from '../../../utils/scroll'
@ -49,7 +50,13 @@ export default {
heading: state => state.TimelineSpace.Contents.Lists.Show.heading, heading: state => state.TimelineSpace.Contents.Lists.Show.heading,
unread: state => state.TimelineSpace.Contents.Lists.Show.unreadTimeline, unread: state => state.TimelineSpace.Contents.Lists.Show.unreadTimeline,
filter: state => state.TimelineSpace.Contents.Lists.Show.filter filter: state => state.TimelineSpace.Contents.Lists.Show.filter
}) }),
...mapGetters('TimelineSpace/Modals', [
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
}
}, },
created () { created () {
this.$store.commit('TimelineSpace/changeLoading', true) this.$store.commit('TimelineSpace/changeLoading', true)
@ -201,6 +208,13 @@ export default {
}, },
focusToot (message) { focusToot (message) {
this.focusedId = message.uri this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
this.focusedId = this.timeline[0].uri
break
}
} }
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="local" v-shortkey="{next: ['j']}" @shortkey="handleKey"> <div id="local" v-shortkey="shortcutEnabled ? {next: ['j']} : {}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div> <div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()"> <div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div> </div>
@ -9,6 +9,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="message.uri === focusedId" :focused="message.uri === focusedId"
:overlaid="modalOpened"
v-on:update="updateToot" v-on:update="updateToot"
v-on:delete="deleteToot" v-on:delete="deleteToot"
@focusNext="focusNext" @focusNext="focusNext"
@ -28,7 +29,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Toot from './Cards/Toot' import Toot from './Cards/Toot'
import scrollTop from '../../utils/scroll' import scrollTop from '../../utils/scroll'
@ -49,7 +50,13 @@ export default {
heading: state => state.TimelineSpace.Contents.Local.heading, heading: state => state.TimelineSpace.Contents.Local.heading,
unread: state => state.TimelineSpace.Contents.Local.unreadTimeline, unread: state => state.TimelineSpace.Contents.Local.unreadTimeline,
filter: state => state.TimelineSpace.Contents.Local.filter filter: state => state.TimelineSpace.Contents.Local.filter
}) }),
...mapGetters('TimelineSpace/Modals', [
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
}
}, },
mounted () { mounted () {
this.$store.commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', false) this.$store.commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', false)
@ -79,6 +86,7 @@ export default {
} }
}, },
focusedId: function (newState, oldState) { focusedId: function (newState, oldState) {
console.log(newState)
if (newState && this.heading) { if (newState && this.heading) {
this.$store.commit('TimelineSpace/Contents/Local/changeHeading', false) this.$store.commit('TimelineSpace/Contents/Local/changeHeading', false)
} else if (newState === null && !this.heading) { } else if (newState === null && !this.heading) {
@ -155,6 +163,7 @@ export default {
}, },
focusNext () { focusNext () {
const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri) const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri)
console.log(currentIndex)
if (currentIndex === -1) { if (currentIndex === -1) {
this.focusedId = this.timeline[0].uri this.focusedId = this.timeline[0].uri
} else if (currentIndex < this.timeline.length) { } else if (currentIndex < this.timeline.length) {
@ -171,13 +180,12 @@ export default {
}, },
focusToot (message) { focusToot (message) {
this.focusedId = message.uri this.focusedId = message.uri
console.log(this.focusedId)
}, },
handleKey (event) { handleKey (event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'next': case 'next':
if (!this.focusedId) { this.focusedId = this.timeline[0].uri
this.focusedId = this.timeline[0].uri
}
break break
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="notifications" v-shortkey="{next: ['j']}" @shortkey="handleKey"> <div id="notifications" v-shortkey="shortcutEnabled ? {next: ['j']} : {}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div> <div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()"> <div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div> </div>
@ -9,6 +9,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="index === focusedIndex" :focused="index === focusedIndex"
:overlaid="modalOpened"
@focusNext="focusNext" @focusNext="focusNext"
@focusPrev="focusPrev" @focusPrev="focusPrev"
@selectNotification="focusNotification(index)" @selectNotification="focusNotification(index)"
@ -26,7 +27,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Notification from './Cards/Notification' import Notification from './Cards/Notification'
import scrollTop from '../../utils/scroll' import scrollTop from '../../utils/scroll'
@ -47,7 +48,13 @@ export default {
heading: state => state.TimelineSpace.Contents.Notifications.heading, heading: state => state.TimelineSpace.Contents.Notifications.heading,
unread: state => state.TimelineSpace.Contents.Notifications.unreadNotifications, unread: state => state.TimelineSpace.Contents.Notifications.unreadNotifications,
filter: state => state.TimelineSpace.Contents.Notifications.filter filter: state => state.TimelineSpace.Contents.Notifications.filter
}) }),
...mapGetters('TimelineSpace/Modals', [
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedIndex && !this.modalOpened
}
}, },
mounted () { mounted () {
this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false) this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false)
@ -161,9 +168,7 @@ export default {
handleKey (event) { handleKey (event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'next': case 'next':
if (!this.focusedIndex) { this.focusedIndex = 0
this.focusedIndex = 0
}
break break
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="public" v-shortkey="{next: ['j']}" @shortkey="handleKey"> <div id="public" v-shortkey="shortcutEnabled ? {next: ['j']} : {}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div> <div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()"> <div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div> </div>
@ -9,6 +9,7 @@
:message="message" :message="message"
:filter="filter" :filter="filter"
:focused="message.uri === focusedId" :focused="message.uri === focusedId"
:overlaid="modalOpened"
v-on:update="updateToot" v-on:update="updateToot"
v-on:delete="deleteToot" v-on:delete="deleteToot"
@focusNext="focusNext" @focusNext="focusNext"
@ -28,7 +29,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState, mapGetters } from 'vuex'
import Toot from './Cards/Toot' import Toot from './Cards/Toot'
import scrollTop from '../../utils/scroll' import scrollTop from '../../utils/scroll'
@ -49,7 +50,13 @@ export default {
heading: state => state.TimelineSpace.Contents.Public.heading, heading: state => state.TimelineSpace.Contents.Public.heading,
unread: state => state.TimelineSpace.Contents.Public.unreadTimeline, unread: state => state.TimelineSpace.Contents.Public.unreadTimeline,
filter: state => state.TimelineSpace.Contents.Public.filter filter: state => state.TimelineSpace.Contents.Public.filter
}) }),
...mapGetters('TimelineSpace/Modals', [
'modalOpened'
]),
shortcutEnabled: function () {
return !this.focusedId && !this.modalOpened
}
}, },
created () { created () {
this.$store.commit('TimelineSpace/changeLoading', true) this.$store.commit('TimelineSpace/changeLoading', true)
@ -198,9 +205,7 @@ export default {
handleKey (event) { handleKey (event) {
switch (event.srcKey) { switch (event.srcKey) {
case 'next': case 'next':
if (!this.focusedId) { this.focusedId = this.timeline[0].uri
this.focusedId = this.timeline[0].uri
}
break break
} }
} }

View File

@ -14,6 +14,17 @@ const Modals = {
ListMembership, ListMembership,
AddListMember, AddListMember,
Shortcut Shortcut
},
getters: {
modalOpened: (state, getters, rootState) => {
const imageViewer = rootState.TimelineSpace.Modals.ImageViewer.modalOpen
const newToot = rootState.TimelineSpace.Modals.NewToot.modalOpen
const jump = rootState.TimelineSpace.Modals.Jump.modalOpen
const listMembership = rootState.TimelineSpace.Modals.ListMembership.modalOpen
const addListMember = rootState.TimelineSpace.Modals.AddListMember.modalOpen
const shortcut = rootState.TimelineSpace.Modals.Jump.modalOpen
return imageViewer || newToot || jump || listMembership || addListMember || shortcut
}
} }
} }