readability keyboard shortcut

This commit is contained in:
Nazar Kanaev 2021-04-05 11:49:10 +01:00
parent f590c358d2
commit b123753d65
3 changed files with 12 additions and 2 deletions

View File

@ -237,7 +237,7 @@
</dropdown> </dropdown>
<button class="toolbar-item" <button class="toolbar-item"
:class="{active: itemSelectedReadability}" :class="{active: itemSelectedReadability}"
@click="getReadable(itemSelectedDetails)" @click="toggleReadability()"
title="Read Here"> title="Read Here">
<span class="icon" :class="{'icon-loading': loading.readability}">{% inline "book-open.svg" %}</span> <span class="icon" :class="{'icon-loading': loading.readability}">{% inline "book-open.svg" %}</span>
</button> </button>
@ -421,6 +421,10 @@
<td><kbd>o</kbd></td> <td><kbd>o</kbd></td>
<td>open an article's link</td> <td>open an article's link</td>
</tr> </tr>
<tr>
<td><kbd>i</kbd></td>
<td>read here</td>
</tr>
<tr> <tr>
<td> <td>
<kbd>f</kbd> <kbd>f</kbd>

View File

@ -573,11 +573,13 @@ var vm = new Vue({
document.location.reload() document.location.reload()
}) })
}, },
getReadable: function(item) { toggleReadability: function() {
if (this.itemSelectedReadability) { if (this.itemSelectedReadability) {
this.itemSelectedReadability = null this.itemSelectedReadability = null
return return
} }
var item = this.itemSelectedDetails
if (!item) return
if (item.link) { if (item.link) {
this.loading.readability = true this.loading.readability = true
api.crawl(item.link).then(function(data) { api.crawl(item.link).then(function(data) {

View File

@ -95,6 +95,9 @@ var shortcutFunctions = {
window.open(vm.itemSelectedDetails.link, '_blank') window.open(vm.itemSelectedDetails.link, '_blank')
} }
}, },
toggleReadability: function() {
vm.toggleReadability()
},
toggleItemRead: function() { toggleItemRead: function() {
if (vm.itemSelected != null) { if (vm.itemSelected != null) {
vm.toggleItemRead(vm.itemSelectedDetails) vm.toggleItemRead(vm.itemSelectedDetails)
@ -146,6 +149,7 @@ var shortcutFunctions = {
// If you edit, make sure you update the help modal // If you edit, make sure you update the help modal
var keybindings = { var keybindings = {
"o": shortcutFunctions.openItemLink, "o": shortcutFunctions.openItemLink,
"i": shortcutFunctions.toggleReadability,
"r": shortcutFunctions.toggleItemRead, "r": shortcutFunctions.toggleItemRead,
"R": shortcutFunctions.markAllRead, "R": shortcutFunctions.markAllRead,
"s": shortcutFunctions.toggleItemStarred, "s": shortcutFunctions.toggleItemStarred,