下载KindEditor编辑器D
引用: <link rel="stylesheet" type="text/css" href="@Url.Content("~/Scripts/Common/kindeditor/themes/default/default.css")" />
编写javascript脚本中添加以下:
///KindEditor文本编辑器
var editor1;
KindEditor.ready(function (K) {
editor1 = K.create('textarea[name="content1"]', {
cssPath: '/Scripts/Common/kindeditor/plugins/code/prettify.css',
uploadJson: '/Scripts/Common/kindeditor/asp.net/upload_json.ashx',
fileManagerJson: '/Scripts/Common/kindeditor/asp.net/file_manager_json.ashx',
allowFileManager: true,
resizetype:0 // 固定高度,不能改变宽高,还有两个值:1,2
afterBlur: function () { this.sync(); },
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();
});
}
});
});
<textarea name="content1" id="content1" cols="50" rows="30"></textarea>