output_xhtml.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 &mdash; 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 &mdash; 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>&lt;font&gt;</code>, <code>&lt;u&gt;</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. coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },
  37. coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'} },
  38. // More definitions follow.
  39. });</pre>
  40. </div>
  41. <!-- This <div> holds alert messages to be display in the sample page. -->
  42. <div id="alerts">
  43. <noscript>
  44. <p>
  45. <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
  46. support, like yours, you should still see the contents (HTML data) and you should
  47. be able to edit it normally, without a rich editor interface.
  48. </p>
  49. </noscript>
  50. </div>
  51. <form action="sample_posteddata.php" method="post">
  52. <p>
  53. <label for="editor1">
  54. Editor 1:</label>
  55. <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>
  56. <script type="text/javascript">
  57. //<![CDATA[
  58. CKEDITOR.replace( 'editor1',
  59. {
  60. /*
  61. * Style sheet for the contents
  62. */
  63. contentsCss : 'assets/output_xhtml.css',
  64. /*
  65. * Core styles.
  66. */
  67. coreStyles_bold : { element : 'span', attributes : {'class': 'Bold'} },
  68. coreStyles_italic : { element : 'span', attributes : {'class': 'Italic'}},
  69. coreStyles_underline : { element : 'span', attributes : {'class': 'Underline'}},
  70. coreStyles_strike : { element : 'span', attributes : {'class': 'StrikeThrough'}, overrides : 'strike' },
  71. coreStyles_subscript : { element : 'span', attributes : {'class': 'Subscript'}, overrides : 'sub' },
  72. coreStyles_superscript : { element : 'span', attributes : {'class': 'Superscript'}, overrides : 'sup' },
  73. /*
  74. * Font face
  75. */
  76. // List of fonts available in the toolbar combo. Each font definition is
  77. // separated by a semi-colon (;). We are using class names here, so each font
  78. // is defined by {Combo Label}/{Class Name}.
  79. font_names : 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes',
  80. // Define the way font elements will be applied to the document. The "span"
  81. // element will be used. When a font is selected, the font name defined in the
  82. // above list is passed to this definition with the name "Font", being it
  83. // injected in the "class" attribute.
  84. // We must also instruct the editor to replace span elements that are used to
  85. // set the font (Overrides).
  86. font_style :
  87. {
  88. element : 'span',
  89. attributes : { 'class' : '#(family)' }
  90. },
  91. /*
  92. * Font sizes.
  93. */
  94. fontSize_sizes : 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',
  95. fontSize_style :
  96. {
  97. element : 'span',
  98. attributes : { 'class' : '#(size)' }
  99. } ,
  100. /*
  101. * Font colors.
  102. */
  103. colorButton_enableMore : false,
  104. colorButton_colors : 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',
  105. colorButton_foreStyle :
  106. {
  107. element : 'span',
  108. attributes : { 'class' : '#(color)' }
  109. },
  110. colorButton_backStyle :
  111. {
  112. element : 'span',
  113. attributes : { 'class' : '#(color)BG' }
  114. },
  115. /*
  116. * Indentation.
  117. */
  118. indentClasses : ['Indent1', 'Indent2', 'Indent3'],
  119. /*
  120. * Paragraph justification.
  121. */
  122. justifyClasses : [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],
  123. /*
  124. * Styles combo.
  125. */
  126. stylesSet :
  127. [
  128. { name : 'Strong Emphasis', element : 'strong' },
  129. { name : 'Emphasis', element : 'em' },
  130. { name : 'Computer Code', element : 'code' },
  131. { name : 'Keyboard Phrase', element : 'kbd' },
  132. { name : 'Sample Text', element : 'samp' },
  133. { name : 'Variable', element : 'var' },
  134. { name : 'Deleted Text', element : 'del' },
  135. { name : 'Inserted Text', element : 'ins' },
  136. { name : 'Cited Work', element : 'cite' },
  137. { name : 'Inline Quotation', element : 'q' }
  138. ]
  139. });
  140. //]]>
  141. </script>
  142. </p>
  143. <p>
  144. <input type="submit" value="Submit" />
  145. </p>
  146. </form>
  147. <div id="footer">
  148. <hr />
  149. <p>
  150. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  151. </p>
  152. <p id="copy">
  153. Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  154. Knabben. All rights reserved.
  155. </p>
  156. </div>
  157. </body>
  158. </html>