https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113421

Revision: 113421
Author:   catrope
Date:     2012-03-08 23:21:20 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
Implement the replace operation for the linear model

Modified Paths:
--------------
    trunk/extensions/VisualEditor/modules/ve/dm/ve.dm.TransactionProcessor.js

Modified: 
trunk/extensions/VisualEditor/modules/ve/dm/ve.dm.TransactionProcessor.js
===================================================================
--- trunk/extensions/VisualEditor/modules/ve/dm/ve.dm.TransactionProcessor.js   
2012-03-08 23:21:18 UTC (rev 113420)
+++ trunk/extensions/VisualEditor/modules/ve/dm/ve.dm.TransactionProcessor.js   
2012-03-08 23:21:20 UTC (rev 113421)
@@ -454,7 +454,17 @@
 };
 
 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 ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to