1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <!-- |
---|
3 | Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. |
---|
4 | For licensing, see LICENSE.html or http://ckeditor.com/license |
---|
5 | --> |
---|
6 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
7 | <head> |
---|
8 | <title>Leak test - CKEditor Sample</title> |
---|
9 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
---|
10 | <!-- CKReleaser %REMOVE_LINE% |
---|
11 | <script type="text/javascript" src="../ckeditor.js"></script> |
---|
12 | CKReleaser %REMOVE_START% --> |
---|
13 | <script type="text/javascript" src="../ckeditor_source.js"></script> |
---|
14 | <!-- CKReleaser %REMOVE_END% --> |
---|
15 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
---|
16 | <script type="text/javascript"> |
---|
17 | //<![CDATA[ |
---|
18 | |
---|
19 | var editor; |
---|
20 | var allPlugins = 'about,a11yhelp,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc'; |
---|
21 | |
---|
22 | // wysiwygarea |
---|
23 | // toolbar |
---|
24 | // button |
---|
25 | // sourcearea |
---|
26 | // maximize |
---|
27 | var removePlugins = 'about,a11yhelp,basicstyles,blockquote,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,stylescombo,table,tabletools,specialchar,tab,templates,undo,wsc'; |
---|
28 | |
---|
29 | // toolbarCanCollapse : false, |
---|
30 | |
---|
31 | var config = { |
---|
32 | removePlugins : removePlugins, |
---|
33 | customConfig : '' |
---|
34 | } |
---|
35 | |
---|
36 | function createEditor() |
---|
37 | { |
---|
38 | if ( editor ) |
---|
39 | return; |
---|
40 | |
---|
41 | var html = document.getElementById( 'editorcontents' ).innerHTML; |
---|
42 | |
---|
43 | // Create a new editor inside the <div id="editor">, setting its value to html |
---|
44 | editor = CKEDITOR.appendTo( 'editor', config, html ); |
---|
45 | } |
---|
46 | |
---|
47 | function removeEditor() |
---|
48 | { |
---|
49 | if ( !editor ) |
---|
50 | return; |
---|
51 | |
---|
52 | // Retrieve the editor contents. In an Ajax application, this data would be |
---|
53 | // sent to the server or used in any other way. |
---|
54 | document.getElementById( 'editorcontents' ).innerHTML = editor.getData(); |
---|
55 | document.getElementById( 'contents' ).style.display = ''; |
---|
56 | |
---|
57 | // Destroy the editor. |
---|
58 | editor.destroy(); |
---|
59 | editor = null; |
---|
60 | } |
---|
61 | |
---|
62 | var oTimer; |
---|
63 | function ChangeLoopPlugins(o) |
---|
64 | { |
---|
65 | counter = 0; |
---|
66 | oTimer = o.checked; |
---|
67 | if (o.checked) |
---|
68 | { |
---|
69 | CKEDITOR.on('instanceReady', AutoDestroyEditor); |
---|
70 | createEditor(); |
---|
71 | } |
---|
72 | else |
---|
73 | { |
---|
74 | CKEDITOR.removeListener('instanceReady', AutoDestroyEditor); |
---|
75 | removeEditor(); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | // If the loop with plugins is used, it will automatically destroy the editor |
---|
80 | function AutoDestroyEditor() { |
---|
81 | document.title = counter++; |
---|
82 | editor.on('destroy', function () {oTimer && window.setTimeout(createEditor, 200)} ) |
---|
83 | window.setTimeout(removeEditor, 200); |
---|
84 | } |
---|
85 | |
---|
86 | // Simpler testing for the core |
---|
87 | var counter; |
---|
88 | function ChangeLoopCore(o) |
---|
89 | { |
---|
90 | counter = 0; |
---|
91 | if (o.checked) |
---|
92 | initLoopCore() |
---|
93 | else |
---|
94 | window.clearTimeout(oTimer); |
---|
95 | } |
---|
96 | |
---|
97 | function initLoopCore() |
---|
98 | { |
---|
99 | document.title = counter++; |
---|
100 | // if (counter>50) |
---|
101 | // return; |
---|
102 | |
---|
103 | editor = CKEDITOR.appendTo( 'editor', {removePlugins: allPlugins, customConfig : ''}, '' ); |
---|
104 | |
---|
105 | oTimer = window.setTimeout(finishLoopCore, 300); |
---|
106 | } |
---|
107 | |
---|
108 | function finishLoopCore() |
---|
109 | { |
---|
110 | // Destroy the editor. |
---|
111 | editor.destroy(); |
---|
112 | editor = null; |
---|
113 | |
---|
114 | oTimer = window.setTimeout(initLoopCore, 100); |
---|
115 | } |
---|
116 | |
---|
117 | //]]> |
---|
118 | </script> |
---|
119 | </head> |
---|
120 | <body> |
---|
121 | <h1> |
---|
122 | CKEditor Sample |
---|
123 | </h1> |
---|
124 | <!-- This <div> holds alert messages to be display in the sample page. --> |
---|
125 | <p> |
---|
126 | <input onclick="createEditor();" type="button" value="Create Editor" /> |
---|
127 | <input onclick="removeEditor();" type="button" value="Remove Editor" /> |
---|
128 | <input type="checkbox" id='loopCore' onclick='ChangeLoopCore(this)'/><label for='loopCore'>Run loop with core</label> |
---|
129 | <input type="checkbox" id='loopPlugins' onclick='ChangeLoopPlugins(this)'/><label for='loopPlugins'>Run loop with plugins</label> |
---|
130 | </p> |
---|
131 | <!-- This div will hold the editor. --> |
---|
132 | <div id="editor"> |
---|
133 | </div> |
---|
134 | <div id="contents" style="display: none"> |
---|
135 | <p> |
---|
136 | Edited Contents:</p> |
---|
137 | <!-- This div will be used to display the editor contents. --> |
---|
138 | <div id="editorcontents"> |
---|
139 | </div> |
---|
140 | </div> |
---|
141 | <div id="footer"> |
---|
142 | <hr /> |
---|
143 | <p> |
---|
144 | CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a> |
---|
145 | </p> |
---|
146 | <p id="copy"> |
---|
147 | Copyright © 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico |
---|
148 | Knabben. All rights reserved. |
---|
149 | </p> |
---|
150 | </div> |
---|
151 | </body> |
---|
152 | </html> |
---|