add setValue to the Document
This commit is contained in:
parent
0847bc73c5
commit
92b0339178
1 changed files with 9 additions and 2 deletions
|
|
@ -1,8 +1,8 @@
|
|||
ace.provide("ace.Document");
|
||||
|
||||
ace.Document = function(text, mode) {
|
||||
this.lines = [];
|
||||
this.modified = true;
|
||||
this.lines = [];
|
||||
this.selection = new ace.Selection(this);
|
||||
|
||||
this.listeners = [];
|
||||
|
|
@ -27,6 +27,13 @@ ace.Document = function(text, mode) {
|
|||
return text.split(/\r\n|\r|\n/);
|
||||
};
|
||||
|
||||
this.setValue = function(text) {
|
||||
var args = [0, this.lines.length];
|
||||
args.push.apply(args, this.$split(text));
|
||||
this.lines.splice.apply(this.lines, args);
|
||||
this.fireChangeEvent(0);
|
||||
};
|
||||
|
||||
this.toString = function() {
|
||||
return this.lines.join(this.$getNewLineCharacter());
|
||||
};
|
||||
|
|
@ -323,7 +330,7 @@ ace.Document = function(text, mode) {
|
|||
|
||||
this.$insert = function(position, text, fromUndo) {
|
||||
if (text.length == 0)
|
||||
return;
|
||||
return position;
|
||||
|
||||
this.modified = true;
|
||||
if (this.lines.length <= 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue