Class: EditorOverlayBase

EditorOverlayBase(params)

new EditorOverlayBase(params)

Base class for SourceEditorOverlay and VisualEditorOverlay

Parameters:
Name Type Description
params Object

Configuration options

Properties
Name Type Description
editCount number | null

of user

Source:

Extends

Members

closeOnContentTap

Flag overlay to close on content tap

Properties:
Type Description
boolean
Inherited From:
Source:

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.

cancelMsg string

Caption for cancel button on edit form.

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.

waitMsg string

Text that displays while a page edit is being saved.

waitIcon string

HTML of the icon that displays while a page edit is being saved.

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.

Overrides:
Mixes In:
Source:

fullScreen

Is overlay fullscreen

Properties:
Type Description
boolean
Inherited From:
Source:

isTemplateMode

Tells the View to ignore tagName and className when constructing the element and to rely solely on the template

Properties:
Name Type Description
isTemplateMode boolean
Inherited From:
Source:

sectionId

Source:

tagName

Name of tag that contains the rendered template

Properties:
Name Type Description
tagName string
Inherited From:
Source:

template

Properties:
Name Type Description
Specifies Mixed

the template used in render(). Object|string|HoganTemplate

Overrides:
Source:

templatePartials

Specifies partials (sub-templates) for the main template. Example:

Properties:
Type Description
Object
Overrides:
Source:
Example
// example content for the "some" template (sub-template will be
    // inserted where {{>content}} is):
    // <h1>Heading</h1>
    // {{>content}}

    oo.mfExtend( SomeView, View, {
      template: util.template( '<source-code>' ),
      templatePartials: { content: util.template( '<source-code>' ) }
    }

Methods

after(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | JQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

append(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | JQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

appendTo(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | JQuery
Inherited From:
Source:
Returns:
Type
this

before(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | JQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

confirmSave() → {boolean}

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

Source:
Returns:

The user confirmed saving

Type
boolean

createAnonWarning(options) → {jQuery.Element}

Sets additional values used for anonymous editing warning.

Parameters:
Name Type Description
options Object
Source:
Returns:
Type
jQuery.Element

delegate(eventName, selector, listener)

Add a single event listener to the view's element (or a child element using selector). This only works for delegate-able events: not focus, blur, and not change, submit, and reset in Internet Explorer.

Parameters:
Name Type Description
eventName string
selector string
listener function
Inherited From:
Source:

delegateEvents(events)

Set callbacks, where this.options.events is a hash of

{ 'event selector': 'callback' }

{ 'mousedown .title': 'edit', 'click .button': 'save', 'click .open': function(e) { ... } }

pairs. Callbacks will be bound to the view, with this set properly. Uses event delegation for efficiency. Omitting the selector binds the event to this.el.

Parameters:
Name Type Description
events Object

Optionally set this events instead of the ones on this.

Inherited From:
Source:

detach(selectoropt) → {this}

Parameters:
Name Type Attributes Description
selector string <optional>
Inherited From:
Source:
Returns:
Type
this

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:

hasChanged()

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

Source:

hide() → {boolean}

Detach the overlay from the current view Should not be overriden as soon to be deprecated.

Inherited From:
Source:
Returns:

Whether the overlay was successfully hidden or not

Type
boolean

hideSpinner()

Hide the spinner near to the input field.

Inherited From:
Source:

initialize(options)

Run once during construction to set up the View

Parameters:
Name Type Description
options Object

Object passed to the constructor.

Properties
Name Type Attributes Description
events Object.<string, string> <optional>
Inherited From:
Source:

insertAfter(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | JQuery
Inherited From:
Source:
Returns:
Type
this

insertBefore(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | JQuery
Inherited From:
Source:
Returns:
Type
this

log(data)

Logs an event to http://meta.wikimedia.org/wiki/Schema:EditAttemptStep

Parameters:
Name Type Description
data Object
Source:

onBeforeExit(exit)

Parameters:
Name Type Description
exit function

Callback to exit the overlay

Source:

onClickAnonymous()

"Edit without logging in" button click handler

Source:

onClickBack()

Back button click handler

Source:

onClickContinue()

Continue button click handler

Source:

onClickSubmit()

Submit button click handler

Source:

onExitClick(ev)

ClickBack event handler

Parameters:
Name Type Description
ev Object

event object

Inherited From:
Source:

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:

onSaveComplete()

Executed when page save is complete. Handles reloading the page, showing toast messages.

Source:

onSaveFailure(data)

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

Parameters:
Name Type Description
data Object

Details about the failure, from EditorGateway.parseSaveError

Source:

onStageChanges()

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

Source:

parseBlockInfo(blockinfo) → {Object}

Parameters:
Name Type Description
blockinfo string
Source:
Returns:
Type
Object

parseHTML(html) → {jQuery.Object}

See parseHTML method of util singleton

Parameters:
Name Type Description
html string

to turn into a jQuery object.

Inherited From:
Source:
Returns:
Type
jQuery.Object

postRender()

Function called after the view is rendered. Can be redefined in objects that extend View.

Overrides:
Source:

prepend(…contents) → {this}

Parameters:
Name Type Attributes Description
contents string | Node | Array.<Node> | JQuery <repeatable>
Inherited From:
Source:
Returns:
Type
this

prependTo(target) → {this}

Parameters:
Name Type Description
target string | Node | Array.<Node> | JQuery
Inherited From:
Source:
Returns:
Type
this

preRender()

Function called before the view is rendered. Can be redefined in objects that extend View.

Inherited From:
Source:

remove(selectoropt) → {this}

Parameters:
Name Type Attributes Description
selector string <optional>
Inherited From:
Source:
Returns:
Type
this

render(data)

Fill this.$el with template rendered using data if template is set.

Parameters:
Name Type Description
data Object

Template data. Will be merged into the view's options

Inherited From:
Source:

reportError(text, heading)

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

Parameters:
Name Type Description
text string

Text of message to display to user

heading string

heading text to display to user

Source:

show()

Attach overlay to current view and show it.

Inherited From:
Source:

(protected) showHidden(className)

Show elements that are selected by the className. Also hide .hideable elements Can't use jQuery's hide() and show() because show() sets display: block. And we want display: table for headers.

Parameters:
Name Type Description
className string

CSS selector to show

Inherited From:
Source:

showSpinner()

Shows the spinner right to the input field.

Inherited From:
Source:

stopPropagation(ev)

Stop clicks in the overlay from propagating to the page (prevents non-fullscreen overlays from being closed when they're tapped)

Parameters:
Name Type Description
ev Object

Event Object

Inherited From:
Source:

undelegate(eventName, selector, listener)

A finer-grained undelegateEvents for removing a single delegated event. selector and listener are both optional.

Parameters:
Name Type Description
eventName string
selector string
listener function
Inherited From:
Source:

undelegateEvents()

Clears all callbacks previously bound to the view by delegateEvents. You usually don't need to use this, but may wish to if you have multiple views attached to the same DOM element.

Inherited From:
Source:

Events

hide

Fired when the overlay is closed.

Inherited From:
Source: