widget/widgettypearound/utils
Constants
TYPE_AROUND_SELECTION_ATTRIBUTE : 'widget-type-around'module:widget/widgettypearound/utils~TYPE_AROUND_SELECTION_ATTRIBUTEThe name of the type around model selection attribute responsible for displaying a fake caret next to a selected widget.
Functions
getClosestTypeAroundDomButton( domElement ) → null | HTMLElementinternalmodule:widget/widgettypearound/utils~getClosestTypeAroundDomButtonFor the passed HTML element, this helper finds the closest widget type around button ancestor.
Parameters
domElement : HTMLElement
Returns
null | HTMLElement
getClosestWidgetViewElement( domElement, domConverter ) → ViewElementinternalmodule:widget/widgettypearound/utils~getClosestWidgetViewElementFor the passed HTML element, this helper returns the closest view widget ancestor.
Parameters
domElement : HTMLElementdomConverter : ViewDomConverter
Returns
getTypeAroundButtonPosition( domElement ) → 'after' | 'before'internalmodule:widget/widgettypearound/utils~getTypeAroundButtonPositionFor 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
'after' | 'before'The position of the button.
getTypeAroundFakeCaretPosition( selection ) → null | 'after' | 'before'internalmodule:widget/widgettypearound/utils~getTypeAroundFakeCaretPositionFor 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,
nullis returned.Parameters
selection : ModelSelection | ModelDocumentSelection
Returns
null | 'after' | 'before'The position of the fake caret or
nullwhen none is present.
isTypeAroundWidget( viewElement, modelElement, schema ) → booleanmodule:widget/widgettypearound/utils~isTypeAroundWidgetChecks if an element is a widget that qualifies to get the widget type around UI.
Parameters
viewElement : undefined | ViewElementmodelElement : ModelElementschema : ModelSchema
Returns
boolean