Class

AnnotationCollection (comments/annotations)

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

class

A collection of annotations.

It implements methods for managing annotations and creates a focus tracker for them to make it easier to manage the focus for all annotations.

AnnotationCollection fires event-focus when an annotation becomes focused and event-blur when all annotations lose focus.

Filtering

Properties

  • isFocused : Boolean

    Equals to true when one of the annotation in the collection is focused.

Methods

  • constructor( [ annotations ] )

    Parameters

    [ annotations ] : Iterable.<Annotation>

    Initial annotations.

  • add( annotation )

    Adds an annotation to the collection.

    Parameters

    annotation : Annotation
  • destroy()

    Destroys all bindings and clears the collection.

  • getByInnerView( innerView ) → Annotation

    Gets the annotation for a given annotation view's inner view.

    Parameters

    innerView : View

    Returns

    Annotation
  • getByView( view ) → Annotation

    Gets the annotation for a given annotation view.

    Parameters

    view : AnnotationView

    Returns

    Annotation
  • refreshPositioning()

    Refreshes the positioning of all annotations and sorts them topmost and leftmost.

  • remove( annotation )

    Removes the annotation from the collection.

    Parameters

    annotation : Annotation

Events

  • blur( eventInfo )

    Fired when all annotations become blurred.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

  • focus( eventInfo, annotation )

    Fired when an annotation becomes active.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

    annotation : Annotation

    An annotation that was focused.