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.
well, if you only have one instance of the plugin, there is no point in doing the for-loop, that is, instead of you could use
oEditor = CKEDITOR.currentInstance;
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
oEditor = CKEDITOR.currentInstance.getIndex();
Instead, I am currently comparing the editor's name, which as you can see is pretty ugly
For whoever is interested, I solved this using the following method:
for(var id in CKEDITOR.instances) {
CKEDITOR.instances[id].on('focus', function(e) {
// Fill some global var here
Some.GlobalVar = e.editor.name;
});
}
Re: how to get name of current instance from plugin?
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
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 whoever is interested, I solved this using the following method: