Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function block_core_gallery_render( $attributes, $content ) {
// Set the CSS variable to the column value, and the `gap` property to the combined gap value.
$style = '.wp-block-gallery.' . $class . '{ --wp--style--unstable-gallery-gap: ' . $gap_column . '; gap: ' . $gap_value . '}';

gutenberg_enqueue_block_support_styles( $style, 11 );
wp_enqueue_block_support_styles( $style, 11 );
return $content;
}
/**
Expand Down
11 changes: 9 additions & 2 deletions tools/webpack/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const blockViewRegex = new RegExp(
* but have been declared elsewhere. This way we can call Gutenberg override functions, but
* the block will still call the core function when updates are back ported.
*/
const prefixFunctions = [ 'build_query_vars_from_query_block' ];
const prefixFunctions = [
'build_query_vars_from_query_block',
'wp_enqueue_block_support_styles',
];

/**
* Escapes the RegExp special characters.
Expand Down Expand Up @@ -140,7 +143,11 @@ module.exports = {
// block will still call the core function when updates are back ported.
content = content.replace(
new RegExp( prefixFunctions.join( '|' ), 'g' ),
( match ) => `${ prefix }${ match }`
( match ) =>
`${ prefix }${ match.replace(
/^wp_/,
''
) }`
Comment on lines +146 to +150

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super familiar with those files but isn't this already done in the same file below? 🤔

// Prepend the Gutenberg prefix, substituting any
// other core prefix (e.g. "wp_").
return result.replace(
new RegExp( functionName, 'g' ),
( match ) =>
prefix +
match.replace( /^wp_/, '' )
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait forget it! The snippet I linked is replacing inside of the function definitions. You were doing it in the function calls 🤦 .

);

// Within content, search for any function definitions. For
Expand Down