Summernote富文本编辑器:minHeight和maxHeight选项无效

问题描述 投票:2回答:2

我使用Summernote作为富文本编辑器,但minHeightmaxHeight初始化选项似乎没有效果? (它适用于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.1Bootstrap 3.0.1font awesome 4.0.3时,它在其他方面运行正常。在ChromeIE10浏览器中测试过。

如果有人知道这个问题的解决方法,请告诉我。

jquery twitter-bootstrap-3 richtextbox rich-text-editor summernote
2个回答
3
投票

我认为有一个小错误,我需要修改核心库以使其工作。请参阅下面的代码,我添加了else if

if (options.height) {
    $editable.height(options.height);
} else if(options.maxHeight){ 
    $editable.css('max-height', options.maxHeight);
}

1
投票

我能够通过CSS而不是JavaScript来实现这一点:

.my_summernote + .note-editor > .note-editable{
    min-height: 200px;
}

(然后将textarea设置为“my_summernote”类。)

© www.soinside.com 2019 - 2024. All rights reserved.