From 9f871ababbcc99c4ad8afaba4d6b3361a3dd4aa1 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Sep 2015 16:44:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=88=91=E8=A6=81?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/init_KindEditor.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/public/javascripts/init_KindEditor.js b/public/javascripts/init_KindEditor.js index 18e7182fb..956262d2f 100644 --- a/public/javascripts/init_KindEditor.js +++ b/public/javascripts/init_KindEditor.js @@ -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('我要回复'); 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{