mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
7bf56a3bd4
New changes: 3b62827b8 Remove negative margin from mobile context action buttons 694705894 Implement a simple notification system to fill in for mw.notify 461283560 Validate history start when applying/unapplying change Bug: T202514 Change-Id: I203dc5101bc31988df2d3986da4300a318e5e889
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MediaWiki WikitextWarningCommand class.
|
|
*
|
|
* @copyright 2011-2018 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
/**
|
|
* Wikitext warning command.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.Command
|
|
*
|
|
* @constructor
|
|
*/
|
|
ve.ui.MWWikitextWarningCommand = function VeUiMWWikitextWarningCommand() {
|
|
// Parent constructor
|
|
ve.ui.MWWikitextWarningCommand.super.call(
|
|
this, 'mwWikitextWarning'
|
|
);
|
|
this.warning = null;
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWWikitextWarningCommand, ve.ui.Command );
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWWikitextWarningCommand.prototype.execute = function () {
|
|
var command = this;
|
|
if ( this.warning && this.warning.isOpen ) {
|
|
return false;
|
|
}
|
|
ve.init.platform.notify(
|
|
$( $.parseHTML( ve.init.platform.getParsedMessage( 'visualeditor-wikitext-warning' ) ) )
|
|
.filter( 'a' ).attr( 'target', '_blank' ).end(),
|
|
ve.msg( 'visualeditor-wikitext-warning-title' ),
|
|
{ tag: 'visualeditor-wikitext-warning' }
|
|
).then( function ( message ) {
|
|
command.warning = message;
|
|
} );
|
|
return true;
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.commandRegistry.register( new ve.ui.MWWikitextWarningCommand() );
|