Extends
Constructor
new ve.ui.MWTagCompletionAction(surface, [source])
#
Autocompletion of HTML, parser and extension tags in wikitext source mode,
triggered by typing "<". The chosen tag is inserted as a matching pair (or self-closing,
for void tags like
) with the caret placed ready for typing: between the
tags (e.g. |) or inside an empty attribute value
(e.g.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
surface |
ve.ui.Surface | Surface to act on |
|
source |
string |
optional |
Autocompletion of HTML, parser and extension tags in wikitext source mode, triggered by typing "<".
Properties
extensionTagsstatic
#
Tags provided by extensions, offered ahead of the plain HTML tags. Each entry is an object with:
name: the tag name, matched against the user's inputnode: optional name of anode class that must be registered for the tag to be offeredve.dmmodule: optional name of a ResourceLoader module that must be registered for the tag to be offeredattributes: optional attributes for the opening tag. If any value is empty the caret is placed inside it, otherwise between the opening and closing tags.selfClosing: set for void tags (e.g.), which are inserted without a closing tag.
Properties:
htmlTagsstatic
#
Plain HTML tags to offer: the set of HTML tags permitted by the MediaWiki parser.
Properties:
| Type | Description |
|---|---|
| Array.<string> |
Plain HTML tags to offer: the set of HTML tags permitted by the MediaWiki parser.
parserTagsstatic
#
Parser tags built in to MediaWiki: always available, and always a matching pair.
Properties:
| Type | Description |
|---|---|
| Array.<string> |
Parser tags built in to MediaWiki: always available, and always a matching pair.
voidHtmlTagsstatic
#
The subset of #static-htmlTags that are void, inserted self-closing rather than as a pair.
Properties:
| Type | Description |
|---|---|
| Array.<string> |
The subset of #static-htmlTags that are void, inserted self-closing rather than as a pair.
Methods
compareSuggestionToInput()
#
getMenuItemForSuggestion()
#
getOpenTag(suggestion) → {string}
#
Build the opening tag for a suggestion, including any attributes.
Parameters:
| Name | Type | Description |
|---|---|---|
suggestion |
Object | Tag descriptor |
Returns:
e.g. '
- Type
- string
getSuggestions()
#
getTags() → {Array.<Object>}
#
Get the tag descriptors available in the current context: the parser and extension tags followed by the plain HTML tags, dropping any that are unavailable (see #static-extensionTags).
Returns:
Available tag descriptors, in preference order
Get the tag descriptors available in the current context: the parser and extension tags followed by the plain HTML tags, dropping any that are unavailable (see #static-extensionTags).