Issue #6: Events carry creator information
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@
|
||||
function Operation(uid) {
|
||||
this.is_deleted = false;
|
||||
this.doSync = true;
|
||||
this.garbage_collected = false;
|
||||
if (uid != null) {
|
||||
this.doSync = !isNaN(parseInt(uid.op_number));
|
||||
} else {
|
||||
@@ -85,9 +86,10 @@
|
||||
if (garbagecollect == null) {
|
||||
garbagecollect = true;
|
||||
}
|
||||
if (!this.isDeleted()) {
|
||||
if (!this.garbage_collected) {
|
||||
this.is_deleted = true;
|
||||
if (garbagecollect) {
|
||||
this.garbage_collected = true;
|
||||
return HB.addToGarbageCollector(this);
|
||||
}
|
||||
}
|
||||
@@ -220,7 +222,7 @@
|
||||
this.deleted_by = [];
|
||||
}
|
||||
if ((this.parent != null) && !this.isDeleted()) {
|
||||
this.parent.callEvent("delete", this);
|
||||
this.parent.callEvent("delete", this, o);
|
||||
}
|
||||
if (o != null) {
|
||||
this.deleted_by.push(o);
|
||||
@@ -228,10 +230,11 @@
|
||||
garbagecollect = false;
|
||||
if (this.prev_cl.isDeleted()) {
|
||||
garbagecollect = true;
|
||||
} else if (this.next_cl.isDeleted()) {
|
||||
this.next_cl.applyDelete();
|
||||
}
|
||||
return Insert.__super__.applyDelete.call(this, garbagecollect);
|
||||
Insert.__super__.applyDelete.call(this, garbagecollect);
|
||||
if (this.next_cl.isDeleted()) {
|
||||
return this.next_cl.applyDelete();
|
||||
}
|
||||
};
|
||||
|
||||
Insert.prototype.cleanup = function() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -242,27 +242,24 @@
|
||||
};
|
||||
|
||||
ReplaceManager.prototype.setParent = function(parent, property_name) {
|
||||
var addPropertyListener;
|
||||
this.on('insert', (function(_this) {
|
||||
return function(event, op) {
|
||||
if (op.next_cl instanceof types.Delimiter) {
|
||||
return _this.parent.callEvent('change', property_name);
|
||||
}
|
||||
};
|
||||
})(this));
|
||||
this.on('change', (function(_this) {
|
||||
return function(event) {
|
||||
return _this.parent.callEvent('change', property_name);
|
||||
};
|
||||
})(this));
|
||||
addPropertyListener = (function(_this) {
|
||||
return function(event, op) {
|
||||
if (op.next_cl instanceof types.Delimiter && op.prev_cl instanceof types.Delimiter) {
|
||||
_this.parent.callEvent('addProperty', property_name);
|
||||
}
|
||||
return _this.deleteListener('addProperty', addPropertyListener);
|
||||
};
|
||||
})(this);
|
||||
var addPropertyListener, repl_manager;
|
||||
repl_manager = this;
|
||||
this.on('insert', function(event, op) {
|
||||
if (op.next_cl instanceof types.Delimiter) {
|
||||
return repl_manager.parent.callEvent('change', property_name, op);
|
||||
}
|
||||
});
|
||||
this.on('change', function(event, op) {
|
||||
if (repl_manager !== this) {
|
||||
return repl_manager.parent.callEvent('change', property_name, op);
|
||||
}
|
||||
});
|
||||
addPropertyListener = function(event, op) {
|
||||
if (op.next_cl instanceof types.Delimiter && op.prev_cl instanceof types.Delimiter) {
|
||||
repl_manager.parent.callEvent('addProperty', property_name, op);
|
||||
}
|
||||
return repl_manager.deleteListener('addProperty', addPropertyListener);
|
||||
};
|
||||
this.on('insert', addPropertyListener);
|
||||
return ReplaceManager.__super__.setParent.call(this, parent);
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -174,10 +174,16 @@
|
||||
WordType.prototype.setReplaceManager = function(op) {
|
||||
this.saveOperation('replace_manager', op);
|
||||
this.validateSavedOperations();
|
||||
return this.on(['insert', 'delete'], (function(_this) {
|
||||
return function() {
|
||||
this.on('insert', (function(_this) {
|
||||
return function(event, ins) {
|
||||
var _ref;
|
||||
return (_ref = _this.replace_manager) != null ? _ref.callEvent('change') : void 0;
|
||||
return (_ref = _this.replace_manager) != null ? _ref.forwardEvent(_this, 'change', ins) : void 0;
|
||||
};
|
||||
})(this));
|
||||
return this.on('delete', (function(_this) {
|
||||
return function(event, ins, del) {
|
||||
var _ref;
|
||||
return (_ref = _this.replace_manager) != null ? _ref.forwardEvent(_this, 'change', del) : void 0;
|
||||
};
|
||||
})(this));
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user