Hi,
I have a plugin for my cms where an internal link is inserted into the editor content.
The links are generated via a php script and is in an iframe.
At some place multiple editor windows are present and I need to get the editor name to insert
the link in the right editor instance.
The plugin code (partly) :
I want to pass the editor name to the sas_link.php via de editor_name GET variable
but the javascript c variable is empty. Looks like it is not global.
The alert(c) gives me the right editor name as popup.
Please advise and kind regards Fred Stuurman
I have a plugin for my cms where an internal link is inserted into the editor content.
The links are generated via a php script and is in an iframe.
At some place multiple editor windows are present and I need to get the editor name to insert
the link in the right editor instance.
The plugin code (partly) :
CKEDITOR.dialog.add( 'SasLinkDialog', function ()
{
return {
title : editor.lang.sas_link.title,
minWidth : 350,
minHeight : 550,
onShow : function()
{
c = this.getParentEditor().name;
alert(c);
},
contents : [
{
id : 'iframe',
label : editor.lang.sas_link.title,
expand : true,
elements :
[
{
type : 'html',
id : 'SasLink',
label : editor.lang.sas_link.title,
style : 'width : 100%;',
html : '<iframe src="'+me.path+'/sas_link.php?editor_name=" + c + " frameborder="0" name="iframeMediaEmbed" id="iframeMediaEmbed" allowtransparency="1" style="width:100%;height:540px;margin:0;padding:0;"></iframe>'
}
]
}
],
I want to pass the editor name to the sas_link.php via de editor_name GET variable
but the javascript c variable is empty. Looks like it is not global.
The alert(c) gives me the right editor name as popup.
Please advise and kind regards Fred Stuurman

Re: get editor name for plugin
There were 2 changes needed:
added the "editor" to: CKEDITOR.dialog.add( 'SasLinkDialog', function ( editor )
If you add this you can use editor.name for the name of the calling editor name.
and the line:
html : '<iframe src="'+me.path+'sas_link.php?editor_name=' + editor.name + '"
had some quotes missing,
Here the (partial) code:
/* * @example An iframe-based dialog with custom button handling logics. */ ( function() { CKEDITOR.plugins.add( 'sas_link', { requires: [ 'iframedialog' ], lang : ['en', 'nl'], init: function( editor ) { var me = this; CKEDITOR.dialog.add( 'SasLinkDialog', function ( editor ) { return { title : editor.lang.sas_link.title, minWidth : 350, minHeight : 550, contents : [ { id : 'iframe', label : editor.lang.sas_link.title, expand : true, elements : [ { type : 'html', id : 'SasLink', label : editor.lang.sas_link.title, style : 'width : 100%;', html : '<iframe src="'+me.path+'sas_link.php?editor_name=' + editor.name + '" frameborder="0" name="iframeMediaEmbed" id="iframeMediaEmbed" allowtransparency="1" style="width:100%;height:540px;margin:0;padding:0;"></iframe>'Kind regards Fred Stuurman