parent
f45980feb7
commit
3026d78395
1 changed files with 11 additions and 44 deletions
|
|
@ -49,7 +49,7 @@ var html = '<div class="ace_search right">\
|
||||||
</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>\
|
||||||
<button type="button" action="replace" class="ace_replacebtn">Replace</button>\
|
<button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
|
||||||
<button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
|
<button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="ace_search_options">\
|
<div class="ace_search_options">\
|
||||||
|
|
@ -224,9 +224,17 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
||||||
this.find(true, true);
|
this.find(true, true);
|
||||||
};
|
};
|
||||||
this.replace = function() {
|
this.replace = function() {
|
||||||
|
if (!this.editor.getReadOnly())
|
||||||
this.editor.replace(this.replaceInput.value);
|
this.editor.replace(this.replaceInput.value);
|
||||||
};
|
};
|
||||||
|
this.replaceAndFindNext = function() {
|
||||||
|
if (!this.editor.getReadOnly()) {
|
||||||
|
this.editor.replace(this.replaceInput.value);
|
||||||
|
this.findNext()
|
||||||
|
}
|
||||||
|
};
|
||||||
this.replaceAll = function() {
|
this.replaceAll = function() {
|
||||||
|
if (!this.editor.getReadOnly())
|
||||||
this.editor.replaceAll(this.replaceInput.value);
|
this.editor.replaceAll(this.replaceInput.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -258,47 +266,6 @@ exports.Search = function(editor, isReplace) {
|
||||||
sb.show(editor.session.getTextRange(), isReplace);
|
sb.show(editor.session.getTextRange(), isReplace);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
exports.ISearch = function(session, options) {
|
|
||||||
this.$changeListener = this.$changeListener.bind(this);
|
|
||||||
this.startRange = session.selection.toOrientedRange();
|
|
||||||
this.options = options || {};
|
|
||||||
};
|
|
||||||
|
|
||||||
(function(){
|
|
||||||
this.setSession = function(session) {
|
|
||||||
if (this.session) {
|
|
||||||
this.session.removeListener(this.$changeListener);
|
|
||||||
}
|
|
||||||
this.session = session;
|
|
||||||
this.session.addListener(this.$changeListener);
|
|
||||||
};
|
|
||||||
this.setSearchString = function() {
|
|
||||||
|
|
||||||
};
|
|
||||||
this.getValue = function() {
|
|
||||||
if (this.value == null)
|
|
||||||
this.value = this.session.getValue();
|
|
||||||
return this.value;
|
|
||||||
};
|
|
||||||
this.$changeListener = function() {
|
|
||||||
this.value = null;
|
|
||||||
};
|
|
||||||
this.find = function() {
|
|
||||||
|
|
||||||
};
|
|
||||||
this.$edgeBefore = function() {
|
|
||||||
this.cursor = this.startRange[this.options.backwards ? "start" : "end"];
|
|
||||||
};
|
|
||||||
this.$edgeAfter = function() {
|
|
||||||
|
|
||||||
};
|
|
||||||
this.next = function(dir) {
|
|
||||||
|
|
||||||
};
|
|
||||||
}).call(exports.ISearch.prototype);
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue