Trevor Parscal has uploaded a new change for review.
https://gerrit.wikimedia.org/r/196655
Change subject: Allow access to surface through window manager
......................................................................
Allow access to surface through window manager
We've been back and forth on this, but we really just need a way for inspectors
to be able to open dialogs.
Change-Id: I3d9caef38755eb39c97e7ce35f7559ee7efdff0b
Bonus: Re-use the dialog manager for the language inspector's language
selection dialog
---
M src/ui/inspectors/ve.ui.LanguageInspector.js
M src/ui/ve.ui.DesktopContext.js
M src/ui/ve.ui.DesktopSurface.js
M src/ui/ve.ui.MobileContext.js
M src/ui/ve.ui.MobileSurface.js
M src/ui/ve.ui.Surface.js
M src/ui/ve.ui.WindowManager.js
M src/ui/windowmanagers/ve.ui.DesktopInspectorWindowManager.js
M src/ui/windowmanagers/ve.ui.MobileWindowManager.js
M src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js
10 files changed, 31 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/55/196655/1
diff --git a/src/ui/inspectors/ve.ui.LanguageInspector.js
b/src/ui/inspectors/ve.ui.LanguageInspector.js
index ec10259..b72142a 100644
--- a/src/ui/inspectors/ve.ui.LanguageInspector.js
+++ b/src/ui/inspectors/ve.ui.LanguageInspector.js
@@ -72,7 +72,10 @@
ve.ui.LanguageInspector.super.prototype.initialize.call( this );
// Properties
- this.languageInput = new ve.ui.LanguageInputWidget( { $: this.$ } );
+ this.languageInput = new ve.ui.LanguageInputWidget( {
+ $: this.$,
+ dialogManager: this.manager.getSurface().getDialogs()
+ } );
// Initialization
this.form.$element.append( this.languageInput.$element );
diff --git a/src/ui/ve.ui.DesktopContext.js b/src/ui/ve.ui.DesktopContext.js
index 0847187..1c78fc4 100644
--- a/src/ui/ve.ui.DesktopContext.js
+++ b/src/ui/ve.ui.DesktopContext.js
@@ -124,7 +124,7 @@
* @inheritdoc
*/
ve.ui.DesktopContext.prototype.createInspectorWindowManager = function () {
- return new ve.ui.DesktopInspectorWindowManager( {
+ return new ve.ui.DesktopInspectorWindowManager( this.surface, {
$: this.$,
factory: ve.ui.windowFactory,
overlay: this.surface.getLocalOverlay(),
diff --git a/src/ui/ve.ui.DesktopSurface.js b/src/ui/ve.ui.DesktopSurface.js
index d55e5a3..265a52c 100644
--- a/src/ui/ve.ui.DesktopSurface.js
+++ b/src/ui/ve.ui.DesktopSurface.js
@@ -37,5 +37,5 @@
* @inheritdoc
*/
ve.ui.DesktopSurface.prototype.createDialogWindowManager = function () {
- return new ve.ui.WindowManager( { factory: ve.ui.windowFactory } );
+ return new ve.ui.WindowManager( this.surface, { factory:
ve.ui.windowFactory } );
};
diff --git a/src/ui/ve.ui.MobileContext.js b/src/ui/ve.ui.MobileContext.js
index d0bc494..43204dc 100644
--- a/src/ui/ve.ui.MobileContext.js
+++ b/src/ui/ve.ui.MobileContext.js
@@ -48,7 +48,7 @@
* @inheritdoc
*/
ve.ui.MobileContext.prototype.createInspectorWindowManager = function () {
- return new ve.ui.MobileWindowManager( {
+ return new ve.ui.MobileWindowManager( this.surface, {
factory: ve.ui.windowFactory,
overlay: this.surface.getGlobalOverlay()
} );
diff --git a/src/ui/ve.ui.MobileSurface.js b/src/ui/ve.ui.MobileSurface.js
index b71f168..65c4e9e 100644
--- a/src/ui/ve.ui.MobileSurface.js
+++ b/src/ui/ve.ui.MobileSurface.js
@@ -76,7 +76,7 @@
* @inheritdoc
*/
ve.ui.MobileSurface.prototype.createDialogWindowManager = function () {
- return new ve.ui.MobileWindowManager( {
+ return new ve.ui.MobileWindowManager( this, {
factory: ve.ui.windowFactory,
overlay: this.globalOverlay
} );
diff --git a/src/ui/ve.ui.Surface.js b/src/ui/ve.ui.Surface.js
index 1c4ffd9..6e211c2 100644
--- a/src/ui/ve.ui.Surface.js
+++ b/src/ui/ve.ui.Surface.js
@@ -61,7 +61,7 @@
this.debugBar = null;
this.toolbarHeight = 0;
- this.toolbarDialogs = new ve.ui.ToolbarDialogWindowManager( {
+ this.toolbarDialogs = new ve.ui.ToolbarDialogWindowManager( this, {
$: this.$,
factory: ve.ui.windowFactory,
modal: false
diff --git a/src/ui/ve.ui.WindowManager.js b/src/ui/ve.ui.WindowManager.js
index a44fa6d..73d7a31 100644
--- a/src/ui/ve.ui.WindowManager.js
+++ b/src/ui/ve.ui.WindowManager.js
@@ -11,10 +11,11 @@
* @extends OO.ui.WindowManager
*
* @constructor
+ * @param {ve.ui.Surface} Surface this belongs to
* @param {Object} [config] Configuration options
* @cfg {ve.ui.Overlay} [overlay] Overlay to use for menus
*/
-ve.ui.WindowManager = function VeUiWindowManager( config ) {
+ve.ui.WindowManager = function VeUiWindowManager( surface, config ) {
// Configuration initialization
config = config || {};
@@ -22,6 +23,7 @@
ve.ui.WindowManager.super.call( this, config );
// Properties
+ this.surface = surface;
this.overlay = config.overlay || null;
};
@@ -41,6 +43,15 @@
};
/**
+ * Get surface.
+ *
+ * @return {ve.ui.Surface} Surface this belongs to
+ */
+ve.ui.WindowManager.prototype.getSurface = function () {
+ return this.surface;
+};
+
+/**
* @inheritdoc
*/
ve.ui.WindowManager.prototype.getReadyDelay = function () {
diff --git a/src/ui/windowmanagers/ve.ui.DesktopInspectorWindowManager.js
b/src/ui/windowmanagers/ve.ui.DesktopInspectorWindowManager.js
index b7b0214..c5cd285 100644
--- a/src/ui/windowmanagers/ve.ui.DesktopInspectorWindowManager.js
+++ b/src/ui/windowmanagers/ve.ui.DesktopInspectorWindowManager.js
@@ -11,12 +11,13 @@
* @extends ve.ui.WindowManager
*
* @constructor
+ * @param {ve.ui.Surface} Surface this belongs to
* @param {Object} [config] Configuration options
* @cfg {ve.ui.Overlay} [overlay] Overlay to use for menus
*/
-ve.ui.DesktopInspectorWindowManager = function
VeUiDesktopInspectorWindowManager( config ) {
+ve.ui.DesktopInspectorWindowManager = function
VeUiDesktopInspectorWindowManager( surface, config ) {
// Parent constructor
- ve.ui.DesktopInspectorWindowManager.super.call( this, config );
+ ve.ui.DesktopInspectorWindowManager.super.call( this, surface, config );
};
/* Inheritance */
diff --git a/src/ui/windowmanagers/ve.ui.MobileWindowManager.js
b/src/ui/windowmanagers/ve.ui.MobileWindowManager.js
index fc35678..1c947dd 100644
--- a/src/ui/windowmanagers/ve.ui.MobileWindowManager.js
+++ b/src/ui/windowmanagers/ve.ui.MobileWindowManager.js
@@ -11,11 +11,13 @@
* @extends ve.ui.WindowManager
*
* @constructor
+ * @param {ve.ui.Surface} Surface this belongs to
* @param {Object} [config] Configuration options
+ * @cfg {ve.ui.Overlay} [overlay] Overlay to use for menus
*/
-ve.ui.MobileWindowManager = function VeUiMobileWindowManager( config ) {
+ve.ui.MobileWindowManager = function VeUiMobileWindowManager( surface, config
) {
// Parent constructor
- ve.ui.MobileWindowManager.super.call( this, config );
+ ve.ui.MobileWindowManager.super.call( this, surface, config );
};
/* Inheritance */
diff --git a/src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js
b/src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js
index c1d0b2c..7d93ca4 100644
--- a/src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js
+++ b/src/ui/windowmanagers/ve.ui.ToolbarDialogWindowManager.js
@@ -11,12 +11,13 @@
* @extends ve.ui.WindowManager
*
* @constructor
+ * @param {ve.ui.Surface} Surface this belongs to
* @param {Object} [config] Configuration options
* @cfg {ve.ui.Overlay} [overlay] Overlay to use for menus
*/
-ve.ui.ToolbarDialogWindowManager = function VeUiToolbarDialogWindowManager(
config ) {
+ve.ui.ToolbarDialogWindowManager = function VeUiToolbarDialogWindowManager(
surface, config ) {
// Parent constructor
- ve.ui.ToolbarDialogWindowManager.super.call( this, config );
+ ve.ui.ToolbarDialogWindowManager.super.call( this, surface, config );
};
/* Inheritance */
--
To view, visit https://gerrit.wikimedia.org/r/196655
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d9caef38755eb39c97e7ce35f7559ee7efdff0b
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits