[Glitch] Add `t` hotkey for post translations

Port 79a9069deb to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/2927/head
Claire 2025-01-03 10:24:50 +01:00
parent 68106f250c
commit 04be5e7f12
4 changed files with 11 additions and 0 deletions

View File

@ -473,6 +473,7 @@ class Status extends ImmutablePureComponent {
bookmark: this.handleHotkeyBookmark,
toggleSensitive: this.handleHotkeyToggleSensitive,
openMedia: this.handleHotkeyOpenMedia,
onTranslate: this.handleTranslate,
};
let prepend, rebloggedByText;

View File

@ -70,6 +70,10 @@ class KeyboardShortcuts extends ImmutablePureComponent {
<td><kbd>enter</kbd>, <kbd>o</kbd></td>
<td><FormattedMessage id='keyboard_shortcuts.enter' defaultMessage='to open status' /></td>
</tr>
<tr>
<td><kbd>t</kbd></td>
<td><FormattedMessage id='keyboard_shortcuts.translate' defaultMessage='to translate a post' /></td>
</tr>
<tr>
<td><kbd>e</kbd></td>
<td><FormattedMessage id='keyboard_shortcuts.open_media' defaultMessage='to open media' /></td>

View File

@ -485,6 +485,10 @@ class Status extends ImmutablePureComponent {
this.props.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
};
handleHotkeyTranslate = () => {
this.handleTranslate(this.props.status);
};
handleMoveUp = id => {
const { status, ancestorsIds, descendantsIds } = this.props;
@ -677,6 +681,7 @@ class Status extends ImmutablePureComponent {
toggleHidden: this.handleToggleHidden,
toggleSensitive: this.handleHotkeyToggleSensitive,
openMedia: this.handleHotkeyOpenMedia,
onTranslate: this.handleHotkeyTranslate,
};
return (

View File

@ -136,6 +136,7 @@ const keyMap = {
bookmark: 'd',
toggleSensitive: 'h',
openMedia: 'e',
onTranslate: 't',
};
class SwitchingColumnsArea extends PureComponent {