文本编辑器KindEditor的使用

1、下载文件

2、在jsp 页面引入

<script charset="UTF-8" type="text/javascript" src="<%=request.getContextPath() %>/resources/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" type="text/javascript" src="<%=request.getContextPath() %>/resources/kindeditor/lang/zh_CN.js"></script>

3、<script>
   KindEditor.ready(function(K) {
   var editor1 = K.create('textarea[name="content"]',{
    cssPath : '${pageContext.request.contextPath}/resources/kindeditor/plugins/code/prettify.css',
    uploadJson : '${pageContext.request.contextPath}/resources/kindeditor/jsp/upload_json.jsp',
    fileManagerJson : '${pageContext.request.contextPath}/resources/kindeditor/jsp/file_manager_json.jsp',
    allowFileManager : true,
    afterCreate : function() {
     var self = this;
     K.ctrl(document, 13, function() {
      self.sync();
      document.forms['myform'].submit();
     });
     K.ctrl(self.edit.doc, 13, function() {
      self.sync();
      document.forms['myform'].submit();
     });
    }
   });
  });
 </script>

说明:name ='是文本框的name值' ,form 里面指的是form的id

你可能感兴趣的:(文本编辑器KindEditor的使用)