KindEditor.ready(function (K) {
var editor = K.create('#description', {
//上傳管理
uploadJson: '/kindeditor/asp.net/upload_json.ashx',
//文件管理
fileManagerJson: '/kindeditor/asp.net/file_manager_json.ashx',
allowFileManager: true,
//設置編輯器創建後執行的回調函數
afterCreate: function () {
//alert("after");
$("#dailyRecordCreateSub").click(function () {
var conCon = $(".ke-content").html();
if (editor.isEmpty()) {
alert("is null");
}
else {
alert(editor.html());
}
return false;
})
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();
});
},
//上傳文件後執行的回調函數,獲取上傳圖片的路徑
afterUpload: function (url) {
//alert(url);
},
//編輯器高度
width: '786px',
//編輯器寬度
height: '300px;',
//配置編輯器的工具欄
items: [
'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
'insertunorderedlist', '|', 'emoticons', 'image', 'link', 'unlink'
]
});
prettyPrint();
});
<div class="editor-label storeDailyDesc">
<div class="storeDailyDescLeft">描述:</div>
<div class="storeDailyDescRight">
@Html.TextAreaFor(model => model.description)
@Html.ValidationMessageFor(model => model.description)
</div>
</div>