From 4a288a5866bae4c469bfc3ecf6261f707d82d414 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Wed, 10 Feb 2016 02:27:50 +0000 Subject: [PATCH] Try to make MW->VE switching failures break less things * Try to hide loading bar on failure * Don't set wgAction back to 'view' if we're dropping the user back to the wikitext editor Bug: T125580 Change-Id: I13058ae131a1dda3b172e78d9b143d70831c47f1 --- .../ve.init.mw.DesktopArticleTarget.init.js | 15 +++++++++++---- .../targets/ve.init.mw.DesktopArticleTarget.js | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) 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 5882c3df4f..b8665a1211 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 @@ -33,6 +33,7 @@ function showLoading() { var $content, contentRect, offsetTop, windowHeight, top, bottom, middle; + $( 'html' ).addClass( 've-activated ve-loading' ); if ( !init.$loading ) { init.$loading = $( '
' + @@ -77,6 +78,7 @@ } function hideLoading() { + $( 'html' ).removeClass( 've-activated ve-loading' ); if ( init.$loading ) { init.$loading.detach(); } @@ -202,13 +204,18 @@ modified ); } ) - .done( function () { - incrementLoadingProgress(); - } ); + .then( + function () { + incrementLoadingProgress(); + }, + function () { + hideLoading(); + resetLoadingProgress(); + } + ); setEditorPreference( 'visualeditor' ); - $( 'html' ).addClass( 've-activated ve-loading' ); showLoading(); incrementLoadingProgress(); active = true; 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 49bbf4787b..49cdcc6a31 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -1066,7 +1066,7 @@ ve.init.mw.DesktopArticleTarget.prototype.restorePage = function () { if ( 'vesection' in uri.query ) { delete uri.query.vesection; } - if ( 'action' in uri.query ) { + if ( 'action' in uri.query && $( '#wpTextbox1' ).length === 0 ) { delete uri.query.action; mw.config.set( 'wgAction', 'view' ); }