do not allow Replace after setReadOnly

fixes #1468
This commit is contained in:
nightwing 2013-06-16 18:24:07 +04:00
commit 3026d78395

View file

@ -49,7 +49,7 @@ var html = '<div class="ace_search right">\
</div>\
<div class="ace_replace_form">\
<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>\
</div>\
<div class="ace_search_options">\
@ -224,10 +224,18 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.find(true, true);
};
this.replace = function() {
this.editor.replace(this.replaceInput.value);
if (!this.editor.getReadOnly())
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.editor.replaceAll(this.replaceInput.value);
if (!this.editor.getReadOnly())
this.editor.replaceAll(this.replaceInput.value);
};
this.hide = function() {
@ -258,47 +266,6 @@ exports.Search = function(editor, 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);
});