JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _samples / readonly.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
2 <!--\r
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
4 For licensing, see LICENSE.html or http://ckeditor.com/license\r
5 -->\r
6 <html xmlns="http://www.w3.org/1999/xhtml">\r
7 <head>\r
8         <title>Read-only State &mdash; CKEditor Sample</title>\r
9         <meta content="text/html; charset=utf-8" http-equiv="content-type" />\r
10         <script type="text/javascript" src="../ckeditor.js"></script>\r
11         <script src="sample.js" type="text/javascript"></script>\r
12         <link href="sample.css" rel="stylesheet" type="text/css" />\r
13         <script type="text/javascript">\r
14         //<![CDATA[\r
15 \r
16 var editor;\r
17 \r
18 // The instanceReady event is fired, when an instance of CKEditor has finished\r
19 // its initialization.\r
20 CKEDITOR.on( 'instanceReady', function( ev )\r
21         {\r
22                 editor = ev.editor;\r
23 \r
24                 // Show this "on" button.\r
25                 document.getElementById( 'readOnlyOn' ).style.display = '';\r
26 \r
27                 // Event fired when the readOnly property changes.\r
28                 editor.on( 'readOnly', function()\r
29                         {\r
30                                 document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';\r
31                                 document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';\r
32                         });\r
33         });\r
34 \r
35 function toggleReadOnly( isReadOnly )\r
36 {\r
37         // Change the read-only state of the editor.\r
38         // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly\r
39         editor.setReadOnly( isReadOnly );\r
40 }\r
41 \r
42         //]]>\r
43         </script>\r
44 \r
45 </head>\r
46 <body>\r
47         <h1 class="samples">\r
48                 CKEditor Sample &mdash; Using the CKEditor Read-Only API\r
49         </h1>\r
50         <div class="description">\r
51         <p>\r
52                 This sample shows how to use the\r
53                 <code><a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly">setReadOnly</a></code>\r
54                 API to put editor into the read-only state that makes it impossible for users to change the editor contents.\r
55         </p>\r
56         <p>\r
57                 For details on how to create this setup check the source code of this sample page.\r
58         </p>\r
59         </div>\r
60 \r
61         <!-- This <div> holds alert messages to be display in the sample page. -->\r
62         <div id="alerts">\r
63                 <noscript>\r
64                         <p>\r
65                                 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript\r
66                                 support, like yours, you should still see the contents (HTML data) and you should\r
67                                 be able to edit it normally, without a rich editor interface.\r
68                         </p>\r
69                 </noscript>\r
70         </div>\r
71         <form action="sample_posteddata.php" method="post">\r
72                 <p>\r
73                         <textarea class="ckeditor" id="editor1" name="editor1" cols="100" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>\r
74                 </p>\r
75                 <p>\r
76                         <input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none" />\r
77                         <input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none" />\r
78                 </p>\r
79         </form>\r
80         <div id="footer">\r
81                 <hr />\r
82                 <p>\r
83                         CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
84                 </p>\r
85                 <p id="copy">\r
86                         Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
87                         Knabben. All rights reserved.\r
88                 </p>\r
89         </div>\r
90 </body>\r
91 </html>\r