diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 609294161..a9c0e9101 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -82,13 +82,19 @@ function nh_init_board(params){ var editor = params.kindutil.create(params.textarea, { // allowPreviewEmoticons : false, // allowImageUpload : false, + autoHeightMode : true, resizeType : 1,minWidth:"1px",width:"560px",height:"150px", allowFileManager:true,uploadJson:"/kindeditor/upload", fileManagerJson:"/kindeditor/filemanager", 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(){ + this.loadPlugin("autoheight"); var userAgent = navigator.userAgent.toLowerCase(); if(/trident/.test(userAgent)){ $("div.talk_new .ke-container").css({'margin-left':'0px'}); diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index c9908d80f..6ed45d92e 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -7,7 +7,9 @@ module RailsKindeditor input_html = input_html.merge(style: 'display:none') output = ActiveSupport::SafeBuffer.new output << text_area_tag(name, content, input_html) - output << javascript_tag(js_replace(id, options.merge(window_onload: 'true'))) + output << javascript_tag(js_replace(id, options.merge(window_onload: 'true', + :autoHeightMode=>true, + afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'))) end def kindeditor(name, method, options = {})