tinymce.EditorOptions

TinyMCE Editor Options API. The options API provides the ability to register, lookup and set editor options.

All options need to be registered before they can be used in the editor. This is done by using the register() API which requires a name and an option specification. The specification should contain a processor and an optional default value. The processor is used to parse and validate the option value either passed in the initial configuration or via the set() API.

The processor can either be a custom function that returns if the option value is valid, or one of the following built-in processors:

  • string

  • number

  • boolean

  • array

  • function

  • object

  • string[]

  • object[]

  • regexp

Examples

// Register an option
editor.options.register('custom_option', {
  processor: 'string',
  default: 'myoption'
});

// Lookup an option
editor.options.get('custom_option');

// Set an option
editor.options.set('custom_option', 'value');

Summary

Methods

Name Summary Defined by

get()

Get the value of a registered option.

EditorOptions

isRegistered()

Check if an option has been registered.

EditorOptions

isSet()

Checks to see if a value has been set for the specified option.

EditorOptions

register()

Register a new option that can be used within TinyMCE.

EditorOptions

set()

Set the value for a registered option.

EditorOptions

unset()

Clear the set value for the specified option and revert back to the default value.

EditorOptions

Methods

get()

get(name: String): Object

Get the value of a registered option.

Parameters

  • name (String) - Name of a registered option.

Return value

  • Object - An option value, the registered default if not set, or undefined if not registered.


isRegistered()

isRegistered(name: String): Boolean

Check if an option has been registered.

Parameters

  • name (String) - Name of the option.

Return value

  • Boolean - True if the option has already been registered, otherwise false.


isSet()

isSet(name: String): Boolean

Checks to see if a value has been set for the specified option.

Parameters

  • name (String) - Name of the option.

Return value

  • Boolean - True if the option has a value set, otherwise false.


register()

register(name: String, spec: OptionSpec)

Register a new option that can be used within TinyMCE.

Parameters

  • name (String) - Name of the option.

  • spec (OptionSpec) - An option spec describing how to validate the option with other optional metadata.


set()

set(name: String): Boolean

Set the value for a registered option.

Parameters

  • name (String) - Name of a registered option.

Return value

  • Boolean - True if the option value was successfully set, otherwise false.


unset()

unset(name: String): Boolean

Clear the set value for the specified option and revert back to the default value.

Parameters

  • name (String) - Name of a registered option.

Return value

  • Boolean - True if the option value was successfully reset, otherwise false.