mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 19:09:29 +00:00
9be5c85db4
VisualEditor is usually not enabled in talk namespaces... but sometimes it is. And when users see the button to edit with VE, they're going to click it and expect to be able to sign their posts. This tool is only loaded on talk pages and pages in additional namespaces defined in $wgExtraSignatureNamespaces. Code adapted with small tweaks from my own gadget <https://meta.wikimedia.org/wiki/User:Matma_Rex/visualeditor-signature.js?oldid=13461327>, which is already available under the MIT license. Changes include: * The tool is now always visible if the wiki allows signatures in any VE namespaces, but disabled when not allowed in the current namespace. * Register '~~~~' sequence to insert the signature. * Code style tweaks for stricter lint checks in this repository. * Documentation corrections. Swedish translation provided by André Costa (already credited as a translator as Lokal_Profil). Depends on changes in VisualEditor core: * I89fe53890ab59d12260ea6b41de802c38c24e8b9 * I14cd7efac521687ea38580341ae08ddc522edeeb Bug: T53154 Change-Id: I6be5fb2118cf3eef5098d4c5320228aa81411ccb
60 lines
1.4 KiB
JavaScript
60 lines
1.4 KiB
JavaScript
/*!
|
|
* VisualEditor MWSignatureContextItem class.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
/**
|
|
* Context item for a MWSignature.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.MWTransclusionContextItem
|
|
*
|
|
* @constructor
|
|
* @param {ve.ui.Context} context Context item is in
|
|
* @param {ve.dm.Model} model Model item is related to
|
|
* @param {Object} config Configuration options
|
|
*/
|
|
ve.ui.MWSignatureContextItem = function VeUiMWSignatureContextItem() {
|
|
// Parent constructor
|
|
ve.ui.MWSignatureContextItem.super.apply( this, arguments );
|
|
|
|
// Initialization
|
|
this.$element.addClass( 've-ui-mwSignatureContextItem' );
|
|
this.$body.remove();
|
|
this.$info.remove();
|
|
this.$actions.remove();
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWSignatureContextItem, ve.ui.MWTransclusionContextItem );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ui.MWSignatureContextItem.static.editable = false;
|
|
|
|
ve.ui.MWSignatureContextItem.static.name = 'mwSignature';
|
|
|
|
ve.ui.MWSignatureContextItem.static.icon = 'signature';
|
|
|
|
ve.ui.MWSignatureContextItem.static.label =
|
|
OO.ui.deferMsg( 'visualeditor-mwsignature-tool' );
|
|
|
|
ve.ui.MWSignatureContextItem.static.modelClasses = [ ve.dm.MWSignatureNode ];
|
|
|
|
ve.ui.MWSignatureContextItem.static.commandName = 'mwSignature';
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWSignatureContextItem.prototype.getDescription = function () {
|
|
return '';
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.contextItemFactory.register( ve.ui.MWSignatureContextItem );
|