How to use draft-js-plugin-editor - 1 common examples

To help you get started, we’ve selected a few draft-js-plugin-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github draft-js-plugins / draft-js-plugins / docs / client / components / SuperheroEditor / index.js View on Github external
const hashtagPluginInstance = hashtagPlugin({ Hashtag });
const linkifyPluginInstance = linkifyPlugin({ Link });
const historyPluginInstance = historyPlugin();
const { UndoButton, RedoButton } = historyPluginInstance;
const { StickerSelect } = stickerPluginInstance;

const plugins = [
  hashtagPluginInstance,
  stickerPluginInstance,
  linkifyPluginInstance,
];

export default class UnicornEditor extends Component {

  state = {
    editorState: createWithText('Hello World!', plugins),
    showState: false,
  };

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

  focus = () => {
    this.refs.editor.focus();
  };

  undo = () => {
    this.setState({
      editorState: EditorState.undo(this.state.editorState),

draft-js-plugin-editor

A Plugin Architecture on top of Draft.JS

MIT
Latest version published 8 years ago

Package Health Score

63 / 100
Full package analysis

Popular draft-js-plugin-editor functions