3 Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
\r
4 For licensing, see LICENSE.md or http://ckeditor.com/license
\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
16 <h1 class="samples">
\r
17 <a href="index.html">CKEditor Samples</a> » Producing XHTML Compliant Output
\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
22 <div class="description">
\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
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
34 A snippet of the configuration code can be seen below; check the source of this page for
\r
37 <pre class="samples">
\r
38 CKEDITOR.replace( '<em>textarea_id</em>', {
\r
39 contentsCss: 'assets/outputxhtml.css',
\r
43 attributes: { 'class': 'Bold' }
\r
45 coreStyles_italic: {
\r
47 attributes: { 'class': 'Italic' }
\r
53 <form action="sample_posteddata.php" method="post">
\r
55 <label for="editor1">
\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
61 CKEDITOR.replace( 'editor1', {
\r
63 * Style sheet for the contents
\r
65 contentsCss: 'assets/outputxhtml/outputxhtml.css',
\r
68 * Special allowed content rules for spans used by
\r
69 * font face, size, and color buttons.
\r
71 * Note: all rules have been written separately so
\r
72 * it was possible to specify required classes.
\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
84 attributes: { 'class': 'Bold' }
\r
86 coreStyles_italic: {
\r
88 attributes: { 'class': 'Italic' }
\r
90 coreStyles_underline: {
\r
92 attributes: { 'class': 'Underline' }
\r
94 coreStyles_strike: {
\r
96 attributes: { 'class': 'StrikeThrough' },
\r
99 coreStyles_subscript: {
\r
101 attributes: { 'class': 'Subscript' },
\r
104 coreStyles_superscript: {
\r
106 attributes: { 'class': 'Superscript' },
\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
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
127 attributes: { 'class': '#(family)' },
\r
132 'class': /^Font(?:Comic|Courier|Times)$/
\r
141 fontSize_sizes: 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',
\r
144 attributes: { 'class': '#(size)' },
\r
149 'class': /^Font(?:Smaller|Larger|Small|Big|Double)$/
\r
158 colorButton_enableMore: false,
\r
160 colorButton_colors: 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',
\r
161 colorButton_foreStyle: {
\r
163 attributes: { 'class': '#(color)' },
\r
168 'class': /^FontColor(?:1|2|3)$/
\r
174 colorButton_backStyle: {
\r
176 attributes: { 'class': '#(color)BG' },
\r
181 'class': /^FontColor(?:1|2|3)BG$/
\r
190 indentClasses: [ 'Indent1', 'Indent2', 'Indent3' ],
\r
193 * Paragraph justification.
\r
195 justifyClasses: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],
\r
201 { name: 'Strong Emphasis', element: 'strong' },
\r
202 { name: 'Emphasis', element: 'em' },
\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
209 { name: 'Deleted Text', element: 'del' },
\r
210 { name: 'Inserted Text', element: 'ins' },
\r
212 { name: 'Cited Work', element: 'cite' },
\r
213 { name: 'Inline Quotation', element: 'q' }
\r
220 <input type="submit" value="Submit">
\r
226 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
\r
229 Copyright © 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
\r
230 Knabben. All rights reserved.
\r