Class

Annotation (comments/annotations)

@ckeditor/ckeditor5-comments/src/annotations/annotation

class

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

    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.

  • innerView : View

    The annotation inner view.

    It is the view that is wrapped by the annotation view.

  • isActive : Boolean

    The state of the annotation.

  • isVisible : Boolean

    observable

    The visibility of the annotation. Annotations that are not visible, are filtered from Annotation UI collections.

  • target : Rect | Element

    The annotation target to which the annotation view should be pinned.

    It is either a DOM element or a rect instance.

  • targetRect : Rect

    The position and dimensions of the annotation target to which the annotation is bound.

  • type : String

    The type of the annotation.

  • view : AnnotationView

    The annotation view.

Methods

  • constructor( options = { options.view, options.target, options.type, [options.isVisible] } )

    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()

    Clears all event listeners and internal collections.

  • 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 the display attribute to none.

    This method only updates an annotation if the annotation target is an HTML Element.

  • updateTargetRect()

    Updates the target rect in the annotation view instance.

Events

  • change:isVisible( eventInfo, name, value, oldValue )

    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 or null, if operation should remove property.

    oldValue : Boolean

    Old value of the isVisible property with given key or null, if property was not set before.