KindEditor在线html编辑器

2013.01.14 No Comments

推荐一款,配置简单,功能完善的html编辑器,它就是大家广为熟知的KindEditor-这里介绍的是php版.

1.下载源码包 kindeditor-4.1.4  最新地址:  http://www.kindsoft.net/down.php

2.直接使用源码包中php包的demo源码实例进行配置使用。

例:

<head>

<script charset="utf-8" src="__PUBLIC__/kindeditor/kindeditor.js"></script>  <!--此处为thinkphp路径-->
<script charset="utf-8" src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
<link rel="stylesheet" href="__PUBLIC__/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="__PUBLIC__/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="__PUBLIC__/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="__PUBLIC__/kindeditor/plugins/code/prettify.js"></script>
<script>
KindEditor.ready(function(K) {
var editor1 = K.create('textarea[name="content[]"]', {
cssPath : '__PUBLIC__/kindeditor/plugins/code/prettify.css',
uploadJson : '__PUBLIC__/kindeditor/php/upload_json.php',  <!--设置包含文件上传的路径-->
fileManagerJson : '__PUBLIC__/kindeditor/php/file_manager_json.php',
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>
<head>
编辑内容
<form name="example" method="post" action="__URL__/update">
<input type="text" name="title" value={$cont.Title} >
<textarea name="content[]" style="width:700px;height:200px;visibility:hidden;"><?php echo htmlspecialchars($cont['Content']); ?></textarea>
<br />
<input type="submit" name="button" value="提交" /> (提交快捷键: Ctrl + Enter)
</form>

 

 

 

Related Posts:

评论已关闭。