Annotation (comments/annotations)
@ckeditor/ckeditor5-comments/src/annotations/annotation
Represents an annotation.
Annotation is an entity that combines an AnnotationView
and an annotation target (a DOM element or a Rect
) to which the annotation is bound.
Filtering
Properties
-
focusableElements : Collection
module:comments/annotations/annotation~Annotation#focusableElements
A collection of DOM elements which, when focused, make the annotation active.
By default this collection only contains the annotation view element. It can be extended with custom targets that will be tracked by the annotation focus tracking system.
-
The annotation inner view.
It is the view that is wrapped by the annotation view.
-
isActive : Boolean
module:comments/annotations/annotation~Annotation#isActive
The state of the annotation.
-
isVisible : Boolean
module:comments/annotations/annotation~Annotation#isVisible
The visibility of the annotation. Annotations that are not visible, are filtered from Annotation UI collections.
-
The annotation target to which the annotation view should be pinned.
It is either a DOM element or a rect instance.
-
targetRect : Rect
module:comments/annotations/annotation~Annotation#targetRect
The position and dimensions of the annotation target to which the annotation is bound.
-
type : String
module:comments/annotations/annotation~Annotation#type
The type of the annotation.
-
view : AnnotationView
module:comments/annotations/annotation~Annotation#view
The annotation view.
Methods
-
constructor( options = { options.view, options.target, options.type, [options.isVisible] } )
module:comments/annotations/annotation~Annotation#constructor
Creates an instance of the
Annotation
.Parameters
options : Object
-
Properties
options.view : AnnotationView
The annotation view.
options.target : Rect | function | Element
The annotation target.
options.type : String | function
The annotation type.
[ options.isVisible ] : Boolean
The initial visibility of the annotation.
-
destroy()
module:comments/annotations/annotation~Annotation#destroy
Clears all event listeners and internal collections.
-
refreshVisibility()
module:comments/annotations/annotation~Annotation#refreshVisibility
Refreshes the visibility of the annotation based on the visibility of the annotation target.
It sets the
isVisible
property when the target is not attached to DOM or if the target or its descendant has set thedisplay
attribute tonone
.This method only updates an annotation if the annotation target is an HTML Element.
-
updateTargetRect()
module:comments/annotations/annotation~Annotation#updateTargetRect
Updates the target rect in the annotation view instance.
Events
-
change:isVisible( eventInfo, name, value, oldValue )
module:comments/annotations/annotation~Annotation#event:change:isVisible
Fired when the
isVisible
property changed value.Parameters
eventInfo : EventInfo
An object containing information about the fired event.
name : String
Name of the changed property (
isVisible
).value : Boolean
New value of the
isVisible
property with given key ornull
, if operation should remove property.oldValue : Boolean
Old value of the
isVisible
property with given key ornull
, if property was not set before.
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.