| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 2 | <!-- |
|---|
| 3 | Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. |
|---|
| 4 | For licensing, see LICENSE.html or http://ckeditor.com/license |
|---|
| 5 | --> |
|---|
| 6 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 7 | <head> |
|---|
| 8 | <title>Replace Textareas by Class Name — CKEditor Sample</title> |
|---|
| 9 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
|---|
| 10 | <!-- CKReleaser %REMOVE_LINE% |
|---|
| 11 | <script type="text/javascript" src="../ckeditor.js"></script> |
|---|
| 12 | CKReleaser %REMOVE_START% --> |
|---|
| 13 | <script type="text/javascript" src="../ckeditor_source.js"></script> |
|---|
| 14 | <!-- CKReleaser %REMOVE_END% --> |
|---|
| 15 | <script src="sample.js" type="text/javascript"></script> |
|---|
| 16 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
|---|
| 17 | </head> |
|---|
| 18 | <body> |
|---|
| 19 | |
|---|
| 20 | <form action="sample_posteddata.php" method="post"> |
|---|
| 21 | <p> |
|---|
| 22 | <label for="editor1"> |
|---|
| 23 | Editor 1:</label> |
|---|
| 24 | <textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10"></textarea> |
|---|
| 25 | </p> |
|---|
| 26 | <p> |
|---|
| 27 | <input type="submit" value="Submit" /> |
|---|
| 28 | <input onclick="insertElements()" type="button" value="Insert Elements" /> |
|---|
| 29 | </p> |
|---|
| 30 | </form> |
|---|
| 31 | |
|---|
| 32 | <script type="text/javascript"> |
|---|
| 33 | |
|---|
| 34 | function insertElements(){ |
|---|
| 35 | var temp = new CKEDITOR.dom.element( 'div', CKEDITOR.instances.editor1.document); |
|---|
| 36 | temp.setHtml('<p>Text goes here</p><img src="http://a.cksource.com/c/1/inc/img/demo-little-red.jpg"/>'); |
|---|
| 37 | console.log(temp.getOuterHtml()); |
|---|
| 38 | console.log(temp.getFirst()); |
|---|
| 39 | CKEDITOR.instances.editor1.insertElement(temp.getFirst()); |
|---|
| 40 | setTimeout(function(){ |
|---|
| 41 | console.log(temp.getFirst()); |
|---|
| 42 | CKEDITOR.instances.editor1.insertElement(temp.getFirst()); |
|---|
| 43 | }, 1000); |
|---|
| 44 | } |
|---|
| 45 | </script> |
|---|
| 46 | |
|---|
| 47 | <div id="footer"> |
|---|
| 48 | <hr /> |
|---|
| 49 | <p> |
|---|
| 50 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
|---|
| 51 | </p> |
|---|
| 52 | <p id="copy"> |
|---|
| 53 | Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
|---|
| 54 | Knabben. All rights reserved. |
|---|
| 55 | </p> |
|---|
| 56 | </div> |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | </body> |
|---|
| 61 | </html> |
|---|