From de822daf44c863e717c609b975eff9344821ee78 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 8 Sep 2015 11:18:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A1=86=E9=AB=98=E5=BA=A6=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8F=98=E9=AB=98=E7=BC=A9=E7=9F=AD=20=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A1=86=E8=87=AA=E5=8A=A8=E9=95=BF=E9=AB=98?= =?UTF-8?q?=E7=BC=A9=E7=9F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_activities.html.erb | 1 - .../lib/rails_kindeditor/helper.rb | 3 ++- public/javascripts/init_KindEditor.js | 21 +++++++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 4ff98b1b7..f071cbeb4 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -9,7 +9,6 @@ span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} div.ke-toolbar .ke-outline{border:none;} .ke-inline-block{display: none;} - .ke-container{height: 30px !important;} <% user_activities.each do |user_activity| if user_activities %> diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index d5f91ebf8..c9908d80f 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -17,7 +17,8 @@ module RailsKindeditor output_buffer = ActiveSupport::SafeBuffer.new output_buffer << build_text_area_tag(name, method, self, options, input_html) output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true', - afterCreate: 'eval(function(){enablePasteImg(self);})'))) + :autoHeightMode=>true, + afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'))) end def kindeditor_upload_json_path(*args) diff --git a/public/javascripts/init_KindEditor.js b/public/javascripts/init_KindEditor.js index fc02146bb..f2b7915ad 100644 --- a/public/javascripts/init_KindEditor.js +++ b/public/javascripts/init_KindEditor.js @@ -1,14 +1,31 @@ function init_editor(params){ + var minHeight; var editor = params.kindutil.create(params.textarea, { - resizeType : 1,minWidth:"1px",width:"100%",height:"80px", - items:['emoticons'], + resizeType : 1,minWidth:"1px",width:"100%",height:"30px",minHeight:"30px", + 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)); }, afterCreate:function(){ var toolbar = $("div[class='ke-toolbar']",params.div_form); $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); params.toolbar_container.append(toolbar); + //init + var edit = this.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + //reset height + var edit = this.edit; + 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)); + } }).loadPlugin('paste'); return editor; From cdca8dea4ddead75fe1cbfe533bb1a1b4c7ab082 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 8 Sep 2015 11:55:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E7=9A=84=E5=9B=BE=E7=89=87=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=A4=A7=E5=9B=BE=E5=90=8E=E7=9A=84=E8=93=9D?= =?UTF-8?q?=E8=89=B2=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 8b9acb36e..04f541d77 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -141,7 +141,7 @@ image.wrap(element); } } - $('#activity_description_<%= user_activity_id %> a').colorbox({rel:'nofollow', close: "关闭"}); + $('#activity_description_<%= user_activity_id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); }); \ No newline at end of file