bbcode.html 4.6 KB

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