-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Video block: Add poster image #9335
Conversation
This is pretty cool. Seeing as this is not part of this PR, separately we should consider adding contextual help to the switches. Their effect is boolean and instant so it's okay to use switches, but we should have some help text below. |
onSelectPoster( image ) { | ||
const { setAttributes, clientId } = this.props; | ||
setAttributes( { poster: image.url } ); | ||
document.getElementById( 'block-' + clientId ).getElementsByTagName( 'video' )[ 0 ].load(); |
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 think we should use ref
in this case. See the related docs: https://reactjs.org/docs/refs-and-the-dom.html
Usage example in the existing code:
https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/block/edit-panel/index.js#L15
https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/block/edit-panel/index.js#L66
https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/block/edit-panel/index.js#L35
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.
By the way, this logic should probably be moved to componenDidUpdate
lifecycle method as it should be triggered before this.props.attributes.poster
isn't updated.
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 will leave the code review for the experts, but in terms of the output/input HTML it's what we are expecting in Aztec. So looking great!
@SergioEstevao, awesome to hear that. By the way, are there any other missing bits to make Gutenberg fully compatible in Aztec? This one was the only one I was aware of. |
@gziolo Thanks for your review. This is a better much better solution, I updated this PR. |
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 added fix for the |
Hi, folks, The video settings only appear if there is a Media Library video at play, but not for YouTube videos: Whereas pre-Gutenburg, the Poster Image setting was present even on YT videos: So the 'classic to Gutenburg' issue #4837 isn't fixed yet, as I can see. |
@harryfear This was a Plugin (https://wordpress.org/plugins/youtube-chromeless/), it was not possible in a standard WordPress installation. |
I'm not 100% sure if that's right? A Chromeless YouTube player is possible now, and has been as of v. 3.9? |
For a |
Description
This PR adds the ability to add a poster image to the video block.
Fixes #4837
Screenshots
No poster selected
Poster selected
Workflow