我正在尝试向 Summernote 编辑器添加字体大小,但没有成功。如果我删除 ['fontsize', ['8', '9', '10', '11', '12', '14', '18']],
并使用 ['fontsize', ['fontsize']],
我只得到一种尺寸,即 13。我正在尝试获取尺寸列表。
<script>
$(document).ready(function() {
$('#image_body').summernote({
toolbar: [
// [groupName, [list of button]]
['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript']],
//['fontsize', ['fontsize']],
['fontsize', ['8', '9', '10', '11', '12', '14', '18']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']]
]
});
});
最佳答案
如果您想更改选项,则必须在属性 fontSizes
中指定数组。下面的代码将显示带有选项 8
、9
、10
、11
、 的字体按钮12
、14
和 18
:
$('#summernote').summernote({
fontSizes: ['8', '9', '10', '11', '12', '14', '18'],
toolbar: [
// [groupName, [list of button]]
['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']]
]
});
您可以看到编辑器正在工作here .
关于javascript - Summernote 将字体大小添加到工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50629596/