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.
-
remove( id, writer )
module:widget/highlightstack~HighlightStack#remove
Removes highlight descriptor from the stack.
-
_insertDescriptor( descriptor )
module:widget/highlightstack~HighlightStack#_insertDescriptor
private
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
-
_removeDescriptor( id )
module:widget/highlightstack~HighlightStack#_removeDescriptor
private
Removes descriptor with given id from the stack.
Parameters
id : String
Descriptor's id.
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 an outdated information? Is something missing? Please report it via our issue tracker.