mediawiki-extensions-SpamBl.../modules/ve-spamblacklist/ve.init.mw.SpamBlacklistSaveErrorHandler.js
Ed Sanders 02ada1b4f2 Move in VE support code from the VE extension
Depends-On: I036ee32847cc3b25a1cc478247cfe54599781098
Change-Id: I1807a5d3d99ecab2bf4545a1bab3aa3f2ae64da8
2018-11-29 17:22:29 +00:00

26 lines
861 B
JavaScript

mw.libs.ve.targetLoader.addPlugin( function () {
ve.init.mw.SpamBlacklistSaveErrorHandler = function () {};
OO.inheritClass( ve.init.mw.SpamBlacklistSaveErrorHandler, ve.init.mw.SaveErrorHandler );
ve.init.mw.SpamBlacklistSaveErrorHandler.static.name = 'spamBlacklist';
ve.init.mw.SpamBlacklistSaveErrorHandler.static.matchFunction = function ( editApi ) {
return !!editApi.spamblacklist;
};
ve.init.mw.SpamBlacklistSaveErrorHandler.static.process = function ( editApi, target ) {
// Handle spam blacklist error from Extension:SpamBlacklist
target.showSaveError(
$( $.parseHTML( editApi.sberrorparsed ) ),
false // prevents reapply
);
// Emit event for tracking. TODO: This is a bad design
target.emit( 'saveErrorSpamBlacklist' );
};
ve.init.mw.saveErrorHandlerFactory.register( ve.init.mw.SpamBlacklistSaveErrorHandler );
} );