mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Merge "Don't try to prefix browser title if a custom message is incompatible"
This commit is contained in:
commit
2d9e31e0e5
|
@ -990,24 +990,32 @@ ve.init.mw.DesktopArticleTarget.prototype.teardownToolbar = function () {
|
|||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.changeDocumentTitle = function () {
|
||||
var title = mw.Title.newFromText( this.getPageName() );
|
||||
|
||||
// Use the real title if we loaded a view page, otherwise reconstruct it
|
||||
this.originalDocumentTitle = this.isViewPage ? document.title : ve.msg( 'pagetitle', title.getPrefixedText() );
|
||||
|
||||
// Reconstruct an edit title
|
||||
document.title = ve.msg( 'pagetitle',
|
||||
var pageTitleMsg = mw.message( 'pagetitle',
|
||||
ve.msg(
|
||||
this.pageExists ? 'editing' : 'creating',
|
||||
title.getPrefixedText()
|
||||
)
|
||||
);
|
||||
|
||||
// T317600
|
||||
if ( pageTitleMsg.isParseable() ) {
|
||||
// Use the real title if we loaded a view page, otherwise reconstruct it
|
||||
this.originalDocumentTitle = this.isViewPage ? document.title : ve.msg( 'pagetitle', title.getPrefixedText() );
|
||||
// Reconstruct an edit title
|
||||
document.title = pageTitleMsg.text();
|
||||
} else {
|
||||
mw.log.warn( 'VisualEditor: MediaWiki:Pagetitle contains unsupported syntax. ' +
|
||||
'https://www.mediawiki.org/wiki/Manual:Messages_API#Feature_support_in_JavaScript' );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Restore the original document title.
|
||||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.restoreDocumentTitle = function () {
|
||||
document.title = this.originalDocumentTitle;
|
||||
if ( this.originalDocumentTitle ) {
|
||||
document.title = this.originalDocumentTitle;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue