1. 程式人生 > >富文字編輯器 kindeditor的使用

富文字編輯器 kindeditor的使用

引入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