Add hotkey ctrl+k for search

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-12-11 10:50:34 +05:30
parent 413188c995
commit fbeecc0479
5 changed files with 52 additions and 32 deletions

View file

@ -12,6 +12,8 @@ class Navigation extends EventEmitter {
this.selectedRoomId = null;
this.recentRooms = [];
this.isRawModalVisible = false;
}
_setSpacePath(roomId) {
@ -38,13 +40,16 @@ class Navigation extends EventEmitter {
addRecentRoom(roomId) {
if (typeof roomId !== 'string') return;
this.removeRecentRoom(roomId);
this.recentRooms.push(roomId);
if (this.recentRooms.length > 10) {
this.recentRooms.splice(0, 1);
}
}
setIsRawModalVisible(visible) {
this.isRawModalVisible = visible;
}
navigate(action) {
const actions = {
[cons.actions.navigation.SELECT_TAB]: () => {
@ -69,6 +74,7 @@ class Navigation extends EventEmitter {
[cons.actions.navigation.SELECT_ROOM]: () => {
const prevSelectedRoomId = this.selectedRoomId;
this.selectedRoomId = action.roomId;
this.removeRecentRoom(prevSelectedRoomId);
this.addRecentRoom(prevSelectedRoomId);
this.removeRecentRoom(this.selectedRoomId);
this.emit(