/*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
* @fileOverview The floating dialog plugin.\r
*/\r
\r
-CKEDITOR.plugins.add( 'dialog',\r
- {\r
- requires : [ 'dialogui' ]\r
- });\r
-\r
/**\r
* No resize for this dialog.\r
* @constant\r
return null;\r
}\r
\r
- // Stores dialog related data from skin definitions. e.g. margin sizes.\r
- var skinData = {};\r
-\r
/**\r
* This is the base class for runtime dialog objects. An instance of this\r
* class represents a single named dialog for a single editor instance.\r
// Execute onLoad for the first show.\r
this.fireOnce( 'load', {} );\r
this.fire( 'show', {} );\r
+ this._.editor.fire( 'dialogShow', this );\r
\r
// Save the initial values of the dialog.\r
this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } );\r
hide : function()\r
{\r
this.fire( 'hide', {} );\r
+ this._.editor.fire( 'dialogHide', this );\r
\r
// Remove the dialog's element from the root document.\r
var element = this._.element;\r
element = dialog.getElement().getFirst(),\r
editor = dialog.getParentEditor(),\r
magnetDistance = editor.config.dialog_magnetDistance,\r
- margins = skinData[ editor.skinName ].margins || [ 0, 0, 0, 0 ];\r
+ margins = editor.skin.margins || [ 0, 0, 0, 0 ];\r
\r
if ( typeof magnetDistance == 'undefined' )\r
magnetDistance = 20;\r
minWidth = definition.minWidth || 0,\r
minHeight = definition.minHeight || 0,\r
resizable = definition.resizable,\r
- margins = skinData[ dialog.getParentEditor().skinName ].margins || [ 0, 0, 0, 0 ];\r
+ margins = dialog.getParentEditor().skin.margins || [ 0, 0, 0, 0 ];\r
\r
function topSizer( coords, dy )\r
{\r
}\r
};\r
})();\r
-\r
- // Grab the margin data from skin definition and store it away.\r
- CKEDITOR.skins.add = ( function()\r
- {\r
- var original = CKEDITOR.skins.add;\r
- return function( skinName, skinDefinition )\r
- {\r
- skinData[ skinName ] = { margins : skinDefinition.margins };\r
- return original.apply( this, arguments );\r
- };\r
- } )();\r
})();\r
\r
// Extend the CKEDITOR.editor class with dialog specific functions.\r
/**\r
* Loads and opens a registered dialog.\r
* @param {String} dialogName The registered name of the dialog.\r
+ * @param {Function} callback The function to be invoked after dialog instance created.\r
* @see CKEDITOR.dialog.add\r
* @example\r
* CKEDITOR.instances.editor1.openDialog( 'smiley' );\r
* @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered.\r
*/\r
- openDialog : function( dialogName )\r
+ openDialog : function( dialogName, callback )\r
{\r
var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ];\r
\r
var dialog = storedDialogs[ dialogName ] ||\r
( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );\r
\r
+ callback && callback.call( dialog, dialog );\r
dialog.show();\r
\r
return dialog;\r
// In case of plugin error, mark it as loading failed.\r
if ( typeof CKEDITOR.dialog._.dialogDefinitions[ dialogName ] != 'function' )\r
CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';\r
- me.openDialog( dialogName );\r
+ me.openDialog( dialogName, callback );\r
body.setStyle( 'cursor', cursor );\r
} );\r
\r
}\r
});\r
\r
+CKEDITOR.plugins.add( 'dialog',\r
+ {\r
+ requires : [ 'dialogui' ]\r
+ });\r
+\r
// Dialog related configurations.\r
\r
/**\r