PluginProbe
BeyondWords – AI audio for publishers / 6.0.3
BeyondWords – AI audio for publishers v6.0.3
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 / DisplayPlayer / index.js

index.js in BeyondWords – AI audio for publishers 6.0.3, at src/Component/Post/DisplayPlayer/index.js

52 lines 1.2 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 { __ } from '@wordpress/i18n';
5 import { CheckboxControl } from '@wordpress/components';
6 import { useEntityProp } from '@wordpress/core-data';
7 import { useSelect } from '@wordpress/data';
8 import { Fragment } from '@wordpress/element';
9
10 /**
11 * Internal dependencies
12 */
13 import DisplayPlayerCheck from './check';
14
15 export function DisplayPlayer( { wrapper } ) {
16 const Wrapper = wrapper || Fragment;
17
18 const postType = useSelect(
19 ( select ) => select( 'core/editor' ).getCurrentPostType(),
20 []
21 );
22
23 const [ meta, setMeta ] = useEntityProp( 'postType', postType, 'meta' );
24
25 const displayPlayer = meta.beyondwords_disabled !== '1';
26
27 const onUpdateDisplayPlayer = ( newDisplayPlayer ) => {
28 setMeta( {
29 ...meta,
30 beyondwords_disabled: newDisplayPlayer ? '' : '1',
31 } );
32 };
33
34 return (
35 <DisplayPlayerCheck>
36 <Wrapper>
37 <CheckboxControl
38 className="beyondwords--display-player"
39 label={ __( 'Display player', 'speechkit' ) }
40 checked={ displayPlayer }
41 onChange={ () => {
42 onUpdateDisplayPlayer( ! displayPlayer );
43 } }
44 __nextHasNoMarginBottom
45 />
46 </Wrapper>
47 </DisplayPlayerCheck>
48 );
49 }
50
51 export default DisplayPlayer;
52