CKEditor Field
The ckeditor
field.
The CK Editor field renders the CK editor control that allows users to visually work with HTML and save the results back into a text property.
Properties
Title | CK Editor |
Description | Provides an instance of a CK Editor control for use in editing HTML. |
Field Type | ckeditor |
Base Field Type | textarea |
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 |
---|---|---|---|
ckeditor | any | Use this entry to provide configuration options to the underlying CKEditor plugin. | |
cols | number | 40 | Number of columns |
name | string | Field Name. | |
rows | number | 5 | Number of rows |
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
http://www.ckeditor.com. This must be included in your page ahead of the control loading in order for this to work properly.
Example 1
In the examples that follow, we'll trim this down.
{ "schema": { "type": "object", "properties": { "body": { "type": "string" } } }, "options": { "fields": { "body": { "label": "Body", "type": "ckeditor" } } }, "data": { "body": "Ice cream is a frozen dessert usually made from dairy products, such as milk and cream, and often combined with fruits or other ingredients and flavors.", } }
Example 2
A full example of the CK Editor at work. This has a lot of buttons. The point here is to show how it looks in full. In the examples that follow, we'll trim this down.
{ "schema": { "type": "object", "properties": { "body": { "type": "string" } } }, "options": { "fields": { "body": { "label": "Body", "type": "ckeditor", "ckeditor": { "toolbar": [ ['Format','Font','FontSize'], ['Bold','Italic','Underline','StrikeThrough','-','Undo','Redo','-','Cut','Copy','Paste','Find','Replace','-','Outdent','Indent','-','Print'], '/', ['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Image','Table','-','Link','Flash','Smiley','TextColor','BGColor','Source'] ] } } } }, "data": { "body": "Ice cream is a frozen dessert usually made from dairy products, such as milk and cream, and often combined with fruits or other ingredients and flavors.", } }
Example 3
{ "schema": { "type": "object", "properties": { "summary": { "type": "string", "title": "Summary" }, "body": { "type": "string", "title": "Body" } } }, "options": { "fields": { "summary": { "type": "ckeditor" }, "body": { "type": "ckeditor" } } } }
Example 4
{
"options": {
"type": "ckeditor"
},
"postRender": function(control) {
control.setValue("<p>Buddha built my hotrod</p>");
}
}