Handle cmd+shift+e keyboard shortcut

This commit is contained in:
Josh Perez 2022-12-02 19:40:33 -05:00 committed by GitHub
parent 1109415dc1
commit bc4f3dcd01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 0 deletions

View file

@ -159,6 +159,28 @@ export function useAttachFileShortcut(
);
}
export function useToggleReactionPicker(
handleReact: () => unknown
): KeyboardShortcutHandlerType {
return useCallback(
ev => {
const { shiftKey } = ev;
const key = KeyboardLayout.lookup(ev);
if (isCmdOrCtrl(ev) && shiftKey && (key === 'e' || key === 'E')) {
ev.preventDefault();
ev.stopPropagation();
handleReact();
return true;
}
return false;
},
[handleReact]
);
}
export function useKeyboardShortcuts(
...eventHandlers: Array<KeyboardShortcutHandlerType>
): void {