| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> |
|---|
| 5 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> |
|---|
| 6 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
|---|
| 7 | <script type="text/javascript" src="../ckeditor_source.js"></script> |
|---|
| 8 | <script src="sample.js" type="text/javascript"></script> |
|---|
| 9 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
|---|
| 10 | </head> |
|---|
| 11 | <body id="mybody"> |
|---|
| 12 | <textarea cols="80" id="editor2" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea> |
|---|
| 13 | <script type="text/javascript"> |
|---|
| 14 | var e = CKEDITOR.replace( 'editor1' ,{ |
|---|
| 15 | bodyId : "myBodyId" |
|---|
| 16 | }); |
|---|
| 17 | |
|---|
| 18 | //Add timeout to make sure that second event will be attached to editor's content area. |
|---|
| 19 | setTimeout(function(){ |
|---|
| 20 | //Attach event to document |
|---|
| 21 | $(document).keypress(function(event){ |
|---|
| 22 | //alert(event.altKey +' '+ event.which); |
|---|
| 23 | if(event.altKey && (event.which == 115 || event.which == 223 || event.which == 347)){ |
|---|
| 24 | e.insertHtml('<p>test </p>'); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | }); |
|---|
| 28 | |
|---|
| 29 | //Attach event to content area inside iframe |
|---|
| 30 | var doc = document.getElementsByTagName('iframe')[0].contentWindow.document; |
|---|
| 31 | $(doc).find('body').keypress(function(event){ |
|---|
| 32 | //alert(event.altKey +' '+ event.which); |
|---|
| 33 | if(event.altKey && (event.which == 115 || event.which == 223 || event.which == 347)){ |
|---|
| 34 | e.insertHtml('<p>test </p>'); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | }); |
|---|
| 38 | },3000); |
|---|
| 39 | </script> |
|---|
| 40 | |
|---|
| 41 | </body> |
|---|
| 42 | </html> |
|---|