Search code examples
javascriptjqueryckeditor

CKEditor edit config on the fly


I have config.js file, but I also want to config some buttons dynamically. Here is my code for page:

 CKEDITOR.on('instanceReady', function (evt)
                  {

                    CKEDITOR.instances.MY_INSTANCE.destroy();
                    CKEDITOR.config.toolbar_Basic = [['Bold']];
                    CKEDITOR.config.toolbar = 'Basic';
                    CKEDITOR.config.width=400;
                    CKEDITOR.config.height=300;
                    CKEDITOR.replace('MY_INSTANCE', CKEDITOR.config);
});

when I go to the page, textarea is blinking and appears/disappears all time. What's wrong? How to change ckeditor's config dynamically ?

PS. I've seen this answer, but it didn't help me much


Solution

  • Use This:-

     CKEDITOR.replace( 'editor1', {
            language: 'fr',
            uiColor: '#9AB8F3'
        });
    

    For More information click here