1.0.1 • Published 5 years ago

draft-js-ace v1.0.1

Weekly downloads
10
License
MIT
Repository
-
Last release
5 years ago

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>