mediawiki.page.preview

Fetch and display a preview of the current editing area.

Source:

Example

var preview = require( 'mediawiki.page.preview' );
preview.doPreview();

Methods

doPreview(config) → {jQuery.Promise|undefined}static #

Fetch and display a preview of the current editing area.

Parameters:

Name Type Description
config Object

Configuration options.

Properties
Name Type Attributes Default Description
$previewNode jQuery <optional>
$( '#wikiPreview' )

Where the preview should be displayed.

$diffNode jQuery <optional>
$( '#wikiDiff' )

Where diffs should be displayed (if showDiff is set).

$formNode jQuery <optional>
$( '#editform' )

The form node.

$textareaNode jQuery <optional>
$( '#wpTextbox1' )

The edit form's textarea.

$spinnerNode jQuery <optional>
$( '.mw-spinner-preview' )

The loading indicator. This will be shown/hidden accordingly while waiting for the XMLHttpRequest to complete. Ignored if no $spinnerNode is given.

summary string <optional>
null

The edit summary. If no value is given, the summary is fetched from $( '#wpSummaryWidget' ).

showDiff boolean <optional>
false

Shows a diff in the preview area instead of the content.

title string <optional>
mw.config.get( 'wgPageName' )

The title of the page being previewed

loadingSelectors Array.<string> <optional>
getLoadingSelectors()

An array of query selectors (i.e. '#catlinks') that should be grayed out while the preview is being generated.

Source:

Fires:

Returns:

jQuery.Promise or undefined if no $textareaNode was provided in the config.

Type
jQuery.Promise | undefined
Fetch and display a preview of the current editing area.

getLoadingSelectors() → {Array.<string>}static #

Get the selectors of elements that should be grayed out while the preview is being generated.

Source:

Returns:

Type
Array.<string>
Get the selectors of elements that should be grayed out while the preview is being generated.