mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-17 19:31:51 +00:00
22a80e430e
Also, avoid parsing HTML manually in a few places. Change-Id: I983a7e1917a3f0728173e9621c709d1c8c04f650
53 lines
1.2 KiB
JavaScript
53 lines
1.2 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 $message,
|
|
command = this;
|
|
if ( this.warning && this.warning.isOpen ) {
|
|
return false;
|
|
}
|
|
$message = $( '<div>' ).html( ve.init.platform.getParsedMessage( 'visualeditor-wikitext-warning' ) );
|
|
ve.targetLinksToNewWindow( $message[ 0 ] );
|
|
ve.init.platform.notify(
|
|
$message.contents(),
|
|
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() );
|