Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/83805
Change subject: Allowing for config data when instantiating dialogs ...................................................................... Allowing for config data when instantiating dialogs Currently, WindowSet open method uses the Window factory to call up the instantiation of a new dialog or inspector class. This commit will also allow sending further config options to these classes if needed. Specifically, this will also allow the use of ve.ui.Context.js for block inspectors that are not dependent on current selection or current location of the cursor. It will also let us generalize the dialog/inspector window instantiations by adding in any needed config settings on call. Change-Id: If14384d74ab91ef01b1c7641ff84f327f2a12112 --- M modules/ve/ui/ve.ui.Context.js M modules/ve/ui/ve.ui.WindowSet.js 2 files changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/05/83805/1 diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js index 0a0825b..cfcb475 100644 --- a/modules/ve/ui/ve.ui.Context.js +++ b/modules/ve/ui/ve.ui.Context.js @@ -386,11 +386,12 @@ * * @method * @param {string} name Symbolic name of inspector + * @param {Object} [config] Config options to be sent to the inspector class constructor * @chainable */ -ve.ui.Context.prototype.openInspector = function ( name ) { +ve.ui.Context.prototype.openInspector = function ( name, config ) { if ( !this.inspectors.currentWindow ) { - this.inspectors.open( name ); + this.inspectors.open( name, config ); } return this; }; diff --git a/modules/ve/ui/ve.ui.WindowSet.js b/modules/ve/ui/ve.ui.WindowSet.js index 1c23fc7..769dd29 100644 --- a/modules/ve/ui/ve.ui.WindowSet.js +++ b/modules/ve/ui/ve.ui.WindowSet.js @@ -113,9 +113,10 @@ * * @method * @param {string} name Symbolic name of window + * @param {Object} [config] Config options to be sent to the window class constructor * @chainable */ -ve.ui.WindowSet.prototype.open = function ( name ) { +ve.ui.WindowSet.prototype.open = function ( name, config ) { var win; if ( !this.factory.lookup( name ) ) { @@ -125,7 +126,7 @@ throw new Error( 'Cannot open another window while another one is active' ); } if ( !( name in this.windows ) ) { - win = this.windows[name] = this.factory.create( name, this.surface ); + win = this.windows[name] = this.factory.create( name, this.surface, config ); win.connect( this, { 'setup': ['onWindowSetup', win], 'open': ['onWindowOpen', win], -- To view, visit https://gerrit.wikimedia.org/r/83805 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If14384d74ab91ef01b1c7641ff84f327f2a12112 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits