Projet

Général

Profil

Paste
Télécharger (2,87 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / libraries / ckeditor-4.9.2-full / samples / old / readonly.html @ b986a83e

1
<!DOCTYPE html>
2
<!--
3
Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
4
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
5
-->
6
<html>
7
<head>
8
        <meta charset="utf-8">
9
        <title>Using the CKEditor Read-Only API &mdash; CKEditor Sample</title>
10
        <script src="../../ckeditor.js"></script>
11
        <link rel="stylesheet" href="sample.css">
12
        <script>
13

14
                var editor;
15

16
                // The instanceReady event is fired, when an instance of CKEditor has finished
17
                // its initialization.
18
                CKEDITOR.on( 'instanceReady', function( ev ) {
19
                        editor = ev.editor;
20

21
                        // Show this "on" button.
22
                        document.getElementById( 'readOnlyOn' ).style.display = '';
23

24
                        // Event fired when the readOnly property changes.
25
                        editor.on( 'readOnly', function() {
26
                                document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
27
                                document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
28
                        });
29
                });
30

31
                function toggleReadOnly( isReadOnly ) {
32
                        // Change the read-only state of the editor.
33
                        // https://docs.ckeditor.com/ckeditor4/docs/#!/api/CKEDITOR.editor-method-setReadOnly
34
                        editor.setReadOnly( isReadOnly );
35
                }
36

    
37
        </script>
38
</head>
39
<body>
40
        <h1 class="samples">
41
                <a href="index.html">CKEditor Samples</a> &raquo; Using the CKEditor Read-Only API
42
        </h1>
43
        <div class="warning deprecated">
44
                This sample is not maintained anymore. Check out its <a href="https://sdk.ckeditor.com/samples/readonly.html">brand new version in CKEditor SDK</a>.
45
        </div>
46
        <div class="description">
47
                <p>
48
                        This sample shows how to use the
49
                        <code><a class="samples" href="https://docs.ckeditor.com/ckeditor4/docs/#!/api/CKEDITOR.editor-method-setReadOnly">setReadOnly</a></code>
50
                        API to put editor into the read-only state that makes it impossible for users to change the editor contents.
51
                </p>
52
                <p>
53
                        For details on how to create this setup check the source code of this sample page.
54
                </p>
55
        </div>
56
        <form action="sample_posteddata.php" method="post">
57
                <p>
58
                        <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="https://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
59
                </p>
60
                <p>
61
                        <input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none">
62
                        <input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none">
63
                </p>
64
        </form>
65
        <div id="footer">
66
                <hr>
67
                <p>
68
                        CKEditor - The text editor for the Internet - <a class="samples" href="https://ckeditor.com/">https://ckeditor.com</a>
69
                </p>
70
                <p id="copy">
71
                        Copyright &copy; 2003-2018, <a class="samples" href="https://cksource.com/">CKSource</a> - Frederico
72
                        Knabben. All rights reserved.
73
                </p>
74
        </div>
75
</body>
76
</html>