mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Use mw.Title.wantSignaturesNamespace
Change-Id: I60187f0a3eb9cf5d56a4fdaa3401b107758bd8e3 Depends-On: Ib2faa22c429096d545ddb829a6b4025427ad6071
This commit is contained in:
parent
cd1d40e691
commit
0d54a62858
|
@ -22,7 +22,7 @@
|
|||
"license-name": "MIT",
|
||||
"type": "editor",
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.32.0"
|
||||
"MediaWiki": ">= 1.33.0"
|
||||
},
|
||||
"callback": "VisualEditorHooks::onRegistration",
|
||||
"config": {
|
||||
|
|
|
@ -909,9 +909,6 @@ class VisualEditorHooks {
|
|||
'preferenceModules' => $veConfig->get( 'VisualEditorPreferenceModules' ),
|
||||
'namespaces' => $availableNamespaces,
|
||||
'contentModels' => $availableContentModels,
|
||||
'signatureNamespaces' => array_values(
|
||||
array_filter( MWNamespace::getValidNamespaces(), 'MWNamespace::wantSignatures' )
|
||||
),
|
||||
'pluginModules' => array_merge(
|
||||
ExtensionRegistry::getInstance()->getAttribute( 'VisualEditorPluginModules' ),
|
||||
// @todo deprecate the global setting
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
( function () {
|
||||
var prefName, prefValue,
|
||||
uri = new mw.Uri(),
|
||||
namespaces = mw.config.get( 'wgNamespaceIds' ),
|
||||
conf = mw.config.get( 'wgVisualEditorConfig' ),
|
||||
pluginCallbacks = [],
|
||||
modules = [ 'ext.visualEditor.articleTarget' ]
|
||||
|
@ -35,8 +36,13 @@
|
|||
modules.push( 'ext.visualEditor.mwwikitext' );
|
||||
}
|
||||
|
||||
// Allow signing posts in select namespaces
|
||||
if ( conf.signatureNamespaces.length ) {
|
||||
// Load signature tool if *any* namespace supports it.
|
||||
// It will be shown disabled on namespaces that don't support it.
|
||||
if (
|
||||
Object.keys( namespaces ).some( function ( name ) {
|
||||
return mw.Title.wantSignaturesNamespace( namespaces[ name ] );
|
||||
} )
|
||||
) {
|
||||
modules.push( 'ext.visualEditor.mwsignature' );
|
||||
}
|
||||
|
||||
|
|
|
@ -31,11 +31,9 @@ ve.ui.MWSignatureTool.static.commandName = 'mwSignature';
|
|||
|
||||
ve.ui.toolFactory.register( ve.ui.MWSignatureTool );
|
||||
|
||||
if (
|
||||
mw.config.get( 'wgVisualEditorConfig' ).signatureNamespaces.indexOf(
|
||||
new mw.Title( mw.config.get( 'wgRelevantPageName' ) ).getNamespaceId()
|
||||
) !== -1
|
||||
) {
|
||||
// Commands and sequences are only registered on supported namespaces.
|
||||
// On other namespaces the tool is still shown, but disabled.
|
||||
if ( mw.Title.wantSignaturesNamespace( mw.config.get( 'wgNamespaceNumber' ) ) ) {
|
||||
// Command to insert signature node.
|
||||
ve.ui.commandRegistry.register(
|
||||
new ve.ui.Command( 'mwSignature', 'content', 'insert', {
|
||||
|
|
Loading…
Reference in a new issue