javascript - 在 Quill 编辑器 Angular 2+ 中添加字体
问题描述
我在 Angular 中使用羽毛笔编辑器我无法在 Angular 2+ 中添加多种字体我正在使用以下代码片段
QuillModule.forRoot({
modules: {
toolbar: [
['blockquote', 'code-block'],
// [{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
// [{ 'script': 'sub' }, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'], // remove formatting button
['link', 'image'] // link and image, video
]
},
})
每当我在字体列表中添加字体时,我总是得到相同的字体。我也关注了这个链接,但它不是角度的,我想 如何使用工具栏选项在 Quill js 上添加字体类型?
谁能帮我?
解决方案
带有ql-font
类的选择标签。这将包含新的字体选项。将新字体添加到白名单。这必须在您调用 Javascript 中的 Quill 构造函数之前定义。为下拉列表中的每个标签定义字体系列。例子:
font-family: "Inconsolata"
定义将在文本区域中使用的内容字体系列。按照第三个组件中的示例:.ql-font-inconsolata
{ font-family: "Inconsolata";}
推荐阅读
- unity3d - 在 Unity 中同步时间和动画的问题
- php - 在 EXIF 读取数据中访问 Thumbnail.MimeType 时出现问题
- javascript - 使用 Settimeout 警告并最终将用户重定向到非活动会话不起作用
- mysql - 获取最低Time对应的DateTime
- c - 在 c 中读取数组或矩阵中的灰度图像(不使用任何库)
- spring-data-r2dbc - Spring数据r2dbc和分页
- python - EXCEL COM 插件:自动登录
- python - 为什么不需要重塑一维数组以适应具有多个变量的线性回归
- java - 按 HashMap 中的值对对象进行排序
- django - django-oauth-toolkit - 提供对特定模型的应用程序访问