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
This commit is contained in:
Alex Monk 2016-02-10 02:27:50 +00:00 committed by Alex Monk
parent 80124c88a6
commit 4a288a5866
2 changed files with 12 additions and 5 deletions

View file

@ -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 = $(
'<div class="ve-init-mw-desktopArticleTarget-loading-overlay">' +
@ -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;

View file

@ -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' );
}