Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
wp-content
/
plugins
/
generateblocks
/
src
/
utils
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * Get the inner blocks from a given block. This function recursively traverses * the inner blocks and returns them as flat array. * * @param {Object} block The block object containing the inner blocks. * @return {Array} An array of inner blocks. */ export function getInnerBlocks( block ) { return block?.innerBlocks?.reduce( ( acc, innerBlock ) => { if ( innerBlock.innerBlocks ) { return [ ...acc, innerBlock, ...getInnerBlocks( innerBlock ), ]; } return [ ...acc, innerBlock ]; }, [] ); }