Merge pull request #2157 from cvoege/master
Added Find All Functionality to Ctrl-F searchbox.
This commit is contained in:
commit
f4356993b2
2 changed files with 19 additions and 1 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
border: 1px solid #cbcbcb;
|
border: 1px solid #cbcbcb;
|
||||||
border-top: 0 none;
|
border-top: 0 none;
|
||||||
max-width: 297px;
|
max-width: 325px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ var html = '<div class="ace_search right">\
|
||||||
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
|
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
|
||||||
<button type="button" action="findNext" class="ace_searchbtn next"></button>\
|
<button type="button" action="findNext" class="ace_searchbtn next"></button>\
|
||||||
<button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
|
<button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
|
||||||
|
<button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="ace_replace_form">\
|
<div class="ace_replace_form">\
|
||||||
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
|
||||||
|
|
@ -170,6 +171,11 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
||||||
sb.replace();
|
sb.replace();
|
||||||
sb.findPrev();
|
sb.findPrev();
|
||||||
},
|
},
|
||||||
|
"Alt-Return": function(sb) {
|
||||||
|
if (sb.activeInput == sb.replaceInput)
|
||||||
|
sb.replaceAll();
|
||||||
|
sb.findAll();
|
||||||
|
},
|
||||||
"Tab": function(sb) {
|
"Tab": function(sb) {
|
||||||
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
|
||||||
}
|
}
|
||||||
|
|
@ -229,6 +235,18 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
||||||
this.findPrev = function() {
|
this.findPrev = function() {
|
||||||
this.find(true, true);
|
this.find(true, true);
|
||||||
};
|
};
|
||||||
|
this.findAll = function(){
|
||||||
|
var range = this.editor.findAll(this.searchInput.value, {
|
||||||
|
regExp: this.regExpOption.checked,
|
||||||
|
caseSensitive: this.caseSensitiveOption.checked,
|
||||||
|
wholeWord: this.wholeWordOption.checked
|
||||||
|
});
|
||||||
|
var noMatch = !range && this.searchInput.value;
|
||||||
|
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
|
||||||
|
this.editor._emit("findSearchBox", { match: !noMatch });
|
||||||
|
this.highlight();
|
||||||
|
this.hide();
|
||||||
|
};
|
||||||
this.replace = function() {
|
this.replace = function() {
|
||||||
if (!this.editor.getReadOnly())
|
if (!this.editor.getReadOnly())
|
||||||
this.editor.replace(this.replaceInput.value);
|
this.editor.replace(this.replaceInput.value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue