-
Hi plate community, Loving the plugin! I need to access the history for more efficient backend transactions (and to integrate history actions with multiple editors on a page). However, I don't have an editor object n my current implementation of plate. Is there any way to access the history object (the stack, along with undo and redo methods) in the editor component (and ideally float them up to parent components?) Thanks!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I figured it out : |
Beta Was this translation helpful? Give feedback.
Unfortunately, Slate cannot currently be used as a controlled component, so you'll have to code imperatively if you want to control it from the outside. There are various patterns you can use to do this, which have been discussed in serveral different Discussions (although I can't remember which ones).
My advice would be to use a reducer in your top-level component and pass down a dispatch function using context that Plate editors can use to register and deregister themselves on mount/unmount.