-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
strip whitespaces in render_block_core_cover #40859
Merged
adamziel
merged 10 commits into
WordPress:trunk
from
navigatrum:edit-cover-block-featured-image
Jun 27, 2022
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
09739d8
strip whitespaces in render_block_core_cover
navigatrum 849197a
amend regex
navigatrum 9be451c
Cover-block: edit regex to insert the featured img
navigatrum ee8fe32
edit cover block regex for featured image #4
navigatrum 2981dd7
Add quotes around the regexp
adamziel e374216
close bracket ad reformat comment
navigatrum 7d65028
retry to fix
navigatrum 98424c7
Update packages/block-library/src/cover/index.php
adamziel 7cd71a2
Update packages/block-library/src/cover/index.php
adamziel 4a4aa98
Merge branch 'trunk' into edit-cover-block-featured-image
adamziel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Why does the featured image have to be inserted there? Who decided that and for what purpose? Could you please comment to make sure we're on the same page (I'm probably missing some considerations there).
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.
Probably you didn't read the first line of comment to this PR.
It says:
Fell free to take a look at the history of that file: the who and their purpose cannot be really hidden. My 2¢? A henchman of his. 😄
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.
@azaozz I decided that for not having a better way - as Gutenberg is missing a token system - to make the cover block get the featured image at render time.
If you look at the history of PRs in which I tried to solve the featured image in cover block problem you'll see there are a few constraints that arise from our lack of a token system which results in this kind of render string operations on the block markup.
It is not the only block where these operations occur and I think it also happens (e.g.
gutenberg_restore_group_inner_container
,render_block_core_image
,render_block_core_post_featured_image
,render_block_core_template_part
,render_block_core_site_logo
).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.
Right, my bad, should have explained this better. Was thinking that the way this works may have been simpler if the featured image was appended to the end of the block's HTML. The difference in the featured image's node position would have probably been pretty easy to account for with a little of CSS. Even maybe that could have been preferred in some cases as would have made it possible to determine when an image was inserted there.