Extends
Constructor
new ve.ui.LinkAction(surface, [source])
#
Hierarchy
Link action. This action transforms or inspects links (or potential links).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
surface |
ve.ui.Surface | Surface to act on |
|
source |
string |
optional |
Properties
autolinkRegExpprivatestatic
#
Properties:
Name | Type | Description |
---|---|---|
RegExp |
RegExp | matching an autolink + trailing space. |
Methods
autolink(validateFunc, [txFunc]) → {boolean}private
#
Autolink the selection, which may have trailing whitespace.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
validateFunc |
function | A function used to validate the given linktext. Properties:
|
||||||||||||||||
txFunc |
function |
optional |
An optional function to create a transaction to perform the autolink.
If not provided, a transaction will be created which applies the
annotations returned by Properties:
|
Returns:
Selection was valid and link action was executed.
- Type
- boolean
autolinkUrl() → {boolean}
#
Autolink the selected URL (which may have trailing whitespace).
Returns:
True if the selection is a valid URL and the autolink action was executed; otherwise false.
- Type
- boolean
getLinkAnnotation(linktext) → {ve.dm.LinkAnnotation}
#
Return an appropriate annotation for the given link text.
Parameters:
Name | Type | Description |
---|---|---|
linktext |
string | The link text to annotate. |
Returns:
The annotation to use.
- Type
- ve.dm.LinkAnnotation
getTrailingPunctuation(candidate) → {RegExp}
#
Return an appropriate "trailing punctuation" set, which will get stripped from possible autolinks.
Parameters:
Name | Type | Description |
---|---|---|
candidate |
string | The candidate text. Some users may not wish to include closing brackets/braces/parentheses in the stripped character class if an opening bracket/brace/parenthesis in present in the candidate link text. |
Returns:
A regular expression matching trailing punctuation which will be stripped from an autolink.
- Type
- RegExp
Return an appropriate "trailing punctuation" set, which will get stripped from possible autolinks.