Custom undo/redo possible for block? #13892
Labels
[Feature] History
History, undo, redo, revisions, autosave.
[Type] Help Request
Help with setup, implementation, or "How do I?" questions.
Is there any way of opting-out of the default undo/redo behavior and handling block history explicitly in my block?
I've tried my luck with this:
but it doesn't seem to have any effect on how undo/redo affects my block. Maybe I'm not using it the right way. Could you please provide an example of how a block can handle it's own history?
Why I need this
My block needs to be aware of it's
innerBlocks
block types and performs checks on them to assure it. If something is out of place (a block of another type is inside it) it creates a new block of the correct type and moves the stray block* inside it. You can see how a normal undo/redo operation would be problematic in this context, as the past/future result of an undo/redo operation consists of more than one actions.I think that essentially what I need to do is to define when undo levels are being created for my block. Although, I cannot seem to find a way to prevent automatic in-between undo levels from being created, which would eventually lead to corrupt block state.
*stray block = block of a type that shouldn't be a direct child of the parent block (think of a row - column implementation)
The text was updated successfully, but these errors were encountered: