【发布时间】:2019-02-16 11:14:55
【问题描述】:
我希望能够通过 JavaScript 使用工具栏选项将自定义字体系列添加到我的 Quill JS 编辑器,而不是通过 HTML 定义它们。
我的代码如下,与文档中的代码相同:
var toolbarOptions = [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }],
[{ 'indent': '-1'}, { 'indent': '+1' }],
[{ 'direction': 'rtl' }],
[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }],
[{ 'font': [] }], // Here, how do I specify custom font families??
[{ 'align': [] }],
];
var quill = new Quill('#editor', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow'
});
此处运行的代码:https://codepen.io/anon/pen/VgVZMg
有没有办法做到这一点?另外,我假设我需要为我想要使用的每种字体添加一个指向 Google 字体的链接,对吧?
谢谢
【问题讨论】:
标签: javascript fonts font-family quill