3 Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
\r
4 For licensing, see LICENSE.md or http://ckeditor.com/license
\r
8 <meta charset="utf-8">
\r
9 <title>Using the CKEditor Read-Only API — CKEditor Sample</title>
\r
10 <script src="../../ckeditor.js"></script>
\r
11 <link rel="stylesheet" href="sample.css">
\r
16 // The instanceReady event is fired, when an instance of CKEditor has finished
\r
17 // its initialization.
\r
18 CKEDITOR.on( 'instanceReady', function( ev ) {
\r
21 // Show this "on" button.
\r
22 document.getElementById( 'readOnlyOn' ).style.display = '';
\r
24 // Event fired when the readOnly property changes.
\r
25 editor.on( 'readOnly', function() {
\r
26 document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
\r
27 document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
\r
31 function toggleReadOnly( isReadOnly ) {
\r
32 // Change the read-only state of the editor.
\r
33 // http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly
\r
34 editor.setReadOnly( isReadOnly );
\r
40 <h1 class="samples">
\r
41 <a href="index.html">CKEditor Samples</a> » Using the CKEditor Read-Only API
\r
43 <div class="warning deprecated">
\r
44 This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/readonly.html">brand new version in CKEditor SDK</a>.
\r
46 <div class="description">
\r
48 This sample shows how to use the
\r
49 <code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly">setReadOnly</a></code>
\r
50 API to put editor into the read-only state that makes it impossible for users to change the editor contents.
\r
53 For details on how to create this setup check the source code of this sample page.
\r
56 <form action="sample_posteddata.php" method="post">
\r
58 <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>
\r
61 <input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none">
\r
62 <input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none">
\r
68 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
\r
71 Copyright © 2003-2017, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
\r
72 Knabben. All rights reserved.
\r