Expand all

ve.editcheck.headlessLoader

Methods

getCheckConfigs() → {Promise.<Object>}inner #

Get the resolved per-check config, keyed by check name.

This is independent of any particular page: it is derived from the global edit check configuration, so it does not require a document to be loaded. The edit check modules must be loaded before calling this.

The textMatch check additionally supports per-matchRule (matchItem) config, which is exposed keyed as "textMatch/".

Returns:

Map of check name to a summary of its resolved config

Type
Promise.<Object>
Source:
Get the resolved per-check config, keyed by check name.

getClosestIdFromModel(node) → {string|undefined}inner #

Get the closest parsoid ID from the model node.

Parameters:

Name Type Description
node ve.dm.Node

The model node.

Returns:

The closest ID or undefined if not found.

Type
string | undefined
Source:
Get the closest parsoid ID from the model node.

loadConfig(pageName, requestId) → {jQuery.Promise.<object>}inner #

Load additional config metadata for a page.

Parameters:

Name Type Description
pageName string

The name of the page.

requestId number

The request ID.

Returns:

A promise that resolves with the config metadata.

Type
jQuery.Promise.<object>
Source:
Load additional config metadata for a page.

loadHtml(pageName, requestId, [parsoidHtml]) → {jQuery.Promise.<string>}inner #

Load the HTML content for a page.

Parameters:

Name Type Attributes Description
pageName string

The name of the page.

requestId number

The request ID.

parsoidHtml string optional

The Parsoid HTML content.

Returns:

A promise that resolves with the HTML content.

Type
jQuery.Promise.<string>
Source:
Load the HTML content for a page.

loadModules() → {jQuery.Promise}inner #

Load the VisualEditor modules for headless operation.

Returns:

A promise that resolves when the modules are loaded.

Type
jQuery.Promise
Source:
Load the VisualEditor modules for headless operation.

publishHeadlessProgress(msg, requestId)inner #

Publish the headless progress to the window and fire an event.

Parameters:

Name Type Description
msg string

The progress message.

requestId number

The request ID associated with the progress.

Source:
Publish the headless progress to the window and fire an event.

publishHeadlessResult(result)inner #

Publish the headless result to the window and fire an event.

Parameters:

Name Type Description
result Object

The result object to publish.

Source:
Publish the headless result to the window and fire an event.

runHeadlessForPage(pageNameRaw, requestId, [parsoidHtml]) → {Promise.<object>}inner #

Run the headless VisualEditor for a page.

Parameters:

Name Type Attributes Description
pageNameRaw string

The page name from user input.

requestId number

The request ID.

parsoidHtml string optional

The Parsoid HTML content.

Returns:

A promise that resolves with the result.

Type
Promise.<object>
Source:
Run the headless VisualEditor for a page.

serializeHeadlessAction(action, dmDoc) → {Object}inner #

Serialize a headless action into a plain object for output.

Parameters:

Name Type Description
action mw.editcheck.EditCheckAction

The action to serialize.

dmDoc ve.dm.Document

The document model for context.

Returns:

The serialized action.

Type
Object
Source:
Serialize a headless action into a plain object for output.