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 — 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 — 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 |
|
---|
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 | <form action="sample_posteddata.php" method="post">
|
---|
62 | <p>
|
---|
63 | <label for="editor1">
|
---|
64 | Editor 1:</label>
|
---|
65 | <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>
|
---|
66 | <script type="text/javascript">
|
---|
67 | //<![CDATA[
|
---|
68 |
|
---|
69 | // Replace the <textarea id="editor"> with an CKEditor
|
---|
70 | // instance, using the "bbcode" plugin, shaping some of the
|
---|
71 | // editor configuration to fit BBCode environment.
|
---|
72 | CKEDITOR.replace( 'editor1',
|
---|
73 | {
|
---|
74 | extraPlugins : 'bbcode',
|
---|
75 | // Remove unused plugins.
|
---|
76 | removePlugins : 'bidi,button,dialogadvtab,div,filebrowser,flash,format,forms,horizontalrule,iframe,indent,justify,liststyle,pagebreak,showborders,stylescombo,table,tabletools,templates',
|
---|
77 | // Width and height are not supported in the BBCode format, so object resizing is disabled.
|
---|
78 | disableObjectResizing : true,
|
---|
79 | // Define font sizes in percent values.
|
---|
80 | fontSize_sizes : "30/30%;50/50%;100/100%;120/120%;150/150%;200/200%;300/300%",
|
---|
81 | toolbar :
|
---|
82 | [
|
---|
83 | ['Source', '-', 'Save','NewPage','-','Undo','Redo'],
|
---|
84 | ['Find','Replace','-','SelectAll','RemoveFormat'],
|
---|
85 | ['Link', 'Unlink', 'Image', 'Smiley','SpecialChar'],
|
---|
86 | '/',
|
---|
87 | ['Bold', 'Italic','Underline'],
|
---|
88 | ['FontSize'],
|
---|
89 | ['TextColor'],
|
---|
90 | ['NumberedList','BulletedList','-','Blockquote'],
|
---|
91 | ['Maximize']
|
---|
92 | ],
|
---|
93 | // Strip CKEditor smileys to those commonly used in BBCode.
|
---|
94 | smiley_images :
|
---|
95 | [
|
---|
96 | 'regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','tounge_smile.gif',
|
---|
97 | 'embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angel_smile.gif','shades_smile.gif',
|
---|
98 | 'cry_smile.gif','kiss.gif'
|
---|
99 | ],
|
---|
100 | smiley_descriptions :
|
---|
101 | [
|
---|
102 | 'smiley', 'sad', 'wink', 'laugh', 'cheeky', 'blush', 'surprise',
|
---|
103 | 'indecision', 'angel', 'cool', 'crying', 'kiss'
|
---|
104 | ]
|
---|
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 © 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>
|
---|