Autocomplete

Autocomplete

Autocomplete dropdown class.

Constructor

new Autocomplete(options)

Source:

Create an autocomplete instance. An instance is a set of settings and inputs to which these settings apply.

Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
types Array.<('mentions'|'commentLinks'|'wikilinks'|'templates'|'tags')>

Which values should be autocompleted.

inputs Array.<external:TextInputWidget>

Inputs to attach the autocomplete to. Please note that these should be CD's TextInputWidgets, not OO.ui.TextInputWidgets, since we use some CD's methods on the inputs here (TextInputWidget#cdFocus, TextInputWidget#cdInsertContent). This is not essential, so if you borrow the source code, you can replace them with native OO.ui.TextInputWidget#focus and OO.ui.TextInputWidget#insertContent.

comments Array.<string> <optional>

List of comments in the section for the mentions and comment links autocomplete.

defaultUserNames Array.<string> <optional>

Default list of user names for the mentions autocomplete.

Members

tribute :Tribute

Source:

Tribute object.

Type:
  • Tribute

Methods

(static) getActiveMenu() → {Element}

Source:

Get the active autocomplete menu element.

Returns:
Type
Element

(static) getConfig(type, …args) → {object}

Source:

For internal use. Get an autocomplete configuration for the specified type.

Parameters:
Name Type Attributes Description
type string
args * <repeatable>
Returns:
Type
object

(static) getRelevantPageNames(text) → {Promise.<Array.<string>>}

Source:

Get a list of 10 page names matching the specified search text. Page names are sorted as OpenSearch sorts them. Redirects are not resolved.

Reuses the existing request if available.

Parameters:
Name Type Description
text string
Throws:
Returns:
Type
Promise.<Array.<string>>

(static) getRelevantTemplateNames(text) → {Promise.<Array.<string>>}

Source:

Get a list of 10 template names matching the specified search text. Template names are sorted as OpenSearch sorts them. Redirects are not resolved.

Reuses the existing request if available.

Parameters:
Name Type Description
text string
Throws:
Returns:
Type
Promise.<Array.<string>>

(static) getRelevantUserNames(text) → {Promise.<Array.<string>>}

Source:

Get a list of 10 user names matching the specified search text. User names are sorted as OpenSearch sorts them. Only users with a talk page existent are included. Redirects are resolved.

Reuses the existing request if available.

Parameters:
Name Type Description
text string
Throws:
Returns:
Type
Promise.<Array.<string>>

cleanUp()

Source:

Clean up event handlers.

init()

Source:

Initialize autocomplete for the inputs.