Sunday, September 7, 2008

FCKeditor 2.x: How to get an instance of the editor using javascript

This is how you get an instance of the editor when you are within the page that loads the editor:


FCKeditorAPI.GetInstance([instanceName]);

E.g.:


var editor = FCKeditorAPI.GetInstance('ctrArticle');

And this is how you get the editor instance when you are inside the editor instance:


var editor = FCK;

And lastly, this is how you get the name (DOM id) of the editor instance (get the instance using either of the methods above):


alert(editor.Name);