mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 19:26:46 +00:00
mw.ViewPageTarget: Fix incomplete teardown sequence in #deactivate
When deactivating before the surface became active (e.g. this.active is still false, as case is the case when Parsoid isn't running), the teardown sequence was incomplete. Most notable, the page title (h1.firstHeading) was still dimmed after cancelling the alert for Parsoid error, eventhough everything else was shown and restored. * Moved call to #showTableOfContents in #deactivate up for consistency with #activate. * Added call to #restorePageTitle in #deactivate so that the title is restored even if the surface didn't activate yet. * Removed calls to various methods in #tearDownSurface that were already called by #deactivate. Now activate/deactivate and setUpSurface/tearDownSurface are in balance. Change-Id: Ibb2fbf0e5ab9b6a028d4e139c13aa7ff8c82be82
This commit is contained in:
parent
73f8299046
commit
7f01c9fadc
|
@ -223,7 +223,9 @@ ve.init.mw.ViewPageTarget.prototype.activate = function () {
|
|||
this.hideTableOfContents();
|
||||
this.mutePageContent();
|
||||
this.mutePageTitle();
|
||||
|
||||
this.saveScrollPosition();
|
||||
|
||||
this.load();
|
||||
}
|
||||
};
|
||||
|
@ -244,6 +246,7 @@ ve.init.mw.ViewPageTarget.prototype.deactivate = function ( override ) {
|
|||
// User interface changes
|
||||
this.restorePage();
|
||||
this.hideSpinner();
|
||||
this.showTableOfContents();
|
||||
|
||||
if ( this.toolbarCancelButton ) {
|
||||
// If deactivate is called before a successful load, then
|
||||
|
@ -256,17 +259,21 @@ ve.init.mw.ViewPageTarget.prototype.deactivate = function ( override ) {
|
|||
this.resetSaveDialog();
|
||||
this.hideSaveDialog();
|
||||
this.detachSaveDialog();
|
||||
// Check we got as far as setting up the surface
|
||||
|
||||
if ( this.active ) {
|
||||
// If we got as far as setting up the surface, tear that down
|
||||
this.tearDownSurface();
|
||||
} else {
|
||||
this.showPageContent();
|
||||
}
|
||||
|
||||
// Show/restore components that are otherwise handled by tearDownSurface
|
||||
this.showPageContent();
|
||||
this.restorePageTitle();
|
||||
|
||||
// If there is a load in progress, abort it
|
||||
if ( this.loading ) {
|
||||
this.loading.abort();
|
||||
}
|
||||
this.showTableOfContents();
|
||||
|
||||
this.deactivating = false;
|
||||
mw.hook( 've.deactivationComplete' ).fire();
|
||||
}
|
||||
|
@ -1204,11 +1211,7 @@ ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () {
|
|||
this.$document = null;
|
||||
}
|
||||
this.tearDownToolbar();
|
||||
this.hideSpinner();
|
||||
this.showPageContent();
|
||||
this.restorePageTitle();
|
||||
this.restoreDocumentTitle();
|
||||
this.showTableOfContents();
|
||||
// Destroy surface
|
||||
if ( this.surface ) {
|
||||
this.surface.destroy();
|
||||
|
|
Loading…
Reference in a new issue