Page 1 of 1

Fixed: HTML editing broken in IE11

Posted: Sat Dec 14, 2013 10:31 pm
by SteveHiner
Able Gold uses TinyMCE 3.4.9 as the page editor in the admin. I found out tonight that on IE11, if you click the HTML button to edit the code directly you get a popup with no HTML in it. Behind the scenes the javascript is throwing an error because of the browser being misdetected. The bug is fixed in the newer versions of TinyMCE but I didn't want to upgrade that and risk breaking something else.

Here's how you fix it:
Open Scripts\tinymce\themes\advanced\js\source_editor.js

In the onLoadInit() method near the top of the file you will find this:

Code: Select all

        if (tinymce.isGecko)
            document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
The problem is that isGecko is true for IE11 but the getParam call fails. I made a dirty hack and decided to just ignore the error by wrapping it in a try...catch. I know, it makes my code smell but the long-term fix is for Able to start using a newer version of TinyMCE and I'm willing to have this in my code until they update it.

Now that code looks like this:

Code: Select all

    try { //SBH: IE11 chokes on this call and prevents the source from getting loaded
        if (tinymce.isGecko)
            document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
    } catch (ex) {
    }
Alternatively you could move the if block above to the bottom of the method and just let the error get thrown but this feels somewhat less dirty to me than that solution.

Re: Fixed: HTML editing broken in IE11

Posted: Mon Dec 16, 2013 1:01 am
by ForumsAdmin
Thanks Steve. Till the time we have a proper fix in new version of TinyMCE, we will incorporate this in our code.