implement 'read all' and 'show' shortcuts

(A) -> show All
(U) -> show Unread
(S) -> show Starred
(R) -> mark all read
This commit is contained in:
Duarte Dias 2021-02-09 18:58:35 +00:00 committed by Nazar Kanaev
parent 1cdde4a6b8
commit bd12096e74

View File

@ -49,6 +49,12 @@ const shortcutFunctions = {
vm.toggleItemRead(vm.itemSelectedDetails)
}
},
markAllRead: function() {
// same condition as 'Mark all read button'
if(vm.filterSelected == 'unread'){
vm.markItemsRead()
}
},
toggleItemStarred: function() {
if(vm.itemSelected != null) {
vm.toggleItemStarred(vm.itemSelectedDetails)
@ -69,16 +75,29 @@ const shortcutFunctions = {
previousFeed() {
helperFunctions.navigateToFeed(-1)
},
showAll() {
vm.filterSelected = ''
},
showUnread() {
vm.filterSelected = 'unread'
},
showStarred() {
vm.filterSelected = 'starred'
},
}
const keybindings = {
"r": shortcutFunctions.toggleItemRead,
"R": shortcutFunctions.markAllRead,
"s": shortcutFunctions.toggleItemStarred,
"?": shortcutFunctions.focusSearch,
"j": shortcutFunctions.nextItem,
"k": shortcutFunctions.previousItem,
"l": shortcutFunctions.nextFeed,
"h": shortcutFunctions.previousFeed,
"A": shortcutFunctions.showAll,
"U": shortcutFunctions.showUnread,
"S": shortcutFunctions.showStarred,
}
function isTextBox(element) {