Expand all

mw.editcheck.SourceVerificationEditCheckAction

Extends

Constructor

new mw.editcheck.SourceVerificationEditCheckAction(config) #

SourceVerificationEditCheckAction

Subclass of EditCheckAction to include information about the suggestion associated with this action

Parameters:

Name Type Description
config Object

Configuration options

Properties:
Name Type Description
suggestionData Object

Suggestion data from the API

footnotes Array.<{footnoteLabel: jQuery, url: string}>

Footnote data computed when creating the action

Source:

SourceVerificationEditCheckAction

Subclass of EditCheckAction to include information about the suggestion associated with this action

Methods

cancelComplete() #

Cancel a previous call to #intendComplete

Used when the check was dismissed before the user finished applying the fix.

Inherited from:
Source:

Cancel a previous call to #intendComplete

Used when the check was dismissed before the user finished applying the fix.

complete([message]) #

Method called when the action is completed successfully

Call this before the action is removed from the action list. Then the system message is in the list when a dialog updates, and the dialog does not close.

Parameters:

Name Type Attributes Description
message jQuery | string | function | OO.ui.HtmlSnippet optional

Message to show for this outcome that overrides the check's successResult message

Fires:

Inherited from:
Source:

Method called when the action is completed successfully

Call this before the action is removed from the action list.

discarded() #

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

Also checks if a check previously called #intendComplete on this action, in which case that completion is finished here.

Inherited from:
Source:

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

Also checks if a check previously called #intendComplete on this action, in which case that completion is finished here.

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
Inherited from:
Source:
Compare to another action

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

Get the available choices

Returns:

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

getConfigAnchor() → {string} #

Get the anchor of this action's row on Special:EditChecks

Returns:

Type
string
Inherited from:
Source:
Get the anchor of this action's row on Special:EditChecks

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

Get a description of the check

Returns:

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

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

Get the selection to focus for this check

Returns:

Type
ve.dm.Selection
Inherited from:
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
Inherited from:
Source:
Get the action's footer, if any

getFooterIcon() → {string|undefined} #

Get the action's footerIcon, if any

Returns:

Type
string | undefined
Inherited from:
Source:
Get the action's footerIcon, if any

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

Get selections to highlight for this check

Returns:

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

getName() → {string} #

Get the name of the check type

Returns:

Check type name

Type
string
Inherited from:
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
Inherited from:
Source:
Get the prompt question for the current choices

getRuleId() → {string|null} #

Get the ID of the community-defined rule that produced this action

The ID has no fixed set of values, so metrics must not use it as the check name.

Returns:

Rule ID, or null if the check has no sub-rules

Type
string | null
Inherited from:
Source:

Get the ID of the community-defined rule that produced this action

The ID has no fixed set of values, so metrics must not use it as the check name.

getTagName() → {string} #

Get unique tag name for this action

Returns:

Type
string
Inherited from:
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
Inherited from:
Source:
Get the action's title

getTrackingIdSuffix() → {string} #

Get action's id if it's configured to include it in its instrumentation

Returns:

suffix with ID, or an empty string

Type
string
Inherited from:
Source:
Get action's id if it's configured to include it in its instrumentation

getType() → {string} #

Get the type of this action ('warning', 'error', 'progressive')

Returns:

Type
string
Inherited from:
Source:
Get the type of this action ('warning', 'error', 'progressive')

intendComplete() #

Method called by a check when the action being discarded should indicate it's been completed

For use by checks whose own workflow can be cancelled without the check knowing.

Inherited from:
Source:

Method called by a check when the action being discarded should indicate it's been completed

For use by checks whose own workflow can be cancelled without the check knowing.

isDismissed(tag) → {boolean} #

Check whether every range of this action has been dismissed for this check

Parameters:

Name Type Description
tag string

Returns:

Type
boolean
Inherited from:
Source:
Check whether every range of this action has been dismissed for this check

isRevising() → {boolean} #

Check if the user is revising the action

Only this action object is revising. Other actions in the tagged range are not, e.g. an action that replaces this one after the paragraph is split.

This always uses the fragments, also for actions with an ID, because the tag must be cleared when the selection leaves a range.

Returns:

Type
boolean
Inherited from:
Source:

Check if the user is revising the action

Only this action object is revising.

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
Inherited from:
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
Inherited from:
Source:
Whether this is a suggestion

isTagged(tag) → {boolean} #

Is this action tagged?

Parameters:

Name Type Description
tag string

Returns:

Type
boolean
Inherited from:
Source:
Is this action tagged?

onActionClick(surface, controller, actionWidget) #

Handle click events from an action button

Parameters:

Name Type Description
surface ve.ui.Surface

Surface

controller

Controller that shows the action

actionWidget OO.ui.ActionWidget

Clicked action widget

Fires:

Inherited from:
Source:
Handle click events from an action button

onActionSeen() #

Handle seen events from an action widget

overlapsRanges(ranges) → {boolean} #

Check if any of this action's fragments' ranges overlap with the given ranges

Parameters:

Name Type Description
ranges Array.<ve.Range>

The ranges

Returns:

True if any overlap exists

Type
boolean
Inherited from:
Source:
Check if any of this action's fragments' ranges overlap with the given ranges

refreshWidget() #

Refresh the rendered widget to reflect any changes since it was last built

Currently only updates the card description but this could be extended if other getters become stale(-able) too

Inherited from:
Source:

Refresh the rendered widget to reflect any changes since it was last built

Currently only updates the card description but this could be extended if other getters become stale(-able) too

render(collapsed, singleAction, surface, controller) → {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

controller

Controller that shows the action

Returns:

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

select(surface, forceCollapse, [focus]) #

Select the action in the surface

Parameters:

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

Whether to force the cursor to the edge of the check's range, or to only do so if outside the check range

focus boolean optional
true

Activate and focus the surface

Inherited from:
Source:
Select the action in the surface

setMode(mode) #

Set the mode used by the action widget

Parameters:

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

startRevising() #

Start revising the action, which makes it stale

The 'revising' tag is cleared when the selection leaves the action's fragments, and this stops the revising.

Inherited from:
Source:

Start revising the action, which makes it stale

The 'revising' tag is cleared when the selection leaves the action's fragments, and this stops the revising.

stopRevising() #

Stop revising the action, and accept its current text as checked

Inherited from:
Source:
Stop revising the action, and accept its current text as checked

tag(tag) #

Tag this action

Parameters:

Name Type Description
tag string
Inherited from:
Source:
Tag this action

untag(tag) → {boolean} #

Untag this action

Parameters:

Name Type Description
tag string

Returns:

Whether anything was untagged

Type
boolean
Inherited from:
Source:
Untag this action

updateFrom(action) → {boolean} #

Whether widget needs to be redrawn using fresh data, without a full rerender

Called from Controller#updateForListener when a new action #equals the old one, but there is an update to some data that is displayed in the widget

Parameters:

Name Type Description
action mw.editcheck.EditCheckAction

the new, equivalent action

Returns:

Whether widget needs to be redrawn

Type
boolean
Overrides:
Source:

Whether widget needs to be redrawn using fresh data, without a full rerender

Called from Controller#updateForListener when a new action #equals the old one, but there is an update to some data that is displayed in the widget

updateStale([resetText]) → {boolean} #

Update the stale state of the action

The action is stale while the user revises it (see #startRevising), or when its text changed since the check last ran.

Parameters:

Name Type Attributes Default Description
resetText boolean optional
false

The check ran again on the current text

Returns:

The stale state changed

Type
boolean
Inherited from:
Source:

Update the stale state of the action

The action is stale while the user revises it (see #startRevising), or when its text changed since the check last ran.

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

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

complete([message]) #

Fired when the action is completed successfully Unlike 'discard', this represents an actual outcome of the action, not just it being removed from the action list

Parameters:

Name Type Attributes Description
message jQuery | string | function | OO.ui.HtmlSnippet optional

Message to show for this outcome that overrides the check's successResult message

Inherited from:
Source:

Fired when the action is completed successfully Unlike 'discard', this represents an actual outcome of the action, not just it being removed from the action list

seen(seen) #

Fired when the action is seen by the user

Parameters:

Name Type Description
seen boolean

The check is seen

Inherited from:
Source:
Fired when the action is seen by the user

shown(shown) #

Fired when the action is shown to the user

Parameters:

Name Type Description
shown boolean

The check is shown

Inherited from:
Source:
Fired when the action is shown to the user

stale(stale) #

Fired when the action's stale state changes

Parameters:

Name Type Description
stale boolean

The check is stale

Inherited from:
Source:
Fired when the action's stale state changes