From b2afe18ccd796e57c682b244b92642e29a492607 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 9 Sep 2015 13:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83=20?= =?UTF-8?q?=E7=95=99=E8=A8=80=E7=95=8C=E9=9D=A2=20=20=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A1=86=E8=87=AA=E9=80=82=E5=BA=94=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/init_KindEditor.js | 15 +++++++++------ public/javascripts/user.js | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/public/javascripts/init_KindEditor.js b/public/javascripts/init_KindEditor.js index 8dadc9ea6..9ee2fad59 100644 --- a/public/javascripts/init_KindEditor.js +++ b/public/javascripts/init_KindEditor.js @@ -1,16 +1,18 @@ function init_editor(params){ - var minHeight; + var minHeight; //最小高度 + var paramsHeight = params.height; //设定的高度 + var editor = params.kindutil.create(params.textarea, { resizeType : 1,minWidth:"1px",width:"100%", - height:params.height == undefined ? "30px":params.height+"px", - minHeight:params.height == undefined ? "30px":params.height+"px", + height:paramsHeight == undefined ? "30px":paramsHeight+"px", + minHeight:paramsHeight == 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(minHeight); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (params.height == undefined ? 30:params.height), minHeight)); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (paramsHeight == undefined ? 30:paramsHeight), minHeight)); }, afterCreate:function(){ var toolbar = $("div[class='ke-toolbar']",params.div_form); @@ -24,9 +26,9 @@ function init_editor(params){ //reset height var edit = this.edit; var body = edit.doc.body; - minHeight = params.kindutil.removeUnit(this.height); + minHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; edit.iframe.height(minHeight); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (params.height == undefined ? 30:params.height) , minHeight)); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (paramsHeight == undefined ? 30:paramsHeight) , minHeight)); } }).loadPlugin('paste'); @@ -82,6 +84,7 @@ function nh_reset_form(params){ params.textarea.empty(); if(params.editor != undefined){ params.editor.html(params.textarea.html()); + params.editor.edit.doc.body.offsetHeight = 0; } params.contentmsg.hide(); } diff --git a/public/javascripts/user.js b/public/javascripts/user.js index 47e1e1c98..a775f5936 100644 --- a/public/javascripts/user.js +++ b/public/javascripts/user.js @@ -8,7 +8,7 @@ $(function(){ params.div_form = $("div[nhname='div_form']",params.container); params.form = $("form",params.div_form); params.textarea = $("textarea[name='user_notes']",params.div_form); - params.textarea.prev('div').css("height","60px"); + //params.textarea.prev('div').css("height","60px"); params.contentmsg = $("p[nhname='contentmsg']",params.div_form); params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form); @@ -43,7 +43,7 @@ $(function(){ params.div_form = $("div[nhname='sub_div_form']",params.container); params.form = $("form",params.div_form); params.textarea = $("textarea[name='user_notes']",params.div_form); - params.textarea.prev('div').css("height","60px"); + //params.textarea.prev('div').css("height","60px"); params.contentmsg = $("p[nhname='sub_contentmsg']",params.div_form); params.toolbar_container = $("div[nhname='sub_toolbar_container']",params.div_form); params.cancel_btn = $("a[nhname='sub_cancel_btn']",params.div_form);