diagram-maker icon indicating copy to clipboard operation
diagram-maker copied to clipboard

Undo/Redo : custom events

Open JohnCyberWick opened this issue 3 years ago • 3 comments

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

JohnCyberWick avatar May 21 '21 13:05 JohnCyberWick

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

sameergoyal avatar Jun 10 '21 08:06 sameergoyal

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".

JohnCyberWick avatar Jun 15 '21 13:06 JohnCyberWick

Thanks for contributing back.

Let us know if you need additional guidance on how to implement this change.

sameergoyal avatar Jun 16 '21 08:06 sameergoyal

Sorry, we are not planning to act on this request in any timely manner and will be closing this issue. Thank you.

tracy-french avatar Aug 25 '22 21:08 tracy-french