4.0版本以后,需要添加如下一句代码 :
afterBlur: function(){this.sync();}
即当失去焦点时,这个函数就是同步KindEditor的值到textarea文本框。
<script src="../../Scripts/Jquery-1.8.0.min.js"></script>
<link href="../../Scripts/kindeditor/themes/default/default.css" rel="stylesheet" />
<link href="../../Scripts/kindeditor/themes/default/default.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/kindeditor/plugins/code/prettify.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/kindeditor/kindeditor.js" type="text/javascript"></script>
<script src="../../Scripts/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
<script src="../../Scripts/kindeditor/plugins/code/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
KindEditor.ready(function (K) {
var editor1 = K.create('#newsContent', {
cssPath: '../../Scripts/kindeditor/plugins/code/prettify.css',
uploadJson: '../../Scripts/kindeditor/upload_json.ashx',
fileManagerJson: '../../Scripts/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();
});
},
afterBlur: function () { this.sync(); }
});
prettyPrint();
});
</script>
===========================================================================
如果觉得对您有帮助,微信扫一扫支持一下: