The Focus method in the javascript editor does not seem to work. I am trying to plug the FCK Editor into a chat application. In my case if you hit the enter key I read the value reset the editor to "" and then return the focus to the editor. But whatever I do the focus does not return to the editor forcing users to click on the editor area. Has anyone seen this behavior before
I have even registered the event onSetAfterHTML() and tried to return the focus to the editor there. That doesnt work either. Any help is appreciated.
I have even registered the event onSetAfterHTML() and tried to return the focus to the editor there. That doesnt work either. Any help is appreciated.
Code Snippet
/*Set the content in the editor*/
function setEditorContent(editorinstance, content){
var oEditor=FCKeditorAPI.GetInstance(editorinstance);
oEditor.SetHTML(content);
}
/*Insert the content at cursor location in the editor*/
function insertContentInEditor(editorinstance, content){
var oEditor=FCKeditorAPI.GetInstance(editorinstance);
oEditor.InsertHtml(content);
}
/*Get clean content from the editor*/
/*Cleaning includes 1.Stripping trailing <br /> tags and 2. Changing targets in <a> tags.*/
function getEditorContent(editorinstance){
var oEditor=FCKeditorAPI.GetInstance(editorinstance);
var content = oEditor.GetHTML();
return content;
}
function focusEditor(editorinstance){
var oEditor=FCKeditorAPI.GetInstance(editorinstance);
oEditor.Focus();
}
var chatareaMsg = getEditorContent(CHAT_EDITOR_NAME);
sendMessage(chatareaMsg);
setEditorContent(CHAT_EDITOR_NAME,"");
focusEditor(CHAT_EDITOR_NAME);
Re: Focus method in the javascript API of FCK Editor does not wo
http://cksource.com/forums/viewtopic.php?f=11&t=17335