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: adjust width of iframe and inline toolbar. #721

Merged
merged 1 commit into from
May 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion blocks/library/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Placeholder from 'components/placeholder';
/**
* Internal dependencies
*/
import './style.scss';
import { registerBlock, query } from '../../api';
import Editable from '../../editable';

Expand Down Expand Up @@ -40,7 +41,7 @@ registerBlock( 'core/embed', {
}

return (
<figure>
<figure className="blocks-embed">
<div className="iframe-overlay">
<iframe src={ url } title={ title } />
</div>
Expand All @@ -53,6 +54,7 @@ registerBlock( 'core/embed', {
onFocus={ setFocus }
onChange={ ( value ) => setAttributes( { caption: value } ) }
inline
inlineToolbar
/>
) : null }
</figure>
Expand Down
18 changes: 18 additions & 0 deletions blocks/library/embed/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.blocks-embed {
margin: 0;
}

.blocks-embed .iframe-overlay {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%; /* 16:9 */
Copy link
Member Author

Choose a reason for hiding this comment

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

just a hack to place the video for now

}

.blocks-embed iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
2 changes: 1 addition & 1 deletion post-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ window._wpGutenbergPost = {
'<!-- /wp:core/text -->',

'<!-- wp:core/embed url="https://www.youtube.com/watch?v=Nl6U7UotA-M" -->',
'<figure><iframe width="560" height="315" src="//www.youtube.com/embed/Nl6U7UotA-M" frameborder="0" allowfullscreen></iframe><figcaption>State of the Word 2016</figcaption></figure>',
'<figure><iframe src="//www.youtube.com/embed/Nl6U7UotA-M" frameborder="0" allowfullscreen></iframe><figcaption>State of the Word 2016</figcaption></figure>',
'<!-- /wp:core/embed -->',

'<!-- wp:core/heading -->',
Expand Down