mirror of https://github.com/vector-im/riot-web
Add keyboard shortcut to close current conversations
Signed-off-by: Heiko Carrasco <heiko.carrasco@yahoo.com>pull/21833/head
parent
4425ae30e9
commit
f36651f538
|
@ -257,6 +257,12 @@ const shortcuts: Record<Categories, IShortcut[]> = {
|
||||||
key: Key.SLASH,
|
key: Key.SLASH,
|
||||||
}],
|
}],
|
||||||
description: _td("Toggle this dialog"),
|
description: _td("Toggle this dialog"),
|
||||||
|
}, {
|
||||||
|
keybinds: [{
|
||||||
|
modifiers: [CMD_OR_CTRL, Modifiers.ALT],
|
||||||
|
key: Key.H,
|
||||||
|
}],
|
||||||
|
description: _td("Go to Home View"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import * as PropTypes from 'prop-types';
|
||||||
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
||||||
import { DragDropContext } from 'react-beautiful-dnd';
|
import { DragDropContext } from 'react-beautiful-dnd';
|
||||||
|
|
||||||
import {Key, isOnlyCtrlOrCmdKeyEvent, isOnlyCtrlOrCmdIgnoreShiftKeyEvent} from '../../Keyboard';
|
import {Key, isOnlyCtrlOrCmdKeyEvent, isOnlyCtrlOrCmdIgnoreShiftKeyEvent, isMac} from '../../Keyboard';
|
||||||
import PageTypes from '../../PageTypes';
|
import PageTypes from '../../PageTypes';
|
||||||
import CallMediaHandler from '../../CallMediaHandler';
|
import CallMediaHandler from '../../CallMediaHandler';
|
||||||
import { fixupColorFonts } from '../../utils/FontManager';
|
import { fixupColorFonts } from '../../utils/FontManager';
|
||||||
|
@ -400,6 +400,7 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
||||||
const hasModifier = ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey;
|
const hasModifier = ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey;
|
||||||
const isModifier = ev.key === Key.ALT || ev.key === Key.CONTROL || ev.key === Key.META || ev.key === Key.SHIFT;
|
const isModifier = ev.key === Key.ALT || ev.key === Key.CONTROL || ev.key === Key.META || ev.key === Key.SHIFT;
|
||||||
|
const modKey = isMac ? ev.metaKey : ev.ctrlKey;
|
||||||
|
|
||||||
switch (ev.key) {
|
switch (ev.key) {
|
||||||
case Key.PAGE_UP:
|
case Key.PAGE_UP:
|
||||||
|
@ -444,6 +445,15 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Key.H:
|
||||||
|
if (ev.altKey && modKey) {
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'view_home_page',
|
||||||
|
});
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Key.ARROW_UP:
|
case Key.ARROW_UP:
|
||||||
case Key.ARROW_DOWN:
|
case Key.ARROW_DOWN:
|
||||||
if (ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
if (ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
||||||
|
|
|
@ -2350,6 +2350,7 @@
|
||||||
"Activate selected button": "Activate selected button",
|
"Activate selected button": "Activate selected button",
|
||||||
"Toggle right panel": "Toggle right panel",
|
"Toggle right panel": "Toggle right panel",
|
||||||
"Toggle this dialog": "Toggle this dialog",
|
"Toggle this dialog": "Toggle this dialog",
|
||||||
|
"Go to Home View": "Go to Home View",
|
||||||
"Move autocomplete selection up/down": "Move autocomplete selection up/down",
|
"Move autocomplete selection up/down": "Move autocomplete selection up/down",
|
||||||
"Cancel autocomplete": "Cancel autocomplete",
|
"Cancel autocomplete": "Cancel autocomplete",
|
||||||
"Page Up": "Page Up",
|
"Page Up": "Page Up",
|
||||||
|
|
Loading…
Reference in New Issue