placeholder.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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>Placeholder 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-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. </head>
  17. <body>
  18. <h1 class="samples">
  19. <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; Using the Placeholder Plugin
  20. </h1>
  21. <div class="description">
  22. <p>
  23. This sample shows how to configure CKEditor instances to use the
  24. <strong>Placeholder</strong> plugin that lets you insert read-only elements
  25. into your content. To enter and modify read-only text, use the
  26. <strong>Create Placeholder</strong> <span class="button_icon" data-icon="placeholder">&nbsp;</span> button and its matching dialog window.
  27. </p>
  28. <p>
  29. To add a CKEditor instance that uses the <code>placeholder</code> plugin and a related
  30. <strong>Create Placeholder</strong> <span class="button_icon" data-icon="placeholder">&nbsp;</span> toolbar button, insert the following JavaScript
  31. call to your code:
  32. </p>
  33. <pre class="samples">
  34. CKEDITOR.replace( '<em>textarea_id</em>', {
  35. <strong>extraPlugins: 'placeholder',</strong>
  36. toolbar: [ [ 'Source', 'Bold' ], [<strong>'CreatePlaceholder'</strong>] ]
  37. });</pre>
  38. <p>
  39. Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
  40. the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor.
  41. </p>
  42. </div>
  43. <form action="../../../samples/sample_posteddata.php" method="post">
  44. <p>
  45. <label for="editor1">
  46. CKEditor using the <code>placeholder</code> plugin with its default configuration:
  47. </label>
  48. <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is a [[sample placeholder]]. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;. &lt;/p&gt;</textarea>
  49. <script>
  50. CKEDITOR.replace( 'editor1', {
  51. extraPlugins: 'placeholder'
  52. });
  53. </script>
  54. </p>
  55. <p>
  56. <input type="submit" value="Submit">
  57. </p>
  58. </form>
  59. <div id="footer">
  60. <hr>
  61. <p>
  62. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  63. </p>
  64. <p id="copy">
  65. Copyright &copy; 2003-2015, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  66. Knabben. All rights reserved.
  67. </p>
  68. </div>
  69. </body>
  70. </html>