Class EditorKeyHandler

Binds keycodes to action names in an editor. This aggregates an internal handler and extends the implementation of KeyHandler.escape to not only cancel the editing, but also hide the properties dialog and fire an <Editor.escape> event via editor. An instance of this class is created by Editor and stored in Editor.keyHandler.

Bind the delete key to the delete action in an existing editor.

var keyHandler = new EditorKeyHandler(editor);
keyHandler.bindAction(46, 'delete');

This class uses the DefaultKeyHandlerCodec to read configuration data into an existing instance. See DefaultKeyHandlerCodec for a description of the configuration format.

See KeyHandler. An InternalEvent.ESCAPE event is fired via the editor if the escape key is pressed.

Constructors

Properties

Methods

Constructors

Properties

editor: null | Editor = null

Reference to the enclosing Editor.

handler: null | KeyHandler = null

Holds the KeyHandler for key event handling.

Methods

  • Binds the specified keycode to the given action in editor. The optional control flag specifies if the control key must be pressed to trigger the action.

    Parameters

    • code: number

      Integer that specifies the keycode.

    • action: string

      Name of the action to execute in editor.

    • Optionalcontrol: boolean

      Optional boolean that specifies if control must be pressed. Default is false.

    Returns void