| 15 | | CKEDITOR.dialog.addIframe = function( name, title, src, width, height, onContentLoad ) |
| | 15 | /** |
| | 16 | * An iframe base dialog. |
| | 17 | * @param {String} name Name of the dialog |
| | 18 | * @param {String} title Title of the dialog |
| | 19 | * @param {Number} width Width of the dialog |
| | 20 | * @param {Number} height Height of the dialog |
| | 21 | * @param {Function} [onContentLoad] Function called when the iframe has been loaded. |
| | 22 | * If it isn't specified, the inner frame is notified of the dialog events ('load', 'ok' and 'cancel') |
| | 23 | * on a function called 'onDialogEvent' |
| | 24 | * @param {Object} [userDefinition] Additional properties for the dialog definition |
| | 25 | * @example |
| | 26 | */ |
| | 27 | CKEDITOR.dialog.addIframe = function( name, title, src, width, height, onContentLoad, userDefinition ) |
| | 45 | // If the inner frame has defined a "onDialogEvent" function, setup listeners |
| | 46 | if ( childWindow.onDialogEvent ) |
| | 47 | { |
| | 48 | var dialog = this.getDialog(), |
| | 49 | notifyEvent = function(e) |
| | 50 | { |
| | 51 | return childWindow.onDialogEvent(e); |
| | 52 | }; |
| | 53 | |
| | 54 | dialog.on( 'ok', notifyEvent ); |
| | 55 | dialog.on( 'cancel', notifyEvent ); |
| | 56 | |
| | 57 | // Clear listeners |
| | 58 | dialog.on( 'hide', function(e) |
| | 59 | { |
| | 60 | dialog.removeListener( 'ok', notifyEvent ); |
| | 61 | dialog.removeListener( 'cancel', notifyEvent ); |
| | 62 | |
| | 63 | e.removeListener(); |
| | 64 | } ); |
| | 65 | |
| | 66 | // Notify child iframe of load: |
| | 67 | childWindow.onDialogEvent( { |
| | 68 | name : 'load', |
| | 69 | sender : this, |
| | 70 | editor : dialog._.editor |
| | 71 | } ); |
| | 72 | } |
| | 73 | }; |
| | 74 | |