Hidden CuteEditor doesn't get initialized in Firefox, Chrome and Safari

Last post 03-11-2010, 8:19 AM by KoenV. 4 replies.
Sort Posts: Previous Next
  •  03-08-2010, 7:22 AM 59234

    Hidden CuteEditor doesn't get initialized in Firefox, Chrome and Safari

    Hi,
     
    We have our CuteEditor (version 6.0, but 6.6 has the same error) in an ASP.NET AJAX ModalPopup, which means it is hidden by default. When a user wants to edit a rich text field, we show the modal popup and use the JavaScript API to set the HTML in the editor and retrieve it again when editing is done.
     
    This works perfectly in IE (8) but not at all in Firefox, Chrome and Safari. When I make the editor visible by default it does work as well in those browsers (but it's no option for me). Just setting "display:none" (which is also done by the ModalPopupExtender) in the CSS style is enough for making it break. The editor doesn't initialize any longer, doesn't register its' javascript API (via prototyping) and we can't use the setHTML() and getHTML() functions.
     
    Does anyone have a clue on how to make this work? I've noticed some threads here with related issues but none of them gives an answer...
     
    Thanks 
  •  03-08-2010, 7:43 AM 59236 in reply to 59234

    Re: Hidden CuteEditor doesn't get initialized in Firefox, Chrome and Safari

    I've investigated some more and came to the conclusion that when you make the editor visible through javascript it does start initializing, but you can't use the API functions right away. You need some sort of indicator on when initializing is done. I've also noticed that the documented CuteEditor_OnInitialized function never gets called (it should work in version 6.0 right?) so that's also no option... 
     
    I'd prefer a manner to have the editor initialized also in hidden state (the same way as IE works).
  •  03-08-2010, 3:08 PM 59243 in reply to 59234

    Re: Hidden CuteEditor doesn't get initialized in Firefox, Chrome and Safari

  •  03-09-2010, 4:15 AM 59253 in reply to 59243

    Re: Hidden CuteEditor doesn't get initialized in Firefox, Chrome and Safari

    Thanks for helping Adam.
     
    Your example does not use the javascript API methods setHTML() and getHTML() on the editor. That is where the problem is for me. If the control is loaded invisible in Firefox, Chrome and Safari, the API is only initialized whenever the control becomes visible, which is too late to directly use the API methods and fill the editor...
     
    I guess that  maybe the following script tag with the "Loader" script is just not executed when the script tag is inside an invisible container in those browsers, or maybe the specific loader scripts for those browsers have slight changes that cause this problem...
    1. <script src="/CuteSoft_Client/CuteEditor/Load.ashx?type=scripts&file=(IE|Gecko|Safari)_Loader"></script>
     I do seem to notice that hitting the "Show" button the first time in IE does instantly show the whole editor (with all toolbars preloaded in the background), while in other browsers the toolbars are still being loaded when the control becomes visual the first time. 
  •  03-11-2010, 8:19 AM 59318 in reply to 59253

    Re: Hidden CuteEditor doesn't get initialized in Firefox, Chrome and Safari

    I worked around the problem like this:
    • I open the dialog window so the editor gets initialized
    • I then start a recursive loop with window.setTimeout (200 milliseconds per cycle) that checks if the method editor.setHTML is defined (typeof(editor.setHTML) == "function")
    • If it is defined (which will always be the case for IE) the editors' value is preset
    • If it is not defined it just runs the cycle again
    It works for any browser now, but it is far from a good solution... 
View as RSS news feed in XML