Class: Command

Command()

The base class of all commands.

Constructor

new Command()

Source:

Classes

Command

Members

commandName :string

Get the commandName property of this command: the name of this command.
Type:
  • string
Source:

Methods

(static) consumeEvent()

Consume specified event (if not null).

Helper used to implement commands.

Source:

(static) joinCmdString(cmdName, cmdParam, separ) → {string}

Returns a string representation of the invocation of the command having specified name, specified parameters (may be null) and using specified name/parameters separator.
Parameters:
Name Type Description
cmdName string command name.
cmdParam string command parameters.
separ string name/parameters separator char.
Source:
See:
Returns:
a command string or null for an unusable command name.
Type
string

(static) splitCmdString(cmdString, separ) → {array}

Inverse of Command.joinCmdString.
Parameters:
Name Type Description
cmdString string command string.
separ string name/parameters separator char.
Source:
Returns:
array [command_name, command_parameters]; both array elements are null if command string is unusable.
Type
array

execute(mode, docView, params, eventopt) → {Promise}

Tests the execution or actually executes this command with specified parameter in current editing context after being trigerred by specified event.
Parameters:
Name Type Attributes Default Description
mode number specifies how this command is to be executed.
docView DocumentView the target of this command
params string parameterizes the command (that is, modifies the behavior of the command in a command specific way). May be null.
event UIEvent <optional>
null the keyboard or event which triggered this command. May be null.
Source:
Returns:
A Promise containing:
  • If mode is EXECUTE_TEST, true if the command can be executed, false otherwise.

    Default implementation does not consume specified event (if any) and returns false.

  • If mode is EXECUTE_HELPER or EXECUTE_NORMAL, null if for any reason (e.g. unknown remote command), this command has not been executed; a CommandResult otherwise.

    Default implementation consumes specified event (if any) and returns CommandResult.FAILED.

Type
Promise

getCommandString()

Returns a string representation of the invocation of this command with specified parameters.
Source: