| 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-2010, 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 Textarea by Code - CKEditor Sample</title> |
|---|
| 9 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
|---|
| 10 | <script type="text/javascript" src="../ckeditor.js"></script> |
|---|
| 11 | <script src="sample.js" type="text/javascript"></script> |
|---|
| 12 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
|---|
| 13 | </head> |
|---|
| 14 | <body> |
|---|
| 15 | <h1> |
|---|
| 16 | CKEditor Sample |
|---|
| 17 | </h1> |
|---|
| 18 | <!-- This <div> holds alert messages to be display in the sample page. --> |
|---|
| 19 | <div id="alerts"> |
|---|
| 20 | <noscript> |
|---|
| 21 | <p> |
|---|
| 22 | <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript |
|---|
| 23 | support, like yours, you should still see the contents (HTML data) and you should |
|---|
| 24 | be able to edit it normally, without a rich editor interface. |
|---|
| 25 | </p> |
|---|
| 26 | </noscript> |
|---|
| 27 | </div> |
|---|
| 28 | <p>Press the button to see the problem in IE7.</p> |
|---|
| 29 | <form action="sample_posteddata.php" method="post"> |
|---|
| 30 | <p> |
|---|
| 31 | <label for="editor1"> |
|---|
| 32 | Editor 1:</label><br /> |
|---|
| 33 | <textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea> |
|---|
| 34 | <script type="text/javascript"> |
|---|
| 35 | //<![CDATA[ |
|---|
| 36 | |
|---|
| 37 | // This call can be placed at any point after the |
|---|
| 38 | // <textarea>, or inside a <head><script> in a |
|---|
| 39 | // window.onload event handler. |
|---|
| 40 | CKEDITOR.dialog.add( 'Foo', function( app ) |
|---|
| 41 | { |
|---|
| 42 | return { |
|---|
| 43 | title : 'IE7 problem', |
|---|
| 44 | minWidth : 270, |
|---|
| 45 | minHeight : 60, |
|---|
| 46 | contents : [ |
|---|
| 47 | { |
|---|
| 48 | id : 'tab1', |
|---|
| 49 | elements : |
|---|
| 50 | [ |
|---|
| 51 | { |
|---|
| 52 | type : 'html', |
|---|
| 53 | html : '', |
|---|
| 54 | id : 'msg' |
|---|
| 55 | } |
|---|
| 56 | ] |
|---|
| 57 | } |
|---|
| 58 | ], |
|---|
| 59 | buttons : [ CKEDITOR.dialog.okButton ] |
|---|
| 60 | }; |
|---|
| 61 | } ); |
|---|
| 62 | |
|---|
| 63 | // Replace the <textarea id="editor"> with an CKEditor |
|---|
| 64 | // instance, using default configurations. |
|---|
| 65 | var editor = CKEDITOR.replace( 'editor1', { toolbar : [['MyButton']] } ); |
|---|
| 66 | |
|---|
| 67 | editor.addCommand( 'myDialogCmd', |
|---|
| 68 | { |
|---|
| 69 | exec : function( editor ) |
|---|
| 70 | { |
|---|
| 71 | editor.openDialog( 'Foo', function( dialog ) { |
|---|
| 72 | var msg = '<h3>Test header</h3>' + |
|---|
| 73 | '<ul>' + |
|---|
| 74 | '<li>item 1</li>' + |
|---|
| 75 | '<li>item 2</li>' + |
|---|
| 76 | '<li>item 3</li>' + |
|---|
| 77 | '<li>item 4</li>' + |
|---|
| 78 | '<li>item 5</li>' + |
|---|
| 79 | '<li>item 6</li>' + |
|---|
| 80 | '<li>item 7</li>' + |
|---|
| 81 | '</ul>' + |
|---|
| 82 | '<p>Do you see me in IE7-like browser?</p>'; |
|---|
| 83 | setTimeout( function() { |
|---|
| 84 | dialog.getContentElement( 'tab1', 'msg' ).getElement().setHtml( msg ); |
|---|
| 85 | }, 400); |
|---|
| 86 | }); |
|---|
| 87 | } |
|---|
| 88 | }); |
|---|
| 89 | |
|---|
| 90 | // Add the a custom toolbar buttons, which fires the above |
|---|
| 91 | // command.. |
|---|
| 92 | editor.ui.addButton( 'MyButton', |
|---|
| 93 | { |
|---|
| 94 | label : 'My Dialog', |
|---|
| 95 | command : 'myDialogCmd' |
|---|
| 96 | } ); |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | //]]> |
|---|
| 100 | </script> |
|---|
| 101 | </p> |
|---|
| 102 | </form> |
|---|
| 103 | <div id="footer"> |
|---|
| 104 | <hr /> |
|---|
| 105 | <p> |
|---|
| 106 | CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a> |
|---|
| 107 | </p> |
|---|
| 108 | <p id="copy"> |
|---|
| 109 | Copyright © 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico |
|---|
| 110 | Knabben. All rights reserved. |
|---|
| 111 | </p> |
|---|
| 112 | </div> |
|---|
| 113 | </body> |
|---|
| 114 | </html> |
|---|