mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-24 05:29:51 +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);
|
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