-
Notifications
You must be signed in to change notification settings - Fork 416
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
Fixed PortableTextEditor pasting not working in firefox #6855
Fixed PortableTextEditor pasting not working in firefox #6855
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
@mariusGundersen is attempting to deploy a commit to the Sanity Team on Vercel. A member of the Team first needs to authorize it. |
First, I want to say thank you so much for this, @mariusGundersen. Second, I'm in the process of moving the Portable Text Editor to a new repo, https://github.com/portabletext/editor so I'll close this PR for now. You are welcome to open it again against the new repo, but I also think, I've managed to narrow down the problem a bit further. So I might want to take an alternate approach at solving the problem. We'll see! Again, thanks a lot for this! It's important that we are on top of issues like this so the fact that you are bringing it to our attention and even proposing a fix is more than we can ask for. |
Apologies, I thought I had another take on the problem, but ended up implementing your fix: portabletext/editor#28 |
Good to hear. Do you have any timeline for when this will be released? |
Description
Pasting in the PortableTextEditor does not work in Firefox because it waits for a promise, after which the clipboardData is empty. The promise isn't needed since the returned value is undefined. This fix checks if the returned value is undefined before wrapping it in a promise, which makes pasting work again.
What to review
I don't know if there are any places where onPaste is set to do anything, if there is then this needs to be tested. I assume that anywhere onPaste is used and where it does something asyncronous pasting won't work in Firefox and maybe not in Chrome either, even before this change.
Testing
Testing should be straight forward: try pasting something in the PortableTextEditor
Notes for release
Fixed pasting into portable text editor in Firefox
This fixes #6715