Make FocusRoomSearch a NavigationAction

pull/21833/head
Clemens Zeidler 2021-03-12 19:40:28 +13:00
parent 2a21d45ac0
commit a8a8741c06
3 changed files with 17 additions and 17 deletions

View File

@ -251,14 +251,7 @@ const roomListBindings = (): KeyBinding<RoomListAction>[] => {
}
const roomBindings = (): KeyBinding<RoomAction>[] => {
const bindings = [
{
action: RoomAction.FocusRoomSearch,
keyCombo: {
key: Key.K,
ctrlOrCmd: true,
},
},
const bindings: KeyBinding<RoomAction>[] = [
{
action: RoomAction.ScrollUp,
keyCombo: {
@ -323,6 +316,13 @@ const roomBindings = (): KeyBinding<RoomAction>[] => {
const navigationBindings = (): KeyBinding<NavigationAction>[] => {
return [
{
action: NavigationAction.FocusRoomSearch,
keyCombo: {
key: Key.K,
ctrlOrCmd: true,
},
},
{
action: NavigationAction.ToggleRoomSidePanel,
keyCombo: {
@ -395,7 +395,7 @@ const navigationBindings = (): KeyBinding<NavigationAction>[] => {
shiftKey: true,
},
},
]
];
}
export const defaultBindingsProvider: IKeyBindingsProvider = {

View File

@ -78,8 +78,6 @@ export enum RoomListAction {
/** Actions for the current room view */
export enum RoomAction {
/** Jump to room search (search for a room)*/
FocusRoomSearch = 'FocusRoomSearch', // TODO: move to NavigationAction?
/** Scroll up in the timeline */
ScrollUp = 'ScrollUp',
/** Scroll down in the timeline */
@ -100,6 +98,8 @@ export enum RoomAction {
/** Actions for navigating do various menus / dialogs / screens */
export enum NavigationAction {
/** Jump to room search (search for a room)*/
FocusRoomSearch = 'FocusRoomSearch',
/** Toggle the room side panel */
ToggleRoomSidePanel = 'ToggleRoomSidePanel',
/** Toggle the user menu */

View File

@ -449,12 +449,6 @@ class LoggedInView extends React.Component<IProps, IState> {
const roomAction = getKeyBindingsManager().getRoomAction(ev);
switch (roomAction) {
case RoomAction.FocusRoomSearch:
dis.dispatch({
action: 'focus_room_filter',
});
handled = true;
break;
case RoomAction.ScrollUp:
case RoomAction.RoomScrollDown:
case RoomAction.JumpToFirstMessage:
@ -477,6 +471,12 @@ class LoggedInView extends React.Component<IProps, IState> {
const navAction = getKeyBindingsManager().getNavigationAction(ev);
switch (navAction) {
case NavigationAction.FocusRoomSearch:
dis.dispatch({
action: 'focus_room_filter',
});
handled = true;
break;
case NavigationAction.ToggleUserMenu:
dis.fire(Action.ToggleUserMenu);
handled = true;