在Summernote中更改字体大小非常容易出现问题

3
我在使用 Summernote 的 fontsize 功能时遇到了问题。似乎在 Chrome 中效果最佳,但即使如此,我仍需先输入文字,然后将其高亮,从 Summernote 文本编辑器中选择所需的 fontsize 才能更改。其他浏览器则完全不起作用。
我认为这可能是由于某个类覆盖了 font-size,因此我尝试在 IE 中使用开发人员工具来撤销任何可疑的类,然后再次尝试更改字体大小,但没有成功。我还在整个互联网上搜索了很多资料,但找到的信息很少,这让我相信这可能是我安装的 Summernote 特有的问题。此外,我似乎找不到 Summernote 的演示版,这将有助于确定这是否只是一个“我”的问题还是一个更大的问题。
非常感谢您的帮助。
<textarea class="loneTextArea" style="width: 400px; height: 60px;"></textarea>

我如何实例化Summernote:

$(document).ready(function () {

    $('.loneTextArea').summernote({
        toolbar: [
          ['style', ['bold', 'italic', 'underline', 'clear']],
          ['font', ['strikethrough']],
          ['fontsize', ['fontsize']],
          ['color', ['color']],
          ['para', ['ul', 'ol', 'paragraph']],
          ['height', ['height']],
          ['codeview', ['codeview']]
        ],
        height: 60,
        width: 400,
    });

});
1个回答

2

试试这个:

$(document).ready(function () {

 $('.loneTextArea').summernote({
    toolbar: [
      ['style', ['bold', 'italic', 'underline', 'clear']],
      ['font', ['strikethrough']],
      ['fontsize', ['fontsize']],
      ['color', ['color']],
      ['para', ['ul', 'ol', 'paragraph']],
      ['height', ['height']],
      ['codeview', ['codeview']]
    ],
    fontSizes: [ '12', '16', '18', '24'], //here set the font size options you want
    height: 60,
    width: 400,
 });

});

OR, try this:

$('.loneTextArea').summernote('fontSize', 20);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接