簡體   English   中英

ReactJs 中的多個 CKEditor5(不同版本) - 以“CKEditorError:ckeditor-duplicated-modules”結尾

[英]Multiple CKEditor5 (of different build) in ReactJs - Ending in 'CKEditorError: ckeditor-duplicated-modules'

我創建了一個主組件和兩個子組件來加載 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 />
)

關於如何克服這個問題的任何想法? 或者這是一個限制?

這可能會有所幫助:

創建“超級構建”

單個構建可以導出多少個編輯器類沒有限制。 默認情況下,官方構建只導出單個編輯器 class。 但是,他們可以輕松導入更多內容。

您可以從“創建自定義構建”指南中的分叉(或復制)現有構建開始。 假設您分叉並克隆了 ckeditor5 存儲庫,並希望將 InlineEditor 添加到經典版本:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM