Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/navigation-block-check-modal-exists
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Jun 29, 2023
2 parents 3f29f8b + c355d54 commit 06d13da
Show file tree
Hide file tree
Showing 136 changed files with 1,584 additions and 848 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const restrictedImports = [
'isPlainObject',
'isString',
'isUndefined',
'kebabCase',
'keyBy',
'keys',
'last',
Expand Down
4 changes: 4 additions & 0 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ async function runPerformanceTests( branches, options ) {
path.join( environmentDirectory, '.wp-env.json' ),
JSON.stringify(
{
config: {
WP_DEBUG: false,
SCRIPT_DEBUG: false,
},
core: 'WordPress/WordPress',
plugins: [ path.join( environmentDirectory, 'plugin' ) ],
themes: [
Expand Down
132 changes: 51 additions & 81 deletions changelog.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/contributors/versions-in-wordpress.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ If anything looks incorrect here, please bring it up in #core-editor in [WordPre

| Gutenberg Versions | WordPress Version |
| ------------------ | ----------------- |
| 15.2-16.1 | 6.3 |
| 14.2-15.1 | 6.2 |
| 13.1-14.1 | 6.1.1 |
| 13.1-14.1 | 6.1 |
Expand Down
3 changes: 2 additions & 1 deletion docs/how-to-guides/themes/theme-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ To retain backward compatibility, the existing `add_theme_support` declarations
| `editor-color-palette` | Provide the list of colors via `color.palette`. |
| `editor-font-sizes` | Provide the list of font size via `typography.fontSizes`. |
| `editor-gradient-presets` | Provide the list of gradients via `color.gradients`. |
| `experimental-link-color` | Set `color.link` to `true`. `experimental-link-color` will be removed when the plugin requires WordPress 5.9 as the minimum version. |
| `appearance-tools` | Set `appearanceTools` to `true`. |
| `border` | Set `border: color, radius, style, width` to `true`. |
| `link-color ` | Set `color.link` to `true`. |

#### Presets

Expand Down
16 changes: 16 additions & 0 deletions docs/how-to-guides/themes/theme-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,22 @@ Use this setting to enable the following Global Styles settings:
add_theme_support( 'appearance-tools' );
```

## Border

Use this to enable all border settings:

```php
add_theme_support( 'border' );
```

## Link color

Use this to enable the link color setting:

```php
add_theme_support( 'link-color' );
```

## Block Based Template Parts

Block Based Template parts allow administrators to edit parts of the site using blocks. This is off by default, and requires the theme to opt in by declaring support:
Expand Down
1 change: 1 addition & 0 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ Edit the different global regions of your site, like the header, footer, sidebar
Display the description of categories, tags and custom taxonomies when viewing an archive. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/term-description))

- **Name:** core/term-description
- **Experimental:** fse
- **Category:** theme
- **Supports:** align (full, wide), color (background, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** textAlign
Expand Down
1 change: 0 additions & 1 deletion docs/reference-guides/data/data-core-block-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ _Parameters_
- _state_ `Object`: Editor state.
- _rootClientId_ `?string`: Optional root client ID of block list.
- _syncStatus_ `?string`: Optional sync status to filter pattern blocks by.
_Returns_
Expand Down
12 changes: 0 additions & 12 deletions docs/reference-guides/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,18 +329,6 @@ _Returns_

- `any`: The entity record's save error.

### getNavigationFallbackId

Retrieve the fallback Navigation.

_Parameters_

- _state_ `State`: Data state.

_Returns_

- `EntityRecordKey | undefined`: The ID for the fallback Navigation post.

### getRawEntityRecord

Returns the entity's record object by key, with its attributes mapped to their raw values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Settings related to typography.
| lineHeight | boolean | false | |
| textColumns | boolean | false | |
| textDecoration | boolean | true | |
| writingMode | boolean | false | |
| textTransform | boolean | true | |
| dropCap | boolean | true | |
| fontSizes | array | | fluid, name, size, slug |
Expand Down Expand Up @@ -239,6 +240,7 @@ Typography styles.
| lineHeight | string, object | |
| textColumns | string | |
| textDecoration | string, object | |
| writingMode | string, object | |
| textTransform | string, object | |

---
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.1
* Requires PHP: 5.6
* Version: 16.1.0-rc.2
* Version: 16.1.0
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
10 changes: 9 additions & 1 deletion lib/block-supports/typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function gutenberg_register_typography_support( $block_type ) {
$has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
$has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
$has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
$has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );

$has_typography_support = $has_font_family_support
|| $has_font_size_support
Expand All @@ -38,7 +39,8 @@ function gutenberg_register_typography_support( $block_type ) {
|| $has_line_height_support
|| $has_text_columns_support
|| $has_text_decoration_support
|| $has_text_transform_support;
|| $has_text_transform_support
|| $has_writing_mode_support;

if ( ! $block_type->attributes ) {
$block_type->attributes = array();
Expand Down Expand Up @@ -96,6 +98,7 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) {
$has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
$has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
$has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
$has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );

// Whether to skip individual block support features.
$should_skip_font_size = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontSize' );
Expand All @@ -107,6 +110,7 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) {
$should_skip_text_decoration = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textDecoration' );
$should_skip_text_transform = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' );
$should_skip_letter_spacing = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'letterSpacing' );
$should_skip_writing_mode = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'writingMode' );

$typography_block_styles = array();
if ( $has_font_size_support && ! $should_skip_font_size ) {
Expand Down Expand Up @@ -158,6 +162,10 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) {
gutenberg_typography_get_preset_inline_style_value( $block_attributes['style']['typography']['letterSpacing'], 'letter-spacing' );
}

if ( $has_writing_mode_support && ! $should_skip_writing_mode && isset( $block_attributes['style']['typography']['writingMode'] ) ) {
$typography_block_styles['writingMode'] = _wp_array_get( $block_attributes, array( 'style', 'typography', 'writingMode' ), null );
}

$attributes = array();
$styles = gutenberg_style_engine_get_styles(
array( 'typography' => $typography_block_styles ),
Expand Down
6 changes: 5 additions & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class WP_Theme_JSON_Gutenberg {
* `--wp--style--root--padding-*`, and `box-shadow` properties,
* removed the `--wp--style--block-gap` property.
* @since 6.2.0 Added `outline-*`, and `min-height` properties.
* @since 6.3.0 Added `writing-mode` property.
*
* @var array
*/
Expand Down Expand Up @@ -260,6 +261,7 @@ class WP_Theme_JSON_Gutenberg {
'text-transform' => array( 'typography', 'textTransform' ),
'filter' => array( 'filter', 'duotone' ),
'box-shadow' => array( 'shadow' ),
'writing-mode' => array( 'typography', 'writingMode' ),
);

/**
Expand Down Expand Up @@ -339,7 +341,7 @@ class WP_Theme_JSON_Gutenberg {
* @since 6.1.0 Added `layout.definitions` and `useRootPaddingAwareAlignments`.
* @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', 'shadow.defaultPresets',
* `position.fixed` and `position.sticky`.
* @since 6.3.0 Removed `layout.definitions`.
* @since 6.3.0 Removed `layout.definitions`. Added `typography.writingMode`.
* @var array
*/
const VALID_SETTINGS = array(
Expand Down Expand Up @@ -406,6 +408,7 @@ class WP_Theme_JSON_Gutenberg {
'textColumns' => null,
'textDecoration' => null,
'textTransform' => null,
'writingMode' => null,
),
'behaviors' => null,
);
Expand Down Expand Up @@ -468,6 +471,7 @@ class WP_Theme_JSON_Gutenberg {
'textColumns' => null,
'textDecoration' => null,
'textTransform' => null,
'writingMode' => null,
),
'css' => null,
);
Expand Down
20 changes: 20 additions & 0 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,26 @@ public static function get_theme_data( $deprecated = array(), $options = array()
// Classic themes without a theme.json don't support global duotone.
$theme_support_data['settings']['color']['defaultDuotone'] = false;

// Allow themes to enable all border settings via theme_support.
if ( current_theme_supports( 'border' ) ) {
$theme_support_data['settings']['border']['color'] = true;
$theme_support_data['settings']['border']['radius'] = true;
$theme_support_data['settings']['border']['style'] = true;
$theme_support_data['settings']['border']['width'] = true;
}

// Allow themes to enable link colors via theme_support.
if ( current_theme_supports( 'link-color' ) ) {
$theme_support_data['settings']['color']['link'] = true;
}
if ( current_theme_supports( 'experimental-link-color' ) ) {
_doing_it_wrong(
current_theme_supports( 'experimental-link-color' ),
__( '`experimental-link-color` is no longer supported. Use `link-color` instead.', 'gutenberg' ),
'6.3.0'
);
}

// BEGIN EXPERIMENTAL.
// Allow themes to enable appearance tools via theme_support.
// This feature was backported for WordPress 6.2 as of https://core.trac.wordpress.org/ticket/56487
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public function prepare_item_for_response( $item, $request ) {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'block-pattern-category',
Expand All @@ -73,6 +77,8 @@ public function get_item_schema() {
),
);

return $this->add_additional_fields_schema( $schema );
$this->schema = $schema;

return $this->add_additional_fields_schema( $this->schema );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public function prepare_item_for_response( $item, $request ) {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'block-pattern',
Expand Down Expand Up @@ -153,7 +157,9 @@ public function get_item_schema() {
),
);

return $this->add_additional_fields_schema( $schema );
$this->schema = $schema;

return $this->add_additional_fields_schema( $this->schema );
}

/**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.3/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
}
if ( isset( $default_template_types['home'] ) ) {
$default_template_types['home'] = array(
'title' => _x( 'Home', 'Template name', 'gutenberg' ),
'title' => _x( 'Blog Home', 'Template name', 'gutenberg' ),
'description' => __(
'Displays the latest posts as either the site homepage or as the "Posts page" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.',
'gutenberg'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public function prepare_item_for_response( $item, $request ) {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'block-pattern',
Expand Down Expand Up @@ -150,6 +154,8 @@ public function get_item_schema() {
),
);

return $this->add_additional_fields_schema( $schema );
$this->schema = $schema;

return $this->add_additional_fields_schema( $this->schema );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function get_item_schema() {
return $this->add_additional_fields_schema( $this->schema );
}

$this->schema = array(
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'block-editor-settings-item',
'type' => 'object',
Expand Down Expand Up @@ -311,6 +311,8 @@ public function get_item_schema() {
),
);

$this->schema = $schema;

return $this->add_additional_fields_schema( $this->schema );
}
}
2 changes: 2 additions & 0 deletions lib/experimental/interactivity-api/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
function gutenberg_block_update_interactive_view_script( $metadata ) {
if (
array_key_exists( 'name', $metadata ) &&
in_array( $metadata['name'], array( 'core/image' ), true ) &&
array_key_exists( 'file', $metadata ) &&
str_contains( $metadata['file'], 'build/block-library/blocks' )
) {
$metadata['viewScript'] = array( 'file:./view-interactivity.min.js' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static function get_data() {
/**
* Merge data.
*
* @param array $data The data that will be merged with the exsisting store.
* @param array $data The data that will be merged with the existing store.
*/
static function merge_data( $data ) {
self::$store = array_replace_recursive( self::$store, $data );
Expand Down
4 changes: 2 additions & 2 deletions lib/experimental/interactivity-api/store.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/

/**
* Merge data with the exsisting store.
* Merge data with the existing store.
*
* @param array $data Data that will be merged with the exsisting store.
* @param array $data Data that will be merged with the existing store.
*
* @return $data The current store data.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.3/script-loader.php';
require __DIR__ . '/compat/wordpress-6.3/blocks.php';
require __DIR__ . '/compat/wordpress-6.3/navigation-fallback.php';
require __DIR__ . '/compat/wordpress-6.3/block-editor-settings.php';

// Experimental features.
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WP 6.0's stopgap handler for Webfonts API.
require __DIR__ . '/experimental/behaviors.php';
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
require __DIR__ . '/experimental/block-editor-settings.php';
require __DIR__ . '/experimental/blocks.php';
require __DIR__ . '/experimental/navigation-theme-opt-in.php';
require __DIR__ . '/experimental/kses.php';
Expand Down
3 changes: 2 additions & 1 deletion lib/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@
"lineHeight": false,
"textColumns": false,
"textDecoration": true,
"textTransform": true
"textTransform": true,
"writingMode": false
},
"blocks": {
"core/button": {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
"version": "16.1.0-rc.2",
"version": "16.1.0",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
Loading

0 comments on commit 06d13da

Please sign in to comment.