Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes #76101
Allows blocks like Post Title/Content to be selectable when inside Template Parts and when 'Show template' is active.
Why?
From my investigation there were two causes of the bug:
getPostBlocksByNameselector which is used to find blocks like Post Tile, Post Content, Featured Image and make them editable when 'Show template' is active. The memoization of this selector means it doesn't recompute when controlled blocks like template parts update (becausegetBlocksitself doesn't, the function has a note that mentions this.), so this selector often doesn't return the post content blocks that are within template parts.After solving those a third issue was present:
contentOnlymode to template parts and restricts what can be inserted into post content. This doesn't really make sense since the 'Show template' option is still supposed to be a full post/page editor, but with the template shown. A user should have full post/page editing functionality.How?
blockEditingMode: disableon blocks like Post Content, ensure that thedefaultblock editing mode is set instead.getPostBlocksByNameto ensure blocks can be selected.disableContentOnlyForTemplatePartseditor setting that the editor package sets totruewheneverrenderingMode === 'template-locked'.This setting is similar to the one introduced for unsynced patterns in Block Editor: Allow disabling content-only editing for unsynced patterns #75457Testing Instructions