I am working on porting my fckeditor plugin to ckeditor. I have successfully added a tab to the link dialog with an iframe.
What I would like to do is be able to detect when my tab is selected and move the dialog so that it is re-centered, and move it back when the tab is changed away from my iframe tab (which is much larger than the other tabs), but I cannot seem to find the right event.
What I would like to do is be able to detect when my tab is selected and move the dialog so that it is re-centered, and move it back when the tab is changed away from my iframe tab (which is much larger than the other tabs), but I cannot seem to find the right event.
CKEDITOR.plugins.add( 'myplugin',
{
requires : ['iframedialog'],
init: function( editor )
{
CKEDITOR.on( 'dialogDefinition', function( ev )
{
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're
// interested on (the "Link" dialog).
if ( dialogName == 'link' )
{
if (!dialogDefinition.getContents('myplugin'))
{
dialogDefinition.addContents({
id : 'myplugin',
label : 'myplugin',
expand : true,
accessKey : 'L',
elements : [{
type : 'iframe',
src : CKEDITOR.plugins.getPath('myplugin')+'resource.php',
width : 800, height : 600,
onContentLoad : function()
{
//alert(CKEDITOR.dialog.getCurrent().getName());
}
}]
});
}
}
});
}
});
Re: Detect dialog tab change.
buttons:[{ type:'button', id:'someButtonID', /* note: this is not the CSS ID attribute! */ label: 'Button', onClick: function(){ console.log(this.getElement()); var CurrObj = CKEDITOR.dialog.getCurrent(); console.log(CurrObj.definition.dialog._.currentTabId); } },CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton],It will show you the id of the currently selected tab.
Aaron