【问题标题】:Summernote Rich-text editor: minHeight and maxHeight options have no effectSummernote 富文本编辑器:minHeight 和 maxHeight 选项无效
【发布时间】:2014-09-29 08:21:03
【问题描述】:

我使用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 浏览器中测试。

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

【问题讨论】:

  • 另一个烦人的问题是必要的引导样式覆盖了我的许多其他样式,从而破坏了我的设计。由于可维护性问题,我不想使用!important 覆盖样式。我认为 Summernote 可能不适合我 - 可惜。
  • 我很震惊这似乎仍然是一个问题。这些都不适合我:'minHeight' =&gt; 200'min-height' =&gt; 200'minHeight' =&gt; '200px''min-height' =&gt; '200px',即使事先指定了'height' =&gt; null

标签: jquery twitter-bootstrap-3 richtextbox rich-text-editor summernote


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2015-10-10
      • 2011-01-06
      • 2018-07-20
      • 1970-01-01
      • 1970-01-01
      • 2020-05-19
      • 2011-06-18
      • 1970-01-01
      • 2018-11-06
      相关资源
      最近更新 更多