mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +00:00
Teardown target before reloading article
Ensures that auto-save data is cleared after creating a new article, or restoring a revision. Bug: T192770 Change-Id: I348b8522c1a935d7db1243ba8fcbd5b24e3383a2
This commit is contained in:
parent
348e9163db
commit
1f4baa7b58
|
@ -566,6 +566,7 @@ ve.init.mw.DesktopArticleTarget.prototype.tryTeardown = function ( noPrompt, tra
|
|||
}
|
||||
this.editingTabDialog = null;
|
||||
|
||||
// Parent method
|
||||
return ve.init.mw.DesktopArticleTarget.super.prototype.tryTeardown.call( this, noPrompt || this.activating, trackMechanism );
|
||||
};
|
||||
|
||||
|
@ -631,9 +632,9 @@ ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism )
|
|||
this.saveDialog = null;
|
||||
}
|
||||
|
||||
saveDialogPromise.then( function () {
|
||||
return saveDialogPromise.then( function () {
|
||||
// Parent method
|
||||
ve.init.mw.DesktopArticleTarget.super.prototype.teardown.call( target ).then( function () {
|
||||
return ve.init.mw.DesktopArticleTarget.super.prototype.teardown.call( target ).then( function () {
|
||||
// After teardown
|
||||
target.active = false;
|
||||
|
||||
|
@ -934,20 +935,24 @@ ve.init.mw.DesktopArticleTarget.prototype.onViewTabClick = function ( e ) {
|
|||
ve.init.mw.DesktopArticleTarget.prototype.saveComplete = function (
|
||||
html, categoriesHtml, newid, isRedirect, displayTitle, lastModified, contentSub, modules, jsconfigvars
|
||||
) {
|
||||
var newUrlParams, watchChecked, watch;
|
||||
var newUrlParams, watchChecked, watch,
|
||||
target = this;
|
||||
|
||||
// Parent method
|
||||
ve.init.mw.DesktopArticleTarget.super.prototype.saveComplete.apply( this, arguments );
|
||||
|
||||
if ( !this.pageExists || this.restoring ) {
|
||||
// This is a page creation or restoration, refresh the page
|
||||
this.teardownUnloadHandlers();
|
||||
newUrlParams = newid === undefined ? {} : { venotify: this.restoring ? 'restored' : 'created' };
|
||||
// Teardown the target, ensuring auto-save data is cleared
|
||||
this.teardown().then( function () {
|
||||
|
||||
if ( isRedirect ) {
|
||||
newUrlParams.redirect = 'no';
|
||||
}
|
||||
location.href = this.viewUri.extend( newUrlParams );
|
||||
// This is a page creation or restoration, refresh the page
|
||||
newUrlParams = newid === undefined ? {} : { venotify: this.restoring ? 'restored' : 'created' };
|
||||
|
||||
if ( isRedirect ) {
|
||||
newUrlParams.redirect = 'no';
|
||||
}
|
||||
location.href = target.viewUri.extend( newUrlParams );
|
||||
} );
|
||||
} else {
|
||||
// Update watch link to match 'watch checkbox' in save dialog.
|
||||
// User logged in if module loaded.
|
||||
|
|
Loading…
Reference in a new issue