Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onCanvasDrop: Support id from data argument #96

Merged
merged 1 commit into from
Apr 26, 2020

Conversation

NoyTse
Copy link
Contributor

@NoyTse NoyTse commented Mar 9, 2020

When using external state and drag&drop, it may be useful to store the new item in DB / Redux when the onCanvasDrop event is fired, but still wrap the chart with component with inner-state, and use the default "action handlers" from the libary to maintain the state.

So, with this patch we can choose the id in

onDragStart={(ev) => { 
    ev.dataTransfer.setData(
        REACT_FLOW_CHART, 
        JSON.stringify({ id: chosenId, ...newNode) }
    ) 
}}

hope you found this helpfully,
Noy

@MrBlenny MrBlenny merged commit 2606490 into MrBlenny:master Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants