You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-13 08:02:38 +03:00
Auto expand room list on search
This commit is contained in:
@@ -76,6 +76,7 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
|
||||
private clearInput = () => {
|
||||
if (!this.inputRef.current) return;
|
||||
this.inputRef.current.value = "";
|
||||
defaultDispatcher.dispatch({action: Action.StopRoomFilter})
|
||||
this.onChange();
|
||||
};
|
||||
|
||||
@@ -102,9 +103,15 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
|
||||
private onFocus = (ev: React.FocusEvent<HTMLInputElement>) => {
|
||||
this.setState({focused: true});
|
||||
ev.target.select();
|
||||
if (ev.target.value === "") {
|
||||
defaultDispatcher.dispatch({action: Action.StartRoomFilter})
|
||||
}
|
||||
};
|
||||
|
||||
private onBlur = () => {
|
||||
private onBlur = (ev: React.FocusEvent<HTMLInputElement>) => {
|
||||
if (ev.target.value === "") {
|
||||
defaultDispatcher.dispatch({action: Action.StopRoomFilter})
|
||||
}
|
||||
this.setState({focused: false});
|
||||
};
|
||||
|
||||
|
||||
@@ -194,6 +194,17 @@ export default class RoomList2 extends React.Component<IProps, IState> {
|
||||
show_room_tile: true, // to make sure the room gets scrolled into view
|
||||
});
|
||||
}
|
||||
} else if (payload.action === Action.StartRoomFilter) {
|
||||
this.state.layouts.forEach(x => {
|
||||
x.saveCollapsedState();
|
||||
x.isCollapsed = false;
|
||||
});
|
||||
this.forceUpdate();
|
||||
} else if (payload.action === Action.StopRoomFilter) {
|
||||
this.state.layouts.forEach(x => {
|
||||
x.restoreCollapsedState();
|
||||
});
|
||||
this.forceUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user