Extends
Properties
integrationTypestatic
#
Type of integration. Used for event tracking.
Properties:
Type | Description |
---|---|
string |
namestatic
#
Symbolic name for this target class.
Properties:
Type | Description |
---|---|
string |
platformTypestatic
#
Type of platform. Used for event tracking.
Properties:
Type | Description |
---|---|
string |
Methods
addSurface()
#
clearDocState()
#
Clear any stored document state
createSurface()
#
createTargetWidget()
#
documentReady(doc)
#
Handle both DOM and modules being loaded and ready.
Parameters:
Name | Type | Description |
---|---|---|
doc |
HTMLDocument | string | HTML document or source text |
getContentApi([doc], [options]) → {mw.Api}
#
Get an API object associated with the wiki where the document content is hosted.
This would be overridden if editing content on another wiki.
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
doc |
ve.dm.Document |
optional |
API for a specific document, should default to document of current surface. |
||||||||
options |
Object |
optional |
API options Properties:
|
Returns:
- Type
- mw.Api
Get an API object associated with the wiki where the document content is hosted.
getHtml(newDoc, [oldDoc]) → {string}
#
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newDoc |
HTMLDocument | ||
oldDoc |
HTMLDocument |
optional |
- Deprecated:
- Moved to mw.libs.ve.targetSaver.getHtml
- Source:
Returns:
- Type
- string
getLocalApi([options]) → {mw.Api}
#
getPageName([doc]) → {string}
#
Get the page name associated with a specific document
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doc |
ve.dm.Document |
optional |
Document, defaults to current surface's |
Returns:
Page name
- Type
- string
getSurfaceClasses() → {Array.<string>}
#
Get a list of CSS classes to be added to surfaces, and target widget surfaces
Returns:
CSS classes
- Type
- Array.<string>
getSurfaceConfig()
#
getWikitextFragment(doc, [useRevision]) → {jQuery.Promise}
#
Get a wikitext fragment from a document
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
doc |
ve.dm.Document | |||
useRevision |
boolean |
optional |
true | Whether to use the revision ID + ETag |
Returns:
Abortable promise which resolves with a wikitext string
- Type
- jQuery.Promise
initAutosave([config])
#
Intialise autosave, recovering changes if applicable
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
optional |
Configuration options Properties:
|
parseWikitextFragment(wikitext, pst, [doc]) → {jQuery.Promise}
#
Parse a fragment of wikitext into HTML
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
wikitext |
string | ||
pst |
boolean | Perform pre-save transform |
|
doc |
ve.dm.Document |
optional |
Parse for a specific document, defaults to current surface's |
Returns:
Abortable promise
- Type
- jQuery.Promise
refreshUser([doc]) → {jQuery.Promise}
#
Refresh our knowledge about the logged-in user.
This should be called in response to a user assertion error, to look up the new user name, and update the current user variables in mw.config.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doc |
ve.dm.Document |
optional |
Document to associate with the API request |
Returns:
Promise resolved with new username, or null if anonymous
- Type
- jQuery.Promise
setSurface()
#
setupSurface(doc)
#
Switch to editing mode.
Parameters:
Name | Type | Description |
---|---|---|
doc |
HTMLDocument | string | HTML document or source text |
storeDocState([html])
#
Store a snapshot of the current document state.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
html |
string |
optional |
Document HTML, will generate from current state if not provided |
surfaceReady()
#
Once surface is ready, initialize the UI
Fires:
teardown()
#
track(name)
#
Track an event
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Event name |
createModelFromDom()static
#
fixBase(doc)static
#
Fix the base URL from Parsoid if necessary.
Absolutizes the base URL if it's relative, and sets a base URL based on wgArticlePath if there was no base URL at all.
Parameters:
Name | Type | Description |
---|---|---|
doc |
HTMLDocument | Parsoid document |
parseDocument(documentString, mode, [section], [onlySection]) → {HTMLDocument|string}static
#
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
documentString |
string | |||
mode |
string | |||
section |
string
|
null
|
optional |
Section. Use null to unwrap all sections. |
|
onlySection |
boolean |
optional |
false | Only return the requested section, otherwise returns the whole document with just the requested section still wrapped (visual mode only). |
Returns:
HTML document, or document string (source mode)
- Type
- HTMLDocument | string