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

Embed block refactor and tidy #10958

Merged
merged 10 commits into from
Nov 1, 2018
6 changes: 3 additions & 3 deletions packages/block-library/src/embed/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import classnames from 'classnames/dedupe';
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { __, _x, sprintf } from '@wordpress/i18n';
import { Fragment } from '@wordpress/element';
import {
Button,
Expand Down Expand Up @@ -103,7 +103,7 @@ export const EmbedControls = ( props ) => {
<InspectorControls>
<PanelBody title={ __( 'Media Settings' ) } className="blocks-responsive">
<ToggleControl
label={ __( 'Automatically scale content' ) }
label={ __( 'Resize for smaller devices' ) }
checked={ allowResponsive }
help={ getResponsiveHelp }
onChange={ toggleResponsive }
Expand All @@ -130,7 +130,7 @@ export const EmbedEditUrl = ( props ) => {
<Button
isLarge
type="submit">
{ __( 'Embed' ) }
{ _x( 'Embed', 'button label' ) }
</Button>
{ cannotEmbed && <p className="components-placeholder__error">{ __( 'Sorry, we could not embed that content.' ) }</p> }
</form>
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/embed/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export function getEmbedEditComponent( title, icon, responsive = true ) {
previewDocument.body.innerHTML = html;
const iframe = previewDocument.body.querySelector( 'iframe' );

if ( ! isFromWordPress( html ) && iframe && iframe.height && iframe.width ) {
// If we have a fixed aspect iframe, and it's a responsive embed block.
if ( responsive && iframe && iframe.height && iframe.width ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the ! isFromWordPress( html ) was lost in the merge, not sure if that's an issue or if it has been replace by the responsive variable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced by the responsive flag :)

const aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );
// Given the actual aspect ratio, find the widest ratio to support it.
for ( let ratioIndex = 0; ratioIndex < ASPECT_RATIOS.length; ratioIndex++ ) {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.