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