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
|
tellthemachines
left a comment
There was a problem hiding this comment.
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
postContentBlockis an empty object, which means it's always truthy. If we update this topostContentBlock?.isValidwhich 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?
isValidso that an empty object doesn't accidentally return trueTesting Instructions
Screenshots or screencast