Skip to content

Version 3.0.3

Compare
Choose a tag to compare
@ndiego ndiego released this 04 Jun 16:47
· 118 commits to main since this release

Changed

  • Updated the blockVisibility.contextualIndicatorClasses filter to include more variables, which allows for more customization. Example usage below:
/**
 * Modifies the indicator classes based on active controls. In this
 * case, add a class if the block has been hidden on medium screens.
 *
 * @param {string} classes - The original classes of the indicator.
 * @param {Array} activeControls - The active controls.
 * @param {object} controls - The controls object.
 * 
 * @returns {string} - The modified classes of the indicator.
 */
function modifyIndicatorClasses( classes, activeControls, controls ) {
    if ( activeControls.includes( 'screen-size' ) ) {
        const screenSize = controls?.screenSize;
        const hiddenOnMedium = screenSize?.hideOnScreenSize?.medium ?? false;

        if ( hiddenOnMedium ) {
            return classes + ' hidden-on-medium';
        }
    }

    return classes;
}

wp.hooks.addFilter(
    'blockVisibility.contextualIndicatorClasses',
    'example-plugin/modify-indicator-classes',
    modifyIndicatorClasses
);

Fixed

  • [Query String] Fixed bug when using 0 as the value of a query parameter would cause unexpected results.