ng2-ckeditor - 如何自定义编辑器本身加载的 css?

ng2-ckeditor - how to customise the css loaded inside the editor itself?

我需要自定义 ng2-ckeditor 的 ENTER 键行为。我知道有一个配置选项,如 here.

所述

但是正如 link 所解释的那样,我应该使用自定义 css:

If you want to change it to control paragraph spacing, you should use stylesheets instead. Edit the contents.css file and set up a suitable margin value for <p> elements, for example:

p { margin: 0; }

根据 ,我可以使用配置选项加载自定义 CSS 文件,如下所示:

config.contentsCss = 'mystyles.css'

我尝试将单个文件添加到我的项目并在 angular 2 组件中设置配置,但该文件似乎没有加载。

  private setConfig(): void {
    this.ckConfig = {
      height: '250',
      extraPlugins: 'divarea',
      contentsCss: '/theme/styles/ckeditor.css',
      toolbar: [... toolbar configurations ...]
    };
  }

那么我怎样才能让 ng2-ckeditor 加载这个文件呢?

如果您激活了 DIVAREA 插件

,这将中断

编辑(来自评论):

这是因为使用 DIVAREA 时不会加载 contentsCss。这是有道理的,因为 CSS 需要限定在 DIV 内部(使用 iFrame 很容易)。

也许新的 CSS 图层可以帮助解决这个问题? github.com/ckeditor/ckeditor4/issues/4640 github.com/ckeditor/ckeditor4/issues/4642