Generalized undo manager for interoperability with apf
This commit is contained in:
parent
b160b95dfe
commit
bdddde5d11
2 changed files with 10 additions and 5 deletions
|
|
@ -76,11 +76,14 @@ var Document = function(text, mode) {
|
|||
}
|
||||
|
||||
if (undoManager) {
|
||||
undoManager.setDocument(this);
|
||||
//undoManager.setDocument(this);
|
||||
var self = this;
|
||||
this.$informUndoManager = lang.deferredCall(function() {
|
||||
if (self.$deltas.length > 0)
|
||||
undoManager.notify(self.$deltas);
|
||||
undoManager.execute({
|
||||
action : "aceupdate",
|
||||
args : [self.$deltas, self]
|
||||
});
|
||||
self.$deltas = [];
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,14 @@ var UndoManager = function() {
|
|||
|
||||
(function() {
|
||||
|
||||
this.$doc = null;
|
||||
/*this.$doc = null;
|
||||
this.setDocument = function(doc) {
|
||||
this.$doc = doc;
|
||||
};
|
||||
};*/
|
||||
|
||||
this.notify = function(deltas) {
|
||||
this.execute = function(options) {
|
||||
var deltas = options.args[0];
|
||||
this.$doc = options.args[1];
|
||||
this.$undoStack.push(deltas);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue