Expand all

ve.ui.MWTagCompletionAction

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
Source:

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 input
  • node: optional name of a ve.dm node class that must be registered for the tag to be offered
  • module: optional name of a ResourceLoader module that must be registered for the tag to be offered
  • attributes: 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:

Type Description
Array.<Object>
Source:
Tags provided by extensions, offered ahead of the plain HTML tags.

htmlTagsstatic #

Plain HTML tags to offer: the set of HTML tags permitted by the MediaWiki parser.

Properties:

Type Description
Array.<string>
Source:

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>
Source:

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>
Source:

The subset of #static-htmlTags that are void, inserted self-closing rather than as a pair.

Methods

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
Source:
Build the opening tag for a suggestion, including any attributes.

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

Type
Array.<Object>
Source:

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).