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.setValue = function(text) {
|
||||||
this.doc.setValue(text);
|
this.doc.setValue(text);
|
||||||
this.$deltas = [];
|
this.$deltas = [];
|
||||||
|
this.$undoManager.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getValue =
|
this.getValue =
|
||||||
|
|
@ -130,7 +131,8 @@ var EditSession = function(text, mode) {
|
||||||
|
|
||||||
this.$defaultUndoManager = {
|
this.$defaultUndoManager = {
|
||||||
undo: function() {},
|
undo: function() {},
|
||||||
redo: function() {}
|
redo: function() {},
|
||||||
|
reset: function() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getUndoManager = function() {
|
this.getUndoManager = function() {
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,7 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
var UndoManager = function() {
|
var UndoManager = function() {
|
||||||
this.$undoStack = [];
|
this.reset();
|
||||||
this.$redoStack = [];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -66,6 +65,11 @@ var UndoManager = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.reset = function() {
|
||||||
|
this.$undoStack = [];
|
||||||
|
this.$redoStack = [];
|
||||||
|
};
|
||||||
|
|
||||||
}).call(UndoManager.prototype);
|
}).call(UndoManager.prototype);
|
||||||
|
|
||||||
exports.UndoManager = UndoManager;
|
exports.UndoManager = UndoManager;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue