placeholder.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright (c) 2003-2022, CKSource Holding sp. z o.o. 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>Placeholder 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-name" content="Placeholder plugin">
  14. <meta name="ckeditor-sample-group" content="Plugins">
  15. <meta name="ckeditor-sample-description" content="Using the Placeholder plugin to create uneditable sections that can only be created and modified with a proper dialog window.">
  16. <meta name="description" content="Try the latest sample of CKEditor 4 and learn more about customizing your WYSIWYG editor with endless possibilities.">
  17. </head>
  18. <body>
  19. <h1 class="samples">
  20. <a href="../../../samples/old/index.html">CKEditor Samples</a> &raquo; Using the Placeholder Plugin
  21. </h1>
  22. <div class="warning deprecated">
  23. This sample is not maintained anymore. Check out its <a href="https://ckeditor.com/docs/ckeditor4/latest/examples/placeholder.html">brand new version in CKEditor Examples</a>.
  24. </div>
  25. <div class="description">
  26. <p>
  27. This sample shows how to configure CKEditor instances to use the
  28. <strong>Placeholder</strong> plugin that lets you insert read-only elements
  29. into your content. To enter and modify read-only text, use the
  30. <strong>Create Placeholder</strong> <span class="button_icon" data-icon="placeholder">&nbsp;</span> button and its matching dialog window.
  31. </p>
  32. <p>
  33. To add a CKEditor instance that uses the <code>placeholder</code> plugin and a related
  34. <strong>Create Placeholder</strong> <span class="button_icon" data-icon="placeholder">&nbsp;</span> toolbar button, insert the following JavaScript
  35. call to your code:
  36. </p>
  37. <pre class="samples">
  38. CKEDITOR.replace( '<em>textarea_id</em>', {
  39. <strong>extraPlugins: 'placeholder',</strong>
  40. toolbar: [ [ 'Source', 'Bold' ], [<strong>'CreatePlaceholder'</strong>] ]
  41. });</pre>
  42. <p>
  43. Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
  44. the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
  45. </p>
  46. </div>
  47. <form action="../../../samples/sample_posteddata.php" method="post">
  48. <p>
  49. <label for="editor1">
  50. CKEditor using the <code>placeholder</code> plugin with its default configuration:
  51. </label>
  52. <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is a [[sample placeholder]]. You are using &lt;a href="https://ckeditor.com/"&gt;CKEditor&lt;/a&gt;. &lt;/p&gt;</textarea>
  53. <script>
  54. CKEDITOR.replace( 'editor1', {
  55. extraPlugins: 'placeholder'
  56. });
  57. </script>
  58. </p>
  59. <p>
  60. <input type="submit" value="Submit">
  61. </p>
  62. </form>
  63. <div id="footer">
  64. <hr>
  65. <p>
  66. CKEditor - The text editor for the Internet - <a class="samples" href="https://ckeditor.com/">https://ckeditor.com</a>
  67. </p>
  68. <p id="copy">
  69. Copyright &copy; 2003-2022, <a class="samples" href="https://cksource.com/">CKSource</a> Holding sp. z o.o. All rights reserved.
  70. </p>
  71. </div>
  72. </body>
  73. </html>