Expand all

mw.libs.ve

Classes

EditingTabDialog
Dialog for allowing new users to change editing tab preferences.
MWEditModeSourceTool
MediaWiki edit mode source tool.
MWEditModeTool
MediaWiki edit mode tool.
MWEditModeVisualTool
MediaWiki edit mode visual tool.
MWTempWikitextEditorWidget

MediaWiki temporary wikitext editor widget

This widget can be used to show the user a basic editing interface while VE libraries are still loading.

ProgressBarWidget

Progress bar widget

This widget can be used to show a progress bar while VE libraries are still loading.

SwitchPopupWidget
WelcomeDialog
Dialog for welcoming new users.
diffLoader
Diff loader.
targetLoader
Target loader.
targetSaver
Target saver.

Methods

decodeURIComponentIntoArticleTitle(s, [preserveUnderscores]) → {string}static #

Decode a URI component into a mediawiki article title

N.B. Illegal article titles can result from fairly reasonable input (e.g. "100%25beef"); see https://phabricator.wikimedia.org/T137847 T137847} .

Parameters:

Name Type Attributes Default Description
s string

String to decode

preserveUnderscores boolean optional
false

Don't convert underscores to spaces

Source:

Returns:

Decoded string, or original string if decodeURIComponent failed

Type
string

Decode a URI component into a mediawiki article title

N.B.

deduplicateStyles(element)static #

De-duplicate TemplateStyles, like Parsoid does.

Parameters:

Name Type Description
element HTMLElement

Parent element, e.g. document body

Source:
De-duplicate TemplateStyles, like Parsoid does.

encodeParsoidResourceName(title) → {string}static #

Encode a page title into a Parsoid resource name.

Parameters:

Name Type Description
title string
Source:

Returns:

Type
string
Encode a page title into a Parsoid resource name.

Fix fragment links which should be relative to the current document

This prevents these links from trying to navigate to another page, or open in a new window.

getTargetDataFromHref(href, doc) → {mw.libs.ve.TargetData}static #

Parse URL to get title it points to.

Parameters:

Name Type Description
href string
doc HTMLDocument

Document whose base URL to use

Source:

Returns:

Information about the given href

Type
mw.libs.ve.TargetData
Parse URL to get title it points to.

normalizeParsoidResourceName(resourceName) → {string}static #

Extract the page title from a Parsoid resource name.

Parameters:

Name Type Description
resourceName string

Resource name, from a href or resource attribute

Source:

Returns:

Full page title in text form (with namespace, and spaces instead of underscores)

Type
string
Extract the page title from a Parsoid resource name.

parseParsoidResourceName(resourceName) → {mw.libs.ve.ParsedResource}static #

Split Parsoid resource name into the href prefix and the page title.

Parameters:

Name Type Description
resourceName string

Resource name, from a href or resource attribute

Source:

Returns:

Parsed resource name

Type
mw.libs.ve.ParsedResource
Split Parsoid resource name into the href prefix and the page title.

reduplicateStyles(element)static #

Re-duplicate deduplicated TemplateStyles, for correct rendering when editing a section or when templates are removed during the edit.

Parameters:

Name Type Description
element HTMLElement

Parent element, e.g. document body

Source:

Re-duplicate deduplicated TemplateStyles, for correct rendering when editing a section or when templates are removed during the edit.

stripParsoidFallbackIds(element)static #

Strip legacy (non-HTML5) IDs; typically found as section IDs inside headings.

Parameters:

Name Type Description
element HTMLElement

Parent element, e.g. document body

Source:

Strip legacy (non-HTML5) IDs; typically found as section IDs inside headings.

unwrapParsoidSections(element, [keepSection])static #

Unwrap Parsoid sections

data-mw-section-id attributes are copied to the first child (the heading) during this step so that we can place the cursor in the correct place when section editing. These attributes must be removed before being sent back to Parsoid to avoid unnecessary re-serialization.

Parameters:

Name Type Attributes Description
element HTMLElement

Parent element, e.g. document body

keepSection string optional

Section to keep

Source:

Unwrap Parsoid sections

data-mw-section-id attributes are copied to the first child (the heading) during this step so that we can place the cursor in the correct place when section editing.

Type Definitions

ParsedResource #

Properties:

Name Type Description
title string

Full page title in text form (with namespace, and spaces instead of underscores)

Source:

TargetData #

Type:

Properties:

Name Type Description
title string

The title of the internal link (if the href is internal)

isInternal boolean

True if the href pointed to the local wiki, false if href is external

Source: