如何动态更改CKEditor工具栏(不使用预定义的工具栏)?
CKEditor 开发人员指南仅告诉您如何在初始化期间设置工具栏.
我正在使用CKEditor 3.6.4.
根据mb21的建议,我设法通过重新初始化整个编辑器来加载一个新的工具栏:
CKEDITOR.instances.editor.destroy();
CKEDITOR.replace('editor', configWithNewToolbar);
Run Code Online (Sandbox Code Playgroud)
var editor = CKEDITOR.instances['text_id'];
if (editor) { editor.destroy(true); }
CKEDITOR.config.toolbar_Basic = [['Bold','Italic','Underline',
'-','JustifyLeft','JustifyCenter','JustifyRight','-','Undo','Redo']];
CKEDITOR.config.toolbar = 'Basic';
CKEDITOR.config.width=400;
CKEDITOR.config.height=300;
CKEDITOR.replace('text_id', CKEDITOR.config);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
25086 次 |
最近记录: |