Handle cmd+shift+e keyboard shortcut
This commit is contained in:
parent
1109415dc1
commit
bc4f3dcd01
3 changed files with 41 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue