/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2009 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * The Data Processor is responsible for transforming the input and output data * in the editor. For more info: * http://dev.fckeditor.net/wiki/Components/DataProcessor * * The default implementation offers the base XHTML compatibility features of * FCKeditor. Further Data Processors may be implemented for other purposes. * */ var FCKDataProcessor = function() {} FCKDataProcessor.prototype = { /* * Returns a string representing the HTML format of "data". The returned * value will be loaded in the editor. * The HTML must be from to , including
, and * eventually the DOCTYPE. * Note: HTML comments may already be part of the data because of the * pre-processing made with ProtectedSource. * @param {String} data The data to be converted in the * DataProcessor specific format. */ ConvertToHtml : function( data ) { // The default data processor must handle two different cases depending // on the FullPage setting. Custom Data Processors will not be // compatible with FullPage, much probably. if ( FCKConfig.FullPage ) { // Save the DOCTYPE. FCK.DocTypeDeclaration = data.match( FCKRegexLib.DocTypeTag ) ; // Check if the tag is available. if ( !FCKRegexLib.HasBodyTag.test( data ) ) data = '' + data + '' ; // Check if the tag is available. if ( !FCKRegexLib.HtmlOpener.test( data ) ) data = '' + data + '' ; // Check if the tag is available. if ( !FCKRegexLib.HeadOpener.test( data ) ) data = data.replace( FCKRegexLib.HtmlOpener, '$&