Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editing the ckeditor config.js has no impact

I changed my CKeditor config.js file to include all the buttons possible to this:

CKEDITOR.editorConfig = function( config ) {
    config.toolbarGroups = [
        { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
        { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
        { name: 'forms', groups: [ 'forms' ] },
        '/',
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
        { name: 'links', groups: [ 'links' ] },
        { name: 'insert', groups: [ 'insert' ] },
        '/',
        { name: 'styles', groups: [ 'styles' ] },
        { name: 'colors', groups: [ 'colors' ] },
        { name: 'tools', groups: [ 'tools' ] },
        { name: 'others', groups: [ 'others' ] },
        { name: 'about', groups: [ 'about' ] }
    ];
};

This config was generated using the CKeditor config generator tool.

After the change was deployed to my server and the page was refreshed using incognito mode in chrome none of the buttons changed.

If I add this code directly in my admin.master then the new button does show.

<script>
    jQuery(function() {
        CKEDITOR.config.extraPlugins = 'justify';
    });
</script>

Is it possible that I am not using the config.js at all?

like image 473
codeNinja Avatar asked Jul 25 '18 22:07

codeNinja


1 Answers

There's a Github issue that was posted for this https://github.com/galetahub/ckeditor/pull/433 (a long time ago). Also, a discussion post about unreflected changes when using CKEDITOR.editorConfig here: https://ckeditor.com/old/forums/CKEditor-3.x/config.js-changes-not-reflected

My suggestion:

Try to clear the cache after you change the config. Check the "console" tab in your developpers inspector inside the browser to verify if there's is any errors.

As an alternative you could use the replace() method after destroying the loaded instance inside the instanceReady event callback like :

CKEDITOR.instances.editor1.on("instanceReady", function(event) {
  CKEDITOR.instances.editor1.destroy(); 
  CKEDITOR.replace('editor1', {
    toolbarGroups
  });
});

Working demo fiddle.

like image 153
Zakaria Acharki Avatar answered Nov 08 '22 18:11

Zakaria Acharki