Modifying the TinyMCE Editor
Overview
This article is a brief overview on how to modify the default settings for the TinyMCE editor by creating an override file. There are two different overrides that can be applied to buttons and default settings.
Overriding Buttons
The first override file is for the toolbar buttons. To do this, you must create ./custom/include/tinyButtonConfig.php
. Within this file, you will be able to override the button layout for the TinyMCE editor.
There are 3 different layouts you can change:
- default : Used when creating an email template
- email_compose : Used when composing an email from the full form under the Emails module
- email_compose_light : Used when doing a quick compose from a listview or subpanel
Example File
./custom/include/tinyButtonConfig.php
<?php
//create email template
$buttonConfigs['default'] = array(
'buttonConfig' => "code,help,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleselect,formatselect,fontselect,fontsizeselect,",
'buttonConfig2' => "cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent,indent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,image,separator,sub,sup,separator,charmap,visualaid",
'buttonConfig3' => "tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,inserttime,separator,preview"
);
//Standard email compose
$buttonConfigs['email_compose'] = array(
'buttonConfig' => "code,help,separator,bold,italic,underline,strikethrough,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleselect,formatselect,fontselect,fontsizeselect,",
'buttonConfig2' => "", //empty
'buttonConfig3' => "" //empty
);
//Quick email compose
$buttonConfigs['email_compose_light'] = array(
'buttonConfig' => "code,help,separator,bold,italic,underline,strikethrough,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,styleselect,formatselect,fontselect,fontsizeselect,",
'buttonConfig2' => "", //empty
'buttonConfig3' => "" //empty
);
Overriding Default Settings
The second override file is for basic TinyMCE functionality. To do this, you must create ./custom/include/tinyMCEDefaultConfig.php
. TinyMCE has quite a few settings that can be altered, so the best reference for configuration settings can be found in the TinyMCE Configuration Documentation.
Example File
./custom/include/tinyMCEDefaultConfig.php
<?php
$defaultConfig = array(
'convert_urls' => false,
'valid_children' => '+body[style]',
'height' => 300,
'width' => '100%',
'theme' => 'advanced',
'theme_advanced_toolbar_align' => "left",
'theme_advanced_toolbar_location' => "top",
'theme_advanced_buttons1' => "",
'theme_advanced_buttons2' => "",
'theme_advanced_buttons3' => "",
'strict_loading_mode' => true,
'mode' => 'exact',
'language' => 'en',
'plugins' => 'advhr,insertdatetime,table,preview,paste,searchreplace,directionality',
'elements' => '',
'extended_valid_elements' => 'style[dir|lang|media|title|type],hr[class|width|size|noshade],@[class|style]',
'content_css' => 'include/javascript/tiny_mce/themes/advanced/skins/default/content.css',
);
Creating Plugins
Another alternative to customizing the TinyMCE is to create a plugin. Your plugins will be stored in ./include/javascript/tiny_mce/plugins/
. You can find more information on creating plugins on the TinyMCE website.