문제

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,

도움이 되었습니까?

해결책

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)

다른 팁

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);
        }       
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top