Skip to content

Commit

Permalink
Changes per review
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 3, 2023
1 parent 851d8fb commit 81c1807
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions packages/blocks/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@ const ROOT_BLOCK_SUPPORTS = [
'letterSpacing',
];

function filterElementBlockSupports( blockSuppots, name, element ) {
return blockSuppots.filter( ( support ) => {
/**
* Filters the list of supported styles for a given element.
*
* @param {string[]} blockSupports list of supported styles.
* @param {string|undefined} name block name.
* @param {string|undefined} element element name.
*
* @return {string[]} filtered list of supported styles.
*/
function filterElementBlockSupports( blockSupports, name, element ) {
return blockSupports.filter( ( support ) => {
if ( support === 'fontSize' && element === 'heading' ) {
return false;
}
Expand Down Expand Up @@ -67,6 +76,9 @@ function filterElementBlockSupports( blockSuppots, name, element ) {
} );
}

/**
* Returns the list of supported styles for a given block name and element.
*/
export const getSupportedStyles = createSelector(
( state, name, element ) => {
if ( ! name ) {
Expand Down Expand Up @@ -121,7 +133,8 @@ export const getSupportedStyles = createSelector(
STYLE_PROPERTY[ styleName ].support
) !== false
) {
return supportKeys.push( styleName );
supportKeys.push( styleName );
return;
}
}

Expand All @@ -132,7 +145,7 @@ export const getSupportedStyles = createSelector(
false
)
) {
return supportKeys.push( styleName );
supportKeys.push( styleName );
}
} );

Expand Down

0 comments on commit 81c1807

Please sign in to comment.