Report an issue
Class

TwoStepCaretHandler (engine/utils)

@ckeditor/ckeditor5-engine/src/utils/bindtwostepcarettoattribute

class private

This is a private helper–class for bindtwostepcarettoattribute. It handles the state of the 2-step caret movement for a single Model attribute upon the keypress in the View.

Filtering

Properties

  • attribute : String

    readonly

    The Attribute this class instance operates on.

  • model : Model#schema

    readonly

    The model instance this class instance operates on.

  • _hasSelectionAttribute : Boolean

    private readonly

    true when the Selection has the attribute.

  • _isGravityOverridden : Boolean

    private readonly

    true when the gravity is overridden for the attribute.

  • _isNextGravityRestorationSkipped : String

    private

    A flag indicating that the automatic gravity restoration for this attribute should not happen upon the next event-change:range event.

  • _modelSelection : Selection

    private

    A reference to the document selection.

  • _overrideUid : String

    private

    The current UID of the overridden gravity, as returned by overrideSelectionGravity.

Methods

  • handleBackwardMovement( position, data ) → Boolean

    Updates the document selection and the view according to the two–step caret movement state when moving backwards. Executed upon keypress in the View.

    Parameters

    position : Position

    The model position at the moment of the key press.

    data : DomEventData

    Data of the key press.

    Returns

    Boolean

    true when the handler prevented caret movement

  • handleForwardMovement( position, data ) → Boolean

    Updates the document selection and the view according to the two–step caret movement state when moving forwards. Executed upon keypress in the View.

    Parameters

    position : Position

    The model position at the moment of the key press.

    data : DomEventData

    Data of the key press.

    Returns

    Boolean

    true when the handler prevented caret movement

  • _overrideGravity()

    private

    Overrides the gravity using the model writer and stores the information about this fact in the _overrideUid.

    A shorthand for overrideSelectionGravity.

  • _preventCaretMovement()

    private

    Prevents the caret movement in the view by calling preventDefault on the event data.

  • _removeSelectionAttribute()

    private

    Removes the attribute from the selection using using the model writer.

  • _restoreGravity()

    private

    Restores the gravity using the model writer.

    A shorthand for restoreSelectionGravity.

  • _setSelectionAttributeFromTheNodeBefore( position )

    private

    Applies the attribute to the current selection using using the value from the node before the current position. Uses the model writer.

    Parameters

    position : Position
  • _skipNextAutomaticGravityRestoration()

    private

    Skips the next automatic selection gravity restoration upon the event-change:range event.