draft-js-plugins

React Plugin Architecture for Draft.js including Slack-Like Emojis, FB-Like Mentions and Stickers

Github星跟蹤圖

DraftJS Plugins

Draft JS Plugins Logo

High quality plugins with great UX on top of DraftJS.

Build Status

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

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 = [
  linkifyPlugin,
  hashtagPlugin,
];

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.

Maintainers

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

License

MIT

主要指標

概覽
名稱與所有者draft-js-plugins/draft-js-plugins
主編程語言TypeScript
編程語言JavaScript (語言數: 5)
平台
許可證MIT License
所有者活动
創建於2016-02-26 09:54:56
推送於2025-06-09 07:57:38
最后一次提交2025-06-09 07:49:11
發布數210
最新版本名稱@draft-js-plugins/mention@5.3.0 (發布於 2024-03-04 18:35:17)
第一版名稱@draft-js-plugins/alignment@4.0.0-beta2 (發布於 2020-11-17 19:32:15)
用户参与
星數4.1k
關注者數51
派生數1.1k
提交數3.9k
已啟用問題?
問題數1043
打開的問題數1
拉請求數1971
打開的拉請求數11
關閉的拉請求數588
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?