KindEditor 工具栏配置

12 篇文章 0 订阅
11 篇文章 0 订阅

KindEditor编辑相对于FCK来说个人感觉更加的简便,使用起来也顺手。KindEditor同样也可以针对工具栏中的功能进行增减。

有时用在会员或网站前台时,只需要编辑器的字体效果以及图片地址的粘贴,而默认的KindEditor则是列出所有的功能来,所以需要对它进行一些配置。

打开 KindEditor目录下的kindeditor.js文件, 搜索items: 大概在60行左右,可以看到所有的工具栏按钮都在这里定义成一个数组。删除你不需要的按钮即可。不过这样的操作将影响所有调用该编辑器的页面,所以我们可以在需要减少按钮的aspx页定义一个数组后再引用kindeditor.js文件,如:

var itemshow=['title', 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold','italic', 'underline', 'strikethrough', 'removeformat', '|', 'image','hr', 'emoticons', 'link', 'unlink'];
<script type=”text/javascript” src=”../KindEditor/kindeditor.js”></script>
<script type=”text/javascript”>
        KE.show({
            id: ‘<%=txtContent.ClientID %>’,
            allowFileManager: false,
            allowUpload:false
        });
        </script>

接着再在kindeditor.js的KE.setting = { 前面加个判断

if (typeof (itemshow) == ‘undefined’) {
        itemshow = ['source', '|', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', '|', 'selectall', '-', 'title', 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image', 'flash', 'media', 'advtable', 'hr', 'emoticons', 'link', 'unlink', '|', 'about'];
    }

这里定义 itemshow是默认显示所有的按钮。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值