John Smith
John Smith

Reputation: 851

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

Upvotes: 1

Views: 5706

Answers (2)

Jakub Szymsza
Jakub Szymsza

Reputation: 86

In case anyone wondered about multiple editors solution, I find this to be the best one.

$(".ckeditor").each(function() {
    CKEDITOR.replace($(this).attr("id"), {
        extraPlugins: 'justify,font'
    });
});

Upvotes: 1

Harpartap Singh Permar
Harpartap Singh Permar

Reputation: 289

Use This:-

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

For More information click here

Upvotes: 1

Related Questions