CK编辑器5自定义构建on Change无法正常工作

发布于 2025-01-24 10:07:27 字数 1072 浏览 4 评论 0原文

我正在使用CK Editor 5在线构建工具来构建CK编辑器5的自定义构建。成功将其添加为React项目的依赖性。

包括提及插件和其他默认插件,

import Editor from "ckeditor5-custom-build/build/ckeditor";

<CKEditor
disabled={props.readOnly}
editor={Editor}
data={props.value ? props.value : ""}
config={{

      readOnly: props.readOnly,
      mention: {
        feeds: [
          {
            marker: "@",
            feed: getPersonByName,
            minimumCharacters: 1,
          },
        ],
      },
      toolbar: [],
    }}
  
    onChange={(_event: any, editor: { getData: () => any }) => {
      const data = editor.getData();
      handleChange(editor);
    }}
    onBlur={(_event: any, _editor: any) => {}}
    onFocus={(_event: any, _editor: any) => {}}
  />

如预期的那样提及插件工作。但是编辑Onchange事件没有启动。因此,我无法获得编辑器值。

ckeditor.js:5

   CKEditorError: editor-isreadonly-has-no-setter

I am using ck editor 5 online build tool to build a custom build of CK Editor 5. Successfully added it as a dependency of react project.

Included Mention plugin and other default plugins

import Editor from "ckeditor5-custom-build/build/ckeditor";

<CKEditor
disabled={props.readOnly}
editor={Editor}
data={props.value ? props.value : ""}
config={{

      readOnly: props.readOnly,
      mention: {
        feeds: [
          {
            marker: "@",
            feed: getPersonByName,
            minimumCharacters: 1,
          },
        ],
      },
      toolbar: [],
    }}
  
    onChange={(_event: any, editor: { getData: () => any }) => {
      const data = editor.getData();
      handleChange(editor);
    }}
    onBlur={(_event: any, _editor: any) => {}}
    onFocus={(_event: any, _editor: any) => {}}
  />

mention plugin work as expected. but editors onChange event not firing.so I could not get the editor value.
enter image description here

ckeditor.js:5

   CKEditorError: editor-isreadonly-has-no-setter

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

宫墨修音 2025-01-31 10:07:27

将React版本更新为最新版本(18.0.0)将解决问题

Updating the React version to the latest version (18.0.0) would be fixed the issue

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文