NiclasDev63 / tiptap-extension-global-drag-handle

MIT License
45 stars 6 forks source link

fix case when mouse leaves the handle #14

Open renardeinside opened 1 month ago

renardeinside commented 1 month ago

hey @NiclasDev63 ,

First of all huge thanks to you for your work on this project - this really saved me ton of time!

I've found a small peculiar behaviour which looks a bit inconvenient. i can formulate it like this - when the mouse moves over the handle and leaves it, the handle is still not hidden.

I've introduced this small PR to fix it, but not a frontend expert, so maybe some corner-cases are not covered.

renardeinside commented 1 month ago

A couple of examples:

https://github.com/user-attachments/assets/2e020ade-955d-4a72-8bcc-c6b9623b7ab9

https://github.com/user-attachments/assets/5b5012c4-c834-4959-8e71-7a85d3467ba8

NiclasDev63 commented 3 weeks ago

The problem if we use your solution is that the user has to hover over the drag handle every time before leaving the editor with his mouse to make it disappear. However, the drag handle remains visible even if you move the mouse from a line within the editor directly to a component outside the editor, which is why we should attach the event listener to another component e.g. the editor.

NiclasDev63 commented 3 weeks ago

@renardeinside Just pushed a few changes that should fix your problem. If everything works as expected, I'll publish the new version on npm.