Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React integration #1015

Closed
szymonkups opened this issue May 8, 2018 · 7 comments
Closed

React integration #1015

szymonkups opened this issue May 8, 2018 · 7 comments
Assignees
Labels
type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone

Comments

@szymonkups
Copy link
Contributor

Part of: #1002.
We should provide at least two ways to integrate with React

  • when using builds,
  • building together with the React project.

Using buids

When someone will like to use ready-to-use builds without building CKEditor together with the project. It should be simple as installing dependencies:

npm i ckeditor5-react ckeditor5-build-classic

And then using CKEditor integration inside React application:

import ClassicEditor from 'ckeditor5-build-classic';
import CKEditor from 'ckeditor5-react';

<CKEditor 
  editor={ ClassicEditor } 
  config={ { ... } } 
  data="<p>This is CKEditor instance.</p>"
/>

Building together with React project

We should also provide a way to integrate editor's building process with react appliction. Integrator should be able to install CKEditor 5 plugins into the project:

npm i ckeditor5-react ckeditor5-editor-classic ckeditor5-essentials

and create custom build:

import ClassicEditor from 'ckeditor5-editor-classic';
import Essentials from 'ckeditor5-essentials';
import CKEditor from 'ckeditor5-react';

<CKEditor 
  editor={ ClassicEditor } 
  config={ { plugins: [ Essentials ] } }
  data="<p>This is CKEditor instance.</p>"
>

We shuld provide a guide how to achieve this when using ReactCLI as the starting point. Custom webpack configuration for React and CKEditor 5 would be cool too.

How do we expose editor API?

Getting data

We should allow to set a callback that will be fired each time editor contents changed:

<CKEditor onChange={ data => console.log( data )  } />

Other

What else should be exposed? Or maybe we should provide some way to access underlying editor instance for more advanced integration scenarios?

@szymonkups szymonkups self-assigned this May 8, 2018
@Reinmar Reinmar added type:feature This issue reports a feature request (an idea for a new functionality or a missing option). status:confirmed labels May 14, 2018
@Reinmar Reinmar added this to the next milestone May 14, 2018
@lsy9108
Copy link

lsy9108 commented May 25, 2018

npm i --save ckeditor5-react
npm ERR! code E404
npm ERR! 404 Not Found: ckeditor5-react@latest

@Reinmar
Copy link
Member

Reinmar commented May 25, 2018

Hi! It's not yet published. You can find the early version of this package in https://github.com/ckeditor/ckeditor5-react. And you can follow the progress there.

@pomek pomek assigned pomek and unassigned szymonkups Jul 26, 2018
@pomek
Copy link
Member

pomek commented Jul 26, 2018

The first version has just been published.

Now using npm install @ckeditor/ckeditor5-react will install the package in version 1.0.0-beta.1.

The feedback is welcomed.

@pomek
Copy link
Member

pomek commented Jul 26, 2018

In case of problems, please report an issue here - https://github.com/ckeditor/ckeditor5-react

@pomek pomek closed this as completed Jul 26, 2018
@Reinmar Reinmar modified the milestones: next, iteration 20 Jul 26, 2018
@SKGGitHub
Copy link

Hello Team, We had shortlisted CKeditor5 to be used in one of new project as an Rich text editor.

While trying to integrate it in our React application using similar code mentioned in "Building together with React Project", we are facing different issues in different implementations:

  1. <CKEditor editor={ ClassicEditor } config={ { plugins: [ Essentials ] } }
    data="

    This is CKEditor instance.

    ">

Specifying above code give error of "Cannot read getAttribute on null object"

  1. Specifying above code without config attribute, throws no error but editor doesn't shows up. But empty div is rendered without any editor, toolbar or content.

Any help is highly appreciated.

@pomek
Copy link
Member

pomek commented Aug 2, 2018

Could you report an issue in here – https://github.com/ckeditor/ckeditor5-react/issues?

I will appreciate an instruction step by step that you've done. Would be good if it allows reproducing the issue.

@pomek
Copy link
Member

pomek commented Aug 2, 2018

PS: The error: "Cannot read getAttribute on null object" means that your webpack configuration misses a proper loader.

The same issue we had here – ckeditor/ckeditor5-react#21 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

No branches or pull requests

5 participants