upd: 调整 macOS 上快捷键展示

This commit is contained in:
purocean
2021-08-02 11:37:07 +08:00
parent b20460ddf3
commit 9b8c2e3fb6
+7 -4
View File
@@ -29,10 +29,13 @@ export const hasCtrlCmd = (e: KeyboardEvent | MouseEvent) => isMacOS ? e.metaKey
export const getKeyLabel = (key: XKey | string | number) => {
switch (key) {
case CtrlCmd:
return isMacOS ? 'Cmd' : 'Ctrl'
return isMacOS ? '⌘' : 'Ctrl'
case Alt:
return isMacOS ? 'Option' : 'Alt'
return isMacOS ? '⌥' : 'Alt'
case Ctrl:
return isMacOS ? '⌃' : 'Ctrl'
case Shift:
return isMacOS ? '⇧' : 'Shift'
default:
return upperFirst(key.toString())
@@ -106,7 +109,7 @@ export function getKeysLabel (id: string): string {
return ''
}
return command.keys.map(getKeyLabel).join('+')
return command.keys.map(getKeyLabel).join(isMacOS ? ' ' : '+')
}
export function registerCommand (command: Command) {