JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.2
[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.prototype.dataProcessor\r
19  * @type CKEDITOR.dataProcessor\r
20  */\r
21 \r
22 /**\r
23  * This class is here for documentation purposes only and is not really part of\r
24  * the API. It serves as the base ("interface") for data processors\r
25  * implementation.\r
26  * @name CKEDITOR.dataProcessor\r
27  * @class Represents a data processor, which is responsible to translate and\r
28  *        transform the editor data on input and output.\r
29  * @example\r
30  */\r
31 \r
32 /**\r
33  * Transforms input data into HTML to be loaded in the editor.\r
34  * While the editor is able to handle non HTML data (like BBCode), at runtime\r
35  * it can handle HTML data only. The role of the data processor is transforming\r
36  * the input data into HTML through this function.\r
37  * @name CKEDITOR.dataProcessor.prototype.toHtml\r
38  * @function\r
39  * @param {String} data The input data to be transformed.\r
40  * @param {String} [fixForBody] The tag name to be used if the data must be\r
41  *              fixed because it is supposed to be loaded direcly into the <body>\r
42  *              tag. This is generally not used by non-HTML data processors.\r
43  * @example\r
44  * // Tranforming BBCode data, having a custom BBCode data processor.\r
45  * var data = 'This is [b]an example[/b].';\r
46  * var html = editor.dataProcessor.toHtml( data );  // '<p>This is <b>an example</b>.</p>'\r
47  */\r
48 \r
49 /**\r
50  * Transforms HTML into data to be outputted by the editor, in the format\r
51  * expected by the data processor.\r
52  * While the editor is able to handle non HTML data (like BBCode), at runtime\r
53  * it can handle HTML data only. The role of the data processor is transforming\r
54  * the HTML data containined by the editor into a specific data format through\r
55  * this function.\r
56  * @name CKEDITOR.dataProcessor.prototype.toDataFormat\r
57  * @function\r
58  * @param {String} html The HTML to be transformed.\r
59  * @param {String} fixForBody The tag name to be used if the output data is\r
60  *              coming from <body> and may be eventually fixed for it. This is\r
61  * generally not used by non-HTML data processors.\r
62  * // Tranforming into BBCode data, having a custom BBCode data processor.\r
63  * var html = '<p>This is <b>an example</b>.</p>';\r
64  * var data = editor.dataProcessor.toDataFormat( html );  // 'This is [b]an example[/b].'\r
65  */\r