Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 06de18b

Browse files
Łukasz SobekjasonLaster
authored andcommitted
Closes QOM when file or project search opens (#5417)
1 parent d0242fb commit 06de18b

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/actions/ui.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
// @flow
66

7-
import { getSource, getActiveSearch, getPaneCollapse } from "../selectors";
7+
import {
8+
getActiveSearch,
9+
getPaneCollapse,
10+
getQuickOpenEnabled,
11+
getSource
12+
} from "../selectors";
813
import { getProjectDirectoryRoot } from "../reducers/ui";
914
import type { ThunkArgs, panelPositionType } from "./types";
1015
import { getRawSourceURL } from "../utils/source";
@@ -39,6 +44,10 @@ export function setActiveSearch(activeSearch?: ActiveSearchType) {
3944
return;
4045
}
4146

47+
if (getQuickOpenEnabled(getState())) {
48+
dispatch({ type: "CLOSE_QUICK_OPEN" });
49+
}
50+
4251
dispatch({
4352
type: "TOGGLE_ACTIVE_SEARCH",
4453
value: activeSearch

src/components/Editor/SearchBar.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ class SearchBar extends Component<Props, State> {
137137
};
138138

139139
closeSearch = (e: SyntheticEvent<HTMLElement>) => {
140-
const { editor, searchOn } = this.props;
140+
const { closeFileSearch, editor, searchOn } = this.props;
141141
if (editor && searchOn) {
142142
this.clearSearch();
143-
this.props.closeFileSearch(editor);
143+
closeFileSearch(editor);
144144
e.stopPropagation();
145145
e.preventDefault();
146146
}
@@ -150,13 +150,13 @@ class SearchBar extends Component<Props, State> {
150150
toggleSearch = (e: SyntheticKeyboardEvent<HTMLElement>) => {
151151
e.stopPropagation();
152152
e.preventDefault();
153-
const { editor } = this.props;
153+
const { editor, searchOn, setActiveSearch } = this.props;
154154

155-
if (!this.props.searchOn) {
156-
this.props.setActiveSearch("file");
155+
if (!searchOn) {
156+
setActiveSearch("file");
157157
}
158158

159-
if (this.props.searchOn && editor) {
159+
if (searchOn && editor) {
160160
const query = editor.codeMirror.getSelection() || this.state.query;
161161

162162
if (query !== "") {

src/components/ProjectSearch.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export class ProjectSearch extends Component<Props, State> {
125125
if (this.isProjectSearchEnabled()) {
126126
return closeProjectSearch();
127127
}
128+
128129
return setActiveSearch("project");
129130
};
130131

0 commit comments

Comments
 (0)