Report an issue
Typedef

HighlightDescriptor (engine/conversion)

@ckeditor/ckeditor5-engine/src/conversion/downcast-converters

typedef
Object

An object describing how the marker highlight should be represented in the view.

Each text node contained in a highlighted range will be wrapped in a <span> view attribute element with CSS class(es), attributes and a priority described by this object.

Additionally, each container element can handle displaying the highlight separately by providing the addHighlight and removeHighlight custom properties. In this case:

  • The HighlightDescriptor object is passed to the addHighlight function upon conversion and should be used to apply the highlight to the element.
  • The descriptor id is passed to the removeHighlight function upon conversion and should be used to remove the highlight with the given ID from the element.

Filtering

Properties

  • attributes : Object

    Attributes to set. If the descriptor is used to create an attribute element over text nodes, these attributes will be set on that attribute element. If the descriptor is applied to an element, usually these attributes will be set on that element, however, this depends on how the element converts the descriptor.

  • classes : String | Array.<String>

    A CSS class or an array of classes to set. If the descriptor is used to create an attribute element over text nodes, these classes will be set on that attribute element. If the descriptor is applied to an element, usually these classes will be set on that element, however, this depends on how the element converts the descriptor.

  • id : String

    Descriptor identifier. If not provided, it defaults to the converted marker's name.

  • priority : Number

    Descriptor priority. If not provided, it defaults to 10. If the descriptor is used to create an attribute element, it will be that element's priority. If the descriptor is applied to an element, the priority will be used to determine which descriptor is more important.