Rich text editor based on draftjs and monaco.
APACHE-2.0 License
saged is the editor used on blog.sagacious.dev site. It embeds draftjs and monaco right out of the box.
npm install --save saged
Using the defaults
import React from 'react'
import Editor from 'saged'
function Editor() {
return <Editor />
}
Configuring the editor
import React from 'react'
import Editor from 'saged'
import Classes from './package.module.css'
function Editor() {
return (
<Editor
content={localStorage.getItem('saged-example-item-eerTy443')}
storageKey="some-random-key"
className={Classes.editorOverride}
readonly
/>
)
}
boolean
): Specify if the editor should open in a read only mode. If opened in readonly mode then it will act as a previewer.string
): Content to be displayed by the text editor. This is supposed to follow the draftjs content schema and hence is not meant to be handled manually.string
): Saged stores the content in the local storage. This key is used to store the data in local storage. Defaults to "article".string
): Override the default style of the editor container using this class name. Note that not all the styles can be overidden.(content: string) => void
): Optional function which will be invoked when editor state changesApache 2.0 © utkarsh-pro