Open Source Content Management System

Customizing TinyMCE editor

  1. TinyMCE - Custom set of buttons

Often it is needed to have different set of tools for content editing than what MidCOM default set gives. There are many useful features, such as setting anchor tags and styling with superscript, subscript, overlining and such.

It is possible to override TinyMCE default configuration by creating a snippet /sitegroup-config/midcom.helper.datamanager2/tinymce and writing the custom configuration there.

You also have create /sitegroup-config/midcom.helper.datamanager2/config and refer to the tinymce configuration. For example:

'default_renderer' => 'simple',
'default_renderer_src' => null,
'tinymce_default_theme' => 'simple',
'tinymce_default_config_snippet' => '/sitegroup-config/midcom.helper.datamanager2/tinymce',

To create a custom theme for TinyMCE it is required to write the whole set - otherwise TinyMCE will be using mixed settings and some items, such as midcom.helper.imagepopup will not work.

Here is an example of a TinyMCE configuration.

width: "560",
theme: "advanced",
button_title_map: false,
apply_source_formatting: true,
plugins: "table,contextmenu,advimage,advlink,paste,fullscreen,imagepopup",
theme_advanced_toolbar_align: "left",
theme_advanced_buttons1: "formatselect,outdent,indent,seperator,undo,redo",
theme_advanced_buttons2: "justifyleft,justifycenter,justifyright,separator,bold,italic,separator,bullist,numlist,link,separator,imagepopup,table,separator,sub,sup",
theme_advanced_buttons3: "",
theme_advanced_toolbar_location: "top",
theme_advanced_path_location : "bottom",
theme_advanced_resizing : true,
content_css : "/style/editable.css",
theme_advanced_blockformats : "p,h2,h3,blockquote",

This will create button set as seen on the screenshot below.

view_TinyMCE - Custom set of buttons.jpg

TinyMCE - Custom set of buttons

To see all the options for configuring TinyMCE, please refer to the original documentation:

  1. Configuration reference
  2. List of all buttons/controls available, and their plugin requirements
Designed by Nemein, hosted by Anykey