Replies: 1 comment 1 reply
-
I was looking for this too. This is what worked for me:
import { withHistory } from 'slate-history';
const [editor] = useState(() => withReact(withHistory(createEditor())));
const initialValue = [
{
type: 'paragraph',
children: [{ text: 'A line of text in a paragraph.' }],
},
];
return (
<>
<button onClick={editor.undo}>Undo</button>
<button onClick={editor.redo}>Redo</button>
<Slate editor={editor} value={initialValue}>
<Editable />
</Slate>
</>
); That should work! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How would I implement undo/redo buttons on the toolbar in, for example, the Rich Text Editor demo?
I've searched everywhere but there doesn't seem to be any documentation on how to implement slate-history as a button.
Beta Was this translation helpful? Give feedback.
All reactions