Expand all

EditorOverlayBase

Constructor

new EditorOverlayBase(params) #

Parameters:

Name Type Description
params Object

Configuration options

Properties:
Name Type Description
editSwitcher boolean

whether possible to switch mode in header

hasToolbar boolean

whether the editor has a toolbar

Source:

Properties

defaults #

Properties:

Name Type Description
defaults Object

Default options hash.

Properties:
Name Type Description
overlayManager OverlayManager

instance

api mw.Api

to interact with

hasToolbar boolean

Whether the editor has a toolbar or not. When disabled a header will be show instead.

continueMsg string

Caption for the next button on edit form which takes you to the screen that shows a preview and license information.

closeMsg string

Caption for a button that takes you back to editing from edit preview screen.

summaryRequestMsg string

Header above edit summary input field asking the user to summarize the changes they made to the page.

summaryMsg string

A placeholder with examples for the summary input field asking user what they changed.

placeholder string

Placeholder text for empty sections.

captchaMsg string

Placeholder for captcha input field.

captchaTryAgainMsg string

A message shown when user enters wrong CAPTCHA and a new one is displayed.

switchMsg string

Label for button that allows the user to switch between two different editing interfaces.

licenseMsg string

Text and link of the license, under which this contribution will be released to inform the user.

Mixes in:
Source:

Methods

confirmSave() → {boolean} #

If this is a new article, require confirmation before saving.

Source:

Returns:

The user confirmed saving

Type
boolean
If this is a new article, require confirmation before saving.

createAnonTalkWarning() → {jQuery.Element} #

Creates and returns a copy of the anon talk message warning

Source:

Returns:

Type
jQuery.Element
Creates and returns a copy of the anon talk message warning

createAnonWarning(options) → {jQuery.Element} #

Sets additional values used for anonymous editing warning.

Parameters:

Name Type Description
options Object
Source:

Returns:

Type
jQuery.Element
Sets additional values used for anonymous editing warning.

getCaptchaPanelTemplateSource() → {string} #

Provides the template code to be used for the captcha step.

This method is called by template(), and provided so that extending classes can change the HTML provided here.

Source:

Returns:

Type
string
Provides the template code to be used for the captcha step.

getLoadingPromise() → {jQuery.Promise} #

Get a promise that is resolved when the editor data has loaded, or rejected when we're refusing to load the editor because the user is blocked.

Source:

Returns:

Type
jQuery.Promise

Get a promise that is resolved when the editor data has loaded, or rejected when we're refusing to load the editor because the user is blocked.

getOptionsForSwitch() → {Object} #

Get an options object not containing any defaults or editor specific options, so that it can be used to construct a different editor for switching.

Source:

Returns:

Options

Type
Object

Get an options object not containing any defaults or editor specific options, so that it can be used to construct a different editor for switching.

getSavePanelTemplateSource() → {string} #

Provides the template code to be used for the save panel, where the user is asked for an edit summary.

This method is called by template(), and provided so that extending classes can change the HTML provided here.

Source:

Returns:

Type
string

Provides the template code to be used for the save panel, where the user is asked for an edit summary.

handleCaptcha(details) #

Handles a failed save due to a CAPTCHA provided by ConfirmEdit extension.

Parameters:

Name Type Description
details Object

Details returned from the api.

Source:
Handles a failed save due to a CAPTCHA provided by ConfirmEdit extension.

hasChanged() #

Checks whether the state of the thing being edited as changed. Expects to be implemented by child class.

Source:
Checks whether the state of the thing being edited as changed.

onBeforeExit(exit, cancel) #

Parameters:

Name Type Description
exit function

Callback to exit the overlay

cancel function

Callback to cancel exiting the overlay

Source:

onClickAnonymous() #

"Edit without logging in" button click handler

Source:
"Edit without logging in" button click handler

onClickBack() #

Back button click handler

Source:
Back button click handler

onClickContinue() #

Continue button click handler

Source:
Continue button click handler

onClickSubmit() #

Submit button click handler

Source:
Submit button click handler

onSaveBegin() #

Executed when the editor clicks the save button. Expects to be overridden by child class. Checks if the save needs to be confirmed.

Source:
Executed when the editor clicks the save button.

onSaveComplete(newRevId, [redirectUrl], [tempUserCreated]) #

Executed when page save is complete. Updates urls and shows toast message.

Parameters:

Name Type Attributes Description
newRevId number | null

ID of the newly created revision, or null if it was a null edit.

redirectUrl string optional

URL to redirect to, if different than the current URL.

tempUserCreated boolean optional

Whether a temporary user was created

Source:
Executed when page save is complete.

onSaveFailure(data) #

Executed when page save fails. Handles logging the error. Subclasses should display error messages as appropriate.

Parameters:

Name Type Description
data Object

API response

Source:
Executed when page save fails.

onStageChanges() #

Prepares the penultimate screen before saving. Expects to be overridden by child class.

Source:
Prepares the penultimate screen before saving.

reportError(text) #

Report load errors back to the user. Silently record the error using EventLogging.

Parameters:

Name Type Description
text string

Text (HTML) of message to display to user

Source:
Report load errors back to the user.

showSaveCompleteMsg(action, [tempUserCreated]) #

Show a save-complete message to the user

Parameters:

Name Type Attributes Description
action string

One of 'saved', 'created', 'restored'

tempUserCreated boolean optional

Whether a temporary user was created

Source:
Show a save-complete message to the user

Events

hide() #

Fired when the overlay is closed.

Inherited from:
Source:
Fired when the overlay is closed.