mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Load notices when switching, just don't show them"
This commit is contained in:
commit
dd6113bb76
|
@ -747,10 +747,12 @@ ve.init.mw.DesktopArticleTarget.prototype.loadFail = function ( code, errorDetai
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
ve.init.mw.DesktopArticleTarget.prototype.surfaceReady = function () {
|
ve.init.mw.DesktopArticleTarget.prototype.surfaceReady = function () {
|
||||||
var surface = this.getSurface(),
|
var redirectMetaItems,
|
||||||
|
editNotices = this.getEditNotices(),
|
||||||
|
actionTools = this.actionsToolbar.tools,
|
||||||
|
surface = this.getSurface(),
|
||||||
surfaceReadyTime = ve.now(),
|
surfaceReadyTime = ve.now(),
|
||||||
target = this,
|
target = this;
|
||||||
redirectMetaItems;
|
|
||||||
|
|
||||||
if ( !this.activating ) {
|
if ( !this.activating ) {
|
||||||
// Activation was aborted before we got here. Do nothing
|
// Activation was aborted before we got here. Do nothing
|
||||||
|
@ -799,6 +801,14 @@ ve.init.mw.DesktopArticleTarget.prototype.surfaceReady = function () {
|
||||||
this.setFakeRedirectInterface( null );
|
this.setFakeRedirectInterface( null );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set edit notices, will be shown after meta dialog.
|
||||||
|
if ( editNotices.length ) {
|
||||||
|
actionTools.notices.setNotices( this.getEditNotices() );
|
||||||
|
} else {
|
||||||
|
actionTools.notices.destroy();
|
||||||
|
actionTools.notices = null;
|
||||||
|
}
|
||||||
|
|
||||||
this.setupUnloadHandlers();
|
this.setupUnloadHandlers();
|
||||||
if ( !this.suppressNormalStartupDialogs ) {
|
if ( !this.suppressNormalStartupDialogs ) {
|
||||||
this.maybeShowWelcomeDialog();
|
this.maybeShowWelcomeDialog();
|
||||||
|
@ -1543,19 +1553,21 @@ ve.init.mw.DesktopArticleTarget.prototype.maybeShowMetaDialog = function () {
|
||||||
target = this;
|
target = this;
|
||||||
|
|
||||||
if ( this.welcomeDialogPromise ) {
|
if ( this.welcomeDialogPromise ) {
|
||||||
|
// Pop out the notices when the welcome dialog is closed
|
||||||
this.welcomeDialogPromise
|
this.welcomeDialogPromise
|
||||||
.always( function () {
|
.always( function () {
|
||||||
var popup;
|
var popup;
|
||||||
// Pop out the notices when the welcome dialog is closed
|
|
||||||
if (
|
if (
|
||||||
target.switched &&
|
target.switched &&
|
||||||
!mw.user.options.get( 'visualeditor-hidevisualswitchpopup' )
|
!mw.user.options.get( 'visualeditor-hidevisualswitchpopup' )
|
||||||
) {
|
) {
|
||||||
|
// Show "switched" popup
|
||||||
popup = new mw.libs.ve.SwitchPopupWidget( 'visual' );
|
popup = new mw.libs.ve.SwitchPopupWidget( 'visual' );
|
||||||
target.actionsToolbar.tools.editModeSource.toolGroup.$element.append( popup.$element );
|
target.actionsToolbar.tools.editModeSource.toolGroup.$element.append( popup.$element );
|
||||||
popup.toggle( true );
|
popup.toggle( true );
|
||||||
} else {
|
} else if ( target.actionsToolbar.tools.notices ) {
|
||||||
target.actionsToolbar.tools.notices.setNotices( target.getEditNotices() );
|
// Show notices
|
||||||
|
target.actionsToolbar.tools.notices.getPopup().toggle( true );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,19 +65,14 @@ ve.ui.MWNoticesPopupTool.static.autoAddToGroup = false;
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set notices to display, and either destroy the tool (if none to display) or open the popup.
|
* Set notices to display
|
||||||
*
|
*
|
||||||
* @param {string[]} notices
|
* @param {string[]} notices A (non-empty) list of notices
|
||||||
*/
|
*/
|
||||||
ve.ui.MWNoticesPopupTool.prototype.setNotices = function ( notices ) {
|
ve.ui.MWNoticesPopupTool.prototype.setNotices = function ( notices ) {
|
||||||
var tool = this,
|
var tool = this,
|
||||||
count = notices.length;
|
count = notices.length;
|
||||||
|
|
||||||
if ( !count ) {
|
|
||||||
this.destroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.popup.setLabel( ve.msg(
|
this.popup.setLabel( ve.msg(
|
||||||
'visualeditor-editnotices-tool',
|
'visualeditor-editnotices-tool',
|
||||||
mw.language.convertNumber( count )
|
mw.language.convertNumber( count )
|
||||||
|
@ -101,8 +96,6 @@ ve.ui.MWNoticesPopupTool.prototype.setNotices = function ( notices ) {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
this.popup.$body.append( this.$items );
|
this.popup.$body.append( this.$items );
|
||||||
|
|
||||||
this.popup.toggle( true );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue