mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-30 00:55:00 +00:00
5ce4885529
Uses the generic sequence detection now available in core instead of a custom hack that had to been manually bound and unbound to every surface and surface widget. As the sequence detection looks at just-typed characters the behaviour has reverted to showing a auto-hide message. This resolves an issue with the previous system whereby typing in the same paragraph as existing wikitext patterns triggered the warning. Depends on I6a4d71d in core. Bug: T53751 Change-Id: I7d914b1b60a1cf8c79a724e5f634e1e666c9562d
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MediaWiki WikitextWarningCommand class.
|
|
*
|
|
* @copyright 2011-2014 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 () {
|
|
if ( this.warning && this.warning.isOpen ) {
|
|
return false;
|
|
}
|
|
var command = this;
|
|
mw.notify(
|
|
$( $.parseHTML( ve.init.platform.getParsedMessage( 'visualeditor-wikitext-warning' ) ) )
|
|
.filter( 'a' ).attr( 'target', '_blank' ).end(),
|
|
{
|
|
title: 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() );
|