Merge "Ensure that ve.init.target is correct when re-activating an ArticleTarget"

This commit is contained in:
jenkins-bot 2020-03-11 23:28:23 +00:00 committed by Gerrit Code Review
commit cb9895e304
2 changed files with 11 additions and 0 deletions

View file

@ -29,6 +29,13 @@ ve.init.mw.ArticleTarget = function VeInitMwArticleTarget( config ) {
// Parent constructor
ve.init.mw.ArticleTarget.super.call( this, config );
// Register
if ( config.register !== false ) {
// ArticleTargets are never destroyed, but we can't trust ve.init.target to
// not get overridden by other targets that may get created on the page.
ve.init.articleTarget = this;
}
// Properties
this.saveDialog = null;
this.saveDeferred = null;

View file

@ -404,6 +404,10 @@ ve.init.mw.DesktopArticleTarget.prototype.activate = function ( dataPromise ) {
var surface,
target = this;
// We may be re-activating an old target, during which time ve.init.target
// has been overridden.
ve.init.target = ve.init.articleTarget;
if ( !this.active && !this.activating ) {
this.activating = true;
this.activatingDeferred = ve.createDeferred();