var CKEDITOR = window.parent.CKEDITOR; var oEditor = CKEDITOR.instances.info_content;
if(CKEDITOR.instances.info_content){
var oEditor = CKEDITOR.instances.info_content;
}else if(CKEDITOR.instances.news_body){
var oEditor = CKEDITOR.instances.news_body;
}else if(CKEDITOR.instances.faq_a){
var oEditor = CKEDITOR.instances.faq_a;
}else if(CKEDITOR.instances.faq_q){
var oEditor = CKEDITOR.instances.faq_q;
}
Re: how to get name of current instance from plugin?
var CKEDITOR = window.parent.CKEDITOR; for ( var i in CKEDITOR.instances ){ var currentInstance = i; break; } var oEditor = CKEDITOR.instances[currentInstance];of course this only works as long as you have only 1 editor in the page......
which thankfully i do in this case but its certainly not the best solution.
Re: how to get name of current instance from plugin?
this will give you the current instance.
This raises an interesting question. Is there a property that gives the index of the current instance? That is, I currently have 3 instances of the editor on my page. When the user clicks on one, I'd like to know the index of the editor, something like
Instead, I am currently comparing the editor's name, which as you can see is pretty ugly
if ("editor_kama" == oEditor.name)Re: how to get name of current instance from plugin?
In my case, I'd like to retrieve the current one, and retrieve it from a plugin popup window.
Re: how to get name of current instance from plugin?
for(var id in CKEDITOR.instances) { CKEDITOR.instances[id].on('focus', function(e) { // Fill some global var here Some.GlobalVar = e.editor.name; }); }