Skip to content

Instantly share code, notes, and snippets.

@garryyao
Created August 25, 2011 09:21
Show Gist options
  • Save garryyao/1170303 to your computer and use it in GitHub Desktop.
Save garryyao/1170303 to your computer and use it in GitHub Desktop.
CKEditor Iframe dialog sample
/*
* @example An iframe-based dialog with frame window fit dialog size.
*/
( function() {
CKEDITOR.plugins.add( 'iframe-fit-size',
{
requires: [ 'iframedialog' ],
init: function( editor )
{
var height = 480, width = 750;
CKEDITOR.dialog.addIframe(
'myiframedialogDialog',
'Smiley',
'http://www.google.com', width, height,
function()
{
// Iframe loaded callback.
},
{
onOk : function()
{
// Dialog onOk callback.
}
}
);
editor.addCommand( 'myiframedialog', new CKEDITOR.dialogCommand( 'myiframedialogDialog' ) );
editor.ui.addButton( 'Myiframedialog',
{
label: 'My Iframe in dialog',
command: 'myiframedialog',
icon: this.path + 'images/icon.gif'
} );
}
} );
} )();
var toolbar = CKEDITOR.config.toolbar_Full;
toolbar[toolbar.length-1].items.push( 'Myiframedialog' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment