mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Merge "Use destroy event to teardown new section inputs"
This commit is contained in:
commit
65ede4fc4f
|
@ -489,7 +489,7 @@ ve.init.mw.DesktopArticleTarget.prototype.setSurface = function ( surface ) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Setup new section inputs if required
|
||||
* Setup new section input for a surface, if required
|
||||
*
|
||||
* @param {ve.ui.Surface} surface Surface
|
||||
*/
|
||||
|
@ -510,32 +510,21 @@ ve.init.mw.DesktopArticleTarget.prototype.setupNewSection = function ( surface )
|
|||
if ( this.currentUri.query.preloadtitle ) {
|
||||
this.sectionTitle.setValue( this.currentUri.query.preloadtitle );
|
||||
}
|
||||
surface.once( 'destroy', this.teardownNewSection.bind( this, surface ) );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Teardown new section inputs
|
||||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.teardownNewSection = function () {
|
||||
if ( this.getSurface() ) {
|
||||
this.getSurface().setPlaceholder( '' );
|
||||
}
|
||||
ve.init.mw.DesktopArticleTarget.prototype.teardownNewSection = function ( surface ) {
|
||||
surface.setPlaceholder( '' );
|
||||
if ( this.sectionTitle ) {
|
||||
this.sectionTitle.$element.remove();
|
||||
this.sectionTitle = null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.DesktopArticleTarget.prototype.clearSurfaces = function () {
|
||||
this.teardownNewSection();
|
||||
|
||||
// Parent method
|
||||
ve.init.mw.DesktopArticleTarget.super.prototype.clearSurfaces.apply( this, arguments );
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether we want to switch to view mode or not (displaying a dialog if necessary)
|
||||
* Then, if we do, actually switches to view mode.
|
||||
|
@ -560,7 +549,6 @@ ve.init.mw.DesktopArticleTarget.prototype.deactivate = function ( noDialog, trac
|
|||
if ( this.editingTabDialog ) {
|
||||
this.editingTabDialog.close();
|
||||
}
|
||||
this.teardownNewSection();
|
||||
this.editingTabDialog = null;
|
||||
|
||||
if ( noDialog || this.activating || !this.edited ) {
|
||||
|
|
Loading…
Reference in a new issue