Delete node on user action only
We have integrated this library in our project, all the functionalities working fine. but we are facing issue while deleting node based on user action. Currently, user can delete node via Backspace and Delete button, but, it causes issue in our requirement so, we want to give button to delete node and for that, we referred your Selected-sidebar demo but, this demo has same issue.
Can you please help us to solve this problem?
Thank You.
The culprit is line 183 here. It's missing a null-check.
https://github.com/MrBlenny/react-flow-chart/blob/master/src/container/actions.ts
if (config.readonly) {
return chart
}
Should be something like
if(config && config.readonly)
onDeleteKey takes an argument of the type IConfig. Which is not passed in the story you mentioned. Easiest workaround for you, while this is fixed, would be to just do this:
const config = { readonly: false }
...
<Button onClick={() => stateActions.onDeleteKey({config})}>Delete</Button>