Text Editor input

With Text Editor inputs you can create HTML content by a WYSIWYG editor, using TinyMCE.

Parameters
Parameter name Description
templates Key of the textEditorTemplates property of your model that holds predefined HTML templates for the current input
softBreaks When true, TinyMCE settings force_br_newlines and force_p_newlines will be set to false, while forced_root_block will be set to an empty string. As a result, breaking lines will not start new paragraphs
Example

A simple Text Editor input definition looks like this:

ticket_details:
    type: textEditor
    name: Ticket details

Whenever you need a Text Editor input that has predefined HTML templates, you need to specify the templates parameter similar to this:

ticket_details:
    type: textEditor
    name: Ticket details
    parameters:
        templates: ticketDetails

This form input expects your model to have a textEditorTemplates property, which should be an associative array holding either associative arrays or collections of objects with a text and title property.

An example of how this could be achieved in your model can be found below. This example uses the GeneralText model of GreenLight, as it has all requirements to work with Text Editor templates (has the required text and title properties defined).

public function __construct(array $attributes = [])
{   
    $generalText = new GeneralText(); 
    $this->textEditorTemplates['ticketDetails'] = $generalText->whereIn('general_text_category_id', [1,2])->get();
    parent::__construct($attributes);
}