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