forked from vikunja/frontend
chore: only check for mac once
This commit is contained in:
parent
e7114d24e9
commit
ff52ceb92e
|
@ -1,3 +1,7 @@
|
|||
import {isMac} from '@/helpers/isMac'
|
||||
|
||||
const ctrl = isMac() ? '⌘' : 'ctrl'
|
||||
|
||||
export const KEYBOARD_SHORTCUTS = [
|
||||
{
|
||||
title: 'keyboardShortcuts.general',
|
||||
|
@ -5,11 +9,11 @@ export const KEYBOARD_SHORTCUTS = [
|
|||
shortcuts: [
|
||||
{
|
||||
title: 'keyboardShortcuts.toggleMenu',
|
||||
keys: ['ctrl', 'e'],
|
||||
keys: [ctrl, 'e'],
|
||||
},
|
||||
{
|
||||
title: 'keyboardShortcuts.quickSearch',
|
||||
keys: ['ctrl', 'k'],
|
||||
keys: [ctrl, 'k'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -19,7 +23,7 @@ export const KEYBOARD_SHORTCUTS = [
|
|||
shortcuts: [
|
||||
{
|
||||
title: 'keyboardShortcuts.task.done',
|
||||
keys: ['ctrl', 'click'],
|
||||
keys: [ctrl, 'click'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,22 +1,15 @@
|
|||
<template>
|
||||
<span class="shortcuts">
|
||||
<template v-for="(k, i) in keys" :key="i">
|
||||
<kbd>{{ isMac ? k.replace('ctrl', '⌘') : k }}</kbd>
|
||||
<kbd>{{ k }}</kbd>
|
||||
<span v-if="i < keys.length - 1">{{ combination }}</span>
|
||||
</template>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {isMac} from '@/helpers/isMac'
|
||||
|
||||
export default {
|
||||
name: 'shortcut',
|
||||
data() {
|
||||
return {
|
||||
isMac: isMac(),
|
||||
}
|
||||
},
|
||||
props: {
|
||||
keys: {
|
||||
type: Array,
|
||||
|
|
Loading…
Reference in New Issue