Opened 14 years ago

Last modified 13 years ago

#6589 closed New Feature

Make it easier to use iframeDialog — at Initial Version

Reported by: Alfonso Martínez de Lizarrondo Owned by: Alfonso Martínez de Lizarrondo
Priority: Normal Milestone: CKEditor 3.6
Component: UI : Dialogs Version:
Keywords: Cc:

Description

Currently is not too easy to use the iframeDialog, specially the part about getting the current editor or listening to the dialog events.

The few resources available show The proposal here is to ignore the CKEDITOR.dialog.addIframe and do that work again http://cksource.com/forums/viewtopic.php?f=11&t=16040 This page explains the basic usage, but again, it seems that it's extra work http://www.tommed.co.uk/?p=31

My proposal is to make the CKEDITOR.dialog.addIframe create automatically a function that will notify the inner window of the dialog events (load, ok and cancel), so the only requirement to specify a dialog are two lines, almost like any other dialog:

		editor.addCommand( 'myPlugin', new CKEDITOR.dialogCommand( 'myPlugin' ) );
		CKEDITOR.dialog.addIframe( 'myPlugin', "Plugin title", this.path + 'popup.html', 700, 470);

And adding a simple function in the iframe:

// Gets notified of events in the main dialog
function onDialogEvent( e )
{
	switch(e.name)
	{
		case 'load':
			oEditor = e.editor;
			init();
			break;

		case 'ok':
			Ok();
			break;

		case 'cancel':
			break;
	}
}

The patch also includes the #5745 proposal so that way it's possible to alter the default buttons or other behavior in the dialog definition.

Change History (1)

Changed 14 years ago by Alfonso Martínez de Lizarrondo

Attachment: 6589.patch added

Proposed patch

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy