开发者

Integrating CKEDITOR.replace and Perch to use two editors

In CKEDITOR's documentation there are suggesti开发者_运维问答ons to use the following in the config.js file:

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

Though that actually does not work. It only works without the parens:

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

Now, Perch also has this little rig: CKEDITOR.replace that is meant to be used inline, but I would like to use it in the config.js file. How do I rewrite the call to CKEDITOR.replace so that it works inside config.js?

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

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


As I replied in CKEditor forums, you must be using an old version of CKEditor, that toolbar syntax was introduced in CKEditor 3.6


Just load the CKEditor with your custom config:

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

Or define your custom toolbar and load it:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜