mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
keyboard fixes
This commit is contained in:
parent
18437d1be7
commit
e52fbd5034
@ -42,20 +42,25 @@ export async function asyncFilter(arr, predicate) {
|
|||||||
|
|
||||||
export function isMac() {
|
export function isMac() {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const platform = navigator?.platform || navigator?.userAgentData?.platform || 'unknown'
|
const platform = navigator?.platform || navigator?.userAgentData?.platform || 'unknown';
|
||||||
return platform.toUpperCase().indexOf('MAC') >= 0;
|
return platform.toUpperCase().indexOf('MAC') >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatKeyText(keyText: string): string {
|
export function formatKeyText(keyText: string): string {
|
||||||
if (isMac()) {
|
if (isMac()) {
|
||||||
return keyText.replace('CtrlOrCommand+', '⌘ ').replace('Shift+', '⇧ ').replace('Alt+', '⌥ ')
|
return keyText
|
||||||
|
.replace('CtrlOrCommand+', '⌘ ')
|
||||||
|
.replace('Shift+', '⇧ ')
|
||||||
|
.replace('Alt+', '⌥ ')
|
||||||
|
.replace('Command+', '⌘ ')
|
||||||
|
.replace('Ctrl+', '⌃ ');
|
||||||
}
|
}
|
||||||
return keyText.replace('CtrlOrCommand+', 'Ctrl+');
|
return keyText.replace('CtrlOrCommand+', 'Ctrl+');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveKeyText(keyText: string): string {
|
export function resolveKeyText(keyText: string): string {
|
||||||
if (isMac()) {
|
if (isMac()) {
|
||||||
return keyText.replace('CtrlOrCommand+', 'Command+')
|
return keyText.replace('CtrlOrCommand+', 'Command+');
|
||||||
}
|
}
|
||||||
return keyText.replace('CtrlOrCommand+', 'Ctrl+');
|
return keyText.replace('CtrlOrCommand+', 'Ctrl+');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user