fix: check if a shortcut has an available function before trying to invoke it

This commit is contained in:
kolaente 2022-01-18 21:51:24 +01:00
parent e2d9aa3d7f
commit 8233c8c953
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -4,9 +4,9 @@
<template v-for="(s, i) in shortcuts" :key="i">
<h3>{{ $t(s.title) }}</h3>
<message class="mb-4">
<message class="mb-4" v-if="s.available">
{{
s?.available($route)
s.available($route)
? $t('keyboardShortcuts.currentPageOnly')
: $t('keyboardShortcuts.allPages')
}}
@ -37,6 +37,8 @@ import Message from '@/components/misc/message.vue'
import {KEYBOARD_SHORTCUTS_ACTIVE} from '@/store/mutation-types'
import {KEYBOARD_SHORTCUTS as shortcuts} from './shortcuts'
console.log('s', shortcuts)
function close() {
store.commit(KEYBOARD_SHORTCUTS_ACTIVE, false)
}