r94602 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94601‎ | r94602 | r94603 >
Date:06:03, 16 August 2011
Author:inez
Status:deferred
Tags:
Comment:
Implementation of getLength and insertContent for ListBlock
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.ListBlock.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.ListBlock.js
@@ -119,6 +119,32 @@
120120 return lineIndex;
121121 };
122122
 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+
123149 es.ListBlock.prototype.getText = function( range, render ) {
124150 return "";
125151 };

Status & tagging log