Skip to content

Commit

Permalink
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into f…
Browse files Browse the repository at this point in the history
…ix/editor-inserted-tabs-indicator
  • Loading branch information
DaniGuardiola committed May 28, 2024
2 parents 7e9278f + fe40df6 commit f876fd5
Show file tree
Hide file tree
Showing 131 changed files with 1,501 additions and 1,291 deletions.
1 change: 1 addition & 0 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ concurrency:

jobs:
performance:
timeout-minutes: 60
name: Run performance tests
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}
Expand Down
5 changes: 5 additions & 0 deletions backport-changelog/6.6/6522.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
https://github.com/WordPress/wordpress-develop/pull/6522

* https://github.com/WordPress/gutenberg/pull/60106
* https://github.com/WordPress/gutenberg/pull/60228
* https://github.com/WordPress/gutenberg/pull/61638
3 changes: 3 additions & 0 deletions backport-changelog/6.6/6656.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/6656

* https://github.com/WordPress/gutenberg/pull/60715
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
== Changelog ==

= 18.4.1 =

## Changelog

### Bug fixes

- Writing flow: fix paste for input fields ([61389](https://github.com/WordPress/gutenberg/pull/61389))


= 18.4.0 =

## Changelog
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Our approach—as outlined in [the technical overview introduction](https://make

This also [gives us the flexibility](https://github.com/WordPress/gutenberg/issues/1516) to store those blocks that are inherently separate from the content stream (reusable pieces like widgets or small post type elements) elsewhere, and just keep token references for their placement.

We suggest you look at the [Gutenberg key concepts](/docs/getting-started/architecture/key-concepts.md) to learn more about how this aspect of the project works.
We suggest you look at the [Gutenberg key concepts](/docs/explanations/architecture/key-concepts.md) to learn more about how this aspect of the project works.

### How can I parse the post content back out into blocks in PHP or JS?

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ This block validation error occurs because the `save()` function returns block c
You will see more of these errors as you update the `save()` function in subsequent steps. Just click "Attempt Block Recovery" and update the page.
After preforming block recovery, open the Code editor and you will see the markup now looks like this.
After performing block recovery, open the Code editor and you will see the markup now looks like this.
```html
<!-- wp:create-block/copyright-date-block {"showStartingYear":true,"startingYear":"2017"} -->
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Add an image or video with a text overlay. ([Source](https://github.com/WordPres

- **Name:** core/cover
- **Category:** media
- **Supports:** align, anchor, color (heading, text, ~~background~~, ~~enableContrastChecker~~), dimensions (aspectRatio), interactivity (clientNavigation), layout (~~allowJustification~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Supports:** align, anchor, color (heading, text, ~~background~~, ~~enableContrastChecker~~), dimensions (aspectRatio), interactivity (clientNavigation), layout (~~allowJustification~~), shadow, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** allowedBlocks, alt, backgroundType, contentPosition, customGradient, customOverlayColor, dimRatio, focalPoint, gradient, hasParallax, id, isDark, isRepeated, isUserOverlayColor, minHeight, minHeightUnit, overlayColor, tagName, templateLock, url, useFeaturedImage

## Details
Expand Down
2 changes: 1 addition & 1 deletion gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality.
* Requires at least: 6.4
* Requires PHP: 7.2
* Version: 18.4.0
* Version: 18.4.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
26 changes: 12 additions & 14 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ protected function process_blocks_custom_css( $css, $selector ) {
$is_root_css = ( ! str_contains( $part, '{' ) );
if ( $is_root_css ) {
// If the part doesn't contain braces, it applies to the root level.
$processed_css .= trim( $selector ) . '{' . trim( $part ) . '}';
$processed_css .= ':root :where(' . trim( $selector ) . '){' . trim( $part ) . '}';
} else {
// If the part contains braces, it's a nested CSS rule.
$part = explode( '{', str_replace( '}', '', $part ) );
Expand All @@ -1305,7 +1305,8 @@ protected function process_blocks_custom_css( $css, $selector ) {
$part_selector = str_starts_with( $nested_selector, ' ' )
? static::scope_selector( $selector, $nested_selector )
: static::append_to_selector( $selector, $nested_selector );
$processed_css .= $part_selector . '{' . trim( $css_value ) . '}';
$final_selector = ":root :where($part_selector)";
$processed_css .= $final_selector . '{' . trim( $css_value ) . '}';
}
}
return $processed_css;
Expand All @@ -1322,6 +1323,7 @@ public function get_custom_css() {
$block_custom_css = '';
$block_nodes = $this->get_block_custom_css_nodes();
foreach ( $block_nodes as $node ) {
// The node selector will have its specificity set to 0-1-0 within process_blocks_custom_css.
$block_custom_css .= $this->get_block_custom_css( $node['css'], $node['selector'] );
}

Expand Down Expand Up @@ -1564,7 +1566,7 @@ protected function get_layout_styles( $block_metadata, $types = array() ) {
$spacing_rule['selector']
);
} else {
$format = static::ROOT_BLOCK_SELECTOR === $selector ? ':where(.%2$s) %3$s' : ':where(%1$s-%2$s) %3$s';
$format = static::ROOT_BLOCK_SELECTOR === $selector ? '.%2$s %3$s' : '%1$s-%2$s %3$s';
$layout_selector = sprintf(
$format,
$selector,
Expand Down Expand Up @@ -2745,7 +2747,7 @@ static function ( $pseudo_selector ) use ( $selector ) {
}

// 2. Generate and append the rules that use the general selector.
$block_rules .= static::to_ruleset( ":where($selector)", $declarations );
$block_rules .= static::to_ruleset( ":root :where($selector)", $declarations );

// 3. Generate and append the rules that use the duotone selector.
if ( isset( $block_metadata['duotone'] ) && ! empty( $declarations_duotone ) ) {
Expand All @@ -2762,12 +2764,12 @@ static function ( $pseudo_selector ) use ( $selector ) {

// 5. Generate and append the feature level rulesets.
foreach ( $feature_declarations as $feature_selector => $individual_feature_declarations ) {
$block_rules .= static::to_ruleset( ":where($feature_selector)", $individual_feature_declarations );
$block_rules .= static::to_ruleset( ":root :where($feature_selector)", $individual_feature_declarations );
}

// 6. Generate and append the style variation rulesets.
foreach ( $style_variation_declarations as $style_variation_selector => $individual_style_variation_declarations ) {
$block_rules .= static::to_ruleset( $style_variation_selector, $individual_style_variation_declarations );
$block_rules .= static::to_ruleset( ":root :where($style_variation_selector)", $individual_style_variation_declarations );
}

return $block_rules;
Expand Down Expand Up @@ -2816,16 +2818,12 @@ public function get_root_layout_rules( $selector, $block_metadata ) {
$css .= '.wp-site-blocks { padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom); }';
// Right and left padding are applied to the first container with `.has-global-padding` class.
$css .= '.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }';
// Nested containers with `.has-global-padding` class do not get padding.
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }';
// Alignfull children of the container with left and right padding have negative margins so they can still be full width.
$css .= '.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }';
// The above rule is negated for alignfull children of nested containers.
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }';
// Some of the children of alignfull blocks without content width should also get padding: text blocks and non-alignfull container blocks.
$css .= '.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }';
// The above rule also has to be negated for blocks inside nested `.has-global-padding` blocks.
$css .= '.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0; }';
// Nested children of the container with left and right padding that are not wide or full aligned do not get padding.
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block, .alignfull, .alignwide)) { padding-right: 0; padding-left: 0; }';
// Nested children of the container with left and right padding that are not wide or full aligned do not get negative margin applied.
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block, .alignfull, .alignwide)) > .alignfull { margin-left: 0; margin-right: 0; }';
}

$css .= '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';
Expand Down
70 changes: 57 additions & 13 deletions lib/experimental/full-page-client-side-navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,69 @@ function _gutenberg_add_enhanced_pagination_to_query_block( $parsed_block ) {
add_filter( 'render_block_data', '_gutenberg_add_enhanced_pagination_to_query_block' );

/**
* Add directives to all links.
* Adds client-side navigation directives to BODY tag.
*
* Note: This should probably be done per site, not by default when this option is enabled.
*
* @param array $content The block content.
* @param string $response_body The response body.
*
* @return array The same block content with the directives needed.
* @return string The rendered template with modified BODY attributes.
*/
function _gutenberg_add_client_side_navigation_directives( $content ) {
$p = new WP_HTML_Tag_Processor( $content );
// Hack to add the necessary directives to the body tag.
// TODO: Find a proper way to add directives to the body tag.
static $body_interactive_added;
if ( ! $body_interactive_added ) {
$body_interactive_added = true;
return (string) $p . '<body data-wp-interactive="core/experimental" data-wp-context="{}">';
function _gutenberg_add_client_side_navigation_directives( $response_body ) {
$is_html_content_type = false;
foreach ( headers_list() as $header ) {
$header_parts = preg_split( '/\s*[:;]\s*/', strtolower( $header ) );
if ( count( $header_parts ) >= 2 && 'content-type' === $header_parts[0] ) {
$is_html_content_type = in_array( $header_parts[1], array( 'text/html', 'application/xhtml+xml' ), true );
}
}
return (string) $p;
if ( ! $is_html_content_type ) {
return $response_body;
}

$p = new WP_HTML_Tag_Processor( $response_body );
if ( $p->next_tag( array( 'tag_name' => 'BODY' ) ) ) {
$p->set_attribute( 'data-wp-interactive', 'core/experimental' );
$p->set_attribute( 'data-wp-context', '{}' );
$response_body = $p->get_updated_html();
}
return $response_body;
}

// TODO: Explore moving this to the server directive processing.
add_filter( 'render_block', '_gutenberg_add_client_side_navigation_directives' );
add_filter( 'gutenberg_template_output_buffer', '_gutenberg_add_client_side_navigation_directives' );

/**
* Starts output buffering at the end of the 'template_include' filter.
*
* This is to implement #43258 in core.
*
* This is a hack which would eventually be replaced with something like this in wp-includes/template-loader.php:
*
* $template = apply_filters( 'template_include', $template );
* + ob_start( 'wp_template_output_buffer_callback' );
* if ( $template ) {
* include $template;
* } elseif ( current_user_can( 'switch_themes' ) ) {
*
* @link https://core.trac.wordpress.org/ticket/43258
*
* @param string $passthrough Value for the template_include filter which is passed through.
*
* @return string Unmodified value of $passthrough.
*/
function _gutenberg_buffer_template_output( string $passthrough ): string {
ob_start(
static function ( string $output ): string {
/**
* Filters the template output buffer prior to sending to the client.
*
* @param string $output Output buffer.
* @return string Filtered output buffer.
*/
return (string) apply_filters( 'gutenberg_template_output_buffer', $output );
}
);
return $passthrough;
}
add_filter( 'template_include', '_gutenberg_buffer_template_output', PHP_INT_MAX );
34 changes: 34 additions & 0 deletions lib/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,40 @@
"bottom": "0px",
"left": "0px"
}
},
"blocks": {
"core/button": {
"variations": {
"outline": {
"border": {
"width": "2px",
"style": "solid",
"color": "currentColor"
},
"color": {
"text": "currentColor",
"gradient": "transparent none"
},
"spacing": {
"padding": {
"top": "0.667em",
"right": "1.33em",
"bottom": "0.667em",
"left": "1.33em"
}
}
}
}
},
"core/site-logo": {
"variations": {
"rounded": {
"border": {
"radius": "9999px"
}
}
}
}
}
}
}
8 changes: 2 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
"version": "18.4.0",
"version": "18.4.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down Expand Up @@ -272,11 +272,11 @@
"prebuild:packages": "npm run clean:packages && lerna run build",
"build:packages": "npm run --silent build:package-types && node ./bin/packages/build.js",
"build:plugin-zip": "bash ./bin/build-plugin-zip.sh",
"clean:package-types": "tsc --build --clean",
"clean:package-types": "tsc --build --clean && rimraf \"./packages/*/build-types\"",
"clean:packages": "rimraf \"./packages/*/@(build|build-module|build-style)\"",
"dev": "npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
"dev:packages": "concurrently \"node ./bin/packages/watch.js\" \"tsc --build --watch\"",
"distclean": "rimraf node_modules packages/*/node_modules",
"distclean": "git clean --force -d -X",
"docs:api-ref": "node ./bin/api-docs/update-api-docs.js",
"docs:blocks": "node ./bin/api-docs/gen-block-lib-list.js",
"docs:build": "npm-run-all docs:gen docs:blocks docs:api-ref docs:theme-ref",
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ registerCoreBlocks();

Any components in this package that have a counterpart in [@wordpress/components](/packages/components/README.md) are an extension of those components.

Unless you're [creating an editor](docs/how-to-guides/platform/custom-block-editor/README.md), it is recommended that the components in @wordpress/components should be used rather than the ones in this package as these components have been customized for use in an editor and may result in unexpected behaviour if used outside of this context.
Unless you're [creating an editor](/docs/how-to-guides/platform/custom-block-editor.md), it is recommended that the components in @wordpress/components should be used rather than the ones in this package as these components have been customized for use in an editor and may result in unexpected behaviour if used outside of this context.

<!-- START TOKEN(Autogenerated API docs) -->

Expand Down
Loading

0 comments on commit f876fd5

Please sign in to comment.