jenkins-bot has submitted this change and it was merged.

Change subject: Show beta welcome dialog before surface is ready
......................................................................


Show beta welcome dialog before surface is ready

Split up beta and meta dialog show methods so that beta dialog
is displayed as soon as possible, regardless of the surface being
ready. Also make sure that we destroy the temporary window
manager on destroy.

Bug: T90454
Change-Id: Ib8f94518af431487ce940a74a8c268dbdbe403d2
---
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
3 files changed, 60 insertions(+), 14 deletions(-)

Approvals:
  Trevor Parscal: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
index f2a8cc8..69efc85 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-monobook.css
@@ -18,7 +18,8 @@
        font-size: 1em;
 }
 
-.ve-ui-overlay {
+.ve-ui-overlay,
+.ve-init-mw-viewPageTarget-windowManager-welcome {
        /* Mimic #globalWrapper */
        font-size: 127%;
 }
diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
index 5aa95e3..fc6715a 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-vector.css
@@ -98,3 +98,8 @@
                margin: 1em -1.5em -1.5em -1.5em;
        }
 }
+
+/* Prevent the progress bar from overlaying the welcome dialog */
+.ve-init-mw-viewPageTarget-windowManager-welcome .oo-ui-dialog {
+       z-index: 2;
+}
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index b613f84..72144e6 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -40,6 +40,9 @@
        this.recreating = false;
        this.activatingDeferred = null;
        this.toolbarSetupDeferred = null;
+       this.welcomeDialog = null;
+       this.welcomeDialogPromise = null;
+
        // If this is true then #transformPage / #restorePage will not call 
pushState
        // This is to avoid adding a new history entry for the url we just got 
from onpopstate
        // (which would mess up with the expected order of Back/Forwards 
browsing)
@@ -282,6 +285,8 @@
                this.activatingDeferred = $.Deferred();
                this.toolbarSetupDeferred = $.Deferred();
 
+               this.maybeShowWelcomeDialog();
+
                $( 'html' ).removeClass( 've-loading' ).addClass( 
've-activating' );
                $.when( this.activatingDeferred, this.toolbarSetupDeferred 
).always( function () {
                        $( 'html' ).removeClass( 've-activating' ).addClass( 
've-active' );
@@ -335,6 +340,9 @@
        if ( this.deactivating || ( !this.active && !this.activating ) ) {
                return;
        }
+
+       // Just in case this wasn't closed before
+       this.welcomeDialog.close();
 
        if ( noDialog || this.activating || !this.edited ) {
                this.cancel( trackMechanism );
@@ -522,7 +530,7 @@
        this.restoreScrollPosition();
        this.restoreEditSection();
        this.setupUnloadHandlers();
-       this.maybeShowDialogs();
+       this.maybeShowMetaDialog();
 
        this.activatingDeferred.resolve();
 
@@ -1573,11 +1581,25 @@
 };
 
 /**
- * Show dialogs as needed on load.
+ * Show the beta dialog as needed
  */
-ve.init.mw.ViewPageTarget.prototype.maybeShowDialogs = function () {
-       var usePrefs, prefSaysShow, urlSaysHide, target = this;
+ve.init.mw.ViewPageTarget.prototype.maybeShowWelcomeDialog = function () {
+       var usePrefs, prefSaysShow, urlSaysHide, windowManager,
+               target = this;
+
+       this.welcomeDialogPromise = $.Deferred();
+
        if ( mw.config.get( 'wgVisualEditorConfig' ).showBetaWelcome ) {
+               // Set up a temporary window manager
+               windowManager = new OO.ui.WindowManager( {
+                       classes: [
+                       've-init-mw-viewPageTarget-windowManager',
+                       've-init-mw-viewPageTarget-windowManager-welcome'
+               ]
+               } );
+               $( 'body' ).append( windowManager.$element );
+               this.welcomeDialog = new ve.ui.MWBetaWelcomeDialog();
+               windowManager.addWindows( [ this.welcomeDialog ] );
 
                // Only use the preference value if the user is logged-in.
                // If the user is anonymous, we can't save the preference
@@ -1600,17 +1622,20 @@
                                )
                        )
                ) {
-                       this.getSurface().getDialogs().openWindow( 
'betaWelcome' ).done( function ( opened ) {
-                               opened.done( function ( closing ) {
-                                       closing.done( function () {
-                                               // Pop out the notices when the 
welcome dialog is closed
-                                               
target.actionsToolbar.tools.notices.getPopup().toggle( true );
-                                       } );
+                       windowManager.openWindow( this.welcomeDialog )
+                               .then( function ( opened ) {
+                                       return opened;
+                               } )
+                               .then( function ( closing ) {
+                                       return closing;
+                               } )
+                               .then( function () {
+                                       // Detach the temporary window manager
+                                       windowManager.destroy();
+                                       target.welcomeDialogPromise.resolve();
                                } );
-                       } );
                } else {
-                       // Automatically open the notices immediately
-                       this.actionsToolbar.tools.notices.getPopup().toggle( 
true );
+                       this.welcomeDialogPromise.resolve();
                }
 
                if ( prefSaysShow ) {
@@ -1629,7 +1654,22 @@
                                $.cookie( 've-beta-welcome-dialog', 1, { path: 
'/', expires: 30 } );
                        }
                }
+       } else {
+               this.welcomeDialogPromise.reject();
        }
+};
+
+/**
+ * Show the meta dialog as needed on load.
+ */
+ve.init.mw.ViewPageTarget.prototype.maybeShowMetaDialog = function () {
+       var target = this;
+
+       this.welcomeDialogPromise
+               .always( function () {
+                       // Pop out the notices when the welcome dialog is closed
+                       target.actionsToolbar.tools.notices.getPopup().toggle( 
true );
+               } );
 
        if ( this.getSurface().getModel().metaList.getItemsInGroup( 
'mwRedirect' ).length ) {
                this.getSurface().getDialogs().openWindow( 'meta', {

-- 
To view, visit https://gerrit.wikimedia.org/r/199755
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib8f94518af431487ce940a74a8c268dbdbe403d2
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to