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

fix: properly calculate setDragImage position #2768

Merged
merged 2 commits into from
May 11, 2022
Merged

Conversation

dilizarov
Copy link
Contributor

NodeView's onDragStart assumes the event is a DragEvent.

In React, the event is usually a SyntheticBaseEvent, which doesn't have offsetX/offsetY properties.

To get the offsetX/offsetY properties, have to use event.nativeEvent, which is the DragEvent.

Without this fix, x and y become NaN in React.

@netlify
Copy link

netlify bot commented May 9, 2022

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 2ec3950
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/627aa6420c96870008310bd4
😎 Deploy Preview https://deploy-preview-2768--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@dilizarov
Copy link
Contributor Author

I chose to do (event as any) over properly typing event: DragEvent | SyntheticBaseEvent because this is the core package and I didn't want to introduce dependencies on React types into it.

Copy link
Contributor

@bdbch bdbch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, thank you! Could you resolve the linting issues please?

@dilizarov
Copy link
Contributor Author

Let me know if you need anything else from me.

@bdbch
Copy link
Contributor

bdbch commented May 11, 2022

Great! Thanks

@bdbch bdbch merged commit e17c414 into ueberdosis:main May 11, 2022
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