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