Interface InputMap<I>

A map that describes bindings from possible input values to editing actions. Usually, the actions are editor commands, but custom actions can be added by subclassing Action and passing the new action to put. The nature of a map's input values is determined by the kind of map. For example, a gestureMap binds keystrokes to actions, while an abbreviationMap binds short letter strings to actions.

Type parameters

  • I

    The type of key (input) accepted by the map.

Hierarchy

  • InputMap

Index

Methods

addDefaults

  • addDefaults(): void
  • Adds the default binding for all built-in commands. To reset the map to its initial state, first call clear.

    Returns void

clear

  • clear(): void
  • Clears the map of all input value bindings.

    Returns void

contains

  • contains(input: I): boolean
  • Returns whether the map contains a binding for the specified input value.

    Parameters

    • input: I

      The input value.

    Returns boolean

    Returns true if the input value is mapped to a command or custom action.

getDefaultFor

  • Returns the default input value that maps to the specified command, or null if the command has no default. For example, in an abbreviation map, this would return the default abbreviation for the command. Throws an Error if the command name is invalid.

    throws

    TypeError If the command is not a valid command name.

    Parameters

    • command: EditorCommand

      The name of the built-in command to look up.

    Returns string

    An input string that (unless replaced or removed) maps to the specified command, or null if none.

keys

  • keys(): I[]
  • Returns an array of the keys of the input map.

    Returns I[]

    Input values that map to a command or action.

put

  • Binds the specified input value to a custom Action instance. When the view receives a matching input value from the user, it will apply the action if possible.

    throws

    TypeError If the input format is not valid or the action is not an Action instance.

    Parameters

    • input: I

      The input value.

    • customAction: Action

      The action to perform when the user produces the gesture.

    Returns void

  • Binds the specified input value to the command with the specified name. When the view receives a matching input value from the user, it will apply the command if possible. Throws an Error if the string is not a valid command name.

    throws

    TypeError If the input format is not valid or the command name is not a valid command.

    Parameters

    Returns void

remove

  • remove(input: I): void
  • Clears the binding, if any, for the specified input value. Mapping an input to null has the same effect.

    Parameters

    • input: I

      The input value.

    Returns void

removeCommand

  • Removes all bindings for inputs that map to the specified command. This will block access to the command through the input map unless a new mapping is created later. In some cases, however, it may not completely block all access to the effect of the command. For example, to completely block a command's effect in the abbreviation map, it may be neccessary to also remove one or more of the built-in mapping functions such as .magicPowers.

    Parameters

    • command: EditorCommand

      The command to remove from the input map.

    Returns void

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.