| 1 |
********************************************************************
|
| 2 |
D R U P A L M O D U L E
|
| 3 |
********************************************************************
|
| 4 |
Name: TinyMCE module
|
| 5 |
|
| 6 |
Current Maintainers;
|
| 7 |
kreynen http://drupal.org/user/48877
|
| 8 |
Allie Micka http://drupal.org/user/15091
|
| 9 |
m3avrck http://drupal.org/user/12932
|
| 10 |
nedjo http://drupal.org/user/4481
|
| 11 |
Steve McKenzie http://drupal.org/user/45890
|
| 12 |
ufku http://drupal.org/user/9910
|
| 13 |
|
| 14 |
Past Maintainers:
|
| 15 |
Matt Westgate <drupal AT asitis DOT org> and
|
| 16 |
Jeff Robbins <robbins AT jjeff DOT com>
|
| 17 |
Richard Bennett <richard.b AT gritechnologies DOT com>
|
| 18 |
|
| 19 |
TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control
|
| 20 |
released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to
|
| 21 |
convert HTML TEXTAREA fields or other HTML elements to editor instances.
|
| 22 |
|
| 23 |
IMPORTANT!!!
|
| 24 |
TinyMCE.module requires IMCE.module to enable these feature: File/Image Manager, Quota,
|
| 25 |
Auto Resize, folder per user, file upload, file delete, etc.
|
| 26 |
|
| 27 |
README:
|
| 28 |
********************************************************************
|
| 29 |
Once TinyMCE is enabled, the default behavior is that all textareas
|
| 30 |
will use TinyMCE for all users. The admin can change these defaults
|
| 31 |
at
|
| 32 |
|
| 33 |
administer > settings > tinymce
|
| 34 |
|
| 35 |
The admin can choose what theme TinyMCE should be the default and
|
| 36 |
user's can override this by editing their account (if they've been
|
| 37 |
given permissions to do so). User's also have the option of disabling
|
| 38 |
TinyMCE completely.
|
| 39 |
|
| 40 |
The admin can also define which pages TinyMCE should be used on.
|
| 41 |
This cannot be changed on a per user basis.
|
| 42 |
|
| 43 |
|
| 44 |
PLUGINS FOR TINYMCE:
|
| 45 |
********************************************************************
|
| 46 |
Adding plugins to TinyMCE is very easy. By default, all TinyMCE
|
| 47 |
plugins are disabled, but can easily be enabled by going to:
|
| 48 |
|
| 49 |
Administer > settings > tinymce
|
| 50 |
|
| 51 |
And then editing a profile (make sure you create one first!) and going
|
| 52 |
to the Buttons & Plugins section. To enable a button or a plugin,
|
| 53 |
simply check a box and TinyMCE will automatically be updated. To find
|
| 54 |
out more info on what a specific button or plugin does, click the
|
| 55 |
corresponding link (note not all buttons have help text).
|
| 56 |
|
| 57 |
If you wish to add more plugins to TinyMCE, simply extract these
|
| 58 |
plugins to the folder: tinymce\jscripts\tiny_mce\plugins
|
| 59 |
|
| 60 |
Then open up plugin_reg.php, found in the TinyMCE module folder.
|
| 61 |
|
| 62 |
Add the following lines:
|
| 63 |
|
| 64 |
$plugins['plugin_name'] = array();
|
| 65 |
$plugins['plugin_name']['theme_advanced_buttons3'] = array('icon_name');
|
| 66 |
// note, you can choose which row of buttons to use by changing
|
| 67 |
// the 3 to either 1 or 2
|
| 68 |
$plugins['plugin_name']['plugin_property'] = array('property_value');
|
| 69 |
|
| 70 |
Be sure to set the 'plugin_name' to the name of the plugin (generally
|
| 71 |
the plugin folder name) and set the 'icon_name' and other properties
|
| 72 |
(properties are optional). See plugin_reg.php for more examples.
|
| 73 |
|
| 74 |
To add Drupal specific plugins, TinyMCE comes bundled with plugins
|
| 75 |
in the main module directory. These plugins include:
|
| 76 |
|
| 77 |
- drupalimage: works in conjunction with the img_assist Drupal
|
| 78 |
module
|
| 79 |
|
| 80 |
NOTE: If you want to use img_assist with TinyMCE, you don't have to
|
| 81 |
install a plugin. Just enable the img_assist module and click
|
| 82 |
the photo icon that appears below each textarea.
|
| 83 |
|
| 84 |
Follow the directions in the README.txt for these plugins to enable them.
|
| 85 |
|
| 86 |
|
| 87 |
CAVEATS
|
| 88 |
********************************************************************
|
| 89 |
By default, Drupal uses the 'Filtered HTML' input format for adding
|
| 90 |
content to the site and this can create conflicts with TinyMCE. It's
|
| 91 |
best when using this editor to use an input format that has all
|
| 92 |
filters disabled. What I usually do is create an input format called
|
| 93 |
'Rich-text editing' and set that as the default format for roles which
|
| 94 |
use TinyMCE exclusively. To modify your input formats go to:
|
| 95 |
|
| 96 |
Administer > input formats > configure > configure filters
|
| 97 |
|
| 98 |
|
| 99 |
TWEAKING THE TINYMCE THEME
|
| 100 |
********************************************************************
|
| 101 |
|
| 102 |
Developers have complete control over when and how tinymce is enabled
|
| 103 |
for each textarea inside Drupal by creating a custom Drupal theme
|
| 104 |
function. The following example assumes you're using a phptemplate based theme.
|
| 105 |
|
| 106 |
Put the following function in your themes template.php file:
|
| 107 |
|
| 108 |
/**
|
| 109 |
* Customize a TinyMCE theme.
|
| 110 |
*
|
| 111 |
* @param init
|
| 112 |
* An array of settings TinyMCE should invoke a theme. You may override any
|
| 113 |
* of the TinyMCE settings. Details here:
|
| 114 |
*
|
| 115 |
* http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
|
| 116 |
*
|
| 117 |
* @param textarea_name
|
| 118 |
* The name of the textarea TinyMCE wants to enable.
|
| 119 |
*
|
| 120 |
* @param theme_name
|
| 121 |
* The default tinymce theme name to be enabled for this textarea. The
|
| 122 |
* sitewide default is 'simple', but the user may also override this.
|
| 123 |
*
|
| 124 |
* @param is_running
|
| 125 |
* A boolean flag that identifies id TinyMCE is currently running for this
|
| 126 |
* request life cycle. It can be ignored.
|
| 127 |
*/
|
| 128 |
function theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
|
| 129 |
switch ($textarea_name) {
|
| 130 |
// Disable tinymce for these textareas
|
| 131 |
case 'log': // book and page log
|
| 132 |
case 'img_assist_pages':
|
| 133 |
case 'caption': // signature
|
| 134 |
case 'pages':
|
| 135 |
case 'access_pages': //TinyMCE profile settings.
|
| 136 |
case 'user_mail_welcome_body': // user config settings
|
| 137 |
case 'user_mail_approval_body': // user config settings
|
| 138 |
case 'user_mail_pass_body': // user config settings
|
| 139 |
case 'synonyms': // taxonomy terms
|
| 140 |
case 'description': // taxonomy terms
|
| 141 |
unset($init);
|
| 142 |
break;
|
| 143 |
|
| 144 |
// Force the 'simple' theme for some of the smaller textareas.
|
| 145 |
case 'signature':
|
| 146 |
case 'site_mission':
|
| 147 |
case 'site_footer':
|
| 148 |
case 'site_offline_message':
|
| 149 |
case 'page_help':
|
| 150 |
case 'user_registration_help':
|
| 151 |
case 'user_picture_guidelines':
|
| 152 |
$init['theme'] = 'simple';
|
| 153 |
foreach ($init as $k => $v) {
|
| 154 |
if (strstr($k, 'theme_advanced_')) unset($init[$k]);
|
| 155 |
}
|
| 156 |
break;
|
| 157 |
}
|
| 158 |
|
| 159 |
/* Example, add some extra features when using the advanced theme.
|
| 160 |
|
| 161 |
// If $init is available, we can extend it
|
| 162 |
if (isset($init)) {
|
| 163 |
switch ($theme_name) {
|
| 164 |
case 'advanced':
|
| 165 |
$init['extended_valid_elements'] = array('a[href|target|name|title|onclick]');
|
| 166 |
break;
|
| 167 |
}
|
| 168 |
}
|
| 169 |
|
| 170 |
*/
|
| 171 |
|
| 172 |
// Always return $init
|
| 173 |
return $init;
|
| 174 |
}
|
| 175 |
|
| 176 |
If you study the above function you can see that tinymce can be completely
|
| 177 |
disabled or you can even switch themes for a given textarea.
|
| 178 |
|
| 179 |
See the TinyMCE manual for details on the parameters that can be
|
| 180 |
sent to TinyMCE:
|
| 181 |
|
| 182 |
http://tinymce.moxiecode.com/documentation.php
|
| 183 |
|
| 184 |
|
| 185 |
TINYMCE KEYBOARD SHORTCUTS
|
| 186 |
********************************************************************
|
| 187 |
Ctrl+Z Undo
|
| 188 |
Ctrl+Y Redo
|
| 189 |
Ctrl+B Bold
|
| 190 |
Ctrl+I Italic
|
| 191 |
Ctrl+U Underline
|