`

KindEditor 工具栏配置

 
阅读更多

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是默认显示所有的按钮。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics