<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Html Editor</title>
<script charset="utf-8" src="kindeditor-min.js"></script>
<script charset="utf-8" src="lang/zh_CN.js"></script>
<script>
window.οnerrοr=function(){return true;};
var editor;
var contentSeted=false;
KindEditor.ready(function(K) {
editor = K.create('#details', {
allowFileManager : false,
allowImageUpload: false,
urlType: 'domain',
//下面这行代码就是关键的所在,当失去焦点时执行 this.sync();
afterBlur: function () { this.sync(); },
items:[
'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
'insertunorderedlist', '|', 'emoticons', 'image', 'multiimage', 'link', 'table'
],
fullscreenMode:true,
afterChange:function(){
if(editor&&contentSeted)
window.external.RequestContent(editor.html());
}
});
setContent(window.external.GetContent());
});
function setContent(content){
if(editor){
contentSeted=false;
editor.html(content);
contentSeted=true;
}
}
</script>
</head>
<body>
<textarea id="details" style="display: block;width:100%;height:100%;visibility:hidden;"></textarea>
</body>
</html>
窗体调用KindEditor
最新推荐文章于 2023-07-21 15:51:00 发布