mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Implement the replace operation for the linear model
This commit is contained in:
parent
46dbb30b7a
commit
cac9971299
Notes:
Roan Kattouw
2012-03-08 23:21:20 +00:00
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in a new issue