HighlightDescriptor (engine/conversion)
@ckeditor/ckeditor5-engine/src/conversion/downcasthelpers
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 theaddHighlight
function upon conversion and should be used to apply the highlight to the element. - The descriptor
id
is passed to theremoveHighlight
function upon conversion and should be used to remove the highlight with the given ID from the element.
Filtering
Properties
-
attributes : Object
module:engine/conversion/downcasthelpers~HighlightDescriptor#attributes
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>
module:engine/conversion/downcasthelpers~HighlightDescriptor#classes
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
module:engine/conversion/downcasthelpers~HighlightDescriptor#id
Descriptor identifier. If not provided, it defaults to the converted marker's name.
-
priority : Number
module:engine/conversion/downcasthelpers~HighlightDescriptor#priority
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.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.