Implement the replace operation for the linear model

This commit is contained in:
Roan Kattouw 2012-03-08 23:21:20 +00:00
parent 46dbb30b7a
commit cac9971299
Notes: Roan Kattouw 2012-03-08 23:21:20 +00:00

View file

@ -454,7 +454,17 @@ ve.dm.TransactionProcessor.prototype.remove = function( op ) {
};
ve.dm.TransactionProcessor.prototype.replace = function( op, invert ) {
// TODO
var remove = invert ? op.replacement : op.remove,
replacement = invert ? op.remove : op.replacement;
// remove is provided only for OT / conflict resolution and for
// reversibility, we don't actually verify it here
// Update the linear model
ve.batchedSplice( this.model.data, this.cursor, remove.length, replacement );
this.cursor += replacement.length - remove.length;
// TODO sync the tree too
};
ve.dm.TransactionProcessor.prototype.attribute = function( op, invert ) {