mediawiki-extensions-Visual.../modules/ve-mw/ui/ve.ui.MWSequenceRegistry.js
Bartosz Dziewoński 9be5c85db4 Provide a tool to insert a signature in namespaces that need it
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
2015-11-16 18:06:32 +01:00

49 lines
1.8 KiB
JavaScript

/*!
* VisualEditor MediaWiki SequenceRegistry registrations.
*
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextItalic', 'mwWikitextWarning', '\'\'' )
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextNowiki', 'mwWikitextWarning', '<nowiki' )
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextHeading', 'heading2', [ { type: 'paragraph' }, '=', '=' ], 2 )
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'numberHash', 'numberWrapOnce', [ { type: 'paragraph' }, '#', ' ' ], 2 )
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextDefinition', 'mwWikitextWarning', [ { type: 'paragraph' }, ';' ] )
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextDescription', 'blockquote', [ { type: 'paragraph' }, ':' ], 1 )
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextTable', 'insertTable', '{|', 2 )
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextComment', 'comment', '<!--', 4 )
);
/* Help registrations */
ve.ui.commandHelpRegistry.register( 'formatting', 'heading2', {
sequences: [ 'wikitextHeading' ],
label: OO.ui.deferMsg( 'visualeditor-formatdropdown-format-heading2' )
} );
ve.ui.commandHelpRegistry.register( 'formatting', 'listNumber', { sequences: [ 'numberHash' ] } );
ve.ui.commandHelpRegistry.register( 'formatting', 'blockquote', { sequences: [ 'wikitextDescription' ] } );
ve.ui.commandHelpRegistry.register( 'insert', 'table', {
sequences: [ 'wikitextTable' ],
label: OO.ui.deferMsg( 'visualeditor-table-insert-table' )
} );
ve.ui.commandHelpRegistry.register( 'insert', 'comment', {
sequences: [ 'wikitextComment' ],
label: OO.ui.deferMsg( 'visualeditor-commentinspector-title' )
} );