Search code examples
javascriptreactjsckeditorecmascript-6

How can CKEditor be used with React.js in a way that allows React to recognize it?


I've tried using componentWillMount and componentDidMount to initialize CKEditor from within the context of React, but it doesn't seem to work no matter what combination I try. Has anyone found a solution to this besides switching editors?


Solution

  • I published a package on Npm for using CKEditor with React. It takes just 1 line of code to integrate in your project.

    Github link - https://github.com/codeslayer1/react-ckeditor.

    How to Use?

    • Install the package using npm install react-ckeditor-component --save.
    • Then include the component in your React app and pass it your content and any other props that you need(all props listed on Github page) -

    <CKEditor activeClass="editor" content={this.state.content} onChange={this.updateContent} />

    The package uses the default build of CKEditor but you can use a custom build as well along with any of the plugins you like. It also includes a sample application. Hope you will find it useful.