Expand all

mw.editcheck.TextMatchEditCheckAction

Extends

Constructor

new mw.editcheck.TextMatchEditCheckAction(config) #

TextMatchEditCheckAction

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

Parameters:

Name Type Description
config Object

Configuration options

Properties:
Name Type Attributes Description
matchRuleId string

ID of the matchRule that triggered the match

term string

Term that prompted the action

message string

Message for the action dialog

replacement string

Word or phrase to use as the replacement, if action allows

tagName string

Unique tag name for this matchRule+term pair

replacementFragment ve.dm.SurfaceFragment optional

Fragment to insert content into

Source:

TextMatchEditCheckAction

Subclass of EditCheckAction to include information about the matchRule 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 a dialog that becomes empty can wait for the system message, and 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, …args) → {boolean} #

Compare to another action

Parameters:

Name Type Attributes Description
other mw.editcheck.EditCheckAction

Other action

args any repeatable

Returns:

Type
boolean
Overrides:
Source:
Compare to another action

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

Get the available choices

Returns:

Type
Array.<Object>
Inherited from:
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
Inherited from:
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
Overrides:
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
Overrides:
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:

unique tag

Type
string
Overrides:
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

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, 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:

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) → {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
Inherited from:
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

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

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
Inherited from:
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([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

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

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