http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97758
Revision: 97758
Author: tparscal
Date: 2011-09-21 19:50:41 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
Comments and cleanup
Modified Paths:
--------------
trunk/parsers/wikidom/lib/synth/views/es.BlockView.js
trunk/parsers/wikidom/lib/synth/views/es.ContentView.js
trunk/parsers/wikidom/lib/synth/views/es.DocumentView.js
trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js
trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js
trunk/parsers/wikidom/lib/synth/views/es.ParagraphBlockView.js
trunk/parsers/wikidom/lib/synth/views/es.TableBlockCellView.js
trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js
trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js
Modified: trunk/parsers/wikidom/lib/synth/views/es.BlockView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.BlockView.js 2011-09-21
19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.BlockView.js 2011-09-21
19:50:41 UTC (rev 97758)
@@ -2,7 +2,7 @@
* Creates an es.BlockView object.
*
* @class
- * @extends {es.DomContainerItem}
+ * @extends {es.ViewListItem}
* @abstract
* @constructor
* @param typeName {String} Name of block type (optional, default: "block")
@@ -14,6 +14,8 @@
/**
* Render content.
+ *
+ * @method
*/
es.BlockView.prototype.renderContent = function() {
throw 'BlockView.renderContent not implemented in this subclass.';
@@ -21,32 +23,57 @@
/**
* Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
*/
-es.BlockView.getContentOffset = function( position ) {
+es.BlockView.prototype.getContentOffset = function( position ) {
throw 'BlockView.getContentOffset not implemented in this subclass.';
};
/**
* Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
*/
-es.BlockView.getRenderedPosition = function( offset ) {
+es.BlockView.prototype.getRenderedPosition = function( offset ) {
throw 'BlockView.getRenderedPosition not implemented in this subclass.';
};
/**
- * Gets rendered line index of offset within content.
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
*/
-es.BlockView.getRenderedLineIndex = function( offset ) {
- throw 'BlockView.getRenderedLineIndex not implemented in this
subclass.';
+es.BlockView.prototype.drawSelection = function( range ) {
+ throw 'BlockView.drawSelection not implemented in this subclass.';
};
/**
- * Gets range of content in a rendered line which an offset is within.
+ * Gets length of contents.
+ *
+ * @method
+ * @returns {Integer} Length of content, including any virtual spaces within
the block
*/
-es.BlockView.getRenderedLineRange = function( offset ) {
- throw 'BlockView.getRenderedLineRange not implemented in this
subclass.';
+es.BlockView.prototype.getLength = function() {
+ throw 'BlockView.getLength not implemented in this subclass.';
};
+/**
+ * Gets HTML rendering of block.
+ *
+ * @method
+ * @param options {Object} List of options, see es.DocumentView.getHtml for
details
+ * @returns {String} HTML data
+ */
+es.BlockView.prototype.getHtml = function( options ) {
+ throw 'BlockView.getHtml not implemented in this subclass.';
+}
+
/* Inheritance */
es.extend( es.BlockView, es.ViewListItem );
Modified: trunk/parsers/wikidom/lib/synth/views/es.ContentView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.ContentView.js 2011-09-21
19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.ContentView.js 2011-09-21
19:50:41 UTC (rev 97758)
@@ -196,6 +196,12 @@
/* Methods */
+/**
+ * Draws selection around a given range of content.
+ *
+ * @method
+ * @param range {es.Range} Range to draw selection around
+ */
es.ContentView.prototype.drawSelection = function( range ) {
range.normalize();
@@ -242,6 +248,13 @@
}
};
+/**
+ * Gets the index of the rendered line a given offset is within.
+ *
+ * @method
+ * @param offset {Integer} Offset to get line for
+ * @returns {Integer} Index of rendered lin offset is within
+ */
es.ContentView.prototype.getLineIndex = function( offset ) {
for ( var i = 0; i < this.lines.length; i++ ) {
if ( this.lines[i].range.containsOffset( offset ) ) {
@@ -256,10 +269,11 @@
*
* Position is assumed to be local to the container the text is being flowed
in.
*
+ * @method
* @param position {Object} Position to find offset for
* @param position.left {Integer} Horizontal position in pixels
* @param position.top {Integer} Vertical position in pixels
- * @return {Integer} Offset within content model nearest the given coordinates
+ * @returns {Integer} Offset within content model nearest the given coordinates
*/
es.ContentView.prototype.getOffset = function( position ) {
// Empty content model shortcut
@@ -325,11 +339,12 @@
/**
* Gets position coordinates of a given offset.
*
- * Offsets are boundaries between plain or annotated characters within content
model. Results are given in
- * left, top and bottom positions, which could be used to draw a cursor,
highlighting, etc.
+ * Offsets are boundaries between plain or annotated characters within content
model. Results are
+ * given in left, top and bottom positions, which could be used to draw a
cursor, highlighting, etc.
*
+ * @method
* @param offset {Integer} Offset within content model
- * @return {Object} Object containing left, top and bottom properties, each
positions in pixels as
+ * @returns {Object} Object containing left, top and bottom properties, each
positions in pixels as
* well as a line index
*/
es.ContentView.prototype.getPosition = function( offset ) {
@@ -398,6 +413,8 @@
/**
* Updates the word boundary cache, which is used for word fitting.
+ *
+ * @method
*/
es.ContentView.prototype.scanBoundaries = function() {
/*
@@ -439,6 +456,9 @@
* In cases where a single word is too long to fit on a line, the word will be
"virtually" wrapped,
* causing them to be fragmented. Word fragments are rendered on their own
lines, except for their
* remainder, which is combined with whatever proceeding words can fit on the
same line.
+ *
+ * @method
+ * @param limit {Integer} Maximum number of iterations to render before
yeilding
*/
es.ContentView.prototype.renderIteration = function( limit ) {
var rs = this.renderState,
@@ -520,6 +540,7 @@
* allowing rendering to be interrupted and restarted if changes to content
model are happening before
* rendering of all lines is complete.
*
+ * @method
* @param offset {Integer} Offset to re-render from, if possible (not yet
implemented)
*/
es.ContentView.prototype.render = function( offset ) {
@@ -591,6 +612,7 @@
/**
* Adds a line containing a given range of text to the end of the DOM and the
"lines" array.
*
+ * @method
* @param range {es.Range} Range of data within content model to append
* @param start {Integer} Beginning of text range for line
* @param end {Integer} Ending of text range for line
@@ -641,10 +663,11 @@
* starting with [offset .. limit], which usually results in reducing the end
position in all but
* the last line, and in most cases more than 3 times, before changing
directions.
*
+ * @method
* @param range {es.Range} Range of data within content model to try to fit
* @param ruler {HTMLElement} Element to take measurements with
* @param width {Integer} Maximum width to allow the line to extend to
- * @return {Integer} Last index within "words" that contains a word that fits
+ * @returns {Integer} Last index within "words" that contains a word that fits
*/
es.ContentView.prototype.fitWords = function( range, ruler, width ) {
var offset = range.start,
@@ -696,10 +719,11 @@
* used to detect when the first character was too long to fit on a line. In
such cases the result
* will contain the index of the first character and it's width.
*
+ * @method
* @param range {es.Range} Range of data within content model to try to fit
* @param ruler {HTMLElement} Element to take measurements with
* @param width {Integer} Maximum width to allow the line to extend to
- * @return {Integer} Last index within "text" that contains a character that
fits
+ * @returns {Integer} Last index within "text" that contains a character that
fits
*/
es.ContentView.prototype.fitCharacters = function( range, ruler, width ) {
var offset = range.start,
Modified: trunk/parsers/wikidom/lib/synth/views/es.DocumentView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.DocumentView.js 2011-09-21
19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.DocumentView.js 2011-09-21
19:50:41 UTC (rev 97758)
@@ -2,6 +2,7 @@
* Creates an es.DocumentView object.
*
* @class
+ * @extends {es.ViewList}
* @constructor
*/
es.DocumentView = function( documentModel ) {
@@ -9,8 +10,12 @@
this.$.addClass( 'editSurface-document' )
};
+/* Methods */
+
/**
* Render content.
+ *
+ * @method
*/
es.DocumentView.prototype.renderContent = function() {
for ( var i = 0; i < this.items.length; i++ ) {
@@ -18,6 +23,34 @@
}
};
+/**
+ * Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
+ */
+es.DocumentView.prototype.getContentOffset = function( position ) {
+ // TODO
+};
+
+/**
+ * Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
+ */
+es.DocumentView.prototype.getRenderedPosition = function( offset ) {
+ // TODO
+};
+
+/**
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
+ */
es.DocumentView.prototype.drawSelection = function( range ) {
var selectedViews = this.items.select( range );
for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -27,7 +60,13 @@
}
};
-es.DocumentView.prototype.getLength = function( ) {
+/**
+ * Gets length of contents.
+ *
+ * @method
+ * @returns {Integer} Length of content, including virtual spaces between
blocks
+ */
+es.DocumentView.prototype.getLength = function() {
return this.items.getLengthOfItems();
};
Modified: trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js
2011-09-21 19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js
2011-09-21 19:50:41 UTC (rev 97758)
@@ -2,6 +2,7 @@
* Creates an es.ListBlockItemView object.
*
* @class
+ * @extends {es.ViewListItem}
* @constructor
*/
es.ListBlockItemView = function( model ) {
@@ -21,48 +22,62 @@
} );
};
+/* Methods */
+
+
/**
* Render content.
+ *
+ * @method
*/
es.ListBlockItemView.prototype.renderContent = function() {
this.contentView.render();
};
-es.ListBlockItemView.prototype.setNumber = function( number ) {
- this.$icon.text( number + '.' );
-};
-
/**
* Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
*/
-es.ListBlockItemView.getContentOffset = function( position ) {
+es.ListBlockItemView.prototype.getContentOffset = function( position ) {
return this.contentView.getOffset( position );
};
/**
* Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
*/
-es.ListBlockItemView.getRenderedPosition = function( offset ) {
+es.ListBlockItemView.prototype.getRenderedPosition = function( offset ) {
return this.contentView.getPosition( position );
};
/**
- * Gets rendered line index of offset within content.
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
*/
-es.ListBlockItemView.getRenderedLineIndex = function( offset ) {
- return this.contentView.getLineIndex( position );
+es.ListBlockItemView.prototype.drawSelection = function( range ) {
+ this.contentView.drawSelection( range );
};
+/**
+ * Gets length of contents.
+ *
+ * @method
+ * @returns {Integer} Length of content, including any virtual spaces within
the block
+ */
es.ListBlockItemView.prototype.getLength = function() {
return this.model.getLength();
};
-es.ListBlockItemView.prototype.drawSelection = function( range ) {
- this.contentView.drawSelection( range );
-};
-
/**
- * Gets HTML rendering of item.
+ * Gets HTML rendering of block.
*
* @method
* @param options {Object} List of options, see es.DocumentView.getHtml for
details
@@ -74,6 +89,15 @@
{ 'class': this.$.attr( 'class' ) },
this.contentView.getHtml()
);
+}
+
+/**
+ * Sets the number label of the item, used for unordered lists
+ *
+ * @method
+ */
+es.ListBlockItemView.prototype.setNumber = function( number ) {
+ this.$icon.text( number + '.' );
};
/* Inheritance */
Modified: trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js 2011-09-21
19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js 2011-09-21
19:50:41 UTC (rev 97758)
@@ -2,6 +2,8 @@
* Creates an es.ListBlockView object.
*
* @class
+ * @extends {es.ViewList}
+ * @extends {es.BlockView}
* @constructor
*/
es.ListBlockView = function( model ) {
@@ -14,8 +16,12 @@
} );
};
+/* Methods */
+
/**
* Render content.
+ *
+ * @method
*/
es.ListBlockView.prototype.renderContent = function() {
for ( var i = 0; i < this.items.length; i++ ) {
@@ -23,47 +29,34 @@
}
};
-es.ListBlockView.prototype.enumerate = function() {
- var itemLevel,
- levels = [];
-
- for ( var i = 0; i < this.items.length; i++ ) {
- itemLevel = this.items[i].model.getLevel();
- levels = levels.slice(0, itemLevel + 1);
- if ( this.items[i].model.getStyle() === 'number' ) {
- if ( !levels[itemLevel] ) {
- levels[itemLevel] = 0;
- }
- this.items[i].setNumber( ++levels[itemLevel] );
- }
- }
-};
-
/**
* Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
*/
-es.ListBlockView.getContentOffset = function( position ) {
- //return this.contentView.getOffset( position );
+es.ListBlockView.prototype.getContentOffset = function( position ) {
+ // TODO
};
/**
* Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
*/
-es.ListBlockView.getRenderedPosition = function( offset ) {
- //return this.contentView.getPosition( position );
+es.ListBlockView.prototype.getRenderedPosition = function( offset ) {
+ // TODO
};
/**
- * Gets rendered line index of offset within content.
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
*/
-es.ListBlockView.getRenderedLineIndex = function( offset ) {
- //return this.contentView.getLineIndex( position );
-};
-
-es.ListBlockView.prototype.getLength = function() {
- return this.model.items.getLengthOfItems();
-};
-
es.ListBlockView.prototype.drawSelection = function( range ) {
var selectedViews = this.items.select( range );
for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -74,6 +67,16 @@
};
/**
+ * Gets length of contents.
+ *
+ * @method
+ * @returns {Integer} Length of content, including any virtual spaces within
the block
+ */
+es.ListBlockView.prototype.getLength = function() {
+ return this.model.items.getLengthOfItems();
+};
+
+/**
* Gets HTML rendering of block.
*
* @method
@@ -90,6 +93,27 @@
);
};
+/**
+ * Set the number labels of all ordered list items.
+ *
+ * @method
+ */
+es.ListBlockView.prototype.enumerate = function() {
+ var itemLevel,
+ levels = [];
+
+ for ( var i = 0; i < this.items.length; i++ ) {
+ itemLevel = this.items[i].model.getLevel();
+ levels = levels.slice(0, itemLevel + 1);
+ if ( this.items[i].model.getStyle() === 'number' ) {
+ if ( !levels[itemLevel] ) {
+ levels[itemLevel] = 0;
+ }
+ this.items[i].setNumber( ++levels[itemLevel] );
+ }
+ }
+};
+
/* Inheritance */
es.extend( es.ListBlockView, es.ViewList );
Modified: trunk/parsers/wikidom/lib/synth/views/es.ParagraphBlockView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.ParagraphBlockView.js
2011-09-21 19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.ParagraphBlockView.js
2011-09-21 19:50:41 UTC (rev 97758)
@@ -2,6 +2,7 @@
* Creates an es.ParagraphBlockView object.
*
* @class
+ * @extends {es.BlockView}
* @constructor
*/
es.ParagraphBlockView = function( model ) {
@@ -16,8 +17,12 @@
} );
};
+/* Methods */
+
/**
* Render content.
+ *
+ * @method
*/
es.ParagraphBlockView.prototype.renderContent = function() {
this.contentView.render();
@@ -25,33 +30,46 @@
/**
* Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
*/
-es.ParagraphBlockView.getContentOffset = function( position ) {
+es.ParagraphBlockView.prototype.getContentOffset = function( position ) {
return this.contentView.getOffset( position );
};
/**
* Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
*/
-es.ParagraphBlockView.getRenderedPosition = function( offset ) {
+es.ParagraphBlockView.prototype.getRenderedPosition = function( offset ) {
return this.contentView.getPosition( position );
};
/**
- * Gets rendered line index of offset within content.
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
*/
-es.ParagraphBlockView.getRenderedLineIndex = function( offset ) {
- return this.contentView.getLineIndex( position );
+es.ParagraphBlockView.prototype.drawSelection = function( range ) {
+ this.contentView.drawSelection( range );
};
+/**
+ * Gets length of contents.
+ *
+ * @method
+ * @returns {Integer} Length of content, including any virtual spaces within
the block
+ */
es.ParagraphBlockView.prototype.getLength = function() {
return this.model.getContentLength();
};
-es.ParagraphBlockView.prototype.drawSelection = function( range ) {
- this.contentView.drawSelection( range );
-};
-
/**
* Gets HTML rendering of block.
*
Modified: trunk/parsers/wikidom/lib/synth/views/es.TableBlockCellView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.TableBlockCellView.js
2011-09-21 19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.TableBlockCellView.js
2011-09-21 19:50:41 UTC (rev 97758)
@@ -2,6 +2,7 @@
* Creates an es.TableBlockCellView object.
*
* @class
+ * @extends {es.ViewListItem}
* @constructor
*/
es.TableBlockCellView = function( model ) {
@@ -11,31 +12,69 @@
this.$.attr( this.model.attributes );
};
+/* Methods */
+
/**
* Render content.
+ *
+ * @method
*/
es.TableBlockCellView.prototype.renderContent = function() {
this.documentView.renderContent();
};
-es.TableBlockCellView.prototype.getLength = function() {
- return this.documentView.getLength();
+/**
+ * Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
+ */
+es.TableBlockCellView.prototype.getContentOffset = function( position ) {
+ // TODO
};
+/**
+ * Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
+ */
+es.TableBlockCellView.prototype.getRenderedPosition = function( offset ) {
+ // TODO
+};
+
+/**
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
+ */
es.TableBlockCellView.prototype.drawSelection = function( range ) {
this.documentView.drawSelection( range );
};
/**
- * Gets HTML rendering of cell.
+ * Gets length of contents.
*
* @method
+ * @returns {Integer} Length of content, including any virtual spaces within
the block
+ */
+es.TableBlockCellView.prototype.getLength = function() {
+ return this.documentView.getLength();
+};
+
+/**
+ * Gets HTML rendering of block.
+ *
+ * @method
* @param options {Object} List of options, see es.DocumentView.getHtml for
details
* @returns {String} HTML data
*/
es.TableBlockCellView.prototype.getHtml = function( options ) {
return es.Html.makeTag( 'td', this.model.attributes,
this.documentView.getHtml() );
-};
+}
/* Inheritance */
Modified: trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js
2011-09-21 19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js
2011-09-21 19:50:41 UTC (rev 97758)
@@ -2,6 +2,8 @@
* Creates an es.TableBlockRowView object.
*
* @class
+ * @extends {es.ViewList}
+ * @extends {es.ViewListItem}
* @constructor
*/
es.TableBlockRowView = function( model ) {
@@ -10,8 +12,12 @@
this.$.attr( this.model.attributes );
};
+/* Methods */
+
/**
* Render content.
+ *
+ * @method
*/
es.TableBlockRowView.prototype.renderContent = function() {
for ( var i = 0; i < this.items.length; i++ ) {
@@ -19,10 +25,34 @@
}
};
-es.TableBlockRowView.prototype.getLength = function() {
- return this.items.getLengthOfItems();
+/**
+ * Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
+ */
+es.TableBlockRowView.prototype.getContentOffset = function( position ) {
+ // TODO
};
+/**
+ * Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
+ */
+es.TableBlockRowView.prototype.getRenderedPosition = function( offset ) {
+ // TODO
+};
+
+/**
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
+ */
es.TableBlockRowView.prototype.drawSelection = function( range ) {
var selectedViews = this.items.select( range );
for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -33,9 +63,19 @@
};
/**
- * Gets HTML rendering of row.
+ * Gets length of contents.
*
* @method
+ * @returns {Integer} Length of content, including any virtual spaces within
the block
+ */
+es.TableBlockRowView.prototype.getLength = function() {
+ return this.items.getLengthOfItems();
+};
+
+/**
+ * Gets HTML rendering of block.
+ *
+ * @method
* @param options {Object} List of options, see es.DocumentView.getHtml for
details
* @returns {String} HTML data
*/
@@ -43,7 +83,7 @@
return es.Html.makeTag( 'tr', this.model.attributes, $.map( this.items,
function( view ) {
return view.getHtml();
} ).join( '' ) );
-};
+}
/* Inheritance */
Modified: trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js 2011-09-21
19:30:08 UTC (rev 97757)
+++ trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js 2011-09-21
19:50:41 UTC (rev 97758)
@@ -2,6 +2,8 @@
* Creates an es.TableBlockView object.
*
* @class
+ * @extends {es.ViewList}
+ * @extends {es.BlockView}
* @constructor
*/
es.TableBlockView = function( model ) {
@@ -11,8 +13,12 @@
this.$.addClass( 'editSurface-tableBlock' );
};
+/* Methods */
+
/**
* Render content.
+ *
+ * @method
*/
es.TableBlockView.prototype.renderContent = function() {
for ( var i = 0; i < this.items.length; i++ ) {
@@ -20,10 +26,34 @@
}
};
-es.TableBlockView.prototype.getLength = function() {
- return this.items.getLengthOfItems();
+/**
+ * Gets offset within content of position.
+ *
+ * @method
+ * @param position {es.Position} Position to get offset for
+ * @returns {Integer} Offset nearest to position
+ */
+es.TableBlockView.prototype.getContentOffset = function( position ) {
+ // TODO
};
+/**
+ * Gets rendered position of offset within content.
+ *
+ * @method
+ * @param offset {Integer} Offset to get position for
+ * @returns {es.Position} Position of offset
+ */
+es.TableBlockView.prototype.getRenderedPosition = function( offset ) {
+ // TODO
+};
+
+/**
+ * Draw selection around a given range.
+ *
+ * @method
+ * @param range {es.Range} Range of content to draw selection around
+ */
es.TableBlockView.prototype.drawSelection = function( range ) {
var selectedViews = this.items.select( range );
for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -34,6 +64,16 @@
};
/**
+ * Gets length of contents.
+ *
+ * @method
+ * @returns {Integer} Length of content, including any virtual spaces within
the block
+ */
+es.TableBlockView.prototype.getLength = function() {
+ return this.items.getLengthOfItems();
+};
+
+/**
* Gets HTML rendering of block.
*
* @method
@@ -44,7 +84,7 @@
return es.Html.makeTag( 'table', this.model.attributes, $.map(
this.items, function( view ) {
return view.getHtml();
} ).join( '' ) );
-};
+}
/* Inheritance */
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs