Report an issue
Class

CKEDITOR.plugins.undo.KeyEventsStack

class since 4.4.5 private

This class represents a stack of pressed keys and stores information about how many input events each key press has caused.

Filtering

Properties

  • readonly

    stack : Array

    Defaults to []

Methods

  • constructor() → KeyEventsStack

    Returns

    KeyEventsStack
  • cleanUp( event )

    Cleans the stack based on a provided keydown event object. The rationale behind this method is that some keystrokes cause the keydown event to be fired in the editor, but not the keyup event. For instance, Alt+Tab will fire keydown, but since the editor is blurred by it, then there is no keyup, so the keystroke is not removed from the stack.

    Parameters

    event : event
  • getLast( [ keyCode ] ) → Object

    Returns the last key recorded in the stack. If keyCode is provided, then it will return the last record for this keyCode.

    Parameters

    [ keyCode ] : Number

    Returns

    Object

    Last matching record or null.

  • getLastIndex( [ keyCode ] ) → Number

    Returns the index of the last registered keyCode in the stack. If no keyCode is provided, then the function will return the index of the last item. If an item is not found, it will return -1.

    Parameters

    [ keyCode ] : Number

    Returns

    Number
  • getTotalInputs() → Number

    Sums up inputs number for each key code and returns it.

    Returns

    Number
  • increment( keyCode )

    Increments registered input events for stack record for a given keyCode.

    Parameters

    keyCode : Number
  • push( keyCode )

    Pushes a literal object with two keys: keyCode and inputs (whose initial value is set to 0) to stack. It is intended to be called on the keydown event.

    Parameters

    keyCode : Number
  • remove( keyCode )

    Removes the last record from the stack for the provided keyCode.

    Parameters

    keyCode : Number
  • resetInputs( [ keyCode ] )

    Resets the inputs value to 0 for a given keyCode or in entire stack if a keyCode is not specified.

    Parameters

    [ keyCode ] : Number