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-2011, 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>AutoGrow Plugin — CKEditor Sample</title> |
---|
9 | <meta content="text/html; charset=utf-8" http-equiv="content-type" /> |
---|
10 | <!-- CKReleaser %REMOVE_LINE% |
---|
11 | <script type="text/javascript" src="../ckeditor.js"></script> |
---|
12 | CKReleaser %REMOVE_START% --> |
---|
13 | <script type="text/javascript" src="../ckeditor_source.js"></script> |
---|
14 | <!-- CKReleaser %REMOVE_END% --> |
---|
15 | <script src="sample.js" type="text/javascript"></script> |
---|
16 | <link href="sample.css" rel="stylesheet" type="text/css" /> |
---|
17 | </head> |
---|
18 | <body> |
---|
19 | <h1 class="samples"> |
---|
20 | CKEditor Sample — Using AutoGrow Plugin |
---|
21 | </h1> |
---|
22 | <div class="description"> |
---|
23 | <p> |
---|
24 | This sample shows how to configure CKEditor instances to use the |
---|
25 | <strong>autogrow</strong> plugin that lets the editor window expand and shrink |
---|
26 | depending on the amount and size of content entered in the editing area. |
---|
27 | </p> |
---|
28 | <p> |
---|
29 | In its default implementation the <strong>AutoGrow feature</strong> can expand the |
---|
30 | CKEditor window infinitely in order to avoid introducing scrollbars to the editing area. |
---|
31 | </p> |
---|
32 | <p> |
---|
33 | It is also possible to set a maximum height for the editor window. Once CKEditor |
---|
34 | editing area reaches the value in pixels specified in the <code>autoGrow_maxHeight</code> |
---|
35 | attribute, scrollbars will be added and the editor window will no longer expand. |
---|
36 | </p> |
---|
37 | <p> |
---|
38 | To add a CKEditor instance using the <strong>autogrow</strong> plugin and its |
---|
39 | <code>autoGrow_maxHeight</code> attribute, insert the following JavaScript call to your code: |
---|
40 | </p> |
---|
41 | <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>', |
---|
42 | { |
---|
43 | <strong>extraPlugins : 'autogrow',</strong> |
---|
44 | autoGrow_maxHeight : 800, |
---|
45 | // Remove the resize plugin, as it doesn't make sense to use it in conjunction with the AutoGrow plugin. |
---|
46 | removePlugins : 'resize' |
---|
47 | });</pre> |
---|
48 | <p> |
---|
49 | Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of |
---|
50 | the <code><textarea></code> element to be replaced with CKEditor. The maximum height should |
---|
51 | be given in pixels. |
---|
52 | </p> |
---|
53 | </div> |
---|
54 | <!-- This <div> holds alert messages to be display in the sample page. --> |
---|
55 | <div id="alerts"> |
---|
56 | <noscript> |
---|
57 | <p> |
---|
58 | <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript |
---|
59 | support, like yours, you should still see the contents (HTML data) and you should |
---|
60 | be able to edit it normally, without a rich editor interface. |
---|
61 | </p> |
---|
62 | </noscript> |
---|
63 | </div> |
---|
64 | <form action="sample_posteddata.php" method="post"> |
---|
65 | <p> |
---|
66 | <label for="editor1"> |
---|
67 | CKEditor using the <strong>autogrow</strong> plugin with its default configuration:</label> |
---|
68 | <textarea cols="80" id="editor1" name="editor1" rows="10"> |
---|
69 | <table border="1" cellpadding="1" cellspacing="1" style="width: 100%; height: 1000px; "> |
---|
70 | <tbody> |
---|
71 | <tr> |
---|
72 | <td> |
---|
73 | </td> |
---|
74 | <td> |
---|
75 | </td> |
---|
76 | </tr> |
---|
77 | <tr> |
---|
78 | <td> |
---|
79 | </td> |
---|
80 | <td> |
---|
81 | </td> |
---|
82 | </tr> |
---|
83 | <tr> |
---|
84 | <td> |
---|
85 | </td> |
---|
86 | <td> |
---|
87 | </td> |
---|
88 | </tr> |
---|
89 | </tbody> |
---|
90 | </table> |
---|
91 | <p> |
---|
92 | |
---|
93 | </p> |
---|
94 | </textarea> |
---|
95 | <script type="text/javascript"> |
---|
96 | //<![CDATA[ |
---|
97 | |
---|
98 | CKEDITOR.replace( 'editor1', { |
---|
99 | extraPlugins : 'autogrow', |
---|
100 | removePlugins : 'resize' |
---|
101 | }); |
---|
102 | |
---|
103 | //]]> |
---|
104 | </script> |
---|
105 | </p> |
---|
106 | <p> |
---|
107 | <label for="editor2"> |
---|
108 | CKEditor using the <strong>autogrow</strong> plugin with maximum height set to 400:</label> |
---|
109 | <textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea> |
---|
110 | <script type="text/javascript"> |
---|
111 | //<![CDATA[ |
---|
112 | |
---|
113 | CKEDITOR.replace( 'editor2', { |
---|
114 | extraPlugins : 'autogrow', |
---|
115 | autoGrow_maxHeight : 400, |
---|
116 | removePlugins : 'resize' |
---|
117 | }); |
---|
118 | |
---|
119 | //]]> |
---|
120 | </script> |
---|
121 | </p> |
---|
122 | <p> |
---|
123 | <input type="submit" value="Submit" /> |
---|
124 | </p> |
---|
125 | </form> |
---|
126 | <div id="footer"> |
---|
127 | <hr /> |
---|
128 | <p> |
---|
129 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
---|
130 | </p> |
---|
131 | <p id="copy"> |
---|
132 | Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
---|
133 | Knabben. All rights reserved. |
---|
134 | </p> |
---|
135 | </div> |
---|
136 | </body> |
---|
137 | </html> |
---|