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>
10 Jonathan <suport@drupal DOT com>
15 This module requires the third-party TinyMCE editor and a
16 Javascript-enabled web browser. Currently it is known to work
17 with Internet Explorer, Mozilla and Firefox and degrade gracefully
18 for Safari and Konqueror users. A browser compatibility chart is here:
20 http://tinymce.moxiecode.com/tinymce/docs/compatiblity_chart.html
24 ********************************************************************
26 NOTE: During this installation process you'll be asked to also
27 install the official TinyMCE package from
28 tinymce.moxiecode.com.
31 1. Place the entire tinymce directory into your Drupal modules/
35 2. Download TinyMCE 2.0 from
37 http://tinymce.moxiecode.com/
39 Remember to uncompress the file and make sure the folder is named
43 3. Place the entire 'tinymce' engine folder inside your modules/tinymce
44 directory. So the TinyMCE engine will live in modules/tinymce/tinymce
47 4. Enable this module by navigating to:
51 *note - all database tables will be automatically created during this step
54 5. Setup role based tinymce profiles via
56 administer > settings > tinymce
59 6. To boost the performance of TinyMCE, download the "TinyMCE compressor" from:
61 http://tinymce.moxiecode.com/download.php
63 Place the tiny_mce_gzip.php file in
65 modules/tinymce/tinymce/jscripts/tiny_mce
68 7. To use AJAX spell checking, download the spellchecker plugin:
69 (note: this requires TinyMCE 2.0.6+)
71 http://tinymce.moxiecode.com/download.php
75 modules/tinymce/tinymce/jscripts/tiny_mce/plugins/
77 Then edit config.php in plugins/spellchecker/:
79 Uncomment this line and comment out all other require_once's:
81 require_once("classes/TinyGoogleSpell.class.php"); // Google web service
85 $spellCheckerConfig['enabled'] = true;
87 Enable spellchecker in TinyMCE settings page, under "buttons and plugins"
91 Create new content as a role that has TinyMCE permissions and see TinyMCE in
96 ********************************************************************
97 Once TinyMCE is enabled, the default behavior is that all textareas
98 will use TinyMCE for all users. The admin can change these defaults
101 administer > settings > tinymce
103 The admin can choose what theme TinyMCE should be the default and
104 user's can override this by editing their account (if they've been
105 given permissions to do so). User's also have the option of disabling
108 The admin can also define which pages TinyMCE should be used on.
109 This cannot be changed on a per user basis.
113 ********************************************************************
114 Adding plugins to TinyMCE is very easy. By default, all TinyMCE
115 plugins are disabled, but can easily be enabled by going to:
117 Administer > settings > tinymce
119 And then editing a profile (make sure you create one first!) and going
120 to the Buttons & Plugins section. To enable a button or a plugin,
121 simply check a box and TinyMCE will automatically be updated. To find
122 out more info on what a specific button or plugin does, click the
123 corresponding link (note not all buttons have help text).
125 If you wish to add more plugins to TinyMCE, simply extract these
126 plugins to the folder: tinymce\jscripts\tiny_mce\plugins
128 Then open up plugin_reg.php, found in the TinyMCE module folder.
130 Add the following lines:
132 $plugins['plugin_name'] = array();
133 $plugins['plugin_name']['theme_advanced_buttons3'] = array('icon_name');
134 // note, you can choose which row of buttons to use by changing
135 // the 3 to either 1 or 2
136 $plugins['plugin_name']['plugin_property'] = array('property_value');
138 Be sure to set the 'plugin_name' to the name of the plugin (generally
139 the plugin folder name) and set the 'icon_name' and other properties
140 (properties are optional). See plugin_reg.php for more examples.
142 To add Drupal specific plugins, TinyMCE comes bundled with plugins
143 in the main module directory. These plugins include:
145 - drupalimage: works in conjunction with the img_assist Drupal
148 NOTE: If you want to use img_assist with TinyMCE, you don't have to
149 install a plugin. Just enable the img_assist module and click
150 the photo icon that appears below each textarea.
152 Follow the directions in the README.txt for these plugins to enable them.
156 ********************************************************************
157 By default, Drupal uses the 'Filtered HTML' input format for adding
158 content to the site and this can create conflicts with TinyMCE. It's
159 best when using this editor to use an input format that has all
160 filters disabled. What I usually do is create an input format called
161 'Rich-text editing' and set that as the default format for roles which
162 use TinyMCE exclusively. To modify your input formats go to:
164 Administer > input formats > configure > configure filters
167 TWEAKING THE TINYMCE THEME
168 ********************************************************************
170 Developers have complete control over when and how tinymce is enabled
171 for each textarea inside Drupal by creating a custom Drupal theme
172 function. The following example assumes you're using a phptemplate based theme.
174 Put the following function in your themes template.php file:
177 * Customize a TinyMCE theme.
180 * An array of settings TinyMCE should invoke a theme. You may override any
181 * of the TinyMCE settings. Details here:
183 * http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
185 * @param textarea_name
186 * The name of the textarea TinyMCE wants to enable.
189 * The default tinymce theme name to be enabled for this textarea. The
190 * sitewide default is 'simple', but the user may also override this.
193 * A boolean flag that identifies id TinyMCE is currently running for this
194 * request life cycle. It can be ignored.
196 function theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
197 switch ($textarea_name) {
198 // Disable tinymce for these textareas
199 case 'log': // book and page log
200 case 'img_assist_pages':
201 case 'caption': // signature
203 case 'access_pages': //TinyMCE profile settings.
204 case 'user_mail_welcome_body': // user config settings
205 case 'user_mail_approval_body': // user config settings
206 case 'user_mail_pass_body': // user config settings
207 case 'synonyms': // taxonomy terms
208 case 'description': // taxonomy terms
212 // Force the 'simple' theme for some of the smaller textareas.
216 case 'site_offline_message':
218 case 'user_registration_help':
219 case 'user_picture_guidelines':
220 $init['theme'] = 'simple';
221 foreach ($init as $k => $v) {
222 if (strstr($k, 'theme_advanced_')) unset($init[$k]);
227 /* Example, add some extra features when using the advanced theme.
229 // If $init is available, we can extend it
231 switch ($theme_name) {
233 $init['extended_valid_elements'] = array('a[href|target|name|title|onclick]');
240 // Always return $init
244 If you study the above function you can see that tinymce can be completely
245 disabled or you can even switch themes for a given textarea.
247 See the TinyMCE manual for details on the parameters that can be
250 http://tinymce.moxiecode.com/documentation.php
253 TINYMCE KEYBOARD SHORTCUTS
254 ********************************************************************