Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5958faa
Fix list block's has-background padding
aaronrobertshaw May 24, 2024
23537e6
Fix paragraph block's has-padding style
aaronrobertshaw May 24, 2024
16de34e
Make global styles data available in block editor
aaronrobertshaw Apr 9, 2024
6549ff3
Update util to retrieve style variations from specified directory
aaronrobertshaw Apr 9, 2024
7ea4780
Add filters to resolve shared block style variation definitions
aaronrobertshaw Apr 9, 2024
93fa1f8
Add new top-level theme.json property to identify supported block typ…
aaronrobertshaw Apr 9, 2024
2c73a62
Support skipping root layout styles from theme.json stylesheet genera…
aaronrobertshaw Apr 9, 2024
3af0d24
Add variations from block style registry to block metadata in theme.json
aaronrobertshaw Apr 9, 2024
d966c38
Update theme.json sanitization to support extended block style variat…
aaronrobertshaw Apr 9, 2024
daa82d3
Prevent block style variation element styles from being removed for u…
aaronrobertshaw Apr 9, 2024
6274c28
Resolve user origin shared block style variation definitions e.g. fro…
aaronrobertshaw Apr 9, 2024
cf79868
Update theme.json schema for extended block style variations
aaronrobertshaw Apr 9, 2024
24b14fa
Allow non-core block style variations in global styles variations panel
aaronrobertshaw Apr 9, 2024
35a1d2f
Generate per-application variation styles and enforce unique classname
aaronrobertshaw Apr 9, 2024
a1ea2e3
Update useGlobalStylesOutput hook's node generation to support extend…
aaronrobertshaw Apr 9, 2024
b7219e5
Allow opting out of certain sets of styles when generating JS global …
aaronrobertshaw Apr 9, 2024
785d9cd
Support instanced variation selectors via getBlockSelectors
aaronrobertshaw Apr 9, 2024
e4c21ca
Add block support hook for variations in the editor
aaronrobertshaw Apr 9, 2024
c8ff6e7
Sort style overrides by the rendered order of associated blocks
aaronrobertshaw Apr 9, 2024
0f63b37
Add test theme and child theme with block style variations
aaronrobertshaw Apr 10, 2024
8786df0
Update theme.json resolver unit tests for get_style_variations
aaronrobertshaw Apr 10, 2024
5206c33
Test for variations support resolving variation definitions into them…
aaronrobertshaw Apr 10, 2024
6f83b55
Clean up retrieval of settings and styles
aaronrobertshaw Apr 12, 2024
611498c
Use cloneDeep util
aaronrobertshaw Apr 12, 2024
6be673c
Register block style variations defined in user origin
aaronrobertshaw Apr 12, 2024
723ed63
Make PHP function, block support, and register styles naming consistent
aaronrobertshaw Apr 15, 2024
09426ff
Rename block style variation PHP block support files
aaronrobertshaw Apr 15, 2024
cefe0cb
Rename JS variation block support to block style variation
aaronrobertshaw Apr 15, 2024
fca1981
Fix typo
aaronrobertshaw Apr 15, 2024
24f1863
Tweaks to resolve and register util function
aaronrobertshaw Apr 15, 2024
c54d3a3
Consolidate block style variations under theme styles directory
aaronrobertshaw Apr 15, 2024
db0402c
Fix references to /block-styles in comments
aaronrobertshaw Apr 16, 2024
800d452
Switch scoping of variations to check supportedBlockTypes
aaronrobertshaw Apr 17, 2024
9108b71
Move scopeFeatureSelectors to utils and add docblock
aaronrobertshaw Apr 17, 2024
a524bfb
Make comment docblock
aaronrobertshaw Apr 17, 2024
1cede2a
Use shorthand for retrieving getBlockStyles from blocksStore
aaronrobertshaw Apr 17, 2024
402a234
Split out user origin based block style registration to useEffect
aaronrobertshaw Apr 17, 2024
a8690c4
Fix issue with application of variations in the site editor
aaronrobertshaw Apr 17, 2024
2b97374
Rename supportedBlockTypes to blockTypes
aaronrobertshaw Apr 18, 2024
92809ea
Fix merging of theme style variations config
aaronrobertshaw Apr 20, 2024
fca03a0
Try optimisation of variation resolution in global styles provider
aaronrobertshaw Apr 22, 2024
00c22e5
Move sorting of style overrides into getStyleOverrides selector
aaronrobertshaw Apr 24, 2024
afe5c98
Undo whitespace change
aaronrobertshaw Apr 24, 2024
2481889
Revert "Make global styles data available in block editor"
aaronrobertshaw May 10, 2024
c579963
Switch variation hook to use new global styles editor setting
aaronrobertshaw May 10, 2024
113c269
Fix variations panel in site editor
aaronrobertshaw May 17, 2024
e8ac4b2
Make block style variation retrieval more robust
aaronrobertshaw May 28, 2024
e2d27d3
Update test block theme json versions to latest
aaronrobertshaw May 28, 2024
e963725
Update missed theme json version numbers in tests
aaronrobertshaw May 28, 2024
df4a518
Pass clientId directly through to block props component
aaronrobertshaw May 28, 2024
33830c4
Add @since comments
aaronrobertshaw May 29, 2024
168b5e4
Add backport change log
aaronrobertshaw May 29, 2024
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
Prev Previous commit
Next Next commit
Prevent block style variation element styles from being removed for u…
…sers without unfiltered html caps
  • Loading branch information
aaronrobertshaw committed May 28, 2024
commit daa82d3c7b1d0d22567ee6dfd4a4e20d5fc26d60
23 changes: 23 additions & 0 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -3279,6 +3279,29 @@ public static function remove_insecure_properties( $theme_json ) {
}

$variation_output = static::remove_insecure_styles( $variation_input );

// Process a variation's elements and element pseudo selector styles.
if ( isset( $variation_input['elements'] ) ) {
foreach ( $valid_element_names as $element_name ) {
$element_input = $variation_input['elements'][ $element_name ] ?? null;
if ( $element_input ) {
$element_output = static::remove_insecure_styles( $element_input );

if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] ) ) {
foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] as $pseudo_selector ) {
if ( isset( $element_input[ $pseudo_selector ] ) ) {
$element_output[ $pseudo_selector ] = static::remove_insecure_styles( $element_input[ $pseudo_selector ] );
}
}
}

if ( ! empty( $element_output ) ) {
_wp_array_set( $variation_output, array( 'elements', $element_name ), $element_output );
}
}
}
}

if ( ! empty( $variation_output ) ) {
_wp_array_set( $sanitized, $variation['path'], $variation_output );
}
Expand Down