mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-17 22:11:59 +03:00
Hotkeys: Ctrl or Cmd + Enter
Add an utility to easily create the callback binding to an enter + ctrl or cmd in a component
This commit is contained in:
parent
29b37f5cab
commit
215af9fc79
@ -43,3 +43,11 @@ export function createKeybind(keybinds: KeybindDefinitions) {
|
||||
|
||||
return createKeybindingsHandler(keys);
|
||||
}
|
||||
|
||||
export function onMetaEnter(callback: () => void) {
|
||||
return (e: KeyboardEvent) => {
|
||||
if (e.key === KeyName.Enter && (e.metaKey || e.ctrlKey)) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user