mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 21:23:59 +00:00
keyboard fixes
This commit is contained in:
@@ -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+');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user