Merge branch 'shortcuts' into 'develop'
Fix keyboard shortcuts See merge request soapbox-pub/soapbox-fe!555
This commit is contained in:
commit
520d82dd0a
2 changed files with 9 additions and 47 deletions
|
@ -65,10 +65,6 @@ class HotkeysModal extends ImmutablePureComponent {
|
||||||
<td><kbd>h</kbd></td>
|
<td><kbd>h</kbd></td>
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.toggle_sensitivity' defaultMessage='to show/hide media' /></td>
|
<td><FormattedMessage id='keyboard_shortcuts.toggle_sensitivity' defaultMessage='to show/hide media' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td><kbd>up</kbd>, <kbd>k</kbd></td>
|
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.up' defaultMessage='to move up in the list' /></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
|
@ -79,12 +75,12 @@ class HotkeysModal extends ImmutablePureComponent {
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><kbd>down</kbd>, <kbd>j</kbd></td>
|
<td><kbd>up</kbd>, <kbd>k</kbd></td>
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.down' defaultMessage='to move down in the list' /></td>
|
<td><FormattedMessage id='keyboard_shortcuts.up' defaultMessage='to move up in the list' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><kbd>1</kbd> - <kbd>9</kbd></td>
|
<td><kbd>down</kbd>, <kbd>j</kbd></td>
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.column' defaultMessage='to focus a post in one of the columns' /></td>
|
<td><FormattedMessage id='keyboard_shortcuts.down' defaultMessage='to move down in the list' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><kbd>n</kbd></td>
|
<td><kbd>n</kbd></td>
|
||||||
|
@ -110,14 +106,6 @@ class HotkeysModal extends ImmutablePureComponent {
|
||||||
<td><kbd>g</kbd> + <kbd>h</kbd></td>
|
<td><kbd>g</kbd> + <kbd>h</kbd></td>
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.home' defaultMessage='to open home timeline' /></td>
|
<td><FormattedMessage id='keyboard_shortcuts.home' defaultMessage='to open home timeline' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td><kbd>g</kbd> + <kbd>n</kbd></td>
|
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.notifications' defaultMessage='to open notifications column' /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><kbd>g</kbd> + <kbd>d</kbd></td>
|
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.direct' defaultMessage='to open direct messages column' /></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
|
@ -128,8 +116,8 @@ class HotkeysModal extends ImmutablePureComponent {
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><kbd>g</kbd> + <kbd>s</kbd></td>
|
<td><kbd>g</kbd> + <kbd>n</kbd></td>
|
||||||
<td><FormattedMessage id='keyboard_shortcuts.start' defaultMessage='to open "get started" column' /></td>
|
<td><FormattedMessage id='keyboard_shortcuts.notifications' defaultMessage='to open notifications column' /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><kbd>g</kbd> + <kbd>f</kbd></td>
|
<td><kbd>g</kbd> + <kbd>f</kbd></td>
|
||||||
|
|
|
@ -126,7 +126,6 @@ const keyMap = {
|
||||||
new: 'n',
|
new: 'n',
|
||||||
search: 's',
|
search: 's',
|
||||||
forceNew: 'option+n',
|
forceNew: 'option+n',
|
||||||
focusColumn: ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
|
|
||||||
reply: 'r',
|
reply: 'r',
|
||||||
favourite: 'f',
|
favourite: 'f',
|
||||||
boost: 'b',
|
boost: 'b',
|
||||||
|
@ -138,7 +137,6 @@ const keyMap = {
|
||||||
back: 'backspace',
|
back: 'backspace',
|
||||||
goToHome: 'g h',
|
goToHome: 'g h',
|
||||||
goToNotifications: 'g n',
|
goToNotifications: 'g n',
|
||||||
goToStart: 'g s',
|
|
||||||
goToFavourites: 'g f',
|
goToFavourites: 'g f',
|
||||||
goToPinned: 'g p',
|
goToPinned: 'g p',
|
||||||
goToProfile: 'g u',
|
goToProfile: 'g u',
|
||||||
|
@ -488,24 +486,6 @@ class UI extends React.PureComponent {
|
||||||
this.props.dispatch(resetCompose());
|
this.props.dispatch(resetCompose());
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHotkeyFocusColumn = e => {
|
|
||||||
const index = (e.key * 1) + 1; // First child is drawer, skip that
|
|
||||||
const column = this.node.querySelector(`.column:nth-child(${index})`);
|
|
||||||
if (!column) return;
|
|
||||||
const container = column.querySelector('.scrollable');
|
|
||||||
|
|
||||||
if (container) {
|
|
||||||
const status = container.querySelector('.focusable');
|
|
||||||
|
|
||||||
if (status) {
|
|
||||||
if (container.scrollTop > status.offsetTop) {
|
|
||||||
status.scrollIntoView(true);
|
|
||||||
}
|
|
||||||
status.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleHotkeyBack = () => {
|
handleHotkeyBack = () => {
|
||||||
if (window.history && window.history.length === 1) {
|
if (window.history && window.history.length === 1) {
|
||||||
this.context.router.history.push('/');
|
this.context.router.history.push('/');
|
||||||
|
@ -536,29 +516,25 @@ class UI extends React.PureComponent {
|
||||||
this.context.router.history.push('/notifications');
|
this.context.router.history.push('/notifications');
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHotkeyGoToStart = () => {
|
|
||||||
this.context.router.history.push('/getting-started');
|
|
||||||
}
|
|
||||||
|
|
||||||
handleHotkeyGoToFavourites = () => {
|
handleHotkeyGoToFavourites = () => {
|
||||||
const { account } = this.props;
|
const { account } = this.props;
|
||||||
if (!account) return;
|
if (!account) return;
|
||||||
|
|
||||||
this.context.router.history.push(`/${account.get('username')}/favorites`);
|
this.context.router.history.push(`/@${account.get('username')}/favorites`);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHotkeyGoToPinned = () => {
|
handleHotkeyGoToPinned = () => {
|
||||||
const { account } = this.props;
|
const { account } = this.props;
|
||||||
if (!account) return;
|
if (!account) return;
|
||||||
|
|
||||||
this.context.router.history.push(`/${account.get('username')}/pins`);
|
this.context.router.history.push(`/@${account.get('username')}/pins`);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHotkeyGoToProfile = () => {
|
handleHotkeyGoToProfile = () => {
|
||||||
const { account } = this.props;
|
const { account } = this.props;
|
||||||
if (!account) return;
|
if (!account) return;
|
||||||
|
|
||||||
this.context.router.history.push(`/${account.get('username')}`);
|
this.context.router.history.push(`/@${account.get('username')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHotkeyGoToBlocked = () => {
|
handleHotkeyGoToBlocked = () => {
|
||||||
|
@ -599,11 +575,9 @@ class UI extends React.PureComponent {
|
||||||
new: this.handleHotkeyNew,
|
new: this.handleHotkeyNew,
|
||||||
search: this.handleHotkeySearch,
|
search: this.handleHotkeySearch,
|
||||||
forceNew: this.handleHotkeyForceNew,
|
forceNew: this.handleHotkeyForceNew,
|
||||||
focusColumn: this.handleHotkeyFocusColumn,
|
|
||||||
back: this.handleHotkeyBack,
|
back: this.handleHotkeyBack,
|
||||||
goToHome: this.handleHotkeyGoToHome,
|
goToHome: this.handleHotkeyGoToHome,
|
||||||
goToNotifications: this.handleHotkeyGoToNotifications,
|
goToNotifications: this.handleHotkeyGoToNotifications,
|
||||||
goToStart: this.handleHotkeyGoToStart,
|
|
||||||
goToFavourites: this.handleHotkeyGoToFavourites,
|
goToFavourites: this.handleHotkeyGoToFavourites,
|
||||||
goToPinned: this.handleHotkeyGoToPinned,
|
goToPinned: this.handleHotkeyGoToPinned,
|
||||||
goToProfile: this.handleHotkeyGoToProfile,
|
goToProfile: this.handleHotkeyGoToProfile,
|
||||||
|
|
Loading…
Reference in a new issue