| 1 | <!DOCTYPE html> |
|---|
| 2 | <!-- |
|---|
| 3 | Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. |
|---|
| 4 | For licensing, see LICENSE.html or http://ckeditor.com/license |
|---|
| 5 | --> |
|---|
| 6 | <html> |
|---|
| 7 | <head> |
|---|
| 8 | <title>Replace Textarea by Code — CKEditor Sample</title> |
|---|
| 9 | <meta charset="utf-8"> |
|---|
| 10 | <script src="../ckeditor.js"></script> |
|---|
| 11 | <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> |
|---|
| 12 | <link href="sample.css" rel="stylesheet"> |
|---|
| 13 | </head> |
|---|
| 14 | <body> |
|---|
| 15 | <h1 class="samples"> |
|---|
| 16 | <a href="index.html">CKEditor Samples</a> » Replace Textarea Elements Using JavaScript Code |
|---|
| 17 | </h1> |
|---|
| 18 | <form id="myform" action="sample_posteddata.php" method="post"> |
|---|
| 19 | <div class="description"> |
|---|
| 20 | <p> |
|---|
| 21 | This editor is using an <code><iframe></code> element-based editing area, provided by the <strong>Wysiwygarea</strong> plugin. |
|---|
| 22 | </p> |
|---|
| 23 | <pre class="samples"> |
|---|
| 24 | |
|---|
| 25 | CKEDITOR.replace( '<em>textarea_id</em>' ) |
|---|
| 26 | </pre> |
|---|
| 27 | </div> |
|---|
| 28 | <textarea cols="80" id="editor1" name="editor1" rows="10"> |
|---|
| 29 | <p>Classic</p> |
|---|
| 30 | </textarea> |
|---|
| 31 | <button id="button1">Finalize Classic</button> |
|---|
| 32 | |
|---|
| 33 | <div id="editor2" contenteditable="true"> |
|---|
| 34 | <p>Inline</p> |
|---|
| 35 | </div> |
|---|
| 36 | <button id="button2">Finalize Inline</button> |
|---|
| 37 | |
|---|
| 38 | <script> |
|---|
| 39 | var edt1 = CKEDITOR.replace( 'editor1', {} ); |
|---|
| 40 | edt1.on( 'pluginsLoaded', function( event ) { |
|---|
| 41 | edt1.on( 'blur', function( evt ) { |
|---|
| 42 | console.log( 'CkEditor Classic Blur' ); |
|---|
| 43 | }, null, null, 1 ); |
|---|
| 44 | }); |
|---|
| 45 | |
|---|
| 46 | var edt2 = CKEDITOR.inline( 'editor2', {} ); |
|---|
| 47 | edt2.on( 'pluginsLoaded', function( event ) { |
|---|
| 48 | edt2.on( 'blur', function( evt ) { |
|---|
| 49 | console.log( 'CkEditor Inline Blur' ); |
|---|
| 50 | }, null, null, 1 ); |
|---|
| 51 | }); |
|---|
| 52 | |
|---|
| 53 | $('#editor').blur(function() { console.log('Global Blur'); }); |
|---|
| 54 | $('#button1').click(function() { edt1.destroy(); $('#button1').remove(); }); |
|---|
| 55 | $('#button2').click(function() { edt2.destroy(); $('#button2').remove(); }); |
|---|
| 56 | </script> |
|---|
| 57 | <p> |
|---|
| 58 | <input type="submit" value="Submit"> |
|---|
| 59 | </p> |
|---|
| 60 | </form> |
|---|
| 61 | <div id="footer"> |
|---|
| 62 | <hr> |
|---|
| 63 | <p> |
|---|
| 64 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
|---|
| 65 | </p> |
|---|
| 66 | <p id="copy"> |
|---|
| 67 | Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
|---|
| 68 | Knabben. All rights reserved. |
|---|
| 69 | </p> |
|---|
| 70 | </div> |
|---|
| 71 | </body> |
|---|
| 72 | </html> |
|---|