-
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
Post Editor: Update postContentBlock check to see if the block is valid #48386
Post Editor: Update postContentBlock check to see if the block is valid #48386
Conversation
Size Change: +10 B (0%) Total Size: 1.33 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.
Thanks for fixing this! Tested with the steps from #48355 and this fix works for that issue. I think we should get this into 6.2 ✅
@Mamaduka @ntsekouras just for visibility, it'd be great to get this fix into the next 6.2 beta release if we can, as it resolves one of the issues folks testing the release have flagged about wide/full alignments not showing up in the post editor. |
This is quite a regression, definitely a high priority bug for 6.2, and let's make sure to ship a quick plugin release to address it as well. |
I just cherry-picked this PR to the wp/6.2 branch to get it included in the next release: d44b065 |
I have cherry-picked this PR to the release/15.2 branch to get it into the 15.2.2 minor release. |
What?
Fixes: #48355
In the post editor's visual editor component, the post content block for the current template is fetched. There is a conditional that checks whether or not the post content block was found, however the fallback state of
postContentBlock
is an empty object, which means it's always truthy. If we update this topostContentBlock?.isValid
which only exists when the value is a real parsed block, then this should fix up the failure state.Why?
When logged in as a non-admin user that cannot edit templates (e.g. an Author role) then the edited template cannot be retrieved. In this state, we should use the fallback layout which allows for constrained layout and full/wide controls, however this wasn't happening.
How?
isValid
so that an empty object doesn't accidentally return trueTesting Instructions
Screenshots or screencast