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 number

the id of the section to operate edits on.

oldId number <optional>

revision to operate on. If absent defaults to latest.

isNewPage boolean <optional>

whether the page being created is new

Source:

Methods

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

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

Parameters:
Name Type Description
pageObj 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:

setPrependText(text)

Mark content as modified and set text that should be prepended to given section when #save is invoked.

Parameters:
Name Type Description
text string

Text to be prepended.

Source: