1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 (function() 7 { 8 var spacesRegex = /[\t\r\n ]{2,}|[\t\r\n]/g; 9 10 /** 11 * A lightweight representation of HTML text. 12 * @constructor 13 * @example 14 */ 15 CKEDITOR.htmlParser.text = function( value ) 16 { 17 /** 18 * The text value. 19 * @type String 20 * @example 21 */ 22 this.value = value.replace( spacesRegex, ' ' ); 23 24 /** @private */ 25 this._ = 26 { 27 isBlockLike : false 28 }; 29 }; 30 31 CKEDITOR.htmlParser.text.prototype = 32 { 33 /** 34 * The node type. This is a constant value set to {@link CKEDITOR.NODE_TEXT}. 35 * @type Number 36 * @example 37 */ 38 type : CKEDITOR.NODE_TEXT, 39 40 /** 41 * Writes the HTML representation of this text to a CKEDITOR.htmlWriter. 42 * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. 43 * @example 44 */ 45 writeHtml : function( writer, filter ) 46 { 47 var text = this.value; 48 49 if ( filter && !( text = filter.onText( text ) ) ) 50 return; 51 52 writer.text( text ); 53 } 54 }; 55 })(); 56