author | indvd00m (gotoindvdum[at]gmail[dot]com) |
Thu, 15 Dec 2016 18:10:20 +0300 | |
changeset 0 | 44d330dccc59 |
permissions | -rw-r--r-- |
indvd00m@0 | 1 |
<!DOCTYPE html> |
indvd00m@0 | 2 |
<!-- |
indvd00m@0 | 3 |
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. |
indvd00m@0 | 4 |
For licensing, see LICENSE.md or http://ckeditor.com/license |
indvd00m@0 | 5 |
--> |
indvd00m@0 | 6 |
<html> |
indvd00m@0 | 7 |
<head> |
indvd00m@0 | 8 |
<meta charset="utf-8"> |
indvd00m@0 | 9 |
<title>Using the CKEditor Read-Only API — CKEditor Sample</title> |
indvd00m@0 | 10 |
<script src="../../ckeditor.js"></script> |
indvd00m@0 | 11 |
<link rel="stylesheet" href="sample.css"> |
indvd00m@0 | 12 |
<script> |
indvd00m@0 | 13 |
|
indvd00m@0 | 14 |
var editor; |
indvd00m@0 | 15 |
|
indvd00m@0 | 16 |
// The instanceReady event is fired, when an instance of CKEditor has finished |
indvd00m@0 | 17 |
// its initialization. |
indvd00m@0 | 18 |
CKEDITOR.on( 'instanceReady', function( ev ) { |
indvd00m@0 | 19 |
editor = ev.editor; |
indvd00m@0 | 20 |
|
indvd00m@0 | 21 |
// Show this "on" button. |
indvd00m@0 | 22 |
document.getElementById( 'readOnlyOn' ).style.display = ''; |
indvd00m@0 | 23 |
|
indvd00m@0 | 24 |
// Event fired when the readOnly property changes. |
indvd00m@0 | 25 |
editor.on( 'readOnly', function() { |
indvd00m@0 | 26 |
document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : ''; |
indvd00m@0 | 27 |
document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none'; |
indvd00m@0 | 28 |
}); |
indvd00m@0 | 29 |
}); |
indvd00m@0 | 30 |
|
indvd00m@0 | 31 |
function toggleReadOnly( isReadOnly ) { |
indvd00m@0 | 32 |
// Change the read-only state of the editor. |
indvd00m@0 | 33 |
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly |
indvd00m@0 | 34 |
editor.setReadOnly( isReadOnly ); |
indvd00m@0 | 35 |
} |
indvd00m@0 | 36 |
|
indvd00m@0 | 37 |
</script> |
indvd00m@0 | 38 |
</head> |
indvd00m@0 | 39 |
<body> |
indvd00m@0 | 40 |
<h1 class="samples"> |
indvd00m@0 | 41 |
<a href="index.html">CKEditor Samples</a> » Using the CKEditor Read-Only API |
indvd00m@0 | 42 |
</h1> |
indvd00m@0 | 43 |
<div class="warning deprecated"> |
indvd00m@0 | 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>. |
indvd00m@0 | 45 |
</div> |
indvd00m@0 | 46 |
<div class="description"> |
indvd00m@0 | 47 |
<p> |
indvd00m@0 | 48 |
This sample shows how to use the |
indvd00m@0 | 49 |
<code><a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly">setReadOnly</a></code> |
indvd00m@0 | 50 |
API to put editor into the read-only state that makes it impossible for users to change the editor contents. |
indvd00m@0 | 51 |
</p> |
indvd00m@0 | 52 |
<p> |
indvd00m@0 | 53 |
For details on how to create this setup check the source code of this sample page. |
indvd00m@0 | 54 |
</p> |
indvd00m@0 | 55 |
</div> |
indvd00m@0 | 56 |
<form action="sample_posteddata.php" method="post"> |
indvd00m@0 | 57 |
<p> |
indvd00m@0 | 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> |
indvd00m@0 | 59 |
</p> |
indvd00m@0 | 60 |
<p> |
indvd00m@0 | 61 |
<input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none"> |
indvd00m@0 | 62 |
<input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none"> |
indvd00m@0 | 63 |
</p> |
indvd00m@0 | 64 |
</form> |
indvd00m@0 | 65 |
<div id="footer"> |
indvd00m@0 | 66 |
<hr> |
indvd00m@0 | 67 |
<p> |
indvd00m@0 | 68 |
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
indvd00m@0 | 69 |
</p> |
indvd00m@0 | 70 |
<p id="copy"> |
indvd00m@0 | 71 |
Copyright © 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
indvd00m@0 | 72 |
Knabben. All rights reserved. |
indvd00m@0 | 73 |
</p> |
indvd00m@0 | 74 |
</div> |
indvd00m@0 | 75 |
</body> |
indvd00m@0 | 76 |
</html> |