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-2009, 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>Sample - CKEditor</title>
|
---|
9 | <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
---|
10 | <script type="text/javascript" src="../ckeditor.js"></script>
|
---|
11 | <script src="sample.js" type="text/javascript"></script>
|
---|
12 | <link href="sample.css" rel="stylesheet" type="text/css"/>
|
---|
13 | <script id="headscript" type="text/javascript">
|
---|
14 | //<![CDATA[
|
---|
15 |
|
---|
16 | var editor;
|
---|
17 |
|
---|
18 | function createEditor()
|
---|
19 | {
|
---|
20 | if ( editor )
|
---|
21 | return;
|
---|
22 |
|
---|
23 | var html = document.getElementById( 'editorcontents' ).innerHTML;
|
---|
24 |
|
---|
25 | // Create a new editor inside the <div id="editor">
|
---|
26 | editor = CKEDITOR.appendTo( 'editor' );
|
---|
27 | editor.setData( html );
|
---|
28 |
|
---|
29 | // This sample may break here if the ckeditor_basic.js is used. In such case, the following code should be used instead:
|
---|
30 | /*
|
---|
31 | if ( editor.setData )
|
---|
32 | editor.setData( html );
|
---|
33 | else
|
---|
34 | CKEDITOR.on( 'loaded', function()
|
---|
35 | {
|
---|
36 | editor.setData( html );
|
---|
37 | });
|
---|
38 | */
|
---|
39 | }
|
---|
40 |
|
---|
41 | function removeEditor()
|
---|
42 | {
|
---|
43 | if ( !editor )
|
---|
44 | return;
|
---|
45 |
|
---|
46 | // Retrieve the editor contents. In an Ajax application, this data would be
|
---|
47 | // sent to the server or used in any other way.
|
---|
48 | document.getElementById( 'editorcontents' ).innerHTML = editor.getData();
|
---|
49 | document.getElementById( 'contents' ).style.display = '';
|
---|
50 |
|
---|
51 | // Destroy the editor.
|
---|
52 | editor.destroy();
|
---|
53 | editor = null;
|
---|
54 | }
|
---|
55 |
|
---|
56 | //]]>
|
---|
57 | </script>
|
---|
58 | </head>
|
---|
59 | <body>
|
---|
60 | <h1>
|
---|
61 | CKEditor Sample
|
---|
62 | </h1>
|
---|
63 | <!-- This <div> holds alert messages to be display in the sample page. -->
|
---|
64 | <div id="alerts">
|
---|
65 | <noscript>
|
---|
66 | <p>
|
---|
67 | <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
---|
68 | support, like yours, you should still see the contents (HTML data) and you should
|
---|
69 | be able to edit it normally, without a rich editor interface.
|
---|
70 | </p>
|
---|
71 | </noscript>
|
---|
72 | </div>
|
---|
73 | <!-- This <fieldset> holds the HTML that you will usually find in your
|
---|
74 | pages. -->
|
---|
75 | <p>
|
---|
76 | <input onclick="createEditor();" type="button" value="Create Editor"/>
|
---|
77 | <input onclick="removeEditor();" type="button" value="Remove Editor"/>
|
---|
78 | </p>
|
---|
79 | <div id="editor">
|
---|
80 | </div>
|
---|
81 | <div id="contents" style="display: none">
|
---|
82 | <p>Edited Contents:</p>
|
---|
83 | <div id="editorcontents"/>
|
---|
84 | </div>
|
---|
85 | <div id="footer">
|
---|
86 | <hr/>
|
---|
87 | <p>
|
---|
88 | CKEditor - The text editor for Internet - <a href="http://ckeditor.com/" shape="rect">http://ckeditor.com</a>
|
---|
89 | </p>
|
---|
90 | <p id="copy">
|
---|
91 | Copyright © 2003-2009, <a href="http://cksource.com/" shape="rect">CKSource</a> - Frederico Knabben. All rights reserved.
|
---|
92 | </p>
|
---|
93 | </div>
|
---|
94 | </body>
|
---|
95 | </html>
|
---|