Ckeditor中的部分配置

一、根据需求对工具栏进行屏蔽操作:

1、  在ckeditor文件下找到config.js文件

2、  在其中自定义需要的工具栏,配置事例如下

config.toolbar='Define';//自定义工具栏

config.toolbar_Define=[

           ['Source','-','Save','NewPage'],

           ['Cut','Copy','Paste','PasteText'],

           ['Font','-','Size','Blod','-'],

           ['matheqn']

                   ];

                   注:这里面添加的工具栏应全是ckeditor.js中toolbar_Full中定义的

二、根据需求在工具栏中加入ckeditor.jsk 中toolbar_Full中未定义的;(如需要添加一个名为matheqn的工具条)

1、  在ckeditor文件夹下找到plugins文件夹

2、  在plugins文件夹中创建一个名为matheqn的文件夹

3、  在这个文件夹下建立一个名为plugin.js的javascript文件

4、  文件中内容模式如下:

(function(){

    //Section 1 : 按下自定义按钮时执行的代码

    var a= {

        exec:function(editor){

            alert("abcdef");

        }

    },

    //Section 2 : 创建自定义按钮、绑定方法

    b='matheqn';

    CKEDITOR.plugins.add(b,{

        init:function(editor){

            editor.addCommand(b,a);

            editor.ui.addButton('matheqn',{

                label:'matheqn',//鼠标移上去后显示的内容

                icon: this.path + 'eqn_sigma.jpg',

                command:b

            });

        }

    });

})();

5、  若需要图标,则在同一级目录下保存图标

6、  注册插件

在config.js中添加如下代码:

config.extraPlugins="matheqn" //导入自己定义的插件

         7、完成添加toolbar_Full中未定义的工具条。

没有登录不能评论