Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Reactjs中的Ckeditor 5不';我不能正常工作_Javascript_Reactjs_Ckeditor_Ckeditor5_Ckeditor5 React - Fatal编程技术网

Javascript Reactjs中的Ckeditor 5不';我不能正常工作

Javascript Reactjs中的Ckeditor 5不';我不能正常工作,javascript,reactjs,ckeditor,ckeditor5,ckeditor5-react,Javascript,Reactjs,Ckeditor,Ckeditor5,Ckeditor5 React,我在React项目中使用Ckeditor 4已经很长时间了,我对它没有任何问题。 为了添加一个插件,它提供了添加视频(视频Html5标签),我不得不使用Ckeditor 5而不是Ckeditor 4。所以我根据文档一步一步地构建了一个编辑器via。 这是我的项目中的Ckeditor目录: ckeditor.js(ckeditor 5/src/ckeditor.js)文件是: 我以这种方式使用了编辑器: import React, { useState, FunctionComponent }

我在React项目中使用Ckeditor 4已经很长时间了,我对它没有任何问题。 为了添加一个插件,它提供了添加视频(视频Html5标签),我不得不使用Ckeditor 5而不是Ckeditor 4。所以我根据文档一步一步地构建了一个编辑器via。 这是我的项目中的Ckeditor目录:

ckeditor.js
(ckeditor 5/src/ckeditor.js)文件是:

我以这种方式使用了
编辑器

import React, { useState, FunctionComponent }   from "react";
import Editor                                   from "ckeditor5-custom-build/build/ckeditor";
import CKEditor                                 from "@ckeditor/ckeditor5-react";
export interface CreateNewArticleProps {}

const CreateNewArticle: FunctionComponent<CreateNewArticleProps> = () => {
    const [articleFormData, setArticleFormData] = useState({
        articleBody: "",
    });

    const editorConfiguration = { toolbar: ["bold", "italic"] };
    const ckeditorDataChangeHandler = (event) => {
        setArticleFormData({
            ...articleFormData,
            articleBody: event.editor.getData(),
        });
    };

    return (
        <CKEditor
            editor={Editor}
            config={editorConfiguration}
            data={articleFormData.articleBody}
            onChange={ckeditorDataChangeHandler}
        />
    );
};
export default CreateNewArticle;
import React,{useState,FunctionComponent}来自“React”;
从“ckeditor5自定义生成/生成/ckeditor”导入编辑器;
从“@CKEditor/ckeditor5 react”导入CKEditor;
导出接口CreateNewArticleProps{}
const CreateNewArticle:FunctionComponent=()=>{
常量[articleFormData,setArticleFormData]=useState({
第条主体:“,
});
常量编辑器配置={工具栏:[“粗体”、“斜体”]};
const ckeditorDataChangeHandler=(事件)=>{
setArticleFormData({
…articleFormData,
articleBody:event.editor.getData(),
});
};
返回(
);
};
导出默认CreateNewArticle;
editorConfiguration
常量是CKEditor组件的最简单配置,但没有一个工具栏不工作

我需要
ckeditor.js
(ckeditor 5/src/ckeditor.js)文件中存在的所有工具栏。
请考虑我在使用CKIDITOR5的主要目标是从在文本中添加视频的能力中获益。

< P>更改处理程序如下:

const ckeditorDataChangeHandler = (event, editor) => {
    setArticleFormData({
        ...articleFormData,
        articleBody: editor.getData(),
    });
};

你能说得比“无法正常工作”更具体些吗?@ChrisG Ckeditor添加了,但其工具栏不工作。@ChrisG当我单击任何工具时,控制台中发生了此错误:Ckeditor.js:4 Uncaught TypeError:无法读取Object.ckeditorDataChangeHandler[as onChange](createNewArticle.tsx:193)的未定义属性“getData”在Yg的Yg.eval(ckeditor.js:5)在Yg.fire(ckeditor.js:4)在Fp.的handleChangeBlock(ckeditor.js:4)在Fp.的runPendingChanges(ckeditor.js:4)在TC.的Fp.change(ckeditor.js:4)在TC.的TC.eval(ckeditor.js:4)的执行(ckeditor.js:4)。[as execute](ckeditor.js:4)是否
ckeditor5自定义版本
实际与版本5兼容?@ChrisG,如ckeditor文档中所述,是的。
const ckeditorDataChangeHandler = (event, editor) => {
    setArticleFormData({
        ...articleFormData,
        articleBody: editor.getData(),
    });
};