johnpuddephatt / gutentap

Tiptap Vue block editor
http://gutentap.letsdance.agency/
MIT License
124 stars 15 forks source link

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

Open KC-Miles opened 2 weeks ago

KC-Miles commented 2 weeks ago

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:

Updated the startDragging method to ensure draggedNodePosition is always set.

Testing:

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 commented 2 weeks ago

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 #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