How to Make WYSIWYG Rich Text Editor Using React & Draft.js

In this article, you will learn how to make WYSIWYG rich text editor using React and Draft.js. The source code of this React WYSIWYG editor is given below.

At the end of this article, I have provided links to view the Live Demo and Download the full source code from GitHub.

Project Screenshot

Here’s a screenshot of how our WYSIWYG Editor Using React and Draft.js will look.

WYSIWYG Editor Using React and Draft.js
WYSIWYG Editor Using React and Draft.js

Features

  • Configurable toolbar with option to add/remove controls.
  • Option to change the order of the controls in the toolbar.
  • Option to add custom controls to the toolbar.
  • Option to change styles and icons in the toolbar.
  • Option to show toolbar only when editor is focused.
  • Support for inline styles: Bold, Italic, Underline, StrikeThrough, Code, Subscript, Superscript.
  • Support for block types: Paragraph, H1 – H6, Blockquote, Code.
  • Support for setting font-size and font-family.
  • Support for ordered / unordered lists and indenting.
  • Support for text-alignment.
  • Support for coloring text or background.
  • Support for adding / editing links
  • Choice of more than 150 emojis.
  • Support for mentions.
  • Support for hashtags.
  • Support for adding / uploading images.
  • Support for aligning images, setting height, width.
  • Support for Embedded links, flexibility to set height and width.
  • Option provided to remove added styling.
  • Option of undo and redo.
  • Configurable behavior for RTL and Spellcheck.
  • Support for placeholder.
  • Support for WAI-ARIA Support attributes
  • Using editor as controlled or un-controlled React component.
  • Support to convert Editor Content to HTML, JSON, Markdown.
  • Support to convert the HTML generated by the editor back to editor content.
  • Support for internationalization.

Source Code of React WYSIWYG Editor Using Draft.js

package.json

JSON

index.js

JavaScript

styles.css

CSS

Live Demo and Download

Live DemoDownload

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.