Question

I found problem with NicEdit (Rich text editor) when typing some text and click align button to align text. The text doesn't align only on FireFox and got this message on FireBug

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://js.nicedit.com/nicEdit-latest.js :: anonymous :: line 38" data: no] Line 0

Please could you help me to solve this problem.

Thanks,

Était-ce utile?

La solution

If you are using the compressed code, go to line 37 and find this code:

Search for B.contentEditable

You will find an if condition exactly like this:

if (B.contentEditable || !!window.opera)


Replace it with this:

if ((B.contentEditable || !!window.opera) && navigator.userAgent.indexOf("Firefox/3") == -1)

Autres conseils

The above answer will bring you in iFrame mode, which is rather slow. You better look here: http://web2.0goodies.com/blog/javascript/nicedit-firefox-center-and-right-align-bug-patch/. This wil actually 'fix' the FF bug.

Just add this: document.execCommand('StyleWithCSS', false, false); ... right before your execCommand(cmd, false, val) command. Around Line 576.

       nicCommand : function(cmd,args) {
          if(navigator.appVersion.indexOf("MSIE") <= 0) {
              //do not use for IE
              document.execCommand('StyleWithCSS', false, false);
          }
            document.execCommand(cmd,false,args);
        }       
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top