看到这,想必能搜的也都搜了,话不多说,上代码
import * as QuillNamespace from 'quill';
const Quill: any = QuillNamespace;
fonts = [
'serif',
'monospace',
'SimSun',
'FangSong',
'SimHei',
'KaiTi',
'Microsoft-YaHei',
'Arial',
'Arial Black',
'Comic Sons MS',
'Courier New',
'System',
'Tahoma',
'Verdana'
];
const Font = Quill.import('attributors/style/font');
Font.whitelist = this.fonts;
Quill.register(Font, true);
这样就把自定义字体注册进去了。后面不多说了。
参考链接:Custom fonts · Issue #137 · KillerCodeMonkey/ngx-quill · GitHub
javascript - How to add font types on Quill js with toolbar options? - Stack Overflow