+++ /dev/null
-/*\r
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
- * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
- *\r
- * == BEGIN LICENSE ==\r
- *\r
- * Licensed under the terms of any of the following licenses at your\r
- * choice:\r
- *\r
- * - GNU General Public License Version 2 or later (the "GPL")\r
- * http://www.gnu.org/licenses/gpl.html\r
- *\r
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
- * http://www.gnu.org/licenses/lgpl.html\r
- *\r
- * - Mozilla Public License Version 1.1 or later (the "MPL")\r
- * http://www.mozilla.org/MPL/MPL-1.1.html\r
- *\r
- * == END LICENSE ==\r
- *\r
- * The Data Processor is responsible for transforming the input and output data\r
- * in the editor. For more info:\r
- * http://dev.fckeditor.net/wiki/Components/DataProcessor\r
- *\r
- * The default implementation offers the base XHTML compatibility features of\r
- * FCKeditor. Further Data Processors may be implemented for other purposes.\r
- *\r
- */\r
-\r
-var FCKDataProcessor = function()\r
-{}\r
-\r
-FCKDataProcessor.prototype =\r
-{\r
- /*\r
- * Returns a string representing the HTML format of "data". The returned\r
- * value will be loaded in the editor.\r
- * The HTML must be from <html> to </html>, including <head>, <body> and\r
- * eventually the DOCTYPE.\r
- * Note: HTML comments may already be part of the data because of the\r
- * pre-processing made with ProtectedSource.\r
- * @param {String} data The data to be converted in the\r
- * DataProcessor specific format.\r
- */\r
- ConvertToHtml : function( data )\r
- {\r
- // The default data processor must handle two different cases depending\r
- // on the FullPage setting. Custom Data Processors will not be\r
- // compatible with FullPage, much probably.\r
- if ( FCKConfig.FullPage )\r
- {\r
- // Save the DOCTYPE.\r
- FCK.DocTypeDeclaration = data.match( FCKRegexLib.DocTypeTag ) ;\r
-\r
- // Check if the <body> tag is available.\r
- if ( !FCKRegexLib.HasBodyTag.test( data ) )\r
- data = '<body>' + data + '</body>' ;\r
-\r
- // Check if the <html> tag is available.\r
- if ( !FCKRegexLib.HtmlOpener.test( data ) )\r
- data = '<html dir="' + FCKConfig.ContentLangDirection + '">' + data + '</html>' ;\r
-\r
- // Check if the <head> tag is available.\r
- if ( !FCKRegexLib.HeadOpener.test( data ) )\r
- data = data.replace( FCKRegexLib.HtmlOpener, '$&<head><title></title></head>' ) ;\r
-\r
- return data ;\r
- }\r
- else\r
- {\r
- var html =\r
- FCKConfig.DocType +\r
- '<html dir="' + FCKConfig.ContentLangDirection + '"' ;\r
-\r
- // On IE, if you are using a DOCTYPE different of HTML 4 (like\r
- // XHTML), you must force the vertical scroll to show, otherwise\r
- // the horizontal one may appear when the page needs vertical scrolling.\r
- // TODO : Check it with IE7 and make it IE6- if it is the case.\r
- if ( FCKBrowserInfo.IsIE && FCKConfig.DocType.length > 0 && !FCKRegexLib.Html4DocType.test( FCKConfig.DocType ) )\r
- html += ' style="overflow-y: scroll"' ;\r
-\r
- html += '><head><title></title></head>' +\r
- '<body' + FCKConfig.GetBodyAttributes() + '>' +\r
- data +\r
- '</body></html>' ;\r
-\r
- return html ;\r
- }\r
- },\r
-\r
- /*\r
- * Converts a DOM (sub-)tree to a string in the data format.\r
- * @param {Object} rootNode The node that contains the DOM tree to be\r
- * converted to the data format.\r
- * @param {Boolean} excludeRoot Indicates that the root node must not\r
- * be included in the conversion, only its children.\r
- * @param {Boolean} format Indicates that the data must be formatted\r
- * for human reading. Not all Data Processors may provide it.\r
- */\r
- ConvertToDataFormat : function( rootNode, excludeRoot, ignoreIfEmptyParagraph, format )\r
- {\r
- var data = FCKXHtml.GetXHTML( rootNode, !excludeRoot, format ) ;\r
-\r
- if ( ignoreIfEmptyParagraph && FCKRegexLib.EmptyOutParagraph.test( data ) )\r
- return '' ;\r
-\r
- return data ;\r
- },\r
-\r
- /*\r
- * Makes any necessary changes to a piece of HTML for insertion in the\r
- * editor selection position.\r
- * @param {String} html The HTML to be fixed.\r
- */\r
- FixHtml : function( html )\r
- {\r
- return html ;\r
- }\r
-} ;\r