如何在一个页面添加多个不同的kindeditor编辑器

       kindeditor官方下载地址:http://kindeditor.net/down.php

     (入门必看)kindeditor官方文档:http://kindeditor.net/doc.php

   (入门必看)Kindeditor编辑器初始化参数文档:http://kindeditor.net/docs/option.html

  或许我们一个页面有需要用到多个文本编辑器的情况,那我们该怎么办呢?   本人查阅了很多资料最后终于找到一种方法,可以通过自定义编辑器的工具栏items属性,来实现:

直接上JS了:

<span class="lspan"><font color="red">*</font>商品信息:</span><%--<span class="lspan">
<input id="txtProductInfo" placeholder="请输入商品信息" value="<%=product.ProductInfo %>"
                                                name="txtProductInfo" type="text" maxlength="25" style="width: 444px" /></span>--%>
<script type="text/javascript">
        KindEditor.ready(function (K) {
        editor = K.create('#txtProductInfo', {
        cssPath: '../kindeditorx/plugins/code/prettify.css',
        uploadJson: '../kindeditorx/asp.net/upload_json.ashx',
        fileManagerJson: '../kindeditorx/asp.net/file_manager_json.ashx',
        minWidth: 444,
        minHeight: 200,
        maxWidth: 444,
        resizeType: 1,
        filterMode: false,
        allowFileManager: true,
        items: ['source', '|', 'undo', 'redo', '|', 'justifyleft', 'justifycenter', 'justifyright',
               'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript',
                'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '|', 'forecolor','hilitecolor','bold','italic'
                ,'underline','strikethrough','lineheight','removeformat'
               ]
        });
});
</script>
<textarea id="txtProductInfo" rows="5" cols="" style="width: 400px;"><%=product.ProductInfo %></textarea>

重点:

下面这些自定义显示工具是关键,其他的编辑器只需要修改items属性就可以了。

items: ['source', '|', 'undo', 'redo', '|', 'justifyleft', 'justifycenter', 'justifyright',
               'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript',
                'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '|', 'forecolor','hilitecolor','bold','italic'
                ,'underline','strikethrough','lineheight','removeformat'
               ]
        });

如下效果图:

 

关于items参数的解释如下:

sourceHTML代码
preview预览
undo后退
redo前进
cut剪切
copy复制
paste粘贴
plainpaste粘贴为无格式文本
wordpaste从Word粘贴
selectall全选
justifyleft左对齐
justifycenter居中
justifyright右对齐
justifyfull两端对齐
insertorderedlist编号
insertunorderedlist项目符号
indent增加缩进
outdent减少缩进
subscript下标
superscript上标
formatblock段落
fontname字体
fontsize文字大小
forecolor文字颜色
hilitecolor文字背景
bold粗体
italic斜体
underline下划线
strikethrough删除线
removeformat删除格式
image图片
flashFlash
media视音频
table表格
hr插入横线
emoticons插入表情
link超级链接
unlink取消超级链接
fullscreen全屏显示
about关于
print打印
code插入程序代码
mapGoogle地图
baidumap百度地图
lineheight行距
clearhtml清理HTML代码
pagebreak插入分页符
quickformat一键排版
insertfile插入文件
template插入模板
anchor插入锚点

转载于:https://www.cnblogs.com/lxhbky/p/6187266.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值