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 b5c27b9a83..0a38b014c9 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
@@ -35,6 +35,7 @@
function showLoading() {
var $content, contentRect, offsetTop, windowHeight, top, bottom, middle;
+ $( 'html' ).addClass( 've-activated ve-loading' );
if ( !init.$loading ) {
init.$loading = $(
'
' +
@@ -79,6 +80,7 @@
}
function hideLoading() {
+ $( 'html' ).removeClass( 've-activated ve-loading' );
if ( init.$loading ) {
init.$loading.detach();
}
@@ -204,13 +206,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 eb38d54a1b..c57a01d1df 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -1067,7 +1067,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' );
}