Show:

Calculates the position where an Widget should be displayed based on the point where user interacted with the editor.

Methods

_animate

(
  • callback
)
protected

Requests an animation frame, if possible, to simulate an animation.

Parameters:

  • callback Function

    The function to be executed on the scheduled frame.

_getXPoint

(
  • selectionData
  • eventX
)
Number protected

Returns the position of the Widget.

Parameters:

  • selectionData Object

    The data about the selection in the editor as returned from getSelectionData

  • eventX Object

    The X coordinate received from the native event (mouseup).

Returns:

Number:

The calculated X point in page coordinates.

_getYPoint

(
  • selectionData
  • nativeEvent
)
Number protected

Returns the position of the Widget.

Parameters:

  • selectionData Object

    The data about the selection in the editor as returned from getSelectionData

  • nativeEvent Object

    The data about event is fired

Returns:

Number:

The calculated Y point in page coordinates.

cancelAnimation

()

Cancels an scheduled animation frame.

getConstrainedPosition

(
  • attrs
  • viewPaneSize
)
Object

Returns an object which contains the position of the element in page coordinates, restricted to fit to given viewport.

Parameters:

  • attrs Object

    The following properties, provided as numbers:

    • height
    • left
    • top
    • width
  • viewPaneSize Object

    Optional. If not provided, the current viewport will be used. Should contain at least these properties:

    • width

Returns:

Object:

An object with x and y properties, which represent the constrained position of the element.

getDefaultProps

()

Lifecycle. Returns the default values of the properties used in the widget.

getInteractionPoint

() Object

Returns the position, in page coordinates, according to which a widget should appear. Depending on the direction of the selection, the wdiget may appear above of or on bottom of the selection.

It depends on the props editorEvent to analyze the following user-interaction parameters:

  • {Object} selectionData The data about the selection in the editor as returned from getSelectionData
  • {Number} pos Contains the coordinates of the position, considered as most appropriate. This may be the point where the user released the mouse, or just the beginning or the end of the selection.

Returns:

Object:

An Object which contains the following properties: direction, x, y, where x and y are in page coordinates and direction can be one of these: CKEDITOR.SELECTION_BOTTOM_TO_TOP or CKEDITOR.SELECTION_TOP_TO_BOTTOM

getWidgetXYPoint

(
  • left
  • top
  • direction
)
Array protected

Returns the position of the Widget taking in consideration the WidgetPosition/gutter:attribute attribute.

Parameters:

  • left Number

    The left offset in page coordinates where Toolbar should be shown.

  • top Number

    The top offset in page coordinates where Toolbar should be shown.

  • direction Number

    The direction of the selection. May be one of the following: CKEDITOR.SELECTION_BOTTOM_TO_TOP or CKEDITOR.SELECTION_TOP_TO_BOTTOM

Returns:

Array:

An Array with left and top offsets in page coordinates.

isVisible

() Boolean

Returns true if the widget is visible, false otherwise

Returns:

Boolean:

True if the widget is visible, false otherwise

moveToPoint

(
  • startPoint
  • endPoint
)

Moves a widget from a starting point to a destination point.

Parameters:

  • startPoint Object

    The starting point for the movement.

  • endPoint Object

    The destination point for the movement.

show

()

Shows the widget with the default animation transition.

updatePosition

()

Updates the widget position based on the current interaction point.

Properties

constrainToViewport

Boolean

Should the widget to be restricted to the viewport, or not.

Default: true

editorEvent

SyntheticEvent

The provided editor event.

gutter

Object

The gutter (vertical and horizontal) between the interaction point and where the widget should be rendered.

Default: { left: 0, top: 10 }