集成 CKEDITOR.replace 和 Perch 以使用两个编辑器
在 CKEDITOR 的文档中,建议在 config.js 文件中使用以下内容:
CKEDITOR.editorConfig = function( config ) {
config.toolbar_Full = [
{ name: 'document', items : [ 'Source','-',
'Save','NewPage','DocProps','Preview',
'Print','-','Templates' ] }
];
config.toolbar = 'Full';
};
尽管这实际上不起作用。它只能在没有括号的情况下工作:
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'
});
In CKEDITOR's documentation there are suggestions 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'
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如我在 CKEditor 论坛中回复的那样,您必须使用旧版本CKEditor,该工具栏语法是在 CKEditor 3.6 中引入的
As I replied in CKEditor forums, you must be using an old version of CKEditor, that toolbar syntax was introduced in CKEditor 3.6
只需使用您的自定义配置加载 CKEditor:
或者定义您的自定义工具栏并加载它:
Just load the CKEditor with your custom config:
Or define your custom toolbar and load it: