Class: Editor

Editor


new Editor(element, settings [, autoNew])

The Editor mixin provides an editable block of text.

Parameters:
Name Type Argument Default Description
element JQuery

The element to which the editor should be applied.

settings
Properties
Name Type Argument Default Description
BlockedKeys Array.<number> <optional>
[]

Key codes which should be blocked from input.

data Control | Object <optional>
null

The data object passed along with events.

DefaultFont EditorGlobal#Font <optional>
EditorGlobal.DefaultFont

Override of default font settings.

Height number <optional>
0

Height of editor.

Height JQuery <optional>
null

Element to sync height to.

NumericOnly boolean <optional>
false

Blocks non-numeric values from being entered.

onChange boolean <optional>
null

Event called when editor value is changed.

onKeyBlock boolean <optional>
null

Event called when editor blocks a key from entry.

onResize boolean <optional>
null

Event called when editor is resized.

ReadOnly boolean <optional>
false

Sets whether or not the editor is read-only.

Validator Validator <optional>
Validator

Validator to use in conjunction with the editor mixin.

autoNew boolean | undefined <optional>
true

Creates a new editor object when missing.

Source:

Members


Ready :boolean

Flag signifying whether or not the editor is ready to use.

Type:
  • boolean
Source:

Parent :JQuery

Element which has been transformed into an editor.

Type:
  • JQuery
Source:

data :Control|Object

The data object passed along with events.

Type:
Source:

NumericOnly :boolean

Setting signifying whether or not the editor should block non-numeric values from being entered.

Type:
  • boolean
Source:

BlockedKeys :Array.<number>

Key codes which should be blocked from input.

Type:
  • Array.<number>
Source:

Validator :Validator

Validator to use in conjunction with the editor.

Type:
Source:

LastValidValue :string

Most recently validated value within the editor.

Type:
  • string
Source:

ReadOnly :boolean

Whether or not the editor is read-only.

Type:
  • boolean
Default Value:
  • false
Source:

Selection :Editor#SelectionObject

Object storing selection information for the editor.

Type:
Source:

Settings :Editor#SettingsObject

Object storing settings for the editor.

Type:
Source:

Methods


Changed()

Handles the change logic for the editor and calls the onChange event if appropriate.

Source:

Exec(commandName, value)

Executes a document command on the active editor.
See https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand for more information.

Parameters:
Name Type Description
commandName string

The command to execute on the editor region.

value string

Value parameter to send with command being executed.

Source:

GetRawSelection()

Retrieves raw selection data.

Source:
Returns:
Type
Editor#RawSelectionObject

PossibleSelection()

Triggers a check to determine if the selection has changed and fire off the appropriate event if so.

Source:

Resize()

Resizes the editor based on the size constraints applied to it.

Source:

SelectionChanged()

Calls the SelectionChanged event for the editor.

Source:

SetClass(className)

Sets a CSS class to the editor.

Parameters:
Name Type Description
className string

The CSS class to set.

Source:

SetHeight(height)

Sets a fixed height to the editor.

Parameters:
Name Type Description
height string

The height to set.

Source:

SetHeightElement(element)

Sets an object height binding to the editor.

Parameters:
Name Type Description
element string

The element to set the editor height off of.

Source:

SetStyle(name, value)

Applies a CSS style property to the editor.

Parameters:
Name Type Description
name string

The name of the CSS property to set.

value string

Value of CSS property to be set.

Source:

Type Definitions


SelectionObject

Type:
  • Object
Properties:
Name Type Argument Default Description
Selection.Raw string <optional>
""
Selection.Fonts Array.<string> <optional>
[EditorGlobal.DefaultFont.Font]
Selection.Families Array.<string> <optional>
[EditorGlobal.DefaultFont.Family]
Selection.Sizes Array.<string> <optional>
[EditorGlobal.DefaultFont.Size]
Source:

SettingsObject

Type:
  • Object
Properties:
Name Type Description
SettingsObject.BlockedKeys Array.<number>

Key codes which should be blocked from input.

SettingsObject.data Control | Object

The data object passed along with events.

SettingsObject.DefaultFont EditorGlobal#Font

Override of default font settings.

SettingsObject.Height number

Height of editor.

SettingsObject.Height JQuery

Element to sync height to.

SettingsObject.NumericOnly boolean

Blocks non-numeric values from being entered.

SettingsObject.onChange boolean

Event called when editor value is changed.

SettingsObject.onKeyBlock boolean

Event called when editor blocks a key from entry.

SettingsObject.onResize boolean

Event called when editor is resized.

SettingsObject.ReadOnly boolean

Sets whether or not the editor is read-only.

SettingsObject.Validator Validator

Validator to use in conjunction with the editor mixin.

Source:

RawSelectionObject

Type:
  • Object
Properties:
Name Type Description
Selection.Raw string
Selection.Fonts Array.<string>
Selection.Families Array.<string>
Selection.Sizes Array.<string>
Selection.Bold string
Selection.Italic string
Selection.Underline string
Selection.Strikethrough string
Selection.Subscript string
Selection.Superscript string
Selection.Styles string
Source:

Events


onChange

Event called when editor value is changed.

Source:

onKeyBlock

Event called when editor blocks a key from entry.

Parameters:
Name Type Description
event IJQueryEventObject

The keydown event object.

Source:

onResize

Event called when editor is resized.

Source: