JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _samples / output_xhtml.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
2 <!--\r
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
4 For licensing, see LICENSE.html or http://ckeditor.com/license\r
5 -->\r
6 <html xmlns="http://www.w3.org/1999/xhtml">\r
7 <head>\r
8         <title>XHTML Compliant Output &mdash; CKEditor Sample</title>\r
9         <meta content="text/html; charset=utf-8" http-equiv="content-type" />\r
10         <script type="text/javascript" src="../ckeditor.js"></script>\r
11         <script src="sample.js" type="text/javascript"></script>\r
12         <link href="sample.css" rel="stylesheet" type="text/css" />\r
13 </head>\r
14 <body>\r
15         <h1 class="samples">\r
16                 CKEditor Sample &mdash; Producing XHTML Compliant Output\r
17         </h1>\r
18         <div class="description">\r
19         <p>\r
20                 This sample shows how to configure CKEditor to output valid\r
21                 <a class="samples" href="http://www.w3.org/TR/xhtml11/">XHTML 1.1</a> code.\r
22                 Deprecated elements (<code>&lt;font&gt;</code>, <code>&lt;u&gt;</code>) or attributes\r
23                 (<code>size</code>, <code>face</code>) will be replaced with XHTML compliant code.\r
24         </p>\r
25         <p>\r
26                 To add a CKEditor instance outputting valid XHTML code, load the editor using a standard\r
27                 JavaScript call and define CKEditor features to use the XHTML compliant elements and styles.\r
28         </p>\r
29         <p>\r
30                 A snippet of the configuration code can be seen below; check the source of this page for\r
31                 full definition:\r
32         </p>\r
33         <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',\r
34         {\r
35                 contentsCss : 'assets/output_xhtml.css',\r
36 \r
37                 coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },\r
38                 coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'} },\r
39 \r
40                 // More definitions follow.\r
41         });</pre>\r
42         </div>\r
43 \r
44         <!-- This <div> holds alert messages to be display in the sample page. -->\r
45         <div id="alerts">\r
46                 <noscript>\r
47                         <p>\r
48                                 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript\r
49                                 support, like yours, you should still see the contents (HTML data) and you should\r
50                                 be able to edit it normally, without a rich editor interface.\r
51                         </p>\r
52                 </noscript>\r
53         </div>\r
54         <form action="sample_posteddata.php" method="post">\r
55                 <p>\r
56                         <label for="editor1">\r
57                                 Editor 1:</label>\r
58                         <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
59                         <script type="text/javascript">\r
60                         //<![CDATA[\r
61 \r
62                                 CKEDITOR.replace( 'editor1',\r
63                                         {\r
64                                                 /*\r
65                                                  * Style sheet for the contents\r
66                                                  */\r
67                                                 contentsCss : 'assets/output_xhtml.css',\r
68 \r
69                                                 /*\r
70                                                  * Core styles.\r
71                                                  */\r
72                                                 coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },\r
73                                                 coreStyles_italic       : { element : 'span', attributes : {'class': 'Italic'}},\r
74                                                 coreStyles_underline    : { element : 'span', attributes : {'class': 'Underline'}},\r
75                                                 coreStyles_strike       : { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' },\r
76 \r
77                                                 coreStyles_subscript : { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' },\r
78                                                 coreStyles_superscript : { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' },\r
79 \r
80                                                 /*\r
81                                                  * Font face\r
82                                                  */\r
83                                                 // List of fonts available in the toolbar combo. Each font definition is\r
84                                                 // separated by a semi-colon (;). We are using class names here, so each font\r
85                                                 // is defined by {Combo Label}/{Class Name}.\r
86                                                 font_names : 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes',\r
87 \r
88                                                 // Define the way font elements will be applied to the document. The "span"\r
89                                                 // element will be used. When a font is selected, the font name defined in the\r
90                                                 // above list is passed to this definition with the name "Font", being it\r
91                                                 // injected in the "class" attribute.\r
92                                                 // We must also instruct the editor to replace span elements that are used to\r
93                                                 // set the font (Overrides).\r
94                                                 font_style :\r
95                                                 {\r
96                                                                 element         : 'span',\r
97                                                                 attributes              : { 'class' : '#(family)' }\r
98                                                 },\r
99 \r
100                                                 /*\r
101                                                  * Font sizes.\r
102                                                  */\r
103                                                 fontSize_sizes : 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',\r
104                                                 fontSize_style :\r
105                                                         {\r
106                                                                 element         : 'span',\r
107                                                                 attributes      : { 'class' : '#(size)' }\r
108                                                         } ,\r
109 \r
110                                                 /*\r
111                                                  * Font colors.\r
112                                                  */\r
113                                                 colorButton_enableMore : false,\r
114 \r
115                                                 colorButton_colors : 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',\r
116                                                 colorButton_foreStyle :\r
117                                                         {\r
118                                                                 element : 'span',\r
119                                                                 attributes : { 'class' : '#(color)' }\r
120                                                         },\r
121 \r
122                                                 colorButton_backStyle :\r
123                                                         {\r
124                                                                 element : 'span',\r
125                                                                 attributes : { 'class' : '#(color)BG' }\r
126                                                         },\r
127 \r
128                                                 /*\r
129                                                  * Indentation.\r
130                                                  */\r
131                                                 indentClasses : ['Indent1', 'Indent2', 'Indent3'],\r
132 \r
133                                                 /*\r
134                                                  * Paragraph justification.\r
135                                                  */\r
136                                                 justifyClasses : [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],\r
137 \r
138                                                 /*\r
139                                                  * Styles combo.\r
140                                                  */\r
141                                                 stylesSet :\r
142                                                                 [\r
143                                                                         { name : 'Strong Emphasis', element : 'strong' },\r
144                                                                         { name : 'Emphasis', element : 'em' },\r
145 \r
146                                                                         { name : 'Computer Code', element : 'code' },\r
147                                                                         { name : 'Keyboard Phrase', element : 'kbd' },\r
148                                                                         { name : 'Sample Text', element : 'samp' },\r
149                                                                         { name : 'Variable', element : 'var' },\r
150 \r
151                                                                         { name : 'Deleted Text', element : 'del' },\r
152                                                                         { name : 'Inserted Text', element : 'ins' },\r
153 \r
154                                                                         { name : 'Cited Work', element : 'cite' },\r
155                                                                         { name : 'Inline Quotation', element : 'q' }\r
156                                                                 ]\r
157 \r
158                                         });\r
159                         //]]>\r
160                         </script>\r
161                 </p>\r
162                 <p>\r
163                         <input type="submit" value="Submit" />\r
164                 </p>\r
165         </form>\r
166         <div id="footer">\r
167                 <hr />\r
168                 <p>\r
169                         CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
170                 </p>\r
171                 <p id="copy">\r
172                         Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
173                         Knabben. All rights reserved.\r
174                 </p>\r
175         </div>\r
176 </body>\r
177 </html>\r