jenkins-bot has submitted this change and it was merged.
Change subject: Add container option to popup widgets
......................................................................
Add container option to popup widgets
This actually fixes a hack done in a previous commit where an undocumented
surface option was being passed, but not always. And in some cases there
were uses of the popup which didn't really have a surface to pass in.
Change-Id: I08b5dc2dc879f6abd1b16d1d66ac1d8b5624f673
---
M modules/ve/ui/ve.ui.Context.js
M modules/ve/ui/widgets/ve.ui.PopupWidget.js
2 files changed, 4 insertions(+), 3 deletions(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 99dec73..09b4273 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -29,7 +29,7 @@
this.embedded = false;
this.selection = null;
this.toolbar = null;
- this.popup = new ve.ui.PopupWidget( { '$$': this.$$, surface:
this.surface } );
+ this.popup = new ve.ui.PopupWidget( { '$$': this.$$, '$container':
this.surface.getView().$ } );
this.$menu = this.$$( '<div>' );
this.inspectors = new ve.ui.WindowSet( surface, ve.ui.inspectorFactory
);
diff --git a/modules/ve/ui/widgets/ve.ui.PopupWidget.js
b/modules/ve/ui/widgets/ve.ui.PopupWidget.js
index d8850e6..510f700 100644
--- a/modules/ve/ui/widgets/ve.ui.PopupWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.PopupWidget.js
@@ -13,6 +13,7 @@
*
* @constructor
* @param {Object} [config] Config options
+ * @cfg {jQuery} [$container] Container to make popup positioned relative to
* @cfg {boolean} [autoClose=false] Popup auto-closes when it loses focus
*/
ve.ui.PopupWidget = function VeUiPopupWidget( config ) {
@@ -25,8 +26,8 @@
// Properties
this.visible = false;
this.$callout = this.$$( '<div>' );
+ this.$container = config.$container || this.$$( 'body' );
this.$body = this.$$( '<div>' );
- this.surface = config.surface;
this.transitionTimeout = null;
this.align = config.align || 'center';
this.autoClose = !!config.autoClose;
@@ -153,7 +154,7 @@
}
// Prevent viewport clipping, using padding between body and popup edges
- overlapRight = this.surface.view.$.outerWidth( true ) - ( x + ( width +
left + ( padding * 2 ) ) );
+ overlapRight = this.$container.outerWidth( true ) - ( x + ( width +
left + ( padding * 2 ) ) );
overlapLeft = x + ( left - ( padding * 2 ) );
if ( overlapRight < 0 ) {
overlapOffset = overlapRight;
--
To view, visit https://gerrit.wikimedia.org/r/71752
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I08b5dc2dc879f6abd1b16d1d66ac1d8b5624f673
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits