富文本编辑器 kindeditor的使用

本文介绍如何在网页中引入并配置KindEditor富文本编辑器,包括设置编辑器的基本属性,如宽度、高度等,并定义了允许上传图片、浏览服务器文件等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

引入js
<script type="text/javascript" src="${pageContext.request.contextPath}/js/kindeditor-4.1.10/kindeditor-all-min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/kindeditor-4.1.10/lang/zh_CN.js"></script>





js代码


<script type="text/javascript">

//编辑器
var options={
	uploadJson: '${pageContext.request.contextPath}/information/addInformation.shtml',
	fileManagerJson : '/ckEditorUploadFile',
	allowFileManager : true, // 是否允许上传本地图片
	allowFileManager: true,  // 是否允许浏览服务器已上传文件
	allowFlashUpload:false, // 是否允许上传Flash(默认)
	allowMediaUpload:false, // 是否允许上传多媒体文件(默认)
	width: "96%", //编辑器的宽度为100%
	height: "400px", //编辑器的高度为100px
	filterMode: false, //不会过滤HTML代码
	resizeMode: 1,//编辑器只能调整高度 
	items : [
	         'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
	         'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
	         'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
	         'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
	         'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
	         'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 
	          '|' ,'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
	         'anchor', 'link', 'unlink', '|', 'about','audio'
		  	]
	};
KindEditor.ready(function(K) {
	editor = K.create('textarea[name="contents"]',options);
	
});
KindEditor.sync();

    
    
    
    
    
 </script>   



内容:


 <textarea id="contents" name="contents" style="width:98%; height:185px;visibility:hidden;">

              </textarea> 



所需的js



http://share.weiyun.com/07569bb5dc39a79d2c4813e2f26b5085


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

学海无涯苦做java

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值