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:
|
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
getDescription() → {jQuery|string|function|OO.ui.HtmlSnippet}
#
Get a description of the check
Returns:
- Type
- jQuery | string | function | OO.ui.HtmlSnippet
- Inherited from:
- Source:
getFocusSelection() → {ve.dm.Selection}
#
getHighlightSelections() → {Array.<ve.dm.Selection>}
#
Get selections to highlight for this check
Returns:
- Type
- Array.<ve.dm.Selection>
- Inherited from:
- Source:
getName() → {string}
#
Get the name of the check type
Returns:
Check type name
- Type
- string
getPrompt() → {jQuery|string|function|OO.ui.HtmlSnippet|undefined}
#
undefined}
#
Get the prompt question for the current choices
Returns:
- Type
-
jQuery
|
string
|
function
|
OO.ui.HtmlSnippet
|
undefined
- Inherited from:
- Source:
getRuleId() → {string|null}
#
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
getTitle() → {jQuery|string|function|OO.ui.HtmlSnippet}
#
Get the action's title
Returns:
- Type
- jQuery | string | function | OO.ui.HtmlSnippet
- Inherited from:
- Source:
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:
getType() → {string}
#
Get the type of this action ('warning', 'error', 'progressive')
Returns:
- Type
- string
- Inherited from:
- Source:
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:
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:
isTagged(tag) → {boolean}
#
Is this action tagged?
Parameters:
| Name | Type | Description |
|---|---|---|
tag |
string |
Returns:
- Type
- boolean
- Inherited from:
- Source:
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:
onActionSeen()
#
Handle seen events from an action widget
Fires:
- Inherited from:
- Source:
overlapsRanges(ranges) → {boolean}
#
Check if any of this action's fragments' ranges overlap with the given ranges
Parameters:
Returns:
True if any overlap exists
- Type
- boolean
- Inherited from:
- Source:
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:
- Inherited from:
- Source:
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:
setMode(mode)
#
Set the mode used by the action widget
Parameters:
| Name | Type | Description |
|---|---|---|
mode |
string |
- Inherited from:
- Source:
tag(tag)
#
Tag this action
Parameters:
| Name | Type | Description |
|---|---|---|
tag |
string |
- Inherited from:
- Source:
untag(tag) → {boolean}
#
Untag this action
Parameters:
| Name | Type | Description |
|---|---|---|
tag |
string |
Returns:
Whether anything was untagged
- Type
- boolean
- Inherited from:
- Source:
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:
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:
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:
shown(shown)
#
Fired when the action is shown to the user
Parameters:
| Name | Type | Description |
|---|---|---|
shown |
boolean | The check is shown |
- Inherited from:
- Source:
stale(stale)
#
Fired when the action's stale state changes
Parameters:
| Name | Type | Description |
|---|---|---|
stale |
boolean | The check is stale |
- Inherited from:
- Source: