Skip to content

Commit

Permalink
added useBlockProps to save function
Browse files Browse the repository at this point in the history
  • Loading branch information
jgcaruso committed May 21, 2021
1 parent 84e35d3 commit d6204ca
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions projects/plugins/jetpack/extensions/blocks/videopress/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { createHigherOrderComponent } from '@wordpress/compose';
import { RichText } from '@wordpress/block-editor';
import { RichText, useBlockProps } from '@wordpress/block-editor';
import classnames from 'classnames';

/**
Expand Down Expand Up @@ -31,6 +31,12 @@ const VideoPressSave = CoreVideoSave => props => {
} = {},
} = props;

const blockProps = useBlockProps.save( {
className: classnames( 'wp-block-video', className, videoPressClassNames, {
[ `align${ align }` ]: align,
} ),
} );

if ( ! guid ) {
/**
* We return the element produced by the render so Gutenberg can add the block class when cloning the element.
Expand Down Expand Up @@ -58,11 +64,7 @@ const VideoPressSave = CoreVideoSave => props => {
} );

return (
<figure
className={ classnames( 'wp-block-video', className, videoPressClassNames, {
[ `align${ align }` ]: align,
} ) }
>
<figure { ...blockProps }>
<div className="wp-block-embed__wrapper">
{ `\n${ url }\n` /* URL needs to be on its own line. */ }
</div>
Expand Down

0 comments on commit d6204ca

Please sign in to comment.