reactjsjodit

Cannot read property 'fire' of undefined in Jodit


I have an error after adding jodit to projet. Please help me, this is my first time using jodit.

enter image description here

And here my code:

       <JoditEditor
                    value={this.state.data.content}
                    config={{
                        // readonly: false,
                        buttons: [
                            'bold', 'underline', 'italic', '|',
                            'ul', 'ol', '|',
                            'outdent', 'indent', '|',
                            'font', 'fontsize', 'brush', 'paragraph', '|',
                            'align', 'undo', 'redo', '|',
                        ]
                    }}
                    onChange={this.handleEditorChange}
                />
handleEditorChange = (e) => {
    this.setState(prevState => ({
        data: {
            ...prevState.data,
            content: e
        }
    }));
};

Solution

  • Replace jodit.min.js with this https://github.com/rejacopyright/jodit.min.js.

    In node modules, the location is your_projects/node_modules/jodit/build/jodit.min.js.

    Make sure that "main": "build/jodit.min.js" is set in package.json.