Specifying a custom configuration file for CKEditor

元气小坏坏 提交于 2020-01-01 05:30:39

问题


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']];

回答1:


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.



来源:https://stackoverflow.com/questions/1754798/specifying-a-custom-configuration-file-for-ckeditor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!