为CKEditor指定自定义配置文件

时间:2009-11-18 09:43:31

标签: asp.net configuration toolbar ckeditor

我正在尝试将CKEditor添加到我正在开发的页面中,但是在获取自定义配置文件时遇到了问题?我在Visual Studio.NET 2008中使用CKEditor。我需要自定义显示的工具栏,因为Basic太小而Full会给用户提供大量的按钮。

我在aspx页面中声明编辑器如下:

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

myconfig.js文件本身位于ckeditor目录的根目录中(config.js所在的位置)。

但是,desipite渲染CKEditor本身,似乎完全忽略了我的自定义配置文件。我想知道是否有人有任何建议?

谢谢!

自定义配置文件的内容如下:

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 个答案:

答案 0 :(得分:8)

以为我会发布一个解决方案。 :

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

来自网站的根目录,而不是来自CKEditor的目录。

所以我的声明应该如下

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

希望我可能在类似的船上帮助其他人,因为CKEditor的文档在实地有点薄。