ReactJs中的多个CKEditor5(版本不同)-结尾为“ CKEditorError:ckeditor-duplicated-modules”

时间:2019-10-26 08:11:17

标签: reactjs ckeditor5 ckeditor5-react

我创建了一个主要组件和两个子组件来加载两种不同版本的CKeditor5(经典和气球);但它给出了以下错误:

  

CKEditorError:ckeditor-duplicated-modules:一些CKEditor 5模块   重复。阅读更多:   https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-ckeditor-duplicated-modules

第一个组件:

import React from "react";
import CKEditor from "@ckeditor/ckeditor5-react";
import BalloonEditor from "@ckeditor/ckeditor5-build-balloon";

..

return (
<CKEditor
  editor={BalloonEditor}
  //data="<p>Hello from CKEditor 5!</p>" //using placeholder instead
  config={editorConfiguration}
  onInit={editor => {
    // You can store the "editor" and use when it is needed.
    console.log("Editor is ready to use!", editor);
  }}
  onChange={(event, editor) => {
    const data = editor.getData();
    //console.log({ event, editor, data });
  }}
/>);

第二部分:

import React from "react";
import CKEditor from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";

 ..

return (
    <CKEditor
      editor={BalloonEditor}
      //data="<p>Hello from CKEditor 5!</p>" //using placeholder instead
      config={editorConfiguration}
      onInit={editor => {
        // You can store the "editor" and use when it is needed.
        console.log("Editor is ready to use!", editor);
      }}
      onChange={(event, editor) => {
        const data = editor.getData();
        //console.log({ event, editor, data });
      }}
    />);

主要组件:

return (
  <CardFront />
  <CardBack />
)

关于如何克服这一点的任何想法?还是这是一个限制?

1 个答案:

答案 0 :(得分:0)

这可能会有所帮助:

创建“超级版本”

单个构建可以导出多少个编辑器类没有限制。默认情况下,正式版本仅导出单个编辑器类。但是,它们可以轻松导入更多内容。

您可以从分叉(或复制)现有版本开始,如“创建自定义版本”指南中所述。假设您分叉并克隆了ckeditor5存储库,并想将InlineEditor添加到经典版本中:

https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/advanced-setup.html#scenario-3-using-two-different-editors