mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
(bug 37837) Spinner of death on error
* Reusing deactivate method to recover from load error * Made deactivate resilient to some properties not being set yet (so we can call it on load error) * Restoring save dialog state after save error Change-Id: I6a697dc6bddeebecf4e2ab26805bee9f3754c714
This commit is contained in:
parent
aebc22f0ed
commit
4737727f34
|
@ -201,7 +201,7 @@ ve.init.mw.ViewPageTarget.prototype.activate = function () {
|
|||
* @method
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.deactivate = function ( override ) {
|
||||
if ( this.active && !this.deactivating ) {
|
||||
if ( override || ( this.active && !this.deactivating ) ) {
|
||||
if (
|
||||
override ||
|
||||
!this.surface.getModel().getHistory().length ||
|
||||
|
@ -256,11 +256,8 @@ ve.init.mw.ViewPageTarget.prototype.onLoadError = function ( response, status )
|
|||
this.load();
|
||||
} else {
|
||||
this.activating = false;
|
||||
this.restoreSkinTabs();
|
||||
this.hideSpinner();
|
||||
this.showTableOfContents();
|
||||
this.showPageContent();
|
||||
this.restorePageTitle();
|
||||
// User interface changes
|
||||
this.deactivate( true );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -311,6 +308,8 @@ ve.init.mw.ViewPageTarget.prototype.onSave = function ( html ) {
|
|||
ve.init.mw.ViewPageTarget.prototype.onSaveError = function ( response, status ) {
|
||||
// TODO: Don't use alert.
|
||||
alert( ve.msg( 'visualeditor-saveerror', status ) );
|
||||
this.unlockSaveDialogSaveButton();
|
||||
this.$saveDialogLoadingIcon.hide();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -524,16 +523,20 @@ ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () {
|
|||
// Reset tabs
|
||||
this.restoreSkinTabs();
|
||||
// Update UI
|
||||
if ( this.$document ) {
|
||||
this.$document.blur();
|
||||
this.$document = null;
|
||||
}
|
||||
this.detachToolbar();
|
||||
this.hideSpinner();
|
||||
this.showPageContent();
|
||||
this.restorePageTitle();
|
||||
this.showTableOfContents();
|
||||
// Destroy editor
|
||||
if ( this.surface ) {
|
||||
this.surface.destroy();
|
||||
this.surface = null;
|
||||
}
|
||||
this.active = false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue