Okay so I'm trying to integrate this editor into an ajax app. My problem is; once I repopulate the dynamic content (using xsl) I get this Can't execute code from a freed script error. It looks like it has something to do with the LoadScripts() function specifically realoading the fckeditorcode_ie_1.js. Any one have any clue or can give me any hope that this can be resolved some how.
Fri, 07/29/2005 - 08:39
#1
RE: Error: Can't execute code from a freed script
RE: Error: Can't execute code from a freed sc
RE: Error: Can't execute code from a freed sc
FCKeditorAPI = null;
every time you load the editor into the page with your Ajax call, or you will get the "can't execute code from a freed script" error.
RE: Error: Can't execute code from a freed sc
Quick update - I've added a bug tracker item for this issue:
https://sourceforge.net/tracker/index.p ... tid=543653
RE: Error: Can't execute code from a freed script
The fix is to remove the FCK javascript object in the parent, thus making FCK reset. This did the trick for me:
__FCKeditorNS = null;
I'm sure the FCK developers did not envision its use in ajax, and did not imagine this kind of process flow.
RE: Error: Can't execute code from a freed sc
Pleeease can we incorporate this as a more explicit reset() or cleanup() function into the next release of FCKeditor??
Also I think there might be a little more cleanup to be done: each usage of FCKeditor leaves behind a growing list of iframes in the DOM (you can see them using Mozilla's DOM inspector).
These iframes hold the style/formatting values used in the editor: "normal", "formatted", "address", etc, etc.
At the moment I'm clearing these out manually - unless anyone has a better solution.
As mentioned above, the ideal solution is to have a cleanup() method that takes care of everything... as everyone's jumping on the AJAX bandwagon these days its imperative that FCKeditor keeps up.
Anyway - good work ridewinter!
RE: Error: Can't execute code from a freed sc
I added __FCKeditorNS = null; and FCKeditorAPI = null; but it is not enough for me
RE: Error: Can't execute code from a freed sc
I haver the same problem, I'm new to ajax, i used it in an internal website, and now when i try to incorporate FCKeditor... PAF !!! don't load when using ajax.
My lame question is:
"Where" need i put the "__FCKeditorNS = null;" sentense ?
Thank's in advance and sorry about my low understanding of this technology :-/
RE: Error: Can't execute code from a freed sc
<script language='javascript'>
__FCKeditorNS = null;
</script>
<?php include_once("FCKeditor/fckeditor.php") ; $oFCKeditor = new FCKeditor("test") ; $oFCKeditor->Create() ; ?>
RE: Error: Can't execute code from a freed sc
__FCKeditorNS = null;
FCKeditorAPI = null;
I know, I know, it's a hack, but the FCKEditor developers still don't seem to have Ajax in mind...
RE: Error: Can't execute code from a freed sc
After recreating the editor, the main toolbar doesn't work anymore:
FCK is not defined
FCK_TRISTATE_DISABLED is not defined
Any ideas?
RE: Error: Can't execute code from a freed sc
Please, I have no idea what is wrong
RE: Error: Can't execute code from a freed script
Will post if I find a solution.
RE: Error: Can't execute code from a freed sc
I have read you posts and you seems to have been the most helpful intrying to solve this issue (I refer to this thread: http://sourceforge.net/forum/message.php?msg_id=3290707)
I apologise if this email is out-of-place but I am really hoping you have some further ideas on how I might address my problem and the AJAX style approach.
I can show FCKEditor the first time by simply injecting the following HTML into the innerHTML of a DIV:
"<div><input type='hidden' id='paragraphEditor_22420' name='paragraphEditor_22420' value='\r<font face=\"Barclays Sans\" size=\"2\" color=\"#000000\">At our meeting you were offered the opportunity to have an independent third party present during any subsequent meetings. However, you declined this offer because [Reason].<br></font>\n<br><div align=\"center\">The unregistered version can convert no more than 15000 symbols.<br>Please register: <a href=\"http://www.sautin.com/rtf-to-html/developers.htm\" target=\"_blank\">http://www.sautin.com/rtf-to-html/developers.htm</a></div>\n' /><input type='hidden' id='paragraphEditor_22420___Config' value='' /><iframe id='paragraphEditor_22420___Frame' src='/ASP.NET/FCKeditor/editor/fckeditor.html?InstanceName=paragraphEditor_22420&Toolbar=Default' width='100%' height='200px' frameborder='no' scrolling='no'></iframe></div><div class='paragraphUpdate'><input id='update_22420' type='button' value='Update' onclick='Update(update_22420, \"updateParagraph\", 22420)'
/></div>"
When done I try to clean up FCKEditor and THEN replace the same DIV's innerHTML with something else.
This is my latest effort to cure the problem - but alas no success (note I am even trying to cleam up left over IFRAMES - which works but doesn't seems to help).
// Try cleaning up FCKEditor
FCKEditorAPI = null;
__FCKeditorNS = null;
oChildNode = document.body.firstChild;
while(oChildNode != null)
{
if(oChildNode.nodeType == 1 && oChildNode.nodeName == "IFRAME")
{
iFrame = oChildNode;
oChildNode = oChildNode.nextSibling;
document.body.removeChild(iFrame);
}
else
{
oChildNode = oChildNode.nextSibling;
}
}
This appear to work - except when I try to use the editor again (same one so same ID etc) it appears "less wide" than before in Mozilla but the right size in IE but error with the "freed script" issue.
Also, if I have created multiple instances of the editor in the same page - this clean up adversely affects th other instances as the null seems to whip away shared variables.
I realy need some concept of "RemoveInstance".
So - after all that, have you got any other bright ideas?
I would be so grateful for any assistance you can give.