Class: ControllerView

Drupal.ckeditor. ControllerView

new Drupal.ckeditor.ControllerView()

Backbone View acting as a controller for CKEditor toolbar configuration.

Extends

  • Backbone.View

Members

eventsobject

Methods

broadcastConfigurationChanges($ckeditorToolbar)

Sets up broadcasting of CKEditor toolbar configuration changes.

Name Type Description
$ckeditorToolbar jQuery

The active toolbar DOM element wrapped in jQuery.

disableFeaturesDisallowedByFilters(features, buttonsToFeatures)

Checks buttons against filter settings; disables disallowed buttons.

Name Type Description
features object

A map of Drupal.EditorFeature objects.

buttonsToFeatures object

Object containing the button-to-feature mapping.

See:

Returns the list of buttons from an editor configuration.

Name Type Description
config object

A CKEditor configuration object.

Returns:
Type Description
Array A list of buttons in the CKEditor configuration.

getCKEditorFeatures(CKEditorConfig, callback)

Asynchronously retrieve the metadata for all available CKEditor features.

In order to get a list of all features needed by CKEditor, we create a hidden CKEditor instance, then check the CKEditor's "allowedContent" filter settings. Because creating an instance is expensive, a callback must be provided that will receive a hash of Drupal.EditorFeature features keyed by feature (button) name.

Name Type Description
CKEditorConfig object

An object that represents the configuration settings for a CKEditor editor component.

callback function

A function to invoke when the instanceReady event is fired by the CKEditor object.

getFeatureForButton(button){object}

Retrieves the feature for a given button from featuresMetadata. Returns false if the given button is in fact a divider.

Name Type Description
button string

The name of a CKEditor button.

Returns:
Type Description
object The feature metadata object for a button.

parseEditorDOM(model, isDirty, options)

Converts the active toolbar DOM structure to an object representation.

Name Type Description
model Drupal.ckeditor.ConfigurationModel

The state model for the CKEditor configuration.

isDirty bool

Tracks whether the active toolbar DOM structure has been changed. isDirty is toggled back to false in this method.

options object

An object that includes:

Name Type Description
broadcast bool optional

A flag that controls whether a CKEditorToolbarChanged event should be fired for configuration changes.

Fires:
  • event:CKEditorToolbarChanged