1 /*
  2 Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
  3 For licensing, see LICENSE.html or http://ckeditor.com/license
  4 */
  5 
  6 /**
  7  * @fileOverview Defines the "virtual" {@link CKEDITOR.dataProcessor} class, which
  8  *		defines the basic structure of data processor objects to be
  9  *		set to {@link CKEDITOR.editor.dataProcessor}.
 10  */
 11 
 12 /**
 13  * If defined, points to the data processor which is responsible to translate
 14  * and transform the editor data on input and output.
 15  * Generaly it will point to an instance of {@link CKEDITOR.htmlDataProcessor},
 16  * which handles HTML data. The editor may also handle other data formats by
 17  * using different data processors provided by specific plugins.
 18  * @name CKEDITOR.editor.prototype.dataProcessor
 19  * @type CKEDITOR.dataProcessor
 20  */
 21 
 22 /**
 23  * This class is here for documentation purposes only and is not really part of
 24  * the API. It serves as the base ("interface") for data processors
 25  * implementation.
 26  * @name CKEDITOR.dataProcessor
 27  * @class Represents a data processor, which is responsible to translate and
 28  *        transform the editor data on input and output.
 29  * @example
 30  */
 31 
 32 /**
 33  * Transforms input data into HTML to be loaded in the editor.
 34  * While the editor is able to handle non HTML data (like BBCode), at runtime
 35  * it can handle HTML data only. The role of the data processor is transforming
 36  * the input data into HTML through this function.
 37  * @name CKEDITOR.dataProcessor.prototype.toHtml
 38  * @function
 39  * @param {String} data The input data to be transformed.
 40  * @param {String} [fixForBody] The tag name to be used if the data must be
 41  *		fixed because it is supposed to be loaded direcly into the <body>
 42  *		tag. This is generally not used by non-HTML data processors.
 43  * @example
 44  * // Tranforming BBCode data, having a custom BBCode data processor.
 45  * var data = 'This is [b]an example[/b].';
 46  * var html = editor.dataProcessor.toHtml( data );  // '<p>This is <b>an example</b>.</p>'
 47  */
 48 
 49 /**
 50  * Transforms HTML into data to be outputted by the editor, in the format
 51  * expected by the data processor.
 52  * While the editor is able to handle non HTML data (like BBCode), at runtime
 53  * it can handle HTML data only. The role of the data processor is transforming
 54  * the HTML data containined by the editor into a specific data format through
 55  * this function.
 56  * @name CKEDITOR.dataProcessor.prototype.toDataFormat
 57  * @function
 58  * @param {String} html The HTML to be transformed.
 59  * @param {String} fixForBody The tag name to be used if the output data is
 60  *		coming from <body> and may be eventually fixed for it. This is
 61  * generally not used by non-HTML data processors.
 62  * // Tranforming into BBCode data, having a custom BBCode data processor.
 63  * var html = '<p>This is <b>an example</b>.</p>';
 64  * var data = editor.dataProcessor.toDataFormat( html );  // 'This is [b]an example[/b].'
 65  */
 66