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>Read-only State — CKEditor Sample</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 type="text/javascript"> |
---|
14 | //<![CDATA[ |
---|
15 | |
---|
16 | var editor; |
---|
17 | |
---|
18 | // The instanceReady event is fired, when an instance of CKEditor has finished |
---|
19 | // its initialization. |
---|
20 | CKEDITOR.on( 'instanceReady', function( ev ) |
---|
21 | { |
---|
22 | editor = ev.editor; |
---|
23 | editor.setReadOnly( true ); |
---|
24 | ev.editor.on( 'contentDom', function(){ |
---|
25 | CKEDITOR.instances['editor1'].document.getById( 'myDiv' ).setHtml(''); |
---|
26 | }) |
---|
27 | }); |
---|
28 | //]]> |
---|
29 | </script> |
---|
30 | |
---|
31 | </head> |
---|
32 | <body> |
---|
33 | <h1 class="samples"> |
---|
34 | CKEditor Sample — Using the CKEditor Read-Only API |
---|
35 | </h1> |
---|
36 | <div class="description"> |
---|
37 | <p> |
---|
38 | This sample shows how to use the |
---|
39 | <code><a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly">setReadOnly</a></code> |
---|
40 | API to put editor into the read-only state that makes it impossible for users to change the editor contents. |
---|
41 | </p> |
---|
42 | <p> |
---|
43 | For details on how to create this setup check the source code of this sample page. |
---|
44 | </p> |
---|
45 | </div> |
---|
46 | |
---|
47 | <!-- This <div> holds alert messages to be display in the sample page. --> |
---|
48 | <div id="alerts"> |
---|
49 | <noscript> |
---|
50 | <p> |
---|
51 | <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript |
---|
52 | support, like yours, you should still see the contents (HTML data) and you should |
---|
53 | be able to edit it normally, without a rich editor interface. |
---|
54 | </p> |
---|
55 | </noscript> |
---|
56 | </div> |
---|
57 | <form action="sample_posteddata.php" method="post"> |
---|
58 | <p> |
---|
59 | <textarea class="ckeditor" id="editor1" name="editor1" cols="100" rows="10"><div id="myDiv" contenteditable="true"> <span style="color:#ffffff"> </span> </div></textarea> |
---|
60 | </p> |
---|
61 | <p> |
---|
62 | |
---|
63 | </p> |
---|
64 | </form> |
---|
65 | <div id="footer"> |
---|
66 | <hr /> |
---|
67 | <p> |
---|
68 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
---|
69 | </p> |
---|
70 | <p id="copy"> |
---|
71 | Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
---|
72 | Knabben. All rights reserved. |
---|
73 | </p> |
---|
74 | </div> |
---|
75 | </body> |
---|
76 | </html> |
---|