chore: add english comment

This commit is contained in:
jialin
2024-08-28 14:51:20 +08:00
parent 9a0aeb491a
commit 9bd6dedd90
28 changed files with 353 additions and 145 deletions
+55 -12
View File
@@ -1,17 +1,60 @@
export default {
CREATE: ['ctrl+alt+n', 'option+meta+n'],
SAVE: ['ctrl+s', 'meta+s'],
import { platformCall } from '@/utils';
const platform = platformCall();
const KeybindingsMap = {
CREATE: ['alt+ctrl+N', 'alt+meta+N'],
CLEAR: ['alt+ctrl+W', 'alt+meta+W'],
RIGHT: ['ctrl+RIGHT', 'meta+RIGHT'],
SAVE: ['ctrl+S', 'meta+S'],
SUBMIT: ['ctrl+enter', 'meta+enter'],
SAVEAS: ['ctrl+shift+s', 'meta+shift+s'],
OPEN: ['ctrl+o', 'meta+o'],
CANCEL: ['ctrl+w', 'meta+w'],
SAVEAS: ['alt+ctrl+S', 'alt+meta+S'],
OPEN: ['alt+ctrl+O', 'alt+meta+O'],
CANCEL: ['ctrl+W', 'meta+W'],
DELETE: ['delete'],
COPY: ['ctrl+c', 'meta+c'],
REFRESH: ['ctrl+r', 'meta+r'],
EDIT: ['ctrl+e', 'meta+e'],
SEARCH: ['ctrl+f', 'meta+f'],
RESET: ['ctrl+shift+r', 'meta+shift+r'],
INPUT: ['ctrl+k', 'meta+k'],
COPY: ['ctrl+C', 'meta+C'],
REFRESH: ['ctrl+R', 'meta+R'],
EDIT: ['ctrl+E', 'meta+E'],
SEARCH: ['ctrl+K', 'meta+K'],
RESET: ['alt+ctrl+R', 'alt+meta+R'],
INPUT: ['ctrl+K', 'meta+K'],
NEW1: ['ctrl+1', 'meta+1'],
NEW2: ['ctrl+2', 'meta+2']
};
type KeyBindingType = keyof typeof KeybindingsMap;
type KeybindingValue = {
keybinding: string;
command: KeyBindingType;
textKeybinding: string;
iconKeybinding: string;
};
const KeybiningList: KeybindingValue[] = Object.entries(KeybindingsMap).map(
([key, value]) => {
const keybinding = platform.isMac ? value[1] || value[0] : value[0];
return {
keybinding: keybinding,
command: key,
textKeybinding: platform.isMac
? keybinding.replace('meta', 'Command').replace('alt', 'Option')
: keybinding.replace('ctrl', 'Ctrl'),
iconKeybinding: platform.isMac
? keybinding.replace('meta', '⌘').replace('alt', '⌥')
: keybinding.replace('ctrl', 'Ctrl')
} as KeybindingValue;
}
);
const KeyMap: Record<KeyBindingType, KeybindingValue> = KeybiningList.reduce(
(acc: any, item) => {
acc[item.command] = item;
return acc;
},
{}
);
console.log('KeyMap=========', KeyMap);
export { KeyMap, KeybiningList };
export default KeybindingsMap;