在控件中使用kindeditor编辑器,却无法获取其值时的解决方案

  • A+
所属分类:PHP技术

这里以.Net为例子

在文件头部导入相应的脚步:

<link rel="stylesheet" href="editor/themes/default/default.css" />
<link rel="stylesheet" href="editor/plugins/code/prettify.css" />
<script charset="utf-8" src="editor/kindeditor.js"></script>
<script charset="utf-8" src="editor/lang/zh_CN.js"></script>
<script charset="utf-8" src="editor/plugins/code/prettify.js"></script>
<script>
KindEditor.ready(function (K) {
var editor1 = K.create('#dl_content1_0', {
cssPath: 'editor/plugins/code/prettify.css', uploadJson: 'editor/asp.net/upload_json.ashx', fileManagerJson: 'editor/asp.net/file_manager_json.ashx',
allowFileManager: true, afterCreate: function () { var self = this; }, afterBlur:function(){this.sync();}
});

var editor2 = K.create('#dl_content2_0', {
cssPath: 'editor/plugins/code/prettify.css', uploadJson: 'editor/asp.net/upload_json.ashx', fileManagerJson: 'editor/asp.net/file_manager_json.ashx',
allowFileManager: true, afterCreate: function () { var self = this; }, afterBlur: function () { this.sync(); }
});

prettyPrint();
});
</script>

其中要注意afterBlur: function () { this.sync(); },这行代码是在编辑器中失去焦点kindeditor编辑器任然将值同步给textarea的过程!

发表评论

您必须登录才能发表评论!