Class: EditorFeature

Drupal. EditorFeature

new Drupal.EditorFeature(name)

A text editor feature object. Initialized with the feature name.

Contains a set of HTML rules (Drupal.EditorFeatureHTMLRule objects) that describe which HTML tags, attributes, styles and classes are required (i.e. essential for the feature to function at all) and which are allowed (i.e. the feature may generate this, but they're not essential).

It is necessary to allow for multiple HTML rules per feature: with just one HTML rule per feature, there is not enough expressiveness to describe certain cases. For example: a "table" feature would probably require the <table> tag, and might allow e.g. the "summary" attribute on that tag. However, the table feature would also require the <tr> and <td> tags, but it doesn't make sense to allow for a "summary" attribute on these tags. Hence these would need to be split in two separate rules.

HTML rules must be added with the addHTMLRule() method. A feature that has zero HTML rules does not create or modify HTML.

Name Type Description
name string

The name of the feature.



Adds a HTML rule to the list of HTML rules for this feature.

Name Type Description
rule Drupal.EditorFeatureHTMLRule

A text editor feature HTML rule.