This commit is contained in:
cxt 2015-09-11 16:44:08 +08:00
commit 35ccb23566
1 changed files with 20 additions and 3 deletions

View File

@ -8,15 +8,30 @@ function init_editor(params){
minHeight:"30px",// == undefined ? "30px":paramsHeight+"px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
var edit = this.edit;
var body = edit.doc.body;
edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (paramsHeight == undefined ? 30:paramsHeight), paramsHeight));
},
afterBlur:function(){
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
//params.toolbar_container.hide();
},
afterFocus: function(){
var edit = this.edit;
var body = edit.doc.body;
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\#\d*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){
edit.html('');
}
params.contentmsg.hide();
// params.toolbar_container.show();
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
toolbar.css('width',20);
$(".ke-outline>.ke-toolbar-icon",toolbar)//.append('表情');
params.toolbar_container.append(toolbar);
//init
var edit = this.edit;
@ -28,7 +43,9 @@ function init_editor(params){
var body = edit.doc.body;
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
edit.iframe.height(paramsHeight);
edit.html('<span id="hint" style="color: #808080">我要回复</span>');
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (paramsHeight == undefined ? 30:paramsHeight) , paramsHeight));
// params.toolbar_container.hide();
}
}).loadPlugin('paste');
@ -44,7 +61,7 @@ function nh_check_field(params){
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
if(params.content.isEmpty() || /^\&\w*\;\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\#\d*\;\"\&\w*\;[\u4e00-\u9fa5]*\&\w*\;\/\w*\&\w*\;$/.test(params.textarea.html())){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{