diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml index e2707e81f5d7cb..9d376e0ea6e2fe 100644 --- a/.github/workflows/build-plugin-zip.yml +++ b/.github/workflows/build-plugin-zip.yml @@ -10,6 +10,13 @@ on: description: 'rc or stable?' required: true +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: bump-version: name: Bump version diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml index f6111b9fb49324..cd3f591a04910f 100644 --- a/.github/workflows/bundle-size.yml +++ b/.github/workflows/bundle-size.yml @@ -2,6 +2,13 @@ name: Compressed Size on: [pull_request] +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: build: name: Check diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index 919a8a4691db8c..00000000000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Cancel -on: pull_request -jobs: - cancel: - name: 'Cancel Previous Runs' - runs-on: ubuntu-latest - timeout-minutes: 3 - steps: - - name: Get all workflow ids and set to env variable - run: echo "WORKFLOW_IDS_TO_CANCEL=$(curl https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows -s | jq -r '.workflows | map(.id|tostring) | join(",")')" >> $GITHUB_ENV - - - uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 - with: - workflow_id: ${{ env.WORKFLOW_IDS_TO_CANCEL }} - access_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/create-block.yml b/.github/workflows/create-block.yml index 435c418a86139a..76a11ff6ad69b1 100644 --- a/.github/workflows/create-block.yml +++ b/.github/workflows/create-block.yml @@ -5,6 +5,13 @@ on: push: branches: [trunk, wp/trunk] +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: checks: name: Checks diff --git a/.github/workflows/end2end-test.yml b/.github/workflows/end2end-test.yml index 97faf7f5a183d4..a6ab7b73e85a0b 100644 --- a/.github/workflows/end2end-test.yml +++ b/.github/workflows/end2end-test.yml @@ -8,6 +8,13 @@ on: - 'release/**' - 'wp/**' +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: admin: name: Admin - ${{ matrix.part }} diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index f438981e6125fa..649f9155ad5e87 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -5,6 +5,13 @@ on: release: types: [published] +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: performance: name: Run performance tests diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index 6fa1009201bc6b..e6404c34208595 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -5,6 +5,13 @@ on: push: branches: [trunk] +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: test: runs-on: macos-latest diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index 36584173a0ccad..971ef150e01260 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -5,6 +5,13 @@ on: push: branches: [trunk] +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: test: runs-on: macos-latest diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml index a5bc053d4c8e24..32508611082d69 100644 --- a/.github/workflows/static-checks.yml +++ b/.github/workflows/static-checks.yml @@ -8,6 +8,13 @@ on: - 'release/**' - 'wp/**' +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: check: name: All diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 87a598a1646e49..d5d4b06c6bcfd0 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -10,6 +10,13 @@ on: - 'release/**' - 'wp/**' +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: unit-js: name: JavaScript diff --git a/bin/build-plugin-zip.sh b/bin/build-plugin-zip.sh index a8cefd8452a3ec..6f8a36b0b81fa7 100755 --- a/bin/build-plugin-zip.sh +++ b/bin/build-plugin-zip.sh @@ -114,6 +114,7 @@ build_files=$( build/block-library/blocks/*.php \ build/block-library/blocks/*/block.json \ build/block-library/blocks/*/*.css \ + build/block-library/blocks/*/*.js \ build/edit-widgets/blocks/*/block.json \ ) diff --git a/bin/plugin/commands/performance.js b/bin/plugin/commands/performance.js index b6bea97a459e51..1af84ef1208dec 100644 --- a/bin/plugin/commands/performance.js +++ b/bin/plugin/commands/performance.js @@ -262,7 +262,7 @@ async function runPerformanceTests( branches, options ) { log( '>> Starting the WordPress environment' ); await runShellScript( 'npm run wp-env start', environmentDirectory ); - const testSuites = [ 'post-editor', 'i18n-filters', 'site-editor' ]; + const testSuites = [ 'post-editor', 'site-editor' ]; /** @type {Record>} */ let results = {}; diff --git a/changelog.txt b/changelog.txt index 299d76b93186b3..809c2494f31bf1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,21 @@ == Changelog == += 10.6.2 = + + + +### Bug Fixes + +- Workflows: Fix "Stable tag:" readme.txt field in SVN upload. ([31897](https://github.com/WordPress/gutenberg/pull/31897)) +- Gallery: Fix Image Size regression. ([31884](https://github.com/WordPress/gutenberg/pull/31884)) + +### Various + +- Plugin: Guard `construct_wp_query_args` with check if implemented in WordPress Core. ([32008](https://github.com/WordPress/gutenberg/pull/32008)) + + + + = 10.6.1 = ### Bug Fixes diff --git a/docs/how-to-guides/backward-compatibility/deprecations.md b/docs/how-to-guides/backward-compatibility/deprecations.md index df0b5af1d781ea..d2839d21a7b06d 100644 --- a/docs/how-to-guides/backward-compatibility/deprecations.md +++ b/docs/how-to-guides/backward-compatibility/deprecations.md @@ -2,6 +2,10 @@ For features included in the Gutenberg plugin, the deprecation policy is intended to support backward compatibility for two minor plugin releases, when possible. Features and code included in a stable release of WordPress are not included in this deprecation timeline, and are instead subject to the [versioning policies of the WordPress project](https://make.wordpress.org/core/handbook/about/release-cycle/version-numbering/). The current deprecations are listed below and are grouped by _the version at which they will be removed completely_. If your plugin depends on these behaviors, you must update to the recommended alternative before the noted version. +## 11.0.0 + +- `wp.blocks.registerBlockTypeFromMetadata` method has been removed. Use `wp.blocks.registerBlockType` method instead. + ## 10.3.0 - Passing a tuple of components with `as` prop to `ActionItem.Slot` component is no longer supported. Please pass a component with `as` prop instead. Example: diff --git a/docs/how-to-guides/themes/theme-json.md b/docs/how-to-guides/themes/theme-json.md index 795c9a8367ccb1..4a217a3c4d3cad 100644 --- a/docs/how-to-guides/themes/theme-json.md +++ b/docs/how-to-guides/themes/theme-json.md @@ -156,7 +156,7 @@ This field describes the format of the `theme.json` file and it's used to detect ### Settings -The settings section has the following structure and default values: +The settings section has the following structure: ```json { @@ -166,36 +166,36 @@ The settings section has the following structure and default values: "customColor": false, "customRadius": false, "customStyle": false, - "customWidth": false, + "customWidth": false }, "color": { - "custom": true, /* Supersedes add_theme_support('disable-custom-colors') */ - "customGradient": true, /* Supersedes add_theme_support('disable-custom-gradients') */ - "duotone": [], /* Duotone presets } */ - "gradients": [], /* Gradient presets, supersedes add_theme_support('editor-gradient-presets', ... ) */ - "link": false, /* Supersedes add_theme_support('experimental-link-color') */ - "palette": [], /* Color presets, supersedes add_theme_support('editor-color-palette', ... ) */ + "custom": true, + "customGradient": true, + "duotone": [], + "gradients": [], + "link": false, + "palette": [] }, "custom": {}, - "layout": { /* Default layout to be used in the post editor */ + "layout": { "contentSize": "800px", - "wideSize": "1000px", + "wideSize": "1000px" }, "spacing": { "customMargin": false, - "customPadding": false, /* Supersedes add_theme_support('custom-spacing') */ - "units": [ "px", "em", "rem", "vh", "vw" ], /* filter values, as in add_theme_support('custom-units', ... ) */ + "customPadding": false, + "units": [ "px", "em", "rem", "vh", "vw" ] }, "typography": { - "customFontSize": true, /* Supersedes add_theme_support( 'disable-custom-font-sizes' ) */ + "customFontSize": true, "customFontStyle": true, "customFontWeight": true, - "customLineHeight": false, /* Supersedes add_theme_support( 'custom-line-height' ) */ + "customLineHeight": false, "customTextDecorations": true, "customTextTransforms": true, "dropCap": true, "fontFamilies": [], - "fontSizes": [], /* Font size presets, supersedes add_theme_support('editor-font-sizes', ... ) */ + "fontSizes": [] }, "blocks": { "core/paragraph": { @@ -213,9 +213,24 @@ The settings section has the following structure and default values: } ``` + + Each block can configure any of these settings separately, providing a more fine-grained control over what exists via `add_theme_support`. The settings declared at the top-level affect to all blocks, unless a particular block overwrites it. It's a way to provide inheritance and configure all blocks at once. -To retain backward compatibility, the existing `add_theme_support` declarations that configure the block editor are retrofit in the proper categories for the top-level section. For example, if a theme uses `add_theme_support('disable-custom-colors')`, it'll be the same as setting `settings.color.custom` to `false`. If the `theme.json` contains any settings, these will take precedence over the values declared via `add_theme_support`. +To retain backward compatibility, the existing `add_theme_support` declarations that configure the block editor are retrofit in the proper categories for the top-level section. For example, if a theme uses `add_theme_support('disable-custom-colors')`, it'll be the same as setting `settings.color.custom` to `false`. If the `theme.json` contains any settings, these will take precedence over the values declared via `add_theme_support`. This is the complete list of equivalences: + +| add_theme_support | theme.json setting | +| --------------------------- | --------------------------------------------------------- | +| `custom-line-height` | Set `typography.customLineHeight`to `false`. | +| `custom-spacing` | Set `spacing.customPadding` to `true`. | +| `custom-units` | Provide the list of units via `spacing.units`. | +| `disable-custom-colors` | Set `color.custom` to `false`. | +| `disable-custom-font-sizes` | Set `typography.customFontSize` to `false`. | +| `disable-custom-gradients` | Set `color.customGradient` to `false`. | +| `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`. | Let's say a theme author wants to enable custom colors only for the paragraph block. This is how it can be done: @@ -224,12 +239,12 @@ Let's say a theme author wants to enable custom colors only for the paragraph bl "version": 1, "settings": { "color": { - "custom": false // Disable it for all blocks. + "custom": false }, "blocks": { "core/paragraph": { "color": { - "custom": true // Paragraph overrides the setting. + "custom": true } } } @@ -516,7 +531,8 @@ Each block declares which style properties it exposes via the [block supports me "h5": {}, "h6": {} } - } + }, + "etc": {} } } } @@ -688,17 +704,22 @@ h3 { Within this field themes can list the custom templates present in the `block-templates` folder. For example, for a custom template named `my-custom-template.html`, the `theme.json` can declare what post types can use it and what's the title to show the user: +- name: mandatory. +- title: mandatory, translatable. +- postTypes: optional, only applies to the `page` by default. + ```json { + "version": 1, "customTemplates": [ { - "name": "my-custom-template" /* Mandatory */, - "title": "The template title" /* Mandatory, translatable */, + "name": "my-custom-template", + "title": "The template title", "postTypes": [ "page", "post", "my-cpt" - ] /* Optional, will only apply to "page" by default. */ + ] } ] } @@ -710,12 +731,16 @@ Within this field themes can list the template parts present in the `block-templ Currently block variations exist for "header" and "footer" values of the area term, any other values and template parts not defined in the json will default to the general template part block. Variations will be denoted by specific icons within the editor's interface, will default to the corresponding semantic HTML element for the wrapper (this can also be overridden by the `tagName` attribute set on the template part block), and will contextualize the template part allowing more custom flows in future editor improvements. +- name: mandatory. +- area: optional, will be set to `uncategorized` by default and trigger no block variation. + ```json { + "version": 1, "templateParts": [ { - "name": "my-template-part" /* Mandatory */, - "area": "header" /* Optional, will be set to 'uncategorized' by default and trigger no block variation */ + "name": "my-template-part", + "area": "header" } ] } diff --git a/docs/manifest.json b/docs/manifest.json index b0a076aeaa3100..80e5b4d3a61a39 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -809,6 +809,12 @@ "markdown_source": "../packages/components/src/duotone-picker/README.md", "parent": "components" }, + { + "title": "Elevation", + "slug": "elevation", + "markdown_source": "../packages/components/src/elevation/README.md", + "parent": "components" + }, { "title": "ExternalLink", "slug": "external-link", @@ -1229,6 +1235,12 @@ "markdown_source": "../packages/components/src/visually-hidden/README.md", "parent": "components" }, + { + "title": "ZStack", + "slug": "z-stack", + "markdown_source": "../packages/components/src/z-stack/README.md", + "parent": "components" + }, { "title": "Package Reference", "slug": "packages", diff --git a/docs/reference-guides/block-api/block-metadata.md b/docs/reference-guides/block-api/block-metadata.md index 6a4160906ba3b6..8af6047da28146 100644 --- a/docs/reference-guides/block-api/block-metadata.md +++ b/docs/reference-guides/block-api/block-metadata.md @@ -470,16 +470,16 @@ Implementation follows the existing [get_plugin_data](https://codex.wordpress.or ### JavaScript -In JavaScript, you need to use `registerBlockTypeFromMetadata` method from `@wordpress/blocks` package to process loaded block metadata. All localized properties get automatically wrapped in `_x` (from `@wordpress/i18n` package) function calls similar to how it works in PHP. +In JavaScript, you can use `registerBlockType` method from `@wordpress/blocks` package and pass the metadata object loaded from `block.json` as the first param. All localized properties get automatically wrapped in `_x` (from `@wordpress/i18n` package) function calls similar to how it works in PHP. **Example:** ```js -import { registerBlockTypeFromMetadata } from '@wordpress/blocks'; +import { registerBlockType } from '@wordpress/blocks'; import Edit from './edit'; import metadata from './block.json'; -registerBlockTypeFromMetadata( metadata, { +registerBlockType( metadata, { edit: Edit, // ...other client-side settings } ); diff --git a/docs/reference-guides/richtext.md b/docs/reference-guides/richtext.md index c34e36ff6b7473..d4cd616303c23e 100644 --- a/docs/reference-guides/richtext.md +++ b/docs/reference-guides/richtext.md @@ -110,13 +110,6 @@ wp.blocks.registerBlockType( /* ... */, { While using the RichText component a number of common issues tend to appear. -### Placeholder Content Separates from the Input - -In some cases the placeholder content on RichText can appear separate from the input where you would write your content. This is likely due to one of two reasons: - -1. You can't have an element with the CSS `display` property set to `inline`. You will need to set it to `inline-block` or any other value. -2. The `position` CSS property value for the element must be set to `relative` or `absolute` within the admin. If the styles within style.css or editor.css modify the `position` property value for this element, you may see issues with how it displays. - ### HTML Formatting Tags Display in the Content If the HTML tags from text formatting such as `` or `` are being escaped and displayed on the frontend of the site, this is likely due to an issue in your save function. Make sure your code looks something like `` (ESNext) within your save function instead of simply outputting the value with `

{ heading }

`. diff --git a/gutenberg.php b/gutenberg.php index 490b7a04584cbf..7b5d63fbef6e41 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the new block editor in core. * Requires at least: 5.6 * Requires PHP: 5.6 - * Version: 10.6.1 + * Version: 10.7.0-rc.1 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 22773bb3a56ba9..ccc6f8bbf7b68e 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -185,10 +185,9 @@ function register_gutenberg_patterns() { } /** - * Deactivate the legacy patterns bundled with WordPress, and add new block patterns for testing. - * More details in the trac issue (https://core.trac.wordpress.org/ticket/52846). + * Deactivate the legacy patterns bundled with WordPress. */ -function update_core_patterns() { +function remove_core_patterns() { $core_block_patterns = array( 'text-two-columns', 'two-buttons', @@ -202,36 +201,34 @@ function update_core_patterns() { 'quote', ); - $new_core_block_patterns = array( - 'media-text-nature', - 'two-images-gallery', - 'three-columns-media-text', - 'quote', - 'large-header-left', - 'large-header-text-button', - 'media-text-art', - 'text-two-columns-title', - 'three-columns-text', - 'text-two-columns-title-offset', - 'heading', - 'three-images-gallery', - 'text-two-columns', - 'media-text-arquitecture', - 'two-buttons', - ); - foreach ( $core_block_patterns as $core_block_pattern ) { $name = 'core/' . $core_block_pattern; if ( WP_Block_Patterns_Registry::get_instance()->is_registered( $name ) ) { unregister_block_pattern( $name ); } } +} + +/** + * Import patterns from wordpress.org/patterns. + */ +function load_remote_patterns() { + $patterns = get_transient( 'gutenberg_remote_block_patterns' ); + if ( ! $patterns ) { + $request = new WP_REST_Request( 'GET', '/__experimental/pattern-directory/patterns' ); + $core_keyword_id = 11; // 11 is the ID for "core". + $request->set_param( 'keyword', $core_keyword_id ); + $response = rest_do_request( $request ); + if ( $response->is_error() ) { + return; + } + $patterns = $response->get_data(); + set_transient( 'gutenberg_remote_block_patterns', $patterns, HOUR_IN_SECONDS ); + } - foreach ( $new_core_block_patterns as $core_block_pattern ) { - register_block_pattern( - 'core/' . $core_block_pattern, - require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php' - ); + foreach ( $patterns as $settings ) { + $pattern_name = 'core/' . sanitize_title( $settings['title'] ); + register_block_pattern( $pattern_name, (array) $settings ); } } @@ -242,7 +239,21 @@ function() { if ( ! get_theme_support( 'core-block-patterns' ) || ! function_exists( 'unregister_block_pattern' ) ) { return; } + remove_core_patterns(); register_gutenberg_patterns(); - update_core_patterns(); + } +); + +add_action( + 'current_screen', + function( $current_screen ) { + if ( ! get_theme_support( 'core-block-patterns' ) ) { + return; + } + + $is_site_editor = ( function_exists( 'gutenberg_is_edit_site_page' ) && gutenberg_is_edit_site_page( $current_screen->id ) ); + if ( $current_screen->is_block_editor || $is_site_editor ) { + load_remote_patterns(); + } } ); diff --git a/lib/block-patterns/heading.php b/lib/block-patterns/heading.php deleted file mode 100644 index 571ff91fa36c4a..00000000000000 --- a/lib/block-patterns/heading.php +++ /dev/null @@ -1,16 +0,0 @@ - _x( 'Heading', 'Block pattern title', 'default' ), - 'categories' => array( 'text' ), - 'blockTypes' => array( 'core/heading' ), - 'content' => ' -

' . esc_html__( "We're a studio in Berlin with an international practice in architecture, urban planning and interior design. We believe in sharing knowledge and promoting dialogue to increase the creative potential of collaboration.", 'default' ) . '

- ', - 'description' => _x( 'Heading text', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/large-header-left.php b/lib/block-patterns/large-header-left.php deleted file mode 100644 index 6b2da580360075..00000000000000 --- a/lib/block-patterns/large-header-left.php +++ /dev/null @@ -1,33 +0,0 @@ - _x( 'Large header with left-aligned text', 'Block pattern title', 'default' ), - 'categories' => array( 'header' ), - 'content' => ' -
-

' . esc_html__( 'Forest.', 'default' ) . '

- - - -
-
- - - - -

' . esc_html__( 'Even a child knows how valuable the forest is. The fresh, breathtaking smell of trees. Echoing birds flying above that dense magnitude. A stable climate, a sustainable diverse life and a source of culture. Yet, forests and other ecosystems hang in the balance, threatened to become croplands, pasture, and plantations.', 'default' ) . '

-
- - - -
-
-
- ', - 'description' => _x( 'Cover image with quote on top', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/large-header-text-button.php b/lib/block-patterns/large-header-text-button.php deleted file mode 100644 index 6f7d4d9f5a4111..00000000000000 --- a/lib/block-patterns/large-header-text-button.php +++ /dev/null @@ -1,35 +0,0 @@ - _x( 'Large header with text and a button.', 'Block pattern title', 'default' ), - 'categories' => array( 'header' ), - 'content' => ' -
-

' . esc_html__( 'Overseas:', 'default' ) . '
' . esc_html__( '1500 — 1960', 'default' ) . '

- - - -
-
-

' . wp_kses_post( __( 'An exhibition about the different representations of the ocean throughout time, between the sixteenth and the twentieth century. Taking place in our Open Room in Floor 2.', 'default' ) ) . '

- - - - -
- - - -
-
-
- ', - 'description' => _x( 'Large header with background image and text and button on top', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/media-text-arquitecture.php b/lib/block-patterns/media-text-arquitecture.php deleted file mode 100644 index ba7cf9521e7e59..00000000000000 --- a/lib/block-patterns/media-text-arquitecture.php +++ /dev/null @@ -1,21 +0,0 @@ - _x( 'Media and text with image on the right', 'Block pattern title', 'default' ), - 'categories' => array( 'header' ), - 'content' => ' -
' . esc_attr__( 'Close-up, abstract view of architecture.', 'default' ) . '
-

' . esc_html__( 'Open Spaces', 'default' ) . '

- - - -

' . esc_html__( 'See case study ↗', 'default' ) . '

-
- ', - 'description' => _x( 'Media and text block with image to the left and text to the right', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/media-text-art.php b/lib/block-patterns/media-text-art.php deleted file mode 100644 index 85ed71d41a6f18..00000000000000 --- a/lib/block-patterns/media-text-art.php +++ /dev/null @@ -1,21 +0,0 @@ - _x( 'Media & text with image on the right', 'Block pattern title', 'default' ), - 'categories' => array( 'header' ), - 'content' => ' -
' . esc_attr__( 'A green and brown rural landscape leading into a bright blue ocean and slightly cloudy sky, done in oil paints.', 'default' ) . '
-

' . esc_html__( 'Shore with Blue Sea', 'default' ) . '

- - - -

' . esc_html__( 'Eleanor Harris (American, 1901-1942)', 'default' ) . '

-
- ', - 'description' => _x( 'Media and text block with image to the right and text to the left', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/media-text-nature.php b/lib/block-patterns/media-text-nature.php deleted file mode 100644 index e51f8514531b7a..00000000000000 --- a/lib/block-patterns/media-text-nature.php +++ /dev/null @@ -1,28 +0,0 @@ - _x( 'Media & text in a full height container', 'Block pattern title', 'default' ), - 'categories' => array( 'header' ), - 'content' => ' -
-
' . esc_attr__( 'Close-up of dried, cracked earth.', 'default' ) . '
-

' . esc_html__( "What's the problem?", 'default' ) . '

- - - -

' . esc_html__( 'Trees are more important today than ever before. More than 10,000 products are reportedly made from trees. Through chemistry, the humble woodpile is yielding chemicals, plastics and fabrics that were beyond comprehension when an axe first felled a Texas tree.', 'default' ) . '

- - - -
-
- ', - 'description' => _x( 'Media and text block with image to the left and text and button to the right', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/quote.php b/lib/block-patterns/quote.php deleted file mode 100644 index bbb844472f05c5..00000000000000 --- a/lib/block-patterns/quote.php +++ /dev/null @@ -1,30 +0,0 @@ - _x( 'Quote', 'Block pattern title', 'default' ), - 'categories' => array( 'text' ), - 'blockTypes' => array( 'core/quote' ), - 'content' => ' -
-
- - - -
' . esc_attr__( 'A side profile of a woman in a russet-colored turtleneck and white bag. She looks up with her eyes closed.', 'default' ) . '
- - - -

' . esc_html__( "\"Contributing makes me feel like I'm being useful to the planet.\"", 'default' ) . '

' . wp_kses_post( __( '— Anna Wong, Volunteer', 'default' ) ) . '
- - - -
-
- ', - 'description' => _x( 'Testimonial quote with portrait', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/text-two-columns-title-offset.php b/lib/block-patterns/text-two-columns-title-offset.php deleted file mode 100644 index e080234ef3af0c..00000000000000 --- a/lib/block-patterns/text-two-columns-title-offset.php +++ /dev/null @@ -1,53 +0,0 @@ - _x( 'Two columns of text with offset heading', 'Block pattern title', 'default' ), - 'categories' => array( 'columns', 'text' ), - 'content' => ' -
- - - - -
-
-

' . esc_html__( 'Oceanic Inspiration', 'default' ) . '

-
- - - -
-
-
-
- - - -
-
- - - -
-

' . esc_html__( 'Winding veils round their heads, the women walked on deck. They were now moving steadily down the river, passing the dark shapes of ships at anchor, and London was a swarm of lights with a pale yellow canopy drooping above it. There were the lights of the great theatres, the lights of the long streets, lights that indicated huge squares of domestic comfort, lights that hung high in air.', 'default' ) . '

-
- - - -
-

' . esc_html__( 'No darkness would ever settle upon those lamps, as no darkness had settled upon them for hundreds of years. It seemed dreadful that the town should blaze for ever in the same spot; dreadful at least to people going away to adventure upon the sea, and beholding it as a circumscribed mound, eternally burnt, eternally scarred. From the deck of the ship the great city appeared a crouched and cowardly figure, a sedentary miser.', 'default' ) . '

-
-
- - - - -
- ', - 'description' => _x( 'Two columns of text with offset heading', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/text-two-columns-title.php b/lib/block-patterns/text-two-columns-title.php deleted file mode 100644 index c21f8f220ed50b..00000000000000 --- a/lib/block-patterns/text-two-columns-title.php +++ /dev/null @@ -1,31 +0,0 @@ - _x( 'Two columns text and title', 'Block pattern title', 'default' ), - 'categories' => array( 'columns', 'text' ), - 'content' => ' -
-

' . esc_html__( 'The voyage had begun, and had begun happily with a soft blue sky, and a calm sea.', 'default' ) . '

- - - -
-
-

' . esc_html__( 'They followed her on to the deck. All the smoke and the houses had disappeared, and the ship was out in a wide space of sea very fresh and clear though pale in the early light. They had left London sitting on its mud. A very thin line of shadow tapered on the horizon, scarcely thick enough to stand the burden of Paris, which nevertheless rested upon it. They were free of roads, free of mankind, and the same exhilaration at their freedom ran through them all.', 'default' ) . '

-
- - - -
-

' . esc_html__( "The ship was making her way steadily through small waves which slapped her and then fizzled like effervescing water, leaving a little border of bubbles and foam on either side. The colourless October sky above was thinly clouded as if by the trail of wood-fire smoke, and the air was wonderfully salt and brisk. Indeed it was too cold to stand still. Mrs. Ambrose drew her arm within her husband's, and as they moved off it could be seen from the way in which her sloping cheek turned up to his that she had something private to communicate.", 'default' ) . '

-
-
-
- ', - 'description' => _x( 'Two columns text and title', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/text-two-columns.php b/lib/block-patterns/text-two-columns.php deleted file mode 100644 index 7ab157d8ca1ae7..00000000000000 --- a/lib/block-patterns/text-two-columns.php +++ /dev/null @@ -1,44 +0,0 @@ - _x( 'Two columns of text', 'Block pattern title', 'default' ), - 'categories' => array( 'columns', 'text' ), - 'content' => ' -
-
- - - -

' . esc_html__( 'We have worked with:', 'default' ) . '

- - - -

' . wp_kses_post( __( 'EARTHFUND™
ARCHWEEKLY
FUTURE ROADS
BUILDING NY', 'default' ) ) . '

- - - - -
- - - - -
- ', - 'description' => _x( 'Two columns of text', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/three-columns-media-text.php b/lib/block-patterns/three-columns-media-text.php deleted file mode 100644 index 7b0652aaed5765..00000000000000 --- a/lib/block-patterns/three-columns-media-text.php +++ /dev/null @@ -1,69 +0,0 @@ - _x( 'Three columns with images and text', 'Block pattern title', 'default' ), - 'categories' => array( 'columns' ), - 'content' => ' -
-
-
- - - - -
' . esc_html__( 'ECOLOGY', 'default' ) . '
- - - -

' . esc_html__( 'Natural resources.', 'default' ) . '

- - -
-
- - - -
-
-

' . wp_kses_post( __( 'Nature, in the common sense, refers to essences unchanged by man; space, the air, the river, the leaf. Art is applied to the mixture of his will with the same things, as in a house, a canal, a statue, a picture. But his operations taken together are so insignificant, a little chipping, baking, patching, and washing, that in an impression so grand as that of the world on the human mind, they do not vary the result.', 'default' ) ) . '

-
- - - -
- - - - -
' . esc_attr__( 'The sun setting through a dense forest of trees.', 'default' ) . '
-
- - - -
-
' . esc_attr__( 'Wind turbines standing on a grassy plain, against a blue sky.', 'default' ) . '
-
-
- - - -
-
-
' . esc_attr__( 'The sun shining over a ridge leading down into the shore. In the distance, a car drives down a road.', 'default' ) . '
-
- - - -
-

' . esc_html__( "Undoubtedly we have no questions to ask which are unanswerable. We must trust the perfection of the creation so far, as to believe that whatever curiosity the order of things has awakened in our minds, the order of things can satisfy. Every man's condition is a solution in hieroglyphic to those inquiries he would put.", 'default' ) . '

-
-
-
- ', - 'description' => _x( 'Three columns with images and text', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/three-columns-text.php b/lib/block-patterns/three-columns-text.php deleted file mode 100644 index 8d6b14b8ba467f..00000000000000 --- a/lib/block-patterns/three-columns-text.php +++ /dev/null @@ -1,43 +0,0 @@ - _x( 'Three columns of text', 'Block pattern title', 'default' ), - 'categories' => array( 'columns', 'text' ), - 'content' => ' -
-
-

' . esc_html__( 'Virtual Tour ↗', 'default' ) . '

- - - -

' . esc_html__( 'Get a virtual tour of the museum. Ideal for schools and events.', 'default' ) . '

-
- - - -
-

' . esc_html__( 'Current Shows ↗', 'default' ) . '

- - - -

' . esc_html__( 'Stay updated and see our current exhibitions here.', 'default' ) . '

-
- - - -
-

' . esc_html__( 'Useful Info ↗', 'default' ) . '

- - - -

' . esc_html__( 'Get to know our opening times, ticket prices and discounts.', 'default' ) . '

-
-
- ', - 'description' => _x( 'Three columns of text', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/three-images-gallery.php b/lib/block-patterns/three-images-gallery.php deleted file mode 100644 index 8b5d9be1bbc4a4..00000000000000 --- a/lib/block-patterns/three-images-gallery.php +++ /dev/null @@ -1,43 +0,0 @@ - _x( 'Three columns with offset images', 'Block pattern title', 'default' ), - 'categories' => array( 'gallery' ), - 'content' => ' -
-
-
' . esc_attr__( 'Close-up, abstract view of geometric architecture.', 'default' ) . '
-
- - - -
- - - - - - - - -
' . esc_attr__( 'Close-up, angled view of a window on a white building.', 'default' ) . '
-
- - - -
-
' . esc_attr__( 'Close-up of the corner of a white, geometric building with both sharp points and round corners.', 'default' ) . '
- - - - -
-
- ', - 'description' => _x( 'Three columns with offset images', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/two-buttons.php b/lib/block-patterns/two-buttons.php deleted file mode 100644 index b369fd31ff2ba7..00000000000000 --- a/lib/block-patterns/two-buttons.php +++ /dev/null @@ -1,22 +0,0 @@ - _x( 'Two buttons', 'Block pattern title', 'default' ), - 'content' => ' - - ', - 'viewportWidth' => 500, - 'categories' => array( 'buttons' ), - 'description' => _x( 'Two buttons, one filled and one outlined, side by side.', 'Block pattern description', 'default' ), -); diff --git a/lib/block-patterns/two-images-gallery.php b/lib/block-patterns/two-images-gallery.php deleted file mode 100644 index ec9e413ee31208..00000000000000 --- a/lib/block-patterns/two-images-gallery.php +++ /dev/null @@ -1,15 +0,0 @@ - _x( 'Two images side by side', 'Block pattern title', 'default' ), - 'categories' => array( 'gallery' ), - 'content' => ' - - ', - 'description' => _x( 'Two images side by side', 'Block pattern description', 'default' ), -); diff --git a/lib/block-supports/colors.php b/lib/block-supports/colors.php index afdc3500d31645..72e3e45ffcb3d8 100644 --- a/lib/block-supports/colors.php +++ b/lib/block-supports/colors.php @@ -76,7 +76,6 @@ function gutenberg_apply_colors_support( $block_type, $block_attributes ) { $has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) ); $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) ); - $has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false ); $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false ); $classes = array(); $styles = array(); diff --git a/lib/block-supports/elements.php b/lib/block-supports/elements.php index a55bffe1c2e849..85a12b582de511 100644 --- a/lib/block-supports/elements.php +++ b/lib/block-supports/elements.php @@ -13,7 +13,6 @@ * @return string Filtered block content. */ function gutenberg_render_elements_support( $block_content, $block ) { - $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] ); $link_color = _wp_array_get( $block['attrs'], array( 'style', 'elements', 'link', 'color', 'text' ), null ); /* @@ -40,7 +39,7 @@ function gutenberg_render_elements_support( $block_content, $block ) { // Like the layout hook this assumes the hook only applies to blocks with a single wrapper. // Retrieve the opening tag of the first HTML element. - $html_element_matches; + $html_element_matches = array(); preg_match( '/<[^>]+>/', $block_content, $html_element_matches, PREG_OFFSET_CAPTURE ); $first_element = $html_element_matches[0][0]; // If the first HTML element has a class attribute just add the new class diff --git a/lib/class-wp-rest-menus-controller.php b/lib/class-wp-rest-menus-controller.php index dc358ea850f1d0..84fc22952aa28e 100644 --- a/lib/class-wp-rest-menus-controller.php +++ b/lib/class-wp-rest-menus-controller.php @@ -189,6 +189,10 @@ public function prepare_item_for_response( $term, $request ) { $fields = $this->get_fields_for_response( $request ); $data = $response->get_data(); + if ( in_array( 'locations', $fields, true ) ) { + $data['locations'] = $this->get_menu_locations( $nav_menu->term_id ); + } + if ( in_array( 'auto_add', $fields, true ) ) { $auto_add = $this->get_menu_auto_add( $nav_menu->term_id ); $data['auto_add'] = $auto_add; @@ -215,16 +219,14 @@ public function prepare_item_for_response( $term, $request ) { protected function prepare_links( $term ) { $links = parent::prepare_links( $term ); - $locations = get_nav_menu_locations(); + $locations = $this->get_menu_locations( $term->term_id ); $rest_base = 'menu-locations'; - foreach ( $locations as $menu_name => $menu_id ) { - if ( $term->term_id === $menu_id ) { - $url = rest_url( sprintf( '__experimental/%s/%s', $rest_base, $menu_name ) ); - $links['https://api.w.org/menu-location'][] = array( - 'href' => $url, - 'embeddable' => true, - ); - } + foreach ( $locations as $location ) { + $url = rest_url( sprintf( '__experimental/%s/%s', $rest_base, $location ) ); + $links['https://api.w.org/menu-location'][] = array( + 'href' => $url, + 'embeddable' => true, + ); } return $links; @@ -531,6 +533,28 @@ function handle_auto_add( $menu_id, $request ) { return $update; } + /** + * Returns names of the locations assigned to the menu. + * + * @since 5.8.0 + * + * @param int $menu_id The menu id. + * + * @return string[] $menu_locations The locations assigned to the menu. + */ + protected function get_menu_locations( $menu_id ) { + $locations = get_nav_menu_locations(); + $menu_locations = array(); + + foreach ( $locations as $location => $assigned_menu_id ) { + if ( $menu_id === $assigned_menu_id ) { + $menu_locations[] = $location; + } + } + + return $menu_locations; + } + /** * Updates the menu's locations from a REST request. * diff --git a/lib/class-wp-theme-json-resolver.php b/lib/class-wp-theme-json-resolver.php index 4df3881a72c565..96e04f43c80216 100644 --- a/lib/class-wp-theme-json-resolver.php +++ b/lib/class-wp-theme-json-resolver.php @@ -419,7 +419,7 @@ public static function get_merged_data( $settings = array(), $origin = 'user' ) $result->merge( self::get_theme_data( $theme_support_data ) ); if ( 'user' === $origin ) { - $result->merge( self::get_user_data() ); + $result->merge( self::get_user_data(), 'update' ); } return $result; diff --git a/lib/class-wp-theme-json.php b/lib/class-wp-theme-json.php index 6734d439b10f9b..2b1600a82236bc 100644 --- a/lib/class-wp-theme-json.php +++ b/lib/class-wp-theme-json.php @@ -205,54 +205,54 @@ class WP_Theme_JSON { * - 'value': path to the value in theme.json and block attributes. */ const PROPERTIES_METADATA = array( - 'background' => array( + 'background' => array( 'value' => array( 'color', 'gradient' ), ), - 'background-color' => array( + 'background-color' => array( 'value' => array( 'color', 'background' ), ), - 'border-radius' => array( + 'border-radius' => array( 'value' => array( 'border', 'radius' ), ), - 'border-color' => array( + 'border-color' => array( 'value' => array( 'border', 'color' ), ), - 'border-width' => array( + 'border-width' => array( 'value' => array( 'border', 'width' ), ), - 'border-style' => array( + 'border-style' => array( 'value' => array( 'border', 'style' ), ), - 'color' => array( + 'color' => array( 'value' => array( 'color', 'text' ), ), - 'font-family' => array( + 'font-family' => array( 'value' => array( 'typography', 'fontFamily' ), ), - 'font-size' => array( + 'font-size' => array( 'value' => array( 'typography', 'fontSize' ), ), - 'font-style' => array( + 'font-style' => array( 'value' => array( 'typography', 'fontStyle' ), ), - 'font-weight' => array( + 'font-weight' => array( 'value' => array( 'typography', 'fontWeight' ), ), - 'line-height' => array( + 'line-height' => array( 'value' => array( 'typography', 'lineHeight' ), ), - 'margin' => array( + 'margin' => array( 'value' => array( 'spacing', 'margin' ), 'properties' => array( 'top', 'right', 'bottom', 'left' ), ), - 'padding' => array( + 'padding' => array( 'value' => array( 'spacing', 'padding' ), 'properties' => array( 'top', 'right', 'bottom', 'left' ), ), - 'text-decoration' => array( + 'text-decoration' => array( 'value' => array( 'typography', 'textDecoration' ), ), - 'text-transform' => array( + 'text-transform' => array( 'value' => array( 'typography', 'textTransform' ), ), ); @@ -1076,33 +1076,85 @@ public function get_stylesheet( $type = 'all' ) { * Merge new incoming data. * * @param WP_Theme_JSON $incoming Data to merge. + * @param string $update_or_remove Whether update or remove existing colors + * for which the incoming data has a duplicated slug. */ - public function merge( $incoming ) { - $incoming_data = $incoming->get_raw_data(); - $this->theme_json = array_replace_recursive( $this->theme_json, $incoming_data ); + public function merge( $incoming, $update_or_remove = 'remove' ) { + $incoming_data = $incoming->get_raw_data(); + $existing_data = $this->theme_json; // The array_replace_recursive algorithm merges at the leaf level. // For leaf values that are arrays it will use the numeric indexes for replacement. - // In those cases, what we want is to use the incoming value, if it exists. - // - // These are the cases that have array values at the leaf levels. - $properties = array(); - $properties[] = array( 'color', 'palette' ); - $properties[] = array( 'color', 'gradients' ); - $properties[] = array( 'custom' ); - $properties[] = array( 'spacing', 'units' ); - $properties[] = array( 'typography', 'fontSizes' ); - $properties[] = array( 'typography', 'fontFamilies' ); + $this->theme_json = array_replace_recursive( $this->theme_json, $incoming_data ); + + // There are a few cases in which we want to merge things differently + // from what array_replace_recursive does. + + // Some incoming properties should replace the existing. + $to_replace = array(); + $to_replace[] = array( 'custom' ); + $to_replace[] = array( 'spacing', 'units' ); + $to_replace[] = array( 'typography', 'fontSizes' ); + $to_replace[] = array( 'typography', 'fontFamilies' ); + + // Some others should be appended to the existing. + // If the slug is the same than an existing element, + // the $update_or_remove param is used to decide + // what to do with the existing element: + // either remove it and append the incoming, + // or update it with the incoming. + $to_append = array(); + $to_append[] = array( 'color', 'duotone' ); + $to_append[] = array( 'color', 'gradients' ); + $to_append[] = array( 'color', 'palette' ); $nodes = self::get_setting_nodes( $this->theme_json ); foreach ( $nodes as $metadata ) { - foreach ( $properties as $property_path ) { - $path = array_merge( $metadata['path'], $property_path ); + foreach ( $to_replace as $path_to_replace ) { + $path = array_merge( $metadata['path'], $path_to_replace ); $node = _wp_array_get( $incoming_data, $path, array() ); if ( ! empty( $node ) ) { gutenberg_experimental_set( $this->theme_json, $path, $node ); } } + foreach ( $to_append as $path_to_append ) { + $path = array_merge( $metadata['path'], $path_to_append ); + $incoming_node = _wp_array_get( $incoming_data, $path, array() ); + $existing_node = _wp_array_get( $existing_data, $path, array() ); + + if ( empty( $incoming_node ) && empty( $existing_node ) ) { + continue; + } + + $index_table = array(); + $existing_slugs = array(); + $merged = array(); + foreach ( $existing_node as $key => $value ) { + $index_table[ $value['slug'] ] = $key; + $existing_slugs[] = $value['slug']; + $merged[ $key ] = $value; + } + + $to_remove = array(); + foreach ( $incoming_node as $value ) { + if ( ! in_array( $value['slug'], $existing_slugs, true ) ) { + $merged[] = $value; + } elseif ( 'update' === $update_or_remove ) { + $merged[ $index_table[ $value['slug'] ] ] = $value; + } else { + $merged[] = $value; + $to_remove[] = $index_table[ $value['slug'] ]; + } + } + + // Remove the duplicated values and pack the sparsed array. + foreach ( $to_remove as $index ) { + unset( $merged[ $index ] ); + } + $merged = array_values( $merged ); + + gutenberg_experimental_set( $this->theme_json, $path, $merged ); + } } } @@ -1162,12 +1214,11 @@ private static function remove_insecure_settings( $input ) { * Processes a style node and returns the same node * without the insecure styles. * - * @param array $input Node to process. - * @param string $selector Selector for the node. + * @param array $input Node to process. * * @return array */ - private static function remove_insecure_styles( $input, $selector ) { + private static function remove_insecure_styles( $input ) { $output = array(); $declarations = self::compute_style_properties( $input ); @@ -1212,7 +1263,7 @@ public function remove_insecure_properties() { continue; } - $output = self::remove_insecure_styles( $input, $metadata['selector'] ); + $output = self::remove_insecure_styles( $input ); if ( ! empty( $output ) ) { gutenberg_experimental_set( $sanitized, $metadata['path'], $output ); } diff --git a/lib/compat.php b/lib/compat.php index ff7e4a1a2000ec..1347810bf38845 100644 --- a/lib/compat.php +++ b/lib/compat.php @@ -90,7 +90,7 @@ function gutenberg_inject_default_block_context( $args ) { if ( is_callable( $args['render_callback'] ) ) { $block_render_callback = $args['render_callback']; $args['render_callback'] = function( $attributes, $content, $block = null ) use ( $block_render_callback ) { - global $post, $wp_query; + global $post; // Check for null for back compatibility with WP_Block_Type->render // which is unused since the introduction of WP_Block class. @@ -127,39 +127,6 @@ function gutenberg_inject_default_block_context( $args ) { $block->context['postType'] = $post->post_type; } - // Inject the query context if not done by Core. - $needs_query = ! empty( $block_type->uses_context ) && in_array( 'query', $block_type->uses_context, true ); - if ( ! isset( $block->context['query'] ) && $needs_query ) { - if ( isset( $wp_query->tax_query->queried_terms['category'] ) ) { - $block->context['query'] = array( 'categoryIds' => array() ); - - foreach ( $wp_query->tax_query->queried_terms['category']['terms'] as $category_slug_or_id ) { - $block->context['query']['categoryIds'][] = 'slug' === $wp_query->tax_query->queried_terms['category']['field'] ? get_cat_ID( $category_slug_or_id ) : $category_slug_or_id; - } - } - - if ( isset( $wp_query->tax_query->queried_terms['post_tag'] ) ) { - if ( isset( $block->context['query'] ) ) { - $block->context['query']['tagIds'] = array(); - } else { - $block->context['query'] = array( 'tagIds' => array() ); - } - - foreach ( $wp_query->tax_query->queried_terms['post_tag']['terms'] as $tag_slug_or_id ) { - $tag_ID = $tag_slug_or_id; - - if ( 'slug' === $wp_query->tax_query->queried_terms['post_tag']['field'] ) { - $tag = get_term_by( 'slug', $tag_slug_or_id, 'post_tag' ); - - if ( $tag ) { - $tag_ID = $tag->term_id; - } - } - $block->context['query']['tagIds'][] = $tag_ID; - } - } - } - return $block_render_callback( $attributes, $content, $block ); }; } diff --git a/lib/compat/wordpress-5.8.php b/lib/compat/wordpress-5.8.php index 609db3cf9c605c..0129fa91c4a7ca 100644 --- a/lib/compat/wordpress-5.8.php +++ b/lib/compat/wordpress-5.8.php @@ -7,7 +7,7 @@ * @package gutenberg */ -if ( ! function_exists( 'construct_wp_query_args' ) ) { +if ( ! function_exists( 'build_query_vars_from_query_block' ) ) { /** * Helper function that constructs a WP_Query args array from * a `Query` block properties. @@ -19,7 +19,7 @@ * * @return array Returns the constructed WP_Query arguments. */ - function construct_wp_query_args( $block, $page ) { + function build_query_vars_from_query_block( $block, $page ) { $query = array( 'post_type' => 'post', 'order' => 'DESC', diff --git a/lib/experimental-default-theme.json b/lib/experimental-default-theme.json index d92547a1468952..dc4dbbaf058529 100644 --- a/lib/experimental-default-theme.json +++ b/lib/experimental-default-theme.json @@ -6,124 +6,148 @@ { "name": "Black", "slug": "black", - "color": "#000000" + "color": "#000000", + "origin": "core" }, { "name": "Cyan bluish gray", "slug": "cyan-bluish-gray", - "color": "#abb8c3" + "color": "#abb8c3", + "origin": "core" }, { "name": "White", "slug": "white", - "color": "#ffffff" + "color": "#ffffff", + "origin": "core" }, { "name": "Pale pink", "slug": "pale-pink", - "color": "#f78da7" + "color": "#f78da7", + "origin": "core" }, { "name": "Vivid red", "slug": "vivid-red", - "color": "#cf2e2e" + "color": "#cf2e2e", + "origin": "core" }, { "name": "Luminous vivid orange", "slug": "luminous-vivid-orange", - "color": "#ff6900" + "color": "#ff6900", + "origin": "core" }, { "name": "Luminous vivid amber", "slug": "luminous-vivid-amber", - "color": "#fcb900" + "color": "#fcb900", + "origin": "core" }, { "name": "Light green cyan", "slug": "light-green-cyan", - "color": "#7bdcb5" + "color": "#7bdcb5", + "origin": "core" }, { "name": "Vivid green cyan", "slug": "vivid-green-cyan", - "color": "#00d084" + "color": "#00d084", + "origin": "core" }, { "name": "Pale cyan blue", "slug": "pale-cyan-blue", - "color": "#8ed1fc" + "color": "#8ed1fc", + "origin": "core" }, { "name": "Vivid cyan blue", "slug": "vivid-cyan-blue", - "color": "#0693e3" + "color": "#0693e3", + "origin": "core" }, { "name": "Vivid purple", "slug": "vivid-purple", - "color": "#9b51e0" + "color": "#9b51e0", + "origin": "core" } ], "gradients": [ { "name": "Vivid cyan blue to vivid purple", "gradient": "linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)", - "slug": "vivid-cyan-blue-to-vivid-purple" + "slug": "vivid-cyan-blue-to-vivid-purple", + "origin": "core" }, { "name": "Light green cyan to vivid green cyan", "gradient": "linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)", - "slug": "light-green-cyan-to-vivid-green-cyan" + "slug": "light-green-cyan-to-vivid-green-cyan", + "origin": "core" }, { "name": "Luminous vivid amber to luminous vivid orange", "gradient": "linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)", - "slug": "luminous-vivid-amber-to-luminous-vivid-orange" + "slug": "luminous-vivid-amber-to-luminous-vivid-orange", + "origin": "core" }, { "name": "Luminous vivid orange to vivid red", "gradient": "linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)", - "slug": "luminous-vivid-orange-to-vivid-red" + "slug": "luminous-vivid-orange-to-vivid-red", + "origin": "core" }, { "name": "Very light gray to cyan bluish gray", "gradient": "linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)", - "slug": "very-light-gray-to-cyan-bluish-gray" + "slug": "very-light-gray-to-cyan-bluish-gray", + "origin": "core" }, { "name": "Cool to warm spectrum", "gradient": "linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)", - "slug": "cool-to-warm-spectrum" + "slug": "cool-to-warm-spectrum", + "origin": "core" }, { "name": "Blush light purple", "gradient": "linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)", - "slug": "blush-light-purple" + "slug": "blush-light-purple", + "origin": "core" }, { "name": "Blush bordeaux", "gradient": "linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)", - "slug": "blush-bordeaux" + "slug": "blush-bordeaux", + "origin": "core" }, { "name": "Luminous dusk", "gradient": "linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)", - "slug": "luminous-dusk" + "slug": "luminous-dusk", + "origin": "core" }, { "name": "Pale ocean", "gradient": "linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)", - "slug": "pale-ocean" + "slug": "pale-ocean", + "origin": "core" }, { "name": "Electric grass", "gradient": "linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)", - "slug": "electric-grass" + "slug": "electric-grass", + "origin": "core" }, { "name": "Midnight", "gradient": "linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)", - "slug": "midnight" + "slug": "midnight", + "origin": "core" } ], "duotone": [ diff --git a/lib/full-site-editing/templates.php b/lib/full-site-editing/templates.php index 08048b5b4b06e4..3b15473692680e 100644 --- a/lib/full-site-editing/templates.php +++ b/lib/full-site-editing/templates.php @@ -5,25 +5,6 @@ * @package gutenberg */ -/** - * Returns all block template file path of the current theme and its parent theme. - * Includes demo block template files if demo experiment is enabled. - * - * @return array $block_template_files A list of paths to all template files. - */ -function gutenberg_get_template_paths() { - $block_template_files = glob( get_stylesheet_directory() . '/block-templates/*.html' ); - $block_template_files = is_array( $block_template_files ) ? $block_template_files : array(); - - if ( is_child_theme() ) { - $child_block_template_files = glob( get_template_directory() . '/block-templates/*.html' ); - $child_block_template_files = is_array( $child_block_template_files ) ? $child_block_template_files : array(); - $block_template_files = array_merge( $block_template_files, $child_block_template_files ); - } - - return $block_template_files; -} - /** * Registers block editor 'wp_template' post type. */ diff --git a/lib/global-styles.php b/lib/global-styles.php index 8d5552e5e7244c..331649d5ba5a72 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -92,7 +92,8 @@ function_exists( 'gutenberg_is_edit_site_page' ) && defined( 'REST_REQUEST' ) && REST_REQUEST && isset( $_GET['context'] ) && - 'mobile' === $_GET['context'] + 'mobile' === $_GET['context'] && + WP_Theme_JSON_Resolver::theme_has_support() ) { $context = 'mobile'; } diff --git a/lib/rest-api.php b/lib/rest-api.php index 19a6baa8c82a07..f1336d86b33a47 100644 --- a/lib/rest-api.php +++ b/lib/rest-api.php @@ -192,3 +192,81 @@ function gutenberg_auto_draft_get_sample_permalink( $permalink, $id, $title, $na return $permalink; } add_filter( 'get_sample_permalink', 'gutenberg_auto_draft_get_sample_permalink', 10, 5 ); + +/** + * Expose the custom_logo theme-mod in the settings REST API. + */ +register_setting( + 'general', + 'theme_mods_' . get_option( 'stylesheet' ), + array( + 'type' => 'object', + 'show_in_rest' => array( + 'name' => 'theme_mods_' . get_option( 'stylesheet' ), + 'schema' => array( + 'type' => 'object', + 'properties' => array( + 'custom_logo' => array( 'type' => 'integer' ), + ), + ), + ), + ) +); + +/** + * Expose the "stylesheet" setting in the REST API. + */ +register_setting( + 'general', + 'stylesheet', + array( + 'type' => 'string', + 'show_in_rest' => true, + ) +); + +/** + * Filters the value of a setting recognized by the REST API. + * + * Hijacks the value for custom_logo theme-mod. + * + * @param mixed $result Value to use for the requested setting. Can be a scalar + * matching the registered schema for the setting, or null to + * follow the default get_option() behavior. + * @param string $name Setting name (as shown in REST API responses). + * + * @return null|array + */ +function gutenberg_rest_pre_get_setting_filter_custom_logo( $result, $name ) { + if ( 'theme_mods_' . get_option( 'stylesheet' ) === $name ) { + return array( + 'custom_logo' => get_theme_mod( 'custom_logo' ), + ); + } +} +add_filter( 'rest_pre_get_setting', 'gutenberg_rest_pre_get_setting_filter_custom_logo', 10, 2 ); + +/** + * Filters whether to preempt a setting value update via the REST API. + * + * Hijacks the saving method for theme-mods. + * + * @param bool $result Whether to override the default behavior for updating the + * value of a setting. + * @param string $name Setting name (as shown in REST API responses). + * @param mixed $value Updated setting value. + * + * @return bool + */ +function gutenberg_rest_pre_set_setting_filter_theme_mods( $result, $name, $value ) { + $theme_mods_setting_name = 'theme_mods_' . get_option( 'stylesheet' ); + if ( $theme_mods_setting_name === $name ) { + $value = (array) $value; + $value = wp_parse_args( $value, get_option( $theme_mods_setting_name, array() ) ); + + update_option( $theme_mods_setting_name, $value ); + return true; + } +} + +add_filter( 'rest_pre_update_setting', 'gutenberg_rest_pre_set_setting_filter_theme_mods', 10, 3 ); diff --git a/package-lock.json b/package-lock.json index b0bb0de718c97a..e8e2f0b5125204 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "10.6.1", + "version": "10.7.0-rc.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -13160,6 +13160,7 @@ "@wordpress/browserslist-config": "file:packages/browserslist-config", "@wordpress/element": "file:packages/element", "@wordpress/warning": "file:packages/warning", + "browserslist": "^4.16.6", "core-js": "^3.6.4" } }, @@ -14245,6 +14246,7 @@ "react-native-keyboard-aware-scroll-view": "git+https://github.com/wordpress-mobile/react-native-keyboard-aware-scroll-view.git#gb-v0.8.8", "react-native-linear-gradient": "git+https://github.com/wordpress-mobile/react-native-linear-gradient.git#52bf43077171cff8714ce3e0155f3ebb7f55bc37", "react-native-modal": "^6.5.0", + "react-native-prompt-android": "git+https://github.com/wordpress-mobile/react-native-prompt-android.git#aba780c0bacddca76bff2c470a6c1d1d760b0b55", "react-native-reanimated": "git+https://github.com/wordpress-mobile/react-native-reanimated.git#ed48f510fba751cd75da7629e92276166766be91", "react-native-safe-area": "^0.5.0", "react-native-safe-area-context": "git+https://github.com/wordpress-mobile/react-native-safe-area-context.git#1e3c0d34f31b59fb79f71ec0b4c39c513f684871", @@ -24776,13 +24778,13 @@ } }, "browserslist": { - "version": "4.16.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.5.tgz", - "integrity": "sha512-C2HAjrM1AI/djrpAUU/tr4pml1DqLIzJKSLDBXBrNErl9ZCCTXdhwxdJjYc16953+mBWf7Lw+uUJgpgb8cN71A==", + "version": "4.16.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", + "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", "requires": { - "caniuse-lite": "^1.0.30001214", + "caniuse-lite": "^1.0.30001219", "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.719", + "electron-to-chromium": "^1.3.723", "escalade": "^3.1.1", "node-releases": "^1.1.71" }, @@ -24793,9 +24795,9 @@ "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" }, "electron-to-chromium": { - "version": "1.3.720", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.720.tgz", - "integrity": "sha512-B6zLTxxaOFP4WZm6DrvgRk8kLFYWNhQ5TrHMC0l5WtkMXhU5UbnvWoTfeEwqOruUSlNMhVLfYak7REX6oC5Yfw==" + "version": "1.3.730", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.730.tgz", + "integrity": "sha512-1Tr3h09wXhmqXnvDyrRe6MFgTeU0ZXy3+rMJWTrOHh/HNesWwBBrKnMxRJWZ86dzs8qQdw2c7ZE1/qeGHygImA==" } } }, @@ -25144,9 +25146,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001214", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001214.tgz", - "integrity": "sha512-O2/SCpuaU3eASWVaesQirZv1MSjUNOvmugaD8zNSJqw6Vv5SGwoOpA9LJs3pNPfM745nxqPvfZY3MQKY4AKHYg==" + "version": "1.0.30001228", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz", + "integrity": "sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==" }, "capture-exit": { "version": "2.0.0", @@ -51246,6 +51248,10 @@ "react-native-animatable": "^1.2.4" } }, + "react-native-prompt-android": { + "version": "git+https://github.com/wordpress-mobile/react-native-prompt-android.git#aba780c0bacddca76bff2c470a6c1d1d760b0b55", + "from": "git+https://github.com/wordpress-mobile/react-native-prompt-android.git#aba780c0bacddca76bff2c470a6c1d1d760b0b55" + }, "react-native-reanimated": { "version": "git+https://github.com/wordpress-mobile/react-native-reanimated.git#ed48f510fba751cd75da7629e92276166766be91", "from": "git+https://github.com/wordpress-mobile/react-native-reanimated.git#ed48f510fba751cd75da7629e92276166766be91", diff --git a/package.json b/package.json index 8e678fe76354da..4b08a73a5bd5d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "10.6.1", + "version": "10.7.0-rc.1", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", @@ -152,7 +152,7 @@ "babel-plugin-react-native-platform-specific-extensions": "1.1.1", "babel-plugin-transform-remove-console": "6.9.4", "benchmark": "2.1.4", - "browserslist": "4.16.5", + "browserslist": "4.16.6", "chalk": "4.0.0", "commander": "4.1.0", "concurrently": "3.5.0", diff --git a/packages/a11y/CHANGELOG.md b/packages/a11y/CHANGELOG.md index 407a8ed8bad4ec..d982a303030bd9 100644 --- a/packages/a11y/CHANGELOG.md +++ b/packages/a11y/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.1.0 (2021-05-20) + ## 3.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/a11y/package.json b/packages/a11y/package.json index d24bb03d69591f..0472f38d78b293 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "3.0.0", + "version": "3.1.0", "description": "Accessibility (a11y) utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/annotations/CHANGELOG.md b/packages/annotations/CHANGELOG.md index ae2aefd1d2da26..b6cca308e8ef3f 100644 --- a/packages/annotations/CHANGELOG.md +++ b/packages/annotations/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.1.0 (2021-05-20) + ## 2.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/annotations/package.json b/packages/annotations/package.json index f927f7b2cbb127..5ede256f807b2b 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "2.0.0", + "version": "2.1.0", "description": "Annotate content in the Gutenberg editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/api-fetch/CHANGELOG.md b/packages/api-fetch/CHANGELOG.md index e9a5c1a02e6655..5e885441c0c256 100644 --- a/packages/api-fetch/CHANGELOG.md +++ b/packages/api-fetch/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.1.0 (2021-05-20) + ## 5.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index e1f73c8a1e53df..bb6c9ce9d39b5d 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "5.0.0", + "version": "5.1.0", "description": "Utility to make WordPress REST API requests.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/autop/CHANGELOG.md b/packages/autop/CHANGELOG.md index cf7cf343d670cf..5a78cee6240acd 100644 --- a/packages/autop/CHANGELOG.md +++ b/packages/autop/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.1.0 (2021-05-20) + ## 3.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/autop/package.json b/packages/autop/package.json index 4c36a998a65574..89720c1a72ad16 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "3.0.0", + "version": "3.1.0", "description": "WordPress's automatic paragraph functions `autop` and `removep`.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-preset-default/CHANGELOG.md b/packages/babel-preset-default/CHANGELOG.md index d33b6f4c8be2c4..241355ff006e1f 100644 --- a/packages/babel-preset-default/CHANGELOG.md +++ b/packages/babel-preset-default/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +## 6.1.0 (2021-05-20) + +### Bug Fixes + +- Configure `@babel/preset-env` preset to respect a local Browserslist configuration. + ## 6.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/babel-preset-default/README.md b/packages/babel-preset-default/README.md index 21adcb1b57f640..d8e917f69f6890 100644 --- a/packages/babel-preset-default/README.md +++ b/packages/babel-preset-default/README.md @@ -16,13 +16,13 @@ npm install @wordpress/babel-preset-default --save-dev ### Usage -There are a number of methods to configure Babel. See [Babel's Configuration documentation](https://babeljs.io/docs/en/configuration) for more information. To use this preset, simply reference `@wordpress/default` in the `presets` option in your Babel configuration. +There are a number of methods to configure Babel. See [Babel's Configuration documentation](https://babeljs.io/docs/en/configuration) for more information. To use this preset, simply reference `@wordpress/babel-preset-default` in the `presets` option in your Babel configuration. For example, using `.babelrc`: ```json { - "presets": [ "@wordpress/default" ] + "presets": [ "@wordpress/babel-preset-default" ] } ``` diff --git a/packages/babel-preset-default/index.js b/packages/babel-preset-default/index.js index 3e82a7d088be1f..876074d2455015 100644 --- a/packages/babel-preset-default/index.js +++ b/packages/babel-preset-default/index.js @@ -1,3 +1,8 @@ +/** + * External dependencies + */ +const browserslist = require( 'browserslist' ); + module.exports = ( api ) => { let wpBuildOpts = {}; const isWPBuild = ( name ) => @@ -26,8 +31,12 @@ module.exports = ( api ) => { }; } else { opts.modules = false; + const localBrowserslistConfig = + browserslist.findConfig( '.' ) || {}; opts.targets = { - browsers: require( '@wordpress/browserslist-config' ), + browsers: + localBrowserslistConfig.defaults || + require( '@wordpress/browserslist-config' ), }; } diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index f3797c9196fd9f..e6afcbad91a676 100644 --- a/packages/babel-preset-default/package.json +++ b/packages/babel-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-preset-default", - "version": "6.0.0", + "version": "6.1.0", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", @@ -38,6 +38,7 @@ "@wordpress/browserslist-config": "file:../browserslist-config", "@wordpress/element": "file:../element", "@wordpress/warning": "file:../warning", + "browserslist": "^4.16.6", "core-js": "^3.6.4" }, "publishConfig": { diff --git a/packages/base-styles/_colors.native.scss b/packages/base-styles/_colors.native.scss index 059843c955bca0..a34e5012eecf9c 100644 --- a/packages/base-styles/_colors.native.scss +++ b/packages/base-styles/_colors.native.scss @@ -54,6 +54,7 @@ $gray-lighten-10: lighten($gray, 10%); // #a8bece $gray-lighten-20: lighten($gray, 20%); // #c8d7e1 $gray-lighten-30: lighten($gray, 30%); // #e9eff3 $gray-darken-20: darken($gray, 20%); // #4f748e +$gray-darken-30: darken($gray, 30%); // #3d596d // Custom $toolbar-button: #7b9ab1; diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index 08258f994a3099..82d7d7b3ef5683 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "3.4.4", + "version": "3.5.0", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blob/CHANGELOG.md b/packages/blob/CHANGELOG.md index e56b487e86470d..e4a58b7ccbcddd 100644 --- a/packages/blob/CHANGELOG.md +++ b/packages/blob/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.1.0 (2021-05-20) + ## 3.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/blob/package.json b/packages/blob/package.json index 37d479d40271e6..35243a87d756e5 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "3.0.0", + "version": "3.1.0", "description": "Blob utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/CHANGELOG.md b/packages/block-directory/CHANGELOG.md index 79c20880b28129..e7d0c24b4feb7d 100644 --- a/packages/block-directory/CHANGELOG.md +++ b/packages/block-directory/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.1.0 (2021-05-20) + ## 2.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index 2ef29586df146a..9efaf337257e55 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "2.0.0", + "version": "2.1.0", "description": "Extend editor with block directory features to search, download and install blocks.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md index 772c27efb05440..73badf8f522fab 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.1.0 (2021-05-20) + ## 6.0.0 (2021-05-14) ### Breaking Changes diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index c8bbea7c3df215..e445801d4d25d5 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "6.0.0", + "version": "6.1.0", "description": "Generic block editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-editor/src/components/autocomplete/index.native.js b/packages/block-editor/src/components/autocomplete/index.native.js deleted file mode 100644 index 461f67a0a4bcbe..00000000000000 --- a/packages/block-editor/src/components/autocomplete/index.native.js +++ /dev/null @@ -1 +0,0 @@ -export default () => null; diff --git a/packages/block-editor/src/components/block-navigation/appender.js b/packages/block-editor/src/components/block-navigation/appender.js index 391b72daccd23b..92d60146ca9ba3 100644 --- a/packages/block-editor/src/components/block-navigation/appender.js +++ b/packages/block-editor/src/components/block-navigation/appender.js @@ -15,7 +15,6 @@ import { useSelect } from '@wordpress/data'; * Internal dependencies */ import BlockNavigationLeaf from './leaf'; -import Indentation from './indentation'; import Inserter from '../inserter'; import { store as blockEditorStore } from '../../store'; @@ -63,7 +62,6 @@ export default function BlockNavigationAppender( { > { ( { ref, tabIndex, onFocus } ) => (
- - + { blockInformation?.anchor && ( + + { blockInformation.anchor } + + ) } { isSelected && ( { __( '(selected block)' ) } diff --git a/packages/block-editor/src/components/block-navigation/dropdown.js b/packages/block-editor/src/components/block-navigation/dropdown.js index bb3fd2eb453dd2..de7345280387ad 100644 --- a/packages/block-editor/src/components/block-navigation/dropdown.js +++ b/packages/block-editor/src/components/block-navigation/dropdown.js @@ -10,7 +10,7 @@ import { listView } from '@wordpress/icons'; /** * Internal dependencies */ -import BlockNavigation from './'; +import BlockNavigationTree from './tree'; import { store as blockEditorStore } from '../../store'; function BlockNavigationDropdownToggle( { @@ -60,9 +60,17 @@ function BlockNavigationDropdown( /> ) } renderContent={ () => ( - +
+

+ { __( 'List view' ) } +

+ + +
) } /> ); diff --git a/packages/block-editor/src/components/block-navigation/indentation.js b/packages/block-editor/src/components/block-navigation/indentation.js deleted file mode 100644 index 6ec4e5206134c8..00000000000000 --- a/packages/block-editor/src/components/block-navigation/indentation.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * External dependencies - */ -import { times } from 'lodash'; -import classnames from 'classnames'; - -const lineClassName = 'block-editor-block-navigator-indentation'; - -export default function Indentation( { level } ) { - return times( level - 1, ( index ) => { - // The first 'level' that has an indentation is level 2. - // Add 2 to the zero-based index below to reflect that. - const currentLevel = index + 2; - const hasItem = currentLevel === level; - return ( -