TwoStepCaretHandler (engine/utils)
@ckeditor/ckeditor5-engine/src/utils/bindtwostepcarettoattribute
This is a protected 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 : Stringreadonly
The Attribute this class instance operates on.
-
model : Model#schemareadonly
The model instance this class instance operates on.
-
_hasSelectionAttribute : Booleanprivate readonly
-
_isGravityOverridden : Booleanprivate readonly
truewhen the gravity is overridden for theattribute. -
_isNextGravityRestorationSkipped : Stringprivate
A flag indicating that the automatic gravity restoration for this attribute should not happen upon the next
event-change:rangeevent. -
_modelSelection : Selectionprivate
A reference to the document selection.
-
_overrideUid : Stringprivate
The current UID of the overridden gravity, as returned by
overrideSelectionGravity.
Methods
-
handleBackwardMovement( position, data ) → BooleanUpdates the document selection and the view according to the two–step caret movement state when moving backwards. Executed upon
keypressin theView.Parameters
position : PositionThe model position at the moment of the key press.
data : DomEventDataData of the key press.
Returns
Booleantruewhen the handler prevented caret movement
-
handleForwardMovement( position, data ) → BooleanUpdates the document selection and the view according to the two–step caret movement state when moving forwards. Executed upon
keypressin theView.Parameters
position : PositionThe model position at the moment of the key press.
data : DomEventDataData of the key press.
Returns
Booleantruewhen 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
preventDefaulton the event data. -
_removeSelectionAttribute()private
Removes the
attributefrom 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
attributeto 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:rangeevent.