draft-js-ace

1.0.1 • Public • Published

draft-js-ace

draft-js-ace is a decorator for DraftJS to highlight code blocks using Ace.

Installation

$ npm install draft-js-ace

Usage

import Draft from 'draft-js'
import AceDecorator from 'draft-js-prism'

const decorator = new AceDecorator({
  mode: 'javascript', // Default is javascript.
  theme: 'monokai', // Default is monokai.
  filter: // Your filter function. Only applies syntax highlight to code-blocks by default.
});

const editorState = Draft.EditorState.createEmpty(decorator)

You'll also need to wrap your Editor Component like this:

<div className='ace-[put theme name here]'>
  <Editor />
</div>

Readme

Keywords

Package Sidebar

Install

npm i draft-js-ace

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

6.64 kB

Total Files

8

Last publish

Collaborators

  • dkjym