Constructor
new ve.ui.Sequence(name, commandName, data, [strip], [config])
#
Key sequence.
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | Symbolic name |
|||||||||||||||||||||||||||
commandName |
string | Command name this sequence executes |
|||||||||||||||||||||||||||
data |
string | Array | RegExp | Data to match. String, linear data array, or regular expression. When using a RegularExpression always match the end of the sequence with a '$' so that only sequences next to the user's cursor match. |
|||||||||||||||||||||||||||
strip |
number |
optional |
0 | Number of data elements to strip after execution (from the right) |
|||||||||||||||||||||||||
config |
Object |
optional |
[description] Properties:
|
- Source:
Methods
execute(surface, range) → {boolean}
#
Execute the command associated with the sequence
Parameters:
Name | Type | Description |
---|---|---|
surface |
ve.ui.Surface | |
range |
ve.Range | Range to set |
- Source:
Returns:
The command executed
- Type
- boolean
getCommandName() → {string}
#
Get the command name which the sequence will execute
- Source:
Returns:
Command name
- Type
- string
getMessage(explode) → {string}
#
Get a representation of the sequence useful for display
What this means depends a bit on how the sequence was defined:
- It strips out undisplayable things like the paragraph-start marker.
- Regexps are just returned as a toString of the regexp.
Parameters:
Name | Type | Description |
---|---|---|
explode |
boolean | Whether to return the message split up into some reasonable sequence of inputs required to trigger the sequence (regexps in sequences will be considered a single "input" as a toString of the regexp, because they're hard to display no matter what…) |
- Source:
Returns:
Message for display
- Type
- string
Get a representation of the sequence useful for display
What this means depends a bit on how the sequence was defined:
- It strips out undisplayable things like the paragraph-start marker.
getName() → {string}
#
Get the symbolic name of the sequence
- Source:
Returns:
Symbolic name
- Type
- string
match(data, offset, plaintext) → {ve.Range|null
}
#
null
}
#
Check if the sequence matches a given offset in the data
Parameters:
Name | Type | Description |
---|---|---|
data |
ve.dm.ElementLinearData | String or linear data |
offset |
number | |
plaintext |
string | Plain text of data |
- Source:
Returns:
Range corresponding to the match, or else null
- Type
-
ve.Range
|
null