国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stylesheetparser.html 3.5KB

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