2024-11-19 13:41:38 +00:00
|
|
|
/**
|
|
|
|
* EditCheckAction
|
|
|
|
*
|
|
|
|
* @param {Object} config
|
|
|
|
* @param {mw.editcheck.BaseEditCheck} check
|
2024-12-05 12:10:28 +00:00
|
|
|
* @param {ve.dm.SurfaceFragment[]} fragments Affected fragments
|
2024-11-19 13:41:38 +00:00
|
|
|
* @param {jQuery|string|Function|OO.ui.HtmlSnippet} message Check message body
|
|
|
|
*/
|
2024-03-14 17:17:36 +00:00
|
|
|
mw.editcheck.EditCheckAction = function MWEditCheckAction( config ) {
|
|
|
|
this.check = config.check;
|
2024-12-05 12:10:28 +00:00
|
|
|
this.fragments = config.fragments;
|
2024-03-14 17:17:36 +00:00
|
|
|
this.message = config.message;
|
|
|
|
};
|
|
|
|
|
|
|
|
OO.initClass( mw.editcheck.EditCheckAction );
|
|
|
|
|
2024-11-19 13:41:38 +00:00
|
|
|
/**
|
|
|
|
* Get the available choices
|
|
|
|
*
|
|
|
|
* @return {Object[]}
|
|
|
|
*/
|
2024-03-14 17:17:36 +00:00
|
|
|
mw.editcheck.EditCheckAction.prototype.getChoices = function () {
|
|
|
|
return this.check.getChoices( this );
|
|
|
|
};
|
|
|
|
|
2024-12-05 12:10:28 +00:00
|
|
|
/**
|
|
|
|
* Get selections to highlight for this check
|
|
|
|
*
|
|
|
|
* @return {ve.dm.Selection[]}
|
|
|
|
*/
|
|
|
|
mw.editcheck.EditCheckAction.prototype.getHighlightSelections = function () {
|
|
|
|
return this.fragments.map( ( fragment ) => fragment.getSelection() );
|
|
|
|
};
|
|
|
|
|
2024-11-19 13:41:38 +00:00
|
|
|
/**
|
|
|
|
* Get a description of the check
|
|
|
|
*
|
|
|
|
* @return {string}
|
|
|
|
*/
|
2024-03-14 17:17:36 +00:00
|
|
|
mw.editcheck.EditCheckAction.prototype.getDescription = function () {
|
|
|
|
return this.check.getDescription( this );
|
|
|
|
};
|