JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-4.1_full
[ckeditor.git] / samples / xhtmlstyle.html
1 <!DOCTYPE html>\r
2 <!--\r
3 Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
4 For licensing, see LICENSE.html or http://ckeditor.com/license\r
5 -->\r
6 <html>\r
7 <head>\r
8         <title>XHTML Compliant Output &mdash; CKEditor Sample</title>\r
9         <meta charset="utf-8">\r
10         <meta name="ckeditor-sample-required-plugins" content="sourcearea">\r
11         <script src="../ckeditor.js"></script>\r
12         <script src="../samples/sample.js"></script>\r
13         <link href="sample.css" rel="stylesheet">\r
14 </head>\r
15 <body>\r
16         <h1 class="samples">\r
17                 <a href="index.html">CKEditor Samples</a> &raquo; Producing XHTML Compliant Output\r
18         </h1>\r
19         <div class="description">\r
20                 <p>\r
21                         This sample shows how to configure CKEditor to output valid\r
22                         <a class="samples" href="http://www.w3.org/TR/xhtml11/">XHTML 1.1</a> code.\r
23                         Deprecated elements (<code>&lt;font&gt;</code>, <code>&lt;u&gt;</code>) or attributes\r
24                         (<code>size</code>, <code>face</code>) will be replaced with XHTML compliant code.\r
25                 </p>\r
26                 <p>\r
27                         To add a CKEditor instance outputting valid XHTML code, load the editor using a standard\r
28                         JavaScript call and define CKEditor features to use the XHTML compliant elements and styles.\r
29                 </p>\r
30                 <p>\r
31                         A snippet of the configuration code can be seen below; check the source of this page for\r
32                         full definition:\r
33                 </p>\r
34 <pre class="samples">\r
35 CKEDITOR.replace( '<em>textarea_id</em>', {\r
36         contentsCss: 'assets/outputxhtml.css',\r
37 \r
38         coreStyles_bold: {\r
39                 element: 'span',\r
40                 attributes: { 'class': 'Bold' }\r
41         },\r
42         coreStyles_italic: {\r
43                 element: 'span',\r
44                 attributes: { 'class': 'Italic' }\r
45         },\r
46 \r
47         ...\r
48 });</pre>\r
49         </div>\r
50         <form action="sample_posteddata.php" method="post">\r
51                 <p>\r
52                         <label for="editor1">\r
53                                 Editor 1:\r
54                         </label>\r
55                         <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;span class="Bold"&gt;sample text&lt;/span&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>\r
56                         <script>\r
57 \r
58                                 CKEDITOR.replace( 'editor1', {\r
59                                         /*\r
60                                          * Style sheet for the contents\r
61                                          */\r
62                                         contentsCss: 'assets/outputxhtml/outputxhtml.css',\r
63 \r
64                                         /*\r
65                                          * Special allowed content rules for spans used by\r
66                                          * font face, size, and color buttons.\r
67                                          *\r
68                                          * Note: all rules have been written separately so\r
69                                          * it was possible to specify required classes.\r
70                                          */\r
71                                         extraAllowedContent: 'span(!FontColor1);span(!FontColor2);span(!FontColor3);' +\r
72                                                 'span(!FontColor1BG);span(!FontColor2BG);span(!FontColor3BG);' +\r
73                                                 'span(!FontComic);span(!FontCourier);span(!FontTimes);' +\r
74                                                 'span(!FontSmaller);span(!FontLarger);span(!FontSmall);span(!FontBig);span(!FontDouble)',\r
75 \r
76                                         /*\r
77                                          * Core styles.\r
78                                          */\r
79                                         coreStyles_bold: {\r
80                                                 element: 'span',\r
81                                                 attributes: { 'class': 'Bold' }\r
82                                         },\r
83                                         coreStyles_italic: {\r
84                                                 element: 'span',\r
85                                                 attributes: { 'class': 'Italic' }\r
86                                         },\r
87                                         coreStyles_underline: {\r
88                                                 element: 'span',\r
89                                                 attributes: { 'class': 'Underline' }\r
90                                         },\r
91                                         coreStyles_strike: {\r
92                                                 element: 'span',\r
93                                                 attributes: { 'class': 'StrikeThrough' },\r
94                                                 overrides: 'strike'\r
95                                         },\r
96                                         coreStyles_subscript: {\r
97                                                 element: 'span',\r
98                                                 attributes: { 'class': 'Subscript' },\r
99                                                 overrides: 'sub'\r
100                                         },\r
101                                         coreStyles_superscript: {\r
102                                                 element: 'span',\r
103                                                 attributes: { 'class': 'Superscript' },\r
104                                                 overrides: 'sup'\r
105                                         },\r
106 \r
107                                         /*\r
108                                          * Font face.\r
109                                          */\r
110 \r
111                                         // List of fonts available in the toolbar combo. Each font definition is\r
112                                         // separated by a semi-colon (;). We are using class names here, so each font\r
113                                         // is defined by {Combo Label}/{Class Name}.\r
114                                         font_names: 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes',\r
115 \r
116                                         // Define the way font elements will be applied to the document. The "span"\r
117                                         // element will be used. When a font is selected, the font name defined in the\r
118                                         // above list is passed to this definition with the name "Font", being it\r
119                                         // injected in the "class" attribute.\r
120                                         // We must also instruct the editor to replace span elements that are used to\r
121                                         // set the font (Overrides).\r
122                                         font_style: {\r
123                                                 element: 'span',\r
124                                                 attributes: { 'class': '#(family)' },\r
125                                                 overrides: [\r
126                                                         {\r
127                                                                 element: 'span',\r
128                                                                 attributes: {\r
129                                                                         'class': /^Font(?:Comic|Courier|Times)$/\r
130                                                                 }\r
131                                                         }\r
132                                                 ]\r
133                                         },\r
134 \r
135                                         /*\r
136                                          * Font sizes.\r
137                                          */\r
138                                         fontSize_sizes: 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',\r
139                                         fontSize_style: {\r
140                                                 element: 'span',\r
141                                                 attributes: { 'class': '#(size)' },\r
142                                                 overrides: [\r
143                                                         {\r
144                                                                 element: 'span',\r
145                                                                 attributes: {\r
146                                                                         'class': /^Font(?:Smaller|Larger|Small|Big|Double)$/\r
147                                                                 }\r
148                                                         }\r
149                                                 ]\r
150                                         } ,\r
151 \r
152                                         /*\r
153                                          * Font colors.\r
154                                          */\r
155                                         colorButton_enableMore: false,\r
156 \r
157                                         colorButton_colors: 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',\r
158                                         colorButton_foreStyle: {\r
159                                                 element: 'span',\r
160                                                 attributes: { 'class': '#(color)' },\r
161                                                 overrides: [\r
162                                                         {\r
163                                                                 element: 'span',\r
164                                                                 attributes: {\r
165                                                                         'class': /^FontColor(?:1|2|3)$/\r
166                                                                 }\r
167                                                         }\r
168                                                 ]\r
169                                         },\r
170 \r
171                                         colorButton_backStyle: {\r
172                                                 element: 'span',\r
173                                                 attributes: { 'class': '#(color)BG' },\r
174                                                 overrides: [\r
175                                                         {\r
176                                                                 element: 'span',\r
177                                                                 attributes: {\r
178                                                                         'class': /^FontColor(?:1|2|3)BG$/\r
179                                                                 }\r
180                                                         }\r
181                                                 ]\r
182                                         },\r
183 \r
184                                         /*\r
185                                          * Indentation.\r
186                                          */\r
187                                         indentClasses: [ 'Indent1', 'Indent2', 'Indent3' ],\r
188 \r
189                                         /*\r
190                                          * Paragraph justification.\r
191                                          */\r
192                                         justifyClasses: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],\r
193 \r
194                                         /*\r
195                                          * Styles combo.\r
196                                          */\r
197                                         stylesSet: [\r
198                                                 { name: 'Strong Emphasis', element: 'strong' },\r
199                                                 { name: 'Emphasis', element: 'em' },\r
200 \r
201                                                 { name: 'Computer Code', element: 'code' },\r
202                                                 { name: 'Keyboard Phrase', element: 'kbd' },\r
203                                                 { name: 'Sample Text', element: 'samp' },\r
204                                                 { name: 'Variable', element: 'var' },\r
205 \r
206                                                 { name: 'Deleted Text', element: 'del' },\r
207                                                 { name: 'Inserted Text', element: 'ins' },\r
208 \r
209                                                 { name: 'Cited Work', element: 'cite' },\r
210                                                 { name: 'Inline Quotation', element: 'q' }\r
211                                         ]\r
212                                 });\r
213 \r
214                         </script>\r
215                 </p>\r
216                 <p>\r
217                         <input type="submit" value="Submit">\r
218                 </p>\r
219         </form>\r
220         <div id="footer">\r
221                 <hr>\r
222                 <p>\r
223                         CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
224                 </p>\r
225                 <p id="copy">\r
226                         Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
227                         Knabben. All rights reserved.\r
228                 </p>\r
229         </div>\r
230 </body>\r
231 </html>\r