-
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
Repair and refine embed block styles #14648
Closed
m-e-h
wants to merge
3
commits into
WordPress:master
from
m-e-h:fix/embed-block-styles-repair-refine
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,71 @@ | ||
// Apply max-width to floated items that have no intrinsic width | ||
.block-editor-block-list__block[data-type="core/embed"][data-align="left"] .block-editor-block-list__block-edit, | ||
.block-editor-block-list__block[data-type="core/embed"][data-align="right"] .block-editor-block-list__block-edit, | ||
.wp-block-embed.alignleft, | ||
.wp-block-embed.alignright { | ||
// Instagram widgets have a min-width of 326px, so go a bit beyond that. | ||
max-width: 360px; | ||
width: 100%; | ||
} | ||
|
||
.wp-block-embed { | ||
// The embed block is in a `figure` element, and many themes zero this out. | ||
// This rule explicitly sets it, to ensure at least some bottom-margin in the flow. | ||
margin-bottom: 1em; | ||
|
||
// don't allow iframe to overflow it's container. | ||
iframe { | ||
max-width: 100%; | ||
} | ||
|
||
// Apply max-width to floated items that have no intrinsic width. | ||
&.alignleft, | ||
&.alignright { | ||
// Instagram widgets have a min-width of 326px, so go a bit beyond that. | ||
max-width: 360px; | ||
width: 100%; | ||
} | ||
} | ||
|
||
.wp-embed-responsive { | ||
.wp-block-embed { | ||
// Add responsiveness to common aspect ratios. | ||
&.wp-embed-aspect-21-9 .wp-block-embed__wrapper, | ||
&.wp-embed-aspect-18-9 .wp-block-embed__wrapper, | ||
&.wp-embed-aspect-16-9 .wp-block-embed__wrapper, | ||
&.wp-embed-aspect-4-3 .wp-block-embed__wrapper, | ||
&.wp-embed-aspect-1-1 .wp-block-embed__wrapper, | ||
&.wp-embed-aspect-9-16 .wp-block-embed__wrapper, | ||
&.wp-embed-aspect-1-2 .wp-block-embed__wrapper { | ||
position: relative; | ||
.wp-block-embed__wrapper { | ||
position: relative; | ||
} | ||
|
||
&::before { | ||
content: ""; | ||
display: block; | ||
padding-top: 50%; // Default to 2:1 aspect ratio. | ||
} | ||
// Add responsiveness to embeds with aspect ratios. | ||
.wp-embed-responsive .wp-has-aspect-ratio { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To save some bytes, switched to |
||
.wp-block-embed__wrapper::before { | ||
content: ""; | ||
display: block; | ||
padding-top: 50%; // Default to 2:1 aspect ratio. | ||
} | ||
|
||
iframe { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
} | ||
iframe { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
} | ||
|
||
&.wp-embed-aspect-21-9 .wp-block-embed__wrapper::before { | ||
padding-top: 42.85%; // 9 / 21 * 100 | ||
} | ||
.wp-embed-responsive { | ||
.wp-embed-aspect-21-9 .wp-block-embed__wrapper::before { | ||
padding-top: 42.85%; // 9 / 21 * 100 | ||
} | ||
|
||
&.wp-embed-aspect-18-9 .wp-block-embed__wrapper::before { | ||
padding-top: 50%; // 9 / 18 * 100 | ||
} | ||
.wp-embed-aspect-18-9 .wp-block-embed__wrapper::before { | ||
padding-top: 50%; // 9 / 18 * 100 | ||
} | ||
|
||
&.wp-embed-aspect-16-9 .wp-block-embed__wrapper::before { | ||
padding-top: 56.25%; // 9 / 16 * 100 | ||
} | ||
.wp-embed-aspect-16-9 .wp-block-embed__wrapper::before { | ||
padding-top: 56.25%; // 9 / 16 * 100 | ||
} | ||
|
||
&.wp-embed-aspect-4-3 .wp-block-embed__wrapper::before { | ||
padding-top: 75%; // 3 / 4 * 100 | ||
} | ||
.wp-embed-aspect-4-3 .wp-block-embed__wrapper::before { | ||
padding-top: 75%; // 3 / 4 * 100 | ||
} | ||
|
||
&.wp-embed-aspect-1-1 .wp-block-embed__wrapper::before { | ||
padding-top: 100%; // 1 / 1 * 100 | ||
} | ||
.wp-embed-aspect-1-1 .wp-block-embed__wrapper::before { | ||
padding-top: 100%; // 1 / 1 * 100 | ||
} | ||
|
||
&.wp-embed-aspect-9-6 .wp-block-embed__wrapper::before { | ||
padding-top: 66.66%; // 6 / 9 * 100 | ||
} | ||
.wp-embed-aspect-9-6 .wp-block-embed__wrapper::before { | ||
padding-top: 66.66%; // 6 / 9 * 100 | ||
} | ||
|
||
&.wp-embed-aspect-1-2 .wp-block-embed__wrapper::before { | ||
padding-top: 200%; // 2 / 1 * 100 | ||
} | ||
.wp-embed-aspect-1-2 .wp-block-embed__wrapper::before { | ||
padding-top: 200%; // 2 / 1 * 100 | ||
} | ||
} |
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.
I'm not completely clear on this though. Maybe
core/embed
is correct. I just now saw where thats used for the generic embed? Everything else appears to use something likecore-embed/youtube
.Are the generic embeds the only thing that doesn't have an intrinsic width?