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
Add new VideoPress block support #7592
Conversation
@@ -86,6 +86,7 @@ | |||
<properties> | |||
<property name="custom_capabilities" type="array"> | |||
<element value="manage_sensei"/> | |||
<element value="edit_course"/> |
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.
It just fixes a PHPCS issue in the committed PHP file.
@@ -133,7 +133,7 @@ public function enqueue_frontend_scripts() { | |||
wp_add_inline_script( 'sensei-course-video-blocks-extension', $script, 'before' ); | |||
|
|||
$post = get_post(); | |||
if ( has_block( 'core/video', $post ) || has_block( 'core/embed', $post ) ) { | |||
if ( has_block( 'core/video', $post ) || has_block( 'core/embed', $post ) || has_block( 'videopress/video', $post ) ) { |
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.
This makes sure that the integration will be loaded also when using the videopress/video
block.
@@ -162,8 +162,10 @@ const useEditorPlayer = ( videoBlock ) => { | |||
const doc = editorCanvasIframe?.contentDocument || document; | |||
const w = editorCanvasIframe?.contentWindow || window; | |||
|
|||
const isJetpackVideoPress = !! videoBlock.attributes | |||
.videoPressClassNames; | |||
const isJetpackVideoPress = |
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.
It will make the integration behave the same way it happens with the VideoPress embed.
@@ -26,6 +26,8 @@ const initVideoPressPlayer = ( iframe ) => { | |||
|
|||
export const initVideoPressExtension = () => { | |||
document | |||
.querySelectorAll( '.wp-block-embed-videopress iframe' ) | |||
.querySelectorAll( | |||
'.wp-block-embed-videopress iframe, .wp-block-jetpack-videopress iframe' |
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.
Add new selector to also match the new block selector.
Test the previous changes of this PR with WordPress Playground. |
WordPress Dependencies ReportThe
This comment was automatically generated by the |
Test the previous changes of this PR with WordPress Playground. |
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, Renatho! Works well 👍
Resolves #7514
And part of https://github.com/Automattic/sensei-pro/pull/2578
Proposed Changes
For context, VideoPress used the "Video" block previously. Now it has its own block (p7DVsv-gDF-p2) which the HTML is similar to the VideoPress embed block, so we leverage this integration.
Testing Instructions
This test instructions are for Video integrations for courses. The rest can be tested in https://github.com/Automattic/sensei-pro/pull/2578.
Pre-Merge Checklist