Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import classnames from 'classnames';
import { get } from 'lodash';
/**
* Internal dependencies
*/
import Loading from './loading';
import { getVideoPressUrl } from './url';
const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
// For Gutenberg versions that support it, use the figure block wrapper (from '@wordpress/block-editor')
// to wrap the VideoPress component the same way the underlying `core/video` block is wrapped.
// (Otherwise there's an issue with Gutenberg >= 8.1 where the VideoPress block becomes unselectable,
// see https://github.com/Automattic/jetpack/issues/15922.)
const BlockFigureWrapper = Block ? Block.figure : 'figure';
const VideoPressEdit = CoreVideoEdit =>
class extends Component {
constructor() {
super( ...arguments );
this.state = {
media: null,
isFetchingMedia: false,
fallback: false,
interactive: false,
};
this.posterImageButton = createRef();
}
static getDerivedStateFromProps( nextProps, state ) {
if ( ! nextProps.isSelected && state.interactive ) {