diagram-maker
diagram-maker copied to clipboard
Undo/Redo : custom events
Hello,
I've been recently using your cool library and I noticed that when I use the undo/redo feature, it seems that only some events are kept in memory : node creation, edge creation and delete item.
I have custom nodes that have an internal HTML input with a default value. Whenever the user changes the input value a custom event is dispatched. Internally, a custom reducer catches the event then updates the node's consumerData with the new value. Unfortunately, after an undo/redo, the value is back to the default one.
I don't know if this is the intended behavior. I would like to be able to keep the last value set.
Best regards
Apologies for the delay in our response.
It is a good suggestion for enhancement. Would you be willing to submit a PR for this?
This could be achieved by exposing an additional configuration option and hooking the consumer provided logic here: https://github.com/awslabs/diagram-maker/blob/master/src/state/middleware/undoMiddleware.ts#L10-L27
Thanks for your response,
I'm willing to submit a PR but I can't give you a clear estimate right now. Among all the issues I opened, this one would be the first on my "todolist".
Thanks for contributing back.
Let us know if you need additional guidance on how to implement this change.
Sorry, we are not planning to act on this request in any timely manner and will be closing this issue. Thank you.