jqueryadapter.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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>jQuery Adapter &mdash; CKEditor Sample</title>
  9. <meta content="text/html; charset=utf-8" http-equiv="content-type" />
  10. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
  11. <script type="text/javascript" src="../ckeditor.js"></script>
  12. <script type="text/javascript" src="../adapters/jquery.js"></script>
  13. <script src="sample.js" type="text/javascript"></script>
  14. <link href="sample.css" rel="stylesheet" type="text/css" />
  15. <script type="text/javascript">
  16. //<![CDATA[
  17. $(function()
  18. {
  19. var config = {
  20. toolbar:
  21. [
  22. ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink'],
  23. ['UIColor']
  24. ]
  25. };
  26. // Initialize the editor.
  27. // Callback function can be passed and executed after full instance creation.
  28. $('.jquery_ckeditor').ckeditor(config);
  29. });
  30. //]]>
  31. </script>
  32. </head>
  33. <body>
  34. <h1 class="samples">
  35. CKEditor Sample &mdash; Using jQuery Adapter
  36. </h1>
  37. <div class="description">
  38. <p>
  39. This sample shows how to load CKEditor and configure it using the
  40. <a class="samples" href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/jQuery_Adapter">jQuery adapter</a>.
  41. In this case the jQuery adapter is responsible for transforming a <code>&lt;textarea&gt;</code>
  42. element into a CKEditor instance and setting the configuration of the toolbar.
  43. </p>
  44. <p>
  45. CKEditor instance with custom configuration set in jQuery can be inserted with the
  46. following JavaScript code:
  47. </p>
  48. <pre class="samples">$(function()
  49. {
  50. var config = {
  51. skin:'v2'
  52. };
  53. $('.<em>textarea_class</em>').ckeditor(config);
  54. });</pre>
  55. <p>
  56. Note that <code><em>textarea_class</em></code> in the code above is the
  57. <code>class</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced with
  58. CKEditor. Any other jQuery selector can be used to match the target element.
  59. </p>
  60. </div>
  61. <!-- This <div> holds alert messages to be display in the sample page. -->
  62. <div id="alerts">
  63. <noscript>
  64. <p>
  65. <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
  66. support, like yours, you should still see the contents (HTML data) and you should
  67. be able to edit it normally, without a rich editor interface.
  68. </p>
  69. </noscript>
  70. </div>
  71. <!-- This <fieldset> holds the HTML that you will usually find in your
  72. pages. -->
  73. <form action="sample_posteddata.php" method="post">
  74. <p>
  75. <label for="editor1">
  76. Editor 1:</label>
  77. <textarea class="jquery_ckeditor" 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>
  78. </p>
  79. <p>
  80. <input type="submit" value="Submit" />
  81. </p>
  82. </form>
  83. <div id="footer">
  84. <hr />
  85. <p>
  86. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  87. </p>
  88. <p id="copy">
  89. Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  90. Knabben. All rights reserved.
  91. </p>
  92. </div>
  93. </body>
  94. </html>