stylesheetparser.html 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  4. For licensing, see LICENSE.md or http://ckeditor.com/license
  5. -->
  6. <html>
  7. <head>
  8. <meta charset="utf-8">
  9. <title>Using Stylesheet Parser Plugin &mdash; CKEditor Sample</title>
  10. <script src="../../../ckeditor.js"></script>
  11. <script src="../../../samples/sample.js"></script>
  12. <link rel="stylesheet" href="../../../samples/sample.css">
  13. <meta name="ckeditor-sample-required-plugins" content="stylescombo">
  14. <meta name="ckeditor-sample-name" content="Stylesheet Parser plugin">
  15. <meta name="ckeditor-sample-description" content="Using the Stylesheet Parser plugin to fill the Styles drop-down list based on the CSS classes available in the document stylesheet.">
  16. <meta name="ckeditor-sample-group" content="Plugins">
  17. </head>
  18. <body>
  19. <h1 class="samples">
  20. <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Using the Stylesheet Parser Plugin
  21. </h1>
  22. <div class="description">
  23. <p>
  24. This sample shows how to configure CKEditor instances to use the
  25. <strong>Stylesheet Parser</strong> (<code>stylesheetparser</code>) plugin that fills
  26. the <strong>Styles</strong> drop-down list based on the CSS rules available in the document stylesheet.
  27. </p>
  28. <p>
  29. To add a CKEditor instance using the <code>stylesheetparser</code> plugin, insert
  30. the following JavaScript call into your code:
  31. </p>
  32. <pre class="samples">
  33. CKEDITOR.replace( '<em>textarea_id</em>', {
  34. <strong>extraPlugins: 'stylesheetparser'</strong>
  35. });</pre>
  36. <p>
  37. Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
  38. the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
  39. </p>
  40. </div>
  41. <form action="../../../samples/sample_posteddata.php" method="post">
  42. <p>
  43. <label for="editor1">
  44. CKEditor using the <code>stylesheetparser</code> plugin with its default configuration:
  45. </label>
  46. <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>
  47. <script>
  48. // This call can be placed at any point after the
  49. // <textarea>, or inside a <head><script> in a
  50. // window.onload event handler.
  51. // Replace the <textarea id="editor"> with an CKEditor
  52. // instance, using default configurations.
  53. CKEDITOR.replace( 'editor1' , {
  54. extraPlugins: 'stylesheetparser',
  55. // Stylesheet for the contents.
  56. contentsCss: 'assets/sample.css',
  57. // Do not load the default Styles configuration.
  58. stylesSet: []
  59. });
  60. </script>
  61. </p>
  62. <p>
  63. <input type="submit" value="Submit">
  64. </p>
  65. </form>
  66. <div id="footer">
  67. <hr>
  68. <p>
  69. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  70. </p>
  71. <p id="copy">
  72. Copyright &copy; 2003-2015, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  73. Knabben. All rights reserved.
  74. </p>
  75. </div>
  76. </body>
  77. </html>