【问题标题】:How to add a plugin in @ckeditor/ckeditor5-react manually?如何手动在@ckeditor/ckeditor5-react 中添加插件?
【发布时间】:2020-01-30 16:04:43
【问题描述】:

所以,我有一个来自https://www.pramukhime.com/ 的插件,它是语言插件。 所以,他们给了我一个包含各种文件的 zip 文件。

文件截图:

我猜 plugin.js 是要导入的主文件。 (另外,它被缩小了)

所以,我尝试了以下但得到错误

代码:

import CKEditor from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import Pramukhime from "./../../Assets/pramukhime/plugin.js";

...

        <CKEditor
          editor={ClassicEditor}
          data={questionData}
          config={{
            plugins: [Pramukhime]
          }}
          onChange={(event, editor) => {
            const data = editor.getData();

            handleQuestionEditor(data);

          }}

        />

那么,我应该如何在我的编辑器中添加这个插件呢?

谢谢

编辑: 在配置中添加额外插件时出错

config={{extraPlugins:'...'}}

【问题讨论】:

  • 您是否尝试过关注这个? - js.plus/docs/how-to-install-a-plugin-to-ckeditor
  • @KrinaSoni ckeditor5-react 中没有文件夹插件。另外,我认为这些步骤适用于普通的 ckeditor 包,而不是用于反应集成的 ckeditor

标签: reactjs ckeditor ckeditor5-react


【解决方案1】:

您需要将这些文件添加到您的ckeditor/plugins 文件夹中。自述文件会告诉你如何命名封闭文件夹(如果你使用插件不期望的名称,它根本不会被加载)。

之后,您需要以相同的方式添加任何依赖项,因为 CKEditor 无法自动执行此操作。然后,您可以通过在 CKEditor 配置中添加一个或多个 config.extraPlugins = 'plugin-name'; 行来简单地启用插件以及任何依赖项。

来源:https://ckeditor.com/docs/ckeditor4/latest/guide/dev_plugins.html#manual-installation

【讨论】:

  • 我尝试了您的解决方案,但错误得到了安慰。查看问题的编辑
  • 您能否在 pastebin/gist 中分享插件 README 的内容?
【解决方案2】:

问题出在我认为您的插件依赖于另一个依赖项的软件包上,或者可能是版本兼容性的问题。

【讨论】:

    猜你喜欢
    • 2019-07-31
    • 2019-02-28
    • 1970-01-01
    • 1970-01-01
    • 2021-08-09
    • 1970-01-01
    • 2022-10-24
    • 2019-03-27
    • 1970-01-01
    相关资源
    最近更新 更多