Ticket #8056: autogrow.html

File autogrow.html, 4.7 KB (added by Dinu, 13 years ago)
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<!--
3Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4For 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 &mdash; 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 &mdash; 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>&lt;textarea&gt;</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&lt;table border=&quot;1&quot; cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; style=&quot;width: 100%; height: 1000px; &quot;&gt;
70        &lt;tbody&gt;
71                &lt;tr&gt;
72                        &lt;td&gt;
73                                &nbsp;&lt;/td&gt;
74                        &lt;td&gt;
75                                &nbsp;&lt;/td&gt;
76                &lt;/tr&gt;
77                &lt;tr&gt;
78                        &lt;td&gt;
79                                &nbsp;&lt;/td&gt;
80                        &lt;td&gt;
81                                &nbsp;&lt;/td&gt;
82                &lt;/tr&gt;
83                &lt;tr&gt;
84                        &lt;td&gt;
85                                &nbsp;&lt;/td&gt;
86                        &lt;td&gt;
87                                &nbsp;&lt;/td&gt;
88                &lt;/tr&gt;
89        &lt;/tbody&gt;
90&lt;/table&gt;
91&lt;p&gt;
92        &nbsp;
93&lt;/p&gt;                     
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">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</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 &copy; 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>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy