JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0
[ckeditor.git] / _source / core / htmlparser / text.js
diff --git a/_source/core/htmlparser/text.js b/_source/core/htmlparser/text.js
new file mode 100644 (file)
index 0000000..718bd82
--- /dev/null
@@ -0,0 +1,55 @@
+/*\r
+Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+(function()\r
+{\r
+       var spacesRegex = /[\t\r\n ]{2,}|[\t\r\n]/g;\r
+\r
+       /**\r
+        * A lightweight representation of HTML text.\r
+        * @constructor\r
+        * @example\r
+        */\r
+       CKEDITOR.htmlParser.text = function( value )\r
+       {\r
+               /**\r
+                * The text value.\r
+                * @type String\r
+                * @example\r
+                */\r
+               this.value = value;\r
+\r
+               /** @private */\r
+               this._ =\r
+               {\r
+                       isBlockLike : false\r
+               };\r
+       };\r
+\r
+       CKEDITOR.htmlParser.text.prototype =\r
+       {\r
+               /**\r
+                * The node type. This is a constant value set to {@link CKEDITOR.NODE_TEXT}.\r
+                * @type Number\r
+                * @example\r
+                */\r
+               type : CKEDITOR.NODE_TEXT,\r
+\r
+               /**\r
+                * Writes the HTML representation of this text to a CKEDITOR.htmlWriter.\r
+                * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML.\r
+                * @example\r
+                */\r
+               writeHtml : function( writer, filter )\r
+               {\r
+                       var text = this.value;\r
+\r
+                       if ( filter && !( text = filter.onText( text, this ) ) )\r
+                               return;\r
+\r
+                       writer.text( text );\r
+               }\r
+       };\r
+})();\r