Make Compose hotkey open Compose modal when required

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2023-07-18 01:06:53 +02:00
parent 36083fe1b8
commit d01f86af22
3 changed files with 5 additions and 4 deletions

View File

@@ -49,12 +49,13 @@ const GlobalHotkeys: React.FC<IGlobalHotkeys> = ({ children, node }) => {
const handleHotkeyNew = (e?: KeyboardEvent) => {
e?.preventDefault();
if (!node.current) return;
const element = node.current.querySelector('textarea#compose-textarea') as HTMLTextAreaElement;
const element = node.current?.querySelector('textarea#compose-textarea') as HTMLTextAreaElement;
if (element) {
element.focus();
} else {
dispatch(openModal('COMPOSE'));
}
};