mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-23 16:56:08 +08:00
6ef0a49c26
- Reload the menu after changing keymap sets - Do not allow accelerators in the menu like "z", because they do not go through selector-based command matching and always fire into the window. - Do not match `cmdctrl` to both `cmd` and `ctrl` on the Mac. Just `cmd` - Re-order `shift-delete` mapping to `core:cut`, because it causes the menu to have no binding on Mac OS X
19 lines
483 B
CoffeeScript
19 lines
483 B
CoffeeScript
KeymapUtils =
|
|
cmdCtrlPreprocessor: (keymap={}) ->
|
|
re = /(cmdctrl|ctrlcmd)/i
|
|
if process.platform is "darwin"
|
|
cmdctrl = 'cmd'
|
|
else
|
|
cmdctrl = 'ctrl'
|
|
|
|
for selector, keyBindings of keymap
|
|
normalizedBindings = {}
|
|
for keystrokes, command of keyBindings
|
|
keystrokes = keystrokes.replace(re, cmdctrl)
|
|
normalizedBindings[keystrokes] = command
|
|
keymap[selector] = normalizedBindings
|
|
|
|
return keymap
|
|
|
|
module.exports = KeymapUtils
|