Rich Text Field

Enacts WYSIWYG editor

Allow content creators to markup, format, and arrange content as they see fit using the rich text field. The rich text fields are powered by Alloy Editor which is built on top of CKEditor, and the options available to each editor field is configured by the alloy configuration files located in enact/config/alloy/.

Options#

  • Configuration – The configuration file defining the options available to the rich text field editor, stored in enact/config/alloy/. By default Enact comes with two configuration files; Default.json and Minimal.json. The default one provides the full suite of options, and the minimal one provides a minimal subset of the options.

  • Remove br tags – Whether <br> tags should be removed when the field is saved.

  • Purify HTML – Whether the rich text fields contents should be purified by HTML Purifier, which ensures that XSS attacks are thwarted and the resulting HTML is standards compliant.

Configuration Files#

You are free to alter and create new configuration files for use with the rich text fields enabling very granular control of what content can and can't be used in the rich text fields. See the Alloy Editor docs for more insight on how the editor can be configured.

The configuration files define three keys:

  • ckeditorFilter – The filter defining what elements are allowed to be pasted into the rich text field. See the CKEditor filter docs for more information.

  • add_buttons - The buttons made available by the plus symbol that floats to the edge of the rich text field, which allows for content to be inserted into the field without a selection (highlighted text).

  • selection_buttons - The buttons made available to alter selected text/content.

Use#

Template Use#

Access your rich text fields via the handle you set for the field and get the html content by calling it directly

<div class='body'>

    {{ entry.yourRichTextHandle }}

</div>