nomcopter / react-mosaic

A React tiling window manager

Home Page:https://nomcopter.github.io/react-mosaic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get node that was just removed?

t3db0t opened this issue · comments

What's the best way to get a node that was just removed (by closing a window)? Right now I'm going to have to manually get a diff from the new layout provided by onChange...

Pass custom toolbarControls to MosaicWindow. You can pass <RemoveButton /> the onClick prop to do what you want.

Sure—however, that would mean two independent callbacks that are hard to collate. I get the onChange with a new layout but with no explicit info about how the layout changed, and then I get the onClick with the info I need.

Thinking out loud, the ideal would be an operational model where onChange returns operations that are performed. Easy for me to say!! If I make that modification I'll send you a PR ;)

Outside of that—is there any other way to force some info into the onChange call?

Not currently, but a second meta arg to onChange would make sense 👍