开发者

multiple tinyMce instances not working in chrome

As with the title in Chrome (v.4.1) multiple tinyMce开发者_如何学运维 (v2.08) instances do not work. To be exact the first two instances are ok, the others not, and chrome gives this error:

Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

Has this happened before?

Unfortunately I can't show you any code because it's for an admin area, I just need some clue for the moment.


Yes, as user XP1 noted, at this link you can find resolution for a comprimed TinyMCE source: http://my.opera.com/XP1/blog/2011/07/21/tinymce-javascript-error-in-opera-getrangeat-index-size-err

But if you want to work with original uncomprimed source (it's just a bit easier), here is the solution: Look for code "setRng : function(r) {" (without quotes) and exchange the whole function with:

setRng : function(r) {
        var s, t = this;

        if (!t.tridentSel) {
            s = t.getSel();

            if (s)              // this block fixed according to TinyMCE JavaScript error in Opera (getRangeAt, INDEX_SIZE_ERR); http://my.opera.com/XP1/blog/2011/07/21/tinymce-javascript-error-in-opera-getrangeat-index-size-err
            {
                if(s.anchorNode === null && s.focusNode === null)
                {
                    t.explicitRange = r;
                    try {
                        s.removeAllRanges();
                    } catch (ex) {
                        // IE9 might throw errors here don't know why  (NOW WE KNOW WHY DAMMIT!)
                    }
                    s.addRange(r);  
                }
                if (s.rangeCount > 0)
                t.selectedRange = s.getRangeAt(0);
            }
        } else {
            // Is W3C Range
            if (r.cloneRange) {
                t.tridentSel.addRange(r);
                return;
            }

            // Is IE specific range
            try {
                r.select();
            } catch (ex) {
                // Needed for some odd IE bug #1843306
            }
        }
    },

ONE NOTE: please make sure variables match. I am not sure how it is between different TinyMCE versions BUT the variables are not the same between comprimed and src mutations of the script file.

Take Care and God Speed

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜