Add a keyboard shortcut to toggle hidden event visibility when labs are enabled. (#7584)

Notes: The keyboard shortcut is control (or cmd) shift h.
Signed-off-by: Katarzyna Stachura <uwunyaa@outlook.com>
This commit is contained in:
UwUnyaa 2022-01-26 17:50:47 +01:00 committed by GitHub
parent 00912c0b50
commit debf4caade
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 82 additions and 3 deletions

View file

@ -125,6 +125,12 @@ export enum NavigationAction {
SelectNextUnreadRoom = 'SelectNextUnreadRoom',
}
/** Actions only available when labs are enabled */
export enum LabsAction {
/** Toggle visibility of hidden events */
ToggleHiddenEventVisibility = 'ToggleHiddenEventVisibility',
}
/**
* Represent a key combination.
*
@ -213,6 +219,7 @@ export interface IKeyBindingsProvider {
getRoomListBindings: KeyBindingGetter<RoomListAction>;
getRoomBindings: KeyBindingGetter<RoomAction>;
getNavigationBindings: KeyBindingGetter<NavigationAction>;
getLabsBindings: KeyBindingGetter<LabsAction>;
}
export class KeyBindingsManager {
@ -264,6 +271,10 @@ export class KeyBindingsManager {
getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): NavigationAction | undefined {
return this.getAction(this.bindingsProviders.map(it => it.getNavigationBindings), ev);
}
getLabsAction(ev: KeyboardEvent | React.KeyboardEvent): LabsAction | undefined {
return this.getAction(this.bindingsProviders.map(it => it.getLabsBindings), ev);
}
}
const manager = new KeyBindingsManager();