@@ -83,7 +83,7 @@ if (!SERVER_RENDERED) {
83
83
'bru.runner' ,
84
84
'bru.runner.setNextRequest(requestName)' ,
85
85
'bru.runner.skipRequest()' ,
86
- 'bru.runner.stopExecution()' ,
86
+ 'bru.runner.stopExecution()'
87
87
] ;
88
88
CodeMirror . registerHelper ( 'hint' , 'brunoJS' , ( editor , options ) => {
89
89
const cursor = editor . getCursor ( ) ;
@@ -174,11 +174,21 @@ export default class CodeEditor extends React.Component {
174
174
}
175
175
} ,
176
176
'Cmd-F' : ( cm ) => {
177
+ if ( this . _isSearchOpen ( ) ) {
178
+ // replace the older search component with the new one
179
+ const search = document . querySelector ( '.CodeMirror-dialog.CodeMirror-dialog-top' ) ;
180
+ search && search . remove ( ) ;
181
+ }
177
182
cm . execCommand ( 'findPersistent' ) ;
178
183
this . _bindSearchHandler ( ) ;
179
184
this . _appendSearchResultsCount ( ) ;
180
185
} ,
181
186
'Ctrl-F' : ( cm ) => {
187
+ if ( this . _isSearchOpen ( ) ) {
188
+ // replace the older search component with the new one
189
+ const search = document . querySelector ( '.CodeMirror-dialog.CodeMirror-dialog-top' ) ;
190
+ search && search . remove ( ) ;
191
+ }
182
192
cm . execCommand ( 'findPersistent' ) ;
183
193
this . _bindSearchHandler ( ) ;
184
194
this . _appendSearchResultsCount ( ) ;
@@ -365,6 +375,10 @@ export default class CodeEditor extends React.Component {
365
375
}
366
376
} ;
367
377
378
+ _isSearchOpen = ( ) => {
379
+ return document . querySelector ( '.CodeMirror-dialog.CodeMirror-dialog-top' ) ;
380
+ } ;
381
+
368
382
/**
369
383
* Bind handler to search input to count number of search results
370
384
*/
0 commit comments