From:  Jeff <jtaylor179@gmail.com>
Date:  22 Oct 2009 04:15:25 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.web-development
Subject:  

Re: Disappearing caret from Rich Text Editor

NNTP-Posting-Host:  68.36.68.249

I've been banging my head against the wall for a day and a half with
this same problem and finally found a solution (i.e. hack).
After an iframe with contentEditable content is hidden then
redisplayed, the code below is used to remove then re-add all the
contenteditable attributes.
I found that ALL contenteditable attributes have to be removed first
before resetting any elements back to contenteditable otherwise this
fix doesn't work.

I'm developing a medical health record application and I was having
this issue within my dialogs (which use iframes).  This fix was
testing against FF 3.5.3


BaseView.prototype.handleNavigationEvent = function(){
    if(window.frameElement && Prototype.Browser.Gecko){
        // Fix the contenteditable bug that occurs when an iframe is
hidden then re-displayed
        this.fixFFContentEditable();
    }
};

/**
 * Get list of editable content, strip contenteditable attributes,
then reapply
 */
BaseView.prototype.fixFFContentEditable = function(){
    var oElements = $(document.body).select("div
[contenteditable=true]","span[contenteditable=true]");
    oElements.each(function(oItem){oItem.removeAttribute
("contenteditable");});
    oElements.each(function(oItem){oItem.setAttribute
("contenteditable", "true");})
};

** Note - I'm using prototype.js