I'm using the CreateHTML() method to initialize an FCKeditor. I want to set the content of the editor but when I use the FCKeditorAPI.GetInstance('instanceName') i get an error saying "FCKeditorAPI is not defined". I guess it's because the FCKeditor hasn't finnished loading? Any fix or workaround?
fckTest.SetHTML(originalContent) gives an error as well. "SetHTML is not a function" or something like that.
fckTest.SetHTML(originalContent) gives an error as well. "SetHTML is not a function" or something like that.
var fckTest = new FCKeditor('test_edit');
fckTest.BasePath = "fckeditor/";
var originalContent = document.getElementById('myDiv').innerHTML;
document.getElementById('myDiv').innerHTML = fckTest.CreateHtml();
var myEditor = FCKeditorAPI.GetInstance('test_edit');
myEditor.SetHTML(originalContent );
Re: SetHTML when using the CreateHTML integration method
Re: SetHTML when using the CreateHTML integration method
Check the sample files.
Re: SetHTML when using the CreateHTML integration method
So there s a way to detect that the editor is loaded? And I could set up a while-loop or something?
Re: SetHTML when using the CreateHTML integration method
http://docs.fckeditor.net/FCKeditor_2.x ... Script_API
Re: SetHTML when using the CreateHTML integration method
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title></title> <script type="text/javascript" src="fckeditor/fckeditor.js"></script> <script type="text/javascript"> function openEditor() { var fckTest = new FCKeditor('test_edit'); fckTest.BasePath = "fckeditor/"; var originalContent = parent.top.frames["myIframe"].document.getElementById('myDiv').innerHTML; parent.top.frames["myIframe"].document.getElementById('myDiv').innerHTML = fckTest.CreateHtml(); var myEditor = parent.top.frames["myIframe"].FCKeditorAPI.GetInstance('test_edit'); myEditor.SetHTML('new content'); } function setContent() { var myEditor = parent.top.frames["myIframe"].FCKeditorAPI.GetInstance('test_edit'); myEditor.SetHTML('new content'); } function closeEditor() { var editedContent = parent.top.frames["myIframe"].FCKeditorAPI.GetInstance('test_edit').GetXHTML(); parent.top.frames["myIframe"].document.getElementById('myDiv').innerHTML = editedContent; } </script> </head> <body> <h1>Test</h1> <input type="button" onclick="openEditor()" value="Open editor"> <input type="button" onclick="setContent()" value="Set new content"> <input type="button" onclick="closeEditor()" value="Close editor"> <iframe src="iframeContent.html" name="myIframe" height="400" width="400" scrolling="auto"></iframe> </body> </html>Re: SetHTML when using the CreateHTML integration method
Re: SetHTML when using the CreateHTML integration method