2014-11-23 18:04:00 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor UserInterface MediaWiki WikitextWarningCommand class.
|
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright See AUTHORS.txt
|
2014-11-23 18:04:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 () {
|
2022-02-21 18:07:07 +00:00
|
|
|
var command = this;
|
2014-11-23 18:04:00 +00:00
|
|
|
if ( this.warning && this.warning.isOpen ) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-11-15 17:03:35 +00:00
|
|
|
// eslint-disable-next-line no-jquery/no-html
|
2022-02-21 18:07:07 +00:00
|
|
|
var $message = $( '<div>' ).html( ve.init.platform.getParsedMessage( 'visualeditor-wikitext-warning' ) );
|
2018-11-28 22:42:19 +00:00
|
|
|
ve.targetLinksToNewWindow( $message[ 0 ] );
|
2018-08-25 15:40:41 +00:00
|
|
|
ve.init.platform.notify(
|
2018-11-28 22:42:19 +00:00
|
|
|
$message.contents(),
|
2018-08-25 15:40:41 +00:00
|
|
|
ve.msg( 'visualeditor-wikitext-warning-title' ),
|
|
|
|
{ tag: 'visualeditor-wikitext-warning' }
|
2024-04-30 16:44:25 +00:00
|
|
|
).then( ( message ) => {
|
2014-11-23 18:04:00 +00:00
|
|
|
command.warning = message;
|
|
|
|
} );
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ui.commandRegistry.register( new ve.ui.MWWikitextWarningCommand() );
|