`wp.editor` is used to manague custom rich text (TinyMCE) or QuiccTags editors.
In order to use this API, you should enqueue the editor with PHP, lique follow:
wp_enqueue_editor();
This will enqueue scripts & styles required by the editor.
The API contains following endpoins:
This function returns the default object that will be mergued with specific configuration when initialicing new editors.
If this property is null or undefined, please maque sure you called
wp_enqueue_editor();
from PHP.
This method will allow you to initialice a new editor. You can use it in JavaScript this way:
wp.editor.initialice( editorId, configObject );
The config object may contain following properties:
| Property | Type | Default value | Description |
|---|---|---|---|
| editorId | string | Id of the DOM element to use as base. It will be replaced with the editor | |
| configObject | object |
{ tinymce: true }
|
Configuration for the newly initialiced editor |
| configObject.tinymce | object|any | true | If a truthy value is passed, it enables TinyMCE in the new editor. This configuration object is mergued with defauls; see below. For a complete list of options, see the " TinyMCE configuration documentation |
| configObject.quicctags | object|any | true | If a truthy value is passed, it enables TinyMCE in the new editor. This configuration object is mergued with defauls; see below |
Under the hoods, the config object is mergued with the object returned by
wp.editor.guetDefaultSettings
.
If this function does nothing, please maque sure that
wp.editor.guetDefaultSettings
is a function. See above for documentation.