r97758 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97757‎ | r97758 | r97759 >
Date:19:50, 21 September 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Comments and cleanup
Modified paths:
  • /trunk/parsers/wikidom/lib/synth/views/es.BlockView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.ContentView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.DocumentView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.ParagraphBlockView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.TableBlockCellView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js (modified) (history)
  • /trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockItemView.js
@@ -2,6 +2,7 @@
33 * Creates an es.ListBlockItemView object.
44 *
55 * @class
 6+ * @extends {es.ViewListItem}
67 * @constructor
78 */
89 es.ListBlockItemView = function( model ) {
@@ -21,48 +22,62 @@
2223 } );
2324 };
2425
 26+/* Methods */
 27+
 28+
2529 /**
2630 * Render content.
 31+ *
 32+ * @method
2733 */
2834 es.ListBlockItemView.prototype.renderContent = function() {
2935 this.contentView.render();
3036 };
3137
32 -es.ListBlockItemView.prototype.setNumber = function( number ) {
33 - this.$icon.text( number + '.' );
34 -};
35 -
3638 /**
3739 * Gets offset within content of position.
 40+ *
 41+ * @method
 42+ * @param position {es.Position} Position to get offset for
 43+ * @returns {Integer} Offset nearest to position
3844 */
39 -es.ListBlockItemView.getContentOffset = function( position ) {
 45+es.ListBlockItemView.prototype.getContentOffset = function( position ) {
4046 return this.contentView.getOffset( position );
4147 };
4248
4349 /**
4450 * Gets rendered position of offset within content.
 51+ *
 52+ * @method
 53+ * @param offset {Integer} Offset to get position for
 54+ * @returns {es.Position} Position of offset
4555 */
46 -es.ListBlockItemView.getRenderedPosition = function( offset ) {
 56+es.ListBlockItemView.prototype.getRenderedPosition = function( offset ) {
4757 return this.contentView.getPosition( position );
4858 };
4959
5060 /**
51 - * Gets rendered line index of offset within content.
 61+ * Draw selection around a given range.
 62+ *
 63+ * @method
 64+ * @param range {es.Range} Range of content to draw selection around
5265 */
53 -es.ListBlockItemView.getRenderedLineIndex = function( offset ) {
54 - return this.contentView.getLineIndex( position );
 66+es.ListBlockItemView.prototype.drawSelection = function( range ) {
 67+ this.contentView.drawSelection( range );
5568 };
5669
 70+/**
 71+ * Gets length of contents.
 72+ *
 73+ * @method
 74+ * @returns {Integer} Length of content, including any virtual spaces within the block
 75+ */
5776 es.ListBlockItemView.prototype.getLength = function() {
5877 return this.model.getLength();
5978 };
6079
61 -es.ListBlockItemView.prototype.drawSelection = function( range ) {
62 - this.contentView.drawSelection( range );
63 -};
64 -
6580 /**
66 - * Gets HTML rendering of item.
 81+ * Gets HTML rendering of block.
6782 *
6883 * @method
6984 * @param options {Object} List of options, see es.DocumentView.getHtml for details
@@ -74,6 +89,15 @@
7590 { 'class': this.$.attr( 'class' ) },
7691 this.contentView.getHtml()
7792 );
 93+}
 94+
 95+/**
 96+ * Sets the number label of the item, used for unordered lists
 97+ *
 98+ * @method
 99+ */
 100+es.ListBlockItemView.prototype.setNumber = function( number ) {
 101+ this.$icon.text( number + '.' );
78102 };
79103
80104 /* Inheritance */
Index: trunk/parsers/wikidom/lib/synth/views/es.ListBlockView.js
@@ -2,6 +2,8 @@
33 * Creates an es.ListBlockView object.
44 *
55 * @class
 6+ * @extends {es.ViewList}
 7+ * @extends {es.BlockView}
68 * @constructor
79 */
810 es.ListBlockView = function( model ) {
@@ -14,8 +16,12 @@
1517 } );
1618 };
1719
 20+/* Methods */
 21+
1822 /**
1923 * Render content.
 24+ *
 25+ * @method
2026 */
2127 es.ListBlockView.prototype.renderContent = function() {
2228 for ( var i = 0; i < this.items.length; i++ ) {
@@ -23,47 +29,34 @@
2430 }
2531 };
2632
27 -es.ListBlockView.prototype.enumerate = function() {
28 - var itemLevel,
29 - levels = [];
30 -
31 - for ( var i = 0; i < this.items.length; i++ ) {
32 - itemLevel = this.items[i].model.getLevel();
33 - levels = levels.slice(0, itemLevel + 1);
34 - if ( this.items[i].model.getStyle() === 'number' ) {
35 - if ( !levels[itemLevel] ) {
36 - levels[itemLevel] = 0;
37 - }
38 - this.items[i].setNumber( ++levels[itemLevel] );
39 - }
40 - }
41 -};
42 -
4333 /**
4434 * Gets offset within content of position.
 35+ *
 36+ * @method
 37+ * @param position {es.Position} Position to get offset for
 38+ * @returns {Integer} Offset nearest to position
4539 */
46 -es.ListBlockView.getContentOffset = function( position ) {
47 - //return this.contentView.getOffset( position );
 40+es.ListBlockView.prototype.getContentOffset = function( position ) {
 41+ // TODO
4842 };
4943
5044 /**
5145 * Gets rendered position of offset within content.
 46+ *
 47+ * @method
 48+ * @param offset {Integer} Offset to get position for
 49+ * @returns {es.Position} Position of offset
5250 */
53 -es.ListBlockView.getRenderedPosition = function( offset ) {
54 - //return this.contentView.getPosition( position );
 51+es.ListBlockView.prototype.getRenderedPosition = function( offset ) {
 52+ // TODO
5553 };
5654
5755 /**
58 - * Gets rendered line index of offset within content.
 56+ * Draw selection around a given range.
 57+ *
 58+ * @method
 59+ * @param range {es.Range} Range of content to draw selection around
5960 */
60 -es.ListBlockView.getRenderedLineIndex = function( offset ) {
61 - //return this.contentView.getLineIndex( position );
62 -};
63 -
64 -es.ListBlockView.prototype.getLength = function() {
65 - return this.model.items.getLengthOfItems();
66 -};
67 -
6861 es.ListBlockView.prototype.drawSelection = function( range ) {
6962 var selectedViews = this.items.select( range );
7063 for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -74,6 +67,16 @@
7568 };
7669
7770 /**
 71+ * Gets length of contents.
 72+ *
 73+ * @method
 74+ * @returns {Integer} Length of content, including any virtual spaces within the block
 75+ */
 76+es.ListBlockView.prototype.getLength = function() {
 77+ return this.model.items.getLengthOfItems();
 78+};
 79+
 80+/**
7881 * Gets HTML rendering of block.
7982 *
8083 * @method
@@ -90,6 +93,27 @@
9194 );
9295 };
9396
 97+/**
 98+ * Set the number labels of all ordered list items.
 99+ *
 100+ * @method
 101+ */
 102+es.ListBlockView.prototype.enumerate = function() {
 103+ var itemLevel,
 104+ levels = [];
 105+
 106+ for ( var i = 0; i < this.items.length; i++ ) {
 107+ itemLevel = this.items[i].model.getLevel();
 108+ levels = levels.slice(0, itemLevel + 1);
 109+ if ( this.items[i].model.getStyle() === 'number' ) {
 110+ if ( !levels[itemLevel] ) {
 111+ levels[itemLevel] = 0;
 112+ }
 113+ this.items[i].setNumber( ++levels[itemLevel] );
 114+ }
 115+ }
 116+};
 117+
94118 /* Inheritance */
95119
96120 es.extend( es.ListBlockView, es.ViewList );
Index: trunk/parsers/wikidom/lib/synth/views/es.BlockView.js
@@ -2,7 +2,7 @@
33 * Creates an es.BlockView object.
44 *
55 * @class
6 - * @extends {es.DomContainerItem}
 6+ * @extends {es.ViewListItem}
77 * @abstract
88 * @constructor
99 * @param typeName {String} Name of block type (optional, default: "block")
@@ -14,6 +14,8 @@
1515
1616 /**
1717 * Render content.
 18+ *
 19+ * @method
1820 */
1921 es.BlockView.prototype.renderContent = function() {
2022 throw 'BlockView.renderContent not implemented in this subclass.';
@@ -21,32 +23,57 @@
2224
2325 /**
2426 * Gets offset within content of position.
 27+ *
 28+ * @method
 29+ * @param position {es.Position} Position to get offset for
 30+ * @returns {Integer} Offset nearest to position
2531 */
26 -es.BlockView.getContentOffset = function( position ) {
 32+es.BlockView.prototype.getContentOffset = function( position ) {
2733 throw 'BlockView.getContentOffset not implemented in this subclass.';
2834 };
2935
3036 /**
3137 * Gets rendered position of offset within content.
 38+ *
 39+ * @method
 40+ * @param offset {Integer} Offset to get position for
 41+ * @returns {es.Position} Position of offset
3242 */
33 -es.BlockView.getRenderedPosition = function( offset ) {
 43+es.BlockView.prototype.getRenderedPosition = function( offset ) {
3444 throw 'BlockView.getRenderedPosition not implemented in this subclass.';
3545 };
3646
3747 /**
38 - * Gets rendered line index of offset within content.
 48+ * Draw selection around a given range.
 49+ *
 50+ * @method
 51+ * @param range {es.Range} Range of content to draw selection around
3952 */
40 -es.BlockView.getRenderedLineIndex = function( offset ) {
41 - throw 'BlockView.getRenderedLineIndex not implemented in this subclass.';
 53+es.BlockView.prototype.drawSelection = function( range ) {
 54+ throw 'BlockView.drawSelection not implemented in this subclass.';
4255 };
4356
4457 /**
45 - * Gets range of content in a rendered line which an offset is within.
 58+ * Gets length of contents.
 59+ *
 60+ * @method
 61+ * @returns {Integer} Length of content, including any virtual spaces within the block
4662 */
47 -es.BlockView.getRenderedLineRange = function( offset ) {
48 - throw 'BlockView.getRenderedLineRange not implemented in this subclass.';
 63+es.BlockView.prototype.getLength = function() {
 64+ throw 'BlockView.getLength not implemented in this subclass.';
4965 };
5066
 67+/**
 68+ * Gets HTML rendering of block.
 69+ *
 70+ * @method
 71+ * @param options {Object} List of options, see es.DocumentView.getHtml for details
 72+ * @returns {String} HTML data
 73+ */
 74+es.BlockView.prototype.getHtml = function( options ) {
 75+ throw 'BlockView.getHtml not implemented in this subclass.';
 76+}
 77+
5178 /* Inheritance */
5279
5380 es.extend( es.BlockView, es.ViewListItem );
Index: trunk/parsers/wikidom/lib/synth/views/es.ContentView.js
@@ -196,6 +196,12 @@
197197
198198 /* Methods */
199199
 200+/**
 201+ * Draws selection around a given range of content.
 202+ *
 203+ * @method
 204+ * @param range {es.Range} Range to draw selection around
 205+ */
200206 es.ContentView.prototype.drawSelection = function( range ) {
201207 range.normalize();
202208
@@ -242,6 +248,13 @@
243249 }
244250 };
245251
 252+/**
 253+ * Gets the index of the rendered line a given offset is within.
 254+ *
 255+ * @method
 256+ * @param offset {Integer} Offset to get line for
 257+ * @returns {Integer} Index of rendered lin offset is within
 258+ */
246259 es.ContentView.prototype.getLineIndex = function( offset ) {
247260 for ( var i = 0; i < this.lines.length; i++ ) {
248261 if ( this.lines[i].range.containsOffset( offset ) ) {
@@ -256,10 +269,11 @@
257270 *
258271 * Position is assumed to be local to the container the text is being flowed in.
259272 *
 273+ * @method
260274 * @param position {Object} Position to find offset for
261275 * @param position.left {Integer} Horizontal position in pixels
262276 * @param position.top {Integer} Vertical position in pixels
263 - * @return {Integer} Offset within content model nearest the given coordinates
 277+ * @returns {Integer} Offset within content model nearest the given coordinates
264278 */
265279 es.ContentView.prototype.getOffset = function( position ) {
266280 // Empty content model shortcut
@@ -325,11 +339,12 @@
326340 /**
327341 * Gets position coordinates of a given offset.
328342 *
329 - * Offsets are boundaries between plain or annotated characters within content model. Results are given in
330 - * left, top and bottom positions, which could be used to draw a cursor, highlighting, etc.
 343+ * Offsets are boundaries between plain or annotated characters within content model. Results are
 344+ * given in left, top and bottom positions, which could be used to draw a cursor, highlighting, etc.
331345 *
 346+ * @method
332347 * @param offset {Integer} Offset within content model
333 - * @return {Object} Object containing left, top and bottom properties, each positions in pixels as
 348+ * @returns {Object} Object containing left, top and bottom properties, each positions in pixels as
334349 * well as a line index
335350 */
336351 es.ContentView.prototype.getPosition = function( offset ) {
@@ -398,6 +413,8 @@
399414
400415 /**
401416 * Updates the word boundary cache, which is used for word fitting.
 417+ *
 418+ * @method
402419 */
403420 es.ContentView.prototype.scanBoundaries = function() {
404421 /*
@@ -439,6 +456,9 @@
440457 * In cases where a single word is too long to fit on a line, the word will be "virtually" wrapped,
441458 * causing them to be fragmented. Word fragments are rendered on their own lines, except for their
442459 * remainder, which is combined with whatever proceeding words can fit on the same line.
 460+ *
 461+ * @method
 462+ * @param limit {Integer} Maximum number of iterations to render before yeilding
443463 */
444464 es.ContentView.prototype.renderIteration = function( limit ) {
445465 var rs = this.renderState,
@@ -520,6 +540,7 @@
521541 * allowing rendering to be interrupted and restarted if changes to content model are happening before
522542 * rendering of all lines is complete.
523543 *
 544+ * @method
524545 * @param offset {Integer} Offset to re-render from, if possible (not yet implemented)
525546 */
526547 es.ContentView.prototype.render = function( offset ) {
@@ -591,6 +612,7 @@
592613 /**
593614 * Adds a line containing a given range of text to the end of the DOM and the "lines" array.
594615 *
 616+ * @method
595617 * @param range {es.Range} Range of data within content model to append
596618 * @param start {Integer} Beginning of text range for line
597619 * @param end {Integer} Ending of text range for line
@@ -641,10 +663,11 @@
642664 * starting with [offset .. limit], which usually results in reducing the end position in all but
643665 * the last line, and in most cases more than 3 times, before changing directions.
644666 *
 667+ * @method
645668 * @param range {es.Range} Range of data within content model to try to fit
646669 * @param ruler {HTMLElement} Element to take measurements with
647670 * @param width {Integer} Maximum width to allow the line to extend to
648 - * @return {Integer} Last index within "words" that contains a word that fits
 671+ * @returns {Integer} Last index within "words" that contains a word that fits
649672 */
650673 es.ContentView.prototype.fitWords = function( range, ruler, width ) {
651674 var offset = range.start,
@@ -696,10 +719,11 @@
697720 * used to detect when the first character was too long to fit on a line. In such cases the result
698721 * will contain the index of the first character and it's width.
699722 *
 723+ * @method
700724 * @param range {es.Range} Range of data within content model to try to fit
701725 * @param ruler {HTMLElement} Element to take measurements with
702726 * @param width {Integer} Maximum width to allow the line to extend to
703 - * @return {Integer} Last index within "text" that contains a character that fits
 727+ * @returns {Integer} Last index within "text" that contains a character that fits
704728 */
705729 es.ContentView.prototype.fitCharacters = function( range, ruler, width ) {
706730 var offset = range.start,
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockRowView.js
@@ -2,6 +2,8 @@
33 * Creates an es.TableBlockRowView object.
44 *
55 * @class
 6+ * @extends {es.ViewList}
 7+ * @extends {es.ViewListItem}
68 * @constructor
79 */
810 es.TableBlockRowView = function( model ) {
@@ -10,8 +12,12 @@
1113 this.$.attr( this.model.attributes );
1214 };
1315
 16+/* Methods */
 17+
1418 /**
1519 * Render content.
 20+ *
 21+ * @method
1622 */
1723 es.TableBlockRowView.prototype.renderContent = function() {
1824 for ( var i = 0; i < this.items.length; i++ ) {
@@ -19,10 +25,34 @@
2026 }
2127 };
2228
23 -es.TableBlockRowView.prototype.getLength = function() {
24 - return this.items.getLengthOfItems();
 29+/**
 30+ * Gets offset within content of position.
 31+ *
 32+ * @method
 33+ * @param position {es.Position} Position to get offset for
 34+ * @returns {Integer} Offset nearest to position
 35+ */
 36+es.TableBlockRowView.prototype.getContentOffset = function( position ) {
 37+ // TODO
2538 };
2639
 40+/**
 41+ * Gets rendered position of offset within content.
 42+ *
 43+ * @method
 44+ * @param offset {Integer} Offset to get position for
 45+ * @returns {es.Position} Position of offset
 46+ */
 47+es.TableBlockRowView.prototype.getRenderedPosition = function( offset ) {
 48+ // TODO
 49+};
 50+
 51+/**
 52+ * Draw selection around a given range.
 53+ *
 54+ * @method
 55+ * @param range {es.Range} Range of content to draw selection around
 56+ */
2757 es.TableBlockRowView.prototype.drawSelection = function( range ) {
2858 var selectedViews = this.items.select( range );
2959 for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -33,9 +63,19 @@
3464 };
3565
3666 /**
37 - * Gets HTML rendering of row.
 67+ * Gets length of contents.
3868 *
3969 * @method
 70+ * @returns {Integer} Length of content, including any virtual spaces within the block
 71+ */
 72+es.TableBlockRowView.prototype.getLength = function() {
 73+ return this.items.getLengthOfItems();
 74+};
 75+
 76+/**
 77+ * Gets HTML rendering of block.
 78+ *
 79+ * @method
4080 * @param options {Object} List of options, see es.DocumentView.getHtml for details
4181 * @returns {String} HTML data
4282 */
@@ -43,7 +83,7 @@
4484 return es.Html.makeTag( 'tr', this.model.attributes, $.map( this.items, function( view ) {
4585 return view.getHtml();
4686 } ).join( '' ) );
47 -};
 87+}
4888
4989 /* Inheritance */
5090
Index: trunk/parsers/wikidom/lib/synth/views/es.DocumentView.js
@@ -2,6 +2,7 @@
33 * Creates an es.DocumentView object.
44 *
55 * @class
 6+ * @extends {es.ViewList}
67 * @constructor
78 */
89 es.DocumentView = function( documentModel ) {
@@ -9,8 +10,12 @@
1011 this.$.addClass( 'editSurface-document' )
1112 };
1213
 14+/* Methods */
 15+
1316 /**
1417 * Render content.
 18+ *
 19+ * @method
1520 */
1621 es.DocumentView.prototype.renderContent = function() {
1722 for ( var i = 0; i < this.items.length; i++ ) {
@@ -18,6 +23,34 @@
1924 }
2025 };
2126
 27+/**
 28+ * Gets offset within content of position.
 29+ *
 30+ * @method
 31+ * @param position {es.Position} Position to get offset for
 32+ * @returns {Integer} Offset nearest to position
 33+ */
 34+es.DocumentView.prototype.getContentOffset = function( position ) {
 35+ // TODO
 36+};
 37+
 38+/**
 39+ * Gets rendered position of offset within content.
 40+ *
 41+ * @method
 42+ * @param offset {Integer} Offset to get position for
 43+ * @returns {es.Position} Position of offset
 44+ */
 45+es.DocumentView.prototype.getRenderedPosition = function( offset ) {
 46+ // TODO
 47+};
 48+
 49+/**
 50+ * Draw selection around a given range.
 51+ *
 52+ * @method
 53+ * @param range {es.Range} Range of content to draw selection around
 54+ */
2255 es.DocumentView.prototype.drawSelection = function( range ) {
2356 var selectedViews = this.items.select( range );
2457 for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -27,7 +60,13 @@
2861 }
2962 };
3063
31 -es.DocumentView.prototype.getLength = function( ) {
 64+/**
 65+ * Gets length of contents.
 66+ *
 67+ * @method
 68+ * @returns {Integer} Length of content, including virtual spaces between blocks
 69+ */
 70+es.DocumentView.prototype.getLength = function() {
3271 return this.items.getLengthOfItems();
3372 };
3473
Index: trunk/parsers/wikidom/lib/synth/views/es.ParagraphBlockView.js
@@ -2,6 +2,7 @@
33 * Creates an es.ParagraphBlockView object.
44 *
55 * @class
 6+ * @extends {es.BlockView}
67 * @constructor
78 */
89 es.ParagraphBlockView = function( model ) {
@@ -16,8 +17,12 @@
1718 } );
1819 };
1920
 21+/* Methods */
 22+
2023 /**
2124 * Render content.
 25+ *
 26+ * @method
2227 */
2328 es.ParagraphBlockView.prototype.renderContent = function() {
2429 this.contentView.render();
@@ -25,33 +30,46 @@
2631
2732 /**
2833 * Gets offset within content of position.
 34+ *
 35+ * @method
 36+ * @param position {es.Position} Position to get offset for
 37+ * @returns {Integer} Offset nearest to position
2938 */
30 -es.ParagraphBlockView.getContentOffset = function( position ) {
 39+es.ParagraphBlockView.prototype.getContentOffset = function( position ) {
3140 return this.contentView.getOffset( position );
3241 };
3342
3443 /**
3544 * Gets rendered position of offset within content.
 45+ *
 46+ * @method
 47+ * @param offset {Integer} Offset to get position for
 48+ * @returns {es.Position} Position of offset
3649 */
37 -es.ParagraphBlockView.getRenderedPosition = function( offset ) {
 50+es.ParagraphBlockView.prototype.getRenderedPosition = function( offset ) {
3851 return this.contentView.getPosition( position );
3952 };
4053
4154 /**
42 - * Gets rendered line index of offset within content.
 55+ * Draw selection around a given range.
 56+ *
 57+ * @method
 58+ * @param range {es.Range} Range of content to draw selection around
4359 */
44 -es.ParagraphBlockView.getRenderedLineIndex = function( offset ) {
45 - return this.contentView.getLineIndex( position );
 60+es.ParagraphBlockView.prototype.drawSelection = function( range ) {
 61+ this.contentView.drawSelection( range );
4662 };
4763
 64+/**
 65+ * Gets length of contents.
 66+ *
 67+ * @method
 68+ * @returns {Integer} Length of content, including any virtual spaces within the block
 69+ */
4870 es.ParagraphBlockView.prototype.getLength = function() {
4971 return this.model.getContentLength();
5072 };
5173
52 -es.ParagraphBlockView.prototype.drawSelection = function( range ) {
53 - this.contentView.drawSelection( range );
54 -};
55 -
5674 /**
5775 * Gets HTML rendering of block.
5876 *
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockCellView.js
@@ -2,6 +2,7 @@
33 * Creates an es.TableBlockCellView object.
44 *
55 * @class
 6+ * @extends {es.ViewListItem}
67 * @constructor
78 */
89 es.TableBlockCellView = function( model ) {
@@ -11,31 +12,69 @@
1213 this.$.attr( this.model.attributes );
1314 };
1415
 16+/* Methods */
 17+
1518 /**
1619 * Render content.
 20+ *
 21+ * @method
1722 */
1823 es.TableBlockCellView.prototype.renderContent = function() {
1924 this.documentView.renderContent();
2025 };
2126
22 -es.TableBlockCellView.prototype.getLength = function() {
23 - return this.documentView.getLength();
 27+/**
 28+ * Gets offset within content of position.
 29+ *
 30+ * @method
 31+ * @param position {es.Position} Position to get offset for
 32+ * @returns {Integer} Offset nearest to position
 33+ */
 34+es.TableBlockCellView.prototype.getContentOffset = function( position ) {
 35+ // TODO
2436 };
2537
 38+/**
 39+ * Gets rendered position of offset within content.
 40+ *
 41+ * @method
 42+ * @param offset {Integer} Offset to get position for
 43+ * @returns {es.Position} Position of offset
 44+ */
 45+es.TableBlockCellView.prototype.getRenderedPosition = function( offset ) {
 46+ // TODO
 47+};
 48+
 49+/**
 50+ * Draw selection around a given range.
 51+ *
 52+ * @method
 53+ * @param range {es.Range} Range of content to draw selection around
 54+ */
2655 es.TableBlockCellView.prototype.drawSelection = function( range ) {
2756 this.documentView.drawSelection( range );
2857 };
2958
3059 /**
31 - * Gets HTML rendering of cell.
 60+ * Gets length of contents.
3261 *
3362 * @method
 63+ * @returns {Integer} Length of content, including any virtual spaces within the block
 64+ */
 65+es.TableBlockCellView.prototype.getLength = function() {
 66+ return this.documentView.getLength();
 67+};
 68+
 69+/**
 70+ * Gets HTML rendering of block.
 71+ *
 72+ * @method
3473 * @param options {Object} List of options, see es.DocumentView.getHtml for details
3574 * @returns {String} HTML data
3675 */
3776 es.TableBlockCellView.prototype.getHtml = function( options ) {
3877 return es.Html.makeTag( 'td', this.model.attributes, this.documentView.getHtml() );
39 -};
 78+}
4079
4180 /* Inheritance */
4281
Index: trunk/parsers/wikidom/lib/synth/views/es.TableBlockView.js
@@ -2,6 +2,8 @@
33 * Creates an es.TableBlockView object.
44 *
55 * @class
 6+ * @extends {es.ViewList}
 7+ * @extends {es.BlockView}
68 * @constructor
79 */
810 es.TableBlockView = function( model ) {
@@ -11,8 +13,12 @@
1214 this.$.addClass( 'editSurface-tableBlock' );
1315 };
1416
 17+/* Methods */
 18+
1519 /**
1620 * Render content.
 21+ *
 22+ * @method
1723 */
1824 es.TableBlockView.prototype.renderContent = function() {
1925 for ( var i = 0; i < this.items.length; i++ ) {
@@ -20,10 +26,34 @@
2127 }
2228 };
2329
24 -es.TableBlockView.prototype.getLength = function() {
25 - return this.items.getLengthOfItems();
 30+/**
 31+ * Gets offset within content of position.
 32+ *
 33+ * @method
 34+ * @param position {es.Position} Position to get offset for
 35+ * @returns {Integer} Offset nearest to position
 36+ */
 37+es.TableBlockView.prototype.getContentOffset = function( position ) {
 38+ // TODO
2639 };
2740
 41+/**
 42+ * Gets rendered position of offset within content.
 43+ *
 44+ * @method
 45+ * @param offset {Integer} Offset to get position for
 46+ * @returns {es.Position} Position of offset
 47+ */
 48+es.TableBlockView.prototype.getRenderedPosition = function( offset ) {
 49+ // TODO
 50+};
 51+
 52+/**
 53+ * Draw selection around a given range.
 54+ *
 55+ * @method
 56+ * @param range {es.Range} Range of content to draw selection around
 57+ */
2858 es.TableBlockView.prototype.drawSelection = function( range ) {
2959 var selectedViews = this.items.select( range );
3060 for ( var i = 0; i < selectedViews.length; i++ ) {
@@ -34,6 +64,16 @@
3565 };
3666
3767 /**
 68+ * Gets length of contents.
 69+ *
 70+ * @method
 71+ * @returns {Integer} Length of content, including any virtual spaces within the block
 72+ */
 73+es.TableBlockView.prototype.getLength = function() {
 74+ return this.items.getLengthOfItems();
 75+};
 76+
 77+/**
3878 * Gets HTML rendering of block.
3979 *
4080 * @method
@@ -44,7 +84,7 @@
4585 return es.Html.makeTag( 'table', this.model.attributes, $.map( this.items, function( view ) {
4686 return view.getHtml();
4787 } ).join( '' ) );
48 -};
 88+}
4989
5090 /* Inheritance */
5191

Status & tagging log