angular - 将字体系列功能添加到 Angular 中的 CKEditor 工具栏
问题描述
遗憾的是,我无法将字体系列功能添加到 Angular 中的 CKEditor 工具栏。
我在控制台中收到以下错误:
toolbarview-item-unavailable:请求的工具栏项目不可用。阅读更多: https ://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-toolbarview-item-unavailable
{name: "fontFamily"}
这是我的项目的样子:
app.module.ts
...
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
import { CkeditorComponent } from './ckeditor/ckeditor.component';
...
@NgModule( {
declarations: [
...
CkeditorComponent
],
imports: [
...
CKEditorModule,
...
],
...
} )
ckeditor.component.ts
import * as BalloonEditor from '@ckeditor/ckeditor5-build-balloon';
@Component( {
...
} )
export class CkeditorComponent {
public Editor = BalloonEditor;
public editorConfig = {
fontFamily: {
options: [
'default',
'Ubuntu, Arial, sans-serif',
'Ubuntu Mono, Courier New, Courier, monospace'
]
},
toolbar: [
'heading', 'bulletedList', 'numberedList', 'fontFamily'
]
};
}
ckeditor.component.html
<ckeditor
[editor]="Editor"
[config]="editorConfig"
data="<p>Hello world!</p>"></ckeditor>
解决方案
正如我在GH 问题中回复您的那样,不幸的是,该FontFamily
插件不存在于Balloon Editor
构建中。因此,您有两种选择:
- 按照本指南在包外使用自定义插件构建一个编辑器,然后将该编辑器移动到 Angular 存储库。其余部分在Angular 集成指南中进行了描述。
- 按照这些步骤从源代码构建编辑器。虽然第一种方法得到官方支持,但我不能告诉你从源代码构建会起作用,因为我没有花太多时间研究它及其边缘案例。
- 使用 包含插件的Document Editor 。
FontFamily
推荐阅读
- java - 带有 jdbcAuthentication 的 Spring Security 抛出没有为 id “null”映射的 PasswordEncoder
- r - 如何将高分辨率时间转换为 R 中的 EST 时间?
- html - 如何使用 Bootstrap 将 flexbox 应用于图像库
- python-3.x - OpenCV - 图像文本增强 - OCR 预处理
- node.js - 调试器不会在生产代码断点处停止
- ios - 在选项卡之间移动时固定导航栏
- stata - 删除缺失值
- r - 在一定频率后循环填充矩阵
- usb - 未检测到 ReSpeaker 麦克风阵列
- google-chrome - Chrome 开发工具快捷方式会覆盖 Google 文档快捷方式