new mw.widgets.TitleWidget(configopt)abstract
#
Mixin for title widgets.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
<optional> |
Configuration options Properties
|
Methods
createOptionWidget(data) → {OO.ui.MenuOptionWidget}
#
Create a menu option widget with specified data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Data for option widget |
Returns:
Data for option widget
getApiParams(query) → {Object}
#
Get API params for a given query.
Parameters:
Name | Type | Description |
---|---|---|
query |
string | User query |
Returns:
API params
- Type
- Object
getMWTitle(valueopt) → {mw.Title|null
}
#
null
}
#
Get title object corresponding to given value, or #getQueryValue if not given.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string |
<optional> |
Value to get a title for |
Returns:
Title object, or null if value is invalid
- Type
-
mw.Title
|
null
getNamespace() → {number|null
}
#
null
}
#
Get the namespace to prepend to titles in suggestions, if any.
Returns:
Namespace number
- Type
-
number
|
null
getOptionWidgetData(title, data) → {Object}
#
Get menu option widget data from the title and page data.
Parameters:
Name | Type | Description |
---|---|---|
title |
string | Title object |
data |
Object | Page data |
Returns:
Data for option widget
- Type
- Object
getOptionsFromData(data) → {Array.<OO.ui.OptionWidget>}
#
Get option widgets from the server response.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Query result |
Returns:
Menu items
- Type
- Array.<OO.ui.OptionWidget>
getQueryValue() → {string}abstract
#
Get the current value of the search query.
Returns:
Search query
- Type
- string
getSectionSuggestions(title, fragmentQuery) → {jQuery.Promise}
#
Suggest link fragments from the sections API.
Parameters:
Name | Type | Description |
---|---|---|
title |
string | Title, extracted form the user input |
fragmentQuery |
string | Partial link fragment, from the user input |
Returns:
Suggestions promise
- Type
- jQuery.Promise
getSuggestionsPromise() → {jQuery.Promise}
#
Get a promise which resolves with an API response for suggested links for the current query.
Returns:
Suggestions promise
- Type
- jQuery.Promise
Get a promise which resolves with an API response for suggested links for the current query.
isQueryValid() → {boolean}
#
Check if the query is valid.
Returns:
The query is valid
- Type
- boolean
setNamespace(namespace)
#
Set the namespace to prepend to titles in suggestions, if any.
Parameters:
Name | Type | Description |
---|---|---|
namespace |
number
|
null
|
Namespace number |