Extends
Methods
getCode() → {string}
#
Return the numeric code associated with this magic link node.
Returns:
- Type
- string
getHref() → {string}
#
Return the link target appropriate for this magic link node.
Returns:
Link href
- Type
- string
getMagicType() → {string}
#
Return the type of this magic link node: one of "RFC", "PMID", or "ISBN".
Returns:
Magic link type
- Type
- string
getRel() → {string}
#
Return the rel attribute appropriate for this magic link node.
Returns:
Either "mw:ExtLink" or "mw:WikiLink"
- Type
- string
getHref()static
#
annotationFromContent(content) → {ve.dm.MWExternalLinkAnnotation|ve.dm.MWInternalLinkAnnotation|null
}static
#
null
}static
#
Return a link annotation appropriate for converting a magic link
with the given content into a simple link, or null
if the given
content is not a valid magic link.
Parameters:
Name | Type | Description |
---|---|---|
content |
string |
Returns:
- Type
-
ve.dm.MWExternalLinkAnnotation
|
ve.dm.MWInternalLinkAnnotation
|
null
Return a link annotation appropriate for converting a magic link
with the given content into a simple link, or null
if the given
content is not a valid magic link.
matchFunction(element) → {boolean}static
#
Determine whether the given element
is a magic link.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement |
Returns:
True if the element is a magic link
- Type
- boolean
element
is a magic link.
toDataElement()static
#
toDomElements()static
#
validateContent(content, [optType]) → {boolean}static
#
Test that a proposed content string is valid for a magic link.
If optType
is given, additionally verify that the content string is
valid for the particular type of magic link (RFC/ISBN/PMID).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
content |
string | The content string to test. |
|
optType |
string |
optional |
The desired type of magic link, one of "RFC", "ISBN", or "PMID". If not supplied, returns true if the content is valid for any one of these. |
Returns:
True if the content string is valid for a magic link of the appropriate type (or any type).
- Type
- boolean
validateHref(content, href) → {boolean}static
#
Test that a proposed content string and href is valid for a magic link.
Parameters:
Name | Type | Description |
---|---|---|
content |
string | The content string to test. |
href |
string | The URL target of the magic link. |
Returns:
True if the content string and href are valid for a magic link.
- Type
- boolean