CKEditor5 react组件-添加插件问题

CKEditor5 react component - add plugins problems

在将 CKEditor5 组件添加到我的 React 应用程序时,我发现我需要添加更多插件 - 我已经完成了,为每个文档添加和重建编辑器,特别是添加:

import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
import Font from '@ckeditor/ckeditor5-font/src/font';
import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';

和重建。第一期:

我在几个地方看到过这个:

Array.from( editor.ui.componentFactory.names() );

应该给我一个工具栏项目的列表,这样我就可以验证我是否有我需要的东西。我更新为使用我正在使用的编辑器的名称,所以:

Array.from( ClassicEditor.ui.componentFactory.names() );

哪个失败了,因为 ClassicEditor 中没有 "ui"...我在这里缺少什么?

其次 - 现在我已经安装了插件并重建 ckeditor.js,我正在尝试确保将这些新内容添加到我现有的 React 项目中 - 有一个 public/ckeditor 目录在那里。我假设我应该从 "ckeditor5-build-classic/build/" 目录中取出 ckeditor.js,并将其放入 public/ckeditor。但是我从哪里得到真正的插件呢? ckeditor5-build-classic/node_modules/@ckeditor 中似乎有一套,但这似乎不起作用。想法?

I have seen a few places where this:

Array.from( editor.ui.componentFactory.names() ); should give me a list of the toolbar items so I can verify that I have what I need.

I updated to use the name of the editor that I am using, so:

Array.from( ClassicEditor.ui.componentFactory.names() );

ClassicEditor 是一个 class,不是实例。

你必须这样做:

ClassicEditor.create( el, config ).then( editor => {
    console.log( Array.from( editor.ui.componentFactory.names() ) );
} );

获取所有可用的工具栏按钮。

Second - now that I have installed plugins, and rebuild ckeditor.js, I'm trying to make sure that I add this new stuff to my existing React project - there is a public/ckeditor directory in there. I assumed that I should take the ckeditor.js from the "ckeditor5-build-classic/build/" directory, and put it into public/ckeditor. But where do I get the actual plugins? there seems to be a set in ckeditor5-build-classic/node_modules/@ckeditor, but that didn't seem to work. Thought

当您在 React 组件之外构建编辑器时,您需要的所有插件都应捆绑到构建中,因此您只需将构建的编辑器复制到 React 项目即可。它被描述为 here