Multiple elRTE instances on one page only works in Chrome? FF and IE show broken areas

Added by Chris Hoopes 6 months ago

Hello,

I'm trying to instantiate multiple WYSIWYG editors on one page by having multiple divs of the same class and initializing them in this way:

$().ready(function() {
    var opts = {
        cssClass : 'el-rte',
        width    : 600,
        height   : 300,
        toolbar  : 'normal',
        cssfiles : ['css/elrte-inner.css']
    }
    $('.editor').elrte(opts);
})

This works perfectly fine in Chrome but Firefox and IE9 show broken editor areas with no buttons and no content. Am I doing this wrong or is this just a limitation of the editor? I really like elRTE as this is a multi-language site so any help will be greatly appreciated.

Thanks!


Replies (3)

RE: Multiple elRTE instances on one page only works in Chrome? FF and IE show broken areas - Added by Troex Nevelin 6 months ago

I think you have to init each elRTE one by one using unique id. I haven't test such case

RE: Multiple elRTE instances on one page only works in Chrome? FF and IE show broken areas - Added by Chris Hoopes 6 months ago

Unfortunately if I change it from one editor class to multiple unique IDs and initiating them individually it still doesn't work in IE or FF. In fact, having more than one editor on a page in FF throws this Javascript error which is probably the root of the problem:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) 
[nsIDOMHTMLDocument.execCommand]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame 
:: http://localhost/admin/js/elrte.min.js :: <TOP_LEVEL> :: line 34"  data: no]

RE: Multiple elRTE instances on one page only works in Chrome? FF and IE show broken areas - Added by asfd fafds 5 months ago

This has to do with the visibly of element before it is transformed to a wysiwyg. It it's visible it works fine.
Show the element then transform it to wysiwyg, it should work.

Also while researching this problem I found and corrected another bug which I believe is unrelated, but I'm not 100% sure about that as I write this.

I changed line 4132
from
first = (tbl 0 ? true : false);

to
var first = (tbl 0 ? true : false);

(a few lines of code around this changed line of code to help you find the exact line)
.....
// create buttons and put on toolbar
while (tbl--) {
var first = (tbl 0 ? true : false); // <-- this line
if (tb[tbl - 1] 'eol') { first = true; }
pname = tb[tbl];
....

this was crashing IE8 but working fine in firefox. Perhaps I was in IE's HerpDerp-Mode not sure

(1-3/3)