jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/347347 )
Change subject: [BREAKING CHANGE] Remove resize handlers from within DiffElement
......................................................................
[BREAKING CHANGE] Remove resize handlers from within DiffElement
Knowing when the element's container has changed width
should be the responsibility of the caller, not the DiffElement.
Change-Id: I82a67a4309bf76db5407ea38c26c47d14c01e921
---
M src/ui/dialogs/ve.ui.DiffDialog.js
M src/ui/elements/ve.ui.DiffElement.js
2 files changed, 26 insertions(+), 27 deletions(-)
Approvals:
jenkins-bot: Verified
Jforrester: Looks good to me, approved
diff --git a/src/ui/dialogs/ve.ui.DiffDialog.js
b/src/ui/dialogs/ve.ui.DiffDialog.js
index e44669b..f012c70 100644
--- a/src/ui/dialogs/ve.ui.DiffDialog.js
+++ b/src/ui/dialogs/ve.ui.DiffDialog.js
@@ -76,14 +76,33 @@
ve.ui.DiffDialog.prototype.getReadyProcess = function ( data ) {
return ve.ui.DiffDialog.super.prototype.getReadyProcess.call( this,
data )
.next( function () {
- var dialog = this;
- setTimeout( function () {
- dialog.withoutSizeTransitions( function () {
-
dialog.diffElement.positionDescriptions();
- dialog.updateSize();
- } );
- }, OO.ui.theme.getDialogTransitionDuration() );
+ this.positionDiffElement();
}, this );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.DiffDialog.prototype.setDimensions = function () {
+ // Parent method
+ ve.ui.DiffDialog.parent.prototype.setDimensions.apply( this, arguments
);
+
+ this.positionDiffElement();
+};
+
+/**
+ * Re-position elements within the diff element
+ *
+ * Should be called whenever the diff element's container has changed width.
+ */
+ve.ui.DiffDialog.prototype.positionDiffElement = function () {
+ var dialog = this;
+ setTimeout( function () {
+ dialog.withoutSizeTransitions( function () {
+ dialog.diffElement.positionDescriptions();
+ dialog.updateSize();
+ } );
+ }, OO.ui.theme.getDialogTransitionDuration() );
};
/**
@@ -92,7 +111,6 @@
ve.ui.DiffDialog.prototype.getTeardownProcess = function ( data ) {
return ve.ui.DiffDialog.super.prototype.getTeardownProcess.call( this,
data )
.next( function () {
- this.diffElement.destroy();
this.diffElement.$element.remove();
}, this );
};
diff --git a/src/ui/elements/ve.ui.DiffElement.js
b/src/ui/elements/ve.ui.DiffElement.js
index c97385c..218153d 100644
--- a/src/ui/elements/ve.ui.DiffElement.js
+++ b/src/ui/elements/ve.ui.DiffElement.js
@@ -42,8 +42,6 @@
this.descriptions = new ve.ui.ChangeDescriptionsSelectWidget();
this.descriptions.connect( this, { highlight: 'onDescriptionsHighlight'
} );
this.descriptionItemsStack = [];
- this.onWindowResizeDebounced = ve.debounce( this.onWindowResize.bind(
this ), 250 );
- $( this.getElementWindow() ).on( 'resize', this.onWindowResizeDebounced
);
this.$document.on( {
mousemove: this.onDocumentMouseMove.bind( this )
@@ -156,15 +154,6 @@
};
/**
- * Handle window resize events
- *
- * @param {jQuery.Event} event Window resize event
- */
-ve.ui.DiffElement.prototype.onWindowResize = function () {
- this.positionDescriptions();
-};
-
-/**
* Reposition the description items so they are not above their position in
the document
*/
ve.ui.DiffElement.prototype.positionDescriptions = function () {
@@ -183,14 +172,6 @@
} );
this.$document.css( 'min-height', this.$sidebar.height() );
-};
-
-/**
- * Destroy the diff and remove global handlers
- */
-ve.ui.DiffElement.prototype.destroy = function () {
- $( this.getElementWindow() ).off( 'resize',
this.onWindowResizeDebounced );
- this.$element.remove();
};
/**
--
To view, visit https://gerrit.wikimedia.org/r/347347
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I82a67a4309bf76db5407ea38c26c47d14c01e921
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits