| 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
|---|
| 4 | |
|---|
| 5 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> |
|---|
| 6 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> |
|---|
| 7 | <script type="text/javascript" src="../ckeditor_source.js"></script> |
|---|
| 8 | <script type="text/javascript" src="../adapters/jquery.js"></script> |
|---|
| 9 | |
|---|
| 10 | <script src="sample.js" type="text/javascript"></script> |
|---|
| 11 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
|---|
| 12 | |
|---|
| 13 | <script type="text/javascript"> |
|---|
| 14 | $(function() { |
|---|
| 15 | $("#list").sortable({ |
|---|
| 16 | placeholder: 'ui-state-highlight' |
|---|
| 17 | }); |
|---|
| 18 | $("#list").disableSelection(); |
|---|
| 19 | |
|---|
| 20 | for (i=0;i<10;i++) { |
|---|
| 21 | addEditor(); |
|---|
| 22 | } |
|---|
| 23 | }); |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | function addEditor() { |
|---|
| 29 | var editor_fields = document.editors.elements["editor[]"]; |
|---|
| 30 | |
|---|
| 31 | var editorAmount = 0; |
|---|
| 32 | |
|---|
| 33 | if (editor_fields.length) { |
|---|
| 34 | editorAmount = editor_fields.length; |
|---|
| 35 | } |
|---|
| 36 | else { |
|---|
| 37 | editorAmount = 1; |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | var newElem = $('#editor_container' + editorAmount).clone().attr('id', 'editor_container' + (editorAmount + 1)); |
|---|
| 41 | |
|---|
| 42 | newElem.html("<textarea class='editor' name='editor[]' id='editor" + (editorAmount + 1) + "' rows='4' cols='30'></textarea>"); |
|---|
| 43 | |
|---|
| 44 | $("#editor_container" + editorAmount).after(newElem); |
|---|
| 45 | |
|---|
| 46 | $("#editor" + (editorAmount + 1)).ckeditor(); |
|---|
| 47 | } |
|---|
| 48 | </script> |
|---|
| 49 | </head> |
|---|
| 50 | <body> |
|---|
| 51 | |
|---|
| 52 | <form name="editors"> |
|---|
| 53 | <ul id="list"> |
|---|
| 54 | <li name="editor_container1" id="editor_container1"><textarea name='editor[]' id='editor1' rows='4' cols='30'></textarea></li> |
|---|
| 55 | </ul> |
|---|
| 56 | </form> |
|---|
| 57 | </body> |
|---|
| 58 | </html> |
|---|