mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
fix: check hotkey and optimize hotkey input, close #287
This commit is contained in:
@@ -1,4 +1,26 @@
|
||||
const parseHotkey = (key: string) => {
|
||||
const KEY_MAP: Record<string, string> = {
|
||||
'"': "'",
|
||||
":": ";",
|
||||
"?": "/",
|
||||
">": ".",
|
||||
"<": ",",
|
||||
"{": "[",
|
||||
"}": "]",
|
||||
"|": "\\",
|
||||
"!": "1",
|
||||
"@": "2",
|
||||
"#": "3",
|
||||
$: "4",
|
||||
"%": "5",
|
||||
"^": "6",
|
||||
"&": "7",
|
||||
"*": "8",
|
||||
"(": "9",
|
||||
")": "0",
|
||||
"~": "`",
|
||||
};
|
||||
|
||||
export const parseHotkey = (key: string) => {
|
||||
let temp = key.toUpperCase();
|
||||
|
||||
if (temp.startsWith("ARROW")) {
|
||||
@@ -20,10 +42,7 @@ const parseHotkey = (key: string) => {
|
||||
return "CMD";
|
||||
case " ":
|
||||
return "SPACE";
|
||||
|
||||
default:
|
||||
return temp;
|
||||
return KEY_MAP[temp] || temp;
|
||||
}
|
||||
};
|
||||
|
||||
export default parseHotkey;
|
||||
|
||||
Reference in New Issue
Block a user