mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Make FocusRoomSearch a NavigationAction
This commit is contained in:
parent
2a21d45ac0
commit
a8a8741c06
@ -251,14 +251,7 @@ const roomListBindings = (): KeyBinding<RoomListAction>[] => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const roomBindings = (): KeyBinding<RoomAction>[] => {
|
const roomBindings = (): KeyBinding<RoomAction>[] => {
|
||||||
const bindings = [
|
const bindings: KeyBinding<RoomAction>[] = [
|
||||||
{
|
|
||||||
action: RoomAction.FocusRoomSearch,
|
|
||||||
keyCombo: {
|
|
||||||
key: Key.K,
|
|
||||||
ctrlOrCmd: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
action: RoomAction.ScrollUp,
|
action: RoomAction.ScrollUp,
|
||||||
keyCombo: {
|
keyCombo: {
|
||||||
@ -323,6 +316,13 @@ const roomBindings = (): KeyBinding<RoomAction>[] => {
|
|||||||
|
|
||||||
const navigationBindings = (): KeyBinding<NavigationAction>[] => {
|
const navigationBindings = (): KeyBinding<NavigationAction>[] => {
|
||||||
return [
|
return [
|
||||||
|
{
|
||||||
|
action: NavigationAction.FocusRoomSearch,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.K,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
action: NavigationAction.ToggleRoomSidePanel,
|
action: NavigationAction.ToggleRoomSidePanel,
|
||||||
keyCombo: {
|
keyCombo: {
|
||||||
@ -395,7 +395,7 @@ const navigationBindings = (): KeyBinding<NavigationAction>[] => {
|
|||||||
shiftKey: true,
|
shiftKey: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultBindingsProvider: IKeyBindingsProvider = {
|
export const defaultBindingsProvider: IKeyBindingsProvider = {
|
||||||
|
@ -78,8 +78,6 @@ export enum RoomListAction {
|
|||||||
|
|
||||||
/** Actions for the current room view */
|
/** Actions for the current room view */
|
||||||
export enum RoomAction {
|
export enum RoomAction {
|
||||||
/** Jump to room search (search for a room)*/
|
|
||||||
FocusRoomSearch = 'FocusRoomSearch', // TODO: move to NavigationAction?
|
|
||||||
/** Scroll up in the timeline */
|
/** Scroll up in the timeline */
|
||||||
ScrollUp = 'ScrollUp',
|
ScrollUp = 'ScrollUp',
|
||||||
/** Scroll down in the timeline */
|
/** Scroll down in the timeline */
|
||||||
@ -100,6 +98,8 @@ export enum RoomAction {
|
|||||||
|
|
||||||
/** Actions for navigating do various menus / dialogs / screens */
|
/** Actions for navigating do various menus / dialogs / screens */
|
||||||
export enum NavigationAction {
|
export enum NavigationAction {
|
||||||
|
/** Jump to room search (search for a room)*/
|
||||||
|
FocusRoomSearch = 'FocusRoomSearch',
|
||||||
/** Toggle the room side panel */
|
/** Toggle the room side panel */
|
||||||
ToggleRoomSidePanel = 'ToggleRoomSidePanel',
|
ToggleRoomSidePanel = 'ToggleRoomSidePanel',
|
||||||
/** Toggle the user menu */
|
/** Toggle the user menu */
|
||||||
|
@ -449,12 +449,6 @@ class LoggedInView extends React.Component<IProps, IState> {
|
|||||||
|
|
||||||
const roomAction = getKeyBindingsManager().getRoomAction(ev);
|
const roomAction = getKeyBindingsManager().getRoomAction(ev);
|
||||||
switch (roomAction) {
|
switch (roomAction) {
|
||||||
case RoomAction.FocusRoomSearch:
|
|
||||||
dis.dispatch({
|
|
||||||
action: 'focus_room_filter',
|
|
||||||
});
|
|
||||||
handled = true;
|
|
||||||
break;
|
|
||||||
case RoomAction.ScrollUp:
|
case RoomAction.ScrollUp:
|
||||||
case RoomAction.RoomScrollDown:
|
case RoomAction.RoomScrollDown:
|
||||||
case RoomAction.JumpToFirstMessage:
|
case RoomAction.JumpToFirstMessage:
|
||||||
@ -477,6 +471,12 @@ class LoggedInView extends React.Component<IProps, IState> {
|
|||||||
|
|
||||||
const navAction = getKeyBindingsManager().getNavigationAction(ev);
|
const navAction = getKeyBindingsManager().getNavigationAction(ev);
|
||||||
switch (navAction) {
|
switch (navAction) {
|
||||||
|
case NavigationAction.FocusRoomSearch:
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'focus_room_filter',
|
||||||
|
});
|
||||||
|
handled = true;
|
||||||
|
break;
|
||||||
case NavigationAction.ToggleUserMenu:
|
case NavigationAction.ToggleUserMenu:
|
||||||
dis.fire(Action.ToggleUserMenu);
|
dis.fire(Action.ToggleUserMenu);
|
||||||
handled = true;
|
handled = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user