CKEditor instance already exists

前端 未结 30 3552
刺人心
刺人心 2020-11-27 11:24

I am using jquery dialogs to present forms (fetched via AJAX). On some forms I am using a CKEditor for the textareas. The editor displays fine on the first load.

Whe

30条回答
  •  猫巷女王i
    2020-11-27 12:06

    I had the same problem where I was receiving a null reference exception and the word "null" would be displayed in the editor. I tried a handful of solutions, including upgrading the editor to 3.4.1 to no avail.

    I ended up having to edit the source. At about line 416 to 426 in _source\plugins\wysiwygarea\plugin.js, there's a snippet like this:

    iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' + ... + '>' );
    

    In FF at least, the iframe isn't completely instantiated by the time it's needed. I surrounded the rest of the function after that line with a setTimeout function:

    iframe = CKEDITOR.dom.element.createFromHtml( '' );
    setTimeout(function()
    { 
        // Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689)
        ...
    }, 1000);
    
    };
    
    // The script that launches the bootstrap logic on 'domReady', so the document
    ...
    

    The text renders consistently now in the modal dialogs.

提交回复
热议问题