From b33cd5d8f1d5f2b91acddba67066127a2c5c7c39 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 1 Jun 2016 14:52:57 +0100 Subject: [PATCH] Fix loading bar opacity * Ensure ve-loading isn't removed early * Quickly detach then reattach the loading bar during activation so it doesn't get moved and marked as original content Change-Id: I263c9627348953a11966f8bcc435d0d89b0b6084 --- .../init/styles/ve.init.mw.DesktopArticleTarget.init.css | 2 +- .../init/targets/ve.init.mw.DesktopArticleTarget.init.js | 8 +++++++- .../ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css index fa10a735b6..7299a8e792 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css +++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css @@ -13,7 +13,7 @@ * Reading | ve-available * Loading editor | ve-available ve-activated ve-loading * - mw.DesktopArticleTarget.css is loaded - * Activate editor | ve-available ve-activated ve-activating + * Activate editor | ve-available ve-activated ve-loading ve-activating * Active | ve-available ve-activated ve-active * Deactivate editor | ve-available ve-deactivating * Deactivated | ve-available diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js index cd4446f295..d465750ffa 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js @@ -246,12 +246,18 @@ targetPromise = targetPromise || getTarget(); targetPromise .then( function ( target ) { + var activatePromise; incrementLoadingProgress(); target.on( 'deactivate', function () { active = false; } ); target.on( 'loadError', handleLoadFailure ); - return target.activate( dataPromise ); + // Detach the loading bar for activation so it doesn't get moved around + // and altered, re-attach immediately after + init.$loading.detach(); + activatePromise = target.activate( dataPromise ); + $( '#content' ).prepend( init.$loading ); + return activatePromise; } ) .then( function () { ve.track( 'mwedit.ready' ); diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index 192820a732..bdd1c05e5e 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -457,7 +457,7 @@ ve.init.mw.DesktopArticleTarget.prototype.activate = function ( dataPromise ) { this.activatingDeferred = $.Deferred(); this.toolbarSetupDeferred = $.Deferred(); - $( 'html' ).removeClass( 've-loading' ).addClass( 've-activating' ); + $( 'html' ).addClass( 've-activating' ); $.when( this.activatingDeferred, this.toolbarSetupDeferred ).done( function () { target.afterActivate(); } ).fail( function () {