ui_color.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <!--
  3. Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
  4. For licensing, see LICENSE.html or http://ckeditor.com/license
  5. -->
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <title>UI Color Picker &mdash; CKEditor Sample</title>
  9. <meta content="text/html; charset=utf-8" http-equiv="content-type" />
  10. <script type="text/javascript" src="../ckeditor.js"></script>
  11. <script src="sample.js" type="text/javascript"></script>
  12. <link href="sample.css" rel="stylesheet" type="text/css" />
  13. </head>
  14. <body>
  15. <h1 class="samples">
  16. CKEditor Sample &mdash; UI Color Picker
  17. </h1>
  18. <div class="description">
  19. <p>
  20. This sample shows how to automatically replace <code>&lt;textarea&gt;</code> elements
  21. with a CKEditor instance with an option to change the color of its user interface.
  22. </p>
  23. <h2 class="samples">Setting the User Interface Color</h2>
  24. <p>
  25. To specify the color of the user interface, set the <code>uiColor</code> property:
  26. </p>
  27. <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
  28. {
  29. <strong>uiColor: '#EE0000'</strong>
  30. });</pre>
  31. <p>
  32. Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
  33. the <code>&lt;textarea&gt;</code> element to be replaced.
  34. </p>
  35. <h2 class="samples">Enabling the Color Picker</h2>
  36. <p>
  37. If the <strong>uicolor</strong> plugin along with the dedicated <strong>UIColor</strong>
  38. toolbar button is added to CKEditor, the user will also be able to pick the color of the
  39. UI from the color palette available in the <strong>UI Color Picker</strong> dialog window.
  40. </p>
  41. <p>
  42. To insert a CKEditor instance with the <strong>uicolor</strong> plugin enabled,
  43. use the following JavaScript call:
  44. </p>
  45. <pre class="samples">CKEDITOR.replace( '<em>textarea_id</em>',
  46. {
  47. <strong>extraPlugins : 'uicolor',</strong>
  48. toolbar : [ [ 'Bold', 'Italic' ], [ <strong>'UIColor'</strong> ] ]
  49. });</pre>
  50. </div>
  51. <!-- This <div> holds alert messages to be display in the sample page. -->
  52. <div id="alerts">
  53. <noscript>
  54. <p>
  55. <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
  56. support, like yours, you should still see the contents (HTML data) and you should
  57. be able to edit it normally, without a rich editor interface.
  58. </p>
  59. </noscript>
  60. </div>
  61. <p>
  62. Click the <strong>UI Color Picker</strong> button to test your color preferences at runtime.
  63. </p>
  64. <p>
  65. The first editor instance includes the <strong>UI Color Picker</strong> toolbar button,
  66. but the default UI color is not defined, so the editor uses the skin color.
  67. </p>
  68. <form action="sample_posteddata.php" method="post">
  69. <p>
  70. <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>
  71. <script type="text/javascript">
  72. //<![CDATA[
  73. // Replace the <textarea id="editor"> with an CKEditor
  74. // instance, using default configurations.
  75. CKEDITOR.replace( 'editor1',
  76. {
  77. extraPlugins : 'uicolor',
  78. toolbar :
  79. [
  80. [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
  81. [ 'UIColor' ]
  82. ]
  83. });
  84. //]]>
  85. </script>
  86. </p>
  87. <p>
  88. The second editor instance includes the <strong>UI Color Picker</strong> toolbar button. The
  89. default UI color was defined, so the skin color is not used.
  90. </p>
  91. <p>
  92. <textarea cols="80" id="editor2" name="editor2" 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>
  93. <script type="text/javascript">
  94. //<![CDATA[
  95. // Replace the <textarea id="editor"> with an CKEditor
  96. // instance, using default configurations.
  97. CKEDITOR.replace( 'editor2',
  98. {
  99. extraPlugins : 'uicolor',
  100. uiColor: '#14B8C4',
  101. toolbar :
  102. [
  103. [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
  104. [ 'UIColor' ]
  105. ]
  106. } );
  107. //]]>
  108. </script>
  109. </p>
  110. <p>
  111. <input type="submit" value="Submit" />
  112. </p>
  113. </form>
  114. <div id="footer">
  115. <hr />
  116. <p>
  117. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  118. </p>
  119. <p id="copy">
  120. Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  121. Knabben. All rights reserved.
  122. </p>
  123. </div>
  124. </body>
  125. </html>