1 | <!DOCTYPE html> |
---|
2 | <!-- |
---|
3 | Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. |
---|
4 | For licensing, see LICENSE.html or http://ckeditor.com/license |
---|
5 | --> |
---|
6 | <html> |
---|
7 | <head> |
---|
8 | <meta charset="utf-8"> |
---|
9 | <title>API Usage — CKEditor Sample</title> |
---|
10 | <script src="../ckeditor.js"></script> |
---|
11 | <link href="sample.css" rel="stylesheet"> |
---|
12 | <script> |
---|
13 | // The instanceReady event is fired, when an instance of CKEditor has finished |
---|
14 | // its initialization. |
---|
15 | CKEDITOR.on( 'instanceReady', function( ev ) { |
---|
16 | console.log('instanceReady '+ CKEDITOR.instances.editor1.checkDirty()); |
---|
17 | // Show the editor name and description in the browser status bar. |
---|
18 | //document.getElementById( 'eMessage' ).innerHTML = 'Instance <code>' + ev.editor.name + '<\/code> loaded.'; |
---|
19 | |
---|
20 | // Show this sample buttons. |
---|
21 | //document.getElementById( 'eButtons' ).style.display = 'block'; |
---|
22 | console.log('After instanceReady '+ CKEDITOR.instances.editor1.checkDirty()); |
---|
23 | }); |
---|
24 | </script> |
---|
25 | |
---|
26 | </head> |
---|
27 | <body onload="console.log('onload '+CKEDITOR.instances.editor1.checkDirty());"> |
---|
28 | |
---|
29 | <textarea cols="100" id="editor1" name="editor1" rows="10"></textarea> |
---|
30 | |
---|
31 | <script> |
---|
32 | // Replace the <textarea id="editor1"> with an CKEditor instance. |
---|
33 | CKEDITOR.replace( 'editor1', { |
---|
34 | on: { |
---|
35 | |
---|
36 | // Check for availability of corresponding plugins. |
---|
37 | pluginsLoaded: function( evt ) { |
---|
38 | console.log('plugins loaded '+ CKEDITOR.instances.editor1.checkDirty()); |
---|
39 | var doc = CKEDITOR.document, ed = evt.editor; |
---|
40 | if ( !ed.getCommand( 'bold' ) ) |
---|
41 | doc.getById( 'exec-bold' ).hide(); |
---|
42 | if ( !ed.getCommand( 'link' ) ) |
---|
43 | doc.getById( 'exec-link' ).hide(); |
---|
44 | console.log('After PluginsLoaded '+ CKEDITOR.instances.editor1.checkDirty()); |
---|
45 | } |
---|
46 | } |
---|
47 | }); |
---|
48 | </script> |
---|
49 | |
---|
50 | |
---|
51 | </body> |
---|
52 | </html> |
---|