1 ********************************************************************
2 D R U P A L M O D U L E
3 ********************************************************************
6 Maintainers: Theodore Serbinski <stanson AT gmail DOT com> and
7 Matt Westgate <drupal AT asitis DOT org> and
8 Jeff Robbins <robbins AT jjeff DOT com>
9 Richard Bennett <richard.b AT gritechnologies DOT com>
14 This module requires the third-party TinyMCE editor and a
15 Javascript-enabled web browser. Currently it is known to work
16 with Internet Explorer, Mozilla and Firefox and degrade gracefully
17 for Safari and Konqueror users. A browser compatibility chart is here:
19 http://tinymce.moxiecode.com/tinymce/docs/compatiblity_chart.html
23 ********************************************************************
25 NOTE: During this installation process you'll be asked to also
26 install the official TinyMCE package from
27 tinymce.moxiecode.com.
30 1. Place the entire tinymce directory into your Drupal modules/
34 2. Download TinyMCE 2.0 from
36 http://tinymce.moxiecode.com/
38 Remember to uncompress the file and make sure the folder is named
42 3. Place the entire 'tinymce' engine folder inside your modules/tinymce
43 directory. So the TinyMCE engine will live in modules/tinymce/tinymce
46 4. Enable this module by navigating to:
50 *note - all database tables will be automatically created during this step
53 5. Setup role based tinymce profiles via
55 administer > settings > tinymce
58 6. To boost the performance of TinyMCE, download the "TinyMCE compressor" from:
60 http://tinymce.moxiecode.com/download.php
62 Place the tiny_mce_gzip.php file in
64 modules/tinymce/tinymce/jscripts/tiny_mce
67 7. To use AJAX spell checking, download the spellchecker plugin:
68 (note: this requires TinyMCE 2.0.6+)
70 http://tinymce.moxiecode.com/download.php
74 modules/tinymce/tinymce/jscripts/tiny_mce/plugins/
76 Then edit config.php in plugins/spellchecker/:
78 Uncomment this line and comment out all other require_once's:
80 require_once("classes/TinyGoogleSpell.class.php"); // Google web service
84 $spellCheckerConfig['enabled'] = true;
86 Enable spellchecker in TinyMCE settings page, under "buttons and plugins"
90 Create new content as a role that has TinyMCE permissions and see TinyMCE in
95 ********************************************************************
96 Once TinyMCE is enabled, the default behavior is that all textareas
97 will use TinyMCE for all users. The admin can change these defaults
100 administer > settings > tinymce
102 The admin can choose what theme TinyMCE should be the default and
103 user's can override this by editing their account (if they've been
104 given permissions to do so). User's also have the option of disabling
107 The admin can also define which pages TinyMCE should be used on.
108 This cannot be changed on a per user basis.
112 ********************************************************************
113 Adding plugins to TinyMCE is very easy. By default, all TinyMCE
114 plugins are disabled, but can easily be enabled by going to:
116 Administer > settings > tinymce
118 And then editing a profile (make sure you create one first!) and going
119 to the Buttons & Plugins section. To enable a button or a plugin,
120 simply check a box and TinyMCE will automatically be updated. To find
121 out more info on what a specific button or plugin does, click the
122 corresponding link (note not all buttons have help text).
124 If you wish to add more plugins to TinyMCE, simply extract these
125 plugins to the folder: tinymce\jscripts\tiny_mce\plugins
127 Then open up plugin_reg.php, found in the TinyMCE module folder.
129 Add the following lines:
131 $plugins['plugin_name'] = array();
132 $plugins['plugin_name']['theme_advanced_buttons3'] = array('icon_name');
133 // note, you can choose which row of buttons to use by changing
134 // the 3 to either 1 or 2
135 $plugins['plugin_name']['plugin_property'] = array('property_value');
137 Be sure to set the 'plugin_name' to the name of the plugin (generally
138 the plugin folder name) and set the 'icon_name' and other properties
139 (properties are optional). See plugin_reg.php for more examples.
141 To add Drupal specific plugins, TinyMCE comes bundled with plugins
142 in the main module directory. These plugins include:
144 - drupalimage: works in conjunction with the img_assist Drupal
147 NOTE: If you want to use img_assist with TinyMCE, you don't have to
148 install a plugin. Just enable the img_assist module and click
149 the photo icon that appears below each textarea.
151 Follow the directions in the README.txt for these plugins to enable them.
155 ********************************************************************
156 By default, Drupal uses the 'Filtered HTML' input format for adding
157 content to the site and this can create conflicts with TinyMCE. It's
158 best when using this editor to use an input format that has all
159 filters disabled. What I usually do is create an input format called
160 'Rich-text editing' and set that as the default format for roles which
161 use TinyMCE exclusively. To modify your input formats go to:
163 Administer > input formats > configure > configure filters
166 TWEAKING THE TINYMCE THEME
167 ********************************************************************
169 Developers have complete control over when and how tinymce is enabled
170 for each textarea inside Drupal by creating a custom Drupal theme
171 function. The following example assumes you're using a phptemplate based theme.
173 Put the following function in your themes template.php file:
176 * Customize a TinyMCE theme.
179 * An array of settings TinyMCE should invoke a theme. You may override any
180 * of the TinyMCE settings. Details here:
182 * http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
184 * @param textarea_name
185 * The name of the textarea TinyMCE wants to enable.
188 * The default tinymce theme name to be enabled for this textarea. The
189 * sitewide default is 'simple', but the user may also override this.
192 * A boolean flag that identifies id TinyMCE is currently running for this
193 * request life cycle. It can be ignored.
195 function theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
196 switch ($textarea_name) {
197 // Disable tinymce for these textareas
198 case 'log': // book and page log
199 case 'img_assist_pages':
200 case 'caption': // signature
202 case 'access_pages': //TinyMCE profile settings.
203 case 'user_mail_welcome_body': // user config settings
204 case 'user_mail_approval_body': // user config settings
205 case 'user_mail_pass_body': // user config settings
206 case 'synonyms': // taxonomy terms
207 case 'description': // taxonomy terms
211 // Force the 'simple' theme for some of the smaller textareas.
215 case 'site_offline_message':
217 case 'user_registration_help':
218 case 'user_picture_guidelines':
219 $init['theme'] = 'simple';
220 foreach ($init as $k => $v) {
221 if (strstr($k, 'theme_advanced_')) unset($init[$k]);
226 /* Example, add some extra features when using the advanced theme.
228 // If $init is available, we can extend it
230 switch ($theme_name) {
232 $init['extended_valid_elements'] = array('a[href|target|name|title|onclick]');
239 // Always return $init
243 If you study the above function you can see that tinymce can be completely
244 disabled or you can even switch themes for a given textarea.
246 See the TinyMCE manual for details on the parameters that can be
249 http://tinymce.moxiecode.com/documentation.php
252 TINYMCE KEYBOARD SHORTCUTS
253 ********************************************************************