Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
a133b6d
KSES: Allow assigning values to CSS variables.
SergeyBiryukov Sep 9, 2022
438822a
Editor: Backport Elements API updates.
SergeyBiryukov Sep 10, 2022
640cca7
Docs: Correct `@global` tags in `WP_User_Query::prepare_query()`.
SergeyBiryukov Sep 11, 2022
8f533d7
Customize: Use Semantically correct function
aaronjorbin Sep 11, 2022
da03cf1
REST API: Use helper functions for building routes in more places.
TimothyBJacobs Sep 11, 2022
3fbc7e5
Editor: Refresh nones for metaboxes after reauthentication.
joemcgill Sep 11, 2022
a400e99
REST API: Add support for searching resources by id.
TimothyBJacobs Sep 11, 2022
db0290b
Build/Test: Prevent using unsupported NPM versions.
aaronjorbin Sep 11, 2022
4b34765
Customize: Prevent JS error in Links widget when selective refresh is…
westonruter Sep 11, 2022
27aa1ec
Date/Time: Cast extracted strings to integers in `wp_resolve_post_dat…
swissspidy Sep 11, 2022
bb20a18
REST API: Introduce _pretty query parameter to opt in to JSON_PRETTY_…
kadamwhite Sep 11, 2022
1c69513
Media: Add muted property for video elements.
antpb Sep 11, 2022
62f25a4
Embeds: Add Google Data Studio as a trusted oEmbed provider
helen Sep 11, 2022
244a209
Autosave/REST API: Block autosaving from overwriting changes when loc…
antpb Sep 11, 2022
b80ba26
REST API: Add support for settings to specify their own additionalPro…
TimothyBJacobs Sep 11, 2022
7053062
Blocks: Add new `render` property in `block.json` for block types
gziolo Sep 12, 2022
5ebe289
Code Modernization: Add `AllowDynamicProperties` attribute to all (pa…
SergeyBiryukov Sep 12, 2022
2d98ba4
Code Modernization: Replace deprecated string interpolation patterns.
SergeyBiryukov Sep 12, 2022
4fc5f0e
Code Modernization: Pass correct value to `parse_url()` in `WP_Custom…
SergeyBiryukov Sep 12, 2022
de06111
Comments: Remove `aria-hidden="true"` attribute for visible text in c…
audrasjb Sep 12, 2022
0ad353d
Comments: Make `wp_required_field_indicator()` and `wp_required_field…
audrasjb Sep 12, 2022
926f3f8
Editor: Hide query loop pagination link arrows from assistive technol…
audrasjb Sep 12, 2022
1746a68
Twenty Seventeen: Ensure long text wraps correctly in the Button Block.
audrasjb Sep 12, 2022
7c72b3d
Themes: Implement file description for `theme.json`.
audrasjb Sep 13, 2022
b886ab6
Twenty Twenty: Improve support for Post Title block alignment.
audrasjb Sep 13, 2022
695cd01
Code Modernization: Fix autovivification from `false` to `array` in `…
SergeyBiryukov Sep 13, 2022
d8b2629
Upgrade/Install: Remove `_copy_dir()` function as originally intended.
SergeyBiryukov Sep 13, 2022
751a7b8
General: Add a new filter for `the_posts_pagination_args`.
dream-encode Sep 13, 2022
9bde2e9
Options, Meta APIs: Add a new `pre-option` filter.
dream-encode Sep 13, 2022
7b9d4cf
General: Correct path replacement regex in `wp_guess_url`.
dream-encode Sep 13, 2022
5225a99
Tests: Rename the test for `pre_option` filter to match the filter name.
SergeyBiryukov Sep 13, 2022
ebd2606
Tests: Rename the test for `wp_guess_url()` to match the function name.
SergeyBiryukov Sep 13, 2022
a338319
Plugins: Visually align plugin cards in Plugin Install screen.
audrasjb Sep 13, 2022
1116041
Upgrade/Install: Update sodium_compat to v1.18.0.
SergeyBiryukov Sep 14, 2022
a8f702f
Twenty Fifteen: Ensure border-bottom styles are applied to the Button…
audrasjb Sep 14, 2022
2030705
Twenty Twenty: Correctly align Social Icons block in the editor.
audrasjb Sep 14, 2022
9603308
Twenty Twenty: Ensure link color is inherited from paragraph in the e…
audrasjb Sep 14, 2022
73c668d
Twenty Twenty: Ensure headings styles are consistent between editor a…
audrasjb Sep 14, 2022
3381f05
Blocks: Allow registering multiple items for all supported asset types
gziolo Sep 14, 2022
7fcc88a
Editor: Backport Style Engine API functions, classes and tests.
audrasjb Sep 14, 2022
e4a2e73
Docs: Correct `@return` value for `wp_get_http_headers()`.
SergeyBiryukov Sep 14, 2022
7c86dfe
Code Quality: Remove unwanted spaces in the `WP_Block_Type` class
gziolo Sep 14, 2022
34aeac1
Editor: Backport foundation for Layout block support refactor (part 1).
audrasjb Sep 14, 2022
759f2b3
Editor: Revert [54159].
Sep 14, 2022
d6e842c
Feeds: Add a set of fine-grained filters to disable the different typ…
SergeyBiryukov Sep 14, 2022
72380e3
Editor: Backport foundation for Layout block support refactor (part 1).
hellofromtonya Sep 14, 2022
3e9fd82
Twenty Twenty: Fix Heading Block alignment when nested in Cover Block.
audrasjb Sep 14, 2022
c2dcd6e
Twenty Twenty-One: Fix Heading Block alignment when nested in Cover B…
audrasjb Sep 14, 2022
4086157
Site health: Add a menu bubble with the critical issues count to the …
azaozz Sep 14, 2022
26fad95
Twenty Twenty: Ensure Latest Posts block set to 2 columns displays ac…
audrasjb Sep 14, 2022
235faff
Twenty Twenty: Fix Social Links widget alignment.
audrasjb Sep 14, 2022
fe87f8e
Twenty Twenty-Two: Add "Accessibility Ready" tag to theme in repository
audrasjb Sep 14, 2022
0fdfa26
Site health:
azaozz Sep 14, 2022
39617d8
Twenty Twenty-One: Remove WooCommerce related CSS selectors.
audrasjb Sep 14, 2022
4c10e3e
Twenty Nineteen: Define underline thickness for links.
audrasjb Sep 15, 2022
0b2f05a
Docs: Add missing `@since` history in Gallery Shortcode function.
audrasjb Sep 15, 2022
7991edb
Docs: Use third-person singular verbs in Media API function descripti…
audrasjb Sep 15, 2022
d0a7711
Editor: Backport `wp_theme_element_class_name()` alias.
audrasjb Sep 15, 2022
b98a8bb
Editor: Backport `build_query_vars_from_query_block` changes from Gut…
audrasjb Sep 15, 2022
98cfa29
Themes: Introduces block-based template parts for Classic themes.
hellofromtonya Sep 15, 2022
db90f69
Initial commit.
ramonjd Sep 9, 2022
8d10a6e
Added test
ramonjd Sep 9, 2022
311df00
Remove unused global from test
ramonjd Sep 9, 2022
3c3a710
Formatting
ramonjd Sep 9, 2022
23a38f8
Move test
ockham Sep 15, 2022
ca40bbb
Remove obsolete PHPDoc
ockham Sep 15, 2022
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
Editor: Backport foundation for Layout block support refactor (part 1).
Backports the following changes from the Gutenberg repository:

* [WordPress/gutenberg/40875 gutenberg/40875] Layout: Use semantic classnames, centralize layout definitions, reduce duplication, and fix blockGap in theme.json
* [WordPress/gutenberg/42544 gutenberg/42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg/42544
* [WordPress/gutenberg/42087 gutenberg/42087] Theme.json: Add block support feature level selectors for blocks gutenberg/42087
* [WordPress/gutenberg/43792 gutenberg/43792] Global Styles: Split root layout rules into a different function gutenberg/43792
* [WordPress/gutenberg/42544 gutenberg/42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg/42544
* [WordPress/gutenberg/42665 gutenberg/42665] Layout: Reduce specificity of fallback blockGap styles gutenberg/42665
* [WordPress/gutenberg/42085 gutenberg/42085] Core CSS support for root padding and alignfull blocks gutenberg/42085

Notes:
* It doesn't entirely port over PR 40875 — the remaining PHP changes for that PR will be explored in a separate PR targeting `layout.php`.
* [54159] was reverted in [54160] due to PHPUnit test failures for tests added by the commit. Later, tests passed when applied on top of `trunk`. There were various outages today of upstream `wp-env` dependencies, which likely were the root cause of the earlier failures. For historical tracking and to make sure, recommitting [54159] but instead on top of current `trunk`. See PR 3205 for more details.
* Giving additional props for those who did a deep dive investigation into the failed tests.

Follow-up to [54160], [54159].

Props andrewserong, aaronrobertshaw, isabel_brison, bernhard-reiter, hellofromTonya.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54162 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
hellofromtonya committed Sep 14, 2022
commit 72380e31ca0bc05dca5617357412ab8fd346a583
28 changes: 28 additions & 0 deletions src/wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ function get_default_block_editor_settings() {
'disableCustomColors' => get_theme_support( 'disable-custom-colors' ),
'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ),
'disableLayoutStyles' => get_theme_support( 'disable-layout-styles' ),
'enableCustomLineHeight' => get_theme_support( 'custom-line-height' ),
'enableCustomSpacing' => get_theme_support( 'custom-spacing' ),
'enableCustomUnits' => get_theme_support( 'custom-units' ),
Expand Down Expand Up @@ -417,6 +418,18 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$block_classes['css'] = $actual_css;
$global_styles[] = $block_classes;
}
} else {
// If there is no `theme.json` file, ensure base layout styles are still available.
$block_classes = array(
'css' => 'base-layout-styles',
'__unstableType' => 'base-layout',
'isGlobalStyles' => true,
);
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
if ( '' !== $actual_css ) {
$block_classes['css'] = $actual_css;
$global_styles[] = $block_classes;
}
}

$editor_settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );
Expand Down Expand Up @@ -474,9 +487,24 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$editor_settings['enableCustomSpacing'] = $editor_settings['__experimentalFeatures']['spacing']['padding'];
unset( $editor_settings['__experimentalFeatures']['spacing']['padding'] );
}
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'] ) ) {
$editor_settings['disableCustomSpacingSizes'] = ! $editor_ettings['__experimentalFeatures']['spacing']['customSpacingSize'];
unset( $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'] );
}

if ( isset( $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'] ) ) {
$spacing_sizes_by_origin = $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'];
$editor_settings['spacingSizes'] = isset( $spacing_sizes_by_origin['custom'] ) ?
$spacing_sizes_by_origin['custom'] : (
isset( $spacing_sizes_by_origin['theme'] ) ?
$spacing_sizes_by_origin['theme'] :
$spacing_sizes_by_origin['default']
);
}

$editor_settings['__unstableResolvedAssets'] = _wp_get_iframed_editor_assets();
$editor_settings['localAutosaveInterval'] = 15;
$editor_settings['disableLayoutStyles'] = current_theme_supports( 'disable-layout-styles' );
$editor_settings['__experimentalDiscussionSettings'] = array(
'commentOrder' => get_option( 'comment_order' ),
'commentsPerPage' => get_option( 'comments_per_page' ),
Expand Down
50 changes: 50 additions & 0 deletions src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,54 @@ public static function get_theme_data( $deprecated = array(), $options = array()
return $with_theme_supports;
}

/**
* Gets the styles for blocks from the block.json file.
*
* @since 6.1.0
*
* @return WP_Theme_JSON
*/
public static function get_block_data() {
$registry = WP_Block_Type_Registry::get_instance();
$blocks = $registry->get_all_registered();
$config = array( 'version' => 1 );
foreach ( $blocks as $block_name => $block_type ) {
if ( isset( $block_type->supports['__experimentalStyle'] ) ) {
$config['styles']['blocks'][ $block_name ] = static::remove_json_comments( $block_type->supports['__experimentalStyle'] );
}

if (
isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] ) &&
null === _wp_array_get( $config, array( 'styles', 'blocks', $block_name, 'spacing', 'blockGap' ), null )
) {
// Ensure an empty placeholder value exists for the block, if it provides a default blockGap value.
// The real blockGap value to be used will be determined when the styles are rendered for output.
$config['styles']['blocks'][ $block_name ]['spacing']['blockGap'] = null;
}
}

// Core here means it's the lower level part of the styles chain.
// It can be a core or a third-party block.
return new WP_Theme_JSON( $config, 'core' );
}

/**
* When given an array, this will remove any keys with the name `//`.
*
* @param array $array The array to filter.
* @return array The filtered array.
*/
private static function remove_json_comments( $array ) {
unset( $array['//'] );
foreach ( $array as $k => $v ) {
if ( is_array( $v ) ) {
$array[ $k ] = static::remove_json_comments( $v );
}
}

return $array;
}

/**
* Returns the custom post type that contains the user's origin config
* for the active theme or a void array if none are found.
Expand Down Expand Up @@ -370,6 +418,7 @@ public static function get_user_data() {
* @since 5.8.0
* @since 5.9.0 Added user data, removed the `$settings` parameter,
* added the `$origin` parameter.
* @since 6.1.0 Added block data.
*
* @param string $origin Optional. To what level should we merge data.
* Valid values are 'theme' or 'custom'. Default 'custom'.
Expand All @@ -382,6 +431,7 @@ public static function get_merged_data( $origin = 'custom' ) {

$result = new WP_Theme_JSON();
$result->merge( static::get_core_data() );
$result->merge( static::get_block_data() );
$result->merge( static::get_theme_data() );

if ( 'custom' === $origin ) {
Expand Down
Loading