Specifying a custom configuration file for CKEditor

12,584

Thought I'd post up a solution. The path in the:

CKEDITOR.replace(document.getElementById("<%= txtTourItinerary.ClientID %>"),        
  { customConfig: 'myconfig.js' }

is from the root of the website, not relative to the directory from CKEditor.

So my declaration should have been as follows

<script type="text/javascript">
    CKEDITOR.replace(document.getElementById("<%= txtTourItinerary.ClientID %>"),
        { customConfig: '/ckeditor/myconfig.js' }
    );
</script>

Hopefully I might have helped someone else in a similar boat as documentation on CKEditor is a little thin on the ground.

Share:
12,584
Barry Roberts
Author by

Barry Roberts

Updated on June 22, 2022

Comments

  • Barry Roberts
    Barry Roberts almost 2 years

    I am trying to add the CKEditor to a page I am currently developing but am having problems getting it to pick up my custom configuration file? I am using CKEditor in Visual Studio.NET 2008. I need to customize the toolbars that are displayed, as Basic is too minimal and Full would give an overwhelming amount of buttons to the user.

    I am declaring the editor in the aspx page as follows:

    <script type="text/javascript">
        CKEDITOR.replace(document.getElementById("<%= txtTourItinerary.ClientID %>"),
            { customConfig: 'myconfig.js' }
        );
    </script>
    

    the myconfig.js file itself is in the root of the ckeditor directory (where config.js resides).

    However, desipite rendering the CKEditor itself, it seems to be completely ignoring my custom config file. I was wondering if anyone had any suggestions?

    Thanks!

    The contents of the custom config file are as follows:

    CKEDITOR.editorConfig = function( config )
    {
        // Define changes to default configuration here. For example:
        config.language = 'en';
        config.defaultLanguage = 'en';
        config.uiColor = '#000000';
    };
    
    CKEDITOR.config.toolbar_Full = [['Save', '-', 'Preview', '-' 'Print'],
        ['Undo', 'Redo'], ['Cut', 'Copy', 'Paste', 'PasteFromWord', 'SelectAll'], 
        ['Find', 'Replace'],
        '/',
        ['Bold', 'Italic', 'Unnderline', 'Strike', '-', 'Subscript', 'Superscript']];