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 |
Returns:
The command executed
- Type
- boolean
- Source:
getCommandName() → {string}
#
Get the command name which the sequence will execute
Returns:
Command name
- Type
- string
- Source:
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…) |
Returns:
Message for display
- Type
- string
- Source:
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
Returns:
Symbolic name
- Type
- string
- Source:
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.LinearData | String or linear data |
offset |
number | |
plaintext |
string | Plain text of data |
Returns:
Range corresponding to the match, or else null
- Type
-
ve.Range
|
null
- Source: