Ticket #901: stylesheetparser.html

File stylesheetparser.html, 4.3 KB (added by Sa'ar Zac Elias, 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>Using Stylesheet Parser 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 the Stylesheet Parser Plugin
21        </h1>
22        <div class="description">
23        <p>
24                This sample shows how to configure CKEditor instances to use the
25                <strong>Stylesheet Parser</strong> (<code>stylesheetparser</code>) plugin that fills
26                the Styles combo based on the CSS rules available in the document stylesheet.
27        </p>
28        <p>
29                To add a CKEditor instance using the <strong>stylesheetparser</strong> plugin, insert
30                the following JavaScript call into your code:
31        </p>
32        <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
33        {
34                <strong>extraPlugins : 'stylesheetparser'</strong>
35        });</pre>
36        <p>
37                Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
38                the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
39        </p>
40        </div>
41
42        <!-- This <div> holds alert messages to be display in the sample page. -->
43        <div id="alerts">
44                <noscript>
45                        <p>
46                                <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
47                                support, like yours, you should still see the contents (HTML data) and you should
48                                be able to edit it normally, without a rich editor interface.
49                        </p>
50                </noscript>
51        </div>
52        <form action="sample_posteddata.php" method="post">
53                <p>
54                        <label for="editor1">
55                                Editor 1:</label>
56                        <textarea cols="80" id="editor1" name="editor1" 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>
57                        <script type="text/javascript">
58                        //<![CDATA[
59
60                                // This call can be placed at any point after the
61                                // <textarea>, or inside a <head><script> in a
62                                // window.onload event handler.
63
64                                // Replace the <textarea id="editor"> with an CKEditor
65                                // instance, using default configurations.
66                                CKEDITOR.replace( 'editor1' ,
67                                {
68                                        extraPlugins : 'stylesheetparser',
69                                        /*
70                                         * Style sheet for the contents
71                                         */
72                                        contentsCss : 'assets/parsesample.css',
73                                        /*
74                                         *  Don't load the default Styles configuration
75                                         */
76                                        stylesSet : []
77                                });
78
79                        //]]>
80                        </script>
81                </p>
82                <p>
83                        <label for="editor2">
84                                Editor 2:</label>
85                        <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>
86                        <script type="text/javascript">
87                        //<![CDATA[
88
89                                // This call can be placed at any point after the
90                                // <textarea>, or inside a <head><script> in a
91                                // window.onload event handler.
92
93                                // Replace the <textarea id="editor"> with an CKEditor
94                                // instance, using default configurations.
95                                CKEDITOR.replace( 'editor2' ,
96                                {
97                                        extraPlugins : 'stylesheetparser',
98                                        /*
99                                         * Style sheet for the contents
100                                         */
101                                        contentsCss : 'assets/parsesample.css',
102                                        stylesheetParser_skipSelectors : /(^(body|div)\.|^\.)/i
103                                });
104
105                        //]]>
106                        </script>
107                </p>
108                <p>
109                        <input type="submit" value="Submit" />
110                </p>
111        </form>
112        <div id="footer">
113                <hr />
114                <p>
115                        CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
116                </p>
117                <p id="copy">
118                        Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
119                        Knabben. All rights reserved.
120                </p>
121        </div>
122</body>
123</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy