Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Editor: Remove unused 'useIsDimensionsSupportValid' method #50735

Merged
merged 1 commit into from
May 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions packages/block-editor/src/hooks/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,43 +136,3 @@ export function useCustomSides() {
version: '6.4',
} );
}

/**
* Custom hook to determine whether the sides configured in the
* block support are valid. A dimension property cannot declare
* support for a mix of axial and individual sides.
*
* @param {string} blockName Block name.
* @param {string} feature The feature custom sides relate to e.g. padding or margins.
*
* @return {boolean} If the feature has a valid configuration of sides.
*/
export function useIsDimensionsSupportValid( blockName, feature ) {
const sides = useCustomSides( blockName, feature );

if (
sides &&
sides.some( ( side ) => ALL_SIDES.includes( side ) ) &&
sides.some( ( side ) => AXIAL_SIDES.includes( side ) )
) {
// eslint-disable-next-line no-console
console.warn(
`The ${ feature } support for the "${ blockName }" block can not be configured to support both axial and arbitrary sides.`
);
return false;
}

if (
sides?.length &&
feature === 'blockGap' &&
! AXIAL_SIDES.every( ( side ) => sides.includes( side ) )
) {
// eslint-disable-next-line no-console
console.warn(
`The ${ feature } support for the "${ blockName }" block can not be configured to support arbitrary sides.`
);
return false;
}

return true;
}