Last updated May 28, 2009. Created by tobiassjosten on December 14, 2006.
Edited by bekasu, dalin. Log in to edit this page.
Formating controls for headings (h1, h2, h3...) are not included in the base TinyMCE package. However there is a 3rd Party TinyMCE plugin that provides this.
- Download the plugin from SourceForge.
- Unzip the files and place header directory in your modules/tinymce/tinymce/jscripts/tiny_mce/plugins folder.
- The TinyMCE Drupal module handles plugins differently than stock TinyMCE, hence the standard plugin installation instructions do not apply. Instead edit the modules/tinymce/plugin_reg.php file and add the following lines immediately before
return $plugins;$plugins['heading'] = array();
$plugins['heading']['theme_advanced_buttons1'] = array('h1,h2,h3,h4,h5,h6,separator');
$plugins['heading']['heading_clear_tag'] = array('p'); - on the TinyMCE settings page you should now see a button entry for the headings: "h1,h2,h3,h4,h5,h6,separator – heading". Enable the button.
That's it, you should now see buttons for headings in your editor.
Drupal 6
As of Jan 2009, All you need to do is enable "HTML block format" if using the latest dev for 6.x
Comments
HTML Block Format
Using HTML Block Format is definitely the best way to do this.
If anyone still uses the plugin for older versions, I found putting this code in a custom module worked well, once the plugin was downloaded:
/*** Implementation of hook_wywiwyg_plugin().
*/
function FOOBAR_wysiwyg_plugin($editor, $version=0) {
$plugins = array();
switch ($editor) {
case 'tinymce':
if ($version > 3) {
$plugins['heading'] = array(
'type' => 'external',
'title' => t('Headings'),
'description' => t('Provides H1-H6 buttons for tinyMCE'),
'path' => wysiwyg_get_path($editor) . '/jscripts/tiny_mce/plugins/heading/editor_plugin.js',
'buttons' => array(
'h1' => t('H1'),
'h2' => t('H2'),
'h3' => t('H3'),
'h4' => t('H4'),
'h5' => t('H5'),
'h6' => t('H6'),
),
'url' => 'http://sourceforge.net/tracker/index.php?func=detail&aid=1467705&group_id=103281&atid=738747',
'load' => TRUE,
);
}
break;
}
return $plugins;
}
(found this here http://openconcept.ca/blog/stevem/howto_add_headings_tinymce_plugin_to_w...)