Merge branch 'compose-hotkey' into 'develop'

Make Compose hotkey open Compose modal when required

See merge request soapbox-pub/soapbox!2607
environments/review-develop-3zknud/deployments/3622
marcin mikołajczak 2023-07-17 23:35:23 +00:00
commit 7944de8305
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",