From fbeecc047918701c08289176d7765ff03fbd3738 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Sat, 11 Dec 2021 10:50:34 +0530 Subject: [PATCH] Add hotkey ctrl+k for search Signed-off-by: Ajay Bura --- src/app/atoms/modal/RawModal.jsx | 5 ++++ src/client/action/navigation.js | 45 ++++++++++---------------------- src/client/event/hotkeys.js | 24 +++++++++++++++++ src/client/initMatrix.js | 2 ++ src/client/state/navigation.js | 8 +++++- 5 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 src/client/event/hotkeys.js diff --git a/src/app/atoms/modal/RawModal.jsx b/src/app/atoms/modal/RawModal.jsx index 995ac60..31693cd 100644 --- a/src/app/atoms/modal/RawModal.jsx +++ b/src/app/atoms/modal/RawModal.jsx @@ -4,6 +4,8 @@ import './RawModal.scss'; import Modal from 'react-modal'; +import navigation from '../../../client/state/navigation'; + Modal.setAppElement('#root'); function RawModal({ @@ -23,6 +25,9 @@ function RawModal({ default: modalClass += 'raw-modal__small '; } + + navigation.setIsRawModalVisible(isOpen); + const modalOverlayClass = (overlayClassName !== null) ? `${overlayClassName} ` : ''; return ( 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(