-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 bug with pasting into rich text blocks #32527
Conversation
Size Change: +2 B (0%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This resolves the issue for me, thanks for looking into it Glen! I could replicate the issue on trunk
in an existing paragraph, if I emptied out the content to the paragraph before pasting in the content. With this change applied, there was no error. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
I could replicate the issue both via deleting paragraph contents prior to pasting and psating the same content twice in succession.
After applying this patch, it works as expected and I no longer receive errors in console.
The failing e2e test looks unrelated and might just need to be re-run.
@ellatrix I did have a bit of a look to try and work out why |
@ellatrix I did some more debugging on this and according to a quick git bisect it looks like the issue was introduced in https://github.com/WordPress/gutenberg/pull/31752/files - I have run out of time to work out how exactly, but will take a closer tomorrow if you don't have time to look at it. |
Thanks! Yeah tracking down why it isn't defined would be best. Otherwise we can do this for now if it's an important bug to fix for the WP release. |
got stuck on a production issue today so didn't make any progress on this. |
@ellatrix It seems that the issue is that previously Passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to fix like this for now. Let's look what is setting the active formats to undefined separately.
It'd be good to backport this to edit: I mean WordPress 5.8! |
Cherry-picked into release/10.9 |
Add optional chaining to prevent exception if activeFormats not defined.
Fixes #32526
Description
Currently when pasting into a rich text block like paragraph multiple times an exception is thrown and the text does not appear in the editor
Testing
Screenshots
Before:
After: