-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Embed Block: Refactor setting panel to use ToolsPanel #69636
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
Embed Block: Refactor setting panel to use ToolsPanel #69636
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Hi |
I copied this from the editor after placing the example code in my post. On trunk, without the PR:
With the PR applied:
I don't think these duplicated class names are correct? |
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.
Thanks for the PR!
What do you think about the approach of making toggleResponsive
a function? If we do that, we won't need to add new props to the EmbedControls
component.
I think it would look something like this:
function toggleResponsive( newAllowResponsive ) {
const { className } = attributes;
const { html } = preview;
setAttributes( {
allowResponsive: newAllowResponsive,
className: getClassNames(
html,
className,
responsive && newAllowResponsive
),
} );
}
aa4f9b8
to
7b2d957
Compare
Thanks for the review.
The duplicate class names seem to be a separate issue. |
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.
LGTM! Finally, could you merge the trunk
branch into this PR or rebase this PR with the trunk
branch?
I don't think these duplicated class names are correct?
This issue can be reproduced on trunk by following the steps below:
- Insert an Embed block.
- Embed a YouTube URL (Example: https://www.youtube.com/watch?v=Ok6JKHMAkH8)
- Class names:
block-editor-block-list__block
wp-block
is-selected
wp-embed-aspect-16-9
wp-has-aspect-ratio
wp-block-embed
is-type-video
is-provider-youtube
wp-block-embed-youtube
,
- Disable the "Resize for smaller devices" setting.
- Class names:
block-editor-block-list__block
wp-block
is-selected
wp-block-embed
is-type-video
is-provider-youtube
wp-block-embed-youtube
- Enable the "Resize for smaller devices" setting again.
- Class names:
block-editor-block-list__block
wp-block
is-selected
wp-embed-aspect-16-9
wp-has-aspect-ratio
wp-block-embed
wp-embed-aspect-16-9
wp-has-aspect-ratio
is-type-video
is-provider-youtube
,- `wp-block-embed-youtube
This issue only occurs in the editor and is not caused by this PR.
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
3bebe8c
to
5565ca3
Compare
Thanks for the review! |
* Embed Block: Refactor setting panel to use ToolsPanel * fix toggleResponsive * fix onDeselect * Update packages/block-library/src/embed/embed-controls.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> * Update packages/block-library/src/embed/embed-controls.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> * Update packages/block-library/src/embed/embed-controls.js Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> --------- Co-authored-by: shimotmk <shimotomoki@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org>
What?
Part of #67813
Make the settings panel more consistent with other blocks
Testing Instructions
Screenshots or screencast
before
before.mp4
after
after.mp4