From 95f66a304c2483ea8b12c3a1d788d14a29850bfd Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 9 Sep 2015 10:55:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=20kindeditor=5Ftag=20f.kinde?= =?UTF-8?q?ditor=E7=94=9F=E4=BA=A7=E7=9A=84=E7=BC=96=E8=BE=91=E6=A1=86?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=87=AA=E5=8A=A8=E9=95=BF=E9=AB=98=E7=BC=A9?= =?UTF-8?q?=E7=9F=AD=20=E8=AF=BE=E7=A8=8B=E6=A8=A1=E5=9D=97=E7=9A=84?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=EF=BC=8C=E8=AE=A8=E8=AE=BA=E5=8C=BA=EF=BC=8C?= =?UTF-8?q?=E7=95=99=E8=A8=80=E9=83=BD=E5=8F=AF=E4=BB=A5=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=9A=84=E9=95=BF=E9=AB=98=EF=BC=8C=E7=BC=A9=E7=9F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_courses_jours.html.erb | 5 +++-- public/javascripts/init_KindEditor.js | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 5ce51ff7b..12dd67c91 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -10,11 +10,11 @@ div.respond-form .reply_btn{margin-left:565px;margin-top:5px;} div.recall_con{width:570px;} div.recall_con .reply_btn{margin-left:525px;margin-top:5px;} - .ke-container{height: 80px !important;} + /*.ke-container{height: 80px !important;}*/ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>

<%= l(:label_leave_message) %>

@@ -62,6 +62,7 @@ params.contentmsg = $("p[nhname='contentmsg']",params.div_form); params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); + params.height = 55; if(params.textarea.data('init') == undefined){ params.editor = init_editor(params); init_form(params); diff --git a/public/javascripts/init_KindEditor.js b/public/javascripts/init_KindEditor.js index f2b7915ad..67616fd22 100644 --- a/public/javascripts/init_KindEditor.js +++ b/public/javascripts/init_KindEditor.js @@ -1,14 +1,16 @@ function init_editor(params){ var minHeight; var editor = params.kindutil.create(params.textarea, { - resizeType : 1,minWidth:"1px",width:"100%",height:"30px",minHeight:"30px", + resizeType : 1,minWidth:"1px",width:"100%", + height:params.height == undefined ? "30px":params.height+"px", + minHeight:params.height == undefined ? "30px":params.height+"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) + 30, minHeight)); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (params.height == undefined ? 30:params.height), minHeight)); }, afterCreate:function(){ var toolbar = $("div[class='ke-toolbar']",params.div_form); @@ -24,7 +26,7 @@ function init_editor(params){ var body = edit.doc.body; minHeight = params.kindutil.removeUnit(this.height); edit.iframe.height(minHeight); - this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ 30 , minHeight)); + this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (params.height == undefined ? 30:params.height) , minHeight)); } }).loadPlugin('paste'); @@ -85,6 +87,7 @@ function nh_reset_form(params){ } function init_KindEditor_data(id){ + var height = arguments[1] ? arguments[1] : undefined; KindEditor.ready(function (K) { $("div[nhname='new_message_" + id + "']").each(function () { var params = {}; @@ -99,7 +102,7 @@ function init_KindEditor_data(id){ params.toolbar_container = $("div[nhname='toolbar_container_" + id + "']", params.div_form); params.cancel_btn = $("#new_message_cancel_btn_" + id); params.submit_btn = $("#new_message_submit_btn_" + id); - + params.height = height; if (params.textarea.data('init') == undefined) { params.editor = init_editor(params); init_form(params);