简体   繁体   English

ckeditor5 中的 ckfinder 反应 js 不工作

[英]ckfinder in ckeditor5 react js not working

i use ckeditor react component by copy code from ckeditor site and when add 'ckfinder' to toolbars it return error below:我通过从 ckeditor 站点复制代码使用 ckeditor React 组件,当将“ckfinder”添加到工具栏时,它返回以下错误:

Uncaught TypeError: Cannot read property 'modal' of undefined未捕获的类型错误:无法读取未定义的属性“模态”

here my code:这是我的代码:

import React, { Component } from 'react';
import { CKEditor } from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';

class App extends Component {
    render() {
        return (
            <div className="App">
                <h2>Using CKEditor 5 build in React</h2>
                <CKEditor
                    editor={ ClassicEditor }
                    config={ {
                        toolbar: [ 'bold', 'italic' , 'ckfinder' ]
                    } }
                    data="<p>Hello from CKEditor 5!</p>"
                    onReady={ 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 } );
                    } }
                    onBlur={ ( event, editor ) => {
                        console.log( 'Blur.', editor );
                    } }
                    onFocus={ ( event, editor ) => {
                        console.log( 'Focus.', editor );
                    } }
                />
            </div>
        );
    }
}

export default App;

From the code that you have posted, not much can be stated.从您发布的代码中,不能说明太多。 However, based on different threads it seems like the problem comes from outdated packages.但是,基于不同的线程,问题似乎来自过时的包。

Here are some steps you can follow and see if it fixes the problem.以下是您可以遵循的一些步骤,看看它是否能解决问题。

  1. npm install --save @ckeditor/ckeditor5-react @ckeditor/ckeditor5-build-decoupled-document ( if you have it installed remove it and install it again) npm install --save @ckeditor/ckeditor5-react @ckeditor/ckeditor5-build-decoupled-document(如果安装了它,请将其删除并重新安装)
  2. Paste your code to the component.将您的代码粘贴到组件中。
  3. Add src="https://ckeditor.com/apps/ckfinder/3.4.5/ckfinder.js" to your page or in the root file - wrap it script tags!将 src="https://ckeditor.com/apps/ckfinder/3.4.5/ckfinder.js" 添加到您的页面或根文件中 - 将其包装在脚本标签中!
  4. npm start npm 开始

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM