个人动态编辑框高度自动变高缩短

其他编辑框自动长高缩短
This commit is contained in:
lizanle 2015-09-08 11:18:02 +08:00
parent e8c5627c41
commit de822daf44
3 changed files with 21 additions and 4 deletions

View File

@ -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;}
</style>
<% user_activities.each do |user_activity|
if user_activities %>

View File

@ -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)

View File

@ -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;