Editor Field

The editor field.

The editor field uses the Cloud 9 ACE Editor plugin to render an inline editor that supports a wide array of textual content types. The editor provides a number of very powerful features and allows for the creation and modification of markup and code such as HTML, JavaScript, Java and other languages.

Properties

Title Editor
Description Provides an automatically formatted and configurable input for entering currency amounts.
Field Type editor
Base Field Type text

Schema

Property Type Default Description
allowOptionalEmpty Allows this non-required field to validate when the value is empty
autocomplete string Allows you to specify the autocomplete attribute for the underlying input control whether or not field should have autocomplete enabled.
data object Allows you to specify a key/value map of data attributes that will be added as DOM attribuets for the underlying input control. The data attributes will be added as data-{name}='{value}'.
disallowEmptySpaces boolean Whether to disallow the entry of empty spaces in the text
disallowOnlyEmptySpaces boolean Whether to disallow the entry of only empty spaces in the text
enum array List of specific values for this property
inputType string Allows for the override of the underlying HTML5 input type. If not specified, an assumed value is provided based on the kind of input control (i.e. 'text', 'date', 'email' and so forth)
maskString string Expression for the field mask. Field masking will be enabled if not empty.
placeholder string Field placeholder.
size number 40 Field size.
trim boolean Remove whitespace from the beginning and end of string
typeahead Provides configuration for the $.typeahead plugin if it is available. For full configuration options, see: https://github.com/twitter/typeahead.js

Options

Property Type Default Description
aceFitContentHeight boolean Configures the ACE Editor to auto-fit its height to the contents of the editor
aceHeight string 300px Specifies the height of the wrapping div around the editor
aceMode string ace/mode/javascript Specifies the mode to set onto the editor instance
aceTheme string ace/theme/twilight Specifies the theme to set onto the editor instance
aceWidth string 100% Specifies the width of the wrapping div around the editor
name string Field Name.
sort function Defines an f(a,b) sort function for the array of enumerated values [{text, value}]. This is used to sort enum and optionLabels as well as results that come back from any data sources (for select and radio controls). By default the items are sorted alphabetically. Don't apply any sorting if false.
wordlimit number -1 Limits the number of words allowed in the text area.

Requirements

ahead of its use.

Be sure to load lib/ace/src-min-noconflict/ace.js before rendering your forms. You can download ACE from the ACE project on GitHub.

Example 1: Simple Configuration

{% raw %} {% endraw %}

Example 2: Using a different theme ("twilight")

using the options configuration. Here, we configure the twilight theme. We also explicitly set the width and the height of the editor.

{% raw %} {% endraw %}

Example 3: Editing a different content type (HTML)

configures itself to edit ace/mode/javascript which is the plugin for JavaScript files. Here, we configure the editor to edit HTML files by setting aceMode to ace/mode/html.

We also set the aceFitContentHeight option to true to tell the editor to automatically resize the height to fit its contents.

{% raw %} {% endraw %}

Example 4: Customizing the editor

to the editor control via the postRender callback.

Take a look at ACE How To Guide for some good starting points on API customization.

{% raw %} {% endraw %}

Example 5: Multiple editors

three editors - one for JavaScript, one for CSS and one for HTML. When the JavaScript editor's value changes, we update the HTML editor.

{% raw %} {% endraw %}

Example 6: Editing Markdown

{% raw %} {% endraw %}