Let the platform do the work

TinyMCE

Overview

The TinyMCE extension affects the TinyMCE WYSIWYG editor's configuration for backward compatible modules such as PDF Manager and Campaign Email Templates.

To review the default configuration for TinyMCE, please refer to the code in ./include/SugarTinyMCE.php. Sidecar's TinyMCE configuration can be edited using the Sidecar Framework and editing the htmleditable_tinymce field.

Properties

The following extension properties are available. For more information, please refer to the Extension Property documentation.

Property Value
Extension Scope Application
Sugar Variable $defaultConfig, $buttonConfigs, $pluginsConfig
Extension Directory ./custom/Extension/application/Ext/TinyMCE/
Compiled Extension File ./custom/application/Ext/TinyMCE/tinymce.ext.php
Manifest Installdef $installdefs['tinymce']

Implementation

The following sections illustrate the various ways to implement a customization to a Sugar instance.

File System

When working directly with the filesystem, you can create a file in ./custom/Extension/application/Ext/TinyMCE/ to customize the TinyMCE configuration. The following example will increase the height of the TinyMCE window, remove buttons, and remove plugins from the WYSIWYG Editor:

./custom/Extension/application/Ext/TinyMCE/<file>.php

<?php

$defaultConfig['height'] = '1000';

$buttonConfigs['default'] = array(
    'buttonConfig' => "bold,italic,underline,strikethrough,separator,bullist,numlist",
    'buttonConfig2' => "justifyleft,justifycenter,justifyright,justifyfull",
    'buttonConfig3' => "fontselect,fontsizeselect",
);

$pluginsConfig['default'] = 'advhr,preview,paste,directionality';

Navigate to Admin > Repair > Quick Repair and Rebuild. The system will then rebuild the extensions and compile your customization into ./custom/application/Ext/TinyMCE/tinymce.ext.php

Module Loadable Package

When building a module loadable package, you can use the $installdefs['tinymce'] index to install the extension file.

Installdef Properties

Name Type Description
from String The base path of the file to be installed

The example below demonstrates the proper install definition that should be used in the ./manifest.php file, in order to add the UserPage file to the system. You should note that when using this approach Sugar will automatically execute Rebuild Extensions to reflect the changes to TinyMCE in the system.

./manifest.php

<?php

$manifest = array(
    ...
);

$installdefs = array(
    'id' => 'tinyMCE_Example',
    'tinymce' => array(
        array(
            'from' => '<basepath>/Files/custom/Extension/application/Ext/TinyMCE/<file>.php',
            'to_module' => 'application'
        )
    )
);

Alternatively, you may use the $installdefs['copy'] index to copy the file. When using this approach, you may need to manually run repair actions such as a Quick Repair and Rebuild. For more information on the $installdefs['copy'] index and module loadable packages, please refer to the Introduction to the Manifest page.