Merge pull request #557 from h3poteto/iss-543

closes #543 Add shortcut to control toot
This commit is contained in:
AkiraFukushima 2018-08-22 20:50:07 +09:00 committed by GitHub
commit 5163951539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 79 additions and 10 deletions

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<div
class="status"
tabIndex="0"
v-shortkey="{next: ['j'], prev: ['k']}"
v-shortkey="focused ? {next: ['j'], prev: ['k'], reply: ['r'], boost: ['b'], fav: ['f'], open: ['o'], profile: ['p']} : {}"
@shortkey="handleTootControl"
ref="status"
@click="$emit('selectToot')"
@ -392,6 +392,21 @@ export default {
case 'prev':
this.$emit('focusPrev')
break
case 'reply':
this.openReply(this.message)
break
case 'boost':
this.changeReblog(this.message)
break
case 'fav':
this.changeFavourite(this.message)
break
case 'open':
this.openDetail(this.message)
break
case 'profile':
this.openUser(this.originalMessage(this.message).account)
break
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="favourites">
<div id="favourites" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
<div class="fav" v-for="message in favourites" v-bind:key="message.id">
@ -167,6 +167,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.id
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.favourites[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div name="tag">
<div name="tag" v-shortkey="{next:['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -205,6 +205,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="home">
<div id="home" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -172,6 +172,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="local">
<div id="local" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -171,6 +171,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="notifications">
<div id="notifications" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -157,6 +157,15 @@ export default {
},
focusNotification (index) {
this.focusedIndex = index
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedIndex) {
this.focusedIndex = 0
}
break
}
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div id="public">
<div id="public" v-shortkey="{next: ['j']}" @shortkey="handleKey">
<div class="unread">{{ unread.length > 0 ? unread.length : '' }}</div>
<div v-shortkey="{linux: ['ctrl', 'r'], mac: ['meta', 'r']}" @shortkey="reload()">
</div>
@ -194,6 +194,15 @@ export default {
},
focusToot (message) {
this.focusedId = message.uri
},
handleKey (event) {
switch (event.srcKey) {
case 'next':
if (!this.focusedId) {
this.focusedId = this.timeline[0].uri
}
break
}
}
}
}