1 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
2 | <head> |
---|
3 | <title>Sample - CKEditor</title> |
---|
4 | <meta content="text/html; charset=utf-8" http-equiv="content-type"/> |
---|
5 | <script type="text/javascript" src="../ckeditor.js"></script> |
---|
6 | <script src="sample.js" type="text/javascript"></script> |
---|
7 | <link href="sample.css" rel="stylesheet" type="text/css"/> |
---|
8 | |
---|
9 | <SCRIPT> |
---|
10 | if (typeof CKEDITOR != 'undefined') CKEDITOR.on( 'instanceReady', function( ev ) |
---|
11 | { |
---|
12 | ev.editor.dataProcessor.writer.setRules( 'p', |
---|
13 | { |
---|
14 | indent : false, |
---|
15 | breakBeforeOpen : false, |
---|
16 | breakAfterOpen : false, |
---|
17 | breakBeforeClose : false, |
---|
18 | breakAfterClose : false |
---|
19 | }); |
---|
20 | |
---|
21 | for ( var instanceName in CKEDITOR.instances ) |
---|
22 | { |
---|
23 | |
---|
24 | CKEDITOR.instances[instanceName].focus(); |
---|
25 | } |
---|
26 | }); |
---|
27 | |
---|
28 | |
---|
29 | AjaxReq = function () |
---|
30 | { |
---|
31 | |
---|
32 | CKEDITOR.instances.editor1.destroy(); |
---|
33 | |
---|
34 | var result ='<label for="editor1">Editor 1:</label><br/><textarea cols="80" id="editor1" name="editor1" rows="10">TEST</textarea>'; |
---|
35 | document.getElementById('editorcontent').innerHTML = result; |
---|
36 | |
---|
37 | var script = document.createElement("script"); |
---|
38 | var dscript="CKEDITOR.replace('editor1');CKEDITOR.instances['editor1'].setData('<p>test</p>');"; |
---|
39 | |
---|
40 | script.setAttribute("type","text/javascript") |
---|
41 | script.setAttribute("id",'sId'); |
---|
42 | script.text = dscript; |
---|
43 | |
---|
44 | var head = document.getElementsByTagName("head")[0]; |
---|
45 | head.appendChild(script); |
---|
46 | |
---|
47 | } |
---|
48 | |
---|
49 | </SCRIPT> |
---|
50 | </head> |
---|
51 | <body> |
---|
52 | <h1> |
---|
53 | CKEditor Sample |
---|
54 | </h1> |
---|
55 | <!-- This <div> holds alert messages to be display in the sample page. --> |
---|
56 | <div id="alerts"> |
---|
57 | <noscript> |
---|
58 | <p> |
---|
59 | <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript |
---|
60 | support, like yours, you should still see the contents (HTML data) and you should |
---|
61 | be able to edit it normally, without a rich editor interface. |
---|
62 | </p> |
---|
63 | </noscript> |
---|
64 | </div> |
---|
65 | <!-- This <fieldset> holds the HTML that you will usually find in your |
---|
66 | pages. --> |
---|
67 | <fieldset title="Output"> |
---|
68 | <legend>Output</legend> |
---|
69 | <form action="sample_posteddata.php" method="post"> |
---|
70 | <p><div id="editorcontent"> |
---|
71 | <label for="editor1"> |
---|
72 | Editor 1:</label><br/> |
---|
73 | <textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You |
---|
74 | are using <a href="http://www.fckeditor.net/">CKEditor</a>.</p></textarea></div> |
---|
75 | <script type="text/javascript"> |
---|
76 | //<![CDATA[ |
---|
77 | |
---|
78 | // This call can be placed at any point after the |
---|
79 | // <textarea>, or inside a <head><script> in a |
---|
80 | // window.onload event handler. |
---|
81 | |
---|
82 | // Replace the <textarea id="editor"> with an CKEditor |
---|
83 | // instance, using default configurations. |
---|
84 | CKEDITOR.replace( 'editor1' ); |
---|
85 | |
---|
86 | //]]> |
---|
87 | </script> |
---|
88 | </p> |
---|
89 | |
---|
90 | <p> |
---|
91 | <input type="button" value="Click me for multiple times to see the issue" onclick='javascript:AjaxReq();'/> |
---|
92 | </p> |
---|
93 | </form> |
---|
94 | </fieldset> |
---|
95 | <!-- This <fieldset> contains the output readable code that illustrates |
---|
96 | how to use the editor, having the results shown in this sample. --> |
---|
97 | |
---|
98 | <div id="footer"> |
---|
99 | <hr/> |
---|
100 | <p> |
---|
101 | CKEditor - The text editor for Internet - <a href="http://ckeditor.com/" shape="rect">http://ckeditor.com</a> |
---|
102 | </p> |
---|
103 | <p id="copy"> |
---|
104 | Copyright © 2003-2009, <a href="http://cksource.com/" shape="rect">CKSource</a> - Frederico Knabben. All rights reserved. |
---|
105 | </p> |
---|
106 | </div> |
---|
107 | </body> |
---|
108 | </html> |
---|