refs #543 Start focus with j key in favourite

This commit is contained in:
AkiraFukushima 2018-08-22 19:20:41 +09:00
parent 76a83320d1
commit 7ea3ffb4f0
4 changed files with 13 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<div <div
class="status" class="status"
tabIndex="0" tabIndex="0"
v-shortkey="{next: ['j'], prev: ['k']}" v-shortkey="focused ? {next: ['j'], prev: ['k']} : {}"
@shortkey="handleStatusControl" @shortkey="handleStatusControl"
ref="status" ref="status"
@click="$emit('select')" @click="$emit('select')"

View File

@ -2,7 +2,7 @@
<div <div
class="follow" class="follow"
tabIndex="0" tabIndex="0"
v-shortkey="{next: ['j'], prev: ['k']}" v-shortkey="focused ? {next: ['j'], prev: ['k']} : {}"
@shortkey="handleStatusControl" @shortkey="handleStatusControl"
ref="status" ref="status"
@click="$emit('select')" @click="$emit('select')"

View File

@ -2,7 +2,7 @@
<div <div
class="status" class="status"
tabIndex="0" tabIndex="0"
v-shortkey="{next: ['j'], prev: ['k']}" v-shortkey="focused ? {next: ['j'], prev: ['k']} : {}"
@shortkey="handleStatusControl" @shortkey="handleStatusControl"
ref="status" ref="status"
@click="$emit('select')" @click="$emit('select')"

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="notifications"> <div id="notifications" v-shortkey="{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>
@ -157,6 +157,15 @@ export default {
}, },
focusNotification (index) { focusNotification (index) {
this.focusedIndex = index this.focusedIndex = index
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedIndex) {
this.focusedIndex = 0
}
break
}
} }
} }
} }