Skip to content

Commit a1a5efd

Browse files
authored
Merge pull request #2576 from perminder-17/replace
Solved the issue with replace Behaviour.
2 parents 177a198 + dadade9 commit a1a5efd

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

client/styles/components/_editor.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pre.CodeMirror-line {
9898
margin-left: 0;
9999
}
100100

101-
// z-index: 20;
101+
z-index: 1;
102102

103103
width: 580px;
104104
font-family: Montserrat, sans-serif;

client/utils/codemirror-search.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,24 @@ function persistentDialog(cm, text, deflt, onEnter, replaceOpened, onKeyDown) {
9898

9999
var upArrow = dialog.getElementsByClassName("up-arrow")[0];
100100
CodeMirror.on(upArrow, "click", function () {
101-
cm.focus();
102-
CodeMirror.commands.findPrev(cm);
103-
searchField.blur();
101+
if (searchField.value.trim() === "") {
102+
searchField.focus();
103+
} else {
104+
cm.focus();
105+
CodeMirror.commands.findPrev(cm);
106+
searchField.blur();
107+
}
104108
});
105109

106110
var downArrow = dialog.getElementsByClassName("down-arrow")[0];
107111
CodeMirror.on(downArrow, "click", function () {
112+
if (searchField.value.trim() === "") {
113+
searchField.focus();
114+
}else{
108115
cm.focus();
109116
CodeMirror.commands.findNext(cm);
110117
searchField.blur();
118+
}
111119
});
112120

113121
var regexpButton = dialog.getElementsByClassName("CodeMirror-regexp-button")[0];
@@ -371,7 +379,7 @@ function doSearch(cm, rev, persistent, immediate, ignoreQuery) {
371379
startSearch(cm, state, q);
372380
findNext(cm, rev);
373381
}
374-
} else {
382+
} else {
375383
dialog(cm, queryDialog, 'Search for:', q, function (query) {
376384
if (query && !state.query)
377385
cm.operation(function () {

0 commit comments

Comments
 (0)