diff --git a/extension.json b/extension.json index 322cf306b8..58b84e6f75 100644 --- a/extension.json +++ b/extension.json @@ -22,7 +22,7 @@ "license-name": "MIT", "type": "editor", "requires": { - "MediaWiki": ">= 1.32.0" + "MediaWiki": ">= 1.33.0" }, "callback": "VisualEditorHooks::onRegistration", "config": { diff --git a/includes/VisualEditorHooks.php b/includes/VisualEditorHooks.php index 8ef0f259c0..9c847d7085 100644 --- a/includes/VisualEditorHooks.php +++ b/includes/VisualEditorHooks.php @@ -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 diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js index 760eff7a45..570d705f97 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js @@ -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' ); } diff --git a/modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js b/modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js index a8b056b355..be8e29f87b 100644 --- a/modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js +++ b/modules/ve-mw/ui/tools/ve.ui.MWSignatureTool.js @@ -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', {