Expand all

abstract ve.ui.MWTitleCompletionAction

Extends

Constructor

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

Base class for source-mode completion actions that suggest page titles from a search query, e.g. wikilinks and template transclusions.

Parameters:

Name Type Attributes Description
surface ve.ui.Surface

Surface to act on

source string optional
Source:

Base class for source-mode completion actions that suggest page titles from a search query, e.g.

Properties

getInsertionTextabstractprotected #

Build the wikitext to insert for a chosen suggestion

Source:
Build the wikitext to insert for a chosen suggestion

headerMessagestatic #

Properties:

Name Type Description
Message string | null

key for the completion menu header

Source:

namespacestatic #

Properties:

Name Type Description
Namespace number | undefined

to prepend to queries - undefined if none

Source:

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