Module

widget/widgettypearound/utils

@ckeditor/ckeditor5-widget/src/widgettypearound/utils

module

Filtering

Constants

  • TYPE_AROUND_SELECTION_ATTRIBUTE : 'widget-type-around'

    The name of the type around model selection attribute responsible for displaying a fake caret next to a selected widget.

Functions

  • getClosestTypeAroundDomButton( domElement ) → HTMLElement | null

    For the passed HTML element, this helper finds the closest widget type around button ancestor.

    Parameters

    domElement : HTMLElement

    Returns

    HTMLElement | null
  • getClosestWidgetViewElement( domElement, domConverter ) → Element

    For the passed HTML element, this helper returns the closest view widget ancestor.

    Parameters

    domElement : HTMLElement
    domConverter : DomConverter

    Returns

    Element
  • getTypeAroundButtonPosition( domElement ) → 'before' | 'after'

    For the passed widget type around button element, this helper determines at which position the paragraph would be inserted into the content if, for instance, the button was clicked by the user.

    Parameters

    domElement : HTMLElement

    Returns

    'before' | 'after'

    The position of the button.

  • getTypeAroundFakeCaretPosition( selection ) → 'before' | 'after' | null

    For the passed selection instance, it returns the position of the fake caret displayed next to a widget.

    Note: If the fake caret is not currently displayed, null is returned.

    Parameters

    selection : Selection | DocumentSelection

    Returns

    'before' | 'after' | null

    The position of the fake caret or null when none is present.

  • isTypeAroundWidget( viewElement, modelElement, schema ) → boolean

    Checks if an element is a widget that qualifies to get the widget type around UI.

    Parameters

    viewElement : undefined | Element
    modelElement : Element
    schema : Schema

    Returns

    boolean