React Plugin Architecture for DraftJS including Slack-Like Emojis, FB-Like Mentions and Stickers
JavaScript CSS Shell
Pull request Compare This branch is 1 commit ahead, 22 commits behind draft-js-plugins:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
draft-js-alignment-plugin
draft-js-buttons
draft-js-counter-plugin
draft-js-drag-n-drop-plugin
draft-js-drag-n-drop-upload-plugin
draft-js-emoji-plugin
draft-js-focus-plugin
draft-js-hashtag-plugin
draft-js-image-plugin
draft-js-inline-toolbar-plugin
draft-js-linkify-plugin
draft-js-mention-plugin
draft-js-plugins-editor
draft-js-resizeable-plugin
draft-js-side-toolbar-plugin
draft-js-sticker-plugin
draft-js-undo-plugin
draft-js-video-plugin
interfaces
legacy
scripts
.babelrc
.editorconfig
.eslintignore
.eslintrc
.flowconfig
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
FAQ.md
HOW_TO_CREATE_A_PLUGIN.md
LICENSE
README.md
package.json
testHelper.js
yarn.lock

README.md

DraftJS Plugins

Draft JS Plugins Logo

High quality plugins with great UX on top of DraftJS.

Build Status

Important Note

We are currently preparing for a 2.0 release. The master branch contains these features. All the packages are already published with a beta tag. Install it via $ npm install <plugin>@2.0.0-beta9 --save.

Roadmap

In case you are interested in helping Issue #329 contains a roadmap of what's coming in 2.0 and beyond.

Available Plugins (incl. Docs)

Built by the community

Live Example & Documentation

Checkout the website!

Usage

First, install the editor with npm:

$ npm install draft-js-plugins-editor --save

To try out the beta version of 2.0.0 run

$ npm install draft-js-plugins-editor@2.0.0-beta9 --save

Then import the editor somewhere in your code and you're ready to go!

import Editor from 'draft-js-plugins-editor';

Documentation

draft-js-plugins-editor

Editor

An editor component accepting plugins. see source

Props Description Required
editorState see here *
onChange see here *
plugins an array of plugins
decorators an array of custom decorators
defaultKeyBindings bool
defaultBlockRenderMap bool
all other props accepted by the DraftJS Editor except decorator see here

Usage:

import React, { Component } from 'react';
import Editor from 'draft-js-plugins-editor';
import createHashtagPlugin from 'draft-js-hashtag-plugin';
import createLinkifyPlugin from 'draft-js-linkify-plugin';
import { EditorState } from 'draft-js';

const hashtagPlugin = createHashtagPlugin();
const linkifyPlugin = createLinkifyPlugin();

const plugins = [
  hashtagPlugin,
  linkifyPlugin,
];

export default class UnicornEditor extends Component {

  state = {
    editorState: EditorState.createEmpty(),
  };

  onChange = (editorState) => {
    this.setState({
      editorState,
    });
  };

  render() {
    return (
      <Editor
        editorState={this.state.editorState}
        onChange={this.onChange}
        plugins={plugins}
      />
    );
  }
}

How to write a Plugin

Feel free to copy any of the existing plugins as a starting point.In this repository you can also find a Guide on how to create a plugin, including a description of the supported features. In addition you can contact @nikgraf directly in case you need help or simply open a Github Issue!

Discussion and Support

Join the channel #draft-js-plugins after signing into the DraftJS Slack organization or check out our collection of frequently asked questions here: FAQ.

Development

Check out our Contribution Guide.

Learn about why Draft.js and how to use DraftJS Plugins

In this talk Nik Graf explained the ContentState structure of a Draft.js Editor as well as explained how to use plugins.

License

MIT