集成CKEDITOR.replace和Perch以使用两个编辑器

时间:2011-09-15 17:13:09

标签: ckeditor perch

在CKEDITOR的文档中,有建议在config.js文件中使用以下内容:

CKEDITOR.editorConfig = function( config ) {
    config.toolbar_Full = [
         { name: 'document', items : [ 'Source','-',
           'Save','NewPage','DocProps','Preview',
           'Print','-','Templates' ] }
    ];
    config.toolbar = 'Full';
 };

虽然这实际上不起作用。它只能在没有parens的情况下工作:

 CKEDITOR.editorConfig = function( config ) {
    config.toolbar_Full = [
         [ 'Source','-','Save','NewPage','DocProps',
           'Preview','Print','-','Templates' ]
    ];
    config.toolbar = 'Full';
 };

现在,Perch也有这个小装备:CKEDITOR.replace意味着内联使用,但我想在config.js文件中使用它。如何重写对CKEDITOR.replace的调用,使其在config.js中运行?

CKEDITOR.replace( 'editor1', {
    toolbar : 'Full'
});

CKEDITOR.replace( 'editor2', {
    toolbar : 'Basic'
});

2 个答案:

答案 0 :(得分:1)

正如我在CKEditor forums中回复的那样,您必须使用旧版本的CKEditor,CKEditor 3.6中引入了工具栏语法

答案 1 :(得分:0)

只需使用自定义配置加载CKEditor:

CKEDITOR.replace( 'editor1', {
  toolbar: [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ]
});

或者定义自定义工具栏并加载它:

CKEDITOR.replace( 'editor2', {
  toolbar_Custom: [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ],
  toolbar: 'Custom'
});
相关问题