1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4 For licensing, see LICENSE.html or http://ckeditor.com/license
6 <html xmlns=
"http://www.w3.org/1999/xhtml">
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">
18 // The instanceReady event is fired, when an instance of CKEditor has finished
19 // its initialization.
20 CKEDITOR.on( 'instanceReady', function( ev )
24 // Show this
"on" button.
25 document.getElementById( 'readOnlyOn' ).style.display = '';
27 // Event fired when the readOnly property changes.
28 editor.on( 'readOnly', function()
30 document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
31 document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
35 function toggleReadOnly( isReadOnly )
37 // Change the read-only state of the editor.
38 // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly
39 editor.setReadOnly( isReadOnly );
48 CKEditor Sample
— Using the CKEditor Read-Only API
50 <div class=
"description">
52 This sample shows how to use the
53 <code><a class=
"samples" href=
"http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly">setReadOnly
</a></code>
54 API to put editor into the read-only state that makes it impossible for users to change the editor contents.
57 For details on how to create this setup check the source code of this sample page.
61 <!-- This <div> holds alert messages to be display in the sample page. -->
65 <strong>CKEditor requires JavaScript to run
</strong>. In a browser with no JavaScript
66 support, like yours, you should still see the contents (HTML data) and you should
67 be able to edit it normally, without a rich editor interface.
71 <form action=
"sample_posteddata.php" method=
"post">
73 <textarea class=
"ckeditor" id=
"editor1" name=
"editor1" cols=
"100" rows=
"10"><p
>This is some
<strong
>sample text
</strong
>. You are using
<a
href=
"http://ckeditor.com/">CKEditor
</a
>.
</p
></textarea>
76 <input id=
"readOnlyOn" onclick=
"toggleReadOnly();" type=
"button" value=
"Make it read-only" style=
"display:none" />
77 <input id=
"readOnlyOff" onclick=
"toggleReadOnly( false );" type=
"button" value=
"Make it editable again" style=
"display:none" />
83 CKEditor - The text editor for the Internet -
<a class=
"samples" href=
"http://ckeditor.com/">http://ckeditor.com
</a>
86 Copyright
© 2003-
2011,
<a class=
"samples" href=
"http://cksource.com/">CKSource
</a> - Frederico
87 Knabben. All rights reserved.