mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
0c4d67698a
commit
75da247b23
1 changed files with 11 additions and 17 deletions
|
|
@ -334,28 +334,23 @@ export const updateHotkeyAfterTip = (hotkey: string) => {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
const KEY_MAP = new Map([
|
|
||||||
["⌘", "Ctrl"],
|
|
||||||
["⌃", "Ctrl"],
|
|
||||||
["⇧", "Shift"],
|
|
||||||
["⌥", "Alt"],
|
|
||||||
["⇥", "Tab"],
|
|
||||||
["⌫", "Backspace"],
|
|
||||||
["⌦", "Delete"],
|
|
||||||
["↩", "Enter"],
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Mac,Windows 快捷键展示
|
// Mac,Windows 快捷键展示
|
||||||
export const updateHotkeyTip = (hotkey: string) => {
|
export const updateHotkeyTip = (hotkey: string) => {
|
||||||
if (!hotkey) {
|
if (!hotkey||isMac()) {
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (isMac()) {
|
|
||||||
return hotkey;
|
return hotkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const KEY_MAP = new Map([
|
||||||
|
["⌘", "Ctrl"],
|
||||||
|
["⌃", "Ctrl"],
|
||||||
|
["⇧", "Shift"],
|
||||||
|
["⌥", "Alt"],
|
||||||
|
["⇥", "Tab"],
|
||||||
|
["⌫", "Backspace"],
|
||||||
|
["⌦", "Delete"],
|
||||||
|
["↩", "Enter"],
|
||||||
|
]);
|
||||||
const keys = [];
|
const keys = [];
|
||||||
|
|
||||||
if ((hotkey.indexOf("⌘") > -1 || hotkey.indexOf("⌃") > -1)) keys.push(KEY_MAP.get("⌘"));
|
if ((hotkey.indexOf("⌘") > -1 || hotkey.indexOf("⌃") > -1)) keys.push(KEY_MAP.get("⌘"));
|
||||||
if (hotkey.indexOf("⇧") > -1) keys.push(KEY_MAP.get("⇧"));
|
if (hotkey.indexOf("⇧") > -1) keys.push(KEY_MAP.get("⇧"));
|
||||||
if (hotkey.indexOf("⌥") > -1) keys.push(KEY_MAP.get("⌥"));
|
if (hotkey.indexOf("⌥") > -1) keys.push(KEY_MAP.get("⌥"));
|
||||||
|
|
@ -365,7 +360,6 @@ export const updateHotkeyTip = (hotkey: string) => {
|
||||||
if (lastKey) {
|
if (lastKey) {
|
||||||
keys.push(KEY_MAP.get(lastKey) || lastKey);
|
keys.push(KEY_MAP.get(lastKey) || lastKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return keys.join("+");
|
return keys.join("+");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue