Skip to content

Commit d019d3c

Browse files
vcanalesstokesmant-hamanocarolinantalldan
authored
Backports: WordPress 6.6.2 (#65050)
* Fix canvas issues by removing VisualEditor’s height (#63724) Unlinked contributors: wp-seopress. Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> * Post Editor: Prevent popover from being hidden by metabox (#63939) * Post Editor: Prevent popover from being hidden by metabox * Use `.interface-interface-skeleton__content` instead of `.interface-interface-skeleton__body` Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: Rishit30G <rishit30g@git.wordpress.org> Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org> * Global Styles: Fix block custom CSS pseudo element selectors (#63980) Unlinked contributors: harlet. Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: dballari <dballari@git.wordpress.org> Co-authored-by: wongjn <wongjn@git.wordpress.org> * Avoid errors for post types without a 'menu_icon' (#64015) Unlinked contributors: karan4official. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> * Data Views: Don't render action modal when there are no eligible items (#64250) Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> * Post editor: apply space below content using a pseudo-element instead of padding-bottom (#64639) Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: PC888 <kracked888@git.wordpress.org> * Featured Image Block: Reduce CSS specificity (#64463) Co-authored-by: dsas <dsas@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> * Inserter: use lighter grammar parse to check allowed status (#64902) Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> * Prepare JSON schemas for Draft 7 update (#63582) Co-authored-by: ajlende <ajlende@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org> * Fix missing ref support for textAlign and textColumns in theme.json schema (#63625) * Add missing ref support for textAlign and textColumns * Update the theme.json reference docs Co-authored-by: ajlende <ajlende@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org> * Don't allow duplicating template parts in non-block-based themes (#64379) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: MadtownLems <madtownlems@git.wordpress.org> * Fix bumped specificity for layout styles in non-iframed editor (#64076) * Fix too specific layout styles in non-iframed editor * Ensure first/last child rules take precedence * Adjust selectors so that `> :first-child`/`> :last-child` still has 0,2,0 specificity to override theme.json spacing * Update tests * Update client side layout selectors to match theme json * Add backport changelog ---- Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> * Update postcss-prefixwrap dependency to 1.51.0 to fix prefixing in `:where` selectors (#64458) * Update postcss-prefixwrap dependency to 1.51.0 to fix prefixing in :where selectors * Add extra test for :where with a pseudo selector ---- Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: andreiglingeanu <andreiglingeanu@git.wordpress.org> * Revert "Update postcss-prefixwrap dependency to 1.51.0 to fix prefixing in `:where` selectors (#64458)" This reverts commit 53a370e. * Update postcss-prefixwrap dependency to 1.51.0 to fix prefixing in `:where` selectors (#64458) * Update postcss-prefixwrap dependency to 1.51.0 to fix prefixing in :where selectors * Add extra test for :where with a pseudo selector ---- Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: andreiglingeanu <andreiglingeanu@git.wordpress.org> * Post Editor: fix click space after post content to append (#64992) * Fix minimally * Revise comment * Stop propagation and don’t prevent default * Insert default block if no blocks are present * re-build package lock to match format * Revert "Inserter: use lighter grammar parse to check allowed status (#64902)" This reverts commit 9b9bbe8. --------- Co-authored-by: Mitchell Austin <mr.fye@oneandthesame.net> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: stokesman <presstoke@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: Rishit30G <rishit30g@git.wordpress.org> Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org> Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: dballari <dballari@git.wordpress.org> Co-authored-by: wongjn <wongjn@git.wordpress.org> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: Daniel Richards <daniel.richards@automattic.com> Co-authored-by: PC888 <kracked888@git.wordpress.org> Co-authored-by: Dean Sas <dean@deansas.org> Co-authored-by: dsas <dsas@git.wordpress.org> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: Alex Lende <alex+github.com@lende.xyz> Co-authored-by: ajlende <ajlende@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: MadtownLems <madtownlems@git.wordpress.org>
1 parent c7f1e8e commit d019d3c

File tree

23 files changed

+345
-134
lines changed

23 files changed

+345
-134
lines changed

backport-changelog/6.6/7097.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
https://github.com/WordPress/wordpress-develop/pull/7097
2+
3+
* https://github.com/WordPress/gutenberg/pull/63980

backport-changelog/6.6/7145.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
https://github.com/WordPress/wordpress-develop/pull/7145
2+
3+
* https://github.com/WordPress/gutenberg/pull/64076
Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
/**
88
* External dependencies
99
*/
10-
const path = require( 'path' );
11-
const fs = require( 'fs' );
10+
import path from 'path';
11+
import fs from 'fs';
12+
import url from 'url';
13+
import $RefParser from '@apidevtools/json-schema-ref-parser';
14+
15+
const __dirname = path.dirname( url.fileURLToPath( import.meta.url ) );
16+
1217
/**
1318
* Path to root project directory.
1419
*
@@ -58,7 +63,7 @@ const END_TOKEN = '<!-- END TOKEN Autogenerated - DO NOT EDIT -->';
5863
*/
5964
const TOKEN_PATTERN = new RegExp( START_TOKEN + '[^]*' + END_TOKEN );
6065

61-
const themejson = require( THEME_JSON_SCHEMA_FILE );
66+
const themejson = await $RefParser.dereference( THEME_JSON_SCHEMA_FILE );
6267

6368
/**
6469
* Convert object keys to an array.
@@ -74,42 +79,6 @@ const keys = ( maybeObject ) => {
7479
return Object.keys( maybeObject );
7580
};
7681

77-
/**
78-
* Get definition from ref.
79-
*
80-
* @param {string} ref
81-
* @return {Object} definition
82-
* @throws {Error} If the referenced definition is not found in 'themejson.definitions'.
83-
*
84-
* @example
85-
* getDefinition( '#/definitions/typographyProperties/properties/fontFamily' )
86-
* // returns themejson.definitions.typographyProperties.properties.fontFamily
87-
*/
88-
const resolveDefinitionRef = ( ref ) => {
89-
const refParts = ref.split( '/' );
90-
const definition = refParts[ refParts.length - 1 ];
91-
if ( ! themejson.definitions[ definition ] ) {
92-
throw new Error( `Can't resolve '${ ref }'. Definition not found` );
93-
}
94-
return themejson.definitions[ definition ];
95-
};
96-
97-
/**
98-
* Get properties from an array.
99-
*
100-
* @param {Object} items
101-
* @return {Object} properties
102-
*/
103-
const getPropertiesFromArray = ( items ) => {
104-
// if its a $ref resolve it
105-
if ( items.$ref ) {
106-
return resolveDefinitionRef( items.$ref ).properties;
107-
}
108-
109-
// otherwise just return the properties
110-
return items.properties;
111-
};
112-
11382
/**
11483
* Convert settings properties to markup.
11584
*
@@ -133,9 +102,7 @@ const getSettingsPropertiesMarkup = ( struct ) => {
133102
let type = props[ key ].type || '';
134103
let ps =
135104
props[ key ].type === 'array'
136-
? keys( getPropertiesFromArray( props[ key ].items ) )
137-
.sort()
138-
.join( ', ' )
105+
? keys( props[ key ].items.properties ).sort().join( ', ' )
139106
: '';
140107

141108
/*
@@ -154,9 +121,7 @@ const getSettingsPropertiesMarkup = ( struct ) => {
154121
.map( ( item ) =>
155122
item?.type === 'object' && item?.properties
156123
? '_{' +
157-
keys( getPropertiesFromArray( item ) )
158-
.sort()
159-
.join( ', ' ) +
124+
keys( item.properties ).sort().join( ', ' ) +
160125
'}_'
161126
: ''
162127
)
@@ -244,10 +209,6 @@ const formatType = ( prop ) => {
244209
if ( item.type ) {
245210
types.push( item.type );
246211
}
247-
// refComplete is always an object
248-
if ( item.$ref && item.$ref === '#/definitions/refComplete' ) {
249-
types.push( 'object' );
250-
}
251212
} );
252213

253214
type = [ ...new Set( types ) ].join( ', ' );

lib/class-wp-theme-json-gutenberg.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,16 @@ public function get_stylesheet( $types = array( 'variables', 'styles', 'presets'
13721372
protected function process_blocks_custom_css( $css, $selector ) {
13731373
$processed_css = '';
13741374

1375+
if ( empty( $css ) ) {
1376+
return $processed_css;
1377+
}
1378+
13751379
// Split CSS nested rules.
13761380
$parts = explode( '&', $css );
13771381
foreach ( $parts as $part ) {
1382+
if ( empty( $part ) ) {
1383+
continue;
1384+
}
13781385
$is_root_css = ( ! str_contains( $part, '{' ) );
13791386
if ( $is_root_css ) {
13801387
// If the part doesn't contain braces, it applies to the root level.
@@ -1387,11 +1394,24 @@ protected function process_blocks_custom_css( $css, $selector ) {
13871394
}
13881395
$nested_selector = $part[0];
13891396
$css_value = $part[1];
1390-
$part_selector = str_starts_with( $nested_selector, ' ' )
1397+
1398+
/*
1399+
* Handle pseudo elements such as ::before, ::after etc. Regex will also
1400+
* capture any leading combinator such as >, +, or ~, as well as spaces.
1401+
* This allows pseudo elements as descendants e.g. `.parent ::before`.
1402+
*/
1403+
$matches = array();
1404+
$has_pseudo_element = preg_match( '/([>+~\s]*::[a-zA-Z-]+)/', $nested_selector, $matches );
1405+
$pseudo_part = $has_pseudo_element ? $matches[1] : '';
1406+
$nested_selector = $has_pseudo_element ? str_replace( $pseudo_part, '', $nested_selector ) : $nested_selector;
1407+
1408+
// Finalize selector and re-append pseudo element if required.
1409+
$part_selector = str_starts_with( $nested_selector, ' ' )
13911410
? static::scope_selector( $selector, $nested_selector )
13921411
: static::append_to_selector( $selector, $nested_selector );
1393-
$final_selector = ":root :where($part_selector)";
1394-
$processed_css .= $final_selector . '{' . trim( $css_value ) . '}';
1412+
$final_selector = ":root :where($part_selector)$pseudo_part";
1413+
1414+
$processed_css .= $final_selector . '{' . trim( $css_value ) . '}';
13951415
}
13961416
}
13971417
return $processed_css;
@@ -1651,7 +1671,7 @@ protected function get_layout_styles( $block_metadata, $types = array() ) {
16511671
$spacing_rule['selector']
16521672
);
16531673
} else {
1654-
$format = static::ROOT_BLOCK_SELECTOR === $selector ? '.%2$s %3$s' : '%1$s-%2$s %3$s';
1674+
$format = static::ROOT_BLOCK_SELECTOR === $selector ? ':root :where(.%2$s)%3$s' : ':root :where(%1$s-%2$s)%3$s';
16551675
$layout_selector = sprintf(
16561676
$format,
16571677
$selector,

package-lock.json

Lines changed: 104 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"devDependencies": {
9898
"@actions/core": "1.9.1",
9999
"@actions/github": "5.0.0",
100+
"@apidevtools/json-schema-ref-parser": "11.6.4",
100101
"@ariakit/test": "^0.3.7",
101102
"@babel/core": "7.24.3",
102103
"@babel/plugin-proposal-export-namespace-from": "7.18.9",
@@ -281,7 +282,7 @@
281282
"docs:blocks": "node ./bin/api-docs/gen-block-lib-list.js",
282283
"docs:build": "npm-run-all docs:gen docs:blocks docs:api-ref docs:theme-ref",
283284
"docs:gen": "node ./docs/tool/index.js",
284-
"docs:theme-ref": "node ./bin/api-docs/gen-theme-reference.js",
285+
"docs:theme-ref": "node ./bin/api-docs/gen-theme-reference.mjs",
285286
"env": "wp-env",
286287
"fixtures:clean": "rimraf \"test/integration/fixtures/blocks/*.+(json|serialized.html)\"",
287288
"fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test:unit test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json",

packages/block-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"fast-deep-equal": "^3.1.3",
7474
"memize": "^2.1.0",
7575
"postcss": "^8.4.21",
76-
"postcss-prefixwrap": "^1.41.0",
76+
"postcss-prefixwrap": "^1.51.0",
7777
"postcss-urlrebase": "^1.0.0",
7878
"react-autosize-textarea": "^7.1.0",
7979
"react-easy-crop": "^5.0.6",

0 commit comments

Comments
 (0)