通过 kindeditor_tag f.kindeditor生产的编辑框可以自动长高缩短
课程模块的通知,讨论区,留言都可以自动的长高,缩短
This commit is contained in:
parent
faf5f1eab5
commit
95f66a304c
|
@ -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;}*/
|
||||
</style>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
|
||||
<script >
|
||||
init_KindEditor_data('');
|
||||
init_KindEditor_data('',80);
|
||||
</script>
|
||||
<div class="msg_box fl mb10" id='leave-message'>
|
||||
<h4><%= l(:label_leave_message) %></h4>
|
||||
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue