Skip to content

Commit

Permalink
fix: wrong ignore regexp for exclude applending blockera unique css
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaelahidev committed Sep 22, 2024
1 parent d9dbb4b commit a235281
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions packages/editor/php/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,6 @@ function blockera_get_compatible_block_css_selector( array $selectors, string $f

} else {

$master_block_state = $args['pseudo-class'] ?? 'normal';
// Filters standard css pseudo classes.
$parent_pseudo_class = in_array(
$master_block_state,
[
'normal',
'parent-class',
'custom-class',
],
true
) ? '' : $master_block_state;

// Re-Generate picked css selector to handle current inner block state!
$selector = blockera_get_inner_block_state_selector( $selector ?? '', $args );
}
Expand Down Expand Up @@ -466,8 +454,9 @@ function blockera_append_root_block_css_selector( string $selector, string $root
return $root;
}

$pattern = '/\.\bwp-block-' . preg_quote( $args['block-name'], '/' ) . '\b/';
$ignore_pattern = '/\.\bwp-block-' . preg_quote( $args['block-name'], '/' ) . '__/';
$preg_quote = preg_quote( $args['block-name'], '/' );
$pattern = '/\.\bwp-block-' . $preg_quote . '\b/';
$ignore_pattern = '/(\.wp-block-' . $preg_quote . '__|^.*\s\.wp-block-' . $preg_quote . ')/';

// Assume recieved selector is another reference to root, so we should concat together.
if ( preg_match( $pattern, $selector, $matches ) && ! preg_match( $ignore_pattern, $selector ) ) {
Expand Down Expand Up @@ -498,7 +487,7 @@ function blockera_append_root_block_css_selector( string $selector, string $root
}

// Imagine selector and root is same.
if ( $selector === $root ) {
if ( $selector === $root || blockera_is_inner_block( $args['block-type'] ) ) {

return $selector;
}
Expand Down

0 comments on commit a235281

Please sign in to comment.