操作系统: win7 thinpc
浏览器版本: chrome
KindEditor版本: 4.1.10
BUG再现步骤:
1.官方demo中asp部分调用编辑器取得选中内容发生错误,原因已找到
2.原代码
<script>
KindEditor.ready(function(K) {
var editor = K.create('textarea[name="content1"]', {
cssPath : '../editor/plugins/code/prettify.css',
uploadJson : '../editor/asp/upload_json.asp',
fileManagerJson : '../editor/asp/file_manager_json.asp',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K('form[name=form1]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K('form[name=form1]')[0].submit();
});
}
});
prettyPrint();
});
</script>
3.修改后正确代码
<script>
KindEditor.ready(function(K) {
editor = K.create('textarea[name="content1"]', {
cssPath : '../editor/plugins/code/prettify.css',
uploadJson : '../editor/asp/upload_json.asp',
fileManagerJson : '../editor/asp/file_manager_json.asp',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K('form[name=form1]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K('form[name=form1]')[0].submit();
});
}
});
prettyPrint();
});
</script>
期望结果: 删除editor前的var即可