Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alexkuz/draft-js-plugins

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alexkuz/draft-js-plugins

A Plugin Architecture on top of Draft.JS

  • 0.0.0
  • temp
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

DraftJS Plugins

Draft JS Plugins Logo

High quality plugins with great UX on to of DraftJS.

Available Plugins

  • Stickers
  • Hashtags
  • Linkify
  • Mentions

Build Status

Live Example

Checkout the website!

Usage

First, install the editor with npm:

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

and then import it 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.

PropsDescriptionRequired
editorStatesee here*
onChangesee here*
pluginsan array of plugins
all other props accepted by the DraftJS Editorsee 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}
        spellCheck
        readOnly={ this.state.readOnly }
        ref="editor"
      />
    );
  }
}
createEditorStateWithText

Function to creates an EditorState with some text.

Usage:

import { createEditorStateWithText } from 'draft-js-plugins-editor';

const editorState = createEditorStateWithText('Hello World!', plugins);

Plugins

  • draft-js-sticker-plugin
  • draft-js-hastag-plugin
  • draft-js-linkify-plugin
How to write a Plugin

Feel free to copy any of the existing plugins as a starting point. Feel free to directly contact @nikgraf in case you need help or open a Github Issue!

More documentation is coming soon…

Development

npm install
cd site
npm install
npm start

Discussion and Support

Join the channel #plugin-editor after signing into the DraftJS Slack organization!

License

MIT

Keywords

FAQs

Package last updated on 22 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc