Fix Template Part placeholder preview#21623
Conversation
|
Size Change: -19 B (0%) Total Size: 845 kB
ℹ️ View Unchanged
|
|
Everything seems to work on this branch, however when I rebased master locally I find that the insertion stops working. That is, the match is found, the preview is shown, but when you press 'Choose' it inserts a blank instead. I am having problems finding the culprit for this regression in behavior. 😞 |
|
I can't seem to repro the fix on this branch, even if I don't rebase on FWIW, I'm using |
Gotcha. I was doing this with custom template parts. So I create one with a slug and theme name, save it, then try to insert it elsewhere. We do need to figure out a way to include the themes template parts in this request as well. 🤔 |
Ah right, I keep forgetting about the endpoint exposing only the template parts CPTs, whereas the template switcher only shows the ones that come with the theme. (I've been bitten before by this issue tho 😅 ) |
|
It may make sense to close this in favor of #21766 - but I will leave it open for now just since this is in a state where inserting the template part works, while there is some unidentified regression on master that currently will cause it to insert a blank instead. |
|
Ok, we can still use this PR to fix the style issue with the preview. #21766 Fixes a handful of the other issues. So lets test this branch to ensure the preview is no longer cut off at the bottom. |
There was a problem hiding this comment.
Nice, that one merged. I rebased this =)
fdd2e94 to
326df36
Compare
vindl
left a comment
There was a problem hiding this comment.
LGTM! ![]()
Since this is used in other areas like block preview, I smoke tested that and couldn't notice any visual regressions.

Description
Fixes the preview for and allows custom template parts to appropriately be found by the Template Part placeholder block.
Before this, no match would be found and the placeholder would promt to create a new one.
Also, if a template were found, the preview is cut off at the bottom:

This PR will fix that to properly show the entire template part:

Code changes:
positionstyle from the BlockPreview content wrapper, this was causing the preview to be cut off at the bottom (Or in the case of small template parts, not show up at all).Testing Instructions
How has this been tested?
Tested on local environment in post and site editors.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: