Make use of the KeyBindingManager in LeftPanel
LeftPanel was making key action decisions based on the forwarded event. Use the KeyBindingManager now. Signed-off-by: Clemens Zeidler <clemens.zeidler@gmail.com>
This commit is contained in:
parent
33e8edb3d5
commit
7d087524a5
2 changed files with 17 additions and 12 deletions
|
@ -30,8 +30,11 @@ import SpaceStore, {UPDATE_SELECTED_SPACE} from "../../stores/SpaceStore";
|
|||
|
||||
interface IProps {
|
||||
isMinimized: boolean;
|
||||
onVerticalArrow(ev: React.KeyboardEvent): void;
|
||||
onEnter(ev: React.KeyboardEvent): boolean;
|
||||
onKeyDown(ev: React.KeyboardEvent): void;
|
||||
/**
|
||||
* @returns true if a room has been selected and the search field should be cleared
|
||||
*/
|
||||
onSelectRoom(): boolean;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
@ -120,10 +123,11 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
|
|||
break;
|
||||
case RoomListAction.NextRoom:
|
||||
case RoomListAction.PrevRoom:
|
||||
this.props.onVerticalArrow(ev);
|
||||
// we don't handle these actions here put pass the event on to the interested party (LeftPanel)
|
||||
this.props.onKeyDown(ev);
|
||||
break;
|
||||
case RoomListAction.SelectRoom: {
|
||||
const shouldClear = this.props.onEnter(ev);
|
||||
const shouldClear = this.props.onSelectRoom();
|
||||
if (shouldClear) {
|
||||
// wrap in set immediate to delay it so that we don't clear the filter & then change room
|
||||
setImmediate(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue