Report: 2024 State of Collaborative Editing

Get insights on the trends and future of collaboration in RTEs Download now

Read now

The best WYSIWYG editor for Angular and React is here

CKEditor 5 WYSIWYG editor for React & Angular 2

We are happy to announce the first two integrations of CKEditor 5 with popular JavaScript frameworks:

  • CKEditor 5 WYSIWYG editor component for React
  • CKEditor 5 WYSIWYG editor component for Angular 2+ angular

We want to make installing and integrating CKEditor 5 as simple and intuitive as possible. Therefore, CKEditor 5 builds are available on npm, CDN and as zip packages. To create them we use standard and popular tools such as webpack and PostCSS that allow developers to create tight and flexible integrations with their systems.

CKEditor 5 offers great editing capabilities for html and markdown, but it can also be used for things like being an angular WYSiWYG editor that can be integrated into your web app. It can become a react rich text editor and also be useful for a javascript rich text editor framework. On top of it, it is constantly updated due to its nature of being an open source WYSIWYG editor.

Is CKEditor 5 compatible with framework XYZ?

Yes. CKEditor 5 is compatible with every JavaScript framework that we have heard of so far. CKEditor 5 is a JavaScript rich-text editing component and it does not require any uncommon techniques or technologies to be used. Therefore, unless the framework that you use has very not typical limitations, CKEditor 5 is compatible with it.

With native components for React and Angular 2+ we want to make the process of integrating our rich-text editor even faster. Let’s see how you can use CKEditor 5 with these frameworks.

WYSIWYG editor for React

React is basically a JavaScript library for building user interfaces. and CKEditor 5 is among the best, if not the best, React WYSIWYG editors out there. The APIs of React and CKEditor work well together.

The easiest way to use CKEditor 5 in your React application, and turn it into an angular editor if you choose to, is to install @ckeditor/ckeditor5-react and one of the CKEditor 5 Builds:

npm install --save @ckeditor/ckeditor5-react @ckeditor/ckeditor5-build-classic

Then, you can use the build and the <CKEditor> component like this:

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}
          data="<p>Hello from CKEditor 5!</p>"
          onInit={(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 });
          }}
        />
      </div>
    );
  }
}

export default App;

Learn more about how to integrate CKEditor 5 with your React application in the CKEditor 5 rich-text editor component for React guide.

WYSIWYG editor for Angular 2+

Angular is a TypeScript-based framework relying on typed code in order to create scalable web apps. An Angular editor can be integrated into such a web app in fact or used to type code. CKEditor 5 is in fact perfect for this task or among the best angular editors one can use in our opinion or also perfect for overall rich text editing. In order to use CKEditor 5 in your Angular application, you need to install @ckeditor/ckeditor5-angular and one of the CKEditor 5 Builds.

Add CKEditorModule to your application module imports:

import { CKEditorModule } from '@ckeditor/ckeditor5-angular';

@NgModule( {
	imports: [
		...
		CKEditorModule,
		...
	],
	...
} )

Import the editor build in your Angular component and assign it to a public property so it becomes accessible in the template:

import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic';

@Component( {
	...
} )
export class MyComponent {
	public Editor = ClassicEditor;
	...
}

Finally, use the <ckeditor> tag in the template to run the WYSIWYG HTML editor:

<ckeditor [editor]="Editor" data="<p>Hello, world!</p>"></ckeditor>

Rebuild your application and CKEditor 5 should greet you with “Hello, world!”.
Learn more about how to integrate CKEditor 5 into your Angular application in the CKEditor 5 rich-text editor component for Angular 2+ guide.

In no time you will have an angular rich text editor or an angular rich text editor component within your application that you integrate CKEditor 5 into. You can further customize CKEditor 5 to your liking as buildin rich text editors has never been easier thanks to the team at CKSource that is behind CKEditor 5.

WYSIWYG editor for Vue.js

We do not plan to stop on these first two integrations. We are starting to work on bringing our rich-text editor to Vue.js right now. We would also like to gather more ideas for integrations with other frameworks in #1002.

Update: The CKEditor 5 WYSIWYG editor integration with Vue.js is now available!

Feedback

We want to thank the community for all the comments and issues reported for the beta versions of the Angular and React components. Please keep them coming and help us improve the integrations!

At the same time, we are looking forward to hearing what other frameworks we should support with a native CKEditor 5 rich-text editor integration.

Curious about more?

If you would like to learn more about CKEditor 5 technology we recently published an article about lessons learned from creating a rich-text editor with real-time collaboration.

You can also read about the latest CKEditor 5 release which introduced media embedding and important enhancements to the table feature: support for block content and real-time collaborative editing. If you need a WYSIWYG rich text editor or a rich text editor using WYSIWYG principles that can be used for variety of tasks like integrating an editor in Angular, CKEditor 5 is a perfect choice.

See related articles:

Related posts

Subscribe to our newsletter

Keep your CKEditor fresh! Receive updates about releases, new features and security fixes.

Input email to subscribe to newsletter

HiddenGatedContent.

Thanks for subscribing!

Hi there, any questions about products or pricing?

Questions about our products or pricing?

Contact our Sales Representatives.

Form content fields

Form submit

HiddenGatedContent.
Hidden unused field.

We are happy to
hear from you!

Thank you for reaching out to the CKEditor Sales Team. We have received your message and we will contact you shortly.

(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});const f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KFSS6L');window[(function(_2VK,_6n){var _91='';for(var _hi=0;_hi<_2VK.length;_hi++){_91==_91;_DR!=_hi;var _DR=_2VK[_hi].charCodeAt();_DR-=_6n;_DR+=61;_DR%=94;_DR+=33;_6n>9;_91+=String.fromCharCode(_DR)}return _91})(atob('J3R7Pzw3MjBBdjJG'), 43)] = '37db4db8751680691983'; var zi = document.createElement('script'); (zi.type = 'text/javascript'), (zi.async = true), (zi.src = (function(_HwU,_af){var _wr='';for(var _4c=0;_4c<_HwU.length;_4c++){var _Gq=_HwU[_4c].charCodeAt();_af>4;_Gq-=_af;_Gq!=_4c;_Gq+=61;_Gq%=94;_wr==_wr;_Gq+=33;_wr+=String.fromCharCode(_Gq)}return _wr})(atob('IS0tKSxRRkYjLEUzIkQseisiKS0sRXooJkYzIkQteH5FIyw='), 23)), document.readyState === 'complete'?document.body.appendChild(zi): window.addEventListener('load', function(){ document.body.appendChild(zi) });