mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
ve.init.mw.DesktopArticleTarget: Handle deactivate on namespace tab when it's a talk namespace
Turns out, talk namespaces are special. Bug: T204194 Change-Id: Ie9af128edd5874075098f8593e01595da863102d
This commit is contained in:
parent
1ffc627532
commit
bb5762a0b2
|
@ -1103,17 +1103,26 @@ ve.init.mw.DesktopArticleTarget.prototype.editSource = function () {
|
|||
* @method
|
||||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.setupSkinTabs = function () {
|
||||
var namespaceKey;
|
||||
var namespaceNumber, namespaceName, isTalkNamespace, namespaceKey, namespaceTabId;
|
||||
if ( this.isViewPage ) {
|
||||
// Mimics getNamespaceKey in Title.php
|
||||
namespaceKey = mw.config.get( 'wgCanonicalNamespace' ).toLowerCase() || 'main';
|
||||
namespaceNumber = mw.config.get( 'wgNamespaceNumber' );
|
||||
namespaceName = mw.config.get( 'wgCanonicalNamespace' );
|
||||
// MWNamespace::isTalk()
|
||||
isTalkNamespace = namespaceNumber > 0 && namespaceNumber % 2 !== 0;
|
||||
// Title::getNamespaceKey()
|
||||
namespaceKey = namespaceName.toLowerCase() || 'main';
|
||||
if ( namespaceKey === 'file' ) {
|
||||
namespaceKey = 'image';
|
||||
}
|
||||
// SkinTemplate::buildContentNavigationUrls()
|
||||
if ( isTalkNamespace ) {
|
||||
namespaceTabId = 'ca-talk';
|
||||
} else {
|
||||
namespaceTabId = 'ca-nstab-' + namespaceKey;
|
||||
}
|
||||
// Allow instant switching back to view mode, without refresh
|
||||
$( '#ca-view a, #ca-nstab-' + namespaceKey + ' a' )
|
||||
$( '#ca-view a, #' + namespaceTabId + ' a' )
|
||||
.on( 'click.ve-target', this.onViewTabClick.bind( this ) );
|
||||
|
||||
}
|
||||
|
||||
mw.hook( 've.skinTabSetupComplete' ).fire();
|
||||
|
|
Loading…
Reference in a new issue