mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
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
This commit is contained in:
parent
22d9067095
commit
63056eaa6d
|
@ -386,11 +386,12 @@ ve.ui.Context.prototype.hide = function () {
|
|||
*
|
||||
* @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;
|
||||
};
|
||||
|
|
|
@ -113,9 +113,10 @@ ve.ui.WindowSet.prototype.getCurrent = function () {
|
|||
*
|
||||
* @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 @@ ve.ui.WindowSet.prototype.open = function ( name ) {
|
|||
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],
|
||||
|
|
Loading…
Reference in a new issue