<link rel="stylesheet" href="/kindeditor-4.0.6/themes/default/default.css" /> <link rel="stylesheet" href="/kindeditor-4.0.6/plugins/code/prettify.css" />
<script charset="utf-8" src="/kindeditor-4.0.6/kindeditor.js"></script> <script charset="utf-8" src="/kindeditor-4.0.6/lang/zh_CN.js"></script> <script charset="utf-8" src="/kindeditor-4.0.6/plugins/code/prettify.js"></script> <script> KindEditor.ready(function(K) { var editor1=K.create('textarea[name="description"]',{//name=form中textarea的name属性 cssPath : '/kindeditor-4.0.6/plugins/code/prettify.css', uploadJson : '/kindeditor-4.0.6/php/upload_json.php', fileManagerJson : '/kindeditor-4.0.6/php/file_manager_json.php', allowFileManager : true, afterCreate : function() { var self = this; K.ctrl(document, 13, function() { self.sync(); K('form[name=myform]')[0].submit(); // name=form表单的name属性 }); K.ctrl(self.edit.doc, 13, function() { self.sync(); K('form[name=myform]')[0].submit(); // name=form表单的name属性 }); } }); prettyPrint(); }); </script>
<form name="myform" method="post" action="根据实际填写"> <textarea name="description" style="width:700px;height:200px;"> </textarea> <br /> <input type="submit" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter) </form>最后在action中使用$_REQUEST['description']即可获取到在文本编辑器中输入的内容。
在线例子
http://weizongwei.sinaapp.com/application/views/kindeditor1.php