Skip to content

Commit

Permalink
prep build 07/25
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Jul 25, 2023
2 parents c0f0e0b + 563402f commit 50b6487
Show file tree
Hide file tree
Showing 72 changed files with 716 additions and 593 deletions.
4 changes: 0 additions & 4 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ const LABEL_FEATURE_MAPPING = {
'REST API Interaction': 'REST API',
'New Block': 'Block Library',
'Accessibility (a11y)': 'Accessibility',
'[a11y] Color Contrast': 'Accessibility',
'[a11y] Keyboard & Focus': 'Accessibility',
'[a11y] Labelling': 'Accessibility',
'[a11y] Zooming': 'Accessibility',
'[Package] E2E Tests': 'Testing',
'[Package] E2E Test Utils': 'Testing',
'Automated Testing': 'Testing',
Expand Down
12 changes: 6 additions & 6 deletions bin/plugin/commands/test/fixtures/pull-requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -5747,13 +5747,13 @@
"description": "/packages/components"
},
{
"id": 1344464662,
"node_id": "MDU6TGFiZWwxMzQ0NDY0NjYy",
"url": "https://api.github.com/repos/WordPress/gutenberg/labels/[a11y]%20Keyboard%20&%20Focus",
"name": "[a11y] Keyboard & Focus",
"color": "efde5d",
"id": 546517042,
"node_id": "MDU6TGFiZWw1NDY1MTcwNDI=",
"url": "https://api.github.com/repos/WordPress/gutenberg/labels/Accessibility%20(a11y)",
"name": "Accessibility (a11y)",
"color": "655104",
"default": false,
"description": ""
"description": "Changes that impact accessibility and need corresponding review (e.g. markup changes)."
}
],
"state": "closed",
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 @@ -646,7 +646,7 @@ Add text that respects your spacing and tabs, and also allows styling. ([Source]

- **Name:** core/preformatted
- **Category:** text
- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight)
- **Supports:** anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight)
- **Attributes:** content

## Pullquote
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ _Parameters_

_Returns_

- `Object | null`: The current global styles.
- `Array< object > | null`: The current global styles.

### getCurrentUser

Expand Down
10 changes: 10 additions & 0 deletions docs/reference-guides/theme-json-reference/theme-json-living.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ Settings related to typography.
Generate custom CSS custom properties of the form `--wp--custom--{key}--{nested-key}: {value};`. `camelCased` keys are transformed to `kebab-case` as to follow the CSS property naming schema. Keys at different depth levels are separated by `--`, so keys should not include `--` in the name.


---

### behaviors

Settings related to behaviors.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| lightbox | boolean | false | |

---
## Styles

Expand Down
3 changes: 1 addition & 2 deletions lib/block-supports/behaviors.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function gutenberg_register_behaviors_support( $block_type ) {
* @return string Filtered block content.
*/
function gutenberg_render_behaviors_support_lightbox( $block_content, $block ) {
$experiments = get_option( 'gutenberg-experiments' );
$link_destination = isset( $block['attrs']['linkDestination'] ) ? $block['attrs']['linkDestination'] : 'none';
// Get the lightbox setting from the block attributes.
if ( isset( $block['attrs']['behaviors']['lightbox'] ) ) {
Expand All @@ -63,7 +62,7 @@ function gutenberg_render_behaviors_support_lightbox( $block_content, $block ) {
return $block_content;
}

if ( ! $lightbox_settings || 'none' !== $link_destination || empty( $experiments['gutenberg-interactivity-api-core-blocks'] ) ) {
if ( ! $lightbox_settings || 'none' !== $link_destination ) {
return $block_content;
}

Expand Down
14 changes: 7 additions & 7 deletions lib/compat/wordpress-6.3/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
$default_template_types['singular'] = array(
'title' => _x( 'Single Entries', 'Template name', 'gutenberg' ),
'description' => __(
'Displays any single entry, such as a post or a page. This template will serve as a fallback when a more specific template (e.g., Single Post, Page, or Attachment) cannot be found.',
'Displays any single entry, such as a post or a page. This template will serve as a fallback when a more specific template (e.g. Single Post, Page, or Attachment) cannot be found.',
'gutenberg'
),
);
Expand All @@ -70,7 +70,7 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
$default_template_types['archive'] = array(
'title' => _x( 'All Archives', 'Template name', 'gutenberg' ),
'description' => __(
'Displays any archive, including posts by a single author, category, tag, taxonomy, custom post type, and date. This template will serve as a fallback when more specific templates (e.g., Category or Tag) cannot be found.',
'Displays any archive, including posts by a single author, category, tag, taxonomy, custom post type, and date. This template will serve as a fallback when more specific templates (e.g. Category or Tag) cannot be found.',
'gutenberg'
),
);
Expand All @@ -79,7 +79,7 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
$default_template_types['author'] = array(
'title' => _x( 'Author Archives', 'Template name', 'gutenberg' ),
'description' => __(
"Displays a single author's post archive. This template will serve as a fallback when a more a specific template (e.g., Author: Admin) cannot be found.",
"Displays a single author's post archive. This template will serve as a fallback when a more a specific template (e.g. Author: Admin) cannot be found.",
'gutenberg'
),
);
Expand All @@ -88,7 +88,7 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
$default_template_types['category'] = array(
'title' => _x( 'Category Archives', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a post category archive. This template will serve as a fallback when more specific template (e.g., Category: Recipes) cannot be found.',
'Displays a post category archive. This template will serve as a fallback when more specific template (e.g. Category: Recipes) cannot be found.',
'gutenberg'
),
);
Expand All @@ -97,22 +97,22 @@ function gutenberg_get_default_block_template_types( $default_template_types ) {
$default_template_types['taxonomy'] = array(
'title' => _x( 'Taxonomy', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a custom taxonomy archive. Like categories and tags, taxonomies have terms which you use to classify things. For example: a taxonomy named "Art" can have multiple terms, such as "Modern" and "18th Century." This template will serve as a fallback when a more specific template (e.g, Taxonomy: Art) cannot be found.',
'Displays a custom taxonomy archive. Like categories and tags, taxonomies have terms which you use to classify things. For example: a taxonomy named "Art" can have multiple terms, such as "Modern" and "18th Century." This template will serve as a fallback when a more specific template (e.g. Taxonomy: Art) cannot be found.',
'gutenberg'
),
);
}
if ( isset( $default_template_types['date'] ) ) {
$default_template_types['date'] = array(
'title' => _x( 'Date Archives', 'Template name', 'gutenberg' ),
'description' => __( 'Displays a post archive when a specific date is visited (e.g., example.com/2023/).', 'gutenberg' ),
'description' => __( 'Displays a post archive when a specific date is visited (e.g. example.com/2023/).', 'gutenberg' ),
);
}
if ( isset( $default_template_types['tag'] ) ) {
$default_template_types['tag'] = array(
'title' => _x( 'Tag Archives', 'Template name', 'gutenberg' ),
'description' => __(
'Displays a post tag archive. This template will serve as a fallback when more specific template (e.g., Tag: Pizza) cannot be found.',
'Displays a post tag archive. This template will serve as a fallback when more specific template (e.g. Tag: Pizza) cannot be found.',
'gutenberg'
),
);
Expand Down
30 changes: 19 additions & 11 deletions lib/compat/wordpress-6.3/navigation-fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,42 @@
* Navigation Fallback REST endpoint.
*
* The endpoint may embed the full Navigation Menu object into the
* response as the `self` link. By default the Posts Controller
* will only exposes a limited subset of fields but the editor requires
* additional fields to be available in order to utilise the menu.
* response as the `self` link. By default, the Posts Controller
* will only expose a limited subset of fields but the editor requires
* additional fields to be available in order to utilize the menu.
*
* @param array $schema the schema for the `wp_navigation` post.
* @return array the modified schema.
*/
function gutenberg_add_fields_to_navigation_fallback_embeded_links( $schema ) {
function gutenberg_add_fields_to_navigation_fallback_embedded_links( $schema ) {
// Expose top level fields.
$schema['properties']['status']['context'] = array_merge( $schema['properties']['status']['context'], array( 'embed' ) );
$schema['properties']['content']['context'] = array_merge( $schema['properties']['content']['context'], array( 'embed' ) );

// Expose sub properties of content field.
// These aren't exposed by the posts controller by default, see:
// https://github.com/WordPress/wordpress-develop/blob/5c3c6258e468c67ba00bbd13db29994f1a57a52a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L2425.
/*
* Exposes sub properties of content field.
* These sub properties aren't exposed by the posts controller by default,
* for requests where context is `embed`.
*
* @see WP_REST_Posts_Controller::get_item_schema()
*/
$schema['properties']['content']['properties']['raw']['context'] = array_merge( $schema['properties']['content']['properties']['raw']['context'], array( 'embed' ) );
$schema['properties']['content']['properties']['rendered']['context'] = array_merge( $schema['properties']['content']['properties']['rendered']['context'], array( 'embed' ) );
$schema['properties']['content']['properties']['block_version']['context'] = array_merge( $schema['properties']['content']['properties']['block_version']['context'], array( 'embed' ) );

// Expose sub properties of title field.
// These aren't exposed by the posts controller by default, see:
// https://github.com/WordPress/wordpress-develop/blob/5c3c6258e468c67ba00bbd13db29994f1a57a52a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L2401.
/*
* Exposes sub properties of title field.
* These sub properties aren't exposed by the posts controller by default,
* for requests where context is `embed`.
*
* @see WP_REST_Posts_Controller::get_item_schema()
*/
$schema['properties']['title']['properties']['raw']['context'] = array_merge( $schema['properties']['title']['properties']['raw']['context'], array( 'embed' ) );

return $schema;
}

add_filter(
'rest_wp_navigation_item_schema',
'gutenberg_add_fields_to_navigation_fallback_embeded_links'
'gutenberg_add_fields_to_navigation_fallback_embedded_links'
);
3 changes: 0 additions & 3 deletions lib/experimental/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ function gutenberg_enable_experiments() {
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-group-grid-variation', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGroupGridVariation = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-interactivity-api-core-blocks', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalInteractivityAPI = true', 'before' );
}

if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) {
wp_add_inline_script( 'wp-block-library', 'window.__experimentalDisableTinymce = true', 'before' );
Expand Down
27 changes: 0 additions & 27 deletions lib/experimental/interactivity-api/blocks.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ static function merge_data( $data ) {
self::$store = array_replace_recursive( self::$store, $data );
}

/**
* Serialize store data to JSON.
*
* @return string|false Serialized JSON data.
*/
static function serialize() {
// TODO: Escape?
return wp_json_encode( self::$store );
}

/**
* Reset the store data.
*/
Expand All @@ -71,7 +61,9 @@ static function render() {
if ( empty( self::$store ) ) {
return;
}
$store = self::serialize();
echo "<script id=\"wp-interactivity-store-data\" type=\"application/json\">$store</script>";
echo sprintf(
'<script id="wp-interactivity-store-data" type="application/json">%s</script>',
wp_json_encode( self::$store, JSON_HEX_TAG | JSON_HEX_AMP )
);
}
}
12 changes: 0 additions & 12 deletions lib/experiments-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,6 @@ function gutenberg_initialize_experiments_settings() {
)
);

add_settings_field(
'gutenberg-interactivity-api-core-blocks',
__( 'Interactivity API and Behaviors UI', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Use the Interactivity API to enable the <a href="https://github.com/WordPress/gutenberg/issues/50029">Behaviors UI</a> in the Image block.', 'gutenberg' ),
'id' => 'gutenberg-interactivity-api-core-blocks',
)
);

add_settings_field(
'gutenberg-no-tinymce',
__( 'Disable TinyMCE and Classic block', 'gutenberg' ),
Expand Down
3 changes: 0 additions & 3 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/experimental/disable-tinymce.php';
}

if ( gutenberg_is_experiment_enabled( 'gutenberg-interactivity-api-core-blocks' ) ) {
require __DIR__ . '/experimental/interactivity-api/blocks.php';
}
require __DIR__ . '/experimental/interactivity-api/class-wp-interactivity-store.php';
require __DIR__ . '/experimental/interactivity-api/store.php';
require __DIR__ . '/experimental/interactivity-api/scripts.php';
Expand Down
27 changes: 21 additions & 6 deletions packages/block-editor/src/autocompleters/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useSelect } from '@wordpress/data';
import {
createBlock,
createBlocksFromInnerBlocksTemplate,
parse,
} from '@wordpress/blocks';
import { useMemo } from '@wordpress/element';

Expand Down Expand Up @@ -116,14 +117,28 @@ function createBlockCompleter() {
return ! ( /\S/.test( before ) || /\S/.test( after ) );
},
getOptionCompletion( inserterItem ) {
const { name, initialAttributes, innerBlocks } = inserterItem;
const {
name,
initialAttributes,
innerBlocks,
syncStatus,
content,
} = inserterItem;

return {
action: 'replace',
value: createBlock(
name,
initialAttributes,
createBlocksFromInnerBlocksTemplate( innerBlocks )
),
value:
syncStatus === 'unsynced'
? parse( content, {
__unstableSkipMigrationLogs: true,
} )
: createBlock(
name,
initialAttributes,
createBlocksFromInnerBlocksTemplate(
innerBlocks
)
),
};
},
};
Expand Down
7 changes: 6 additions & 1 deletion packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,14 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
) {
__unstableMarkLastChangeAsPersistent();
}
//Unsynced patterns are nested in an array so we need to flatten them.
const replacementBlocks =
blocks?.length === 1 && Array.isArray( blocks[ 0 ] )
? blocks[ 0 ]
: blocks;
replaceBlocks(
[ ownProps.clientId ],
blocks,
replacementBlocks,
indexToSelect,
initialPosition
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ export function __experimentalUseHasBehaviorsPanel(
name,
{ blockSupportOnly = false } = {}
) {
if ( ! settings?.behaviors || ! window?.__experimentalInteractivityAPI ) {
if ( ! settings?.behaviors ) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { store as blockEditorStore } from '../../../store';
const CUSTOM_CATEGORY = {
name: 'custom',
label: __( 'My patterns' ),
description: __( 'Custom patterns add by site users' ),
description: __( 'Custom patterns added by site users' ),
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ function ReusableBlocksList( { onHover, onInsert, rootClientId } ) {
);

const filteredItems = useMemo( () => {
return items.filter( ( { category } ) => category === 'reusable' );
return items.filter(
( { category, syncStatus } ) =>
category === 'reusable' && syncStatus !== 'unsynced'
);
}, [ items ] );

if ( filteredItems.length === 0 ) {
Expand Down
12 changes: 5 additions & 7 deletions packages/block-editor/src/hooks/behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,8 @@ export const withBehaviors = createHigherOrderComponent( ( BlockEdit ) => {
};
}, 'withBehaviors' );

if ( window?.__experimentalInteractivityAPI ) {
addFilter(
'editor.BlockEdit',
'core/behaviors/with-inspector-control',
withBehaviors
);
}
addFilter(
'editor.BlockEdit',
'core/behaviors/with-inspector-control',
withBehaviors
);
Loading

0 comments on commit 50b6487

Please sign in to comment.