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

Feat: Fix drag and drop issues for custom nodes #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KC-Miles
Copy link

This PR addresses the nodeSize error that occurs during drag and drop operations for custom nodes in GutenTap. The changes provide a more robust handling of drag and drop events, including fallback mechanisms for when the standard operation fails.

Changes:

Modified the endDragging method in the GutenTap component:

  • Added a try-catch block around the nw function call.
  • Implemented a fallback mechanism for moving nodes when an error occurs.
  • Added handling for cases where nodeSize might be undefined.

Updated the startDragging method to ensure draggedNodePosition is always set.

Testing:

  • Tested drag and drop operations with various custom nodes.
  • Verified that the nodeSize error no longer occurs.
  • Ensured that the fallback mechanism works correctly when the standard drag and drop operation fails.

Notes:

This change may slightly impact the performance of drag and drop operations due to the added try-catch block. However, the impact should be minimal and is outweighed by the improved reliability.

@johnpuddephatt
Copy link
Owner

Hey @KC-Miles, thanks for this!

  1. Are you seeing drag/drop errors on the demo at https://gutentap.letsdance.agency/ ? I ask because I thought drop/drop was working after some changes I made in response to Dragging issues? #3 . It wouldn't surprise me if there are still some issues because it was very temperamental for a long time, I would just like to be able to recreate the issue(s).

  2. You've made changes to /lib/guten-tap.js. Changes need to be made within the /src/ folder and then built and then pushed. Otherwise whenever the build process is run the changes in /lib/ would be lost (also the changes you have made are currently not present in both /lib/guten-tap.js and /lib/guten-tap.umd.cjs whereas if they are made in /src/ and the build process is run then they will be present in both). If you need help with this just give me a shout – you should just be able to run npm install and then npm run build

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.

2 participants