root/releases/elgg0.8rc2/_tinymce/docs/option_cleanup_callback.html

Revision 758, 2.3 kB (checked in by sven, 2 years ago)

set svn property eol-style native on some files without it

  • Property svn:eol-style set to native
Line 
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>Option: cleanup_callback</title>
5 <link href="css/screen.css" rel="stylesheet" type="text/css" />
6 </head>
7 <body>
8
9 <div class="header">
10         <h1>Option: cleanup_callback</h1>
11 </div>
12
13 <div class="content">
14         <p>
15                 This option enables you to add custom cleanup logic to TinyMCE. This function is called when the cleanup process is executed this process occures when the editor saves/submits content, user hits the cleanup button and when the HTML editor dialog is presented. The format of this function is: customCleanup(type, value). Where type can be &quot;get_from_editor&quot; when the contents is extracted from TinyMCE for example when the user submits the form. The &quot;insert_to_editor&quot; type value gets passed when new contents is inserted into the editor on initialization or when the HTML editor dialog commits new content. The &quot;get_from_editor_dom&quot; value is executed when cleanup process has a valid DOM tree and is extracted from the editor. The &quot;insert_to_editor_dom&quot; gets passed when the editor has a valid DOM tree and contents has been inserted into the editor. The example below illustrated all these types.
16         </p>
17
18         <div class="separator"></div>
19
20         <h3>Example of usage of the cleanup_callback option:</h3>
21         <div class="example">
22 <pre>
23 function <strong>myCustomCleanup</strong>(type, value) {
24         switch (type) {
25                 case "get_from_editor":
26                         alert("Value HTML string: " + value);
27
28                         // Do custom cleanup code here
29
30                         break;
31
32                 case "insert_to_editor":
33                         alert("Value HTML string: " + value);
34
35                         // Do custom cleanup code here
36
37                         break;
38
39                 case "get_from_editor_dom":
40                         alert("Value DOM Element " + value);
41
42                         // Do custom cleanup code here
43
44                         break;
45
46                 case "insert_to_editor_dom":
47                         alert("Value DOM Element: " + value);
48
49                         // Do custom cleanup code here
50
51                         break;
52         }
53
54         return value;
55 }
56
57 tinyMCE.init({
58         ...
59         <strong>cleanup_callback : "myCustomCleanup"</strong>
60 });
61 </pre>
62         </div>
63 </div>
64
65 <div class="footer">
66         <div class="helpindexlink"><a href="index.html">Index</a></div>
67         <div class="copyright">Copyright &copy; 2003-2006 <a href="http://www.moxiecode.com">Moxiecode Systems AB</a></div>
68         <br style="clear: both" />
69 </div>
70
71 </body>
72 </html>
Note: See TracBrowser for help on using the browser.