r105407 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105406‎ | r105407 | r105408 >
Date:01:38, 7 December 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Fixed scope issue when inserting at structural offsets
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/es.TransactionProcessor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/es.TransactionProcessor.js
@@ -256,8 +256,15 @@
257257 };
258258
259259 es.TransactionProcessor.prototype.insert = function( op ) {
260 - var node = this.model.getNodeFromOffset( this.cursor ),
261 - offset;
 260+ var node;
 261+ // If the cursor is on the left of a structural offset, it's going to the the parent node of
 262+ // the element we want to be inserting into
 263+ if ( es.DocumentModel.isStructuralOffset( this.model.data, this.cursor ) ) {
 264+ node = this.model.getNodeFromOffset( this.cursor + 1 );
 265+ } else {
 266+ node = this.model.getNodeFromOffset( this.cursor );
 267+ }
 268+ var offset;
262269 if ( node.getParent() === this.model ) {
263270 offset = this.model.getOffsetFromNode( node );
264271 } else {

Status & tagging log