React based rich text editor for chemical formula
npm install formula-editor
import React, { useState } from 'react';
import FormulaEditor from 'formula-editor';
const FormulaEditorDemo = () => {
const [editorValue, changeEditorValue] = useState('');
return (
<FormulaEditor
editorValue = {editorValue}
onChange = {event => changeEditorValue(event.target.value)}
placeholder = {'Start typing...'}
/>
);
};| prop | type | description |
|---|---|---|
| editorValue | string | Content of the editor |
| placeholder | string | placeholder |
| onChange | func | called whenever innerHTML changes |
| onFocus | func | called whenever editor input gets focus |
| onBlur | func | called whenever editor input looses focus |