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 / BlockAttributes / addAttributes.js

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

49 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 { addFilter } from '@wordpress/hooks';
5
6 /**
7 * Internal dependencies
8 */
9 import { isBeyondwordsSupportedBlock } from './isBeyondwordsSupportedBlock';
10
11 /**
12 * Register custom block attributes for BeyondWords.
13 *
14 * @since 4.0.4 Remove settings.attributes undefined check, to match official docs.
15 * @since 6.0.1 Skip internal/UI blocks to prevent breaking the block inserter.
16 *
17 * @param {Object} settings Settings for the block.
18 * @param {string} name Block name.
19 *
20 * @return {Object} settings Modified settings.
21 */
22 function addAttributes( settings, name ) {
23 // Only add attributes to content blocks
24 if ( ! isBeyondwordsSupportedBlock( name ) ) {
25 return settings;
26 }
27
28 return {
29 ...settings,
30 attributes: {
31 ...settings.attributes,
32 beyondwordsAudio: {
33 type: 'boolean',
34 default: true,
35 },
36 beyondwordsMarker: {
37 type: 'string',
38 default: '',
39 },
40 },
41 };
42 }
43
44 addFilter(
45 'blocks.registerBlockType',
46 'beyondwords/beyondwords-block-attributes',
47 addAttributes
48 );
49