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 | |
---|
7 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> |
---|
8 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script> |
---|
9 | |
---|
10 | <script type="text/javascript"> |
---|
11 | $.widget( "ui.dialog", $.ui.dialog, { |
---|
12 | /*! jQuery UI - v1.10.2 - 2013-12-12 |
---|
13 | * http://bugs.jqueryui.com/ticket/9087#comment:27 - bugfix |
---|
14 | * http://bugs.jqueryui.com/ticket/4727#comment:23 - bugfix |
---|
15 | * allowInteraction fix to accommodate windowed editors |
---|
16 | */ |
---|
17 | _allowInteraction: function( event ) { |
---|
18 | if ( this._super( event ) ) { |
---|
19 | return true; |
---|
20 | } |
---|
21 | |
---|
22 | // address interaction issues with general iframes with the dialog |
---|
23 | if ( event.target.ownerDocument != this.document[ 0 ] ) { |
---|
24 | return true; |
---|
25 | } |
---|
26 | |
---|
27 | // address interaction issues with dialog window |
---|
28 | if ( $( event.target ).closest( ".cke_dialog" ).length ) { |
---|
29 | return true; |
---|
30 | } |
---|
31 | |
---|
32 | // address interaction issues with iframe based drop downs in IE |
---|
33 | if ( $( event.target ).closest( ".cke" ).length ) { |
---|
34 | return true; |
---|
35 | } |
---|
36 | }, |
---|
37 | /*! jQuery UI - v1.10.2 - 2013-10-28 |
---|
38 | * http://dev.ckeditor.com/ticket/10269 - bugfix |
---|
39 | * moveToTop fix to accommodate windowed editors |
---|
40 | */ |
---|
41 | _moveToTop: function ( event, silent ) { |
---|
42 | if ( !event || !this.options.modal ) { |
---|
43 | this._super( event, silent ); |
---|
44 | } |
---|
45 | } |
---|
46 | }); |
---|
47 | </script> |
---|
48 | |
---|
49 | <script type="text/javascript" src="http://cdn.skatrix.com/tools/ckeditor/4.3.1/ckeditor.js"></script> |
---|
50 | |
---|
51 | |
---|
52 | <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/smoothness/jquery-ui.css" /> |
---|
53 | |
---|
54 | </head> |
---|
55 | <body> |
---|
56 | <script type="text/javascript"> |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | var editor, html = ''; |
---|
61 | var config = {}; |
---|
62 | |
---|
63 | function createEditor() |
---|
64 | { |
---|
65 | if ( editor ) |
---|
66 | return; |
---|
67 | |
---|
68 | $("#editor").bind('dialogopen', function() //JQ |
---|
69 | { |
---|
70 | editor = CKEDITOR.replace('editor1', config, 'aaa'); |
---|
71 | }).bind('dialogclose', function() |
---|
72 | { |
---|
73 | removeEditor();//CK |
---|
74 | $(this).dialog('destroy'); |
---|
75 | }) |
---|
76 | .dialog({autoOpen: false, |
---|
77 | maxHeight:0.95 * $(window).height(),//1 |
---|
78 | width: 800, |
---|
79 | modal: true, |
---|
80 | position: 'top', |
---|
81 | resizable: false, |
---|
82 | autoResize: true }).dialog('open'); |
---|
83 | } |
---|
84 | |
---|
85 | function removeEditor() |
---|
86 | { |
---|
87 | if ( !editor ) |
---|
88 | return; |
---|
89 | |
---|
90 | // Destroy the editor. |
---|
91 | editor.destroy(); |
---|
92 | editor = null; |
---|
93 | } |
---|
94 | </script> |
---|
95 | <p>Click the buttons to create jquery dialog and CKEditor instance.</p> |
---|
96 | <p> |
---|
97 | <input onclick="createEditor();" type="button" value="Create Editor" /> |
---|
98 | </p> |
---|
99 | <div id="editor"> |
---|
100 | <textarea id="editor1" ><a href="/" |
---|
101 | >click me</a></textarea> |
---|
102 | |
---|
103 | </div> |
---|
104 | </body> |
---|
105 | </html> |
---|