Index: trunk/parsers/wikidom/lib/es/es.Document.js |
— | — | @@ -60,11 +60,24 @@ |
61 | 61 | Document.prototype.insertBlockBefore = function( block, before ) { |
62 | 62 | block.document = this; |
63 | 63 | if ( before ) { |
64 | | - this.blocks.splice( before.index(), 0, block ); |
| 64 | + this.blocks.splice( before.getIndex(), 0, block ); |
65 | 65 | } else { |
66 | 66 | this.blocks.push( block ); |
67 | 67 | } |
68 | 68 | }; |
| 69 | +/** |
| 70 | + * Adds a block to the document after an existing block. |
| 71 | + * @param block {Block} Block to insert |
| 72 | + * @param after {Block} Block to insert after, if null then block will be inserted at the end |
| 73 | + */ |
| 74 | +Document.prototype.insertBlockAfter = function( block, after ) { |
| 75 | + block.document = this; |
| 76 | + if ( after ) { |
| 77 | + this.blocks.splice( after.getIndex() + 1, 0, block ); |
| 78 | + } else { |
| 79 | + this.blocks.push( block ); |
| 80 | + } |
| 81 | +} |
69 | 82 | |
70 | 83 | /** |
71 | 84 | * Removes a block from the document. |
— | — | @@ -72,7 +85,7 @@ |
73 | 86 | * @param {Block} Block to remove |
74 | 87 | */ |
75 | 88 | Document.prototype.removeBlock = function( block ) { |
76 | | - this.blocks.splice( block.index(), 1 ); |
| 89 | + this.blocks.splice( block.getIndex(), 1 ); |
77 | 90 | block.document = null; |
78 | 91 | }; |
79 | 92 | |