Class: CodeEditorControl

wp.customize. CodeEditorControl


new CodeEditorControl()

Class wp.customize.CodeEditorControl
Since:
  • 4.9.0
Source:

Extends

Members


defaults :object

Default params.
Type:
  • object
Since:
  • 4.9.0
Inherited From:
Source:

Methods


<private> addNewPage()

Add a new page to a dropdown-pages control reusing menus code for this.
Since:
  • 4.7.0
Inherited From:
Source:
Returns:
Type
void

embed()

Embed the control into the page.
Inherited From:
Source:

expand( [params])

Normal controls do not expand, so just expand its parent
Parameters:
Name Type Argument Description
params Object <optional>
Inherited From:
Source:

focus( [params])

Make sure editor gets focused when control is focused.
Parameters:
Name Type Argument Description
params Object <optional>
Focus params.
Properties
Name Type Argument Description
completeCallback function <optional>
Function to call when expansion is complete.
Since:
  • 4.9.0
Source:
Returns:
Type
void

getNotificationsContainerElement()

Get the element inside of a control's container that contains the validation error message. Control subclasses may override this to return the proper container to render notifications into. Injects the notification container for existing controls that lack the necessary container, including special handling for nav menu items and widgets.
Since:
  • 4.6.0
Inherited From:
Source:
Returns:
Setting validation message element.
Type
jQuery

initEditor()

Initialize editor.
Since:
  • 4.9.0
Source:
Returns:
Type
void

initialize(id, options)

Initialize.
Parameters:
Name Type Description
id string Unique identifier for the control instance.
options object Options hash for the control instance.
Since:
  • 4.9.0
Source:
Returns:
Type
void

initPlainTextareaEditor()

Initialize plain-textarea editor when syntax highlighting is disabled.
Since:
  • 4.9.0
Source:
Returns:
Type
void

initSyntaxHighlightingEditor(codeEditorSettings)

Initialize syntax-highlighting editor.
Parameters:
Name Type Description
codeEditorSettings object Code editor settings.
Since:
  • 4.9.0
Source:
Returns:
Type
void

linkElements()

Link elements between settings and inputs.
Since:
  • 4.7.0
Inherited From:
Source:
Returns:
Type
void

onChangeActive(active, args)

Update UI in response to a change in the control's active state. This does not change the active state, it merely handles the behavior for when it does change.
Parameters:
Name Type Description
active Boolean
args Object
Properties
Name Type Description
duration Number
completeCallback function
Since:
  • 4.1.0
Inherited From:
Source:

onTabNext()

Handle tabbing to the field after the editor.
Since:
  • 4.9.0
Source:
Returns:
Type
void

onTabPrevious()

Handle tabbing to the field before the editor.
Since:
  • 4.9.0
Source:
Returns:
Type
void

onUpdateErrorNotice(errorAnnotations)

Update error notice.
Parameters:
Name Type Description
errorAnnotations Array Error annotations.
Since:
  • 4.9.0
Source:
Returns:
Type
void

ready()

Initialize the editor when the containing section is ready and expanded.
Since:
  • 4.9.0
Overrides:
Source:
Returns:
Type
void

renderContent()

Render the control from its JS template, if it exists. The control's container must already exist in the DOM.
Since:
  • 4.1.0
Inherited From:
Source:

renderNotifications()

Render notifications. Renders the `control.notifications` into the control's container. Control subclasses may override this method to do their own handling of rendering notifications.
This:
Since:
  • 4.6.0
Inherited From:
Deprecated:
  • in favor of `control.notifications.render()`
Source:

setupNotifications()

Set up notifications.
Since:
  • 4.9.0
Inherited From:
Source:
Returns:
Type
void

toggle()

Inherited From:
Deprecated:
  • 4.1.0 Use this.onChangeActive() instead.
Source: