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

Fixed PortableTextEditor pasting not working in firefox #6855

Closed

Conversation

mariusGundersen
Copy link

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

@mariusGundersen mariusGundersen requested a review from a team as a code owner June 5, 2024 11:21
@mariusGundersen mariusGundersen requested review from hermanwikner and removed request for a team June 5, 2024 11:21
Copy link

vercel bot commented Jun 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2024 10:07pm
performance-studio ✅ Ready (Inspect) Visit Preview Jun 20, 2024 10:07pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jun 20, 2024 10:07pm

Copy link

vercel bot commented Jun 5, 2024

@mariusGundersen is attempting to deploy a commit to the Sanity Team on Vercel.

A member of the Team first needs to authorize it.

@christianhg
Copy link
Contributor

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.

@christianhg
Copy link
Contributor

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

@mariusGundersen
Copy link
Author

Good to hear. Do you have any timeline for when this will be released?

@christianhg
Copy link
Contributor

Good to hear. Do you have any timeline for when this will be released?

I hope #7001 gets merged this week which means that next week's release of the Studio would include this bugfix. I think you could subscribe to #7001 to get a feel for the progress of things.

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.

Cannot Paste Into Block Content in Mozilla
3 participants