| 1 | <!DOCTYPE html> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <meta charset="utf-8"> |
|---|
| 5 | <title>A Simple Page with CKEditor</title> |
|---|
| 6 | <script src="../../ckeditor.js"></script> |
|---|
| 7 | </head> |
|---|
| 8 | <body> |
|---|
| 9 | <form> |
|---|
| 10 | <textarea name="editor1" id="editor1" rows="10" cols="80"></textarea> |
|---|
| 11 | <button id="insertSomething">Click Me</button> |
|---|
| 12 | <script> |
|---|
| 13 | var editor = CKEDITOR.replace( 'editor1', {extraPlugins: 'divarea'} ); |
|---|
| 14 | document.getElementById('insertSomething').onclick = function(e){ |
|---|
| 15 | e.preventDefault(); |
|---|
| 16 | //if( !editor.focusManager.hasFocus ){ |
|---|
| 17 | //console.log('here'); |
|---|
| 18 | //editor.focus(); |
|---|
| 19 | //} |
|---|
| 20 | editor.insertHtml('<p>Hello, World!</p>'); |
|---|
| 21 | }; |
|---|
| 22 | </script> |
|---|
| 23 | </form> |
|---|
| 24 | </body> |
|---|
| 25 | </html> |
|---|