PluginProbe
BeyondWords – AI audio for publishers / 4.0.6
BeyondWords – AI audio for publishers v4.0.6
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / Component / Post / BlockAttributes / check.js

check.js in BeyondWords – AI audio for publishers 4.0.6, at src/Component/Post/BlockAttributes/check.js

38 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4 import { compose } from '@wordpress/compose';
5 import { withSelect } from '@wordpress/data';
6
7 export function BlockAttributesCheck( { hasAudioAction, children } ) {
8 if ( ! hasAudioAction ) {
9 return null;
10 }
11
12 return children;
13 }
14
15 export default compose( [
16 withSelect( ( select ) => {
17 const { getEditedPostAttribute } = select( 'core/editor' );
18
19 // TODO simplify checks for whether audio exists, this is copied across the codebase
20 const beyondwordsGenerateAudio =
21 getEditedPostAttribute( 'meta' ).beyondwords_generate_audio === '1';
22 const beyondwordsContentId =
23 getEditedPostAttribute( 'meta' ).beyondwords_content_id;
24 const beyondwordsPodcastId =
25 getEditedPostAttribute( 'meta' ).beyondwords_podcast_id;
26 const speechkitPodcastId =
27 getEditedPostAttribute( 'meta' ).speechkit_podcast_id;
28
29 return {
30 hasAudioAction:
31 !! beyondwordsGenerateAudio ||
32 !! beyondwordsContentId ||
33 !! beyondwordsPodcastId ||
34 !! speechkitPodcastId,
35 };
36 } ),
37 ] )( BlockAttributesCheck );
38