Angular 将字体族功能添加到角形编辑器工具栏

Angular 将字体族功能添加到角形编辑器工具栏,angular,ckeditor,toolbar,font-family,ckeditor5,Angular,Ckeditor,Toolbar,Font Family,Ckeditor5,遗憾的是,我无法将字体系列功能添加到CKEditor的工具栏中 我在控制台中遇到以下错误: 工具栏视图项不可用:请求的工具栏项不可用 不可用的阅读更多: 以下是我的项目的外观: 应用程序模块.ts ... import { CKEditorModule } from '@ckeditor/ckeditor5-angular'; import { CkeditorComponent } from './ckeditor/ckeditor.component'; ... @NgModule( {

遗憾的是,我无法将字体系列功能添加到CKEditor的工具栏中

我在控制台中遇到以下错误:

工具栏视图项不可用:请求的工具栏项不可用 不可用的阅读更多:

以下是我的项目的外观:

应用程序模块.ts

...
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
import { CkeditorComponent } from './ckeditor/ckeditor.component';
...

@NgModule( {
    declarations: [
        ...
        CkeditorComponent
    ],
    imports: [
        ...
        CKEditorModule,
        ...
    ],
    ...
} )
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.ts

...
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
import { CkeditorComponent } from './ckeditor/ckeditor.component';
...

@NgModule( {
    declarations: [
        ...
        CkeditorComponent
    ],
    imports: [
        ...
        CKEditorModule,
        ...
    ],
    ...
} )
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>

正如我在中回答您的那样,不幸的是,
FontFamily
插件没有出现在
气球编辑器
构建中。因此,您有两种选择:

  • 在下面的包之外使用自定义插件构建一个编辑器,然后将该编辑器移动到angular存储库。其余部分将在中描述
  • 从以下源代码生成编辑器。虽然第一种方法得到了官方的支持,但我不能告诉您从源代码构建将起作用,因为我没有花太多时间调查它及其边缘案例
  • 使用,其中包含
    FontFamily
    插件

  • 感谢您的帮助,我开始基于Balloon创建自己的自定义构建。在这里你可以找到我现在卡住的地方:注意:我添加了一个错误日志目录,在里面你可以找到我得到的错误日志。这是因为导入不正确-
    import Font from'@ckeditor/ckeditor5 Font'应该是
    从'@ckeditor/ckeditor5 Font/src/Font'导入字体我们不公开源程序包中的默认入口点,因为它们可能会以不同的方式使用。我已经将修复提交给了,还成功地从GH安装了自定义版本,并导入到我的Angular 6项目中。非常感谢您的帮助,