Renamed expandContentData to getExpandedContentData

This commit is contained in:
Trevor Parscal 2011-11-03 20:01:39 +00:00
parent 7e825a15fb
commit 91f0cd2d6b
3 changed files with 17 additions and 2 deletions

View file

@ -75,7 +75,7 @@ es.DocumentModelNode.prototype.getPlainObject = function() {
obj.children.push( this.children[i].getPlainObject() ); obj.children.push( this.children[i].getPlainObject() );
} }
} else if ( this.getContentLength() ) { } else if ( this.getContentLength() ) {
obj.content = es.DocumentModel.expandContentData( this.getContent() ); obj.content = es.DocumentModel.getExpandedContentData( this.getContent() );
} }
return obj; return obj;
}; };

View file

@ -488,7 +488,7 @@ es.DocumentModel.flattenPlainObjectElementNode = function( obj ) {
* @method * @method
* @returns {Object} Plain object representation * @returns {Object} Plain object representation
*/ */
es.DocumentModel.expandContentData = function( data ) { es.DocumentModel.getExpandedContentData = function( data ) {
var stack = []; var stack = [];
// Text and annotations // Text and annotations
function start( offset, annotation ) { function start( offset, annotation ) {

View file

@ -38,6 +38,21 @@ es.HtmlSerializer.getHtmlAttributes = function( attributes ) {
return count ? htmlAttributes : null; return count ? htmlAttributes : null;
}; };
es.HtmlSerializer.getExpandedListItems = function( node ) {
var styles,
levels = [];
for ( var i = 0; i < this.children.length; i++ ) {
styles = this.children[i].model.getElementAttribute( 'styles' );
levels = levels.slice( 0, styles.length );
if ( styles[styles.length - 1] === 'number' ) {
if ( !levels[styles.length - 1] ) {
levels[styles.length - 1] = 0;
}
this.children[i].setNumber( ++levels[styles.length - 1] );
}
}
};
/* Methods */ /* Methods */
es.HtmlSerializer.prototype.document = function( node, rawFirstParagraph ) { es.HtmlSerializer.prototype.document = function( node, rawFirstParagraph ) {