Skip to content
Prev Previous commit
Next Next commit
Add notices store to mobile Video block
  • Loading branch information
derekblank committed May 27, 2022
commit 4caa0133555faa9a9285b7f8439dbb081fd86644
13 changes: 11 additions & 2 deletions packages/block-library/src/video/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import { __, sprintf } from '@wordpress/i18n';
import { isURL, getProtocol } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';
import { video as SvgIcon, replace } from '@wordpress/icons';
import { withSelect } from '@wordpress/data';
import { withDispatch, withSelect } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';

/**
* Internal dependencies
Expand Down Expand Up @@ -169,7 +170,10 @@ class VideoEdit extends Component {
isFetchingVideo: true,
} );

// TODO: Check if video is valid and set attributes
// TODO: Check if video is valid and set attributes, and also handle errors
// setAttributes( { ... } )
// ...
// createErrorNotice(__('Image file not found.'));
} else {
createErrorNotice( __( 'Invalid URL.' ) );
}
Expand Down Expand Up @@ -394,5 +398,10 @@ export default compose( [
'inserter_menu'
),
} ) ),
withDispatch( ( dispatch ) => {
const { createErrorNotice } = dispatch( noticesStore );

return { createErrorNotice };
} ),
withPreferredColorScheme,
] )( VideoEdit );