Extends
Constructor
new ve.ui.MWTitleCompletionAction(surface, [source])abstract
#
Hierarchy
Children
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 |
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
headerMessagestatic
#
Properties:
| Name | Type | Description |
|---|---|---|
Message |
string
|
null
|
key for the completion menu header |
namespacestatic
#
Properties:
| Name | Type | Description |
|---|---|---|
Namespace |
number
|
undefined
|
to prepend to queries - undefined if none |
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:
getHeaderLabel()
#
getSuggestions()
#
insertCompletion()
#
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
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
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".