Name: draft-js-plugins
Owner: draft-js-plugins
Description: React Plugin Architecture for Draft.js including Slack-Like Emojis, FB-Like Mentions and Stickers
Created: 2016-02-26 09:54:56.0
Updated: 2018-01-18 23:36:41.0
Pushed: 2018-01-14 12:36:55.0
Homepage: https://www.draft-js-plugins.com/
Size: 7064
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
High quality plugins with great UX on top of DraftJS.
Checkout the website!
First, install the editor with npm
:
m install draft-js-plugins-editor --save
Then import the editor somewhere in your code and you're ready to go!
rt Editor from 'draft-js-plugins-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:
rt React, { Component } from 'react';
rt Editor from 'draft-js-plugins-editor';
rt createHashtagPlugin from 'draft-js-hashtag-plugin';
rt createLinkifyPlugin from 'draft-js-linkify-plugin';
rt { EditorState } from 'draft-js';
t hashtagPlugin = createHashtagPlugin();
t linkifyPlugin = createLinkifyPlugin();
t plugins = [
shtagPlugin,
nkifyPlugin,
rt default class UnicornEditor extends Component {
ate = {
editorState: EditorState.createEmpty(),
Change = (editorState) => {
this.setState({
editorState,
});
nder() {
return (
<Editor
editorState={this.state.editorState}
onChange={this.onChange}
plugins={plugins}
/>
);
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!
Join the channel #draft-js-plugins after signing into the DraftJS Slack organization or check out our collection of frequently asked questions here: FAQ.
Check out our Contribution Guide.
In this talk Nik Graf explained the ContentState structure of a Draft.js Editor as well as explained how to use plugins.
This project was initiated by Nik Graf and is maintained by Julian Krispel. Julian is a draft.js consultant and available for hire, you can get in touch with him on his website, react rocket
MIT