3 Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
\r
4 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
8 <title>XHTML Compliant Output — 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
16 <h1 class="samples">
\r
17 <a href="index.html">CKEditor Samples</a> » Producing XHTML Compliant Output
\r
19 <div class="description">
\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><font></code>, <code><u></code>) or attributes
\r
24 (<code>size</code>, <code>face</code>) will be replaced with XHTML compliant code.
\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
31 A snippet of the configuration code can be seen below; check the source of this page for
\r
34 <pre class="samples">
\r
35 CKEDITOR.replace( '<em>textarea_id</em>', {
\r
36 contentsCss: 'assets/outputxhtml.css',
\r
40 attributes: { 'class': 'Bold' }
\r
42 coreStyles_italic: {
\r
44 attributes: { 'class': 'Italic' }
\r
50 <form action="sample_posteddata.php" method="post">
\r
52 <label for="editor1">
\r
55 <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
58 CKEDITOR.replace( 'editor1', {
\r
60 * Style sheet for the contents
\r
62 contentsCss: 'assets/outputxhtml/outputxhtml.css',
\r
65 * Special allowed content rules for spans used by
\r
66 * font face, size, and color buttons.
\r
68 * Note: all rules have been written separately so
\r
69 * it was possible to specify required classes.
\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
81 attributes: { 'class': 'Bold' }
\r
83 coreStyles_italic: {
\r
85 attributes: { 'class': 'Italic' }
\r
87 coreStyles_underline: {
\r
89 attributes: { 'class': 'Underline' }
\r
91 coreStyles_strike: {
\r
93 attributes: { 'class': 'StrikeThrough' },
\r
96 coreStyles_subscript: {
\r
98 attributes: { 'class': 'Subscript' },
\r
101 coreStyles_superscript: {
\r
103 attributes: { 'class': 'Superscript' },
\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
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
124 attributes: { 'class': '#(family)' },
\r
129 'class': /^Font(?:Comic|Courier|Times)$/
\r
138 fontSize_sizes: 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',
\r
141 attributes: { 'class': '#(size)' },
\r
146 'class': /^Font(?:Smaller|Larger|Small|Big|Double)$/
\r
155 colorButton_enableMore: false,
\r
157 colorButton_colors: 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',
\r
158 colorButton_foreStyle: {
\r
160 attributes: { 'class': '#(color)' },
\r
165 'class': /^FontColor(?:1|2|3)$/
\r
171 colorButton_backStyle: {
\r
173 attributes: { 'class': '#(color)BG' },
\r
178 'class': /^FontColor(?:1|2|3)BG$/
\r
187 indentClasses: [ 'Indent1', 'Indent2', 'Indent3' ],
\r
190 * Paragraph justification.
\r
192 justifyClasses: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],
\r
198 { name: 'Strong Emphasis', element: 'strong' },
\r
199 { name: 'Emphasis', element: 'em' },
\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
206 { name: 'Deleted Text', element: 'del' },
\r
207 { name: 'Inserted Text', element: 'ins' },
\r
209 { name: 'Cited Work', element: 'cite' },
\r
210 { name: 'Inline Quotation', element: 'q' }
\r
217 <input type="submit" value="Submit">
\r
223 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
\r
226 Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
\r
227 Knabben. All rights reserved.
\r