reset undo stack after setValue() calls
This commit is contained in:
parent
6e3b05dc2f
commit
b01e4c8640
2 changed files with 11 additions and 5 deletions
|
|
@ -94,8 +94,9 @@ var EditSession = function(text, mode) {
|
|||
};
|
||||
|
||||
this.setValue = function(text) {
|
||||
this.doc.setValue(text);
|
||||
this.$deltas = [];
|
||||
this.doc.setValue(text);
|
||||
this.$deltas = [];
|
||||
this.$undoManager.reset();
|
||||
};
|
||||
|
||||
this.getValue =
|
||||
|
|
@ -130,7 +131,8 @@ var EditSession = function(text, mode) {
|
|||
|
||||
this.$defaultUndoManager = {
|
||||
undo: function() {},
|
||||
redo: function() {}
|
||||
redo: function() {},
|
||||
reset: function() {}
|
||||
};
|
||||
|
||||
this.getUndoManager = function() {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
var UndoManager = function() {
|
||||
this.$undoStack = [];
|
||||
this.$redoStack = [];
|
||||
this.reset();
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -65,6 +64,11 @@ var UndoManager = function() {
|
|||
this.$undoStack.push(deltas);
|
||||
}
|
||||
};
|
||||
|
||||
this.reset = function() {
|
||||
this.$undoStack = [];
|
||||
this.$redoStack = [];
|
||||
};
|
||||
|
||||
}).call(UndoManager.prototype);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue