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 = [
|
export const KEYBOARD_SHORTCUTS = [
|
||||||
{
|
{
|
||||||
title: 'keyboardShortcuts.general',
|
title: 'keyboardShortcuts.general',
|
||||||
|
@ -5,11 +9,11 @@ export const KEYBOARD_SHORTCUTS = [
|
||||||
shortcuts: [
|
shortcuts: [
|
||||||
{
|
{
|
||||||
title: 'keyboardShortcuts.toggleMenu',
|
title: 'keyboardShortcuts.toggleMenu',
|
||||||
keys: ['ctrl', 'e'],
|
keys: [ctrl, 'e'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'keyboardShortcuts.quickSearch',
|
title: 'keyboardShortcuts.quickSearch',
|
||||||
keys: ['ctrl', 'k'],
|
keys: [ctrl, 'k'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -19,7 +23,7 @@ export const KEYBOARD_SHORTCUTS = [
|
||||||
shortcuts: [
|
shortcuts: [
|
||||||
{
|
{
|
||||||
title: 'keyboardShortcuts.task.done',
|
title: 'keyboardShortcuts.task.done',
|
||||||
keys: ['ctrl', 'click'],
|
keys: [ctrl, 'click'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<span class="shortcuts">
|
<span class="shortcuts">
|
||||||
<template v-for="(k, i) in keys" :key="i">
|
<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>
|
<span v-if="i < keys.length - 1">{{ combination }}</span>
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {isMac} from '@/helpers/isMac'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'shortcut',
|
name: 'shortcut',
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isMac: isMac(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
keys: {
|
keys: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
|
Loading…
Reference in New Issue