Make Compose hotkey open Compose modal when required

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
environments/review-compose-ho-2th0de/deployments/3621
marcin mikołajczak 2023-07-18 01:06:53 +02:00
rodzic 36083fe1b8
commit d01f86af22
3 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -102,7 +102,7 @@ const HotkeysModal: React.FC<IHotkeysModal> = ({ onClose }) => {
</tr>
<tr>
<TableCell><Hotkey>n</Hotkey></TableCell>
<TableCell><FormattedMessage id='keyboard_shortcuts.compose' defaultMessage='to focus the compose textarea' /></TableCell>
<TableCell><FormattedMessage id='keyboard_shortcuts.compose' defaultMessage='to open the compose textarea' /></TableCell>
</tr>
<tr>
<TableCell><Hotkey>alt</Hotkey> + <Hotkey>n</Hotkey></TableCell>

Wyświetl plik

@ -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'));
}
};

Wyświetl plik

@ -912,7 +912,7 @@
"keyboard_shortcuts.back": "to navigate back",
"keyboard_shortcuts.blocked": "to open blocked users list",
"keyboard_shortcuts.boost": "to repost",
"keyboard_shortcuts.compose": "to focus the compose textarea",
"keyboard_shortcuts.compose": "to open the compose textarea",
"keyboard_shortcuts.down": "to move down in the list",
"keyboard_shortcuts.enter": "to open post",
"keyboard_shortcuts.favourite": "to like",