HighlightStack (widget)
@ckeditor/ckeditor5-widget/src/highlightstack
Class used to handle correct order of highlights on elements.
When different highlights are applied to same element correct order should be preserved:
- highlight with highest priority should be applied,
- if two highlights have same priority - sort by CSS class provided in
HighlightDescriptor
.
This way, highlight will be applied with the same rules it is applied on texts.
Filtering
Methods
-
constructor()
module:widget/highlightstack~HighlightStack#constructor
Creates class instance.
-
add( descriptor, writer )
module:widget/highlightstack~HighlightStack#add
Adds highlight descriptor to the stack.
Parameters
descriptor : HighlightDescriptor
writer : DowncastWriter
Fires
-
remove( id, writer )
module:widget/highlightstack~HighlightStack#remove
Removes highlight descriptor from the stack.
Parameters
id : String
Id of the descriptor to remove.
writer : DowncastWriter
Fires
-
private
_insertDescriptor( descriptor )
module:widget/highlightstack~HighlightStack#_insertDescriptor
Inserts given descriptor in correct place in the stack. It also takes care about updating information when descriptor with same id is already present.
Parameters
descriptor : HighlightDescriptor
-
Events
-
change:top( eventInfo, data = { [data.newDescriptor], [data.oldDescriptor] }, writer )
module:widget/highlightstack~HighlightStack#event:change:top
Fired when top element on
HighlightStack
has been changedParameters
eventInfo : EventInfo
An object containing information about the fired event.
data : Object
Additional information about the change.
Properties[ data.newDescriptor ] : HighlightDescriptor
New highlight descriptor. It will be
undefined
when last descriptor is removed from the stack.[ data.oldDescriptor ] : HighlightDescriptor
Old highlight descriptor. It will be
undefined
when first descriptor is added to the stack.
writer : DowncastWriter
View writer that can be used to modify element.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.