stylesheetparser.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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>Using Stylesheet Parser Plugin &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; Using the Stylesheet Parser Plugin
  17. </h1>
  18. <div class="description">
  19. <p>
  20. This sample shows how to configure CKEditor instances to use the
  21. <strong>Stylesheet Parser</strong> (<code>stylesheetparser</code>) plugin that fills
  22. the <strong>Styles</strong> drop-down list based on the CSS rules available in the document stylesheet.
  23. </p>
  24. <p>
  25. To add a CKEditor instance using the <code>stylesheetparser</code> plugin, insert
  26. the following JavaScript call into your code:
  27. </p>
  28. <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
  29. {
  30. <strong>extraPlugins : 'stylesheetparser'</strong>
  31. });</pre>
  32. <p>
  33. Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
  34. the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
  35. </p>
  36. </div>
  37. <!-- This <div> holds alert messages to be display in the sample page. -->
  38. <div id="alerts">
  39. <noscript>
  40. <p>
  41. <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
  42. support, like yours, you should still see the contents (HTML data) and you should
  43. be able to edit it normally, without a rich editor interface.
  44. </p>
  45. </noscript>
  46. </div>
  47. <form action="sample_posteddata.php" method="post">
  48. <p>
  49. <label for="editor1">
  50. CKEditor using the <code>stylesheetparser</code> plugin with its default configuration:</label>
  51. <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
  52. <script type="text/javascript">
  53. //<![CDATA[
  54. // This call can be placed at any point after the
  55. // <textarea>, or inside a <head><script> in a
  56. // window.onload event handler.
  57. // Replace the <textarea id="editor"> with an CKEditor
  58. // instance, using default configurations.
  59. CKEDITOR.replace( 'editor1' ,
  60. {
  61. extraPlugins : 'stylesheetparser',
  62. /*
  63. * Stylesheet for the contents.
  64. */
  65. contentsCss : 'assets/parsesample.css',
  66. /*
  67. * Do not load the default Styles configuration.
  68. */
  69. stylesSet : []
  70. });
  71. //]]>
  72. </script>
  73. </p>
  74. <p>
  75. <input type="submit" value="Submit" />
  76. </p>
  77. </form>
  78. <div id="footer">
  79. <hr />
  80. <p>
  81. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  82. </p>
  83. <p id="copy">
  84. Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  85. Knabben. All rights reserved.
  86. </p>
  87. </div>
  88. </body>
  89. </html>