CarlosNZ/json-edit-react

Feature Request: custom button node data as props

Jack-skitt opened this issue · 5 comments

Hi,

Is it possible to have the current node data in the props of the custom button component? I.e making a pin button icon change if the current node is pinned, you would need to node the current node the button is on

Yes, the node data is already passed to Custom Nodes (as nodeData). So you can get the location of the current node from nodeData.path.

I suggest you console.log the entire "props" object of your custom node to see all the info available (it's quite a bit, should be enough for most use cases)

Does this apply to custom buttons? not nodes, i have logged the props coming through to the Element and it's empty

#147
Added PR to support this

Oh, sorry, I thought you meant Custom Nodes. Thanks for the PR, I'll check it out later today and make a new release for it.

Closed by #147