import React, { ReactElement, useRef, useState } from 'react'; import { EditorState } from 'draft-js'; import Editor from '@draft-js-plugins/editor'; import createUndoPlugin from '@draft-js-plugins/undo'; import editorStyles from './editorStyles.css'; const undoPlugin = createUndoPlugin(); const { UndoButton, RedoButton } = undoPlugin; const plugins = [undoPlugin]; const SimpleUndoEditor = (): ReactElement => { const [editorState, setEditorState] = useState(EditorState.createEmpty()); const editor = useRef(); const onChange = (value): void => { setEditorState(value); }; const focus = (): void => { editor.current.focus(); }; return (