Expand all

ve.ui.Command

Constructor

new ve.ui.Command(name, action, method, [options]) #

Parameters:

Name Type Attributes Description
name string

Symbolic name for the command

action string

Action to execute when command is triggered

method string

Method to call on action when executing

options Object optional
Properties:
Name Type Attributes Description
supportedSelections Array.<string> | null optional

List of supported selection types, or null for all

args Array optional

Additional arguments to pass to the action when executing

Source:
Command that executes an action.

Methods

execute(surface, [args], [source]) → {boolean} #

Execute command on a surface.

Parameters:

Name Type Attributes Description
surface ve.ui.Surface

Surface to execute command on

args Array optional

Custom arguments to override defaults

source string optional

Label for the source of the command. One of 'trigger', 'sequence', 'tool', or 'context'

Source:

Returns:

Command was executed

Type
boolean
Execute command on a surface.

getAction() → {string} #

Get command action.

Source:

Returns:

action Action to execute when command is triggered

Type
string
Get command action.

getArgs() → {Array} #

Get command arguments.

Source:

Returns:

args Additional arguments to pass to the action when executing

Type
Array
Get command arguments.

getMethod() → {string} #

Get command method.

Source:

Returns:

method Method to call on action when executing

Type
string
Get command method.

getName() → {string} #

Get command name.

Source:

Returns:

name The symbolic name of the command.

Type
string
Get command name.

isExecutable(fragment) → {boolean} #

Check if this command is executable on a given surface fragment

Parameters:

Name Type Description
fragment ve.dm.SurfaceFragment

Surface fragment

Source:

Returns:

The command can execute on this fragment

Type
boolean
Check if this command is executable on a given surface fragment