Index: trunk/parsers/wikidom/lib/hype/models/es.DocumentModel.js |
— | — | @@ -545,7 +545,17 @@ |
546 | 546 | */ |
547 | 547 | es.DocumentModel.prototype.prepareInsertion = function( offset, data ) { |
548 | 548 | var tx = new es.Transaction(); |
| 549 | + if ( offset > 0 ) { |
| 550 | + tx.pushRetain( offset ); |
| 551 | + } |
| 552 | + // TODO check for structural changes |
| 553 | + tx.pushInsert( data ); |
| 554 | + if ( offset < this.data.length ) { |
| 555 | + tx.pushRetain( this.data.length - offset ); |
| 556 | + } |
549 | 557 | |
| 558 | + return tx; |
| 559 | + |
550 | 560 | /* |
551 | 561 | * // Structural changes |
552 | 562 | * There are 2 basic types of locations the insertion point can be: |