Summernote-“段落”按钮未显示用于选择组件的下拉菜单

时间:2019-06-09 06:08:24

标签: javascript jquery summernote

我正在使用Summernote富文本编辑器。 “段落”按钮不提供下拉菜单,因此我无法选择缩进和缩进功能。

我想念CDN还是请问另一个问题?

我的代码是:

HTML:

<!-- Text Editor -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-bs4.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-bs4.js"></script>

<div class="row">
    <div class="row col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <label class="control-label control-label-left col-lg-12 col-md-12 col-sm-12 col-xs-12" for="atHome">At Home:</label>
        <textarea class="summernote" id="atHome" name="atHome" rows="3"></textarea>
    </div>  
</div> <!-- Row -->

JS:

$(document).ready(function() {
    $('#atHome').summernote({
        toolbar: [
           // [groupName, [list of button]]
           ['style', ['bold', 'italic', 'underline', 'clear']],
           ['font', ['strikethrough', 'superscript', 'subscript']],
           ['fontsize', ['fontsize']],
           ['color', ['color']],
           ['para', ['ul', 'ol', 'paragraph']],
           ['height', ['height']]
        ]
    });
});

1 个答案:

答案 0 :(得分:1)

$(document).ready(function() {
$('#atHome').summernote({

  toolbar: [
      // [groupName, [list of button]]
      ['style', ['style']],
      ['style', ['bold', 'italic', 'underline', 'clear']],
      ['font', ['strikethrough', 'superscript', 'subscript']],
      ['fontsize', ['fontsize']],
      ['color', ['color']],
      ['para', ['ul', 'ol', 'paragraph']],
      ['height', ['height']],
      ['fontname', ['fontname']],
      ['table', ['table']],
      ['insert', ['link', 'picture', 'video']],
      ['view', ['fullscreen', 'codeview', 'help']]
      ]
  });
});

使用上面的代码检查对我有用,如果您的代码不起作用,请检查控制台是否有错误。