Class: EditorGateway

EditorGateway(options)

new EditorGateway(options)

API that helps save and retrieve page content

Parameters:
Name Type Description
options Object

Configuration options

Properties
Name Type Attributes Description
api mw.Api

an Api to use.

title string

the title to edit

sectionId string | null

the id of the section to operate edits on.

oldId number <optional>

revision to operate on. If absent defaults to latest.

fromModified boolean <optional>

whether the page was loaded in a modified state

preload string <optional>

the name of a page to preload into the editor

preloadparams Array <optional>

parameters to prefill into the preload content

editintro string <optional>

edit intro to add to notices

Source:

Methods

(static) getBlockInfo(pageObj) → {Object|null}

Get the block (if there is one) from the result.

Parameters:
Name Type Description
pageObj Object

Page object

Source:
Returns:
Type
Object | null

abortPreview()

Abort any pending previews.

Source:

getContent() → {jQuery.Promise}

Get the content of a page.

Source:
Returns:
Type
jQuery.Promise

getPreview(options) → {jQuery.Deferred}

Get page preview from the API and abort any existing previews.

Parameters:
Name Type Description
options Object

API query parameters

Source:
Returns:
Type
jQuery.Deferred

save(options) → {jQuery.Deferred}

Save the new content of the section, previously set using #setContent.

Parameters:
Name Type Description
options Object

Configuration options

Properties
Name Type Attributes Description
summary string <optional>

Optional summary for the edit.

captchaId string <optional>

If CAPTCHA was requested, ID of the captcha.

captchaWord string <optional>

If CAPTCHA was requested, term displayed in the CAPTCHA.

Source:
Returns:

On failure callback is passed an object with type and details properties. type is a string describing the type of error, details can be any object (usually error message).

Type
jQuery.Deferred

setContent(content)

Mark content as modified and set changes to be submitted when #save is invoked.

Parameters:
Name Type Description
content string

New section content.

Source: