cmRichTextEditor
This type allows to configure the rich text editor.
Attributes:
- configuration
The configuration of the editor in JSON format, see https://www.froala.com/wysiwyg-editor/v2.0/docs/options for all the options. - font
This is the font used in the editor by default. - fontSizeValue
This is the default size for the text in the rich text editor. It must be one of the values from the list in fontSizeValues.
Using a script to configure settings
Instead of providing the values for the attributes directly in the page customization, you can reference a script which returns the desired values. This allows you to add logic when determining the editor settings. You need to create a script of the type Page customization and reference it in the configuration script field of the page customization.
Example:
The default font size should depend on the customer group of the case’s main contact. You can reference a script with the following code.
ticket = ticketService.getById(ticketId);
def mainContact = ticket.mainContact
def cgName = mainContact.customerGroup.name
switch(cgName) {
case "DirectCustomers": [fontSizeValue:"14pt"];
break;
case "Reseller": [fontSizeValue:"12pt"];
break;
default: [fontSizeValue:"10pt"];
break;
}
Code example 40: Script to set the default font size for the rich text editor depending on the customer group of the case’s main contact