Expand all

mw.editcheck.EditCheckAction

Constructor

new mw.editcheck.EditCheckAction(config) #

EditCheckAction

Parameters:

Name Type Description
config Object

Configuration options

Properties:
Name Type Attributes Default Description
check mw.editcheck.BaseEditCheck

Check which created this action

fragments Array.<ve.dm.SurfaceFragment>

Affected fragments

focusFragment ve.dm.SurfaceFragment optional

Fragment to focus

focusAnnotation function optional

Annotation to focus, see ve.ce.Surface#selectAnnotation

title jQuery | string | function | OO.ui.HtmlSnippet optional

Title

message jQuery | string | function | OO.ui.HtmlSnippet optional

Body message

prompt jQuery | string | function | OO.ui.HtmlSnippet optional

Prompt to show before choices

id string optional

Optional unique identifier

icon string optional

Optional icon name

type string optional
'warning'

Type of message (e.g., 'warning', 'error')

suggestion boolean optional

Whether this is a suggestion

choices Array.<Object> optional

User choices

Mixes in:
Source:
EditCheckAction

Methods

discarded() #

Method called by the controller when the action is removed from the action list

Source:
Method called by the controller when the action is removed from the action list

equals(other, allowOverlaps) → {boolean} #

Compare to another action

Parameters:

Name Type Description
other mw.editcheck.EditCheckAction

Other action

allowOverlaps boolean

Count overlaps rather than a perfect match

Returns:

Type
boolean
Source:
Compare to another action

getChoices() → {Array.<Object>} #

Get the available choices

Returns:

Type
Array.<Object>
Source:
Get the available choices

getDescription() → {jQuery|string|function|OO.ui.HtmlSnippet} #

Get a description of the check

Returns:

Type
jQuery | string | function | OO.ui.HtmlSnippet
Source:
Get a description of the check

getFocusSelection() → {ve.dm.Selection} #

Get the selection to focus for this check

Returns:

Type
ve.dm.Selection
Source:
Get the selection to focus for this check

getFooter() → {jQuery|string|function|OO.ui.HtmlSnippet|undefined} #

Get the action's footer, if any

Returns:

Type
jQuery | string | function | OO.ui.HtmlSnippet | undefined
Source:
Get the action's footer, if any

getHighlightSelections() → {Array.<ve.dm.Selection>} #

Get selections to highlight for this check

Returns:

Type
Array.<ve.dm.Selection>
Source:
Get selections to highlight for this check

getName() → {string} #

Get the name of the check type

Returns:

Check type name

Type
string
Source:
Get the name of the check type

getPrompt() → {jQuery|string|function|OO.ui.HtmlSnippet|undefined} #

Get the prompt question for the current choices

Returns:

Type
jQuery | string | function | OO.ui.HtmlSnippet | undefined
Source:
Get the prompt question for the current choices

getTagName() → {string} #

Get unique tag name for this action

Returns:

Type
string
Source:
Get unique tag name for this action

getTitle() → {jQuery|string|function|OO.ui.HtmlSnippet} #

Get the action's title

Returns:

Type
jQuery | string | function | OO.ui.HtmlSnippet
Source:
Get the action's title

getType() → {string} #

Get the type of this action (e.g., 'warning', 'error')

Returns:

Type
string
Source:
Get the type of this action (e.g., 'warning', 'error')

isStale() → {boolean} #

Get the stale state of the action

Users must call #updateStale first if they want to get the latest state based on the current text.

Returns:

The action is stale

Type
boolean
Source:

Get the stale state of the action

Users must call #updateStale first if they want to get the latest state based on the current text.

isSuggestion() → {boolean} #

Whether this is a suggestion

Returns:

Type
boolean
Source:
Whether this is a suggestion

isTagged(tag) → {boolean} #

Is this action tagged?

Parameters:

Name Type Description
tag string

Returns:

Type
boolean
Source:
Is this action tagged?

onActionClick(surface, actionWidget) #

Handle click events from an action button

Parameters:

Name Type Description
surface ve.ui.Surface

Surface

actionWidget OO.ui.ActionWidget

Clicked action widget

Fires:

Source:
Handle click events from an action button

onActionSeen() #

Handle seen events from an action widget

Fires:

Source:
Handle seen events from an action widget

render(collapsed, singleAction, surface) → {mw.editcheck.EditCheckActionWidget} #

Render as an EditCheckActionWidget

Parameters:

Name Type Description
collapsed boolean

Start collapsed

singleAction boolean

This is the only action shown

surface ve.ui.Surface

Surface

Returns:

Type
mw.editcheck.EditCheckActionWidget
Source:
Render as an EditCheckActionWidget

select(surface, selectFocusRange, [focus]) #

Select the action in the surface

Parameters:

Name Type Attributes Default Description
surface ve.ui.Surface
selectFocusRange boolean

Whether to select the focus range of the check, or just move the cursor to the nearest point in the selection if outside the check range

focus boolean optional
true

Activate and focus the surface

Source:
Select the action in the surface

setMode(mode) #

Set the mode used by the action widget

Parameters:

Name Type Description
mode string
Source:
Set the mode used by the action widget

tag(tag) #

Tag this action

Parameters:

Name Type Description
tag string
Source:
Tag this action

untag(tag) → {boolean} #

Untag this action

Parameters:

Name Type Description
tag string

Returns:

Whether anything was untagged

Type
boolean
Source:
Untag this action

updateStale([forceStale]) #

Update the stale state of the action based on the text, or force a specific state

Parameters:

Name Type Attributes Description
forceStale boolean optional

Force the action into a stale or not-stale state

Source:
Update the stale state of the action based on the text, or force a specific state

compareStarts(a, b) → {number}static #

Compare the start offsets of two actions.

Parameters:

Returns:

Type
number
Source:
Compare the start offsets of two actions.

Events

act(promise) #

Fired when the user selects an action (e.g., clicks a suggestion button).

Parameters:

Name Type Description
promise jQuery.Promise

A promise that resolves when the action is complete

Source:
Fired when the user selects an action (e.g., clicks a suggestion button).

act(promise) #

Fired when the user selects an action (e.g., clicks a suggestion button).

Parameters:

Name Type Description
promise jQuery.Promise

A promise that resolves when the action is complete

Source:
Fired when the user selects an action (e.g., clicks a suggestion button).

seen(seen) #

Fired when the action is seen by the user

Parameters:

Name Type Description
seen boolean

The check is seen

Source:
Fired when the action is seen by the user

stale(stale) #

Fired when the action's stale state changes

Parameters:

Name Type Description
stale boolean

The check is stale

Source:
Fired when the action's stale state changes