draft-js vs prosemirror-view vs quill vs slate vs tinymce
Rich Text Editors
draft-jsprosemirror-viewquillslatetinymceSimilar Packages:

Rich Text Editors

Rich text editors are tools that allow users to create and edit text with various formatting options, such as bold, italics, lists, and more, directly within a web application. These editors provide a user-friendly interface for text manipulation, similar to word processors, but are designed to be embedded in web pages. They are essential for applications like content management systems, blogs, email clients, and any platform that requires user-generated content with rich formatting. draft-js is a React-based framework for building rich text editors with a focus on immutability and extensibility, while prosemirror-view is part of the ProseMirror toolkit, offering a highly customizable and performant editor view. quill is a modern, open-source WYSIWYG editor with a clean API and modular architecture. slate is a highly customizable framework for building rich text editors, emphasizing flexibility and control over the editing experience. tinymce is a feature-rich, full-fledged WYSIWYG editor with a wide range of plugins and integrations, suitable for enterprise applications.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
draft-js022,873-9546 years agoMIT
prosemirror-view02,036890 kB14a month agoMIT
quill046,9353.04 MB628a year agoBSD-3-Clause
slate031,5842.17 MB6952 months agoMIT
tinymce016,14210.9 MB4352 months agoSEE LICENSE IN license.md

Feature Comparison: draft-js vs prosemirror-view vs quill vs slate vs tinymce

Customization

  • draft-js:

    draft-js provides a high level of customization, especially for React developers. It allows you to create custom blocks, inline styles, and entities, making it ideal for applications that need specialized editing features.

  • prosemirror-view:

    prosemirror-view is highly customizable, allowing developers to define their own schemas, node types, and behaviors. It is particularly well-suited for complex documents and applications that require fine-tuned control over the editing experience.

  • quill:

    quill offers moderate customization with a modular architecture that allows for the addition of custom formats, themes, and modules. It is easy to extend but may not be as flexible as ProseMirror or Slate for highly specialized use cases.

  • slate:

    slate is designed for deep customization, allowing developers to define their own data structures, rendering logic, and editing behaviors. It is one of the most flexible editors available, making it ideal for applications that need unique or non-standard editing features.

  • tinymce:

    tinymce provides extensive customization options through its API and a wide range of plugins. It is easy to configure for most use cases, but deep customization may require more effort compared to frameworks like Slate or ProseMirror.

Performance

  • draft-js:

    draft-js is optimized for React applications and handles large documents efficiently. Its use of immutable data structures helps minimize unnecessary re-renders, making it performant for most use cases.

  • prosemirror-view:

    prosemirror-view is designed for high performance, especially with large and complex documents. Its architecture allows for efficient rendering and updates, making it suitable for applications that require real-time collaboration and frequent changes.

  • quill:

    quill is lightweight and performs well for typical rich text editing tasks. However, it may not be as efficient as ProseMirror for very large documents or applications that require complex editing features.

  • slate:

    slate performance depends on the complexity of the editor and the implementation. While it is generally efficient, highly customized editors may require optimization to maintain smooth performance, especially with large documents.

  • tinymce:

    tinymce is a mature editor with good performance for most use cases. It is optimized for handling large documents and complex content, but the inclusion of many plugins can impact load times and responsiveness.

Collaboration

  • draft-js:

    draft-js does not provide built-in collaboration features, but it can be integrated with third-party libraries and services to enable real-time editing. Its immutable data model makes it easier to implement collaborative features.

  • prosemirror-view:

    prosemirror-view is designed with collaboration in mind and supports real-time collaborative editing out of the box. It provides a robust framework for building collaborative applications, including conflict resolution and synchronization.

  • quill:

    quill does not have native collaboration features, but it can be integrated with third-party services like ShareDB to enable real-time editing. Its modular architecture makes it relatively easy to add collaborative functionality.

  • slate:

    slate does not include built-in collaboration features, but its flexible architecture allows developers to implement real-time editing using external libraries. Collaboration can be added, but it requires custom development.

  • tinymce:

    tinymce does not offer native real-time collaboration, but it can be integrated with third-party tools to enable collaborative editing. It is primarily designed as a standalone editor, but its API allows for extensions.

Ease of Use: Code Examples

  • draft-js:

    draft-js is designed for React developers and integrates seamlessly with React applications. However, it has a steeper learning curve compared to simpler editors, especially for those unfamiliar with its concepts of immutability and controlled components. Example: Basic Draft.js Editor

    import React, { useState } from 'react';
    import { Editor, EditorState } from 'draft-js';
    import 'draft-js/dist/Draft.css';
    
    function MyEditor() {
      const [editorState, setEditorState] = useState(EditorState.createEmpty());
    
      return (
        <div style={{ border: '1px solid #ccc', padding: '10px', borderRadius: '4px' }}>
          <Editor editorState={editorState} onChange={setEditorState} />
        </div>
      );
    }
    
    export default MyEditor;
    
  • prosemirror-view:

    prosemirror-view is highly customizable but requires a good understanding of its architecture and concepts. It is more complex to set up compared to other editors, but it offers powerful features for those willing to invest the time. Example: Basic ProseMirror Editor

    import { EditorState } from 'prosemirror-state';
    import { EditorView } from 'prosemirror-view';
    import { Schema, DOMParser } from 'prosemirror-model';
    import { schema } from 'prosemirror-schema-basic';
    
    const state = EditorState.create({
      schema,
      doc: DOMParser.fromSchema(schema).parse(document.querySelector('#content'))
    });
    
    const view = new EditorView(document.querySelector('#editor'), {
      state
    });
    
  • quill:

    quill is user-friendly and easy to integrate, with a clean API and good documentation. It is suitable for developers of all skill levels and provides a quick way to add rich text editing to applications. Example: Basic Quill Editor

    <div id="editor"></div>
    <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
    <script>
      const quill = new Quill('#editor', {
        theme: 'snow'
      });
    </script>
    
  • slate:

    slate offers great flexibility but has a steep learning curve, especially for those new to its concepts. It requires a good understanding of React and its architecture to fully leverage its capabilities. Example: Basic Slate Editor

    import React, { useState } from 'react';
    import { Slate, Editable, withReact } from 'slate-react';
    import { createEditor } from 'slate';
    
    function MyEditor() {
      const [editor] = useState(() => withReact(createEditor()));
      const [value, setValue] = useState([
        { type: 'paragraph', children: [{ text: 'Hello, Slate!' }] }
      ]);
    
      return (
        <Slate editor={editor} value={value} onChange={newValue => setValue(newValue)}>
          <Editable />
        </Slate>
      );
    }
    
    export default MyEditor;
    
  • tinymce:

    tinymce is easy to use and integrates well with various platforms. Its WYSIWYG interface is familiar to users, making it a good choice for applications that need a ready-to-use editor with minimal setup. Example: Basic TinyMCE Editor

    <textarea id="mytextarea">Hello, TinyMCE!</textarea>
    <script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
    <script>
      tinymce.init({
        selector: '#mytextarea'
      });
    </script>
    

How to Choose: draft-js vs prosemirror-view vs quill vs slate vs tinymce

  • draft-js:

    Choose draft-js if you are building a React application and need a highly customizable editor with a focus on immutability and controlled components. It is ideal for projects that require fine-grained control over the editor state and content.

  • prosemirror-view:

    Choose prosemirror-view if you need a highly customizable and performant editor with a strong emphasis on collaborative editing and complex document structures. It is suitable for applications that require advanced features and are willing to invest time in configuration.

  • quill:

    Choose quill if you need a lightweight, easy-to-use editor with a clean API and good default styling. It is ideal for projects that need a quick setup with basic to moderate rich text features.

  • slate:

    Choose slate if you need a highly flexible and extensible editor that allows for deep customization of the editing experience. It is perfect for applications that require unique behaviors, custom nodes, and a high degree of control over the editor’s functionality.

  • tinymce:

    Choose tinymce if you need a full-featured, enterprise-ready editor with a wide range of built-in features and plugins. It is suitable for applications that require a robust solution with minimal configuration and extensive support.

README for draft-js

draftjs-logo

Draft.js

Build Status npm version

Live Demo


Draft.js is a JavaScript rich text editor framework, built for React and backed by an immutable model.

  • Extensible and Customizable: We provide the building blocks to enable the creation of a broad variety of rich text composition experiences, from basic text styles to embedded media.
  • Declarative Rich Text: Draft.js fits seamlessly into React applications, abstracting away the details of rendering, selection, and input behavior with a familiar declarative API.
  • Immutable Editor State: The Draft.js model is built with immutable-js, offering an API with functional state updates and aggressively leveraging data persistence for scalable memory usage.

Learn how to use Draft.js in your own project.

API Notice

Before getting started, please be aware that we recently changed the API of Entity storage in Draft. The latest version, v0.10.0, supports both the old and new API. Following that up will be v0.11.0 which will remove the old API. If you are interested in helping out, or tracking the progress, please follow issue 839.

Getting Started

npm install --save draft-js react react-dom

or

yarn add draft-js react react-dom

Draft.js depends on React and React DOM which must also be installed.

Using Draft.js

import React from 'react';
import ReactDOM from 'react-dom';
import {Editor, EditorState} from 'draft-js';

class MyEditor extends React.Component {
  constructor(props) {
    super(props);
    this.state = {editorState: EditorState.createEmpty()};
    this.onChange = (editorState) => this.setState({editorState});
    this.setEditor = (editor) => {
      this.editor = editor;
    };
    this.focusEditor = () => {
      if (this.editor) {
        this.editor.focus();
      }
    };
  }

  componentDidMount() {
    this.focusEditor();
  }

  render() {
    return (
      <div style={styles.editor} onClick={this.focusEditor}>
        <Editor
          ref={this.setEditor}
          editorState={this.state.editorState}
          onChange={this.onChange}
        />
      </div>
    );
  }
}

const styles = {
  editor: {
    border: '1px solid gray',
    minHeight: '6em'
  }
};

ReactDOM.render(
  <MyEditor />,
  document.getElementById('container')
);

Since the release of React 16.8, you can use Hooks as a way to work with EditorState without using a class.

import React from 'react';
import ReactDOM from 'react-dom';
import {Editor, EditorState} from 'draft-js';

function MyEditor() {
  const [editorState, setEditorState] = React.useState(
    EditorState.createEmpty()
  );

  const editor = React.useRef(null);

  function focusEditor() {
    editor.current.focus();
  }

  React.useEffect(() => {
    focusEditor()
  }, []);

  return (
    <div onClick={focusEditor}>
      <Editor
        ref={editor}
        editorState={editorState}
        onChange={editorState => setEditorState(editorState)}
      />
    </div>
  );
}

Note that the editor itself is only as tall as its contents. In order to give users a visual cue, we recommend setting a border and a minimum height via the .DraftEditor-root CSS selector, or using a wrapper div like in the above example.

Because Draft.js supports unicode, you must have the following meta tag in the <head> </head> block of your HTML file:

<meta charset="utf-8" />

Further examples of how Draft.js can be used are provided below.

Examples

Visit http://draftjs.org/ to try out a basic rich editor example.

The repository includes a variety of different editor examples to demonstrate some of the features offered by the framework.

To run the examples, first build Draft.js locally. The Draft.js build is tested with Yarn v1 only. If you're using any other package manager and something doesn't work, try using yarn v1:

git clone https://github.com/facebook/draft-js.git
cd draft-js
yarn install
yarn run build

then open the example HTML files in your browser.

Draft.js is used in production on Facebook, including status and comment inputs, Notes, and messenger.com.

Browser Support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Chrome for Android
Chrome for Android
IE11, Edge [1, 2]last 2 versionslast 2 versionslast 2 versionsnot fully supported [3]not fully supported [3]

[1] May need a shim or a polyfill for some syntax used in Draft.js (docs).

[2] IME inputs have known issues in these browsers, especially Korean (docs).

[3] There are known issues with mobile browsers, especially on Android (docs).

Resources and Ecosystem

Check out this curated list of articles and open-sourced projects/utilities: Awesome Draft-JS.

Discussion and Support

Join our Slack team!

Contribute

We actively welcome pull requests. Learn how to contribute.

License

Draft.js is MIT licensed.

Examples provided in this repository and in the documentation are separately licensed.