CKEDITOR.feature
Interface that may be automatically implemented by any instance of any class which has at least the name property and can be meant as an editor feature.
For example:
- "Bold" command, button, and keystroke – it does not mean exactly
<strong>or<b>but just the ability to create bold text. - "Format" drop-down list – it also does not imply any HTML tag.
- "Link" command, button, and keystroke.
- "Image" command, button, and dialog window.
Thus most often a feature is an instance of one of the following classes:
None of them have a name property explicitly defined, but it is set by CKEDITOR.editor.addCommand and CKEDITOR.ui.add.
During editor initialization all features that the editor should activate should be passed to CKEDITOR.editor.addFeature (shorthand for CKEDITOR.filter.addFeature).
This method checks if a feature can be activated (see requiredContent) and if yes, then it registers allowed content rules required by this feature (see allowedContent) along with two kinds of transformations: contentForms and contentTransformations.
By default all buttons that are included in toolbar layout configuration are checked and registered with CKEDITOR.editor.addFeature, all styles available in the 'Format' and 'Styles' drop-down lists are checked and registered too and so on.
Filtering
Properties
allowedContent : allowedContentRulesCKEDITOR.feature#allowedContentHTML code that can be generated by this feature.
For example a basic image feature (image button displaying the image dialog window) may allow
'img[!src,alt,width,height]'.During the feature activation this value is passed to CKEDITOR.filter.allow.
Defaults to
nullcontentForms : ObjectCKEDITOR.feature#contentFormsFeature content forms to be registered in the CKEDITOR.editor.filter during the feature activation.
See CKEDITOR.filter.addContentForms for more details.
Defaults to
nullcontentTransformations : ObjectCKEDITOR.feature#contentTransformationsTransformations (usually for content generated by this feature, but not necessarily) that will be registered in the CKEDITOR.editor.filter during the feature activation.
See CKEDITOR.filter.addTransformations for more details.
Defaults to
nullname : StringCKEDITOR.feature#nameThe name of the feature.
It is used for example to identify which CKEDITOR.filter.allowedContent rule was added for which feature.
requiredContent : contentRuleCKEDITOR.feature#requiredContentMinimal HTML code that this feature must be allowed to generate in order to work.
For example a basic image feature (image button displaying the image dialog window) needs
'img[src,alt]'in order to be activated.During the feature validation this value is passed to CKEDITOR.filter.check.
If this value is not provided, a feature will be always activated.
Defaults to
null
Methods
toFeature() → featureCKEDITOR.feature#toFeatureReturns a feature that this feature needs to register.
In some cases, during activation, one feature may need to register another feature. For example a CKEDITOR.ui.button often registers a related command. See CKEDITOR.ui.button.toFeature.
This method is executed when a feature is passed to the CKEDITOR.editor.addFeature.
Returns
feature