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-2011, 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>Ajax — CKEditor Sample</title> |
---|
9 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
---|
10 | |
---|
11 | <script type="text/javascript" src="../ckeditor.js"></script> |
---|
12 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
---|
13 | <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> |
---|
14 | <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css" /> |
---|
15 | </head> |
---|
16 | <body> |
---|
17 | <h1 class="samples"> |
---|
18 | CKEditor Sample — Create and Destroy Editor Instances |
---|
19 | </h1> |
---|
20 | <p>Click the buttons to create and remove a CKEditor instance.</p> |
---|
21 | <p>Autostartup scayt nad focus both work in this case - no matter how many times you create and destroy instance (unlike in demo.html)</p> |
---|
22 | <p> |
---|
23 | <input onclick="createEditor();" type="button" value="Create Editor" /> |
---|
24 | <input onclick="removeEditor();" type="button" value="Remove Editor" /> |
---|
25 | </p> |
---|
26 | |
---|
27 | <div id="editor"> |
---|
28 | </div> |
---|
29 | |
---|
30 | <div id="footer"> |
---|
31 | <hr /> |
---|
32 | <p> |
---|
33 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
---|
34 | </p> |
---|
35 | <p id="copy"> |
---|
36 | Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
---|
37 | Knabben. All rights reserved. |
---|
38 | </p> |
---|
39 | </div> |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | <script type="text/javascript"> |
---|
44 | //<![CDATA[ |
---|
45 | |
---|
46 | |
---|
47 | var editor = null; |
---|
48 | var config = {baseFloatZIndex : 102000}; |
---|
49 | |
---|
50 | function createEditor() |
---|
51 | { |
---|
52 | if ( editor ) |
---|
53 | return; |
---|
54 | |
---|
55 | $("#editor").bind('dialogopen', function() |
---|
56 | { |
---|
57 | if ( !editor ) |
---|
58 | editor = CKEDITOR.appendTo('editor', config, 'data'); |
---|
59 | }).bind('dialogclose', function() |
---|
60 | { |
---|
61 | removeEditor(); |
---|
62 | $(this).dialog('destroy'); |
---|
63 | }) |
---|
64 | .dialog({autoOpen: false, |
---|
65 | maxHeight:0.95 * $(window).height(), |
---|
66 | width: 800, |
---|
67 | modal: true, |
---|
68 | position: 'top', |
---|
69 | resizable: false, |
---|
70 | autoResize: true }).dialog('open'); |
---|
71 | } |
---|
72 | |
---|
73 | function removeEditor() |
---|
74 | { |
---|
75 | if ( !editor ) |
---|
76 | return; |
---|
77 | |
---|
78 | // Destroy the editor. |
---|
79 | editor.destroy(); |
---|
80 | editor = null; |
---|
81 | } |
---|
82 | |
---|
83 | |
---|
84 | </script> |
---|
85 | |
---|
86 | |
---|
87 | </body> |
---|
88 | </html> |
---|