我试图将字体大小添加到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/