Methods
addPlugin(plugin)static
#
Add a plugin module or callback.
If a module name is passed, that module will be loaded alongside the other modules.
If a callback is passed, it will be executed after the modules have loaded. The callback may optionally return a jQuery.Promise; if it does, loading won't be complete until that promise is resolved.
Parameters:
Name | Type | Description |
---|---|---|
plugin |
string | function | Plugin module name or callback |
createCheckboxFields(checkboxesDef, [widgetConfig]) → {Object}static
#
Creates an OOUI checkbox inside an inline field layout
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
checkboxesDef |
Array.<Object> | Checkbox definitions from the API |
|
widgetConfig |
Object |
optional |
Additional widget config |
Returns:
Result object with checkboxFields (OO.ui.FieldLayout[]) and checkboxesByName (keyed object of OO.ui.CheckboxInputWidget).
- Type
- Object
loadModules(mode) → {jQuery.Promise}static
#
Load modules needed for VisualEditor, as well as plugins.
This loads the base VE modules as well as any registered plugin modules. Once those are loaded, any registered plugin callbacks are executed, and we wait for all promises returned by those callbacks to resolve.
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | Initial editor mode, for tracking |
Returns:
Promise resolved when the loading process is complete
- Type
- jQuery.Promise
requestPageData(mode, pageName, [options]) → {jQuery.Promise}static
#
Request the page data and various metadata from the MediaWiki API (which will use Parsoid or RESTBase).
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mode |
string | Target mode: 'visual' or 'source' |
|||||||||||||||||||||||||||||||||||||||||
pageName |
string | Page name to request, in prefixed DB key form (underscores instead of spaces) |
|||||||||||||||||||||||||||||||||||||||||
options |
Object |
optional |
Properties:
|
Returns:
Abortable promise resolved with a JSON object
- Type
- jQuery.Promise
Request the page data and various metadata from the MediaWiki API (which will use Parsoid or RESTBase).
requestParsoidData(pageName, [options], [noRestbase], [noMetadata]) → {jQuery.Promise}static
#
Request the page HTML and various metadata from the MediaWiki API (which will use Parsoid or RESTBase).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pageName |
string | See #requestPageData |
||
options |
Object |
optional |
See #requestPageData |
|
noRestbase |
boolean |
optional |
false | Don't query RESTBase directly |
noMetadata |
boolean |
optional |
false | Don't fetch document metadata when querying RESTBase. Metadata is not required for some use cases, e.g. diffing. |
Returns:
Abortable promise resolved with a JSON object
- Type
- jQuery.Promise
Request the page HTML and various metadata from the MediaWiki API (which will use Parsoid or RESTBase).
requestWikitext(pageName, [options]) → {jQuery.Promise}static
#
Request the page wikitext and various metadata from the MediaWiki API.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pageName |
string | See #requestPageData |
|
options |
Object |
optional |
See #requestPageData |
Returns:
Abortable promise resolved with a JSON object
- Type
- jQuery.Promise