Expand all

ve.ui.MWTemplateCompletionAction

Extends

Constructor

new ve.ui.MWTemplateCompletionAction(surface, [source]) #

Autocompletion of template transclusions in source mode, triggered by typing "{{".

Parameters:

Name Type Attributes Description
surface ve.ui.Surface

Surface to act on

source string optional
Source:
Autocompletion of template transclusions in source mode, triggered by typing "{{".

Properties

getInsertionTextprotected #

Build the wikitext to insert for a chosen suggestion

Overrides:
Source:
Build the wikitext to insert for a chosen suggestion

Methods

createTitleWidget(config) → {mw.widgets.TitleInputWidget}protected #

Create the widget whose search logic this action reuses

Parameters:

Name Type Description
config Object

Configuration options for the widget

Returns:

Type
mw.widgets.TitleInputWidget
Overrides:
Source:
Create the widget whose search logic this action reuses

prepareSearch(input) → {string}protected #

Prepare the search for an input, and get the leading syntax the search leaves out

A leading colon says "not the default namespace". It is not part of the title, and the search finds nothing for a query that starts with one, e.g. ":Category:Foo". A subclass adds the syntax it knows in front of this, in the order the wikitext uses.

Parameters:

Name Type Description
input string

Returns:

Start of the input to put back in front of each suggestion

Type
string
Overrides:
Source:

Prepare the search for an input, and get the leading syntax the search leaves out

A leading colon says "not the default namespace".

restoreTypedNamespace(suggestion, query) → {string}protected #

Put a namespace prefix back the way it was typed

The search answers with canonical titles, so a query for "Image:Foo" comes back as "File:Foo". Keep the prefix the user chose. This also keeps the correct name for a namespace that has a gendered form.

Parameters:

Name Type Description
suggestion string

Suggestion from the title widget

query string

Query the suggestion was found for, without a leading colon

Returns:

Type
string
Inherited from:
Source:

Put a namespace prefix back the way it was typed

The search answers with canonical titles, so a query for "Image:Foo" comes back as "File:Foo".

setSearchNamespace(query)private #

Point the search at the namespace the query names

A transclusion is from the template namespace unless the wikitext names another one, as in "{{Help:Foo}}" or "{{:Article}}". A search of the template namespace finds nothing for those.

Parameters:

Name Type Description
query string

Query, without a {{subst:...}} magic word

Source:

Point the search at the namespace the query names

A transclusion is from the template namespace unless the wikitext names another one, as in "{{Help:Foo}}" or "{{:Article}}".