Index: trunk/parsers/wikidom/lib/es/es.ListBlock.js |
— | — | @@ -119,6 +119,32 @@ |
120 | 120 | return lineIndex; |
121 | 121 | }; |
122 | 122 | |
| 123 | +/** |
| 124 | + * Gets the length of all block content. |
| 125 | + * |
| 126 | + * @method |
| 127 | + * @returns {Integer} Length of content |
| 128 | + */ |
| 129 | +es.ListBlock.prototype.getLength = function( ) { |
| 130 | + var length = 0; |
| 131 | + this.list.traverseItems( function( item, index ) { |
| 132 | + length += item.content.getLength() + 1; |
| 133 | + } ); |
| 134 | + return length === 0 ? 0 : length - 1; |
| 135 | +}; |
| 136 | + |
| 137 | +/** |
| 138 | + * Inserts content into a block at an offset. |
| 139 | + * |
| 140 | + * @method |
| 141 | + * @param offset {Integer} Position to insert content at |
| 142 | + * @param content {Object} Content to insert |
| 143 | + */ |
| 144 | +es.ListBlock.prototype.insertContent = function( offset, content ) { |
| 145 | + var location = this.getLocationFromOffset( offset ); |
| 146 | + location.item.flow.content.insert( location.offset, content ); |
| 147 | +}; |
| 148 | + |
123 | 149 | es.ListBlock.prototype.getText = function( range, render ) { |
124 | 150 | return ""; |
125 | 151 | }; |