draft-js-md-keyboard-plugin

0.6.3 • Public • Published

draft-js-md-keyboard-plugin

A DraftJS plugin for supporting Markdown syntax shortcuts

This plugin works with DraftJS Plugins wrapper component.

screen

View Demo

Usage

npm i --save draft-js-md-keyboard-plugin

then import from your editor component

import createMarkdownShortcutsPlugin from 'draft-js-md-keyboard-plugin';

Example

import React, { Component } from 'react';
import Editor from 'draft-js-plugins-editor';
import createMarkdownShortcutsPlugin from 'draft-js-md-keyboard-plugin';
import { EditorState } from 'draft-js';
 
const plugins = [
  createMarkdownShortcutsPlugin()
];
 
export default class DemoEditor extends Component {
 
  state = {
    editorState: EditorState.createEmpty(),
  };
 
  onChange = (editorState) => {
    this.setState({
      editorState,
    });
  };
 
  render() {
    return (
      <Editor
        editorState={this.state.editorState}
        onChange={this.onChange}
        plugins={plugins}
      />
    );
  }
}

License

MIT. See LICENSE

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Dependents (3)

Package Sidebar

Install

npm i draft-js-md-keyboard-plugin

Weekly Downloads

7

Version

0.6.3

License

MIT

Unpacked Size

36 kB

Total Files

24

Last publish

Collaborators

  • elbakerino