在编辑表单页面添加引用的js
<script charset="utf-8" src="../kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="../kindeditor/plugins/code/prettify.js"></script>
<script>
KindEditor.ready(function (K) {
var editor1 = K.create('#content', {
cssPath: '../kindeditor/plugins/code/prettify.css',
uploadJson: '../kindeditor/upload_json.ashx',
fileManagerJson: '../kindeditor/file_manager_json.ashx',
allowFileManager: true,
afterCreate: function () {
var self = this;
K.ctrl(document, 13, function () {
self.sync();
K('form[name=example]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function () {
self.sync();
K('form[name=example]')[0].submit();
});
}
});
prettyPrint();
});
</script>
form表单中
<asp:TextBox id="content" name="content" runat="server" TextMode="MultiLine" cols="100" rows="8" style="width:100%;height:300px;"></asp:TextBox>
文本域的id和var editor1 = K.create('#content', {里面的#后的相同
然后后台接受数据时直接取content的值就行了
插入图片的值从哪里获取呢
kindeditor文件夹下面有个文件upload_json.ashx在这里设置 //文件保存目录路径 String savePath = "../img/"; //文件保存目录URL String saveUrl = aspxUrl + "../img/"; //定义允许上传的文件扩展名 Hashtable extTable = new Hashtable(); extTable.Add("image", "gif,jpg,jpeg,png,bmp"); extTable.Add("flash", "swf,flv"); extTable.Add("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb"); extTable.Add("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2"); //最大文件大小 int maxSize = 1000000; this.context = context; 有文字注释改下就可以了