| 1 |
/** |
| 2 |
* Check if a block is supported by BeyondWords. |
| 3 |
* |
| 4 |
* Only content blocks that can be read aloud get attributes and controls. |
| 5 |
* |
| 6 |
* @param {string} name Block name. |
| 7 |
* @return {boolean} Whether the block is supported by BeyondWords. |
| 8 |
*/ |
| 9 |
export function isBeyondwordsSupportedBlock( name ) { |
| 10 |
if ( ! name ) { |
| 11 |
return false; |
| 12 |
} |
| 13 |
|
| 14 |
// Skip internal/UI blocks |
| 15 |
if ( name.startsWith( '__' ) ) { |
| 16 |
return false; |
| 17 |
} |
| 18 |
|
| 19 |
// Skip reusable blocks and template parts (these are containers) |
| 20 |
if ( |
| 21 |
name.startsWith( 'core/block' ) || |
| 22 |
name.startsWith( 'core/template' ) |
| 23 |
) { |
| 24 |
return false; |
| 25 |
} |
| 26 |
|
| 27 |
const excludedBlocks = [ |
| 28 |
'beyondwords/player', // The Player block embeds the player itself |
| 29 |
'core/freeform', // Classic editor |
| 30 |
'core/legacy-widget', |
| 31 |
'core/widget-area', |
| 32 |
'core/navigation', |
| 33 |
'core/navigation-link', |
| 34 |
'core/navigation-submenu', |
| 35 |
'core/site-logo', |
| 36 |
'core/site-title', |
| 37 |
'core/site-tagline', |
| 38 |
]; |
| 39 |
|
| 40 |
if ( excludedBlocks.includes( name ) ) { |
| 41 |
return false; |
| 42 |
} |
| 43 |
|
| 44 |
return true; |
| 45 |
} |
| 46 |
|