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