stylesheetparser.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright (c) 2003-2016, 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/old/sample.js"></script>
  12. <link rel="stylesheet" href="../../../samples/old/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/old/index.html">CKEditor Samples</a> &raquo; Using the Stylesheet Parser Plugin
  21. </h1>
  22. <div class="warning deprecated">
  23. This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/styles.html">brand new version in CKEditor SDK</a>.
  24. </div>
  25. <div class="description">
  26. <p>
  27. This sample shows how to configure CKEditor instances to use the
  28. <strong>Stylesheet Parser</strong> (<code>stylesheetparser</code>) plugin that fills
  29. the <strong>Styles</strong> drop-down list based on the CSS rules available in the document stylesheet.
  30. </p>
  31. <p>
  32. To add a CKEditor instance using the <code>stylesheetparser</code> plugin, insert
  33. the following JavaScript call into your code:
  34. </p>
  35. <pre class="samples">
  36. CKEDITOR.replace( '<em>textarea_id</em>', {
  37. <strong>extraPlugins: 'stylesheetparser'</strong>
  38. });</pre>
  39. <p>
  40. Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
  41. the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
  42. </p>
  43. </div>
  44. <form action="../../../samples/sample_posteddata.php" method="post">
  45. <p>
  46. <label for="editor1">
  47. CKEditor using the <code>stylesheetparser</code> plugin with its default configuration:
  48. </label>
  49. <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>
  50. <script>
  51. // This call can be placed at any point after the
  52. // <textarea>, or inside a <head><script> in a
  53. // window.onload event handler.
  54. // Replace the <textarea id="editor"> with an CKEditor
  55. // instance, using default configurations.
  56. CKEDITOR.replace( 'editor1' , {
  57. extraPlugins: 'stylesheetparser',
  58. // Stylesheet for the contents.
  59. contentsCss: 'assets/sample.css',
  60. // Do not load the default Styles configuration.
  61. stylesSet: []
  62. });
  63. </script>
  64. </p>
  65. <p>
  66. <input type="submit" value="Submit">
  67. </p>
  68. </form>
  69. <div id="footer">
  70. <hr>
  71. <p>
  72. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  73. </p>
  74. <p id="copy">
  75. Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  76. Knabben. All rights reserved.
  77. </p>
  78. </div>
  79. </body>
  80. </html>