﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
8749	Passing data into a shared dialog	NicHolt	Alfonso Martínez de Lizarrondo	"It is sometimes useful to be able to pass data to a shared dialog.  For example, I have a datepicker dialog and a treeview selector dialog, both of which are invoked from several other dialogs.  The getDialogValue function in the docprops dialog enables a shared dialog to be invoked, and provides a callback for e.g. passing the result to the parent dialog. However, there is no clean way to pass data - for example, the current value of an element in the parent dialog or options.

Here's how this can be achieved.

In plugins/docprops/dialogs/docprops.js:

Add a third argument to getDialogValue:

{{{
function getDialogValue( dialogName, callback, data )
}}}

Pass the data in the invocation of execCommand:

{{{
editor.execCommand( dialogName, data );
}}}

Change the following line to be generic (not just for colorDialog):

{{{
if ( editor._.storedDialogs[dialogName] )
}}}

In plugins/dialog/plugin.js

Add a data argument to show:

{{{
show : function(data)
}}}

Pass the data in the show event:

{{{
this.fire( 'show', data );
}}}

Add a data argument to exec:

{{{
exec : function(editor, data)
}}}

Pass the data in the invocation of openDialog:

{{{
CKEDITOR.tools.setTimeout( function() { editor.openDialog( this.dialogName, null, data ) }, 0, this )
}}}

And in openDialog itself:

{{{
openDialog : function( dialogName, callback, data )
}}}

And in the inline invocation of show:

{{{
dialog.show(data);
}}}

The data can be in any form, but I usually pass it as name-value pairs - for example, for the datepicker:

{{{
{ 
    'inputDate' : inputDate,
    'dateFormat' : editor.config.dateFormat 
}
}}}

"	New Feature	review	Normal		General				
