Generalized undo manager for interoperability with apf

This commit is contained in:
Ruben Daniels 2010-10-21 18:37:04 +02:00
commit bdddde5d11
2 changed files with 10 additions and 5 deletions

View file

@ -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 = [];
});
}

View file

@ -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);
};