Esanders has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/382487 )
Change subject: Use destroy event to teardown new section inputs
......................................................................
Use destroy event to teardown new section inputs
Change-Id: I4990a162b62b7195016efba47cc5926b9e3a0f21
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
1 file changed, 4 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/87/382487/1
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index 77c2105..3eab17a 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -489,7 +489,7 @@
};
/**
- * Setup new section inputs if required
+ * Setup new section input for a surface, if required
*
* @param {ve.ui.Surface} surface Surface
*/
@@ -510,30 +510,19 @@
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 );
};
/**
@@ -560,7 +549,6 @@
if ( this.editingTabDialog ) {
this.editingTabDialog.close();
}
- this.teardownNewSection();
this.editingTabDialog = null;
if ( noDialog || this.activating || !this.edited ) {
--
To view, visit https://gerrit.wikimedia.org/r/382487
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4990a162b62b7195016efba47cc5926b9e3a0f21
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits