first commit

This commit is contained in:
CHIEFSOFT\ameye
2023-11-30 13:20:54 -05:00
commit e9e5c0546c
5833 changed files with 1801865 additions and 0 deletions
@@ -0,0 +1,19 @@
const { findIndex } = window.lodash;
/**
* Returns the considered adjacent to that of the specified `clientId` for
* resizing consideration. Adjacent blocks are those occurring after, except
* when the given block is the last block in the set. For the last block, the
* behavior is reversed.
*
* @param {WPBlock[]} blocks Block objects.
* @param {string} clientId Client ID to consider for adjacent blocks.
*
* @return {WPBlock[]} Adjacent block objects.
*/
export function getAdjacentBlocks( blocks, clientId ) {
const index = findIndex( blocks, { clientId } );
const isLastBlock = index === blocks.length - 1;
return isLastBlock ? blocks.slice( 0, index ) : blocks.slice( index + 1 );
}