draft-js-markdown-code-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

draft-js-markdown-code-plugin

A DraftJS plugin for supporting Markdown syntax shortcuts.

This plugin works with DraftJS Plugins wrapper component.

This is a fork of ngs/draft-js-markdown-shortcuts-plugin, which hasn't merged PRs in a while.

This fork includes:

  • Dependency updates
  • Typescript support
  • Resolved deprecation warnings

TODO:

  • [ ] Port tests
  • [ ] Add custom components to render links and images

Install

yarn add draft-js-markdown-code-plugin

Usage

import Editor from '@draft-js-plugins/editor';
import createMarkdownCodePlugin from 'draft-js-markdown-code-plugin';

const [editorState, setEditorState] = useState(
  () => EditorState.createWithContent(ContentState.createFromText(''))
);
const plugins = [createMarkdownCodePlugin()];

export default function Example() {
  return (
    <Editor
      editorState={editorState}
      onChange={setEditorState}
      placeholder="Write something here..."
      plugins={plugins}
    />
  )
}

License

MIT © davidmh

/draft-js-markdown-code-plugin/

    Package Sidebar

    Install

    npm i draft-js-markdown-code-plugin

    Weekly Downloads

    2

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    6.54 MB

    Total Files

    34

    Last publish

    Collaborators

    • davidmh