This commit is contained in:
Vanessa 2022-09-25 12:25:01 +08:00
parent a59014cf2d
commit deab11f9d0
4 changed files with 61 additions and 66 deletions

View file

@ -86,12 +86,6 @@ export const updateHotkeyTip = (hotkey: string) => {
"⌦": "Delete",
"↩": "Enter",
}));
const SHIFT_KEY_MAP = new Map(Object.entries({
";": ":",
"=": "+",
"-": "_",
".": ">",
}));
const keys = [];
@ -101,12 +95,8 @@ export const updateHotkeyTip = (hotkey: string) => {
// 不能去最后一个,需匹配 F2
const lastKey = hotkey.replace(/⌘|⇧|⌥/g, "");
if ("⌘⇧⌥".indexOf(lastKey) < 0) {
keys.push(
KEY_MAP.get(lastKey)
|| (hotkey.indexOf("⇧") > -1 && SHIFT_KEY_MAP.get(lastKey))
|| lastKey
);
if (lastKey) {
keys.push(KEY_MAP.get(lastKey) || lastKey);
}
return keys.join("+");