我使用Summernote作为富文本编辑器,但minHeight
和maxHeight
初始化选项似乎没有效果? (它适用于height
选项。)
我搜索了其他帖子但找不到具有完全相同问题的帖子。这是我的代码:
HTML:
<textarea id='summernote_editor' name='summernote_editor' class='summernote'></textarea>
jQuery的:
$(function() {
$('.summernote').summernote( {
minHeight: 200 // using maxHeight here instead, or both, has no effect either
});
});
我使用的是最新版本的Summernote
,在使用jQuery 1.11.1
,Bootstrap 3.0.1
和font awesome 4.0.3
时,它在其他方面运行正常。在Chrome
和IE10
浏览器中测试过。
如果有人知道这个问题的解决方法,请告诉我。
我认为有一个小错误,我需要修改核心库以使其工作。请参阅下面的代码,我添加了else if
if (options.height) {
$editable.height(options.height);
} else if(options.maxHeight){
$editable.css('max-height', options.maxHeight);
}
我能够通过CSS而不是JavaScript来实现这一点:
.my_summernote + .note-editor > .note-editable{
min-height: 200px;
}
(然后将textarea
设置为“my_summernote”类。)