Skip to content
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

Block embed: use dedicated attribute to save the embed ratio instead of using custom classes (#39616) #60895

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

petitphp
Copy link
Contributor

@petitphp petitphp commented Apr 19, 2024

What?

This PR change the way custom CSS classes for the aspect ratio are managed for the block embed.

Why?

When a block embed is transformed to a paragraph, the custom CSS classes for the aspect ratio were not removed.

How?

This is an alternative approach of #44947. This PR go a step further by adding a new attribute to store the aspect ratio and dynamically add the aspect ratio CSS classes to the block.

Testing Instructions

  1. Open a post
  2. Paste an embeddable link (eg. https://www.youtube.com/watch?v=S1Z9OHXME7E)
  3. The field "Additional CSS Classes" in the "Advanced" panel should be empty
  4. Publish the post
  5. Go to the frontend
  6. Inspect the block, the class attribute should contain the classes wp-embed-aspect-16-9 wp-has-aspect-ratio
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: petitphp <petitphp@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@fabiankaegy fabiankaegy added [Type] Enhancement A suggestion for improvement. [Block] Embed Affects the Embed Block labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Embed Affects the Embed Block [Type] Enhancement A suggestion for improvement.
2 participants