Injecting HTML into FCKeditor (Working in Firefox)

by Matt 10. February 2010 20:48

Some time ago I wrote about injecting HTML into an instance of FCKeditor.  I had it working in Internet Explorer but not in Firefox.  It turns out that the problem was with my syntax.  Oops…

Here’s what the OnComplete event should look like:

function FCKeditor_OnComplete(editorInstance) 
{
    var oEditor = FCKeditorAPI.GetInstance(editorInstance.Name);
    var content = parent.document.getElementById("ContentBody").value;
    // Replace curly quotes with straight quotes
    var EditedContent = content.replace(/\u201C/g, '"');
    oEditor.InsertHtml(EditedContent);
    content = null;
}

Categories: ASP.NET | Javascript