draft-js-custom-markdown-shortcuts-plugin
v0.6.2
Published
A DraftJS plugin for supporting Markdown syntax shortcuts
Downloads
4
Maintainers
Readme
draft-js-markdown-shortcuts-plugin
A DraftJS plugin for supporting Markdown syntax shortcuts
This plugin works with DraftJS Plugins wrapper component.
Usage
npm i --save draft-js-markdown-shortcuts-plugin
then import from your editor component
import createMarkdownShortcutsPlugin from 'draft-js-markdown-shortcuts-plugin';
Example
import React, { Component } from 'react';
import Editor from 'draft-js-plugins-editor';
import createMarkdownShortcutsPlugin from 'draft-js-markdown-shortcuts-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].
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]