Adds keyboard shortcut for editing last message sent
This commit is contained in:
parent
a1fd4e55ee
commit
216ee67c50
13 changed files with 675 additions and 550 deletions
|
@ -181,6 +181,29 @@ export function useToggleReactionPicker(
|
|||
);
|
||||
}
|
||||
|
||||
export function useEditLastMessageSent(
|
||||
maybeEditMessage: () => boolean
|
||||
): KeyboardShortcutHandlerType {
|
||||
return useCallback(
|
||||
ev => {
|
||||
const key = KeyboardLayout.lookup(ev);
|
||||
|
||||
if (key === 'ArrowUp') {
|
||||
const value = maybeEditMessage();
|
||||
if (value) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
[maybeEditMessage]
|
||||
);
|
||||
}
|
||||
|
||||
export function useKeyboardShortcuts(
|
||||
...eventHandlers: Array<KeyboardShortcutHandlerType>
|
||||
): void {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue