Index: trunk/extensions/VisualEditor/modules/es/es.TransactionProcessor.js |
— | — | @@ -256,8 +256,15 @@ |
257 | 257 | }; |
258 | 258 | |
259 | 259 | 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; |
262 | 269 | if ( node.getParent() === this.model ) { |
263 | 270 | offset = this.model.getOffsetFromNode( node ); |
264 | 271 | } else { |