PluginProbe
BeyondWords – AI audio for publishers / 7.0.0
BeyondWords – AI audio for publishers v7.0.0
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 / editor / components / block-attributes / addAttributes.js

addAttributes.js in BeyondWords – AI audio for publishers 7.0.0, at src/editor/components/block-attributes/addAttributes.js

48 lines 999 B
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 if ( ! isBeyondwordsSupportedBlock( name ) ) {
24 return settings;
25 }
26
27 return {
28 ...settings,
29 attributes: {
30 ...settings.attributes,
31 beyondwordsAudio: {
32 type: 'boolean',
33 default: true,
34 },
35 beyondwordsMarker: {
36 type: 'string',
37 default: '',
38 },
39 },
40 };
41 }
42
43 addFilter(
44 'blocks.registerBlockType',
45 'beyondwords/beyondwords-block-attributes',
46 addAttributes
47 );
48