| 1 | <!DOCTYPE html> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <title>Ajax — CKEditor Sample</title> |
|---|
| 5 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
|---|
| 6 | <script type="text/javascript" src="../ckeditor.js"></script> |
|---|
| 7 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> |
|---|
| 8 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script> |
|---|
| 9 | <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/smoothness/jquery-ui.css" /> |
|---|
| 10 | </head> |
|---|
| 11 | <body> |
|---|
| 12 | <script type="text/javascript"> |
|---|
| 13 | var editor, html = ''; |
|---|
| 14 | var config = { |
|---|
| 15 | baseFloatZIndex : 102000 |
|---|
| 16 | }; |
|---|
| 17 | |
|---|
| 18 | function createEditor() |
|---|
| 19 | { |
|---|
| 20 | if ( editor ) |
|---|
| 21 | return; |
|---|
| 22 | |
|---|
| 23 | $("#editor").bind('dialogopen', function() //JQ |
|---|
| 24 | { |
|---|
| 25 | editor = CKEDITOR.replace('editor1', config, 'aaa'); |
|---|
| 26 | }).bind('dialogclose', function() |
|---|
| 27 | { |
|---|
| 28 | removeEditor();//CK |
|---|
| 29 | $(this).dialog('destroy'); |
|---|
| 30 | }) |
|---|
| 31 | .dialog({autoOpen: false, |
|---|
| 32 | maxHeight:0.95 * $(window).height(),//1 |
|---|
| 33 | width: 800, |
|---|
| 34 | modal: true, |
|---|
| 35 | position: 'top', |
|---|
| 36 | resizable: false, |
|---|
| 37 | autoResize: true }).dialog('open'); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | function removeEditor() |
|---|
| 41 | { |
|---|
| 42 | if ( !editor ) |
|---|
| 43 | return; |
|---|
| 44 | |
|---|
| 45 | // Destroy the editor. |
|---|
| 46 | editor.destroy(); |
|---|
| 47 | editor = null; |
|---|
| 48 | } |
|---|
| 49 | </script> |
|---|
| 50 | <p>Click the buttons to create jquery dialog and CKEditor instance.</p> |
|---|
| 51 | <p> |
|---|
| 52 | <input onclick="createEditor();" type="button" value="Create Editor" /> |
|---|
| 53 | </p> |
|---|
| 54 | <div id="editor"> |
|---|
| 55 | <textarea id="editor1" ><a href="/" |
|---|
| 56 | >click me</a></textarea> |
|---|
| 57 | |
|---|
| 58 | </div> |
|---|
| 59 | </body> |
|---|
| 60 | </html> |
|---|