bbcode.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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>BBCode Plugin &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; BBCode Plugin
  17. </h1>
  18. <div class="description">
  19. <p>
  20. This sample shows how to configure CKEditor to output <a href="http://en.wikipedia.org/wiki/BBCode">BBCode</a> format instead of HTML.
  21. Please note that the editor configuration was modified to reflect what is needed in a BBCode editing environment.
  22. Smiley images, for example, were stripped to the emoticons that are commonly used in some BBCode dialects.
  23. </p>
  24. <p>
  25. Please note that currently there is no standard for the BBCode markup language, so its implementation
  26. for different platforms (message boards, blogs etc.) can vary. This means that before using CKEditor to
  27. output BBCode you may need to adjust the implementation to your own environment.
  28. </p>
  29. <p>
  30. A snippet of the configuration code can be seen below; check the source of this page for
  31. a full definition:
  32. </p>
  33. <pre class="samples">
  34. CKEDITOR.replace( 'editor1',
  35. {
  36. <strong>extraPlugins : 'bbcode',</strong>
  37. toolbar :
  38. [
  39. ['Source', '-', 'Save','NewPage','-','Undo','Redo'],
  40. ['Find','Replace','-','SelectAll','RemoveFormat'],
  41. ['Link', 'Unlink', 'Image'],
  42. '/',
  43. ['FontSize', 'Bold', 'Italic','Underline'],
  44. ['NumberedList','BulletedList','-','Blockquote'],
  45. ['TextColor', '-', 'Smiley','SpecialChar', '-', 'Maximize']
  46. ],
  47. ... <i>some other configurations omitted here</i>
  48. }); </pre>
  49. </div>
  50. <!-- This <div> holds alert messages to be display in the sample page. -->
  51. <div id="alerts">
  52. <noscript>
  53. <p>
  54. <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
  55. support, like yours, you should still see the contents (HTML data) and you should
  56. be able to edit it normally, without a rich editor interface.
  57. </p>
  58. </noscript>
  59. </div>
  60. <form action="sample_posteddata.php" method="post">
  61. <p>
  62. <label for="editor1">
  63. Editor 1:</label>
  64. <textarea cols="80" id="editor1" name="editor1" rows="10">This is some [b]sample text[/b]. You are using [url=http://ckeditor.com/]CKEditor[/url].</textarea>
  65. <script type="text/javascript">
  66. //<![CDATA[
  67. // Replace the <textarea id="editor"> with an CKEditor
  68. // instance, using the "bbcode" plugin, shaping some of the
  69. // editor configuration to fit BBCode environment.
  70. CKEDITOR.replace( 'editor1',
  71. {
  72. extraPlugins : 'bbcode',
  73. // Remove unused plugins.
  74. removePlugins : 'bidi,button,dialogadvtab,div,filebrowser,flash,format,forms,horizontalrule,iframe,indent,justify,liststyle,pagebreak,showborders,stylescombo,table,tabletools,templates',
  75. // Width and height are not supported in the BBCode format, so object resizing is disabled.
  76. disableObjectResizing : true,
  77. // Define font sizes in percent values.
  78. fontSize_sizes : "30/30%;50/50%;100/100%;120/120%;150/150%;200/200%;300/300%",
  79. toolbar :
  80. [
  81. ['Source', '-', 'Save','NewPage','-','Undo','Redo'],
  82. ['Find','Replace','-','SelectAll','RemoveFormat'],
  83. ['Link', 'Unlink', 'Image', 'Smiley','SpecialChar'],
  84. '/',
  85. ['Bold', 'Italic','Underline'],
  86. ['FontSize'],
  87. ['TextColor'],
  88. ['NumberedList','BulletedList','-','Blockquote'],
  89. ['Maximize']
  90. ],
  91. // Strip CKEditor smileys to those commonly used in BBCode.
  92. smiley_images :
  93. [
  94. 'regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','tounge_smile.gif',
  95. 'embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angel_smile.gif','shades_smile.gif',
  96. 'cry_smile.gif','kiss.gif'
  97. ],
  98. smiley_descriptions :
  99. [
  100. 'smiley', 'sad', 'wink', 'laugh', 'cheeky', 'blush', 'surprise',
  101. 'indecision', 'angel', 'cool', 'crying', 'kiss'
  102. ]
  103. } );
  104. //]]>
  105. </script>
  106. </p>
  107. <p>
  108. <input type="submit" value="Submit" />
  109. </p>
  110. </form>
  111. <div id="footer">
  112. <hr />
  113. <p>
  114. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  115. </p>
  116. <p id="copy">
  117. Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  118. Knabben. All rights reserved.
  119. </p>
  120. </div>
  121. </body>
  122. </html>