0

I had a problem with default editor (TinyMCE) of Richfaces version 3.3.1.GA when the user is using Internet Explorer 9. I've read many people here and on the Internet who prefer to use X-UA-Compatible metadata to downgrade IE version, but, I dislike it. I always prefer to use the edge version because I'm using CSS 3 as well. Another solution was a upgrade of RichFaces however I've not considered the possibility for the sake that my application is a pretty legacy.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
SaXeTz
  • 500
  • 1
  • 3
  • 14

1 Answers1

0

Then I started unzipping the RichFacesUI jar and changing the file META-INF/resources-config.xml from:

 <resource>
   <name>scripts/tiny_mce/tiny_mce.js</name>
   <path>org/richfaces/renderkit/html/scripts/tiny_mce/tiny_mce.js</path>
   <renderer class="org.ajax4jsf.resource.ScriptRenderer"/>
 </resource>

to:

 <resource>
   <name>scripts/tiny_mce/tiny_mce.js</name>
   <path>org/richfaces/renderkit/html/scripts/tiny_mce/tiny_mce_src.js</path>
   <renderer class="org.ajax4jsf.resource.ScriptRenderer"/>
 </resource>

This is to ease the script debugging. That would be pretty hard without it.

First of all these problems are occur because Richfaces uses a specific statement to old IEs therefore I putted the following code to know what version of IE is execution:

var ie = (function(){

    var undef,
        v = 3,
        div = document.createElement('div'),
        all = div.getElementsByTagName('i');

    while (
        div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
        all[0]
    );

    return v > 4 ? v : undef;

}());

PS: This clever code is from James Padolsey and I found it here in this question.

Then I ran my application and where it broke I changed the closest IE if statement as the following examples:

Before it was:

if (isIE) {

Then it became:

if (ie < 9) {

And when it was negative statement like:

if (!isIE) {

Then it became:

if (!isIE || ie > 8) {

The only difference was in the getXML function which was like:

if (!i || !i.createDocument) {

Then I changed to:

if (!i || !i.createDocument || ie > 8) {

In this Gist are all changes that I did. I hope that it helps anyone with this problem.

If you want I putted the jars which I changed on the following links:

Please, sorry my English mistakes, you are encouraged to re-write and fix this post.

Community
  • 1
  • 1
SaXeTz
  • 500
  • 1
  • 3
  • 14