Expand all

ve.init.mw.MobileCollabTarget

Extends

Constructor

new ve.init.mw.MobileCollabTarget(title, rebaserUrl, [config]) #

MediaWiki mobile article target.

Parameters:

Name Type Attributes Description
title mw.Title

Page sub-title

rebaserUrl string

Rebaser server URL

config Object optional

Configuration options

Properties:
Name Type Attributes Description
importTitle mw.Title optional

Title to import

Source:
MediaWiki mobile article target.

Methods

clearDocState() #

Clear any stored document state

Inherited from:
Source:
Clear any stored document state

documentReady(doc) #

Handle both DOM and modules being loaded and ready.

Parameters:

Name Type Description
doc HTMLDocument | string

HTML document or source text

Inherited from:
Source:
Handle both DOM and modules being loaded and ready.

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:
Name Type Attributes Description
parameters Object optional

Default query parameters for all API requests. Defaults include action=query, format=json, and formatversion=2 if not specified otherwise.

Inherited from:
Source:

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
Inherited from:
Deprecated:
  • Moved to mw.libs.ve.targetSaver.getHtml
Source:

Returns:

Type
string

getLocalApi([options]) → {mw.Api} #

Get an API object associated with the local wiki.

For example you would always use getLocalApi for actions associated with the current user.

Parameters:

Name Type Attributes Description
options Object optional

API options

Inherited from:
Source:

Returns:

Type
mw.Api
Get an API object associated with the local wiki.

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

Inherited from:
Source:

Returns:

Page name

Type
string
Get the page name associated with a specific document

getSurfaceClasses() → {Array.<string>} #

Get a list of CSS classes to be added to surfaces, and target widget surfaces

Overrides:
Source:

Returns:

CSS classes

Type
Array.<string>
Get a list of CSS classes to be added to surfaces, and target widget surfaces

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

Inherited from:
Source:

Returns:

Abortable promise which resolves with a wikitext string

Type
jQuery.Promise
Get a wikitext fragment from a document

initAutosave([config]) #

Intialise autosave, recovering changes if applicable

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
suppressNotification boolean optional
false

Don't notify the user if changes are recovered

docId string optional

Document ID for storage grouping

storage ve.init.SafeStorage optional

Storage interface

storageExpiry number optional

Storage expiry time in seconds (optional)

Inherited from:
Source:
Intialise autosave, recovering changes if applicable

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

Inherited from:
Source:

Returns:

Abortable promise

Type
jQuery.Promise
Parse a fragment of wikitext into HTML

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

Inherited from:
Source:

Returns:

Promise resolved with new username, or null if anonymous

Type
jQuery.Promise
Refresh our knowledge about the logged-in user.

setupSurface(doc) #

Switch to editing mode.

Parameters:

Name Type Description
doc HTMLDocument | string

HTML document or source text

Inherited from:
Source:
Switch to editing mode.

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

Inherited from:
Source:
Store a snapshot of the current document state.

surfaceReady() #

Once surface is ready, initialize the UI

Inherited from:
Source:

Fires:

Once surface is ready, initialize the UI

track(name) #

Track an event

Parameters:

Name Type Description
name string

Event name

Inherited from:
Source:
Track an event