diff --git a/.eslintrc.js b/.eslintrc.js index 5d7c6b40890510..0b0c71c39a2664 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -76,6 +76,11 @@ const restrictedImports = [ message: "edit-widgets is a WordPress top level package that shouldn't be imported into other packages", }, + { + name: 'classnames', + message: + "Please use `clsx` instead. It's a lighter and faster drop-in replacement for `classnames`.", + }, ]; module.exports = { @@ -407,6 +412,24 @@ module.exports = { ], }, }, + { + files: [ 'packages/edit-post/**', 'packages/edit-site/**' ], + rules: { + 'no-restricted-imports': [ + 'error', + { + paths: [ + ...restrictedImports, + { + name: '@wordpress/interface', + message: + 'The edit-post and edit-site package should not directly import the interface package. They should import them from the private APIs of the editor package instead.', + }, + ], + }, + ], + }, + }, { files: [ 'packages/interactivity*/src/**' ], rules: { diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 2df5fd2a8725f9..f6527c3de9d978 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -15,3 +15,6 @@ c56e8a1910ed74f405b74bbb12fe81dea974e5c3 # ESLint: Enable react/jsx-boolean-value 9a34927870df80ac3b2da14d71f81d20ec23e2b6 + +# Autofix eslint curly rule. +0221522f253e094b277a1485b7a2d186cb172632 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c11359d4844a6d..c90179f0e80943 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -47,7 +47,7 @@ /packages/block-editor/src/components/link-control @getdave # Widgets -/packages/edit-widgets @draganescu @talldan @adamziel @kevin940726 +/packages/edit-widgets @draganescu @adamziel @kevin940726 /packages/customize-widgets /packages/widgets @@ -81,7 +81,6 @@ /packages/prettier-config @ntwb @gziolo /packages/scripts @gziolo @ntwb @nerrad @ajitbohra @ryanwelcher /packages/stylelint-config @ntwb -/test/e2e @kevin940726 @Mamaduka /test/php/gutenberg-coding-standards @anton-vlasenko # UI Components diff --git a/.github/setup-node/action.yml b/.github/setup-node/action.yml index fccce2e4e93bcf..a17adfe5f50071 100644 --- a/.github/setup-node/action.yml +++ b/.github/setup-node/action.yml @@ -10,7 +10,7 @@ runs: using: 'composite' steps: - name: Use desired version of Node.js - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version-file: '.nvmrc' node-version: ${{ inputs.node-version }} @@ -25,15 +25,22 @@ runs: - name: Cache node_modules id: cache-node_modules - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: '**/node_modules' - key: node_modules-${{ runner.os }}-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('package-lock.json') }} + key: node_modules-${{ runner.os }}-${{ runner.arch }}-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('package-lock.json') }} - name: Install npm dependencies if: ${{ steps.cache-node_modules.outputs.cache-hit != 'true' }} - run: npm ci + run: | + npm ci shell: bash + - name: Upload npm logs as an artifact on failure + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + if: failure() + with: + name: npm-logs + path: C:\npm\cache\_logs # On cache hit, we run the post-install script to match the native `npm ci` behavior. # An example of this is to patch `node_modules` using patch-package. diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml index fef2b196e954ca..149faee274206e 100644 --- a/.github/workflows/build-plugin-zip.yml +++ b/.github/workflows/build-plugin-zip.yml @@ -69,7 +69,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: token: ${{ secrets.GUTENBERG_TOKEN }} show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -165,7 +165,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: ref: ${{ needs.bump-version.outputs.release_branch || github.ref }} show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -183,7 +183,7 @@ jobs: NO_CHECKS: 'true' - name: Upload artifact - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: gutenberg-plugin path: ./gutenberg.zip @@ -206,7 +206,7 @@ jobs: - name: Upload release notes artifact if: ${{ needs.bump-version.outputs.new_version }} - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: release-notes path: ./release-notes.txt @@ -222,7 +222,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: fetch-depth: 2 ref: ${{ needs.bump-version.outputs.release_branch }} @@ -270,12 +270,12 @@ jobs: run: echo "version=$(echo $VERSION | cut -d / -f 3 | sed 's/-rc./ RC/' )" >> $GITHUB_OUTPUT - name: Download Plugin Zip Artifact - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: gutenberg-plugin - name: Download Release Notes Artifact - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: release-notes @@ -311,14 +311,14 @@ jobs: if: ${{ endsWith( needs.bump-version.outputs.new_version, '-rc.1' ) }} steps: - name: Checkout (for CLI) - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: path: main ref: trunk show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Checkout (for publishing) - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: path: publish # Later, we switch this branch in the script that publishes packages. diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml index 8c8a5da8eb62ad..1065421044373b 100644 --- a/.github/workflows/bundle-size.yml +++ b/.github/workflows/bundle-size.yml @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: fetch-depth: 1 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -49,7 +49,7 @@ jobs: check-latest: true cache: npm - - uses: preactjs/compressed-size-action@8119d3d31b6e57b167e09c81dfa877eada3bcb35 # v2.5.0 + - uses: preactjs/compressed-size-action@f780fd104362cfce9e118f9198df2ee37d12946c # v2.6.0 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' pattern: '{build/**/*.min.js,build/**/*.css}' diff --git a/.github/workflows/check-backport-changelog.yml b/.github/workflows/check-backport-changelog.yml new file mode 100644 index 00000000000000..0d7025474d715d --- /dev/null +++ b/.github/workflows/check-backport-changelog.yml @@ -0,0 +1,58 @@ +name: Verify Core Backport Changlog + +on: + pull_request: + types: [opened, synchronize] + paths: + - 'lib/**' + - '!lib/load.php' + - '!lib/experiments-page.php' + - '!lib/experimental/**' + - 'phpunit/**' + - '!phpunit/experimental/**' + - '!phpunit/blocks/**' + - 'packages/**/*.php' + - '!packages/block-library/**' + - '!packages/e2e-tests/**' +jobs: + check: + name: Check CHANGELOG diff + runs-on: ubuntu-latest + steps: + - name: 'Get PR commit count' + run: echo "PR_COMMIT_COUNT=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" + - name: Checkout code + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: ${{ env.PR_COMMIT_COUNT }} + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + - name: 'Fetch relevant history from origin' + run: git fetch origin ${{ github.event.pull_request.base.ref }} + - name: Check CHANGELOG status + env: + PR_NUMBER: ${{ github.event.number }} + run: | + changelog_folder="backport-changelog" + + # Find any changelog file that contains the Gutenberg PR link + gutenberg_pr_url="https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER}" + changelog_file=$(grep -rl "[-*] ${gutenberg_pr_url}" "${changelog_folder}" | head -n 1) + + # Confirm that there is an entry containing the Gutenberg PR link + if [[ -z "${changelog_file}" ]]; then + echo "Please create a core backport PR and add a file with the path /.md in the $changelog_folder folder with the core backport PR URL and a list item with this PR URL." + echo "If changes are related to an existing, open core PR, you may add this PR URL to the core PR's file." + echo "See $changelog_folder/readme.md for more information." + exit 1 + fi + + core_pr_number=$(basename "${changelog_file}" .md) + core_pr_url="https://github\.com/WordPress/wordpress-develop/pull/${core_pr_number}" + + # Confirm that the entry has the correct core backport PR URL. + if ! grep -q -e "${core_pr_url}" "${changelog_file}"; then + echo "Please update the content of ${changelog_file} to include the core backport PR URL, or update the file name to match the core backport PR number." + exit 1 + fi diff --git a/.github/workflows/check-components-changelog.yml b/.github/workflows/check-components-changelog.yml index fece5aa3a9d9ad..d995d641fae57d 100644 --- a/.github/workflows/check-components-changelog.yml +++ b/.github/workflows/check-components-changelog.yml @@ -20,7 +20,7 @@ jobs: - name: 'Get PR commit count' run: echo "PR_COMMIT_COUNT=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} diff --git a/.github/workflows/create-block.yml b/.github/workflows/create-block.yml index d817ac1e0be976..7c26cb6e14e760 100644 --- a/.github/workflows/create-block.yml +++ b/.github/workflows/create-block.yml @@ -24,7 +24,7 @@ jobs: os: ['macos-latest', 'ubuntu-latest', 'windows-latest'] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} diff --git a/.github/workflows/end2end-test.yml b/.github/workflows/end2end-test.yml index cd393854c40308..16680038e0db64 100644 --- a/.github/workflows/end2end-test.yml +++ b/.github/workflows/end2end-test.yml @@ -16,42 +16,6 @@ concurrency: cancel-in-progress: true jobs: - e2e-puppeteer: - name: Puppeteer - runs-on: ubuntu-latest - if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - - name: Setup Node.js and install dependencies - uses: ./.github/setup-node - - - name: Npm build - run: npm run build - - - name: Install WordPress - run: | - npm run wp-env start - - - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() - with: - name: failures-artifacts - path: artifacts - if-no-files-found: ignore - - - name: Archive flaky tests report - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() - with: - name: flaky-tests-report - path: flaky-tests - if-no-files-found: ignore - e2e-playwright: name: Playwright - ${{ matrix.part }} runs-on: ubuntu-latest @@ -63,7 +27,7 @@ jobs: totalParts: [8] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -85,39 +49,65 @@ jobs: env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 run: | - xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright -- --shard=${{ matrix.part }}/${{ matrix.totalParts }} + xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e -- --shard=${{ matrix.part }}/${{ matrix.totalParts }} - name: Archive debug artifacts (screenshots, traces) - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + if: ${{ !cancelled() }} with: - name: failures-artifacts + name: failures-artifacts--${{ matrix.part }} path: artifacts/test-results if-no-files-found: ignore - name: Archive flaky tests report - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - if: always() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + if: ${{ !cancelled() }} with: - name: flaky-tests-report + name: flaky-tests-report--${{ matrix.part }} path: flaky-tests if-no-files-found: ignore + merge-artifacts: + name: Merge Artifacts + if: ${{ !cancelled() }} + needs: [e2e-playwright] + runs-on: ubuntu-latest + outputs: + has-flaky-test-report: ${{ !!steps.merge-flaky-tests-reports.outputs.artifact-id }} + steps: + - name: Merge failures artifacts + uses: actions/upload-artifact/merge@v4 + # Don't fail the job if there aren't any artifacts to merge. + continue-on-error: true + with: + name: failures-artifacts + # Retain the merged artifacts in case of a rerun. + pattern: failures-artifacts* + delete-merged: true + + - name: Merge flaky tests reports + id: merge-flaky-tests-reports + uses: actions/upload-artifact/merge@v4 + continue-on-error: true + with: + name: flaky-tests-report + pattern: flaky-tests-report* + delete-merged: true + report-to-issues: name: Report to GitHub - needs: [e2e-puppeteer, e2e-playwright] - if: ${{ always() }} + needs: [merge-artifacts] + if: ${{ needs.merge-artifacts.outputs.has-flaky-test-report == 'true' }} runs-on: ubuntu-latest steps: # Checkout defaults to using the branch which triggered the event, which # isn't necessarily `trunk` (e.g. in the case of a merge). - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: ref: trunk show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - uses: actions/download-artifact@v4.1.4 - id: download_artifact + - uses: actions/download-artifact@v4.1.7 # Don't fail the job if there isn't any flaky tests report. continue-on-error: true with: @@ -125,16 +115,13 @@ jobs: path: flaky-tests - name: Setup Node.js and install dependencies - if: ${{ steps.download_artifact.outcome == 'success' }} uses: ./.github/setup-node - name: Npm build - if: ${{ steps.download_artifact.outcome == 'success' }} # TODO: We don't have to build the entire project, just the action itself. run: npm run build:packages - name: Report flaky tests - if: ${{ steps.download_artifact.outcome == 'success' }} uses: ./packages/report-flaky-tests with: repo-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index ade7ecd3e9a060..633f62d5ed28c9 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -6,7 +6,7 @@ jobs: name: 'Validation' runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - uses: gradle/wrapper-validation-action@v2 + - uses: gradle/wrapper-validation-action@v3 diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index b84e8c569dc51a..7f239652774df1 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -32,7 +32,7 @@ jobs: WP_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -68,13 +68,13 @@ jobs: - name: Compare performance with base branch if: github.event_name == 'push' # The base hash used here need to be a commit that is compatible with the current WP version - # The current one is 9bb75b35ec0daa46e8cd60c46619f522c7edd453 and it needs to be updated every WP major release. + # The current one is 9725060a5b18904c6cc5fdbe4b06fbde7419e02c and it needs to be updated every WP major release. # It is used as a base comparison point to avoid fluctuation in the performance metrics. run: | WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt) IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION" WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" - ./bin/plugin/cli.js perf $GITHUB_SHA 9bb75b35ec0daa46e8cd60c46619f522c7edd453 --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR" + ./bin/plugin/cli.js perf $GITHUB_SHA 9725060a5b18904c6cc5fdbe4b06fbde7419e02c --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR" - name: Compare performance with custom branches if: github.event_name == 'workflow_dispatch' @@ -84,9 +84,12 @@ jobs: run: | ./bin/plugin/cli.js perf $(echo $BRANCHES | tr ',' ' ') --tests-branch $GITHUB_SHA --wp-version "$WP_VERSION" + - name: Add workflow summary + run: cat ${{ env.WP_ARTIFACTS_PATH }}/summary.md >> $GITHUB_STEP_SUMMARY + - name: Archive performance results if: success() - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: performance-results path: ${{ env.WP_ARTIFACTS_PATH }}/*.performance-results*.json @@ -97,10 +100,10 @@ jobs: CODEHEALTH_PROJECT_TOKEN: ${{ secrets.CODEHEALTH_PROJECT_TOKEN }} run: | COMMITTED_AT=$(git show -s $GITHUB_SHA --format="%cI") - ./bin/log-performance-results.js $CODEHEALTH_PROJECT_TOKEN trunk $GITHUB_SHA 9bb75b35ec0daa46e8cd60c46619f522c7edd453 $COMMITTED_AT + ./bin/log-performance-results.js $CODEHEALTH_PROJECT_TOKEN trunk $GITHUB_SHA 9725060a5b18904c6cc5fdbe4b06fbde7419e02c $COMMITTED_AT - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: failure() with: name: failures-artifacts diff --git a/.github/workflows/php-changes-detection.yml b/.github/workflows/php-changes-detection.yml index 61416311e79f93..6d0a0a451a5153 100644 --- a/.github/workflows/php-changes-detection.yml +++ b/.github/workflows/php-changes-detection.yml @@ -10,18 +10,18 @@ jobs: if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} steps: - name: Check out code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: fetch-depth: 0 show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Get changed PHP files id: changed-files-php - uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188 # v42.0.5 + uses: tj-actions/changed-files@a29e8b565651ce417abb5db7164b4a2ad8b6155c # v44.4.0 with: files: | - *.{php} lib/** + packages/**/*.php phpunit/** - name: List all changed files diff --git a/.github/workflows/publish-npm-packages.yml b/.github/workflows/publish-npm-packages.yml index c9de22a5c31955..94397afd7b4bca 100644 --- a/.github/workflows/publish-npm-packages.yml +++ b/.github/workflows/publish-npm-packages.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout (for CLI) if: ${{ github.event.inputs.release_type != 'wp' }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: path: cli ref: trunk @@ -39,7 +39,7 @@ jobs: - name: Checkout (for publishing) if: ${{ github.event.inputs.release_type != 'wp' }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: path: publish # Later, we switch this branch in the script that publishes packages. @@ -49,7 +49,7 @@ jobs: - name: Checkout (for publishing WP major version) if: ${{ github.event.inputs.release_type == 'wp' && github.event.inputs.wp_version }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: path: publish ref: wp/${{ github.event.inputs.wp_version }} diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml index ccf0502ba21dac..099203bbffe720 100644 --- a/.github/workflows/pull-request-automation.yml +++ b/.github/workflows/pull-request-automation.yml @@ -12,7 +12,7 @@ jobs: steps: # Checkout defaults to using the branch which triggered the event, which # isn't necessarily `trunk` (e.g. in the case of a merge). - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: ref: trunk show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -24,7 +24,7 @@ jobs: check-latest: true - name: Cache NPM packages - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index 5c5800792c5c07..a4dce407d1c0ff 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -23,12 +23,12 @@ jobs: steps: - name: checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Use desired version of Java - uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 with: distribution: 'corretto' java-version: '17' @@ -37,7 +37,7 @@ jobs: uses: ./.github/setup-node - name: Restore tests setup cache - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: | ~/.appium @@ -47,10 +47,10 @@ jobs: run: npm run native test:e2e:setup - name: Gradle cache - uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2 - name: AVD cache - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 id: avd-cache with: path: | @@ -81,13 +81,13 @@ jobs: profile: Nexus 6 script: npm run native test:e2e:android:local ${{ matrix.native-test-name }} - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: android-screen-recordings path: packages/react-native-editor/android-screen-recordings - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: appium-logs diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index 49c3b5b07b5ae4..516f783c11e401 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -23,11 +23,11 @@ jobs: native-test-name: [gutenberg-editor-rendering] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 + - uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0 with: # `.ruby-version` file location working-directory: packages/react-native-editor/ios @@ -42,7 +42,7 @@ jobs: uses: ./.github/setup-node - name: Restore tests setup cache - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: | ~/.appium @@ -55,7 +55,7 @@ jobs: run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt - name: Restore build cache - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: | packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app @@ -63,7 +63,7 @@ jobs: key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ matrix.device }}-${{ hashFiles('ios-checksums.txt') }} - name: Restore pods cache - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: | packages/react-native-editor/ios/Pods @@ -89,13 +89,13 @@ jobs: rm packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle rm -rf packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/assets - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: ios-screen-recordings path: packages/react-native-editor/ios-screen-recordings - - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 if: always() with: name: appium-logs diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml index 789e64a25fa205..ff3fe96d505f6f 100644 --- a/.github/workflows/static-checks.yml +++ b/.github/workflows/static-checks.yml @@ -22,7 +22,7 @@ jobs: if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} diff --git a/.github/workflows/storybook-pages.yml b/.github/workflows/storybook-pages.yml index 5117e2fc9fe6ec..7486ea32533e6a 100644 --- a/.github/workflows/storybook-pages.yml +++ b/.github/workflows/storybook-pages.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: ref: trunk show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -24,7 +24,7 @@ jobs: run: npm run storybook:build - name: Deploy - uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 + uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./storybook/build diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index d5be172578d43e..a4a639e183d5bf 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -21,16 +21,18 @@ concurrency: jobs: unit-js: - name: JavaScript (Node.js ${{ matrix.node }}) + name: JavaScript (Node.js ${{ matrix.node }}) ${{ matrix.shard }} runs-on: ubuntu-latest if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} strategy: fail-fast: false matrix: node: ['20', '21'] + shard: ['1/4', '2/4', '3/4', '4/4'] steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Checkout repository + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -39,17 +41,56 @@ jobs: with: node-version: ${{ matrix.node }} - - name: npm build + - name: Determine the number of CPU cores + uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0 + id: cpu-cores + + - name: Run build scripts # It's not necessary to run the full build, since Jest can interpret # source files with `babel-jest`. Some packages have their own custom # build tasks, however. These must be run. run: npx lerna run build - name: Running the tests - run: npm run test:unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + run: | + npm run test:unit -- \ + --ci \ + --maxWorkers="${{ steps.cpu-cores.outputs.count }}" \ + --shard="${{ matrix.shard }}" \ + --cacheDirectory="$HOME/.jest-cache" + + unit-js-date: + name: JavaScript Date Tests (Node.js ${{ matrix.node }}) + runs-on: ubuntu-latest + if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} + strategy: + fail-fast: false + matrix: + node: ['20', '21'] + + steps: + - name: Checkout repository + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + with: + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + + - name: Setup Node.js and install dependencies + uses: ./.github/setup-node + with: + node-version: ${{ matrix.node }} + + - name: Determine the number of CPU cores + uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0 + id: cpu-cores + + - name: Run build scripts + # It's not necessary to run the full build, since Jest can interpret + # source files with `babel-jest`. Some packages have their own custom + # build tasks, however. These must be run. + run: npx lerna run build - - name: Running the date tests - run: npm run test:unit:date -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + - name: Run the date tests + run: npm run test:unit:date -- --ci --maxWorkers=${{ steps.cpu-cores.outputs.count }} --cacheDirectory="$HOME/.jest-cache" compute-previous-wordpress-version: name: Compute previous WordPress version @@ -76,9 +117,29 @@ jobs: echo "previous-wordpress-version=${PREVIOUS_WP_VERSION}" >> $GITHUB_OUTPUT rm versions.json + build-assets: + name: Build JavaScript assets for PHP unit tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + with: + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + + - name: Setup Node.js and install dependencies + uses: ./.github/setup-node + + - name: Run build scripts + run: npm run build + + - name: Upload built JavaScript assets + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: build-assets + path: ./build/ + test-php: name: PHP ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest - needs: compute-previous-wordpress-version + needs: [compute-previous-wordpress-version, build-assets] runs-on: ubuntu-latest timeout-minutes: 20 if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} @@ -86,8 +147,6 @@ jobs: fail-fast: true matrix: php: - - '7.0' - - '7.1' - '7.2' - '7.3' - '7.4' @@ -98,7 +157,7 @@ jobs: wordpress: [''] # Latest WordPress version. include: # Test with the previous WP version. - - php: '7.0' + - php: '7.2' wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }} - php: '7.4' wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }} @@ -110,7 +169,8 @@ jobs: WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Checkout repository + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} @@ -125,7 +185,7 @@ jobs: # dependency versions are installed and cached. ## - name: Set up PHP - uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.0 + uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198 # v2.30.4 with: php-version: '${{ matrix.php }}' ini-file: development @@ -148,13 +208,15 @@ jobs: with: custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F") - - name: Npm build - run: npm run build + - name: Download built JavaScript assets + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 + with: + name: build-assets + path: ./build - name: Docker debug information run: | docker -v - docker-compose -v - name: General debug information run: | @@ -162,7 +224,6 @@ jobs: node --version curl --version git --version - svn --version locale -a - name: Start Docker environment @@ -220,12 +281,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Set up PHP - uses: shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2.30.0 + uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198 # v2.30.4 with: php-version: '7.4' coverage: none @@ -238,7 +299,7 @@ jobs: run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT - name: Cache PHPCS scan cache - uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: .cache/phpcs.json key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} @@ -289,18 +350,23 @@ jobs: if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Checkout repository + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} + - name: Determine the number of CPU cores + uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2.0.0 + id: cpu-cores + - name: Setup Node.js and install dependencies uses: ./.github/setup-node - - name: Npm build + - name: Run build scripts # It's not necessary to run the full build, since Jest can interpret # source files with `babel-jest`. Some packages have their own custom # build tasks, however. These must be run. run: npx lerna run build - name: Running the tests - run: npm run test:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + run: npm run test:native -- --ci --maxWorkers=${{ steps.cpu-cores.outputs.count }} --cacheDirectory="$HOME/.jest-cache" diff --git a/.github/workflows/upload-release-to-plugin-repo.yml b/.github/workflows/upload-release-to-plugin-repo.yml index 6f0eb31adcc407..8f57a749b0601d 100644 --- a/.github/workflows/upload-release-to-plugin-repo.yml +++ b/.github/workflows/upload-release-to-plugin-repo.yml @@ -96,7 +96,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 with: ref: ${{ matrix.branch }} token: ${{ secrets.GUTENBERG_TOKEN }} @@ -147,7 +147,7 @@ jobs: fi - name: Upload Changelog artifact - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: changelog ${{ matrix.label }} path: ./changelog.txt @@ -189,7 +189,7 @@ jobs: sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" ./trunk/readme.txt - name: Download Changelog Artifact - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: changelog trunk path: trunk @@ -247,7 +247,7 @@ jobs: sed -i "s/$STABLE_TAG_PLACEHOLDER/Stable tag: $VERSION/g" "$VERSION/readme.txt" - name: Download Changelog Artifact - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 with: name: changelog trunk path: ${{ github.event.release.name }} diff --git a/.npmrc b/.npmrc index cd7566c8202337..7a346f877b9319 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,4 @@ save-exact = true engine-strict = true legacy-peer-deps = true +prefer-dedupe = true diff --git a/.stylelintrc.json b/.stylelintrc.json index 76294109134028..df01978222e632 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -15,6 +15,12 @@ "font-weight-notation": null, "max-line-length": null, "no-descending-specificity": null, + "property-disallowed-list": [ + [ "order" ], + { + "message": "Avoid the order property. For accessibility reasons, visual, reading, and DOM order must match. Only use the order property when it does not affect reading order, meaning, and interaction" + } + ], "rule-empty-line-before": null, "selector-class-pattern": null, "value-keyword-case": null, @@ -29,5 +35,6 @@ "scss/at-else-empty-line-before": null, "scss/at-if-closing-brace-space-after": null, "no-invalid-position-at-import-rule": null - } + }, + "reportDescriptionlessDisables": true } diff --git a/README.md b/README.md index 33f76716470751..9c920337ef5941 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ Welcome to the development hub for the WordPress Gutenberg project! -"Gutenberg" is a codename for a whole new paradigm in WordPress site building and publishing, that aims to revolutionize the entire publishing experience as much as Gutenberg did the printed word. Right now, the project is in the second phase of a four-phase process that will touch every piece of WordPress -- Editing, **Customization** (which includes Full Site Editing, Block Patterns, Block Directory and Block based themes), Collaboration, and Multilingual -- and is focused on a new editing experience, the block editor. +"Gutenberg" is a codename for a whole new paradigm in WordPress site building and publishing, that aims to revolutionize the entire publishing experience as much as Gutenberg did the printed word. Right now, the project is in the second phase of a four-phase process that will touch every piece of WordPress -- Editing, Customization, **Collaboration** (which includes [Real-time collaboration](https://make.wordpress.org/core/2023/07/03/real-time-collaboration/), [Asynchronous collaboration](https://make.wordpress.org/core/2023/07/04/workflows/), [Publishing flows](https://make.wordpress.org/core/2023/07/04/workflows/), [Post revisions interface](https://make.wordpress.org/core/2023/07/05/revisions/), [Admin design](https://make.wordpress.org/core/2023/07/12/admin-design/), [Library](https://make.wordpress.org/core/2023/07/10/block-library/)), and Multilingual -- and is focused on a new editing experience, the block editor. The block editor introduces a modular approach to pages and posts: each piece of content in the editor, from a paragraph to an image gallery to a headline, is its own block. And just like physical blocks, WordPress blocks can be added, arranged, and rearranged, allowing WordPress users to create media-rich pages in a visually intuitive way -- and without work-arounds like shortcodes or custom HTML. The block editor first became available in December 2018, and we're still hard at work refining the experience, creating more and better blocks, and laying the groundwork for the next three phases of work. The Gutenberg plugin gives you the latest version of the block editor, so you can join us in testing bleeding-edge features, start playing with blocks, and maybe get inspired to build your own. -Check out the [Ways to keep up with Gutenberg & Full Site Editing (FSE)](https://make.wordpress.org/core/2020/05/20/ways-to-keep-up-with-full-site-editing-fse/) +Check out the [Keeping up with Gutenberg Index](https://make.wordpress.org/core/handbook/references/keeping-up-with-gutenberg-index/) ## Getting Started @@ -37,7 +37,7 @@ Get hands on: check out the [block editor live demo](https://wordpress.org/guten Extending and customizing is at the heart of the WordPress platform, this is no different for the Gutenberg project. The editor and future products can be extended by third-party developers using plugins. -Review the [Create a Block tutorial](/docs/getting-started/devenv/get-started-with-create-block.md) for the fastest way to get started extending the block editor. See the [Developer Documentation](https://developer.wordpress.org/block-editor/#develop-for-the-block-editor) for extensive tutorials, documentation, and API references. +Review the [Quick Start Guide](https://developer.wordpress.org/block-editor/getting-started/quick-start-guide/) for the fastest way to get started extending the block editor. See the [Block Editor Handbook](https://developer.wordpress.org/block-editor/) for extensive tutorials, documentation, and API references. Also, check the [WordPress Developer Blog](https://developer.wordpress.org/blog/) for great articles about block development, among other topics. ### Contribute to Gutenberg @@ -55,8 +55,6 @@ As with all WordPress projects, we want to ensure a welcoming environment for ev You can join us in the `#core-editor` channel in Slack, see the [WordPress Slack page](https://make.wordpress.org/chat/) for signup information; it is free to join. -**Weekly meetings** The Editor Team meets weekly on Wednesdays at 14:00 UTC in Slack. If you can not join the meeting, [agenda](https://make.wordpress.org/core/tag/core-editor-agenda/) and [notes](https://make.wordpress.org/core/tag/core-editor-summary/) are posted to the [Make WordPress Blog](https://make.wordpress.org/core/). - ## License WordPress is free software, and is released under the terms of the GNU General Public License version 2 or (at your option) any later version. See [LICENSE.md](LICENSE.md) for complete license. diff --git a/backport-changelog/readme.md b/backport-changelog/readme.md new file mode 100644 index 00000000000000..200cb9db404865 --- /dev/null +++ b/backport-changelog/readme.md @@ -0,0 +1,16 @@ +# Core Backport Changelog + +Any PR that makes changes to be backported to [core](https://github.com/WordPress/wordpress-develop) should log a core PR here. It's possible to have multiple Gutenberg PRs link to a single core backport PR. The core backport PR can remain open as long as wanted/needed. The entries are sorted by core release (in folders), and each entry should be an md file with the core PR number as the file name, and the link to the Gutenberg PR in the file content. The file content should start with the core PR URL, followed by a Markdown list of Gutenberg PRs (see example). Files are used to avoid rebase conflicts. + +If you think a file path is wrongly flagged as needing a core backport PR, you can add it to the list of exceptions in `.github/workflows/check-backport-changelog.yml`. + +## Example + +Path: `{wp-release-number-x.x}/{core-pr-number}.md`, e.g. `6.6/1234.md`. +File content: +```md +https://github.com/WordPress/wordpress-develop/pull/{core-pr-number} + +* https://github.com/WordPress/gutenberg/pull/{first-gb-pr-number} +* https://github.com/WordPress/gutenberg/pull/{second-gb-pr-number} +``` diff --git a/bin/api-docs/gen-theme-reference.js b/bin/api-docs/gen-theme-reference.js index 0ea9e282e5463e..07a8c2fcc697d4 100644 --- a/bin/api-docs/gen-theme-reference.js +++ b/bin/api-docs/gen-theme-reference.js @@ -127,16 +127,44 @@ const getSettingsPropertiesMarkup = ( struct ) => { } let markup = '| Property | Type | Default | Props |\n'; - markup += '| --- | --- | --- |--- |\n'; + markup += '| --- | --- | --- |--- |\n'; ks.forEach( ( key ) => { const def = 'default' in props[ key ] ? props[ key ].default : ''; - const ps = + let type = props[ key ].type || ''; + let ps = props[ key ].type === 'array' ? keys( getPropertiesFromArray( props[ key ].items ) ) .sort() .join( ', ' ) : ''; - markup += `| ${ key } | ${ props[ key ].type } | ${ def } | ${ ps } |\n`; + + /* + * Handle`oneOf` type definitions - extract the type and properties. + * See: https://json-schema.org/understanding-json-schema/reference/combining#oneOf + */ + if ( props[ key ].oneOf && Array.isArray( props[ key ].oneOf ) ) { + if ( ! type ) { + type = props[ key ].oneOf + .map( ( item ) => item.type ) + .join( ', ' ); + } + + if ( ! ps ) { + ps = props[ key ].oneOf + .map( ( item ) => + item?.type === 'object' && item?.properties + ? '_{' + + keys( getPropertiesFromArray( item ) ) + .sort() + .join( ', ' ) + + '}_' + : '' + ) + .join( ' ' ); + } + } + + markup += `| ${ key } | ${ type } | ${ def } | ${ ps } |\n`; } ); return markup; @@ -213,10 +241,13 @@ const formatType = ( prop ) => { const types = []; propTypes.forEach( ( item ) => { - if ( item.type ) types.push( item.type ); + if ( item.type ) { + types.push( item.type ); + } // refComplete is always an object - if ( item.$ref && item.$ref === '#/definitions/refComplete' ) + if ( item.$ref && item.$ref === '#/definitions/refComplete' ) { types.push( 'object' ); + } } ); type = [ ...new Set( types ) ].join( ', ' ); diff --git a/bin/cherry-pick.mjs b/bin/cherry-pick.mjs index f0ca37d10f30cb..d81bc017fc0be6 100644 --- a/bin/cherry-pick.mjs +++ b/bin/cherry-pick.mjs @@ -113,15 +113,18 @@ function cli( command, args, pipe = false ) { */ async function fetchPRs() { const { items } = await GitHubFetch( - `/search/issues?q=is:pr state:closed sort:updated label:"${ LABEL }" repo:WordPress/gutenberg` + `/search/issues?per_page=100&q=is:pr state:closed sort:updated label:"${ LABEL }" repo:WordPress/gutenberg` ); const PRs = items - .map( ( { id, number, title, pull_request, closed_at } ) => ( { + // eslint-disable-next-line camelcase + .map( ( { id, number, title, pull_request } ) => ( { id, number, title, + // eslint-disable-next-line camelcase pull_request, } ) ) + // eslint-disable-next-line camelcase .filter( ( { pull_request } ) => !! pull_request?.merged_at ) .sort( ( a, b ) => diff --git a/bin/generate-php-sync-issue.mjs b/bin/generate-php-sync-issue.mjs index a45d77d354107c..bd627aeb65107c 100644 --- a/bin/generate-php-sync-issue.mjs +++ b/bin/generate-php-sync-issue.mjs @@ -21,14 +21,18 @@ const MAX_MONTHS_TO_QUERY = 4; // The following paths will be ignored when generating the issue content. const IGNORED_PATHS = [ + 'init.php', // plugin specific code. 'lib/load.php', // plugin specific code. 'lib/experiments-page.php', // experiments are plugin specific. 'packages/e2e-tests/plugins', // PHP files related to e2e tests only. - 'packages/block-library', // this is handled automatically. + 'packages/block-library', // packages are synced to WP Core via npm packages. ]; // PRs containing the following labels will be ignored when generating the issue content. -const LABELS_TO_IGNORE = [ 'Backport from WordPress Core' ]; +const LABELS_TO_IGNORE = [ + 'Backport from WordPress Core', // PRs made "upstream" in Core that were synced back into Gutenberg. + 'Backported to WP Core', // PRs that were synced into Core during a previous release. +]; const MAX_NESTING_LEVEL = 3; @@ -72,28 +76,6 @@ async function main() { process.exit( 1 ); } - const lastRcDateArg = getArg( 'lastrcdate' ); - let lastRcDate; - - if ( lastRcDateArg ) { - if ( - validateDate( lastRcDateArg ) && - isAfter( lastRcDateArg, since ) - ) { - lastRcDate = lastRcDateArg; - } else { - console.error( - `Error: The --lastrcdate argument must be a date after the --since date.` - ); - process.exit( 1 ); - } - } else { - console.error( - `Error: The --lastrcdate argument is required (e.g. YYYY-MM-DD).` - ); - process.exit( 1 ); - } - console.log( 'Welcome to the PHP Sync Issue Generator!' ); console.log( '--------------------------------' ); @@ -126,11 +108,7 @@ async function main() { commits.map( async ( commit ) => { const commitData = await fetchCommit( commit.sha ); - // In the future we will want to exclude PRs based on label - // so we will need to fetch the full PR data for each commit. - // For now we can just set this to null. - const fullPRData = null; - // const fullPRData = getPullRequestDataForCommit( commit.sha ); + const fullPRData = await getPullRequestDataForCommit( commit.sha ); // Our Issue links to the PRs associated with the commits so we must // provide this data. We could also get the PR data from the commit data, @@ -156,18 +134,6 @@ async function main() { return null; } - // This is temporarily required because PRs merged between Beta 1 (since) - // and the final RC may have already been manually backported to Core. - // This is however no reliable way to identify these PRs as the `Backport to WP beta/RC` - // label is manually removed once the PR has been backported. - // In future releases we will add a **new** label `Backported` - // to indicate the PR was backported to Core. - // As a result, in the future we will be able to exclude any PRs that have - // already been backported using the `Backported` label. - if ( isAfter( lastRcDate, commitData.commit.committer.date ) ) { - commitData.isBeforeLastRCDate = true; - } - return commitData; } ) ); @@ -426,12 +392,8 @@ function processCommits( commits ) { return result; } -function formatPRLine( { pullRequest: pr, isBeforeLastRCDate } ) { - return `- [ ] ${ pr.url } - @${ - pr.creator - } | Trac ticket | Core backport PR ${ - isBeforeLastRCDate ? '(⚠️ Check for existing WP Core backport)' : '' - }\n`; +function formatPRLine( { pullRequest: pr } ) { + return `- [ ] ${ pr.url } - @${ pr.creator } | Trac ticket | Core backport PR \n`; } function formatHeading( level, key ) { @@ -466,7 +428,7 @@ function generateIssueContent( result, level = 1 ) { } async function fetchAllCommits( since, path ) { - return await octokitPaginate( 'GET /repos/{owner}/{repo}/commits', { + return octokitPaginate( 'GET /repos/{owner}/{repo}/commits', { since, per_page: 30, path, @@ -481,7 +443,7 @@ async function fetchCommit( sha ) { // eslint-disable-next-line no-unused-vars async function getPullRequestDataForCommit( commitSha ) { - const pullRequests = octokitRequest( + const pullRequests = await octokitRequest( 'GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls', { commit_sha: commitSha, diff --git a/bin/log-performance-results.js b/bin/log-performance-results.js index f18e40fea3d2f4..da22253546eb61 100755 --- a/bin/log-performance-results.js +++ b/bin/log-performance-results.js @@ -50,7 +50,7 @@ const data = new TextEncoder().encode( performanceResults[ index ][ hash ] ?? {} ).map( ( [ key, value ] ) => [ metricsPrefix + key, - value, + typeof value === 'object' ? value.q50 : value, ] ) ), }; @@ -64,7 +64,7 @@ const data = new TextEncoder().encode( performanceResults[ index ][ baseHash ] ?? {} ).map( ( [ key, value ] ) => [ metricsPrefix + key, - value, + typeof value === 'object' ? value.q50 : value, ] ) ), }; diff --git a/bin/packages/lint-staged-typecheck.js b/bin/packages/lint-staged-typecheck.js index 7b7eb7b846bfb0..8e656755134f18 100644 --- a/bin/packages/lint-staged-typecheck.js +++ b/bin/packages/lint-staged-typecheck.js @@ -28,9 +28,11 @@ const changedPackages = [ fs.existsSync( path.join( packageRoot, 'tsconfig.json' ) ) ); -try { - execa.sync( tscPath, [ '--build', ...changedPackages ] ); -} catch ( err ) { - console.error( err.stdout ); - process.exitCode = 1; +if ( changedPackages.length > 0 ) { + try { + execa.sync( tscPath, [ '--build', ...changedPackages ] ); + } catch ( err ) { + console.error( err.stdout ); + process.exitCode = 1; + } } diff --git a/bin/plugin/commands/packages.js b/bin/plugin/commands/packages.js index c2f673d51dcc33..d70baf4f91bfa7 100644 --- a/bin/plugin/commands/packages.js +++ b/bin/plugin/commands/packages.js @@ -135,7 +135,7 @@ async function runNpmReleaseBranchSyncStep( pluginReleaseBranch, config ) { /* * Replace content from remote branch. * - * @TODO: What is our goal here? Could `git reset --hard origin/${pluginReleaseBranch}` work? + * @todo What is our goal here? Could `git reset --hard origin/${pluginReleaseBranch}` work? * Why are we manually removing and then adding files back in? */ await repo diff --git a/bin/plugin/commands/performance.js b/bin/plugin/commands/performance.js index bdc38347e40c86..a945319a5491b1 100644 --- a/bin/plugin/commands/performance.js +++ b/bin/plugin/commands/performance.js @@ -20,6 +20,7 @@ const config = require( '../config' ); const ARTIFACTS_PATH = process.env.WP_ARTIFACTS_PATH || path.join( process.cwd(), 'artifacts' ); +const RAW_RESULTS_FILE_SUFFIX = '.performance-results.raw.json'; const RESULTS_FILE_SUFFIX = '.performance-results.json'; /** @@ -56,22 +57,97 @@ function sanitizeBranchName( branch ) { } /** - * Computes the median number from an array numbers. - * + * @param {number} number + */ +function fixed( number ) { + return Math.round( number * 100 ) / 100; +} + +/** * @param {number[]} array - * - * @return {number|undefined} Median value or undefined if array empty. */ -function median( array ) { - if ( ! array || ! array.length ) return undefined; +function quartiles( array ) { + const numbers = array.slice().sort( ( a, b ) => a - b ); + + /** + * @param {number} offset + * @param {number} length + */ + function med( offset, length ) { + if ( length % 2 === 0 ) { + // even length, average of two middle numbers + return ( + ( numbers[ offset + length / 2 - 1 ] + + numbers[ offset + length / 2 ] ) / + 2 + ); + } + + // odd length, exact middle point + return numbers[ offset + ( length - 1 ) / 2 ]; + } - const numbers = [ ...array ].sort( ( a, b ) => a - b ); - const middleIndex = Math.floor( numbers.length / 2 ); + const q50 = med( 0, numbers.length ); + let q25, q75; if ( numbers.length % 2 === 0 ) { - return ( numbers[ middleIndex - 1 ] + numbers[ middleIndex ] ) / 2; + // medians of two exact halves + const mid = numbers.length / 2; + q25 = med( 0, mid ); + q75 = med( mid, mid ); + } else { + // quartiles are average of medians of the smaller and bigger slice + const midl = ( numbers.length - 1 ) / 2; + const midh = ( numbers.length + 1 ) / 2; + q25 = ( med( 0, midl ) + med( 0, midh ) ) / 2; + q75 = ( med( midl, midh ) + med( midh, midl ) ) / 2; } - return numbers[ middleIndex ]; + return { q25, q50, q75 }; +} + +/** + * @param {number[]|undefined} values + */ +function stats( values ) { + if ( ! values || values.length === 0 ) { + return undefined; + } + const { q25, q50, q75 } = quartiles( values ); + const cnt = values.length; + return { + q25: fixed( q25 ), + q50: fixed( q50 ), + q75: fixed( q75 ), + cnt, + }; +} + +/** + * Nicely formats a given value. + * + * @param {string} metric Metric. + * @param {number} value + */ +function formatValue( metric, value ) { + if ( 'wpMemoryUsage' === metric ) { + return `${ ( value / Math.pow( 10, 6 ) ).toFixed( 2 ) } MB`; + } + + if ( 'wpDbQueries' === metric ) { + return value.toString(); + } + + return `${ value } ms`; +} + +/** + * @param {string} m + * @param {Record} s + */ +function printStats( m, s ) { + const pp = fixed( ( 100 * ( s.q75 - s.q50 ) ) / s.q50 ); + const mp = fixed( ( 100 * ( s.q50 - s.q25 ) ) / s.q50 ); + return `${ formatValue( m, s.q50 ) } +${ pp }% -${ mp }%`; } /** @@ -94,6 +170,61 @@ async function runTestSuite( testSuite, testRunnerDir, runKey ) { ); } +/** + * Formats an array of objects as a Markdown table. + * + * For example, this array: + * + * [ + * { + * foo: 123, + * bar: 456, + * baz: 'Yes', + * }, + * { + * foo: 777, + * bar: 999, + * baz: 'No', + * } + * ] + * + * Will result in the following table: + * + * | foo | bar | baz | + * |-----|-----|-----| + * | 123 | 456 | Yes | + * | 777 | 999 | No | + * + * @param {Array} rows Table rows. + * @return {string} Markdown table content. + */ +function formatAsMarkdownTable( rows ) { + let result = ''; + + if ( ! rows.length ) { + return result; + } + + const headers = Object.keys( rows[ 0 ] ); + for ( const header of headers ) { + result += `| ${ header } `; + } + result += '|\n'; + for ( let i = 0; i < headers.length; i++ ) { + result += '| ------ '; + } + result += '|\n'; + + for ( const row of rows ) { + for ( const value of Object.values( row ) ) { + result += `| ${ value } `; + } + result += '|\n'; + } + + return result; +} + /** * Runs the performances tests on an array of branches and output the result. * @@ -362,9 +493,9 @@ async function runPerformanceTests( branches, options ) { logAtIndent( 0, 'Calculating results' ); const resultFiles = getFilesFromDir( ARTIFACTS_PATH ).filter( ( file ) => - file.endsWith( RESULTS_FILE_SUFFIX ) + file.endsWith( RAW_RESULTS_FILE_SUFFIX ) ); - /** @type {Record>>} */ + /** @type {Record>>>} */ const results = {}; // Calculate medians from all rounds. @@ -385,20 +516,21 @@ async function runPerformanceTests( branches, options ) { return readJSONFile( file ); } ); - const metrics = Object.keys( resultsRounds[ 0 ] ); + const metrics = Object.keys( resultsRounds[ 0 ] ?? {} ); results[ testSuite ][ branch ] = {}; for ( const metric of metrics ) { - const values = resultsRounds - .map( ( round ) => round[ metric ] ) - .filter( ( value ) => typeof value === 'number' ); + const values = resultsRounds.flatMap( + ( round ) => round[ metric ] ?? [] + ); - const value = median( values ); + const value = stats( values ); if ( value !== undefined ) { results[ testSuite ][ branch ][ metric ] = value; } } } + const calculatedResultsPath = path.join( ARTIFACTS_PATH, testSuite + RESULTS_FILE_SUFFIX @@ -422,24 +554,82 @@ async function runPerformanceTests( branches, options ) { ) ); + let summaryMarkdown = `## Performance Test Results\n\n`; + + summaryMarkdown += `Please note that client side metrics **exclude** the server response time.\n\n`; + for ( const testSuite of testSuites ) { logAtIndent( 0, formats.success( testSuite ) ); // Invert the results so we can display them in a table. - /** @type {Record>} */ + /** @type {Record>>} */ const invertedResult = {}; for ( const [ branch, metrics ] of Object.entries( results[ testSuite ] ) ) { for ( const [ metric, value ] of Object.entries( metrics ) ) { invertedResult[ metric ] = invertedResult[ metric ] || {}; - invertedResult[ metric ][ branch ] = `${ value } ms`; + invertedResult[ metric ][ branch ] = value; + } + } + + /** @type {Record>} */ + const printedResult = {}; + for ( const [ metric, branch ] of Object.entries( invertedResult ) ) { + printedResult[ metric ] = {}; + for ( const [ branchName, data ] of Object.entries( branch ) ) { + printedResult[ metric ][ branchName ] = printStats( + metric, + data + ); + } + + if ( branches.length === 2 ) { + const [ branch1, branch2 ] = branches; + const value1 = branch[ branch1 ].q50; + const value2 = branch[ branch2 ].q50; + const percentageChange = fixed( + ( ( value1 - value2 ) / value2 ) * 100 + ); + printedResult[ metric ][ + '% Change' + ] = `${ percentageChange }%`; } } // Print the results. - console.table( invertedResult ); + console.table( printedResult ); + + // Use yet another structure to generate a Markdown table. + + const rows = []; + + for ( const [ metric, resultBranches ] of Object.entries( + printedResult + ) ) { + /** + * @type {Record< string, string >} + */ + const row = { + Metric: metric, + }; + + for ( const [ branch, value ] of Object.entries( + resultBranches + ) ) { + row[ branch ] = value; + } + rows.push( row ); + } + + summaryMarkdown += `**${ testSuite }**\n\n`; + summaryMarkdown += `${ formatAsMarkdownTable( rows ) }\n`; } + + fs.writeFileSync( + path.join( ARTIFACTS_PATH, 'summary.md' ), + summaryMarkdown + ); } module.exports = { diff --git a/bin/test-create-block.sh b/bin/test-create-block.sh index 7959334a8e30ec..99b7e8e6082604 100755 --- a/bin/test-create-block.sh +++ b/bin/test-create-block.sh @@ -69,7 +69,7 @@ status "Building block..." ../node_modules/.bin/wp-scripts build status "Verifying build..." -expected=7 +expected=9 actual=$( find build -maxdepth 1 -type f | wc -l ) if [ "$expected" -ne "$actual" ]; then error "Expected $expected files in the \`build\` directory, but found $actual." diff --git a/bin/tsconfig.json b/bin/tsconfig.json index 48fd553e4c049b..3ec5d5826a045d 100644 --- a/bin/tsconfig.json +++ b/bin/tsconfig.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/tsconfig.json", "extends": "../tsconfig.base.json", "compilerOptions": { "module": "commonjs", diff --git a/changelog.txt b/changelog.txt index 0a4d05d10635d1..7a3ba488afd9f9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,1862 @@ == Changelog == -= 17.9.0-rc.1 = += 18.4.0-rc.1 = + + +## Changelog + +### Features + +#### Site Editor +- Adds "Template Parts" command to site editor. ([61287](https://github.com/WordPress/gutenberg/pull/61287)) + + +### Enhancements + +#### Global Styles +- Add aspect ratio presets support via theme.json. ([47271](https://github.com/WordPress/gutenberg/pull/47271)) +- Background images: Remove required "file" prop. ([61387](https://github.com/WordPress/gutenberg/pull/61387)) +- Change "Solid" tab to "Color". ([61366](https://github.com/WordPress/gutenberg/pull/61366)) +- Improve panel title and description for palette. ([61365](https://github.com/WordPress/gutenberg/pull/61365)) +- Tweak palette panel spacing and empty message. ([61368](https://github.com/WordPress/gutenberg/pull/61368)) +- Update color variations. ([61334](https://github.com/WordPress/gutenberg/pull/61334)) + +#### Zoom Out +- Editor: Enable Zoom-out mode in the post editor. ([61293](https://github.com/WordPress/gutenberg/pull/61293)) +- Keep original viewport width (single scale). ([61424](https://github.com/WordPress/gutenberg/pull/61424)) +- Open inserter sidebar when clicking on inserter buttons on zoom-out mode. ([61434](https://github.com/WordPress/gutenberg/pull/61434)) +- Remove experimental zoom out control. ([61509](https://github.com/WordPress/gutenberg/pull/61509)) +- Zoomed Out View: Don't close the inserter. ([61004](https://github.com/WordPress/gutenberg/pull/61004)) + +#### Data Views +- Dataviews: Add: Bulk actions toolbar. ([59714](https://github.com/WordPress/gutenberg/pull/59714)) +- Align list and table layout visuals. ([61157](https://github.com/WordPress/gutenberg/pull/61157)) +- DataViews: Add actions to list layout. ([60805](https://github.com/WordPress/gutenberg/pull/60805)) +- Make pattern preview click area larger. ([61250](https://github.com/WordPress/gutenberg/pull/61250)) +- Post Type Actions: Unify the list of available actions. ([61520](https://github.com/WordPress/gutenberg/pull/61520)) + +#### Post Editor +- Editor: Add global styles to settings using existing context code. ([61556](https://github.com/WordPress/gutenberg/pull/61556)) +- Post Actions: Display a notice after moving a post into the trash. ([61670](https://github.com/WordPress/gutenberg/pull/61670)) +- Post Publish Flow: Simplify status term. ([61386](https://github.com/WordPress/gutenberg/pull/61386)) + +#### Layout +- Check child layout exists before generating classname. ([61392](https://github.com/WordPress/gutenberg/pull/61392)) +- Hide Image block resizer when inside a grid layout. ([61603](https://github.com/WordPress/gutenberg/pull/61603)) +- Stabilise grid layout visualiser and resizer. ([61640](https://github.com/WordPress/gutenberg/pull/61640)) + +#### Block Library +- Add block class name to the list block. ([56469](https://github.com/WordPress/gutenberg/pull/56469)) +- Embeds: Add Bluesky variation. ([61352](https://github.com/WordPress/gutenberg/pull/61352)) +- Site Logo: Add setting labels via the 'register_setting' method. ([61351](https://github.com/WordPress/gutenberg/pull/61351)) + +#### Components +- Do not render FormTokenField label when not defined. ([61336](https://github.com/WordPress/gutenberg/pull/61336)) +- Placeholder: Tweak placeholder style. ([61590](https://github.com/WordPress/gutenberg/pull/61590)) + +#### Patterns +- Only add the selected pattern category in metadata during insertion. ([61557](https://github.com/WordPress/gutenberg/pull/61557)) + +#### Block Editor +- Block editor: Add a keyboard shortcut to create group from the selected blocks. ([46972](https://github.com/WordPress/gutenberg/pull/46972)) +- Enhance block outlines and selection interactions. ([60757](https://github.com/WordPress/gutenberg/pull/60757)) +- Tiny tweak to position close button properly in the inserter. ([61461](https://github.com/WordPress/gutenberg/pull/61461)) + +#### Extensibility +- PluginSidebar: Show pin/unpin button on the site eitor. ([61448](https://github.com/WordPress/gutenberg/pull/61448)) + +#### Site Editor +- Redirect `/wp_template_part/all` to `/patterns`. ([61446](https://github.com/WordPress/gutenberg/pull/61446)) +- Moves "Patterns" command to site editor main navigation. ([61416](https://github.com/WordPress/gutenberg/pull/61416)) + +#### Navigation Menus +- Remove default entry into Navigation Menu focus mode but retain ability to access via "Edit". ([61275](https://github.com/WordPress/gutenberg/pull/61275)) + +#### Synced Patterns +- Add content only descriptions in dropdown menus for patterns and templates. ([61127](https://github.com/WordPress/gutenberg/pull/61127)) + +#### Block Styles +- Add extended version of register block style functions. ([61029](https://github.com/WordPress/gutenberg/pull/61029)) + +#### Editor +- Editor: Unify Header component. ([61273](https://github.com/WordPress/gutenberg/pull/61273)) +- Editor: Unify the sidebar between the post and site editors. ([61507](https://github.com/WordPress/gutenberg/pull/61507)) +- Editor: Update and simplify the Post Summary and Post Card section in the document sidebar. ([61624](https://github.com/WordPress/gutenberg/pull/61624)) +- Improve success messages of some post actions. ([61539](https://github.com/WordPress/gutenberg/pull/61539)) +- Try: Improve date-wrapping in prepublish flow. ([61490](https://github.com/WordPress/gutenberg/pull/61490)) +- Update: Implement the new discussion panel design. ([61357](https://github.com/WordPress/gutenberg/pull/61357)) + +### New APIs + +#### Extensibility +- Make `BlockPopover` component public. ([61529](https://github.com/WordPress/gutenberg/pull/61529)) + + +### Bug Fixes + +#### Layout +- Fix grid item resizing in non-iframed editor. ([61636](https://github.com/WordPress/gutenberg/pull/61636)) +- Fix resizing items to top and left with GridItemResizer. ([60986](https://github.com/WordPress/gutenberg/pull/60986)) +- Grid Visualizer: Fix grid item resizing in site editor. ([61641](https://github.com/WordPress/gutenberg/pull/61641)) +- Grid Visualizer: Fix resize not ending when mouse is released outside grid's bounds. ([61668](https://github.com/WordPress/gutenberg/pull/61668)) +- GridItemResizer: Fix resizing when List View is open. ([61643](https://github.com/WordPress/gutenberg/pull/61643)) +- Only show grid resizer if grid block allows resizing on children. ([61552](https://github.com/WordPress/gutenberg/pull/61552)) + +#### Zoom Out +- Block editor: Scroll block into view on insert. ([61418](https://github.com/WordPress/gutenberg/pull/61418)) +- Fix double scrollbars in site editor with zoom out view enabled. ([61548](https://github.com/WordPress/gutenberg/pull/61548)) +- Fix zoom out UI scale. ([61265](https://github.com/WordPress/gutenberg/pull/61265)) +- Add bottom and top inserters. ([61473](https://github.com/WordPress/gutenberg/pull/61473)) +- Add patterns loading state. ([61513](https://github.com/WordPress/gutenberg/pull/61513)) +- Don't allow dropping outside section root. ([61512](https://github.com/WordPress/gutenberg/pull/61512)) +- Don't select last block. ([61484](https://github.com/WordPress/gutenberg/pull/61484)) +- Pass the section root ID to the inserter. ([61464](https://github.com/WordPress/gutenberg/pull/61464)) +- Zoom-out: Fix iframe ref error. ([61200](https://github.com/WordPress/gutenberg/pull/61200)) + +#### Block Library +- Add list item wrapper to social links when used in navigation block. ([61396](https://github.com/WordPress/gutenberg/pull/61396)) +- Fix: Remove font weight on toolbar tab button - #61254. ([61308](https://github.com/WordPress/gutenberg/pull/61308)) +- Fix: Time to Read block showing "this block has encountered an error" - #61459. ([61614](https://github.com/WordPress/gutenberg/pull/61614)) +- Image Block: Enable crop action when image has a link. ([61470](https://github.com/WordPress/gutenberg/pull/61470)) +- Shortcode Block: Fix layout margin override. ([55028](https://github.com/WordPress/gutenberg/pull/55028)) + +#### Global Styles +- Background image: Explicitly set background repeat value in user styles. ([61526](https://github.com/WordPress/gutenberg/pull/61526)) +- Background image: Size controls should show when an image is set. ([61388](https://github.com/WordPress/gutenberg/pull/61388)) +- Make sure to replace all instances of `:Where(body)` instead of just …. ([61602](https://github.com/WordPress/gutenberg/pull/61602)) +- Reduce specificity of global styles body margin reset rule. ([61340](https://github.com/WordPress/gutenberg/pull/61340)) +- Remove Post Template background override. ([61545](https://github.com/WordPress/gutenberg/pull/61545)) + +#### Block Editor +- Editor styles: Fix cache (by wrapper selector). ([61397](https://github.com/WordPress/gutenberg/pull/61397)) +- Fix Truncate component for long unbreakable text. ([61137](https://github.com/WordPress/gutenberg/pull/61137)) +- Fix focus loss due to filtering blocks. ([61558](https://github.com/WordPress/gutenberg/pull/61558)) +- Fix: The issue of appender button not clickable in row/stack group. ([61585](https://github.com/WordPress/gutenberg/pull/61585)) +- Writing Flow/Rich Text: Unify split logic. ([54543](https://github.com/WordPress/gutenberg/pull/54543)) + +#### List View +- Account for text fields in shortcut handler. ([61583](https://github.com/WordPress/gutenberg/pull/61583)) +- Add a special case for shortcuts coming from modals. ([61606](https://github.com/WordPress/gutenberg/pull/61606)) +- Standardize List View feature name to use title case capitalization. ([61535](https://github.com/WordPress/gutenberg/pull/61535)) + +#### Components +- Fix inconsistent complementary header styles. ([61331](https://github.com/WordPress/gutenberg/pull/61331)) +- Fix sticking “Reset” option in `ToolsPanel`. ([60621](https://github.com/WordPress/gutenberg/pull/60621)) +- RadioControl: Fix shrinking radio controls. ([61476](https://github.com/WordPress/gutenberg/pull/61476)) + +#### Interactivity API +- Interactivity API: Allow multiple event handlers for the same type with `data-wp-on-document` and `data-wp-on-window`. ([61009](https://github.com/WordPress/gutenberg/pull/61009)) +- Interactivity API: Prevent empty namespace or different namespaces from killing the runtime. ([61409](https://github.com/WordPress/gutenberg/pull/61409)) +- Interactivity API: Prevent wrong written directives from killing the runtime. ([61249](https://github.com/WordPress/gutenberg/pull/61249)) + +#### Site Editor +- Fix user capabilities check for the Site Editor. ([61444](https://github.com/WordPress/gutenberg/pull/61444)) +- Preserve the wp_theme_preview query arg when navigating in Site Editor. ([61394](https://github.com/WordPress/gutenberg/pull/61394)) +- Trigger sidebar animations only on cross-route navigations. ([61402](https://github.com/WordPress/gutenberg/pull/61402)) +- Site Editor: Restore the hover zoom effect when hovering the editor frame. ([61647](https://github.com/WordPress/gutenberg/pull/61647)) + +#### Data Views +- Fix regression on keyboard navigation. ([61478](https://github.com/WordPress/gutenberg/pull/61478)) +- fix: Improve dataview types. ([61586](https://github.com/WordPress/gutenberg/pull/61586)) + +#### Patterns +- Fix blocks in unsynced patterns can enable overrides. ([61639](https://github.com/WordPress/gutenberg/pull/61639)) + +#### Synced Patterns +- Revert "Use contentOnly locking for pattern block, remove hard-coded block check in block inspector". ([61517](https://github.com/WordPress/gutenberg/pull/61517)) + +#### Widgets Editor +- Hide the close button on the inserter for widgets editor. ([61510](https://github.com/WordPress/gutenberg/pull/61510)) + +#### Post Editor +- Edit Post: Fix the 'usePaddingAppender' error. ([61500](https://github.com/WordPress/gutenberg/pull/61500)) + + +### Accessibility + +#### Block Editor +- Focus currently selected block when entering canvas. ([61472](https://github.com/WordPress/gutenberg/pull/61472)) +- Focus inserter toggle when closing the inserter sidebar. ([61467](https://github.com/WordPress/gutenberg/pull/61467)) + +#### Components +- ComboboxControl supports disabled items. ([61294](https://github.com/WordPress/gutenberg/pull/61294)) +- Remove usage of aria-details from InputControl and BaseControl. ([61203](https://github.com/WordPress/gutenberg/pull/61203)) + +#### Post Editor +- Post Actions: Correctly disable dropdown trigger. ([61625](https://github.com/WordPress/gutenberg/pull/61625)) + +#### Block Library +- Fix the RRS block placeholder labeling and improve spacing. ([61576](https://github.com/WordPress/gutenberg/pull/61576)) + +#### Zoom Out +- Inserter: Add close button. ([61421](https://github.com/WordPress/gutenberg/pull/61421)) + + +### Performance + +- Calculate and report quartiles in performance results. ([60950](https://github.com/WordPress/gutenberg/pull/60950)) +- Refactor InserterTabs to use children and remove re-memoizing. ([61295](https://github.com/WordPress/gutenberg/pull/61295)) +- Tests: Improve collection and reporting. ([61450](https://github.com/WordPress/gutenberg/pull/61450)) +- Performance tests: Fix results file path. ([61686](https://github.com/WordPress/gutenberg/pull/61686)) +- Revert "useBlockSync: Remove isControlled effect". ([61480](https://github.com/WordPress/gutenberg/pull/61480)) + + +### Experiments + +#### Layout +- Grid interactivity: Improve `max` attribute logic. ([61420](https://github.com/WordPress/gutenberg/pull/61420)) +- Grid interactivity: Improve how grid resizer handles 0-width and 0-height cells. ([61423](https://github.com/WordPress/gutenberg/pull/61423)) +- Grid interactivity: Show grid visualizer when block inspector is closed. ([61429](https://github.com/WordPress/gutenberg/pull/61429)) + + +### Documentation + +- Update old document URLs to new ones. ([61595](https://github.com/WordPress/gutenberg/pull/61595)) +- Add a section about `block_editor_settings_all` to the Filters and Hooks doc. ([61597](https://github.com/WordPress/gutenberg/pull/61597)) +- Add link to VS Code Playwright Extension. ([61505](https://github.com/WordPress/gutenberg/pull/61505)) +- Added check for duplicated slugs during manifest.json generation. ([61332](https://github.com/WordPress/gutenberg/pull/61332)) +- Block Editor: Remove `multiline` prop from `Richtext` doc. ([61592](https://github.com/WordPress/gutenberg/pull/61592)) +- Docs: How-to Guides > Meta Boxes - Update metabox.md. ([61314](https://github.com/WordPress/gutenberg/pull/61314)) +- Docs: Interactivity API - Add viewScriptModule as a requirement to work with the Interactivity API. ([61355](https://github.com/WordPress/gutenberg/pull/61355)) +- Docs: Interactivity API : New pages - About and FAQ. ([61323](https://github.com/WordPress/gutenberg/pull/61323)) +- Docs: Interactivity Api - Small fixes. ([61403](https://github.com/WordPress/gutenberg/pull/61403)) +- Docs: Remove list of keyboard shortcuts from FAQ page. ([61591](https://github.com/WordPress/gutenberg/pull/61591)) +- Docs: Update theme-json-living.md to fix little issue. ([61354](https://github.com/WordPress/gutenberg/pull/61354)) +- Fix WP versions for theme.json v3 migration in inline documentation. ([61328](https://github.com/WordPress/gutenberg/pull/61328)) +- Several Typo Correction in Inline doc. ([61379](https://github.com/WordPress/gutenberg/pull/61379)) +- Small fixes as per feedback received. ([61445](https://github.com/WordPress/gutenberg/pull/61445)) +- Theme.json: Update schema with working create theme link. ([61306](https://github.com/WordPress/gutenberg/pull/61306)) +- Update @wordpress/a11y README.md. ([61635](https://github.com/WordPress/gutenberg/pull/61635)) +- Update Node.js requirement in create-block docs. ([60962](https://github.com/WordPress/gutenberg/pull/60962)) +- Update and restructure the Editor Hooks doc. ([61596](https://github.com/WordPress/gutenberg/pull/61596)) +- Updated links to developer resources on README.md. ([61525](https://github.com/WordPress/gutenberg/pull/61525)) +- theme.json schema: Remove duplicate key. ([61523](https://github.com/WordPress/gutenberg/pull/61523)) +- Several Typo Corrections in Inline Documentations. ([61662](https://github.com/WordPress/gutenberg/pull/61662)) + + +### Code Quality + +- PHP load: move rest template controller 6.6 import to "REST" area. ([61564](https://github.com/WordPress/gutenberg/pull/61564)) +- Background images: Remove lingering "file" prop. ([61469](https://github.com/WordPress/gutenberg/pull/61469)) +- Replace classnames with clsx. ([61138](https://github.com/WordPress/gutenberg/pull/61138)) +- Fix JS lint error for `clsx`. ([61380](https://github.com/WordPress/gutenberg/pull/61380)) + +#### Data Views +- DataViews: Expand typing more components. ([61654](https://github.com/WordPress/gutenberg/pull/61654)) +- Add end-to-end tests for keyboard interactions in DataViews ListView. ([61648](https://github.com/WordPress/gutenberg/pull/61648)) +- DataViews: Add types to the ViewGrid component. ([61667](https://github.com/WordPress/gutenberg/pull/61667)) +- DataViews: Type the BulkActions component. ([61666](https://github.com/WordPress/gutenberg/pull/61666)) +- DataViews: Type the ItemActions component. ([61400](https://github.com/WordPress/gutenberg/pull/61400)) +- DataViews: Type the ViewList component. ([61246](https://github.com/WordPress/gutenberg/pull/61246)) +- Remove `onActionPerformed` & `onActionStart` from the ActionModal API. ([61659](https://github.com/WordPress/gutenberg/pull/61659)) + +#### Block bindings +- Remove not needed breaks in `gutenberg_block_bindings_replace_html`. ([61660](https://github.com/WordPress/gutenberg/pull/61660)) +- Simplify the HTML replacement logic until the HTML API is ready. ([61236](https://github.com/WordPress/gutenberg/pull/61236)) + +#### Post Editor +- Edit post: Do not consider sidebars mutually exclusive. ([61468](https://github.com/WordPress/gutenberg/pull/61468)) +- Editor: Move the sidebar component to the editor package. ([61497](https://github.com/WordPress/gutenberg/pull/61497)) + +#### Components +- Assess stabilization of `Theme`. ([61077](https://github.com/WordPress/gutenberg/pull/61077)) +- Upgrade @types/react package and @types/react-dom. ([60796](https://github.com/WordPress/gutenberg/pull/60796)) +- Fix problem with gradient-parser types. ([61679](https://github.com/WordPress/gutenberg/pull/61679)) + +#### Interactivity API +- Interactivity API: Add types for warn helper. ([61687](https://github.com/WordPress/gutenberg/pull/61687)) +- Interactivity: Strict type checking. ([59865](https://github.com/WordPress/gutenberg/pull/59865)) + +#### Block Editor +- Improve `LineHeightControl` unit tests. ([61337](https://github.com/WordPress/gutenberg/pull/61337)) + +#### Site Editor +- Site Editor sidebar: Provide explicit backPaths, remove the getBackPath helper. ([61286](https://github.com/WordPress/gutenberg/pull/61286)) + +#### Patterns +- Pattern overrides: Use block binding editing API. ([60721](https://github.com/WordPress/gutenberg/pull/60721)) + +#### Editor +- Editor: Move the starter template options to the editor package. ([61665](https://github.com/WordPress/gutenberg/pull/61665)) +- Post Actions: Don't export duplicatePostAction for now. ([61407](https://github.com/WordPress/gutenberg/pull/61407)) + +### Tools + +#### Testing +- Convert FocalPointPicker tests to TypeScript. ([61373](https://github.com/WordPress/gutenberg/pull/61373)) +- E2E: Fix artifacts handling in CI. ([61338](https://github.com/WordPress/gutenberg/pull/61338)) +- Interactivity API: Fix flaky tests for attribute hydration. ([61615](https://github.com/WordPress/gutenberg/pull/61615)) +- Lightbox UI block override tests. ([61414](https://github.com/WordPress/gutenberg/pull/61414)) +- Playwright Utils: Silence some of the warnings coming from Firefox. ([61451](https://github.com/WordPress/gutenberg/pull/61451)) +- Test: Fix failing style linting error. ([61649](https://github.com/WordPress/gutenberg/pull/61649)) +- Tests: Fix flaky interactivity deferred test. ([61359](https://github.com/WordPress/gutenberg/pull/61359)) + +#### Build Tooling +- Add stylelint rule to disallow the `order` CSS property. ([61243](https://github.com/WordPress/gutenberg/pull/61243)) +- Enforce `@since` tags in /packages/block-serialization-default-parser/ and other files. ([60007](https://github.com/WordPress/gutenberg/pull/60007)) +- Bug: False positives for `react-hooks/exhaustive-deps`. ([61599](https://github.com/WordPress/gutenberg/pull/61599)) +- Scripts: Add RTLCSS to wp-scripts. ([61540](https://github.com/WordPress/gutenberg/pull/61540)) +- WP-ENV: Fix return type and tests. ([61631](https://github.com/WordPress/gutenberg/pull/61631)) +- Create Block: Match specified engines with Gutenberg and Core. ([61430](https://github.com/WordPress/gutenberg/pull/61430)) +- Set `prefer-dedupe` as the default. ([61630](https://github.com/WordPress/gutenberg/pull/61630)) +- build: Suggest workaround if `tsc --build` fails. ([61501](https://github.com/WordPress/gutenberg/pull/61501)) +- build:package-types: Run silently to reduce user confusion. ([61530](https://github.com/WordPress/gutenberg/pull/61530)) +- GitHub Actions: Fix PHP file change detection filter pattern. ([61183](https://github.com/WordPress/gutenberg/pull/61183)) +- Dedupe packages. ([61532](https://github.com/WordPress/gutenberg/pull/61532)) +- Patch react-autosize-textarea for updated types. ([61570](https://github.com/WordPress/gutenberg/pull/61570)) +- Upgrade @use-gesture/react. ([61503](https://github.com/WordPress/gutenberg/pull/61503)) +- Upgrade framer-motion. ([61572](https://github.com/WordPress/gutenberg/pull/61572)) + + +## First time contributors + +The following PRs were merged by first time contributors: + +- @amitraj2203: Embeds: Add Bluesky variation. ([61352](https://github.com/WordPress/gutenberg/pull/61352)) +- @jpstevens: Convert FocalPointPicker tests to TypeScript. ([61373](https://github.com/WordPress/gutenberg/pull/61373)) +- @kovshenin: Update Node.js requirement in create-block docs. ([60962](https://github.com/WordPress/gutenberg/pull/60962)) +- @mrmurphy: Upgrade @types/react package and @types/react-dom. ([60796](https://github.com/WordPress/gutenberg/pull/60796)) +- @scheinercc: Update @wordpress/a11y README.md. ([61635](https://github.com/WordPress/gutenberg/pull/61635)) +- @StyleShit: Bug: False positives for `react-hooks/exhaustive-deps`. ([61599](https://github.com/WordPress/gutenberg/pull/61599)) +- @vipul0425: Fix: The issue of appender button not clickable in row/stack group. ([61585](https://github.com/WordPress/gutenberg/pull/61585)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @afercia @ajlende @amitraj2203 @anton-vlasenko @artemiomorales @bacoords @carolinan @cbravobernal @colinduwe @DaniGuardiola @DAreRodz @desrosj @draganescu @ellatrix @fullofcaffeine @geriux @getdave @gigitux @hbhalodia @jameskoster @jasmussen @jeryj @jffng @johnhooks @jorgefilipecosta @jpstevens @jsnajdr @juanmaguitar @kevin940726 @kovshenin @MaggieCabrera @Mamaduka @mcsf @mrmurphy @ndiego @noisysocks @ntsekouras @oandregal @ramonjd @retrofox @richtabor @ryelle @SantosGuillamot @scheinercc @scruffian @shail-mehta @sirreal @stokesman @StyleShit @swissspidy @t-hamano @talldan @tellthemachines @tyxla @vipul0425 @WunderBart @youknowriad + + += 18.3.0 = + +## Changelog + +### Enhancements + +- Output post classes in the editor. ([60642](https://github.com/WordPress/gutenberg/pull/60642)) +- Abstract keyboard shortcuts for heading to paragraph transform and vice-versa. ([60606](https://github.com/WordPress/gutenberg/pull/60606)) +- Capitalize more occurrences of Navigation Menu. ([60747](https://github.com/WordPress/gutenberg/pull/60747)) +- Clean up top toolbar to use same metrics as block toolbar. ([61126](https://github.com/WordPress/gutenberg/pull/61126)) +- Update template and template parts labels. ([61146](https://github.com/WordPress/gutenberg/pull/61146)) +- Update the template preview menu item text in the Template option. ([57802](https://github.com/WordPress/gutenberg/pull/57802)) +- Upgrade React to v18.3. ([61202](https://github.com/WordPress/gutenberg/pull/61202)) + +#### Site Editor +- Add PluginDocumentSettingPanel in template inspector controls. ([60961](https://github.com/WordPress/gutenberg/pull/60961)) +- Add publish flow in site editor. ([61136](https://github.com/WordPress/gutenberg/pull/61136)) +- Classic Theme: Expose new Patterns page and remove Template Parts submenu. ([61080](https://github.com/WordPress/gutenberg/pull/61080)) +- Consolidate editor/canvas resize handles. ([60712](https://github.com/WordPress/gutenberg/pull/60712)) +- Patterns data view: Remove icons in favor of dedicated sync status field. ([60833](https://github.com/WordPress/gutenberg/pull/60833)) +- Patterns: Remove "Manage all parts" page & link. ([60689](https://github.com/WordPress/gutenberg/pull/60689)) +- Tweak Template/Template Parts/Page creation modal. ([61005](https://github.com/WordPress/gutenberg/pull/61005)) +- Drop patterns and blocks between sections only in zoom out mode. ([60828](https://github.com/WordPress/gutenberg/pull/60828)) +- Insert patterns at the end of the root section. ([60855](https://github.com/WordPress/gutenberg/pull/60855)) +- Typography Panel: Use simple labels. ([60886](https://github.com/WordPress/gutenberg/pull/60886)) +- Font Library: Convert heading text to heading elements and group fonts as a list. ([58834](https://github.com/WordPress/gutenberg/pull/58834)) + +#### Block Editor +- Add new `TextAlignmentControl` component. ([60841](https://github.com/WordPress/gutenberg/pull/60841)) +- Editor: Sort style overrides by block client ids. ([61039](https://github.com/WordPress/gutenberg/pull/61039)) +- Inserter: Bail early when a user has no permission to upload media. ([60983](https://github.com/WordPress/gutenberg/pull/60983)) +- List View: Use 'isMatch' for unselect the shortcut. ([61223](https://github.com/WordPress/gutenberg/pull/61223)) +- Move search into inserter tabs. ([61108](https://github.com/WordPress/gutenberg/pull/61108)) +- Polish Autocomplete popover. ([60131](https://github.com/WordPress/gutenberg/pull/60131)) + +#### Global Styles +- Add scoping of feature level selectors for custom block style variations. ([61033](https://github.com/WordPress/gutenberg/pull/61033)) +- Allow negative values for margin controls. ([60347](https://github.com/WordPress/gutenberg/pull/60347)) +- Allow opt out of certain sets of styles in the editor. ([61035](https://github.com/WordPress/gutenberg/pull/61035)) +- Filter out color and typography variations. ([60220](https://github.com/WordPress/gutenberg/pull/60220)) +- Update utils for scoping CSS selectors. ([61026](https://github.com/WordPress/gutenberg/pull/61026)) +- Add defaultFontSizes theme.json (theme.json v3). ([58409](https://github.com/WordPress/gutenberg/pull/58409)) + +#### Block Library +- Group: Remove hardcoded Group block example styles. ([61027](https://github.com/WordPress/gutenberg/pull/61027)) +- Remove `Button` component from social link block, replace with `button` element. ([61270](https://github.com/WordPress/gutenberg/pull/61270)) +- List View: Unify shortcut handlers. ([61130](https://github.com/WordPress/gutenberg/pull/61130)) +- Update list view spacing. ([60713](https://github.com/WordPress/gutenberg/pull/60713)) + +#### Post Editor +- Editor: Move around word count, post status and last edited info in page summary. ([61235](https://github.com/WordPress/gutenberg/pull/61235)) +- Editor: Update post excerpt panel with new designs. ([60894](https://github.com/WordPress/gutenberg/pull/60894)) +- Add duplicate post action. ([60637](https://github.com/WordPress/gutenberg/pull/60637)) +- Make duplicate post action available only on the plugin for now. ([61192](https://github.com/WordPress/gutenberg/pull/61192)) + +#### Data Views +- Unbox items in grid layout. ([61159](https://github.com/WordPress/gutenberg/pull/61159)) +- Update alignment of preview contents in Patterns and Templates data views. ([61190](https://github.com/WordPress/gutenberg/pull/61190)) + +#### Components +- ComboboxControl: Simplify string normalization. ([60893](https://github.com/WordPress/gutenberg/pull/60893)) +- Update help text alignment in CheckboxControl. ([60787](https://github.com/WordPress/gutenberg/pull/60787)) +- RangeControl: Remove deprecated `reducedMotion` util. ([61119](https://github.com/WordPress/gutenberg/pull/61119)) +- components - inputStyleNeutral: Remove deprecated `reducedMotion` util. ([61122](https://github.com/WordPress/gutenberg/pull/61122)) + +### Bug Fixes + +- Editor: Do not show scrollbars when closing sidebars. ([60889](https://github.com/WordPress/gutenberg/pull/60889)) +- Fix block tab spacing when few available blocks. ([61296](https://github.com/WordPress/gutenberg/pull/61296)) +- Fix pattern preview focus styles. ([60881](https://github.com/WordPress/gutenberg/pull/60881)) +- Fix styles panel header. ([61319](https://github.com/WordPress/gutenberg/pull/61319)) +- Fix typo in clear customizations text. ([61089](https://github.com/WordPress/gutenberg/pull/61089)) +- Fix: Missing format, categories, and tags on the duplicate post action. ([61194](https://github.com/WordPress/gutenberg/pull/61194)) +- Fix: Post actions in post card panel is not checking for eligibility. ([60994](https://github.com/WordPress/gutenberg/pull/60994)) +- Notices: Fix snackbar placement. ([60912](https://github.com/WordPress/gutenberg/pull/60912)) +- Setup Node action - Set arch for key value. ([61010](https://github.com/WordPress/gutenberg/pull/61010)) +- docgen: Fix qualified types with type parameters. ([61097](https://github.com/WordPress/gutenberg/pull/61097)) +- Background image: Tools panel shouldn't show reset button for inherited values. ([61304](https://github.com/WordPress/gutenberg/pull/61304)) +- Fix template files query by post-type. ([61244](https://github.com/WordPress/gutenberg/pull/61244)) +- Remove unnecessary period in template block selection notice. ([61087](https://github.com/WordPress/gutenberg/pull/61087)) +- Fix issue where pattern override values reset when saving. ([61023](https://github.com/WordPress/gutenberg/pull/61023)) +- Blocks: Merge variations bootstrapped from a server with the client definitions. ([60832](https://github.com/WordPress/gutenberg/pull/60832)) +- Bump minimum required WordPress version to 6.4. ([60780](https://github.com/WordPress/gutenberg/pull/60780)) + +#### Site Editor +- DocumentBar: Account for when top toolbar is open. ([61118](https://github.com/WordPress/gutenberg/pull/61118)) +- Don't show appender at all inside sections on zoom-out mode. ([60948](https://github.com/WordPress/gutenberg/pull/60948)) +- Editor: Avoid triggering the start page modal on unsaved pages. ([61082](https://github.com/WordPress/gutenberg/pull/61082)) +- Fix zoom out mode background color on Safari. ([60873](https://github.com/WordPress/gutenberg/pull/60873)) +- Fix: Pattern details page backpath. ([61174](https://github.com/WordPress/gutenberg/pull/61174)) +- Make the zoom out inserters work for sections inside the section root. ([60909](https://github.com/WordPress/gutenberg/pull/60909)) +- Select last section if parent section doesn't exist. ([61002](https://github.com/WordPress/gutenberg/pull/61002)) + +#### Components +- Box Control: Fix issue with negative values. ([60984](https://github.com/WordPress/gutenberg/pull/60984)) +- Fix usages of uSES with missing getServerSnapshot. ([60943](https://github.com/WordPress/gutenberg/pull/60943)) + +#### Block Library +- Avoid unnecessary heading level and paragraph transform via keyboard shortcuts. ([60955](https://github.com/WordPress/gutenberg/pull/60955)) +- Navigation: Remove unnecessary `__experimentalStyle`. ([60965](https://github.com/WordPress/gutenberg/pull/60965)) + +### Accessibility + +- Add aria-haspopup="dialog" to Enable/Disable overrides button. ([61309](https://github.com/WordPress/gutenberg/pull/61309)) +- Fix unlabeled PostURL Copy button. ([61195](https://github.com/WordPress/gutenberg/pull/61195)) +- [Data Views] User patterns: Use excerpt as description. ([60549](https://github.com/WordPress/gutenberg/pull/60549)) + +### Performance + +- Block lib: columns: Remove store subs on mount. ([61123](https://github.com/WordPress/gutenberg/pull/61123)) +- Block: Remove outline related store selecting. ([61139](https://github.com/WordPress/gutenberg/pull/61139)) +- Rich text: Combine all ref effects. ([60936](https://github.com/WordPress/gutenberg/pull/60936)) +- Template lock: Batch block disabling. ([60934](https://github.com/WordPress/gutenberg/pull/60934)) +- useBlockSync: Avoid replacing blocks twice on mount. ([60967](https://github.com/WordPress/gutenberg/pull/60967)) +- useMatchMedia: Cache queries. ([61000](https://github.com/WordPress/gutenberg/pull/61000)) +- ListViewBlock: Combine 'useSelect' hooks, part two. ([61054](https://github.com/WordPress/gutenberg/pull/61054)) +- Remove `showFixedToolbar` from `useShowBlockTools`. ([60717](https://github.com/WordPress/gutenberg/pull/60717)) +- Editor: Optimize some of the post-support panels. ([61003](https://github.com/WordPress/gutenberg/pull/61003)) +- Core data: getEditedEntityRecord: Do not return empty object. ([60988](https://github.com/WordPress/gutenberg/pull/60988)) +- Drop zone: Avoid media query on mount. ([60546](https://github.com/WordPress/gutenberg/pull/60546)) +- Nav link: Use rich text value. ([60503](https://github.com/WordPress/gutenberg/pull/60503)) + + +### Experiments + +#### Interactivity API +- Add full page client-side navigation experiment setting. ([59707](https://github.com/WordPress/gutenberg/pull/59707)) + +### Documentation + +- Add AutosaveMonitor component JSDoc enhancements. ([60905](https://github.com/WordPress/gutenberg/pull/60905)) +- Add Documentation for CharacterCount component. ([60906](https://github.com/WordPress/gutenberg/pull/60906)) +- Add EditorSnackbars component documentation. ([61110](https://github.com/WordPress/gutenberg/pull/61110)) +- Add documentation for DocumentOutline and DocumentOutlineCheck components. ([61129](https://github.com/WordPress/gutenberg/pull/61129)) +- Add documentation for EditorHistoryRedo and EditorHistoryUndo. ([60932](https://github.com/WordPress/gutenberg/pull/60932)) +- Add documentation for EditorKeyboardShortcuts and EditorKeyboardShortcutsRegister. ([60933](https://github.com/WordPress/gutenberg/pull/60933)) +- Add documentation for PostAuthor, PostAuthorCheck, PostAuthorPanel components. ([61090](https://github.com/WordPress/gutenberg/pull/61090)) +- Added doc for components PageAttributesCheck, PageAttributesPanel, PageAttributesOrder, PageAttributesParent. ([60977](https://github.com/WordPress/gutenberg/pull/60977)) +- Change the name of the Interactivity API quick start guide markdown file. ([61198](https://github.com/WordPress/gutenberg/pull/61198)) +- Docs: Fix import statement of PluginMoreMenuItem. ([60931](https://github.com/WordPress/gutenberg/pull/60931)) +- Docs: Handle "oneOf" in theme.json schema doc generation. ([61024](https://github.com/WordPress/gutenberg/pull/61024)) +- Fix import in block editor’s readme example. ([61218](https://github.com/WordPress/gutenberg/pull/61218)) +- Fix use local version of theme.json schema in bundled files. ([61312](https://github.com/WordPress/gutenberg/pull/61312)) +- FontSizerPicker: Improve documentation for default units. ([60996](https://github.com/WordPress/gutenberg/pull/60996)) +- InputControl: Added password visibility story. ([60898](https://github.com/WordPress/gutenberg/pull/60898)) +- Move iAPI documentation from package to reference guides. ([61143](https://github.com/WordPress/gutenberg/pull/61143)) +- Refresh the folder structure documentation page. ([60953](https://github.com/WordPress/gutenberg/pull/60953)) +- Small-typo-change. ([61178](https://github.com/WordPress/gutenberg/pull/61178)) +- Theme JSON: Backport PHP annotations from Core. ([61301](https://github.com/WordPress/gutenberg/pull/61301)) +- Update an anchor link in block-in-the-editor.md. ([59527](https://github.com/WordPress/gutenberg/pull/59527)) +- Update block-deprecation.md. ([60768](https://github.com/WordPress/gutenberg/pull/60768)) +- Update documentation for theme.json version 3. ([61221](https://github.com/WordPress/gutenberg/pull/61221)) +- Update main readme file with relevant current information. ([60942](https://github.com/WordPress/gutenberg/pull/60942)) + + +### Code Quality + +- DataViews: Enable types. ([61185](https://github.com/WordPress/gutenberg/pull/61185)) +- Editor: Cleanup edit-post classnames and documentation. ([61240](https://github.com/WordPress/gutenberg/pull/61240)) +- Editor: Consistently deprecate edit-post and edit-site slots. ([61134](https://github.com/WordPress/gutenberg/pull/61134)) +- Editor: Unify the BlockContextualToolbar component between post and site editors. ([61104](https://github.com/WordPress/gutenberg/pull/61104)) +- Editor: Unify the more menu. ([60910](https://github.com/WordPress/gutenberg/pull/60910)) +- Editor: Unify the region navigation keyboard shortcuts. ([60907](https://github.com/WordPress/gutenberg/pull/60907)) +- Fix: Actions moved to the editor package still reference edit-site on their ids. ([60899](https://github.com/WordPress/gutenberg/pull/60899)) +- Remove unnecessary `usesContext` from paragraph block. ([61008](https://github.com/WordPress/gutenberg/pull/61008)) +- Removed Extra Space Before Since. ([60918](https://github.com/WordPress/gutenberg/pull/60918)) +- ToolsMoreMenuGroup: Remove form post editor. ([61132](https://github.com/WordPress/gutenberg/pull/61132)) +- Unify placeholders. ([59275](https://github.com/WordPress/gutenberg/pull/59275)) +- Use `math.div` for scss division. ([61285](https://github.com/WordPress/gutenberg/pull/61285)) +- useBlockProps: Remove dead code. ([61133](https://github.com/WordPress/gutenberg/pull/61133)) +- useBlockSync: Just testing without isControlled effect. ([61114](https://github.com/WordPress/gutenberg/pull/61114)) +- Add eslint autofix commit to ignored git commits. ([61253](https://github.com/WordPress/gutenberg/pull/61253)) +- Rephrasing for accuracy and link to Core Trac ticket. ([61284](https://github.com/WordPress/gutenberg/pull/61284)) +- Blocks: Add a warning when registering variation without a name. ([61037](https://github.com/WordPress/gutenberg/pull/61037)) +- DataViews: Cleanup unused type property. ([61197](https://github.com/WordPress/gutenberg/pull/61197)) +- DataViews: More dataviews types. ([61193](https://github.com/WordPress/gutenberg/pull/61193)) +- Quality: Fix php warning error. ([61321](https://github.com/WordPress/gutenberg/pull/61321)) +- UseLocation instead of window.location.href. ([61230](https://github.com/WordPress/gutenberg/pull/61230)) +- Use contentOnly locking for pattern block. ([61227](https://github.com/WordPress/gutenberg/pull/61227)) +- Editor: No need to memorize callback in 'SwapTemplateButton'. ([61049](https://github.com/WordPress/gutenberg/pull/61049)) +- Improve data-wp-context debugging by validating it as a stringified JSON Object. ([61045](https://github.com/WordPress/gutenberg/pull/61045)) +- Theme JSON: Extract util to get valid block style variations. ([61030](https://github.com/WordPress/gutenberg/pull/61030)) +- Elements: Deprecate old block support filter callbacks. ([59538](https://github.com/WordPress/gutenberg/pull/59538)) + +#### Components +- AlignmentMatrixControl: Remove deprecated `reducedMotion` util. ([61113](https://github.com/WordPress/gutenberg/pull/61113)) +- FocalPointPicker: Remove deprecated `reducedMotion` util. ([61116](https://github.com/WordPress/gutenberg/pull/61116)) +- Navigation: Remove deprecated `reducedMotion` util. ([61117](https://github.com/WordPress/gutenberg/pull/61117)) +- Remove "experimental" designation for `CustomSelectControlV2`. ([61078](https://github.com/WordPress/gutenberg/pull/61078)) +- ToggleGroupControl: Remove deprecated `reducedMotion` util. ([61120](https://github.com/WordPress/gutenberg/pull/61120)) +- View: Fix TypeScript types. ([60919](https://github.com/WordPress/gutenberg/pull/60919)) +- components/elevation: Remove deprecated reducedMotion util. ([61115](https://github.com/WordPress/gutenberg/pull/61115)) + +#### Block Editor +- Convert Media Inserter to Tabs Pattern. ([60970](https://github.com/WordPress/gutenberg/pull/60970)) +- Obviate mousetrap around Navigation Link popover. ([61050](https://github.com/WordPress/gutenberg/pull/61050)) +- editPost: Deprecate __experimentalPluginPostExcerpt. ([61188](https://github.com/WordPress/gutenberg/pull/61188)) +- editPost: __experimentalPluginPostExcerpt return ``. ([61238](https://github.com/WordPress/gutenberg/pull/61238)) +- useBlockRefs: Use more efficient lookup map, use uSES. ([60945](https://github.com/WordPress/gutenberg/pull/60945)) +- withBlockTree: Simplify code that replaces/removes controlled blocks. ([61234](https://github.com/WordPress/gutenberg/pull/61234)) + +### Tools + +- ESLint Plugin: Handle multi-line translator comments. ([61096](https://github.com/WordPress/gutenberg/pull/61096)) + +#### Testing +- Components: Fix snapshot tests of ToggleGroupControl. ([61228](https://github.com/WordPress/gutenberg/pull/61228)) +- Fix ESLint warning in Performance test files. ([61311](https://github.com/WordPress/gutenberg/pull/61311)) +- Hotfix: Fixed failing snapshot test. ([61274](https://github.com/WordPress/gutenberg/pull/61274)) +- Update 3rd party actions within composite action. ([61211](https://github.com/WordPress/gutenberg/pull/61211)) + +#### Build Tooling +- Remove block-editor package usage from components. ([60999](https://github.com/WordPress/gutenberg/pull/60999)) +- lint-staged-typecheck: Don't run TSC when no TS project is affected. ([60998](https://github.com/WordPress/gutenberg/pull/60998)) + + +## First time contributors + +The following PRs were merged by first time contributors: + +- @huubl: Output post classes in the editor. ([60642](https://github.com/WordPress/gutenberg/pull/60642)) +- @itzmekhokan: Fix typo in clear customizations text. ([61089](https://github.com/WordPress/gutenberg/pull/61089)) +- @lanresmith: Update an anchor link in block-in-the-editor.md. ([59527](https://github.com/WordPress/gutenberg/pull/59527)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @afercia @ajlende @carolinan @cbravobernal @colorful-tones @DaniGuardiola @desrosj @draganescu @ellatrix @fabiankaegy @fullofcaffeine @geriux @huubl @itzmekhokan @jameskoster @jasmussen @jeryj @jorgefilipecosta @jsnajdr @juanfra @juanmaguitar @lanresmith @MaggieCabrera @Mamaduka @mirka @ntsekouras @oandregal @ockham @ramonjd @retrofox @richtabor @SantosGuillamot @scruffian @shail-mehta @sirreal @stokesman @sunil25393 @swissspidy @t-hamano @talldan @twstokes @tyxla @youknowriad + + + + += 18.2.0 = + +## Changelog + +- Bump minimum required PHP version to 7.2 ([60714](https://github.com/WordPress/gutenberg/pull/60714)) + +### Enhancements + +#### Site Editor +- Add rename and trash actions to page panel. ([60232](https://github.com/WordPress/gutenberg/pull/60232)) +- Adjust frame animation profile. ([60589](https://github.com/WordPress/gutenberg/pull/60589)) +- Animate the radius of the frame. ([60415](https://github.com/WordPress/gutenberg/pull/60415)) +- Create router adapter for sidebar. ([60466](https://github.com/WordPress/gutenberg/pull/60466)) +- Improve the header animation. ([60408](https://github.com/WordPress/gutenberg/pull/60408)) +- Index view for Templates & Parts: Use `grid` layout as default. ([60069](https://github.com/WordPress/gutenberg/pull/60069)) +- Pages: Display content frame in mobile when canvas is not edit. ([60409](https://github.com/WordPress/gutenberg/pull/60409)) +- Simplify template reset language. ([60256](https://github.com/WordPress/gutenberg/pull/60256)) +- Template parts in patterns page: Add author field. ([60372](https://github.com/WordPress/gutenberg/pull/60372)) +- Template parts: Set backpath to patterns page. ([60667](https://github.com/WordPress/gutenberg/pull/60667)) +- Update hub markup and animation. ([60410](https://github.com/WordPress/gutenberg/pull/60410)) +- Update site hub action positioning. ([60511](https://github.com/WordPress/gutenberg/pull/60511)) + +#### Components +- CustomSelectControlV2: Support disabled in item types. ([60896](https://github.com/WordPress/gutenberg/pull/60896)) +- ExternalLink: Replace icon with unicode arrow. ([60255](https://github.com/WordPress/gutenberg/pull/60255)) +- InputBase: Simplify focus styles. ([60226](https://github.com/WordPress/gutenberg/pull/60226)) +- ProgressBar: Moved width to css var for perf. ([60388](https://github.com/WordPress/gutenberg/pull/60388)) +- SlotFill: Replace valtio with custom ObservableMap. ([60879](https://github.com/WordPress/gutenberg/pull/60879)) +- Tabs: Fallback to first enabled tab if no active tab Id. ([60681](https://github.com/WordPress/gutenberg/pull/60681)) +- Text: Add text-wrap: Pretty. ([60164](https://github.com/WordPress/gutenberg/pull/60164)) +- Try: Reduce checkbox size in data views. ([60475](https://github.com/WordPress/gutenberg/pull/60475)) + +#### Post Editor +- Confirm dialog: Use more descriptive text for the confirm button. ([60364](https://github.com/WordPress/gutenberg/pull/60364)) +- Editor: Add wordcount and reading time info in post card. ([60672](https://github.com/WordPress/gutenberg/pull/60672)) +- Editor: Animate opening and closing editor right sidebar. ([60561](https://github.com/WordPress/gutenberg/pull/60561)) +- Editor: Animate the inserter and list view panels. ([60665](https://github.com/WordPress/gutenberg/pull/60665)) +- Editor: Update post URL component. ([60632](https://github.com/WordPress/gutenberg/pull/60632)) +- Editor: Use the 'ConfirmDialog' component in template validation notice. ([60385](https://github.com/WordPress/gutenberg/pull/60385)) +- Enable template preview in post editor for non administrators. ([60447](https://github.com/WordPress/gutenberg/pull/60447)) +- Support insert before/after keyboard shortcuts when focus is within the list view. ([60651](https://github.com/WordPress/gutenberg/pull/60651)) +- Update publish flow. ([60456](https://github.com/WordPress/gutenberg/pull/60456)) + +#### Patterns +- Add a "All Template Parts" section. ([60775](https://github.com/WordPress/gutenberg/pull/60775)) +- Back Compat: Add Patterns submenu for WordPress 6.4. ([60804](https://github.com/WordPress/gutenberg/pull/60804)) +- Patterns page: Add edit & view revision actions to parts. ([60659](https://github.com/WordPress/gutenberg/pull/60659)) +- Remove "Template parts" sidebar group. ([60359](https://github.com/WordPress/gutenberg/pull/60359)) +- Site Editor: Support starter patterns. ([60745](https://github.com/WordPress/gutenberg/pull/60745)) + +#### Synced Patterns +- Adjust allow pattern overrides UX flow. ([60769](https://github.com/WordPress/gutenberg/pull/60769)) +- Consolidate "bound block" color and "synced" colors. ([60617](https://github.com/WordPress/gutenberg/pull/60617)) +- Improve override indication for editable blocks in synced patterns. ([60599](https://github.com/WordPress/gutenberg/pull/60599)) +- Refine rename flow for blocks with overrides. ([60234](https://github.com/WordPress/gutenberg/pull/60234)) + +#### Zoom Out +- Adjust block selection button. ([60348](https://github.com/WordPress/gutenberg/pull/60348)) +- Animation: Avoid fixed width when animating the secondary sidebar. ([60693](https://github.com/WordPress/gutenberg/pull/60693)) +- Introduce section container selection when assembling patterns (zoom out mode). ([59249](https://github.com/WordPress/gutenberg/pull/59249)) +- Update zoom out scale. ([60618](https://github.com/WordPress/gutenberg/pull/60618)) + +#### Block Library +- Add loading state on image upload in featured image, Site logo and Cover blocks. ([59519](https://github.com/WordPress/gutenberg/pull/59519)) +- File: Use HTML API to update the PDF preview label. ([60494](https://github.com/WordPress/gutenberg/pull/60494)) +- Navigation block: Add current-menu-item class for post type archive. ([57808](https://github.com/WordPress/gutenberg/pull/57808)) +- Remove block renaming control from advanced inspector controls group. ([60453](https://github.com/WordPress/gutenberg/pull/60453)) + +#### Data Views +- Add ability to display fields as a badge in grid layout. ([60284](https://github.com/WordPress/gutenberg/pull/60284)) +- Data views table row: Make checkboxes and actions visible on touch devices. ([60829](https://github.com/WordPress/gutenberg/pull/60829)) +- DataViews: Make the experiment about custom views. ([60813](https://github.com/WordPress/gutenberg/pull/60813)) + +#### Layout +- Add a Row control to grid layout in manual mode. ([60652](https://github.com/WordPress/gutenberg/pull/60652)) +- Apply negative margins for alignfull children of blocks with custom padding set. ([60716](https://github.com/WordPress/gutenberg/pull/60716)) +- Try reducing specificity of layout style selectors. ([60228](https://github.com/WordPress/gutenberg/pull/60228)) + +#### Block Editor +- Remove animation from InlineLinkUI. ([60575](https://github.com/WordPress/gutenberg/pull/60575)) +- Remove root appender. ([60697](https://github.com/WordPress/gutenberg/pull/60697)) +- Try: Add new `textAlign` block support. ([59531](https://github.com/WordPress/gutenberg/pull/59531)) + +#### Global Styles +- Background image: Display default background size value in global styles. ([60490](https://github.com/WordPress/gutenberg/pull/60490)) +- Background UI control labels. ([60264](https://github.com/WordPress/gutenberg/pull/60264)) +- Use text and button background color for color indicators. ([59514](https://github.com/WordPress/gutenberg/pull/59514)) + +#### Font Library +- Change Spinner to ProgressBar component. ([60570](https://github.com/WordPress/gutenberg/pull/60570)) + +#### Interactivity API +- Include `preact/debug` when `SCRIPT_DEBUG` is enabled. ([60514](https://github.com/WordPress/gutenberg/pull/60514)) + + +### New APIs + +#### Extensibility +- Editor: Support PluginPostStatusInfo Slot in the site editor. ([60814](https://github.com/WordPress/gutenberg/pull/60814)) +- Editor: Unify PluginMoreMenuItem API between post and site editors. ([60778](https://github.com/WordPress/gutenberg/pull/60778)) + - Fix: Use core instead of core/editor on normalizeComplementaryAreaScope. ([60821](https://github.com/WordPress/gutenberg/pull/60821)) +- Editor: Unify PluginSidebarMoreMenuItem. ([60853](https://github.com/WordPress/gutenberg/pull/60853)) +- Editor: Unify the PluginSidebar slot between post and site editors. ([60815](https://github.com/WordPress/gutenberg/pull/60815)) + + +### Bug Fixes + +- Fix: Add types to useSuspenseSelect. ([60733](https://github.com/WordPress/gutenberg/pull/60733)) +- Fix experimental useHasRecursion deprecation. ([60451](https://github.com/WordPress/gutenberg/pull/60451)) +- Fix translatable string in pagination modal. ([60742](https://github.com/WordPress/gutenberg/pull/60742)) +- Interactivity: Return useMemo and useCallback hooks. ([60474](https://github.com/WordPress/gutenberg/pull/60474)) +- Only show block icon in toolbar for contentOnly blocks when block is a synced block. ([60647](https://github.com/WordPress/gutenberg/pull/60647)) +- Patterns: Guard for unknown pattern in server-side resolver. ([60464](https://github.com/WordPress/gutenberg/pull/60464)) +- Snackbar: Make the `explicitDismiss` string translatable. ([60368](https://github.com/WordPress/gutenberg/pull/60368)) +- Update standardisation of 'Navigation Menu' to have both words capitalised in user-facing menus. ([60262](https://github.com/WordPress/gutenberg/pull/60262)) + - Standardise capitalisation of Navigation Menu in sidebar. ([60527](https://github.com/WordPress/gutenberg/pull/60527)) + +#### Block Library +- Embed: Avoid retrying valid URLs. ([60655](https://github.com/WordPress/gutenberg/pull/60655)) +- File: Mark update for setting default label as non-persistent. ([60492](https://github.com/WordPress/gutenberg/pull/60492)) +- Fix don't close overlay menu when focus leaves submenu. ([60406](https://github.com/WordPress/gutenberg/pull/60406)) +- Fix pattern block recursion handling. ([60452](https://github.com/WordPress/gutenberg/pull/60452)) +- Image: Fix cropper resize on align change (react-easy-crop upgrade). ([60581](https://github.com/WordPress/gutenberg/pull/60581)) +- Latest Posts: Remove wrapper div and apply consistent class. ([60728](https://github.com/WordPress/gutenberg/pull/60728)) +- List: Disable edit as HTML support. ([55656](https://github.com/WordPress/gutenberg/pull/55656)) +- Media & Text: Hide the alt text option for featured images. ([60496](https://github.com/WordPress/gutenberg/pull/60496)) +- Post title: Re-add the paragraph level (without UI). ([60548](https://github.com/WordPress/gutenberg/pull/60548)) +- Pullquote: Reduce specificity of padding rule to avoid conflicts with global styles. ([60649](https://github.com/WordPress/gutenberg/pull/60649)) +- Separator block: Reduce default border styles to avoid conflicts with global styles. ([60740](https://github.com/WordPress/gutenberg/pull/60740)) + +#### Site Editor +- Chore: Fix missing comma on welcome guide styles. ([60596](https://github.com/WordPress/gutenberg/pull/60596)) +- Fallback to URL when site title is empty. ([60885](https://github.com/WordPress/gutenberg/pull/60885)) +- Fix activating a theme in site editor when previewing. ([60699](https://github.com/WordPress/gutenberg/pull/60699)) +- Fix site icon animation. ([60419](https://github.com/WordPress/gutenberg/pull/60419)) +- Fix small regression on the resize handle. ([60427](https://github.com/WordPress/gutenberg/pull/60427)) +- Fix the removePropertyFromObject function throws an error if the object is null. ([60831](https://github.com/WordPress/gutenberg/pull/60831)) +- Fix: Style issue on page actions button. ([60592](https://github.com/WordPress/gutenberg/pull/60592)) +- Pattern page: Fix deps for `onActionPerformed` useCallback. ([60784](https://github.com/WordPress/gutenberg/pull/60784)) +- Remove outdated border radius animation. ([60454](https://github.com/WordPress/gutenberg/pull/60454)) +- Router: Load proper sidebar for `/wp_template`. ([60850](https://github.com/WordPress/gutenberg/pull/60850)) +- [Site Editor]: Fix ability to edit trashed pages. ([60236](https://github.com/WordPress/gutenberg/pull/60236)) + +#### Post Editor +- Editor: Do not render publish time and post status panels in design post types. ([60857](https://github.com/WordPress/gutenberg/pull/60857)) +- Editor: Fix post status label styles for low-capability users. ([60854](https://github.com/WordPress/gutenberg/pull/60854)) +- Fix display of shortcut to add non breaking space in the post editor. ([60625](https://github.com/WordPress/gutenberg/pull/60625)) +- Fix: Action button alignment on details panel. ([60773](https://github.com/WordPress/gutenberg/pull/60773)) +- Fix: Action order is different from inspector and dataviews. ([60877](https://github.com/WordPress/gutenberg/pull/60877)) +- Fix: Do not show pattern and template actions on the post editor. ([60568](https://github.com/WordPress/gutenberg/pull/60568)) +- Fix: Missing items parameter and or missing onActionPerformed calls. ([60753](https://github.com/WordPress/gutenberg/pull/60753)) +- Fix: Trash Post action and permanently delete post action do not show errors on single item. ([60597](https://github.com/WordPress/gutenberg/pull/60597)) +- Post Editor Header: Make block toolbar toggle button focus visible. ([59781](https://github.com/WordPress/gutenberg/pull/59781)) + +#### Block Editor +- Avoid errors when a block variation icon is an object. ([60766](https://github.com/WordPress/gutenberg/pull/60766)) +- Fix external link indicator in Link Control. ([60439](https://github.com/WordPress/gutenberg/pull/60439)) +- Fix for isPossibleTransformForSource handling selecting inexistent block. ([59410](https://github.com/WordPress/gutenberg/pull/59410)) +- Fix stuck dragging mode in UI in Firefox when dealing with deeply nested lists. ([60845](https://github.com/WordPress/gutenberg/pull/60845)) +- Prevents delete key from undoing automatic changes. ([60858](https://github.com/WordPress/gutenberg/pull/60858)) +- Raw Handling - msListIgnore - Check attributes are valid. ([60375](https://github.com/WordPress/gutenberg/pull/60375)) + +#### Data Views +- DataViews: Fix typing in combobox filter. ([60819](https://github.com/WordPress/gutenberg/pull/60819)) +- Fix default layout configuration in pages list. ([60407](https://github.com/WordPress/gutenberg/pull/60407)) +- Fix pattern titles. ([60640](https://github.com/WordPress/gutenberg/pull/60640)) + +#### Zoom Out +- Don't allow shuffle for locked patterns. ([60381](https://github.com/WordPress/gutenberg/pull/60381)) +- Prevent exiting Zoom Out mode from stealing focus. ([60441](https://github.com/WordPress/gutenberg/pull/60441)) +- Respect reduced motion when engaging zoom out mode. ([60808](https://github.com/WordPress/gutenberg/pull/60808)) + +#### Font Library +- Avoid overriding custom settings on font library save. ([60438](https://github.com/WordPress/gutenberg/pull/60438)) +- Fix modal scrollbar. ([60641](https://github.com/WordPress/gutenberg/pull/60641)) +- I18N: Add context to 'Library' string. ([60520](https://github.com/WordPress/gutenberg/pull/60520)) + +#### Components +- Fix link control link preview when it displays long URLs. ([60890](https://github.com/WordPress/gutenberg/pull/60890)) +- ProgressBar: Fix CSS variable with invalid value. ([60576](https://github.com/WordPress/gutenberg/pull/60576)) + +#### Layout +- Always add semantic classes. ([60668](https://github.com/WordPress/gutenberg/pull/60668)) +- Don't output base flow and constrained layout rules on themes without theme.json. ([60764](https://github.com/WordPress/gutenberg/pull/60764)) +- Fix responsive column span logic on the front end. ([60976](https://github.com/WordPress/gutenberg/pull/60976)) +- Restore classic auto margin rule to its previous specificity. ([60802](https://github.com/WordPress/gutenberg/pull/60802)) + +#### Interactivity API +- Allow multiple event handlers for the same type with `data-wp-on`. ([60661](https://github.com/WordPress/gutenberg/pull/60661)) +- Update the query block to permit non-core interactive blocks. ([60006](https://github.com/WordPress/gutenberg/pull/60006)) + +#### Templates API +- Fix static posts page setting resolved template. ([60608](https://github.com/WordPress/gutenberg/pull/60608)) +- Fix: Honor 'template_hierarchy' filters on template fallbacks. ([60377](https://github.com/WordPress/gutenberg/pull/60377)) + +#### Distraction Free +- Only show inserter in document tools if DFM is off. ([60426](https://github.com/WordPress/gutenberg/pull/60426)) +- Remove alpha from edit post header. ([60431](https://github.com/WordPress/gutenberg/pull/60431)) + +#### REST API +- Fix PHP notice triggered by 'gutenberg_update_initial_settings'. ([60862](https://github.com/WordPress/gutenberg/pull/60862)) + +#### Global Styles +- Editor styles: Delete duplicate backwards compat CSS custom properties. ([60400](https://github.com/WordPress/gutenberg/pull/60400)) +- Fix browser warning regarding highlight colors. ([60555](https://github.com/WordPress/gutenberg/pull/60555)) + +### Accessibility + +- Details Block: remove `overflow:Hidden` style. ([60270](https://github.com/WordPress/gutenberg/pull/60270)) +- Do not render pattern aria description if not button is rendered. ([60653](https://github.com/WordPress/gutenberg/pull/60653)) +- Fix inserter pattern pagination focus loss. ([60620](https://github.com/WordPress/gutenberg/pull/60620)) +- Make sure Social icons links aren't empty and improve UI clarity. ([60047](https://github.com/WordPress/gutenberg/pull/60047)) + +### Performance + +- Add null check to prevent errors in `get_block_template` filter. ([60491](https://github.com/WordPress/gutenberg/pull/60491)) +- Block preview: Build in async rendering. ([60425](https://github.com/WordPress/gutenberg/pull/60425)) +- Editor canvas: Reduces resize listeners. ([60682](https://github.com/WordPress/gutenberg/pull/60682)) +- Layout support: Avoid two block editor store subs. ([60612](https://github.com/WordPress/gutenberg/pull/60612)) +- Optimize the rendering of the EditorStyles component. ([60493](https://github.com/WordPress/gutenberg/pull/60493)) +- Post Title: Avoid accidental types requests. ([60531](https://github.com/WordPress/gutenberg/pull/60531)) +- Preview: Skip rendering rich text. ([60544](https://github.com/WordPress/gutenberg/pull/60544)) +- Previews: Avoid unneeded block selectors. ([60543](https://github.com/WordPress/gutenberg/pull/60543)) +- Site Editor: Close the editor sidebar by default. ([60820](https://github.com/WordPress/gutenberg/pull/60820)) +- Zoom-out: Scale should be stable function. ([60580](https://github.com/WordPress/gutenberg/pull/60580)) +- getEntityRecords: Batch actions. ([60591](https://github.com/WordPress/gutenberg/pull/60591)) + +#### Block Library +- Avoid calling getBlocks selector for navigation link blocks. ([60458](https://github.com/WordPress/gutenberg/pull/60458)) +- Image cropper: Remove clientWidth prop with useResizeObserver. ([60674](https://github.com/WordPress/gutenberg/pull/60674)) +- Navigation block: Avoid selector + style recalc on mount. ([60572](https://github.com/WordPress/gutenberg/pull/60572)) +- Pattern block: Avoid fetching all reusable blocks on mount. ([60310](https://github.com/WordPress/gutenberg/pull/60310)) +- Post Featured Image: Optimize store subscriptions. ([60770](https://github.com/WordPress/gutenberg/pull/60770)) + +#### Site Editor +- Optimize the AddTemplate component used in data views pages. ([60586](https://github.com/WordPress/gutenberg/pull/60586)) +- Sidebar slide animation: Replace motion.div with CSS animation. ([60849](https://github.com/WordPress/gutenberg/pull/60849)) + +### Documentation + +- Add `AutosaveMonitor` component JSDoc and populate `README` with auto-gen documentation. ([60882](https://github.com/WordPress/gutenberg/pull/60882)) +- Add documentation for `disableLineBreaks` property of `RichText`. ([56284](https://github.com/WordPress/gutenberg/pull/56284)) +- Added Documentation for PostExcerptCheck. ([60864](https://github.com/WordPress/gutenberg/pull/60864)) +- Added links to related components. ([60726](https://github.com/WordPress/gutenberg/pull/60726)) +- Correct link to the theme json reference. ([60517](https://github.com/WordPress/gutenberg/pull/60517)) +- DimensionControl: Fix story configuration. ([60703](https://github.com/WordPress/gutenberg/pull/60703)) +- Docs: Fix typos in interactivity API reference. ([60870](https://github.com/WordPress/gutenberg/pull/60870)) +- Docs: Update wording in Block Editor Handbook to reflect that all examples now use JSX. ([56315](https://github.com/WordPress/gutenberg/pull/56315)) +- Fix: Grammar typo on packages/dataviews/src/search-widget.js. ([60588](https://github.com/WordPress/gutenberg/pull/60588)) +- Fix: Link to the block building tutorial. ([60518](https://github.com/WordPress/gutenberg/pull/60518)) +- Fixes a link to the getEntityRecord documentation. ([60823](https://github.com/WordPress/gutenberg/pull/60823)) +- Improve documentation for block variation `isActive` property. ([60801](https://github.com/WordPress/gutenberg/pull/60801)) +- Update: Hardcoded documentation link to a branch that does not exist. ([60671](https://github.com/WordPress/gutenberg/pull/60671)) +- Update: Reference editor scope instead of edit-site, edit-post on interface package documentation. ([60818](https://github.com/WordPress/gutenberg/pull/60818)) +- [Create Block] Adding documentation for the transformer property. ([60445](https://github.com/WordPress/gutenberg/pull/60445)) + + +### Code Quality + +- Added @return after @global in php doc. ([60611](https://github.com/WordPress/gutenberg/pull/60611)) +- Blocks: Remove client-side polyfill for 'selectors'. ([60846](https://github.com/WordPress/gutenberg/pull/60846)) +- [Block Bindings] Don't use hooks. ([60724](https://github.com/WordPress/gutenberg/pull/60724)) +- Chore: Fix: Wrong JSDOC for an action return. ([60786](https://github.com/WordPress/gutenberg/pull/60786)) +- Chore: Simplify some CSS margin rules. ([60816](https://github.com/WordPress/gutenberg/pull/60816)) +- Editor: Serve as a proxy for the interface package. ([60748](https://github.com/WordPress/gutenberg/pull/60748)) +- Editor: Unify the auto-switch sidebars behavior. ([60869](https://github.com/WordPress/gutenberg/pull/60869)) +- Editor: Unify the keyboard shortcuts modal. ([60866](https://github.com/WordPress/gutenberg/pull/60866)) +- Editor: Unify the names of the sidebars between edit post and edit site. ([60856](https://github.com/WordPress/gutenberg/pull/60856)) +- Editor: Unify the preferences modal name. ([60871](https://github.com/WordPress/gutenberg/pull/60871)) +- Fix: Remove unused CSS for TemplatePartHint. ([60852](https://github.com/WordPress/gutenberg/pull/60852)) +- Fix: Remove unused css from page panels styles. ([60774](https://github.com/WordPress/gutenberg/pull/60774)) +- Fix: Font Library typo. ([60751](https://github.com/WordPress/gutenberg/pull/60751)) +- Fix: Remove unused CSS code from the site editor. ([60662](https://github.com/WordPress/gutenberg/pull/60662)) +- Interactivity API refactor to TypeScript (utils & kebabToCamelCase). ([60149](https://github.com/WordPress/gutenberg/pull/60149)) +- Reexport createSelector from data package. ([60370](https://github.com/WordPress/gutenberg/pull/60370)) +- Refactor: UseBlockTools cleanup. ([59450](https://github.com/WordPress/gutenberg/pull/59450)) +- Remove comment that no longer applies about appearance-tools support. ([60844](https://github.com/WordPress/gutenberg/pull/60844)) +- Reuse and unify post and page actions, accross the different use cases. ([60486](https://github.com/WordPress/gutenberg/pull/60486)) +- Test: Validate block & theme json. ([57374](https://github.com/WordPress/gutenberg/pull/57374)) +- Tests: Shard JS unit tests. ([60045](https://github.com/WordPress/gutenberg/pull/60045)) +- Tests: Share JavaScript build assets across PHP workflows. ([60428](https://github.com/WordPress/gutenberg/pull/60428)) +- Update: Avoid two useSelect calls on PostActions. ([60752](https://github.com/WordPress/gutenberg/pull/60752)) +- Update: Make content locking related selectors private. ([60827](https://github.com/WordPress/gutenberg/pull/60827)) +- Update: Move template actions to the editor store. ([60395](https://github.com/WordPress/gutenberg/pull/60395)) +- Update: Remove keyCode usage from dataviews package. ([60585](https://github.com/WordPress/gutenberg/pull/60585)) +- Update: Use util getVariationClassName instead of computing the variation inline. ([60664](https://github.com/WordPress/gutenberg/pull/60664)) + +#### Components +- Deprecate `reduceMotion` util. ([60839](https://github.com/WordPress/gutenberg/pull/60839)) +- Navigation: Soft deprecate component. ([59182](https://github.com/WordPress/gutenberg/pull/59182)) +- NavigatorProvider: Move the same-location check to the goTo function. ([60767](https://github.com/WordPress/gutenberg/pull/60767)) +- ObservableMap: Optimize unsubscribe and add unit tests. ([60892](https://github.com/WordPress/gutenberg/pull/60892)) +- Remove CSS hack for Internet Explorer 11. ([60727](https://github.com/WordPress/gutenberg/pull/60727)) + +#### Post Editor +- Editor: Optimize the 'PostSlug' component. ([60422](https://github.com/WordPress/gutenberg/pull/60422)) +- Editor: Use hook instead of HoC in 'ThemeSupportCheck'. ([60807](https://github.com/WordPress/gutenberg/pull/60807)) +- Editor: Use hooks instead of HoCs in 'PostTrashCheck'. ([60380](https://github.com/WordPress/gutenberg/pull/60380)) +- [Editor]:Get post content in PostContentInfo component. ([60743](https://github.com/WordPress/gutenberg/pull/60743)) + +#### Data Views +- DataViews: Remove `onDetailsChange` event. ([60387](https://github.com/WordPress/gutenberg/pull/60387)) +- Rename displayAsColumnFields to columnFields API. ([60504](https://github.com/WordPress/gutenberg/pull/60504)) +- Simplify visually hidden label. ([60835](https://github.com/WordPress/gutenberg/pull/60835)) + +#### Block Editor +- Refactor Link UI States. ([59762](https://github.com/WordPress/gutenberg/pull/59762)) +- Switching pattern categories inserter to Tabs component with arrow key navigation. ([60257](https://github.com/WordPress/gutenberg/pull/60257)) + +### Tools + +- Update @talldan in codeowners file, remove from edit-widgets package. ([60800](https://github.com/WordPress/gutenberg/pull/60800)) + +#### Testing +- Add end-to-end test for activating themes in site editor. ([60707](https://github.com/WordPress/gutenberg/pull/60707)) +- Automated Testing: Update end-to-end test npm commands. ([60376](https://github.com/WordPress/gutenberg/pull/60376)) +- Fix flaky Site Editor URL navigation end-to-end test. ([60675](https://github.com/WordPress/gutenberg/pull/60675)) +- PHP unit test workflow: Try removing 7.0 and 7.1. ([60686](https://github.com/WordPress/gutenberg/pull/60686)) +- Perf: Improve way we measure template loading by adding posts. ([60516](https://github.com/WordPress/gutenberg/pull/60516)) +- Performance Tests: I'm tired of doing head math 😊. ([60509](https://github.com/WordPress/gutenberg/pull/60509)) +- Upgrade Playwright to v1.43. ([60635](https://github.com/WordPress/gutenberg/pull/60635)) +- tip: Remove unecessary delay in tests except where needed. ([60897](https://github.com/WordPress/gutenberg/pull/60897)) + +#### Build Tooling +- Dependencies: Upgrade babel. ([57311](https://github.com/WordPress/gutenberg/pull/57311)) +- Upgrade simple-git dependency. ([59915](https://github.com/WordPress/gutenberg/pull/59915)) +- Update Typescript to 5.4.5. ([60793](https://github.com/WordPress/gutenberg/pull/60793)) + +## First time contributors + +The following PRs were merged by first time contributors: + +- @asheshmagar: Font library: Fix typo. ([60751](https://github.com/WordPress/gutenberg/pull/60751)) +- @DaniGuardiola: ProgressBar: Moved width to CSS var for performance. ([60388](https://github.com/WordPress/gutenberg/pull/60388)) +- @garridinsi: Interactivity API refactor to TypeScript (utils & kebabToCamelCase). ([60149](https://github.com/WordPress/gutenberg/pull/60149)) +- @xhemals: Update standardization of the 'Navigation Menu' to have both words capitalized in user-facing menus. ([60262](https://github.com/WordPress/gutenberg/pull/60262)), Standardise capitalization of the Navigation Menu in the sidebar. ([60527](https://github.com/WordPress/gutenberg/pull/60527)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @afercia @andrewserong @arthur791004 @artpi @asheshmagar @atachibana @carolinan @colinduwe @colorful-tones @DaniGuardiola @DAreRodz @draganescu @ellatrix @fabiankaegy @flexseth @garridinsi @geriux @getdave @ixkaito @jameskoster @jasmussen @jeryj @johnhooks @jorgefilipecosta @jsnajdr @kevin940726 @Mamaduka @matiasbenedetto @mhkuu @mikachan @mirka @noisysocks @ntsekouras @oandregal @ocean90 @okmttdhr @prajapatisagar @ramonjd @richtabor @ryanwelcher @scruffian @shail-mehta @shimotmk @simonhammes @sirreal @Soean @sunil25393 @t-hamano @talldan @tellthemachines @tyxla @xhemals @youknowriad + + += 18.1.2 = + +## Bug Fixes + +- Restore classic auto margin rule to its previous specificity ([60802](https://github.com/WordPress/gutenberg/pull/60802)) +- Fix the removePropertyFromObject function throws an error if the object is null ([60831](https://github.com/WordPress/gutenberg/pull/60831)) + +## Contributors + +The following contributors merged PRs in this release: + +@tellthemachines @arthur791004 + + += 18.1.1 = + +## Bug Fixes + +- Add null check to prevent errors in `get_block_template` filter ([60491](https://github.com/WordPress/gutenberg/pull/60491)) +- Fix activating a theme in site editor when previewing ([60699](https://github.com/WordPress/gutenberg/pull/60699)) + +## Contributors + +The following contributors merged PRs in this release: + +@okmttdhr @ntsekouras + + += 18.1.0 = + +## Changelog + +### Enhancements + +#### Block Editor +- Zoom out: Invoke zoom out mode when opening the patterns tab, and move the code to do so to a shared hook. ([59775](https://github.com/WordPress/gutenberg/pull/59775)) +- Block Previews: Update shadows in different contexts. ([60161](https://github.com/WordPress/gutenberg/pull/60161)) +- Update: Move post actions to the editor package. ([60092](https://github.com/WordPress/gutenberg/pull/60092)) +- Try: Show copy shortcut in block options. ([60339](https://github.com/WordPress/gutenberg/pull/60339)) +- Update image role description text to fix spacing. ([60338](https://github.com/WordPress/gutenberg/pull/60338)) + +#### Site Editor +- Add rename page action. ([60230](https://github.com/WordPress/gutenberg/pull/60230)) +- Center the document title. ([59134](https://github.com/WordPress/gutenberg/pull/59134)) +- Consolidate when showing revisions link or action. ([60194](https://github.com/WordPress/gutenberg/pull/60194)) +- Editor: Update hover color of editor document title. ([60113](https://github.com/WordPress/gutenberg/pull/60113)) +- Improve the frame animation. ([60363](https://github.com/WordPress/gutenberg/pull/60363)) +- Try selecting closest editable block when clicking on a disabled block. ([60016](https://github.com/WordPress/gutenberg/pull/60016)) +- Update index view for pages. ([59950](https://github.com/WordPress/gutenberg/pull/59950)) + +#### Patterns +- Add content schema to pattern editing view. ([59977](https://github.com/WordPress/gutenberg/pull/59977)) +- Close inspector on pattern category select. ([60004](https://github.com/WordPress/gutenberg/pull/60004)) +- Focus block selection button only in navigation mode. ([60207](https://github.com/WordPress/gutenberg/pull/60207)) +- Pattern Shuffling: Make the results deterministic. ([60074](https://github.com/WordPress/gutenberg/pull/60074)) +- Patterns page: Enable table layout. ([60337](https://github.com/WordPress/gutenberg/pull/60337)) +- Prevent reordering of header and footer template parts when zoomed out. ([60054](https://github.com/WordPress/gutenberg/pull/60054)) +- Remove manage all of my patterns link. ([60345](https://github.com/WordPress/gutenberg/pull/60345)) + +#### Block Library +- Add `__next40pxDefaultSize` to Image block Title Attribute. ([60117](https://github.com/WordPress/gutenberg/pull/60117)) +- Add support "HTML Element" to Site Tagline. ([59654](https://github.com/WordPress/gutenberg/pull/59654)) +- Image: Remove temporary image check for rendering controls. ([60212](https://github.com/WordPress/gutenberg/pull/60212)) +- Quote block: Button for cite add/remove. ([59073](https://github.com/WordPress/gutenberg/pull/59073)) +- Quote block: Remove appender. ([60307](https://github.com/WordPress/gutenberg/pull/60307)) +- Reduce specificity of block library styles conflicting with block supports. ([59457](https://github.com/WordPress/gutenberg/pull/59457)) +- Update navigation blocks to use consistent link UI labels and field sizes. ([60116](https://github.com/WordPress/gutenberg/pull/60116)) +- Summary: Polish featured image. ([60110](https://github.com/WordPress/gutenberg/pull/60110)) + +#### Post Editor +- Block Editor: Deprecate `__experimentalGetReusableBlockTitle` selector. ([60278](https://github.com/WordPress/gutenberg/pull/60278)) +- Editor: Move PluginPostPublishPanel and PluginPrePublishPanel to editor package. ([60344](https://github.com/WordPress/gutenberg/pull/60344)) +- Editor: Move publish panel handling to `editor` store. ([60340](https://github.com/WordPress/gutenberg/pull/60340)) +- Editor: Unify publish sidebar preference. ([60334](https://github.com/WordPress/gutenberg/pull/60334)) + +#### Global Styles +- Add background to global styles changes output. ([60229](https://github.com/WordPress/gutenberg/pull/60229)) +- Background UI controls. ([59454](https://github.com/WordPress/gutenberg/pull/59454)) +- Follow up design tweaks for global styles presets. ([60031](https://github.com/WordPress/gutenberg/pull/60031)) +- Try reducing specificity of global styles selectors only. ([60106](https://github.com/WordPress/gutenberg/pull/60106)) + +#### Data Views +- DataViews: Add a utility to share filtering, sorting and pagination logic. ([59897](https://github.com/WordPress/gutenberg/pull/59897)) +- Data views: Remove the `enumeration` type as redundant. ([60084](https://github.com/WordPress/gutenberg/pull/60084)) +- Data views: Update template actions. ([60075](https://github.com/WordPress/gutenberg/pull/60075)) +- Data views: Add confirmation modal for clearing customizations in templates. ([60119](https://github.com/WordPress/gutenberg/pull/60119)) +- Data views: Make trash a quick action again. ([60165](https://github.com/WordPress/gutenberg/pull/60165)) + +#### List View +- Add keyboard shortcut to collapse list view items other than the focused item. ([59978](https://github.com/WordPress/gutenberg/pull/59978)) +- Adjust the List View close icon to resemble the Inspector close icon. ([59999](https://github.com/WordPress/gutenberg/pull/59999)) +- Update "Actions" string to "Options" in List View. ([60136](https://github.com/WordPress/gutenberg/pull/60136)) + +#### Templates +- Add filter to allow extending the list of post content blocks. ([60068](https://github.com/WordPress/gutenberg/pull/60068)) +- Render non-editable preview of template part when user does not have capability to edit template part. ([60326](https://github.com/WordPress/gutenberg/pull/60326)) +- Template Parts: Remove pattern title from sidebar. ([60160](https://github.com/WordPress/gutenberg/pull/60160)) +- Template Parts: Update replace flow to separate template parts from patterns. ([60203](https://github.com/WordPress/gutenberg/pull/60203)) +- Template Parts: Update the 'Replace' label to 'Design'. ([60156](https://github.com/WordPress/gutenberg/pull/60156)) + +#### Zoom Out +- Add a delete control to toolbar on zoomed out mode. ([60214](https://github.com/WordPress/gutenberg/pull/60214)) +- Media dialog push content in zoomed out mode. ([60170](https://github.com/WordPress/gutenberg/pull/60170)) + +#### Components +- Popover / ToggleGroupControl: Use `useReducedMotion()` from `@wordpress/compose`. ([60168](https://github.com/WordPress/gutenberg/pull/60168)) +- date-fns: Bump to v3.6. ([60163](https://github.com/WordPress/gutenberg/pull/60163)) + +#### REST API +- Allow view access of template rest endpoint to anyone with the `edit_post` capability. ([60317](https://github.com/WordPress/gutenberg/pull/60317)) + +#### Commands +- Polish Command Palette. ([60134](https://github.com/WordPress/gutenberg/pull/60134)) + +#### Page Content Focus +- Allow selecting template parts in page content focus mode. ([60010](https://github.com/WordPress/gutenberg/pull/60010)) + +#### Inspector Controls +- Add: PostCardPanel component. ([59870](https://github.com/WordPress/gutenberg/pull/59870)) + +#### Package and utility updates +- Router: Update history package to 5.3.0, fix query string generation. ([60271](https://github.com/WordPress/gutenberg/pull/60271)) +- Create block: Add new namespacePascalCase template variable. ([60223](https://github.com/WordPress/gutenberg/pull/60223)) + +### New APIs + +#### Extensibility +- Extensibility: Support PluginBlockSettingsMenuItem in the site editor. ([60033](https://github.com/WordPress/gutenberg/pull/60033)) + +### Bug Fixes + +#### Block Library +- Fix enqueuing block theme styles when separate asset loading is enabled. ([60098](https://github.com/WordPress/gutenberg/pull/60098)) +- Fix lightbox UI disallow editing. ([59890](https://github.com/WordPress/gutenberg/pull/59890)) +- Fix navigation link ui close focus management. ([59925](https://github.com/WordPress/gutenberg/pull/59925)) +- Removed pointer-events none inline style due it blocking crop action. ([60305](https://github.com/WordPress/gutenberg/pull/60305)) +- Search Block: Apply font-related style inheritance to input field. ([60321](https://github.com/WordPress/gutenberg/pull/60321)) +- Columns block: Fix arrow up into it. ([55197](https://github.com/WordPress/gutenberg/pull/55197)) + +#### Site Editor +- Fix rendering PluginTemplateSettingPanel when we're editing a template. ([60215](https://github.com/WordPress/gutenberg/pull/60215)) +- Fix: Use `viewportWidth` in pattern preview data view. ([60315](https://github.com/WordPress/gutenberg/pull/60315)) +- Templates: Fix deferred rendering. ([60361](https://github.com/WordPress/gutenberg/pull/60361)) +- Site Editor: Consolidate save button functionality. ([60077](https://github.com/WordPress/gutenberg/pull/60077)) +- Revert #60300: Make sure the CSS class id-dark-theme is added to the editor iframe body. ([60616](https://github.com/WordPress/gutenberg/pull/60616)) + +#### Block Editor +- Make sure the CSS class is-dark-theme is added to the editor iframe body. ([60300](https://github.com/WordPress/gutenberg/pull/60300)) +- Raw handling: Preserve class. ([60331](https://github.com/WordPress/gutenberg/pull/60331)) +- Raw handling: Preserve empty paragraphs. ([59476](https://github.com/WordPress/gutenberg/pull/59476)) +- Wiriting flow: Backspace at beginning of first paragraph block prevents block from being deleted. ([56329](https://github.com/WordPress/gutenberg/pull/56329)) +- DOM: Fix return types of focus.tabbable methods. ([60274](https://github.com/WordPress/gutenberg/pull/60274)) + +#### Components +- CustomSelectControlV2: Fix hint behavior in legacy. ([60183](https://github.com/WordPress/gutenberg/pull/60183)) +- InputControl: Ignore IME events when `isPressEnterToChange`. ([60090](https://github.com/WordPress/gutenberg/pull/60090)) +- TextControl: Apply zero margin to input element. ([60282](https://github.com/WordPress/gutenberg/pull/60282)) + +#### Global Styles +- Fix missing class for Global Styles > Colors. ([60094](https://github.com/WordPress/gutenberg/pull/60094)) +- Reset specificity of body selector when processing with postcss. ([60266](https://github.com/WordPress/gutenberg/pull/60266)) +- Shadow: Revert shadow default presets opt-in to opt-out. ([60204](https://github.com/WordPress/gutenberg/pull/60204)) +- Global Styles: Make strings translatable. ([60127](https://github.com/WordPress/gutenberg/pull/60127)) +- Skip outputting base layout rules that reference content or wide sizes if no layout sizes exist. ([60489](https://github.com/WordPress/gutenberg/pull/60489)) + +#### Zoom Out +- Fix zoom out mode toggling between pattern category selection. ([60225](https://github.com/WordPress/gutenberg/pull/60225)) + +#### Data Views +- Fix focus outline visibility and truncation in data view record titles. ([60191](https://github.com/WordPress/gutenberg/pull/60191)) + +#### Layout +- Fix horizontal flex layout in classic themes. ([60154](https://github.com/WordPress/gutenberg/pull/60154)) + +#### Post Editor +- Editor: Memoize 'getInsertionPoint' selector. ([60015](https://github.com/WordPress/gutenberg/pull/60015)) +- Fix block toolbar dropdown separator color. ([60336](https://github.com/WordPress/gutenberg/pull/60336)) +- Backport r57868 (Editor: Prevent font folder naive filtering causing infinite loops) from WordPress-Develop. ([60141](https://github.com/WordPress/gutenberg/pull/60141)) + +#### Block templates +- Add null check to prevent errors in `get_block_template` filter. ([60491](https://github.com/WordPress/gutenberg/pull/60491)) + +#### Utilities +- URL: Return early in getFilename where URL argument is falsy. ([60265](https://github.com/WordPress/gutenberg/pull/60265)) + + +### Accessibility + +#### Data Views +- Add click-to-select behavior on table rows. ([59803](https://github.com/WordPress/gutenberg/pull/59803)) +- Data views list layout: Apply focus styles to items on `focus-visible` rather than `focus`. ([60253](https://github.com/WordPress/gutenberg/pull/60253)) +- Update field display in grid layout. ([60083](https://github.com/WordPress/gutenberg/pull/60083)) +- Data Views: Updating keyboard navigation in list layouts. ([59637](https://github.com/WordPress/gutenberg/pull/59637)) + +#### Site Editor +- Restore Style book close button tooltip. ([60177](https://github.com/WordPress/gutenberg/pull/60177)) + +#### Block Library +- Remove CSS order property from social icons placeholder UI. ([60032](https://github.com/WordPress/gutenberg/pull/60032)) + +### Performance + +### Block Editor +- Avoid fetching all reusable blocks (user patterns) on post/site editor load. ([58239](https://github.com/WordPress/gutenberg/pull/58239)) +- Block editor: Optimize hasSelectedInnerBlock selector. ([60330](https://github.com/WordPress/gutenberg/pull/60330)) +- Templates performance: Resolve patterns server side. ([60349](https://github.com/WordPress/gutenberg/pull/60349)) + +#### Block Library +- Template part: Avoid pattern fetch on mount. ([60297](https://github.com/WordPress/gutenberg/pull/60297)) + +#### Block Editor +- Inserter: Cache search normalization results. ([60080](https://github.com/WordPress/gutenberg/pull/60080)) +- Format library: Improve unknown format performance. ([48761](https://github.com/WordPress/gutenberg/pull/48761)) + +### Experiments + +#### Site Editor +- Zoom-out view: Disable canvas resizing. ([60104](https://github.com/WordPress/gutenberg/pull/60104)) + + +### Documentation + +- Add auto generated API documentation for `editor` package. ([60356](https://github.com/WordPress/gutenberg/pull/60356)) +- Add component props documentation. ([60350](https://github.com/WordPress/gutenberg/pull/60350)) +- Add php `@global` documentation. ([59931](https://github.com/WordPress/gutenberg/pull/59931)) +- Change heading level on troubleshooting section. ([60233](https://github.com/WordPress/gutenberg/pull/60233)) +- CustomSelectControlV2: Match v1 stories to test legacy component. ([60182](https://github.com/WordPress/gutenberg/pull/60182)) +- Docs (general): Fix some typos. ([60260](https://github.com/WordPress/gutenberg/pull/60260)) +- Fix `@todo` tags to follow standards in WordPress comments. ([60148](https://github.com/WordPress/gutenberg/pull/60148)) +- Fix Font Collection JSON schema definition. ([60285](https://github.com/WordPress/gutenberg/pull/60285)) +- Fix: Invalid documentation link to load JavaScript. ([60181](https://github.com/WordPress/gutenberg/pull/60181)) +- Fix: Invalid links to the block supports api. ([60199](https://github.com/WordPress/gutenberg/pull/60199)) +- Fix: Non existent link to submitting to the block directory. ([60389](https://github.com/WordPress/gutenberg/pull/60389)) +- Interactivity API: Variable name correction in the documentation. ([60056](https://github.com/WordPress/gutenberg/pull/60056)) +- Create Block: Update external template documentation to include variants. ([60095](https://github.com/WordPress/gutenberg/pull/60095)) + + +### Code Quality + + +#### Block Editor +- Add comment for unmemoized context. ([60272](https://github.com/WordPress/gutenberg/pull/60272)) +- Fix ESLint warning in BlockListBlock component. ([60064](https://github.com/WordPress/gutenberg/pull/60064)) +- RichText: Switch from disableEditing to standard html readonly attribute. ([60327](https://github.com/WordPress/gutenberg/pull/60327)) +- Site Editor: Reuse inserter search term normalization. ([60218](https://github.com/WordPress/gutenberg/pull/60218)) +- `canInsertBlockType`: Extract helper for selector dependants. ([60235](https://github.com/WordPress/gutenberg/pull/60235)) +- Fix editor canvas overflow on search results with position: Relative. ([60287](https://github.com/WordPress/gutenberg/pull/60287)) +- Editor: Move template areas to editor package. ([60179](https://github.com/WordPress/gutenberg/pull/60179)) + +#### Components +- `CustomSelectControlV2`: Rename for consistency. ([60178](https://github.com/WordPress/gutenberg/pull/60178)) +- Navigator: Fix two nits. ([60273](https://github.com/WordPress/gutenberg/pull/60273)) +- NavigatorProvider: Move all state management to one reducer. ([60190](https://github.com/WordPress/gutenberg/pull/60190)) +- Components: Try obviating Popover pointer event trap. ([59449](https://github.com/WordPress/gutenberg/pull/59449)) + +#### Post Editor +- Memoize the getTemplateInfo selector. ([60200](https://github.com/WordPress/gutenberg/pull/60200)) +- Update: Remove template summary component. ([60351](https://github.com/WordPress/gutenberg/pull/60351)) +- Update: Use getPostIcon selector on document bar. ([60128](https://github.com/WordPress/gutenberg/pull/60128)) +- Distraction free: Remove unwanted space from string. ([60108](https://github.com/WordPress/gutenberg/pull/60108)) + +#### Global Styles +- Additional CSS: Add code comments contextualising tranformStyles for clarity. ([60267](https://github.com/WordPress/gutenberg/pull/60267)) +- Global styles: output `:root` selector for CSS custom properties. ([42084](https://github.com/WordPress/gutenberg/pull/42084)) +- Style Engine: Continue get_classnames loop after adding the default classname. ([60153](https://github.com/WordPress/gutenberg/pull/60153)) + +#### Font Library +- Add test for Font Library and Theme Style Variations. ([60250](https://github.com/WordPress/gutenberg/pull/60250)) +- Update google fonts font collection data URL to the latest version available. ([60079](https://github.com/WordPress/gutenberg/pull/60079)) + +#### Block Library +- Image: Use the new 'useUploadMediaFromBlobURL' hook. ([60208](https://github.com/WordPress/gutenberg/pull/60208)) +- Navigation Block: Add test coverage to check that post content is not removed. ([60189](https://github.com/WordPress/gutenberg/pull/60189)) + +#### Site Editor +- DataViews: Don't memoize every callback 'PagePages' component. ([60103](https://github.com/WordPress/gutenberg/pull/60103)) +- History: Simplify the push and replace methods. ([60112](https://github.com/WordPress/gutenberg/pull/60112)) + +#### Rich Text +- RichText: Separate fallback instance ID for selection retrieval. ([60277](https://github.com/WordPress/gutenberg/pull/60277)) + +#### Block Locking +- E2E: Test BlockSwitcher availability in l-post-ul-group CPT. ([60254](https://github.com/WordPress/gutenberg/pull/60254)) + +#### Data Views +- DataViews: Fix react warning error in list layout. ([60101](https://github.com/WordPress/gutenberg/pull/60101)) + + +### Tools + +#### Testing +- Automated Testing: Remove Puppeteer CI Job. ([59311](https://github.com/WordPress/gutenberg/pull/59311)) +- CustomSelectControlV2: Stabilize tests. ([60133](https://github.com/WordPress/gutenberg/pull/60133)) +- E2E: Fix flaky Site Editor pages end-to-end test. ([60109](https://github.com/WordPress/gutenberg/pull/60109)) +- Font Library: Add upload font test. ([60221](https://github.com/WordPress/gutenberg/pull/60221)) + +#### Build Tooling +- Blocks: Fix double `gutenberg_` prefix in built dynamic blocks PHP. ([60288](https://github.com/WordPress/gutenberg/pull/60288)) + +## First-time contributors + +The following PRs were merged by first-time contributors 🎉 : + +- @interdevel: Fix `@todo` tags to follow standards in WordPress comments. ([60148](https://github.com/WordPress/gutenberg/pull/60148)) +- @mikeybinns: Add component props documentation. ([60350](https://github.com/WordPress/gutenberg/pull/60350)) +- @nirav7707: Editor: Update hover color of editor document title. ([60113](https://github.com/WordPress/gutenberg/pull/60113)) +- @steveariss: Interactivity API: Variable name correction in the documentation. ([60056](https://github.com/WordPress/gutenberg/pull/60056)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @afercia @andrewhayward @andrewserong @artemiomorales @bph @draganescu @ellatrix @fabiankaegy @geriux @getdave @glendaviesnz @interdevel @jameskoster @jasmussen @jeryj @jorgefilipecosta @jsnajdr @madhusudhand @MaggieCabrera @Mamaduka @matiasbenedetto @mcsf @mikachan @mikeybinns @mirka @mujuonly @n2erjo00 @nirav7707 @noisysocks @ntsekouras @oandregal @ockham @okmttdhr @pedro-mendonca @peterwilsoncc @ramonjd @richtabor @ryanwelcher @scruffian @shail-mehta @Soean @steveariss @stokesman @t-hamano @talldan @tellthemachines @torounit @tyxla @youknowriad + + + + += 18.0.1 = + +## Bug fixes + +Make sure display name is correctly formatted in comments. (#60579) + + += 18.1.0-rc.2 = + + +## Changelog + +### Bug Fixes + +- Add null check to prevent errors in `get_block_template` filter. ([60491](https://github.com/WordPress/gutenberg/pull/60491)) + +#### Layout +- Skip outputting base layout rules that reference content or wide sizes if no layout sizes exist. ([60489](https://github.com/WordPress/gutenberg/pull/60489)) + + + + +## Contributors + +The following contributors merged PRs in this release: + +@andrewserong @okmttdhr + + += 18.1.0-rc.1 = + + +## Changelog + +### Enhancements + +- Block Previews: Update shadows in different contexts. ([60161](https://github.com/WordPress/gutenberg/pull/60161)) +- Data views: Make trash a quick action again. ([60165](https://github.com/WordPress/gutenberg/pull/60165)) +- Router: Update history package to 5.3.0, fix query string generation. ([60271](https://github.com/WordPress/gutenberg/pull/60271)) +- Summary: Polish featured image. ([60110](https://github.com/WordPress/gutenberg/pull/60110)) +- Template Parts: Remove pattern title from sidebar. ([60160](https://github.com/WordPress/gutenberg/pull/60160)) +- Template Parts: Update replace flow to separate template parts from patterns. ([60203](https://github.com/WordPress/gutenberg/pull/60203)) +- Template Parts: Update the 'Replace' label to 'Design'. ([60156](https://github.com/WordPress/gutenberg/pull/60156)) +- Try: Show copy shortcut in block options. ([60339](https://github.com/WordPress/gutenberg/pull/60339)) +- Update image role description text to fix spacing. ([60338](https://github.com/WordPress/gutenberg/pull/60338)) +- Update: Move post actions to the editor package. ([60092](https://github.com/WordPress/gutenberg/pull/60092)) +- Zoom out: Invoke zoom out mode when opening the patterns tab, and move the code to do so to a shared hook. ([59775](https://github.com/WordPress/gutenberg/pull/59775)) +- Create block: Add new namespacePascalCase template variable. ([60223](https://github.com/WordPress/gutenberg/pull/60223)) + +#### Site Editor +- Add rename page action. ([60230](https://github.com/WordPress/gutenberg/pull/60230)) +- Center the document title. ([59134](https://github.com/WordPress/gutenberg/pull/59134)) +- Consolidate when showing revisions link or action. ([60194](https://github.com/WordPress/gutenberg/pull/60194)) +- Editor: Update hover color of editor document title. ([60113](https://github.com/WordPress/gutenberg/pull/60113)) +- Improve the frame animation. ([60363](https://github.com/WordPress/gutenberg/pull/60363)) +- Try selecting closest editable block when clicking on a disabled block. ([60016](https://github.com/WordPress/gutenberg/pull/60016)) +- Update index view for pages. ([59950](https://github.com/WordPress/gutenberg/pull/59950)) + +#### Patterns +- Add content schema to pattern editing view. ([59977](https://github.com/WordPress/gutenberg/pull/59977)) +- Close inspector on pattern category select. ([60004](https://github.com/WordPress/gutenberg/pull/60004)) +- Focus block selection button only in navigation mode. ([60207](https://github.com/WordPress/gutenberg/pull/60207)) +- Pattern Shuffling: Make the results deterministic. ([60074](https://github.com/WordPress/gutenberg/pull/60074)) +- Patterns page: Enable table layout. ([60337](https://github.com/WordPress/gutenberg/pull/60337)) +- Prevent reordering of header and footer template parts when zoomed out. ([60054](https://github.com/WordPress/gutenberg/pull/60054)) +- Remove manage all of my patterns link. ([60345](https://github.com/WordPress/gutenberg/pull/60345)) + +#### Block Library +- Add __next40pxDefaultSize to Image block Title Attribute. ([60117](https://github.com/WordPress/gutenberg/pull/60117)) +- Add support "HTML Element" to Site Tagline. ([59654](https://github.com/WordPress/gutenberg/pull/59654)) +- Image: Remove temporary image check for rendering controls. ([60212](https://github.com/WordPress/gutenberg/pull/60212)) +- Quote block: Button for cite add/remove. ([59073](https://github.com/WordPress/gutenberg/pull/59073)) +- Quote block: Remove appender. ([60307](https://github.com/WordPress/gutenberg/pull/60307)) +- Reduce specificity of block library styles conflicting with block supports. ([59457](https://github.com/WordPress/gutenberg/pull/59457)) +- Update navigation blocks to use consistent link UI labels and field sizes. ([60116](https://github.com/WordPress/gutenberg/pull/60116)) + +#### Post Editor +- Block Editor: Deprecate '__experimentalGetReusableBlockTitle' selector. ([60278](https://github.com/WordPress/gutenberg/pull/60278)) +- Editor: Move PluginPostPublishPanel and PluginPrePublishPanel to editor package. ([60344](https://github.com/WordPress/gutenberg/pull/60344)) +- Editor: Move publish panel handling to `editor` store. ([60340](https://github.com/WordPress/gutenberg/pull/60340)) +- [Editor]: Unify publish sidebar preference. ([60334](https://github.com/WordPress/gutenberg/pull/60334)) + +#### Global Styles +- Add background to global styles changes output. ([60229](https://github.com/WordPress/gutenberg/pull/60229)) +- Background UI controls. ([59454](https://github.com/WordPress/gutenberg/pull/59454)) +- Follow up design tweaks for global styles presets. ([60031](https://github.com/WordPress/gutenberg/pull/60031)) +- Try reducing specificity of global styles selectors only. ([60106](https://github.com/WordPress/gutenberg/pull/60106)) + +#### Data Views +- DataViews: Add a utility to share filtering, sorting and pagination logic. ([59897](https://github.com/WordPress/gutenberg/pull/59897)) +- DataViews: Remove the `enumeration` type as redundant. ([60084](https://github.com/WordPress/gutenberg/pull/60084)) +- Update template actions. ([60075](https://github.com/WordPress/gutenberg/pull/60075)) +- [Data Views]: Add confirmation modal for clearing customizations in templates. ([60119](https://github.com/WordPress/gutenberg/pull/60119)) + +#### List View +- Add keyboard shortcut to collapse list view items other than the focused item. ([59978](https://github.com/WordPress/gutenberg/pull/59978)) +- Adjust the List View close icon to resemble the Inspector close icon. ([59999](https://github.com/WordPress/gutenberg/pull/59999)) +- Update "Actions" string to "Options" in List View. ([60136](https://github.com/WordPress/gutenberg/pull/60136)) + +#### Template Editor +- Add filter to allow extending the list of post content blocks. ([60068](https://github.com/WordPress/gutenberg/pull/60068)) +- Render non-editable preview of template part when user does not have capability to edit template part. ([60326](https://github.com/WordPress/gutenberg/pull/60326)) + +#### Zoom Out +- Add a delete control to toolbar on zoom-out mode. ([60214](https://github.com/WordPress/gutenberg/pull/60214)) +- Media dialog push content in zoomed out mode. ([60170](https://github.com/WordPress/gutenberg/pull/60170)) + +#### Components +- Popover / ToggleGroupControl: Use `useReducedMotion()` from `@wordpress/compose`. ([60168](https://github.com/WordPress/gutenberg/pull/60168)) +- date-fns: Bump to v3.6. ([60163](https://github.com/WordPress/gutenberg/pull/60163)) + +#### REST API +- Allow view access of template rest endpoint to anyone with the `edit_post` capability. ([60317](https://github.com/WordPress/gutenberg/pull/60317)) + +#### Commands +- Polish Command Palette. ([60134](https://github.com/WordPress/gutenberg/pull/60134)) + +#### Page Content Focus +- Allow selecting template parts in page content focus mode. ([60010](https://github.com/WordPress/gutenberg/pull/60010)) + +#### Inspector Controls +- Add: PostCardPanel component. ([59870](https://github.com/WordPress/gutenberg/pull/59870)) + + +### New APIs + +#### Extensibility +- Extensibiltiy: Support PluginBlockSettingsMenuItem in the site editor. ([60033](https://github.com/WordPress/gutenberg/pull/60033)) + + +### Bug Fixes + +- Columns block: Fix arrow up into it. ([55197](https://github.com/WordPress/gutenberg/pull/55197)) +- DOM: Fix return types of focus.tabbable methods. ([60274](https://github.com/WordPress/gutenberg/pull/60274)) +- Fix block toolbar dropdown separator color. ([60336](https://github.com/WordPress/gutenberg/pull/60336)) +- Global Styles: Make strings translatable. ([60127](https://github.com/WordPress/gutenberg/pull/60127)) +- Shadow: Revert shadow default presets opt-in to opt-out. ([60204](https://github.com/WordPress/gutenberg/pull/60204)) +- URL: Return early in getFilename where URL argument is falsy. ([60265](https://github.com/WordPress/gutenberg/pull/60265)) + +#### Block Library +- Fix enqueuing block theme styles when separate asset loading is enabled. ([60098](https://github.com/WordPress/gutenberg/pull/60098)) +- Fix lightbox UI disallow editing. ([59890](https://github.com/WordPress/gutenberg/pull/59890)) +- Fix navigation link ui close focus management. ([59925](https://github.com/WordPress/gutenberg/pull/59925)) +- Removed pointer-events none inline style due it blocking crop action. ([60305](https://github.com/WordPress/gutenberg/pull/60305)) +- Search Block: Apply font-related style inheritance to input field. ([60321](https://github.com/WordPress/gutenberg/pull/60321)) + +#### Site Editor +- Fix rendering PluginTemplateSettingPanel when we're editing a template. ([60215](https://github.com/WordPress/gutenberg/pull/60215)) +- Fix: Use `viewportWidth` in pattern preview data view. ([60315](https://github.com/WordPress/gutenberg/pull/60315)) +- Templates: Fix deferred rendering. ([60361](https://github.com/WordPress/gutenberg/pull/60361)) +- [Site Editor]: Consolidate save button functionality. ([60077](https://github.com/WordPress/gutenberg/pull/60077)) + +#### Block Editor +- Make sure the CSS class is-dark-theme is added to the editor iframe body. ([60300](https://github.com/WordPress/gutenberg/pull/60300)) +- Raw handling: Preserve class. ([60331](https://github.com/WordPress/gutenberg/pull/60331)) +- Raw handling: Preserve empty paragraphs. ([59476](https://github.com/WordPress/gutenberg/pull/59476)) +- Wiriting flow: Backspace at beginning of first paragraph block prevents block from being deleted. ([56329](https://github.com/WordPress/gutenberg/pull/56329)) + +#### Components +- CustomSelectControlV2: Fix hint behavior in legacy. ([60183](https://github.com/WordPress/gutenberg/pull/60183)) +- InputControl: Ignore IME events when `isPressEnterToChange`. ([60090](https://github.com/WordPress/gutenberg/pull/60090)) +- TextControl: Apply zero margin to input element. ([60282](https://github.com/WordPress/gutenberg/pull/60282)) + +#### Global Styles +- Fix missing class for Global Styles > Colors. ([60094](https://github.com/WordPress/gutenberg/pull/60094)) +- Reset specificity of body selector when processing with postcss. ([60266](https://github.com/WordPress/gutenberg/pull/60266)) + +#### Zoom Out +- Fix zoom out mode toggling between pattern category selection. ([60225](https://github.com/WordPress/gutenberg/pull/60225)) + +#### Data Views +- Fix focus outline visibility and truncation in data view record titles. ([60191](https://github.com/WordPress/gutenberg/pull/60191)) + +#### Layout +- Fix horizontal flex layout in classic themes. ([60154](https://github.com/WordPress/gutenberg/pull/60154)) + +#### Post Editor +- Editor: Memoize 'getInsertionPoint' selector. ([60015](https://github.com/WordPress/gutenberg/pull/60015)) + + +### Accessibility + +#### Data Views +- Add click-to-select behavior on table rows. ([59803](https://github.com/WordPress/gutenberg/pull/59803)) +- Data views list layout: Apply focus styles to items on `focus-visible` rather than `focus`. ([60253](https://github.com/WordPress/gutenberg/pull/60253)) +- Update field display in grid layout. ([60083](https://github.com/WordPress/gutenberg/pull/60083)) +- [Data Views] Updating keyboard navigation in list layouts. ([59637](https://github.com/WordPress/gutenberg/pull/59637)) + +#### Site Editor +- Restore Style book close button tooltip. ([60177](https://github.com/WordPress/gutenberg/pull/60177)) + +#### Block Library +- Remove CSS order property from social icons placeholder UI. ([60032](https://github.com/WordPress/gutenberg/pull/60032)) + +### Performance + +- Avoid fetching ALL reusable blocks (user patterns) on post/site editor load. ([58239](https://github.com/WordPress/gutenberg/pull/58239)) +- Block editor: Optimize hasSelectedInnerBlock selector. ([60330](https://github.com/WordPress/gutenberg/pull/60330)) +- Templates perf: Resolve patterns server side. ([60349](https://github.com/WordPress/gutenberg/pull/60349)) + +#### Block Library +- Template part: Avoid pattern fetch on mount. ([60297](https://github.com/WordPress/gutenberg/pull/60297)) + +#### Block Editor +- Inserter: Cache search normalization results. ([60080](https://github.com/WordPress/gutenberg/pull/60080)) + +### Experiments + +#### Site Editor +- Zoom-out view: Disable canvas resizing. ([60104](https://github.com/WordPress/gutenberg/pull/60104)) + + +### Documentation + +- Add auto generated API documentation for `editor` package. ([60356](https://github.com/WordPress/gutenberg/pull/60356)) +- Add component props documentation. ([60350](https://github.com/WordPress/gutenberg/pull/60350)) +- Add php @global documentation. ([59931](https://github.com/WordPress/gutenberg/pull/59931)) +- Change heading level on troubleshooting section. ([60233](https://github.com/WordPress/gutenberg/pull/60233)) +- CustomSelectControlV2: Match v1 stories to test legacy component. ([60182](https://github.com/WordPress/gutenberg/pull/60182)) +- Docs: Fix some typos. ([60260](https://github.com/WordPress/gutenberg/pull/60260)) +- Fix @todo tags to follow standards in WordPress comments. ([60148](https://github.com/WordPress/gutenberg/pull/60148)) +- Fix Font Collection JSON schema definition. ([60285](https://github.com/WordPress/gutenberg/pull/60285)) +- Fix: Invalid documentation link to load JavaScript. ([60181](https://github.com/WordPress/gutenberg/pull/60181)) +- Fix: Invalid links to the block supports api. ([60199](https://github.com/WordPress/gutenberg/pull/60199)) +- Fix: Non existent link to submitting to the block directory. ([60389](https://github.com/WordPress/gutenberg/pull/60389)) +- Interactivity API: Variable name correction in the documentation. ([60056](https://github.com/WordPress/gutenberg/pull/60056)) +- [Create Block] Update external template documentation to include variants. ([60095](https://github.com/WordPress/gutenberg/pull/60095)) + + +### Code Quality + +- Fix editor canvas overflow on search results with position: Relative. ([60287](https://github.com/WordPress/gutenberg/pull/60287)) +- Editor: Move template areas to editor package. ([60179](https://github.com/WordPress/gutenberg/pull/60179)) +- Style Engine: Continue get_classnames loop after adding the default classname. ([60153](https://github.com/WordPress/gutenberg/pull/60153)) +- Update: Use getPostIcon selector on document bar. ([60128](https://github.com/WordPress/gutenberg/pull/60128)) + +#### Block Editor +- Add comment for unmemoized context. ([60272](https://github.com/WordPress/gutenberg/pull/60272)) +- Fix ESLint warning in BlockListBlock component. ([60064](https://github.com/WordPress/gutenberg/pull/60064)) +- RichText: Switch from disableEditing to standard html readonly attribute. ([60327](https://github.com/WordPress/gutenberg/pull/60327)) +- Site Editor: Reuse inserter search term normalization. ([60218](https://github.com/WordPress/gutenberg/pull/60218)) +- canInsertBlockType: Extract helper for selector dependants. ([60235](https://github.com/WordPress/gutenberg/pull/60235)) + +#### Components +- CustomSelectControlV2: Rename for consistency. ([60178](https://github.com/WordPress/gutenberg/pull/60178)) +- Navigator: Fix two nits. ([60273](https://github.com/WordPress/gutenberg/pull/60273)) +- NavigatorProvider: Move all state management to one reducer. ([60190](https://github.com/WordPress/gutenberg/pull/60190)) +- Components: Try obviating Popover pointer event trap. ([59449](https://github.com/WordPress/gutenberg/pull/59449)) + +#### Post Editor +- Memoize the getTemplateInfo selector. ([60200](https://github.com/WordPress/gutenberg/pull/60200)) +- Update: Remove template summary component. ([60351](https://github.com/WordPress/gutenberg/pull/60351)) + +#### Global Styles +- Additional CSS: Add code comments contextualising tranformStyles for clarity. ([60267](https://github.com/WordPress/gutenberg/pull/60267)) +- Global styles: output `:root` selector for CSS custom properties. ([42084](https://github.com/WordPress/gutenberg/pull/42084)) + +#### Font Library +- Add test for Font Library and Theme Style Variations. ([60250](https://github.com/WordPress/gutenberg/pull/60250)) +- Update google fonts font collection data URL to the latest version available. ([60079](https://github.com/WordPress/gutenberg/pull/60079)) + +#### Block Library +- Image: Use the new 'useUploadMediaFromBlobURL' hook. ([60208](https://github.com/WordPress/gutenberg/pull/60208)) +- Navigation Block: Add test coverage to check that post content is not removed. ([60189](https://github.com/WordPress/gutenberg/pull/60189)) + +#### Site Editor +- DataViews: Don't memoize every callback 'PagePages' component. ([60103](https://github.com/WordPress/gutenberg/pull/60103)) +- History: Simplify the push and replace methods. ([60112](https://github.com/WordPress/gutenberg/pull/60112)) + +#### Rich Text +- RichText: Separate fallback instance ID for selection retrieval. ([60277](https://github.com/WordPress/gutenberg/pull/60277)) + +#### Block Locking +- E2E: Test BlockSwitcher availability in l-post-ul-group CPT. ([60254](https://github.com/WordPress/gutenberg/pull/60254)) + +#### Data Views +- DataViews: Fix react warning error in list layout. ([60101](https://github.com/WordPress/gutenberg/pull/60101)) + + +### Tools + +#### Testing +- Automated Testing: Remove Puppeteer CI Job. ([59311](https://github.com/WordPress/gutenberg/pull/59311)) +- CustomSelectControlV2: Stabilize tests. ([60133](https://github.com/WordPress/gutenberg/pull/60133)) +- E2E: Fix flaky Site Editor pages end-to-end test. ([60109](https://github.com/WordPress/gutenberg/pull/60109)) +- Font Library: Add upload font test. ([60221](https://github.com/WordPress/gutenberg/pull/60221)) + +#### Build Tooling +- Blocks: Fix double `gutenberg_` prefix in built dynamic blocks PHP. ([60288](https://github.com/WordPress/gutenberg/pull/60288)) + + +### Various + +- Backport r57868 (Editor: Prevent font folder naive filtering causing infinite loops) from WordPress-Develop. ([60141](https://github.com/WordPress/gutenberg/pull/60141)) +- Format library: Improve unknown format performance. ([48761](https://github.com/WordPress/gutenberg/pull/48761)) + +#### Post Editor +- Distraction free: Remove unwanted space from string. ([60108](https://github.com/WordPress/gutenberg/pull/60108)) + + +## First time contributors + +The following PRs were merged by first time contributors 🎉 : + +- @interdevel: Fix `@todo` tags to follow standards in WordPress comments. ([60148](https://github.com/WordPress/gutenberg/pull/60148)) +- @mikeybinns: Add component props documentation. ([60350](https://github.com/WordPress/gutenberg/pull/60350)) +- @nirav7707: Editor: Update hover color of editor document title. ([60113](https://github.com/WordPress/gutenberg/pull/60113)) +- @steveariss: Interactivity API: Variable name correction in the documentation. ([60056](https://github.com/WordPress/gutenberg/pull/60056)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @afercia @andrewhayward @andrewserong @artemiomorales @bph @draganescu @ellatrix @fabiankaegy @geriux @getdave @glendaviesnz @interdevel @jameskoster @jasmussen @jeryj @jorgefilipecosta @jsnajdr @madhusudhand @MaggieCabrera @Mamaduka @matiasbenedetto @mcsf @mikachan @mikeybinns @mirka @mujuonly @n2erjo00 @nirav7707 @noisysocks @ntsekouras @oandregal @ockham @pedro-mendonca @peterwilsoncc @ramonjd @richtabor @ryanwelcher @scruffian @shail-mehta @Soean @steveariss @stokesman @t-hamano @talldan @tellthemachines @torounit @tyxla @youknowriad + + += 18.0.0 = + +## Changelog + +### Enhancements + +- Core Data: Update method generating plural names. ([59881](https://github.com/WordPress/gutenberg/pull/59881)) +- Expand main content area to viewport when zoomed out. ([59512](https://github.com/WordPress/gutenberg/pull/59512)) +- Update 'sidebar card' appearance. ([59997](https://github.com/WordPress/gutenberg/pull/59997)) + +#### Data Views +- Add: Command click to select item on table view. ([59563](https://github.com/WordPress/gutenberg/pull/59563)) +- DataViews: Add AND logic operators to filters. ([59953](https://github.com/WordPress/gutenberg/pull/59953)) +- DataViews: Add default getValue for fields. ([59810](https://github.com/WordPress/gutenberg/pull/59810)) +- DataViews: Implement multiple selection for filters. ([59610](https://github.com/WordPress/gutenberg/pull/59610)) +- DataViews: Make list layout stable. ([59858](https://github.com/WordPress/gutenberg/pull/59858)) +- Pages data view: Update quick-actions. ([59551](https://github.com/WordPress/gutenberg/pull/59551)) +- Reduce visual prominence of primary actions in table data views, and consolidate primary + secondary actions in ellipsis menu. ([59128](https://github.com/WordPress/gutenberg/pull/59128)) + +#### Site Editor +- Patterns: Add a title to the category delete flow and increase line height. ([59645](https://github.com/WordPress/gutenberg/pull/59645)) +- Standardize block tools toggle button size to 32px. ([59625](https://github.com/WordPress/gutenberg/pull/59625)) +- Update index page for templates. ([59792](https://github.com/WordPress/gutenberg/pull/59792)) +- [Site Editor]: Move featured image at the top of the inspector controls. ([59783](https://github.com/WordPress/gutenberg/pull/59783)) + +#### Block Library +- Add featured image to Media & Text block. ([51491](https://github.com/WordPress/gutenberg/pull/51491)) +- Social Icons: Update Medium icon. ([57073](https://github.com/WordPress/gutenberg/pull/57073)) +- Table Block: Fixed width table cells on by default. ([49672](https://github.com/WordPress/gutenberg/pull/49672)) +- Update Reddit social icon to latest brand guidelines. ([59438](https://github.com/WordPress/gutenberg/pull/59438)) + +#### Components +- Add typing for date and time typing for TextControl. ([59666](https://github.com/WordPress/gutenberg/pull/59666)) +- Add: Support for menu group to the Dropdown. ([59723](https://github.com/WordPress/gutenberg/pull/59723)) +- Update the line height for components. ([60028](https://github.com/WordPress/gutenberg/pull/60028)) + +#### Design Tools +- Add Box Shadow support for featured image. ([59616](https://github.com/WordPress/gutenberg/pull/59616)) +- Background block supports: Move block support defaults to gutenberg_render_background_support and revert gutenberg_get_background_support_styles. ([59889](https://github.com/WordPress/gutenberg/pull/59889)) + +#### Layout +- Add Column Start and Row Start controls to Grid children. ([59483](https://github.com/WordPress/gutenberg/pull/59483)) +- Allow blocks to be grouped as a Grid. ([59853](https://github.com/WordPress/gutenberg/pull/59853)) + +#### Global Styles +- Remove preset headers. ([59504](https://github.com/WordPress/gutenberg/pull/59504)) +- Try color and typography presets in Site View. ([59594](https://github.com/WordPress/gutenberg/pull/59594)) + +#### Block API +- Display settings 'label' defined by the 'register_setting' method. ([59243](https://github.com/WordPress/gutenberg/pull/59243)) + +#### Rich Text +- RichText: Add non breaking space shortcut on Windows. ([43150](https://github.com/WordPress/gutenberg/pull/43150)) + + +### New APIs + +- Support the PluginDocumentSettingPanel slot in the site editor. ([59985](https://github.com/WordPress/gutenberg/pull/59985)) +- Add pre 6.5 compat for viewStyles. ([59322](https://github.com/WordPress/gutenberg/pull/59322)) + +### Bug Fixes + +#### Block Library +- Add filter for duotone to account for gutenberg_restore_image_outer_container in classic themes. ([59764](https://github.com/WordPress/gutenberg/pull/59764)) +- Add richText identifier to blocks. ([59056](https://github.com/WordPress/gutenberg/pull/59056)) +- Close navigation link ui on escape. ([59838](https://github.com/WordPress/gutenberg/pull/59838)) +- Code block: Preserve newlines. ([59627](https://github.com/WordPress/gutenberg/pull/59627)) +- Do not focus new navigation block menu until loading is finished. ([59801](https://github.com/WordPress/gutenberg/pull/59801)) +- File: Add center alignment editor class for classic themes. ([59975](https://github.com/WordPress/gutenberg/pull/59975)) +- Fix create menu after menu switch. ([59630](https://github.com/WordPress/gutenberg/pull/59630)) +- Fix image layout shift from placeholder to selected placeholder. ([59857](https://github.com/WordPress/gutenberg/pull/59857)) +- Fix overlay issue when empty featured image is used in Cover Block. ([59855](https://github.com/WordPress/gutenberg/pull/59855)) +- Media & Text: Remove the duplicate Media width control. ([59776](https://github.com/WordPress/gutenberg/pull/59776)) +- Prevent default on primary+k to prevent command center from opening on navigation link. ([59845](https://github.com/WordPress/gutenberg/pull/59845)) +- Quote: Show as active when deeply nested child block is selected. ([59662](https://github.com/WordPress/gutenberg/pull/59662)) +- RichText: Document the identifier prop. ([60036](https://github.com/WordPress/gutenberg/pull/60036)) +- Social icons: Only render label container when there's a label. ([60060](https://github.com/WordPress/gutenberg/pull/60060)) +- Template Parts: Fix typo in translatable string. ([59816](https://github.com/WordPress/gutenberg/pull/59816)) +- Ensure consistent return type in `WP_Navigation_Block_Renderer::Get_markup_for_inner_block()`. ([59820](https://github.com/WordPress/gutenberg/pull/59820)) +- Return early from saving meta data for the navigation without a $post->ID. ([59875](https://github.com/WordPress/gutenberg/pull/59875)) +- Fix root ID calculation when check if block can be transformed. ([60167](https://github.com/WordPress/gutenberg/pull/60167)) +- Featured Image: Fix overlay rendering in the editor. ([60187](https://github.com/WordPress/gutenberg/pull/60187)) +- Fix self closing navigation overlay. ([60130](https://github.com/WordPress/gutenberg/pull/60130)) +- Navigation: Avoid content loss when only specific entity fields are edited. ([60071](https://github.com/WordPress/gutenberg/pull/60071)) + +#### Font Library +- Avoid auto-removing font families without font faces. ([59910](https://github.com/WordPress/gutenberg/pull/59910)) +- Ensure that errors reported from uploading font files are not duplicated. ([59564](https://github.com/WordPress/gutenberg/pull/59564)) +- Fix JS errors when activating or deactivating system fonts. ([59935](https://github.com/WordPress/gutenberg/pull/59935)) +- Fix typo in upload text. ([59655](https://github.com/WordPress/gutenberg/pull/59655)) +- Polish Google Fonts consent box. ([59631](https://github.com/WordPress/gutenberg/pull/59631)) +- Refactors the upload handler in order to check if files being uploaded are valid font files. ([59648](https://github.com/WordPress/gutenberg/pull/59648)) +- Reset notices when navigating away from the collection. ([59981](https://github.com/WordPress/gutenberg/pull/59981)) +- Activate the fonts coming from the backend and not the data from the frontend. ([60093](https://github.com/WordPress/gutenberg/pull/60093)) +- Install fonts in sequence to work around race condition. ([60180](https://github.com/WordPress/gutenberg/pull/60180)) + +#### Interactivity API +- Backport fixes from Core. ([59903](https://github.com/WordPress/gutenberg/pull/59903)) +- Fix interactivity api end-to-end tests. ([59836](https://github.com/WordPress/gutenberg/pull/59836)) +- Interactivity: Ensure stores are initialized on client. ([59842](https://github.com/WordPress/gutenberg/pull/59842)) +- Interactivity: Restore scope when yielded promise rejects. ([59708](https://github.com/WordPress/gutenberg/pull/59708)) +- Prevent non-object state from being added. ([59886](https://github.com/WordPress/gutenberg/pull/59886)) +- Re-introduce `data_wp_context()` with `_deprecated_function()` call. ([59834](https://github.com/WordPress/gutenberg/pull/59834)) + +#### Site Editor +- Don't display welcome guide in hybrid theme. ([55865](https://github.com/WordPress/gutenberg/pull/55865)) +- Editor: Fix loading templates using a top level pattern block that includes a template part. ([59900](https://github.com/WordPress/gutenberg/pull/59900)) +- Fix opening of save panel when using the `save` shortcut. ([59647](https://github.com/WordPress/gutenberg/pull/59647)) +- Fix selected featured image when opening media library. ([59769](https://github.com/WordPress/gutenberg/pull/59769)) +- Make the delete navigation menu confirm dialogs consistent. ([59825](https://github.com/WordPress/gutenberg/pull/59825)) +- Restore the back button when navigating to the template from the home page. ([59639](https://github.com/WordPress/gutenberg/pull/59639)) + +#### Block Editor +- Fix allow mouse users to edit link text when Link UI is active. ([59635](https://github.com/WordPress/gutenberg/pull/59635)) +- Fix crash when unmounting an editor iframe. ([59992](https://github.com/WordPress/gutenberg/pull/59992)) +- Handle when attributes param passed into hasStickyOrFixedPositionValue is nullish. ([59800](https://github.com/WordPress/gutenberg/pull/59800)) +- List view: Fix stuck moving animation on Enter. ([59644](https://github.com/WordPress/gutenberg/pull/59644)) +- Shadow support enable skip serialization for dynamic blocks. ([59887](https://github.com/WordPress/gutenberg/pull/59887)) +- FlatTermSelector: Invalidate optimistic update if term creation fails. ([59945](https://github.com/WordPress/gutenberg/pull/59945)) + +#### Global Styles +- Fix retrieval of referenced preset values in editor. ([59811](https://github.com/WordPress/gutenberg/pull/59811)) +- Global Syles: Apply fallback background color to typography elements. ([59347](https://github.com/WordPress/gutenberg/pull/59347)) +- Presets: Show the default empty variation as well as the other presets. ([59717](https://github.com/WordPress/gutenberg/pull/59717)) +- Remove filter for same number of settings. ([59590](https://github.com/WordPress/gutenberg/pull/59590)) +- Site editor: Find font families for typography presets crashes editor. ([59806](https://github.com/WordPress/gutenberg/pull/59806)) +- Force root min-height of 100% for backgrounds. ([59809](https://github.com/WordPress/gutenberg/pull/59809)) +- Featured Image: Fix block support selectors after shadow support addition. ([60184](https://github.com/WordPress/gutenberg/pull/60184)) +- Fix list of base theme fonts when a theme variation is applied.. ([59959](https://github.com/WordPress/gutenberg/pull/59959)) + +#### Patterns +- Add pattern title in create modal in post editor. ([59550](https://github.com/WordPress/gutenberg/pull/59550)) +- Implement pattern overrides behind `IS_GUTENBERG_PLUGIN` flag. ([59702](https://github.com/WordPress/gutenberg/pull/59702)) +- Pattern Explorer: Pass 'rootClientId' to the pattern list. ([60014](https://github.com/WordPress/gutenberg/pull/60014)) +- Pattern Shuffling: Don't assume that patterns have categories. ([60070](https://github.com/WordPress/gutenberg/pull/60070)) + +#### Data Views +- Ensure the 'select all' checkbox appears on hover. ([59799](https://github.com/WordPress/gutenberg/pull/59799)) +- Fix: Regression: Default templates and template parts views do not work. ([59794](https://github.com/WordPress/gutenberg/pull/59794)) +- Ignore cmd-click when row not selectable. ([59697](https://github.com/WordPress/gutenberg/pull/59697)) +- [DataViews]: Fix item actions. ([59748](https://github.com/WordPress/gutenberg/pull/59748)) + +#### Components +- DateTimePicker: Change day button size back from 32px to 28px. ([59990](https://github.com/WordPress/gutenberg/pull/59990)) +- Fix unwanted ToggleGroupControl backdrop vertical animation. ([59642](https://github.com/WordPress/gutenberg/pull/59642)) +- PaletteEdit: Fix order numbers. ([52212](https://github.com/WordPress/gutenberg/pull/52212)) + +#### Layout +- Experiments: Fix label typo: "Grid interactivity". ([59796](https://github.com/WordPress/gutenberg/pull/59796)) +- Show inherit toggle in the absence of `settings.layout` object. ([59580](https://github.com/WordPress/gutenberg/pull/59580)) +- Use correct layout type to display controls. ([59979](https://github.com/WordPress/gutenberg/pull/59979)) + +#### List View +- Block Bindings: Remove Block Bindings icon from List View, fixes and CSS updates. ([59477](https://github.com/WordPress/gutenberg/pull/59477)) +- Heading Block: Show default block name in list view when content is empty. ([59827](https://github.com/WordPress/gutenberg/pull/59827)) +- Blocks: getBlockLabel: Use RichTextData.toPlainText if available. ([58524](https://github.com/WordPress/gutenberg/pull/58524)) + +#### Data Layer +- Fix `getEntityRecordsTotalPages` when `per_page` is not provided. ([59983](https://github.com/WordPress/gutenberg/pull/59983)) + +#### Icons +- Fix return icon viewbox. ([59669](https://github.com/WordPress/gutenberg/pull/59669)) + +### Accessibility + +- Add tooltip to several Back buttons. ([59760](https://github.com/WordPress/gutenberg/pull/59760)) +- Make save panel a dialog with proper labels, fix site editor focus loss after save. ([59622](https://github.com/WordPress/gutenberg/pull/59622)) +- Fix labeling of the navigation links in the list view. ([59370](https://github.com/WordPress/gutenberg/pull/59370)) + +### Documentation + +- Block JSON schema: Add `layout.allowCustomContentAndWideSize` field. ([59736](https://github.com/WordPress/gutenberg/pull/59736)) +- Components: Fix headline hierarchy in README. ([59726](https://github.com/WordPress/gutenberg/pull/59726)) +- Components: Hide private READMEs from handbook. ([60003](https://github.com/WordPress/gutenberg/pull/60003)) +- Dataviews: Improve story. ([59773](https://github.com/WordPress/gutenberg/pull/59773)) +- Docs/fix typo in metadata reference guide. ([59577](https://github.com/WordPress/gutenberg/pull/59577)) +- Docs/fix typos and clarify wording in blocks supports guide. ([59721](https://github.com/WordPress/gutenberg/pull/59721)) +- Docs/fix typos in block context. ([59575](https://github.com/WordPress/gutenberg/pull/59575)) +- Docs/fix typos in block registration guide. ([59720](https://github.com/WordPress/gutenberg/pull/59720)) +- Docs/fix typos in block supports. ([59919](https://github.com/WordPress/gutenberg/pull/59919)) +- Docs/fix typos in edit and save reference guide. ([59576](https://github.com/WordPress/gutenberg/pull/59576)) +- Docs: Flex - Fix headline hierarchy. ([59686](https://github.com/WordPress/gutenberg/pull/59686)) +- Docs: List all minor versions on Versions in WordPress page. ([58003](https://github.com/WordPress/gutenberg/pull/58003)) +- Docs: Remove alert callout on block selectors page. ([60020](https://github.com/WordPress/gutenberg/pull/60020)) +- Docs: Update Interactivity API package readme. ([59763](https://github.com/WordPress/gutenberg/pull/59763)) +- Fix broken links in Interactivity API documentation. ([59715](https://github.com/WordPress/gutenberg/pull/59715)) +- Fix sample code on InputControl documentation. ([59517](https://github.com/WordPress/gutenberg/pull/59517)) +- Fix typo in platform-docs. ([60042](https://github.com/WordPress/gutenberg/pull/60042)) +- Fix: Invalid links to getting started with JavaScript. ([59927](https://github.com/WordPress/gutenberg/pull/59927)) +- Fixes pseudo code doc block to use real PHP. ([60012](https://github.com/WordPress/gutenberg/pull/60012)) +- HeadingLevelDropdown: Fix JSDoc and documentation. ([59727](https://github.com/WordPress/gutenberg/pull/59727)) +- Improve Gutenberg platform documentation homepage. ([59749](https://github.com/WordPress/gutenberg/pull/59749)) +- InputControl: Make `onChange` observable in Storybook. ([60055](https://github.com/WordPress/gutenberg/pull/60055)) +- Interactivity API Docs: Clarify that `getElement()`'s `ref` can be `null`. ([59868](https://github.com/WordPress/gutenberg/pull/59868)) +- Platform Docs: Fix JSX error. ([59967](https://github.com/WordPress/gutenberg/pull/59967)) +- Plugin short description less than 150 characters. ([59661](https://github.com/WordPress/gutenberg/pull/59661)) +- RadioControl: Update deprecated suggestion in readme. ([60002](https://github.com/WordPress/gutenberg/pull/60002)) +- Replace screenshots of Radio Control. ([60024](https://github.com/WordPress/gutenberg/pull/60024)) +- Replace “sidebar” with “panel” in README.md. ([59664](https://github.com/WordPress/gutenberg/pull/59664)) +- Update GitHub edit URL in docusaurus.config.js. ([59969](https://github.com/WordPress/gutenberg/pull/59969)) +- Update React documentation links for forms. ([59657](https://github.com/WordPress/gutenberg/pull/59657)) +- Update api-reference - data-bind--hidden is an incorrrect attribute - should be data-wp-bind--hidden. ([59955](https://github.com/WordPress/gutenberg/pull/59955)) +- Update block supports documentation for WordPress 6.5. ([59862](https://github.com/WordPress/gutenberg/pull/59862)) +- Update dependency-extraction-webpack-plugin documentation. ([59973](https://github.com/WordPress/gutenberg/pull/59973)) +- docs: Fix syntax in block filters example. ([59636](https://github.com/WordPress/gutenberg/pull/59636)) +- theme.json schema: Add settings.color.caption definition. ([60017](https://github.com/WordPress/gutenberg/pull/60017)) + + +### Code Quality + +- Add $schema to tsconfig files. ([59861](https://github.com/WordPress/gutenberg/pull/59861)) +- Added @global to PHP documentation Comments. ([59725](https://github.com/WordPress/gutenberg/pull/59725)) +- Consolidate template actions components. ([59586](https://github.com/WordPress/gutenberg/pull/59586)) +- Core Data: Clarify comments for entities' plural methods. ([59946](https://github.com/WordPress/gutenberg/pull/59946)) +- Fix Code Standards for RC 2 release. ([59774](https://github.com/WordPress/gutenberg/pull/59774)) +- Fix typo in Dataviews and Font Collection packages. ([59656](https://github.com/WordPress/gutenberg/pull/59656)) +- Fix: Typo correction tff to ttf. ([59665](https://github.com/WordPress/gutenberg/pull/59665)) +- Global styles utils: Remove unused vars. ([59805](https://github.com/WordPress/gutenberg/pull/59805)) +- Refactor zoom-out iframe scale. ([59618](https://github.com/WordPress/gutenberg/pull/59618)) +- Refine include/exclude patterns in phpcs.xml.dist. ([59712](https://github.com/WordPress/gutenberg/pull/59712)) +- Typography Presets: Use && rather to avoid a messy nested conditional. ([59920](https://github.com/WordPress/gutenberg/pull/59920)) +- synchronizeBlocksWithTemplate: Extract common functions. ([59682](https://github.com/WordPress/gutenberg/pull/59682)) + +#### Block Editor +- Block tree reducer: Avoid nested update for insertUsage. ([59681](https://github.com/WordPress/gutenberg/pull/59681)) +- Block tree reducer: Avoid repetitive Map.get. ([59672](https://github.com/WordPress/gutenberg/pull/59672)) +- BlockSettingsDropdown: No need to cast 'clientIds' to an array. ([59940](https://github.com/WordPress/gutenberg/pull/59940)) +- BlockSettingsMenuControls: Remove '__unstableDisplayLocation' prop. ([59942](https://github.com/WordPress/gutenberg/pull/59942)) +- Don't memoize callbacks in 'BlockSettingsDropdown'. ([59397](https://github.com/WordPress/gutenberg/pull/59397)) +- Link dialog: Remove CSS hack. ([59746](https://github.com/WordPress/gutenberg/pull/59746)) +- Pattern Explorer: Remove leftover source filter state handlers. ([60019](https://github.com/WordPress/gutenberg/pull/60019)) +- Fix code formatting in Nav block view file. ([60162](https://github.com/WordPress/gutenberg/pull/60162)) + +#### Components +- Button : Deprecate `isSmall` prop. ([59734](https://github.com/WordPress/gutenberg/pull/59734)) +- Button: Keep deprecated props in type definitions. ([59913](https://github.com/WordPress/gutenberg/pull/59913)) +- Replace `isSmall` prop with `size` in `NavigationMenuSelector`. ([59667](https://github.com/WordPress/gutenberg/pull/59667)) +- Replace isSmall prop WordPress/Gutenberg#53560. ([59302](https://github.com/WordPress/gutenberg/pull/59302)) +- TextareaControl: Remove extra closing curly brace in `inputStyleNeutral`. ([59744](https://github.com/WordPress/gutenberg/pull/59744)) +- Update Snapshots for line height. ([60041](https://github.com/WordPress/gutenberg/pull/60041)) + +#### Block Library +- Add explanatory comment to Nav Link block fix for Command Center. ([59864](https://github.com/WordPress/gutenberg/pull/59864)) +- Enforce @since tags in block-library/src/*/*.php files. ([59700](https://github.com/WordPress/gutenberg/pull/59700)) +- Refactor Enter keypress on Nav Link. ([59848](https://github.com/WordPress/gutenberg/pull/59848)) +- Update Nav block permissions variable naming accuracy. ([59882](https://github.com/WordPress/gutenberg/pull/59882)) + +#### Global Styles +- Fetch the variations inside the component. ([59588](https://github.com/WordPress/gutenberg/pull/59588)) +- Theme JSON: Remove unused vars in layout class. ([59938](https://github.com/WordPress/gutenberg/pull/59938)) +- Use the preivew iframe to preview typography for consistency. ([59587](https://github.com/WordPress/gutenberg/pull/59587)) +- Background block supports: Move size defaults to hooks and block.json. ([60008](https://github.com/WordPress/gutenberg/pull/60008)) + +#### Plugin +- Remove unnecessary 'IS_GUTENBERG_PLUGIN' check in 'load.php'. ([59873](https://github.com/WordPress/gutenberg/pull/59873)) +- Update PHP Sync Issue generation script to ignore PRs with given labels. ([59549](https://github.com/WordPress/gutenberg/pull/59549)) + +#### Data Views +- Update: Dataviews do not use strings on isCustom props passed down. ([59609](https://github.com/WordPress/gutenberg/pull/59609)) +- [Data Views]: Remove separator in item actions. ([59822](https://github.com/WordPress/gutenberg/pull/59822)) + +#### Data Layer +- Data: Deprecate the getIsResolving selector. ([59679](https://github.com/WordPress/gutenberg/pull/59679)) + +### Tools + +#### Build Tooling +- Add inline comment denoting version for Ruby setup. ([59640](https://github.com/WordPress/gutenberg/pull/59640)) +- Build: Dedupe packages. ([57800](https://github.com/WordPress/gutenberg/pull/57800)) +- GitHub Actions: Fix PHP file change detection logic. ([59653](https://github.com/WordPress/gutenberg/pull/59653)) +- Improve likelihood of Cherry Picking script including all PRs. ([59871](https://github.com/WordPress/gutenberg/pull/59871)) +- Interactive template: Use wp_interactivity_data_wp_context function. ([59995](https://github.com/WordPress/gutenberg/pull/59995)) +- Test: Dynamically detect and set max-workers. ([59904](https://github.com/WordPress/gutenberg/pull/59904)) +- Update docusaurus to the latest version. ([59866](https://github.com/WordPress/gutenberg/pull/59866)) + +#### Testing +- Remove @kevin940726 and @Mamaduka from end-to-end test codeowners. ([60067](https://github.com/WordPress/gutenberg/pull/60067)) +- Upgrade Playwright to v1.42. ([59339](https://github.com/WordPress/gutenberg/pull/59339)) +- Use viewScriptModule block.json field for interactivity end-to-end tests. ([59705](https://github.com/WordPress/gutenberg/pull/59705)) +- end-to-end theme switch: Match incoming theme slug, then optional folder. ([59851](https://github.com/WordPress/gutenberg/pull/59851)) + + +## First time contributors + +The following PRs were merged by first time contributors: + +- @andrewfleming: Plugin short description less than 150 characters. ([59661](https://github.com/WordPress/gutenberg/pull/59661)) +- @chrisbellboy: docs: Fix syntax in block filters example. ([59636](https://github.com/WordPress/gutenberg/pull/59636)) +- @colinduwe: Shadow support enable skip serialization for dynamic blocks. ([59887](https://github.com/WordPress/gutenberg/pull/59887)) +- @enodekciw: Update dependency-extraction-webpack-plugin documentation. ([59973](https://github.com/WordPress/gutenberg/pull/59973)) +- @georgestephanis: Re-introduce `data_wp_context()` with `_deprecated_function()` call. ([59834](https://github.com/WordPress/gutenberg/pull/59834)) +- @J0n-92: Add typing for date and time typing for TextControl. ([59666](https://github.com/WordPress/gutenberg/pull/59666)) +- @jaclync: Replace `isSmall` prop with `size` in `NavigationMenuSelector`. ([59667](https://github.com/WordPress/gutenberg/pull/59667)) +- @Jayanth-Parthsarathy: Add inline comment denoting version for Ruby setup. ([59640](https://github.com/WordPress/gutenberg/pull/59640)) +- @luislard: Fix broken links in Interactivity API documentation. ([59715](https://github.com/WordPress/gutenberg/pull/59715)) +- @mattsherman: Handle when attributes param passed into hasStickyOrFixedPositionValue is nullish. ([59800](https://github.com/WordPress/gutenberg/pull/59800)) +- @mzahir: Update React documentation links for forms. ([59657](https://github.com/WordPress/gutenberg/pull/59657)) +- @rcoll: Fix typo in Dataviews and Font Collection packages. ([59656](https://github.com/WordPress/gutenberg/pull/59656)) +- @SahilThakur02: TextareaControl: Remove extra closing curly brace in `inputStyleNeutral`. ([59744](https://github.com/WordPress/gutenberg/pull/59744)) +- @Sam-Xronn: Update Reddit social icon to latest brand guidelines. ([59438](https://github.com/WordPress/gutenberg/pull/59438)) +- @Strangehill: Replace “sidebar” with “panel” in README.md. ([59664](https://github.com/WordPress/gutenberg/pull/59664)) +- @TeresaGobble: Docs/fix typos in edit and save reference guide. ([59576](https://github.com/WordPress/gutenberg/pull/59576)) +- @tomepajk: Update api-reference - data-bind--hidden is an incorrrect attribute - should be data-wp-bind--hidden. ([59955](https://github.com/WordPress/gutenberg/pull/59955)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @afercia @afragen @ajlende @alexstine @andrewfleming @anton-vlasenko @artemiomorales @bacoords @c4rl0sbr4v0 @carolinan @chrisbellboy @colinduwe @creativecoder @DAreRodz @dcalhoun @draganescu @ellatrix @enejb @enodekciw @flexseth @fluiddot @gaambo @georgestephanis @geriux @getdave @huzaifaalmesbah @inc2734 @J0n-92 @jaclync @jameskoster @jasmussen @Jayanth-Parthsarathy @jeryj @jorgefilipecosta @jsnajdr @kevin940726 @krokodok @luislard @Mamaduka @matiasbenedetto @mattsherman @mcsf @megane9988 @michalczaplinski @mirka @mujuonly @mzahir @ndiego @noisysocks @ntsekouras @oandregal @pbking @ramonjd @rcoll @SahilThakur02 @Sam-Xronn @scruffian @shail-mehta @SiobhyB @sirreal @Soean @Strangehill @sunil25393 @swissspidy @t-hamano @talldan @tellthemachines @TeresaGobble @tjcafferkey @tomepajk @tyxla @vcanales @youknowriad + + + + += 17.9.0 = ## Changelog @@ -32,7 +1888,6 @@ - Template Parts: Add a replace flow to the inspector controls. ([55128](https://github.com/WordPress/gutenberg/pull/55128)) #### Site Editor -- Zoomed-Out Mode: Don't show blocks in zoomed out view. ([59245](https://github.com/WordPress/gutenberg/pull/59245)) - Block Theme Previews: Remove "Looking for Template Parts?" hint. ([59092](https://github.com/WordPress/gutenberg/pull/59092)) - Remove the site editor sidebar navigation edit button. ([59335](https://github.com/WordPress/gutenberg/pull/59335)) - Scale the zoomed out mode to fit available space. ([59342](https://github.com/WordPress/gutenberg/pull/59342)) @@ -83,6 +1938,7 @@ - Hide UI elements when user lacks permissions. ([59332](https://github.com/WordPress/gutenberg/pull/59332)) - Load/Unload the font face in browser when toggling the variants. ([59066](https://github.com/WordPress/gutenberg/pull/59066)) - Use SearchControl component for search input. ([59589](https://github.com/WordPress/gutenberg/pull/59589)) +- REST API: Backport r57804 from wp-dev. ([59767](https://github.com/WordPress/gutenberg/pull/59767)) #### Interactivity API - Fix `navigate()` issues related to initial state merges. ([57134](https://github.com/WordPress/gutenberg/pull/57134)) @@ -101,6 +1957,7 @@ #### Block Editor - Fix Navigation link control overlapping issue. ([59065](https://github.com/WordPress/gutenberg/pull/59065)) +- Fix: Re-render toolbar when parent block changes. ([59234](https://github.com/WordPress/gutenberg/pull/59234)) - List: Copy wrapper when multi selecting items. ([59460](https://github.com/WordPress/gutenberg/pull/59460)) - Refactor: UseBlockTools hook. ([58979](https://github.com/WordPress/gutenberg/pull/58979)) - Rich text: Fix typing into empty flex element. ([59473](https://github.com/WordPress/gutenberg/pull/59473)) @@ -123,12 +1980,14 @@ - Ensure ResizableFrame does not force Cover blocks within the editor to show drag handles. ([59262](https://github.com/WordPress/gutenberg/pull/59262)) - Iframe: Scale html instead of iframe element for zoomed out mode. ([59334](https://github.com/WordPress/gutenberg/pull/59334)) - Zoom out mode: Only apply grey background for mode. ([59377](https://github.com/WordPress/gutenberg/pull/59377)) -- Site Editor: Fix Global Styles outdated output. ([59628](https://github.com/WordPress/gutenberg/pull/59628)) +- Fix Global Styles outdated output. ([59628](https://github.com/WordPress/gutenberg/pull/59628)) +- Fix site editor crashing when not fully loaded. ([59658](https://github.com/WordPress/gutenberg/pull/59658)) #### Global Styles - Dynamically set border panel label based on the controls available. ([59358](https://github.com/WordPress/gutenberg/pull/59358)) - Shadow: Fix layout collapse when indicator is selected. ([59309](https://github.com/WordPress/gutenberg/pull/59309)) - Theme JSON: Check for null values to cater for blockGap. ([59258](https://github.com/WordPress/gutenberg/pull/59258)) +- Remove the extra unneeded color variations panel. ([59718](https://github.com/WordPress/gutenberg/pull/59718)) #### Post Editor - Command Palette: Prevent mode switching if only one editor mode is available. ([59299](https://github.com/WordPress/gutenberg/pull/59299)) @@ -239,7 +2098,7 @@ - Editor: Remove MoreDropdownMenuComponent. ([59096](https://github.com/WordPress/gutenberg/pull/59096)) - Interface: Remove unused MoreMenuFeatureToggle component. ([59095](https://github.com/WordPress/gutenberg/pull/59095)) - Remove old templates list code. ([59558](https://github.com/WordPress/gutenberg/pull/59558)) -- Replace Navigator isSmall prop WordPress/gutenberg#53560. ([59304](https://github.com/WordPress/gutenberg/pull/59304)) +- Replace Navigator isSmall prop. ([59304](https://github.com/WordPress/gutenberg/pull/59304)) - Theme JSON Tests: Refactor base styles to a static variable. ([58975](https://github.com/WordPress/gutenberg/pull/58975)) - Update: Simplify code and use capture events instead of pointer-events hack. ([59565](https://github.com/WordPress/gutenberg/pull/59565)) - l10n: Unify terminology to `screen size`. ([59456](https://github.com/WordPress/gutenberg/pull/59456)) @@ -320,7 +2179,9 @@ The following PRs were merged by first time contributors: The following contributors merged PRs in this release: -@afercia @ajlende @alanjacobmathew @andrewserong @annezazu @arthur791004 @bacoords @c4rl0sbr4v0 @carolinan @chad1008 @creativecoder @DAreRodz @dcalhoun @desrosj @draganescu @ellatrix @fluiddot @getdave @glendaviesnz @huzaifaalmesbah @inc2734 @jameskoster @jasmussen @jeryj @jorgefilipecosta @jsnajdr @juanfra @kevin940726 @madhusudhand @Mamaduka @matiasbenedetto @mattgrshaw @michalczaplinski @mikachan @mirka @ndiego @noisysocks @ntsekouras @oandregal @ockham @pbking @ramonjd @retrofox @samueljseay @SantosGuillamot @scruffian @shail-mehta @SiobhyB @sirreal @sunil25393 @t-hamano @talldan @tellthemachines @TeresaGobble @torounit @tyxla @WunderBart @youknowriad +@afercia @ajlende @alanjacobmathew @andrewserong @annezazu @arthur791004 @bacoords @c4rl0sbr4v0 @carolinan @chad1008 @creativecoder @DAreRodz @dcalhoun @desrosj @draganescu @ellatrix @fluiddot @getdave @glendaviesnz @huzaifaalmesbah @inc2734 @jameskoster @jasmussen @jeryj @jorgefilipecosta @jsnajdr @juanfra @kevin940726 @madhusudhand @Mamaduka @matiasbenedetto @mattgrshaw @michalczaplinski @mikachan @mirka @ndiego @noisysocks @ntsekouras @oandregal @ockham @pbking @peterwilsoncc @ramonjd @retrofox @samueljseay @SantosGuillamot @scruffian @shail-mehta @SiobhyB @sirreal @sunil25393 @t-hamano @talldan @tellthemachines @TeresaGobble @torounit @tyxla @WunderBart @youknowriad + + = 17.8.2 = diff --git a/docs/contributors/code/back-merging-to-wp-core.md b/docs/contributors/code/back-merging-to-wp-core.md index c01fd74382fbca..d6c283629e1938 100644 --- a/docs/contributors/code/back-merging-to-wp-core.md +++ b/docs/contributors/code/back-merging-to-wp-core.md @@ -31,7 +31,7 @@ There are however certain exceptions to that rule. PRs with the following criter - Does not contain changes to PHP code. - Has label `Backport from WordPress Core` - this code is already in WP Core and is being synchronized back to Gutenberg. -- Has label `Backport to WordPress Core` - this code has already been syncrhonized to WP Core. +- Has label `Backport to WordPress Core` - this code has already been synchronized to WP Core. ## Further Reading diff --git a/docs/contributors/code/coding-guidelines.md b/docs/contributors/code/coding-guidelines.md index 52fa92440b2653..06f86715a65a06 100644 --- a/docs/contributors/code/coding-guidelines.md +++ b/docs/contributors/code/coding-guidelines.md @@ -39,13 +39,13 @@ Components may be assigned with class names that indicate states (for example, a **Example:** -Consider again the Notices example. We may want to apply specific styling for dismissible notices. The [`classnames` package](https://www.npmjs.com/package/classnames) can be a helpful utility for conditionally applying modifier class names. +Consider again the Notices example. We may want to apply specific styling for dismissible notices. The [`clsx` package](https://www.npmjs.com/package/clsx) can be a helpful utility for conditionally applying modifier class names. ```jsx -import classnames from 'classnames'; +import clsx from 'clsx'; export default function Notice( { children, onRemove, isDismissible } ) { - const classes = classnames( 'components-notice', { + const classes = clsx( 'components-notice', { 'is-dismissible': isDismissible, } ); @@ -720,7 +720,7 @@ function getConfigurationValue( key ) { } ``` -When documenting a [function type](https://github.com/WordPress/gutenberg/blob/add/typescript-jsdoc-guidelines/docs/contributors/coding-guidelines.md#record-types), you must always include the `void` return value type, as otherwise the function is inferred to return a mixed ("any") value, not a void result. +When documenting a [function type](#generic-types), you must always include the `void` return value type, as otherwise the function is inferred to return a mixed ("any") value, not a void result. ```js /** diff --git a/docs/contributors/code/e2e/README.md b/docs/contributors/code/e2e/README.md index 9394e3cddd5501..3a123cc2988b7a 100644 --- a/docs/contributors/code/e2e/README.md +++ b/docs/contributors/code/e2e/README.md @@ -12,30 +12,31 @@ See the dedicated guide if you're working with the previous Jest + Puppeteer fra ```bash # Run all available tests. -npm run test:e2e:playwright +npm run test:e2e # Run in headed mode. -npm run test:e2e:playwright -- --headed +npm run test:e2e -- --headed # Run tests with specific browsers (`chromium`, `firefox`, or `webkit`). -npm run test:e2e:playwright -- --project=webkit --project=firefox +npm run test:e2e -- --project=webkit --project=firefox # Run a single test file. -npm run test:e2e:playwright -- # E.g., npm run test:e2e:playwright -- site-editor/title.spec.js +npm run test:e2e -- # E.g., npm run test:e2e -- site-editor/title.spec.js # Debugging. -npm run test:e2e:playwright -- --debug +npm run test:e2e -- --debug ``` If you're developing in Linux, it currently requires testing Webkit browsers in headed mode. If you don't want to or can't run it with the GUI (e.g. if you don't have a graphic interface), prepend the command with [`xvfb-run`](https://manpages.ubuntu.com/manpages/xenial/man1/xvfb-run.1.html) to run it in a virtual environment. ```bash # Run all available tests. -xvfb-run npm run test:e2e:playwright +xvfb-run npm run test:e2e # Only run webkit tests. -xvfb-run -- npm run test:e2e:playwright -- --project=webkit +xvfb-run -- npm run test:e2e -- --project=webkit ``` +If you're already editing in VS Code, you may find the [Playwright extension](https://playwright.dev/docs/getting-started-vscode) helpful for running, writing and debugging tests. ## Best practices diff --git a/docs/contributors/code/getting-started-with-code-contribution.md b/docs/contributors/code/getting-started-with-code-contribution.md index 30a78037ab75e3..921c8ad6ddc3e7 100644 --- a/docs/contributors/code/getting-started-with-code-contribution.md +++ b/docs/contributors/code/getting-started-with-code-contribution.md @@ -126,7 +126,7 @@ Port: {MYSQL_PORT_NUMBER} **Please note**: the MySQL port number will change each time `wp-env` restarts. If you find you can no longer access your database, simply repeat the steps above to find the new port number and restore your connection. -**Tip**: [Sequel Ace](https://sequel-ace.com/) is a useful GUI tool for accessing a MySQL database. Other tools are available and documented in this [article on accessing the WordPress database](https://wordpress.org/documentation/article/creating-database-for-wordpress/). +**Tip**: [Sequel Ace](https://sequel-ace.com/) is a useful GUI tool for accessing a MySQL database. Other tools are available and documented in this [article on accessing the WordPress database](https://developer.wordpress.org/advanced-administration/before-install/creating-database/). #### Troubleshooting diff --git a/docs/contributors/code/release.md b/docs/contributors/code/release.md index 05194ecd834170..4c8950eb5e7cd6 100644 --- a/docs/contributors/code/release.md +++ b/docs/contributors/code/release.md @@ -223,7 +223,7 @@ Once approved, the new Gutenberg version will be available to WordPress users al The final step is to write a release post on [make.wordpress.org/core](https://make.wordpress.org/core/). You can find some tips on that below. -#### Troubleshooting the release +### Troubleshooting the release > The plugin was published to the WordPress.org plugin directory but the workflow failed. diff --git a/docs/contributors/code/testing-overview.md b/docs/contributors/code/testing-overview.md index 520c95bc600223..6afa5aed865b7d 100644 --- a/docs/contributors/code/testing-overview.md +++ b/docs/contributors/code/testing-overview.md @@ -327,10 +327,7 @@ However, if the change was intentional, follow these steps to update the snapsho npm run test:unit -- --updateSnapshot --testPathPattern path/to/tests # Update snapshot for e2e tests -npm run test:e2e -- --updateSnapshot --testPathPattern path/to/e2e-tests - -# Update snapshot for Playwright -npm run test:e2e:playwright -- --update-snapshots path/to/spec +npm run test:e2e -- --update-snapshots path/to/spec ``` 1. Review the diff and ensure the changes are expected and intentional. diff --git a/docs/contributors/folder-structure.md b/docs/contributors/folder-structure.md index 98eccf1b2029ba..cbad182a58f447 100644 --- a/docs/contributors/folder-structure.md +++ b/docs/contributors/folder-structure.md @@ -75,9 +75,19 @@ The following snippet explains how the Gutenberg repository is structured omitti ├── docs/*.md │ Set of documentation pages composing the [Block editor handbook](https://developer.wordpress.org/block-editor/). │ + ├── platform-docs + │ Documentation website targetted to non WordPress developpers + │ using Gutenberg in their own applications. + │ Deployed on [https://wordpress.org/gutenberg-framework/](https://wordpress.org/gutenberg-framework/). + │ + │ ├── lib │ PHP Source code of the Gutenberg plugin. │ + ├── lib/compact/wordpress-x.x + │ PHP code that was include in WordPress ont the WordPrexx X.X version. + │ It is kept to ensure plugin compatibility with older WordPress versions. + │ ├── packages │ Source code of the WordPress packages. │ Packages can be: @@ -107,10 +117,6 @@ The following snippet explains how the Gutenberg repository is structured omitti ├── packages/{packageName}/src/**/{ComponentName}/stories/*.js │ Component Stories to load on the Gutenberg storybook. │ - ├── packages/e2e-tests - │ End-2-end tests of the Gutenberg plugin. - │ Distributed as a package for potential reuse in Core and other plugins. - │ ├── phpunit │ Unit tests for the PHP code of the Gutenberg plugin. │ @@ -123,11 +129,17 @@ The following snippet explains how the Gutenberg repository is structured omitti ├── test/native │ Configuration for the Gutenberg Mobile unit tests. │ - └── test/unit + ├── test/unit │ Configuration for the Packages unit tests. │ - └── tools/eslint + ├── test/e2e + │ End-2-end tests of the Gutenberg plugin. + │ + ├── test/performance + │ Performance metrics. Results are tracked on the [Gutenberg performance dashboard](https://codevitals.run/project/gutenberg). + │ + ├── tools/eslint │ Configuration files for the ESLint linter. │ - └── tools/webpack + ├── tools/webpack │ Configuration files for the webpack build. diff --git a/docs/contributors/versions-in-wordpress.md b/docs/contributors/versions-in-wordpress.md index b287d574e56b45..f95dbf479f3cb1 100644 --- a/docs/contributors/versions-in-wordpress.md +++ b/docs/contributors/versions-in-wordpress.md @@ -11,38 +11,125 @@ If anything looks incorrect here, please bring it up in #core-editor in [WordPre | 16.2-16.7 | 6.4.2 | | 16.2-16.7 | 6.4.1 | | 16.2-16.7 | 6.4 | +| 15.2-16.1 | 6.3.2 | | 15.2-16.1 | 6.3.1 | | 15.2-16.1 | 6.3 | +| 14.2-15.1 | 6.2.3 | +| 14.2-15.1 | 6.2.2 | +| 14.2-15.1 | 6.2.1 | | 14.2-15.1 | 6.2 | +| 13.1-14.1 | 6.1.4 | +| 13.1-14.1 | 6.1.3 | +| 13.1-14.1 | 6.1.2 | | 13.1-14.1 | 6.1.1 | | 13.1-14.1 | 6.1 | +| 12.0-13.0 | 6.0.6 | +| 12.0-13.0 | 6.0.5 | +| 12.0-13.0 | 6.0.4 | | 12.0-13.0 | 6.0.3 | | 12.0-13.0 | 6.0.2 | | 12.0-13.0 | 6.0.1 | | 12.0-13.0 | 6.0 | +| 10.8-11.9 | 5.9.8 | +| 10.8-11.9 | 5.9.7 | +| 10.8-11.9 | 5.9.6 | +| 10.8-11.9 | 5.9.5 | +| 10.8-11.9 | 5.9.4 | | 10.8-11.9 | 5.9.3 | | 10.8-11.9 | 5.9.2 | | 10.8-11.9 | 5.9.1 | | 10.8-11.9 | 5.9 | +| 10.0-10.7 | 5.8.8 | +| 10.0-10.7 | 5.8.7 | +| 10.0-10.7 | 5.8.6 | +| 10.0-10.7 | 5.8.5 | +| 10.0-10.7 | 5.8.4 | | 10.0-10.7 | 5.8.3 | | 10.0-10.7 | 5.8.2 | | 10.0-10.7 | 5.8.1 | | 10.0-10.7 | 5.8 | +| 9.3-9.9 | 5.7.10 | +| 9.3-9.9 | 5.7.9 | +| 9.3-9.9 | 5.7.8 | +| 9.3-9.9 | 5.7.7 | +| 9.3-9.9 | 5.7.6 | +| 9.3-9.9 | 5.7.5 | +| 9.3-9.9 | 5.7.4 | +| 9.3-9.9 | 5.7.3 | +| 9.3-9.9 | 5.7.2 | | 9.3-9.9 | 5.7.1 | | 9.3-9.9 | 5.7 | +| 8.6-9.2 | 5.6.12 | +| 8.6-9.2 | 5.6.11 | +| 8.6-9.2 | 5.6.10 | +| 8.6-9.2 | 5.6.9 | +| 8.6-9.2 | 5.6.8 | +| 8.6-9.2 | 5.6.7 | +| 8.6-9.2 | 5.6.6 | +| 8.6-9.2 | 5.6.5 | +| 8.6-9.2 | 5.6.4 | +| 8.6-9.2 | 5.6.3 | +| 8.6-9.2 | 5.6.2 | | 8.6-9.2 | 5.6.1 | | 8.6-9.2 | 5.6 | +| 7.6-8.5 | 5.5.13 | +| 7.6-8.5 | 5.5.12 | +| 7.6-8.5 | 5.5.11 | +| 7.6-8.5 | 5.5.10 | +| 7.6-8.5 | 5.5.9 | +| 7.6-8.5 | 5.5.8 | +| 7.6-8.5 | 5.5.7 | +| 7.6-8.5 | 5.5.6 | +| 7.6-8.5 | 5.5.5 | +| 7.6-8.5 | 5.5.4 | | 7.6-8.5 | 5.5.3 | | 7.6-8.5 | 5.5.2 | | 7.6-8.5 | 5.5.1 | | 7.6-8.5 | 5.5 | +| 6.6-7.5 | 5.4.14 | +| 6.6-7.5 | 5.4.13 | +| 6.6-7.5 | 5.4.12 | +| 6.6-7.5 | 5.4.11 | +| 6.6-7.5 | 5.4.10 | +| 6.6-7.5 | 5.4.9 | +| 6.6-7.5 | 5.4.8 | +| 6.6-7.5 | 5.4.7 | +| 6.6-7.5 | 5.4.6 | +| 6.6-7.5 | 5.4.5 | +| 6.6-7.5 | 5.4.4 | +| 6.6-7.5 | 5.4.3 | | 6.6-7.5 | 5.4.2 | -| 6.6-7.5 | 5.4.0 | +| 6.6-7.5 | 5.4.1 | +| 6.6-7.5 | 5.4 | +| 5.5-6.5 | 5.3.16 | +| 5.5-6.5 | 5.3.15 | +| 5.5-6.5 | 5.3.14 | +| 5.5-6.5 | 5.3.13 | +| 5.5-6.5 | 5.3.12 | +| 5.5-6.5 | 5.3.11 | +| 5.5-6.5 | 5.3.10 | +| 5.5-6.5 | 5.3.9 | +| 5.5-6.5 | 5.3.8 | +| 5.5-6.5 | 5.3.7 | +| 5.5-6.5 | 5.3.6 | +| 5.5-6.5 | 5.3.5 | | 5.5-6.5 | 5.3.4 | | 5.5-6.5 | 5.3.3 | | 5.5-6.5 | 5.3.2 | | 5.5-6.5 | 5.3.1 | -| 5.5-6.5 | 5.3.0 | +| 5.5-6.5 | 5.3 | +| 4.9-5.4 | 5.2.19 | +| 4.9-5.4 | 5.2.18 | +| 4.9-5.4 | 5.2.17 | +| 4.9-5.4 | 5.2.16 | +| 4.9-5.4 | 5.2.15 | +| 4.9-5.4 | 5.2.14 | +| 4.9-5.4 | 5.2.13 | +| 4.9-5.4 | 5.2.12 | +| 4.9-5.4 | 5.2.11 | +| 4.9-5.4 | 5.2.10 | +| 4.9-5.4 | 5.2.9 | +| 4.9-5.4 | 5.2.8 | | 4.9-5.4 | 5.2.7 | | 4.9-5.4 | 5.2.6 | | 4.9-5.4 | 5.2.5 | @@ -50,14 +137,35 @@ If anything looks incorrect here, please bring it up in #core-editor in [WordPre | 4.9-5.4 | 5.2.3 | | 4.9-5.4 | 5.2.2 | | 4.9-5.4 | 5.2.1 | -| 4.9-5.4 | 5.2.0 | +| 4.9-5.4 | 5.2 | +| 4.8 | 5.1.17 | +| 4.8 | 5.1.16 | +| 4.8 | 5.1.15 | +| 4.8 | 5.1.14 | +| 4.8 | 5.1.13 | +| 4.8 | 5.1.12 | +| 4.8 | 5.1.11 | +| 4.8 | 5.1.10 | +| 4.8 | 5.1.9 | +| 4.8 | 5.1.8 | +| 4.8 | 5.1.7 | | 4.8 | 5.1.6 | | 4.8 | 5.1.5 | | 4.8 | 5.1.4 | | 4.8 | 5.1.3 | | 4.8 | 5.1.2 | | 4.8 | 5.1.1 | -| 4.8 | 5.1.0 | +| 4.8 | 5.1 | +| 4.7.1 | 5.0.20 | +| 4.7.1 | 5.0.19 | +| 4.7.1 | 5.0.18 | +| 4.7.1 | 5.0.17 | +| 4.7.1 | 5.0.16 | +| 4.7.1 | 5.0.15 | +| 4.7.1 | 5.0.14 | +| 4.7.1 | 5.0.13 | +| 4.7.1 | 5.0.12 | +| 4.7.1 | 5.0.11 | | 4.7.1 | 5.0.10 | | 4.7.1 | 5.0.9 | | 4.7.1 | 5.0.8 | @@ -68,4 +176,4 @@ If anything looks incorrect here, please bring it up in #core-editor in [WordPre | 4.7.1 | 5.0.3 | | 4.7.0 | 5.0.2 | | 4.6.1 | 5.0.1 | -| 4.6.1 | 5.0.0 | +| 4.6.1 | 5.0 | diff --git a/docs/explanations/architecture/styles.md b/docs/explanations/architecture/styles.md index 94a8e91f94edbe..952c6c49caad23 100644 --- a/docs/explanations/architecture/styles.md +++ b/docs/explanations/architecture/styles.md @@ -78,7 +78,7 @@ For example: The paragraph declares support for font size in its `block.json`. This means the block will show a UI control for users to tweak its font size, unless it's disabled by the theme (learn more about how themes can disable UI controls in [the `theme.json` reference](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/)). The system will also take care of setting up the UI control data (the font size of the block if it has one already assigned, the list of available font sizes to show), and will serialize the block data into HTML markup upon user changes (attach classes and inline styles appropriately). -By using the block supports mechanism via `block.json`, the block author is able to create the same experience as before just by writing a couple of lines. Check the tutorials for adding block supports to [static](/docs/how-to-guides/block-tutorial/block-supports-in-static-blocks.md) and [dynamic](/docs/how-to-guides/block-tutorial/block-supports-in-dynamic-blocks.md) blocks. +By using the block supports mechanism via `block.json`, the block author is able to create the same experience as before just by writing a couple of lines. Check the [block supports api](/docs/reference-guides/block-api/block-supports.md) for adding block supports to static or dynamic blocks. Besides the benefit of having to do less work to achieve the same results, there's a few other advantages: diff --git a/docs/getting-started/devenv/get-started-with-wp-scripts.md b/docs/getting-started/devenv/get-started-with-wp-scripts.md index b6271620514df4..16f1bbc6015b5b 100644 --- a/docs/getting-started/devenv/get-started-with-wp-scripts.md +++ b/docs/getting-started/devenv/get-started-with-wp-scripts.md @@ -4,7 +4,7 @@ The [`@wordpress/scripts`](https://developer.wordpress.org/block-editor/referenc A JavaScript build step refers to the process of transforming, bundling, and optimizing JavaScript source code and related assets into a format suitable for production environments. These build steps often take modern JavaScript (ESNext and JSX) and convert it to a version compatible with most browsers. They can also bundle multiple files into one, minify the code to reduce file size and perform various other tasks to optimize the code. -You will typically be working with ESNext and JSX when building for the Block Editor, and most examples in the Block Editor Handbook are written in these syntaxes. Learning how to set up a build step is essential. However, configuring the necessary tools like [webpack](https://webpack.js.org/), [Babel](https://babeljs.io/), and [ESLint](https://eslint.org/) can become complex. This is where `wp-scripts` comes in. +You will typically be working with ESNext and JSX when building for the Block Editor, and all examples in the Block Editor Handbook are written in these syntaxes. Learning how to set up a build step is essential. However, configuring the necessary tools like [webpack](https://webpack.js.org/), [Babel](https://babeljs.io/), and [ESLint](https://eslint.org/) can become complex. This is where `wp-scripts` comes in. Here are a few things that `wp-scripts` can do: diff --git a/docs/getting-started/faq.md b/docs/getting-started/faq.md index 95ddf3b0c616ee..72d7bfd760d657 100644 --- a/docs/getting-started/faq.md +++ b/docs/getting-started/faq.md @@ -68,219 +68,6 @@ Yes. There are a lot! There is a help modal showing all available keyboard short You can see the whole list going to the top right corner menu of the new editor and clicking on “Keyboard Shortcuts” (or by using the keyboard shortcut Shift+Alt+H on Linux/Windows and H on macOS). -This is the canonical list of keyboard shortcuts: - -#### Editor shortcuts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Shortcut descriptionLinux/Windows shortcutmacOS shortcut
Display keyboard shortcuts.Shift+Alt+HH
Save your changes.Ctrl+SS
Undo your last changes.Ctrl+ZZ
Redo your last undo.Ctrl+Shift+ZZ
Show or hide the Settings sidebar.Ctrl+Shift+,,
Open the list view menu.Shift+Alt+OO
Navigate to the next part of the editor.Ctrl+``
Navigate to the previous part of the editor.Ctrl+Shift+``
Navigate to the next part of the editor (alternative).Ctrl+Alt+NN
Navigate to the previous part of the editor (alternative).Ctrl+Alt+PP
Navigate to the nearest toolbar.Alt+F10F10
Switch between visual editor and code editor.Ctrl+Shift+Alt+MM
Toggle fullscreen mode.Ctrl+Alt+Shift+FF
- -#### Selection shortcuts - - - - - - - - - - - - - - - - - - - - - - - - - - -
Shortcut descriptionLinux/Windows shortcutmacOS shortcut
Select all text when typing. Press again to select all blocks.Ctrl+AA
Clear selection.EscEsc
Select text across multiple blocks.Shift+Arrow (⇦, ⇧, ⇨, ⇩)Shift+Arrow (⇦, ⇧, ⇨, ⇩)
- -#### Block shortcuts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Shortcut descriptionLinux/Windows shortcutmacOS shortcut
Duplicate the selected block(s).Ctrl+Shift+DD
Remove the selected block(s).Shift+Alt+ZZ
Insert a new block before the selected block(s).Ctrl+Alt+TT
Insert a new block after the selected block(s).Ctrl+Alt+YY
Move the selected block(s) up.Ctrl+Alt+Shift+TT
Move the selected block(s) down.Ctrl+Alt+Shift+YY
Change the block type after adding a new paragraph.//
Remove multiple selected blocks.delbackspacedelbackspace
- -#### Text formatting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Shortcut descriptionLinux/Windows shortcutmacOS shortcut
Make the selected text bold.Ctrl+BB
Make the selected text italic.Ctrl+II
Underline the selected text.Ctrl+UU
Convert the selected text into a link.Ctrl+KK
Remove a link.Ctrl+Shift+KK
Add a strikethrough to the selected text.Shift+Alt+DD
Display the selected text in a monospaced font.Shift+Alt+XX
- Here is a brief animation illustrating how to find and use the keyboard shortcuts: ![GIF showing how to access keyboard shortcuts](https://make.wordpress.org/core/files/2020/07/keyboard-shortcuts.gif) @@ -314,7 +101,7 @@ See the [Meta Box Tutorial](https://developer.wordpress.org/block-editor/how-to- ### How can plugins extend the Gutenberg UI? -The main extension point we want to emphasize is creating new blocks. Blocks are added to the block editor using plugins, see the [Create a Block Tutorial](https://developer.wordpress.org/block-editor/getting-stared/create-block/) to get started. +The main extension point we want to emphasize is creating new blocks. Blocks are added to the block editor using plugins, see the [Build your first block Tutorial](https://developer.wordpress.org/block-editor/getting-started/tutorial/) to get started. ### Are Custom Post Types still supported? diff --git a/docs/getting-started/fundamentals/block-in-the-editor.md b/docs/getting-started/fundamentals/block-in-the-editor.md index 85a6dfe506db3e..f7357def5ec2df 100644 --- a/docs/getting-started/fundamentals/block-in-the-editor.md +++ b/docs/getting-started/fundamentals/block-in-the-editor.md @@ -1,6 +1,6 @@ # The block in the Editor -The Block Editor is a React Single Page Application (SPA). Every block in the Editor is displayed through a React component defined in the `edit` property of the settings object used to [register the block](https://developer.wordpress.org/block-editor/getting-started/fundamentals/registration-of-a-block/#registration-of-the-block-with-javascript-client-side) on the client. +The Block Editor is a React Single Page Application (SPA). Every block in the Editor is displayed through a React component defined in the `edit` property of the settings object used to [register the block](https://developer.wordpress.org/block-editor/getting-started/fundamentals/registration-of-a-block/#registering-a-block-with-javascript-client-side) on the client. The `props` object received by the block's `Edit` React component includes: @@ -164,4 +164,4 @@ Block controls rendered in both the toolbar and sidebar will also be available w - [@wordpress/block-editor](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/) - [@wordpress/components](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-components/) - [`InspectorControls`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-controls/README.md) -- [`BlockControls`](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-editor/src/components/block-controls) \ No newline at end of file +- [`BlockControls`](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-editor/src/components/block-controls) diff --git a/docs/getting-started/fundamentals/registration-of-a-block.md b/docs/getting-started/fundamentals/registration-of-a-block.md index d8d547912c7484..5c80422f6f8574 100644 --- a/docs/getting-started/fundamentals/registration-of-a-block.md +++ b/docs/getting-started/fundamentals/registration-of-a-block.md @@ -33,7 +33,7 @@ register_block_type( ); ``` -Here is a more complete example, including the `init` hook. +Here is a more complete example, including the `init` hook. ```php function minimal_block_ca6eda___register_block() { @@ -46,7 +46,7 @@ _See the [full block example](https://github.com/WordPress/block-development-exa ## Registering a block with JavaScript (client-side) -When the block has already been registered on the server, you only need to register the client-side settings in JavaScipt using the [`registerBlockType`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blocks/#registerblocktype) method from the `@wordpress/blocks` package. You just need to make sure you use the same block name as defined in the block's `block.json` file. Here's an example: +When the block has already been registered on the server, you only need to register the client-side settings in JavaScript using the [`registerBlockType`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-blocks/#registerblocktype) method from the `@wordpress/blocks` package. You just need to make sure you use the same block name as defined in the block's `block.json` file. Here's an example: ```js import { registerBlockType } from '@wordpress/blocks'; @@ -71,7 +71,7 @@ The function accepts two parameters: The `settings` object passed as the second parameter includes many properties, but these are the two most important ones: - **`edit`:** The React component that gets used in the Editor for our block. -- **`save`:** The function that returns the static HTML markup that gets saved to the database. +- **`save`:** The function that returns the static HTML markup that gets saved to the database. The `registerBlockType()` function returns the registered block type (`WPBlock`) on success or `undefined` on failure. Here's an example: diff --git a/docs/getting-started/fundamentals/static-dynamic-rendering.md b/docs/getting-started/fundamentals/static-dynamic-rendering.md index c7a692a8ecb654..8d199f66cccd2a 100644 --- a/docs/getting-started/fundamentals/static-dynamic-rendering.md +++ b/docs/getting-started/fundamentals/static-dynamic-rendering.md @@ -6,11 +6,11 @@ A block's front-end markup can either be dynamically generated server-side upon The post Static vs. dynamic blocks: What’s the difference? provides a great introduction to this topic. -## Static rendering +## Static rendering Blocks with "static rendering" produce front-end output that is fixed and stored in the database upon saving. These blocks rely solely on their `save` function to define their [HTML markup](https://developer.wordpress.org/block-editor/getting-started/fundamentals/markup-representation-block/), which remains unchanged unless manually edited in the Block Editor. -If a block does not use a dynamic rendering method—meaning it doesn't generate content on the fly via PHP when the page loads—it's considered a "static block." +If a block does not use a dynamic rendering method—meaning it doesn't generate content on the fly via PHP when the page loads—it's considered a "static block." The diagram below illustrates how static block content is saved in the database and then retrieved and rendered as HTML on the front end. @@ -24,7 +24,7 @@ Blocks in WordPress are encapsulated within special comment tags that serve as u
View an example of static rendering in the Preformatted block
-The following save function for the Preformatted core block looks like this: +The following save function for the Preformatted core block looks like this: ```js import { RichText, useBlockProps } from '@wordpress/block-editor'; @@ -160,7 +160,7 @@ On the front end, the `render_callback` is used to dynamically render the markup ### HTML representation of dynamic blocks in the database (`save`) -For dynamic blocks, the `save` callback function can return just `null`, which tells the editor to save only the block delimiter comment (along with any existing [block attributes](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/)) to the database. These attributes are then passed into the server-side rendering callback, which will determine how to display the block on the front end of your site. +For dynamic blocks, the `save` callback function can return just `null`, which tells the editor to save only the block delimiter comment (along with any existing [block attributes](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/)) to the database. These attributes are then passed into the server-side rendering callback, which will determine how to display the block on the front end of your site. When `save` is `null`, the Block Editor will skip the [block markup validation process](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#validation), avoiding issues with frequently changing markup. @@ -176,4 +176,4 @@ If you are using [InnerBlocks](https://developer.wordpress.org/block-editor/how- ## Additional resources - [Static vs. dynamic blocks: What’s the difference?](https://developer.wordpress.org/news/2023/02/27/static-vs-dynamic-blocks-whats-the-difference/) | Developer Blog -- [Block deprecation – a tutorial](https://developer.wordpress.org/news/2023/03/10/block-deprecation-a-tutorial/) | Developer Blog \ No newline at end of file +- [Block deprecation – a tutorial](https://developer.wordpress.org/news/2023/03/10/block-deprecation-a-tutorial/) | Developer Blog diff --git a/docs/getting-started/glossary.md b/docs/getting-started/glossary.md index ca509f6a321dba..3c7ba7f722c445 100644 --- a/docs/getting-started/glossary.md +++ b/docs/getting-started/glossary.md @@ -70,7 +70,7 @@ This refers to a collection of features that ultimately allows users to edit the The CSS styles generated by WordPress and enqueued as an embedded stylesheet in the front end of the site. The stylesheet ID is `global-styles-inline-css`. The contents of this stylesheet come from the default `theme.json` of WordPress, the theme's `theme.json`, and the styles provided by the user via the global styles sidebar in the site editor. -See [theme.json reference docs](/docs/reference-guides/theme-json-reference.md), the [how to guide](/docs/how-to-guides/themes/global-settings-and-styles.md), and an introduction to [styles in the block editor](/docs/explanations/architecture/styles.md). +See [theme.json reference docs](/docs/reference-guides/theme-json-reference/README.md), the [how to guide](/docs/how-to-guides/themes/global-settings-and-styles.md), and an introduction to [styles in the block editor](/docs/explanations/architecture/styles.md). Compare to block styles. diff --git a/docs/how-to-guides/curating-the-editor-experience/disable-editor-functionality.md b/docs/how-to-guides/curating-the-editor-experience/disable-editor-functionality.md index 23803888f95221..2491d12ce9482f 100644 --- a/docs/how-to-guides/curating-the-editor-experience/disable-editor-functionality.md +++ b/docs/how-to-guides/curating-the-editor-experience/disable-editor-functionality.md @@ -1,14 +1,14 @@ # Disable Editor functionality -This page is dedicated to the many ways you can disable specific functionality in the Post Editor and Site Editor that are not covered in other areas of the curation documentation. +This page is dedicated to the many ways you can disable specific functionality in the Post Editor and Site Editor that are not covered in other areas of the curation documentation. ## Restrict block options -There might be times when you don’t want access to a block at all to be available for users. To control what’s available in the inserter, you can take two approaches: [an allow list](/docs/reference-guides/filters/block-filters.md#using-an-allow-list) that disables all blocks except those on the list or a [deny list that unregisters specific blocks](/docs/reference-guides/filters/block-filters.md#using-a-deny-list). +There might be times when you don’t want access to a block at all to be available for users. To control what’s available in the inserter, you can take two approaches: [an allow list](/docs/reference-guides/filters/block-filters.md#using-an-allow-list) that disables all blocks except those on the list or a [deny list that unregisters specific blocks](/docs/reference-guides/filters/block-filters.md#using-a-deny-list). ## Disable the Pattern Directory -To fully remove patterns bundled with WordPress core from being accessed in the Inserter, the following can be added to your `functions.php` file: +To fully remove patterns bundled with WordPress core from being accessed in the Inserter, the following can be added to your `functions.php` file: ```php function example_theme_support() { @@ -21,7 +21,7 @@ add_action( 'after_setup_theme', 'example_theme_support' ); Some Core blocks are actually [block variations](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/). A great example is the Row and Stack blocks, which are actually variations of the Group block. If you want to disable these "blocks", you actually need to disable the respective variations. -Block variations are registered using JavaScript and need to be disabled with JavaScript. The code below will disable the Row variation. +Block variations are registered using JavaScript and need to be disabled with JavaScript. The code below will disable the Row variation. ```js wp.domReady( () => { @@ -48,7 +48,7 @@ add_action( 'enqueue_block_editor_assets', 'example_disable_variations_script' ) There are a few Core blocks that include their own [block styles](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/). An example is the Image block, which includes a block style for rounded images called "Rounded". You many not want your users to round images, or you might prefer to use the border-radius control instead of the block style. Either way, it's easy to disable any unwanted block styles. -Unlike block variations, you can register styles in either JavaScript or PHP. If a style was registered in JavaScript, it must be disabled with JavaScript. If registered using PHP, the style can be disabled with either. All Core block styles are registed in JavaScript. +Unlike block variations, you can register styles in either JavaScript or PHP. If a style was registered in JavaScript, it must be disabled with JavaScript. If registered using PHP, the style can be disabled with either. All Core block styles are registered in JavaScript. So, you would use the following code to disable the "Rounded" block style for the Image block. @@ -58,7 +58,7 @@ wp.domReady( () => { }); ``` -This JavaScript should be enqueued much like the block variation example above. Refer to the [block styles](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/) documentation for how to register and unregister styles using PHP. +This JavaScript should be enqueued much like the block variation example above. Refer to the [block styles](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/) documentation for how to register and unregister styles using PHP. ## Disable access to the Template Editor @@ -71,7 +71,7 @@ function example_theme_support() { add_action( 'after_setup_theme', 'example_theme_support' ); ``` -This prevents both the ability to create new block templates or edit them from within the Post Editor. +This prevents both the ability to create new block templates or edit them from within the Post Editor. ## Disable access to the Code Editor @@ -86,4 +86,4 @@ function example_restrict_code_editor_access( $settings, $context ) { add_filter( 'block_editor_settings_all', 'example_restrict_code_editor_access', 10, 2 ); ``` -This code prevents all users from accessing the Code Editor. You could also add [capability](https://wordpress.org/documentation/article/roles-and-capabilities/) checks to disable access for specific users. \ No newline at end of file +This code prevents all users from accessing the Code Editor. You could also add [capability](https://wordpress.org/documentation/article/roles-and-capabilities/) checks to disable access for specific users. diff --git a/docs/how-to-guides/curating-the-editor-experience/filters-and-hooks.md b/docs/how-to-guides/curating-the-editor-experience/filters-and-hooks.md index fbc4de12586396..b28fdf7d9e5db1 100644 --- a/docs/how-to-guides/curating-the-editor-experience/filters-and-hooks.md +++ b/docs/how-to-guides/curating-the-editor-experience/filters-and-hooks.md @@ -2,6 +2,39 @@ The Editor provides numerous filters and hooks that allow you to modify the editing experience. Here are a few. +## Editor settings + +One of the most common ways to modify the Editor is through the [`block_editor_settings_all`](https://developer.wordpress.org/reference/hooks/block_editor_settings_all/) PHP filter, which is applied before settings are sent to the initialized Editor. + +The `block_editor_settings_all` hook passes two parameters to the callback function: + +- `$settings` – An array of [configurable settings](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/#editor-settings) for the Editor. +- `$context` – An instance of [`WP_Block_Editor_Context`](https://developer.wordpress.org/reference/classes/wp_block_editor_context/), an object that contains information about the current Editor. + +The following example disables the Code Editor for users who cannot activate plugins (Administrators). Add this to a plugin or your theme's `functions.php` file to test it. + +```php +add_filter( 'block_editor_settings_all', 'example_restrict_code_editor' ); + +function example_restrict_code_editor( $settings ) { + $can_active_plugins = current_user_can( 'activate_plugins' ); + + // Disable the Code Editor for users that cannot activate plugins (Administrators). + if ( ! $can_active_plugins ) { + $settings[ 'codeEditingEnabled' ] = false; + } + + return $settings; +} +``` + +For more examples, check out the [Editor Hooks](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/) documentation that includes the following use cases: + +- [Set a default image size](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/#set-a-default-image-size) +- [Disable Openverse](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/#disable-openverse) +- [Disable the Font Library](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/#disable-the-font-library) +- [Disable block inspector tabs](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/#disable-block-inspector-tabs) + ## Server-side theme.json filters The theme.json file is a great way to control interface options, but it only allows for global or block-level modifications, which can be limiting in some scenarios. @@ -103,6 +136,43 @@ addFilter( ); ``` +## Block Filters + +Beyond curating the Editor itself, there are many ways that you can modify individual blocks. Perhaps you want to disable particular block supports like background color or define which settings should be displayed by default on specific blocks. + +One of the most commonly used filters is [`block_type_metadata`](https://developer.wordpress.org/reference/hooks/block_type_metadata/). It allows you to filter the raw metadata loaded from a block's `block.json` file when a block type is registered on the server with PHP. + +The filter takes one parameter: + +- `$metadata` (`array`) – metadata loaded from `block.json` for registering a block type. + +The `$metadata` array contains everything you might want to know about a block, from its description and [attributes](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/) to block [supports](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/). + +In the following example, background color and gradient support are disabled for Heading blocks. + +```php +function example_disable_heading_background_color_and_gradients( $metadata ) { + + // Only apply the filter to Heading blocks. + if ( ! isset( $metadata['name'] ) || 'core/heading' !== $metadata['name'] ) { + return $metadata; + } + + // Check if 'supports' key exists. + if ( isset( $metadata['supports'] ) && isset( $metadata['supports']['color'] ) ) { + + // Remove Background color and Gradients support. + $metadata['supports']['color']['background'] = false; + $metadata['supports']['color']['gradients'] = false; + } + + return $metadata; +} +add_filter( 'block_type_metadata', 'example_disable_heading_background_color_and_gradients' ); +``` + +You can learn more about the available block filters in the [Block Filters](https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/) documentation. + ## Additional resources - [How to modify theme.json data using server-side filters](https://developer.wordpress.org/news/2023/07/05/how-to-modify-theme-json-data-using-server-side-filters/) (WordPress Developer Blog) diff --git a/docs/how-to-guides/curating-the-editor-experience/patterns.md b/docs/how-to-guides/curating-the-editor-experience/patterns.md index fbe5143298cdba..abb7d131041dfb 100644 --- a/docs/how-to-guides/curating-the-editor-experience/patterns.md +++ b/docs/how-to-guides/curating-the-editor-experience/patterns.md @@ -79,12 +79,11 @@ With WordPress 6.0 themes can register patterns from [Pattern Directory](https:/ ```json { - "version": 2, "patterns": [ "short-text-surrounded-by-round-images", "partner-logos" ] } ``` -Note that this field requires using [version 2 of theme.json](/docs/reference-guides/theme-json-reference/theme-json-living.md). The content creator will then find the respective Pattern in the inserter “Patterns” tab in the categories that match the categories from the Pattern Directory. +The content creator will then find the respective Pattern in the inserter “Patterns” tab in the categories that match the categories from the Pattern Directory. ## Additional resources diff --git a/docs/how-to-guides/curating-the-editor-experience/theme-json.md b/docs/how-to-guides/curating-the-editor-experience/theme-json.md index d373e0e81e345a..d14f29e0a76f3e 100644 --- a/docs/how-to-guides/curating-the-editor-experience/theme-json.md +++ b/docs/how-to-guides/curating-the-editor-experience/theme-json.md @@ -10,7 +10,7 @@ Since theme.json acts as a configuration tool, there are numerous ways to define ```json { -"version": 2, + "version": 3, "settings": { "color": { "customDuotone": true, @@ -25,7 +25,7 @@ Since theme.json acts as a configuration tool, there are numerous ways to define ```json { - "version": 2, + "version": 3, "settings": { "color": { "duotone": [ @@ -54,8 +54,7 @@ Since theme.json acts as a configuration tool, there are numerous ways to define ```json { - "schema": "https://schemas.wp.org/trunk/theme.json", - "version": 2, + "version": 3, "settings": { "color": { "custom": true, @@ -89,8 +88,7 @@ Since theme.json acts as a configuration tool, there are numerous ways to define ```json { - "schema": "https://schemas.wp.org/trunk/theme.json", - "version": 2, + "version": 3, "settings": { "color": { "custom": true, @@ -132,8 +130,7 @@ Continuing the examples with duotone, this means you could allow full access to ```json { - "schema": "https://schemas.wp.org/trunk/theme.json", - "version": 2, + "version": 3, "settings": { "color": { "custom": true, @@ -178,8 +175,7 @@ When using theme.json in a block or classic theme, these settings will stop the ```json { - "$schema": "http://schemas.wp.org/trunk/theme.json", - "version": 2, + "version": 3, "settings": { "layout": { "contentSize": "750px" diff --git a/docs/how-to-guides/data-basics/3-building-an-edit-form.md b/docs/how-to-guides/data-basics/3-building-an-edit-form.md index 68c87381701515..34136ff4080800 100644 --- a/docs/how-to-guides/data-basics/3-building-an-edit-form.md +++ b/docs/how-to-guides/data-basics/3-building-an-edit-form.md @@ -120,7 +120,7 @@ Great! We now have a basic user interface to work with. We want the `EditPageForm` to display the title of the currently edited page. You may have noticed that it doesn't receive a `page` prop, only `pageId`. That's okay. Gutenberg Data allows us to easily access entity records from any component. -In this case, we need to use the [`getEntityRecord`](/docs/reference-guides/data/data-core/#getentityrecord) selector. The list of records is already available thanks to the `getEntityRecords` call in `MyFirstApp`, so there won't even be any additional HTTP requests involved – we'll get the cached record right away. +In this case, we need to use the [`getEntityRecord`](/docs/reference-guides/data/data-core.md#getentityrecord) selector. The list of records is already available thanks to the `getEntityRecords` call in `MyFirstApp`, so there won't even be any additional HTTP requests involved – we'll get the cached record right away. Here's how you can try it in your browser's dev tools: diff --git a/docs/how-to-guides/format-api.md b/docs/how-to-guides/format-api.md index fe989575f8b00e..188bc1725c3633 100644 --- a/docs/how-to-guides/format-api.md +++ b/docs/how-to-guides/format-api.md @@ -10,7 +10,7 @@ In WordPress lingo, a _format_ is a [HTML tag with text-level semantics](https:/ ## Before you start -This guide assumes you are already familiar with WordPress plugins and loading JavaScript with them, see the [Plugin Handbook](https://developer.wordpress.org/plugins/) or [JavaScript Tutorial](/docs/how-to-guides/javascript/README.md) to brush up. +This guide assumes you are already familiar with WordPress plugins and loading JavaScript with them, see the [Plugin Handbook](https://developer.wordpress.org/plugins/) or [JavaScript Tutorial](/docs/getting-started/fundamentals/javascript-in-the-block-editor.md) to brush up. You will need: diff --git a/docs/how-to-guides/metabox.md b/docs/how-to-guides/metabox.md index 9db89f51c748d8..d16666a060c3c8 100644 --- a/docs/how-to-guides/metabox.md +++ b/docs/how-to-guides/metabox.md @@ -16,9 +16,9 @@ This guide shows how to create a block that prompts a user for a single value, a ## Before you start -This guide assumes you are already familiar with WordPress plugins, post meta, and basic JavaScript. Review the [Getting started with JavaScript tutorial](/docs/how-to-guides/javascript/README.md) for an introduction. +This guide assumes you are already familiar with WordPress plugins, post meta, and basic JavaScript. Review the [Getting started with JavaScript tutorial](/docs/getting-started/fundamentals/javascript-in-the-block-editor.md) for an introduction. -The guide will walk through creating a basic block, but recommended to go through the [Create Block tutorial](/docs/getting-started/devenv/get-started-with-create-block.md) for a deeper understanding of creating custom blocks. +The guide will walk through creating a basic block, but recommended to go through the [Create Block tutorial](/docs/getting-started/tutorial.md) for a deeper understanding of creating custom blocks. You will need: @@ -107,8 +107,7 @@ registerBlockType( 'myguten/meta-block', { } ); ``` -Confirm this works by creating a post and add the Meta Block. You will see your field that you can type a value in. When you save the post, either as a draft or published, the post meta value will be saved too. You can verify by -saving and reloading your draft, the form will still be filled in on reload. +Confirm this works by creating a post and add the Meta Block. You will see your field that you can type a value in. When you save the post, either as a draft or published, the post meta value will be saved too. You can verify by saving and reloading your draft, the form will still be filled in on reload. You could also confirm the data is saved by checking the database table `wp_postmeta` and confirm the new post id contains the new field data. @@ -259,3 +258,7 @@ Most PHP meta boxes should continue to work in the block editor, but some meta b - Plugins making updates to their DOM on "submit" or on "save". Please also note that if your plugin triggers a PHP warning or notice to be output on the page, this will cause the HTML document type (``) to be output incorrectly. This will cause the browser to render using "Quirks Mode", which is a compatibility layer that gets enabled when the browser doesn't know what type of document it is parsing. The block editor is not meant to work in this mode, but it can _appear_ to be working just fine. If you encounter issues such as _meta boxes overlaying the editor_ or other layout issues, please check the raw page source of your document to see that the document type definition is the first thing output on the page. There will also be a warning in the JavaScript console, noting the issue. + +## Additional resources + +- [Creating a custom block that stores post meta](https://developer.wordpress.org/news/2023/03/03/creating-a-custom-block-that-stores-post-meta/) diff --git a/docs/how-to-guides/notices/README.md b/docs/how-to-guides/notices/README.md index d52004b7e48452..15895e2bd32131 100644 --- a/docs/how-to-guides/notices/README.md +++ b/docs/how-to-guides/notices/README.md @@ -71,7 +71,7 @@ To better understand the specific code example above: - `wp.data.dispatch('core/notices')` accesses functionality registered to the block editor data store by the Notices package. - `createNotice()` is a function offered by the Notices package to register a new notice. The block editor reads from the notice data store in order to know which notices to display. -Check out the [_Loading JavaScript_](/docs/how-to-guides/javascript/loading-javascript.md) tutorial for a primer on how to load your custom JavaScript into the block editor. +Check out the [_Enqueueing assets in the Editor_](/docs/how-to-guides/enqueueing-assets-in-the-editor.md) tutorial for a primer on how to load your custom JavaScript into the block editor. ## Learn more diff --git a/docs/how-to-guides/platform/custom-block-editor.md b/docs/how-to-guides/platform/custom-block-editor.md index 65f8c412c45d33..a7abb00adacec6 100644 --- a/docs/how-to-guides/platform/custom-block-editor.md +++ b/docs/how-to-guides/platform/custom-block-editor.md @@ -24,7 +24,7 @@ By the end of this article, you will have a solid understanding of the block edi ## Code syntax -The code snippets in this guide use JSX syntax. However, you could use plain JavaScript if you prefer. However, once familiar with JSX, many developers find it easier to read and write, so most code examples in the Block Editor Handbook use this syntax. +The code snippets in this guide use JSX syntax. However, you could use plain JavaScript if you prefer. However, once familiar with JSX, many developers find it easier to read and write, so all code examples in the Block Editor Handbook use this syntax. ## What you're going to be building diff --git a/docs/how-to-guides/plugin-sidebar-0.md b/docs/how-to-guides/plugin-sidebar-0.md index 1c0abe86c30be9..76ef54bb9d3082 100644 --- a/docs/how-to-guides/plugin-sidebar-0.md +++ b/docs/how-to-guides/plugin-sidebar-0.md @@ -10,13 +10,13 @@ _Note: this tutorial covers a custom sidebar, if you are looking to add controls ## Before you start -The tutorial assumes you have an existing plugin setup and are ready to add PHP and JavaScript code. Please, refer to [Getting started with JavaScript](/docs/how-to-guides/javascript/README.md) tutorial for an introduction to WordPress plugins and how to use JavaScript to extend the block editor. +The tutorial assumes you have an existing plugin setup and are ready to add PHP and JavaScript code. Please, refer to [Getting started with JavaScript](/docs/getting-started/fundamentals/javascript-in-the-block-editor.md) tutorial for an introduction to WordPress plugins and how to use JavaScript to extend the block editor. ## Step-by-step guide ### Step 1: Get a sidebar up and running -The first step is to tell the editor that there is a new plugin that will have its own sidebar. Use the [registerPlugin](/packages/plugins/README.md), [PluginSidebar](/packages/edit-post/README.md#pluginsidebar), and [createElement](/packages/element/README.md) utilities provided by the `@wordpress/plugins`, `@wordpress/edit-post`, and `react` packages, respectively. +The first step is to tell the editor that there is a new plugin that will have its own sidebar. Use the [registerPlugin](/packages/plugins/README.md), [PluginSidebar](/packages/editor/README.md#pluginsidebar), and [createElement](/packages/element/README.md) utilities provided by the `@wordpress/plugins`, `@wordpress/editor`, and `react` packages, respectively. Add the following code to a JavaScript file called `plugin-sidebar.js` and save it within your plugin's directory: @@ -24,7 +24,7 @@ Add the following code to a JavaScript file called `plugin-sidebar.js` and save ( function ( wp, React ) { var el = React.createElement; var registerPlugin = wp.plugins.registerPlugin; - var PluginSidebar = wp.editPost.PluginSidebar; + var PluginSidebar = wp.editor.PluginSidebar; registerPlugin( 'my-plugin-sidebar', { render: function () { @@ -57,7 +57,7 @@ function sidebar_plugin_register() { wp_register_script( 'plugin-sidebar-js', plugins_url( 'plugin-sidebar.js', __FILE__ ), - array( 'wp-plugins', 'wp-edit-post', 'react' ) + array( 'wp-plugins', 'wp-editor', 'react' ) ); } add_action( 'init', 'sidebar_plugin_register' ); @@ -82,7 +82,7 @@ To visualize and edit the meta field value you'll use an input component. The `@ ( function ( wp ) { var el = React.createElement; var registerPlugin = wp.plugins.registerPlugin; - var PluginSidebar = wp.editPost.PluginSidebar; + var PluginSidebar = wp.editor.PluginSidebar; var TextControl = wp.components.TextControl; registerPlugin( 'my-plugin-sidebar', { @@ -144,7 +144,7 @@ function sidebar_plugin_register() { array( 'react', 'wp-plugins', - 'wp-edit-post', + 'wp-editor', 'wp-components' ) ); @@ -202,7 +202,7 @@ With the field available in the editor store, it can now be surfaced to the UI. ( function ( wp ) { var el = React.createElement; var registerPlugin = wp.plugins.registerPlugin; - var PluginSidebar = wp.editPost.PluginSidebar; + var PluginSidebar = wp.editor.PluginSidebar; var TextControl = wp.components.TextControl; var MetaBlockField = function () { @@ -243,7 +243,7 @@ The `useSelect` function is used to fetch data when the component loads and will ( function ( wp ) { var el = React.createElement; var registerPlugin = wp.plugins.registerPlugin; - var PluginSidebar = wp.editPost.PluginSidebar; + var PluginSidebar = wp.editor.PluginSidebar; var Text = wp.components.TextControl; var useSelect = wp.data.useSelect; @@ -306,7 +306,7 @@ The `useDispatch` function takes a store name as its only argument and returns m ( function ( wp ) { var el = React.createElement; var registerPlugin = wp.plugins.registerPlugin; - var PluginSidebar = wp.editPost.PluginSidebar; + var PluginSidebar = wp.editor.PluginSidebar; var TextControl = wp.components.TextControl; var useSelect = wp.data.useSelect; var useDispatch = wp.data.useDispatch; diff --git a/docs/how-to-guides/themes/global-settings-and-styles.md b/docs/how-to-guides/themes/global-settings-and-styles.md index cd5557d40e55c6..69f0606c936490 100644 --- a/docs/how-to-guides/themes/global-settings-and-styles.md +++ b/docs/how-to-guides/themes/global-settings-and-styles.md @@ -1,6 +1,6 @@ # Global Settings & Styles (theme.json) -WordPress 5.8 comes with [a new mechanism](https://make.wordpress.org/core/2021/06/25/introducing-theme-json-in-wordpress-5-8/) to configure the editor that enables a finer-grained control and introduces the first step in managing styles for future WordPress releases: the `theme.json` file. Then `theme.json` [evolved to a v2](https://make.wordpress.org/core/2022/01/08/updates-for-settings-styles-and-theme-json/) with WordPress 5.9 release. This page documents its format. +WordPress 5.8 comes with [a new mechanism](https://make.wordpress.org/core/2021/06/25/introducing-theme-json-in-wordpress-5-8/) to configure the editor that enables a finer-grained control and introduces the first step in managing styles for future WordPress releases: the `theme.json` file. ## Rationale @@ -48,7 +48,7 @@ To address this need, we've started to experiment with CSS Custom Properties, ak ```json { - "version": 2, + "version": 3, "settings": { "color": { "palette": [ @@ -86,7 +86,7 @@ body { ```json { - "version": 2, + "version": 3, "settings": { "custom": { "line-height": { @@ -115,7 +115,7 @@ This specification is the same for the three different origins that use this for ```json { - "version": 2, + "version": 3, "settings": {}, "styles": {}, "customTemplates": {}, @@ -125,10 +125,13 @@ This specification is the same for the three different origins that use this for ### Version -This field describes the format of the `theme.json` file. The current version is [v2](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/), [introduced in WordPress 5.9](https://make.wordpress.org/core/2022/01/08/updates-for-settings-styles-and-theme-json/). It also works with the current Gutenberg plugin. +This field describes the format of the `theme.json` file. The latest version is [version 3](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-living/) introduced in WordPress 6.6. -If you have used [v1](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-v1/) previously, you don’t need to update the version in the v1 file to v2, as it’ll be [migrated](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-migrations/) into v2 at runtime for you. +New versions are introduced when a breaking change needs to be made. This allows theme authors to choose when to opt-in to the breaking changes and migrate their theme.json files to the new format. +Older versions of `theme.json` are backwards-compatible and will continue to work with newer versions of WordPress and the Gutenberg plugin. However new features will be developed on the latest version. + +Follow the instructions in [migrating to newer versions](https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/theme-json-migrations/) for details on updating to the latest version. ### Settings @@ -145,7 +148,7 @@ The settings section has the following structure: ```json { - "version": 2, + "version": 3, "settings": { "border": { "radius": false, @@ -209,7 +212,7 @@ The settings section has the following structure: ```json { - "version": 2, + "version": 3, "settings": { "appearanceTools": false, "border": { @@ -265,6 +268,7 @@ The settings section has the following structure: "fontWeight": true, "letterSpacing": true, "lineHeight": false, + "textAlign": true, "textColumns": false, "textDecoration": true, "textTransform": true @@ -356,7 +360,7 @@ The naming schema for the classes and the custom properties is as follows: ```json { - "version": 2, + "version": 3, "settings": { "color": { "duotone": [ @@ -531,7 +535,7 @@ For example: ```json { - "version": 2, + "version": 3, "settings": { "custom": { "baseFont": 16, @@ -576,7 +580,7 @@ Note that the name of the variable is created by adding `--` in between each nes ```json { - "version": 2, + "version": 3, "settings": { "color": { "custom": false @@ -596,7 +600,7 @@ Note that the name of the variable is created by adding `--` in between each nes ```json { - "version": 2, + "version": 3, "settings": { "blocks": { "core/button": { @@ -613,7 +617,7 @@ Note that the name of the variable is created by adding `--` in between each nes ```json { - "version": 2, + "version": 3, "settings": { "color": { "palette": [ @@ -681,7 +685,7 @@ Each block declares which style properties it exposes via the [block supports me ```json { - "version": 2, + "version": 3, "styles": { "border": { "radius": "value", @@ -760,7 +764,7 @@ Each block declares which style properties it exposes via the [block supports me ```json { - "version": 2, + "version": 3, "styles": { "border": { "color": "value", @@ -855,7 +859,7 @@ Styles found at the top-level will be enqueued using the `body` selector. ```json { - "version": 1, + "version": 3, "styles": { "color": { "text": "var(--wp--preset--color--primary)" @@ -884,7 +888,7 @@ By default, the block selector is generated based on its name such as `.wp-block ```json { - "version": 1, + "version": 3, "styles": { "color": { "text": "var(--wp--preset--color--primary)" @@ -971,7 +975,7 @@ If they're found in the top-level the element selector will be used. If they're ```json { - "version": 1, + "version": 3, "styles": { "typography": { "fontSize": "var(--wp--preset--font-size--normal)" @@ -1065,7 +1069,7 @@ For example, this is how to provide styles for the existing `plain` variation fo ```json { - "version": 2, + "version": 3, "styles":{ "blocks": { "core/quote": { @@ -1102,7 +1106,7 @@ Within this field themes can list the custom templates present in the `templates ```json { - "version": 2, + "version": 3, "customTemplates": [ { "name": "my-custom-template", @@ -1131,7 +1135,7 @@ Currently block variations exist for "header" and "footer" values of the area te ```json { - "version": 2, + "version": 3, "templateParts": [ { "name": "my-template-part", @@ -1144,22 +1148,28 @@ Currently block variations exist for "header" and "footer" values of the area te ### patterns -
Supported in WordPress from version 6.0 using version 2 of theme.json.
+
Supported in WordPress from version 6.0.
Within this field themes can list patterns to register from [Pattern Directory](https://wordpress.org/patterns/). The `patterns` field is an array of pattern `slugs` from the Pattern Directory. Pattern slugs can be extracted by the `url` in single pattern view at the Pattern Directory. For example in this url `https://wordpress.org/patterns/pattern/partner-logos` the slug is `partner-logos`. ```json { - "version": 2, + "version": 3, "patterns": [ "short-text-surrounded-by-round-images", "partner-logos" ] } ``` ## Developing with theme.json -It can be difficult to remember the theme.json settings and properties while you develop, so a JSON scheme was created to help. The schema is available at https://schemas.wp.org/trunk/theme.json +It can be difficult to remember the theme.json settings and properties and which versions of WordPress support which settings while you develop, so it can be helpful to use the provided JSON schema for theme.json. + +Many code editors support JSON schema and can provide help like tooltips, autocomplete, or schema validation right in your editor. + +Theme.json schemas for each WordPress version are available at `https://schemas.wp.org/wp/{{version}}/theme.json`. For example a schema for WordPress 5.8 is available at `https://schemas.wp.org/wp/5.8/theme.json`. To ensure that you're only using features available to your users, it's best to use the oldest version that your theme supports. + +The latest schema including all the latest changes from the Gutenberg plugin is available at `https://schemas.wp.org/trunk/theme.json`. -Code editors can pick up the schema and can provide help like tooltips, autocomplete, or schema validation in the editor. To use the schema in Visual Studio Code, add `"$schema": "https://schemas.wp.org/trunk/theme.json"` to the beginning of your theme.json file. +Check your editor's documentation for JSON schema support. In Visual Studio Code, for example, you need to add `"$schema": "https://schemas.wp.org/wp/x.x/theme.json"` as a top-level property of your theme.json file, but other editors may be configured differently. ![Example using validation with schema](https://developer.wordpress.org/files/2021/11/theme-json-schema-updated.gif) @@ -1209,7 +1219,7 @@ For example: ```json { - "version": 2, + "version": 3, "settings": { "custom": { "lineHeight": { @@ -1239,7 +1249,7 @@ A few notes about this process: ```json { - "version": 2, + "version": 3, "settings": { "custom": { "line--height": { // DO NOT DO THIS @@ -1283,7 +1293,7 @@ body { ### Specificity for link colors provided by the user -In v1, when a user selected a link color for a specific block we attached a class to that block in the form of `.wp-element-` and then enqueued the following style: +In WordPress 5.8, when a user selected a link color for a specific block we attached a class to that block in the form of `.wp-element-` and then enqueued the following style: ```css .wp-element- a { color: !important; } @@ -1303,7 +1313,7 @@ For blocks that contain inner blocks, such as Group, Columns, Buttons, and Socia ```json { - "version": 2, + "version": 3, "settings": { "spacing": { "blockGap": true, @@ -1327,4 +1337,4 @@ The value defined for the root `styles.spacing.blockGap` style is also output as ### Why does it take so long to update the styles in the browser? -When you are actively developing with theme.json you may notice it takes 30+ seconds for your changes to show up in the browser, this is because `theme.json` is cached. To remove this caching issue, set either [`WP_DEBUG`](https://wordpress.org/documentation/article/debugging-in-wordpress/#wp_debug) or [`SCRIPT_DEBUG`](https://wordpress.org/documentation/article/debugging-in-wordpress/#script_debug) to 'true' in your [`wp-config.php`](https://wordpress.org/documentation/article/editing-wp-config-php/). This tells WordPress to skip the cache and always use fresh data. +When you are actively developing with theme.json you may notice it takes 30+ seconds for your changes to show up in the browser, this is because `theme.json` is cached. To remove this caching issue, set either [`WP_DEBUG`](https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/#wp_debug) or [`SCRIPT_DEBUG`](https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/#script_debug) to 'true' in your [`wp-config.php`](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/). This tells WordPress to skip the cache and always use fresh data. diff --git a/docs/how-to-guides/themes/theme-support.md b/docs/how-to-guides/themes/theme-support.md index edf4b8e505c13a..e5d6c34e4081ce 100644 --- a/docs/how-to-guides/themes/theme-support.md +++ b/docs/how-to-guides/themes/theme-support.md @@ -442,7 +442,6 @@ Link support has been made stable as part of WordPress 5.8. It's `false` by defa ```json { - "version": 1, "settings": { "color": { "link": true diff --git a/docs/manifest.json b/docs/manifest.json index 638c5d2b16c83d..a2577530463555 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -491,6 +491,36 @@ "markdown_source": "../docs/reference-guides/filters/global-styles-filters.md", "parent": "filters" }, + { + "title": "Interactivity API Reference", + "slug": "interactivity-api", + "markdown_source": "../docs/reference-guides/interactivity-api/README.md", + "parent": "reference-guides" + }, + { + "title": "Quick start guide", + "slug": "iapi-quick-start-guide", + "markdown_source": "../docs/reference-guides/interactivity-api/iapi-quick-start-guide.md", + "parent": "interactivity-api" + }, + { + "title": "API Reference", + "slug": "api-reference", + "markdown_source": "../docs/reference-guides/interactivity-api/api-reference.md", + "parent": "interactivity-api" + }, + { + "title": "About the Interactivity API", + "slug": "iapi-about", + "markdown_source": "../docs/reference-guides/interactivity-api/iapi-about.md", + "parent": "interactivity-api" + }, + { + "title": "Frequently Asked Questions", + "slug": "iapi-faq", + "markdown_source": "../docs/reference-guides/interactivity-api/iapi-faq.md", + "parent": "interactivity-api" + }, { "title": "SlotFills Reference", "slug": "slotfills", @@ -564,7 +594,7 @@ "parent": "reference-guides" }, { - "title": "Theme.json Version 2", + "title": "Theme.json Version 3 Reference (latest)", "slug": "theme-json-living", "markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-living.md", "parent": "theme-json-reference" @@ -576,7 +606,13 @@ "parent": "theme-json-reference" }, { - "title": "Migrating to Newer Versions", + "title": "Theme.json Version 2 Reference", + "slug": "theme-json-v2", + "markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-v2.md", + "parent": "theme-json-reference" + }, + { + "title": "Migrating Theme.json to Newer Versions", "slug": "theme-json-migrations", "markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-migrations.md", "parent": "theme-json-reference" @@ -737,12 +773,6 @@ "markdown_source": "../packages/components/src/confirm-dialog/README.md", "parent": "components" }, - { - "title": "CustomSelectControlV2", - "slug": "custom-select-control-v2", - "markdown_source": "../packages/components/src/custom-select-control-v2/README.md", - "parent": "components" - }, { "title": "CustomSelectControl", "slug": "custom-select-control", @@ -1199,12 +1229,6 @@ "markdown_source": "../packages/components/src/tab-panel/README.md", "parent": "components" }, - { - "title": "Tabs", - "slug": "tabs", - "markdown_source": "../packages/components/src/tabs/README.md", - "parent": "components" - }, { "title": "TextControl", "slug": "text-control", @@ -1679,12 +1703,6 @@ "markdown_source": "../packages/interactivity/README.md", "parent": "packages" }, - { - "title": "API Reference", - "slug": "packages-interactivity-api-reference", - "markdown_source": "../packages/interactivity/docs/api-reference.md", - "parent": "packages-interactivity" - }, { "title": "@wordpress/interface", "slug": "packages-interface", diff --git a/docs/reference-guides/README.md b/docs/reference-guides/README.md index b9725af66f0804..cc30aa87526058 100644 --- a/docs/reference-guides/README.md +++ b/docs/reference-guides/README.md @@ -39,7 +39,8 @@ ## [Theme.json Reference](/docs/reference-guides/theme-json-reference/README.md) -- [Version 2 (living reference)](/docs/reference-guides/theme-json-reference/theme-json-living.md) +- [Version 3 (latest)](/docs/reference-guides/theme-json-reference/theme-json-living.md) +- [Version 2](/docs/reference-guides/theme-json-reference/theme-json-v2.md) - [Version 1](/docs/reference-guides/theme-json-reference/theme-json-v1.md) - [Migrating to Newer Versions](/docs/reference-guides/theme-json-reference/theme-json-migrations.md) diff --git a/docs/reference-guides/block-api/block-attributes.md b/docs/reference-guides/block-api/block-attributes.md index 935b38155f1e72..52a325ff9253de 100644 --- a/docs/reference-guides/block-api/block-attributes.md +++ b/docs/reference-guides/block-api/block-attributes.md @@ -375,9 +375,6 @@ Attribute definition: From here, meta attributes can be read and written by a block using the same interface as any attribute: - -{% JSX %} - ```js edit( { attributes, setAttributes } ) { function onChange( event ) { diff --git a/docs/reference-guides/block-api/block-deprecation.md b/docs/reference-guides/block-api/block-deprecation.md index 4d69d9d46843cd..0da85ee02d1ec0 100644 --- a/docs/reference-guides/block-api/block-deprecation.md +++ b/docs/reference-guides/block-api/block-deprecation.md @@ -23,7 +23,7 @@ It is also important to note that if a deprecation's `save` method imports addit For blocks with multiple deprecations, it may be easier to save each deprecation to a constant with the version of the block it applies to, and then add each of these to the block's `deprecated` array. The deprecations in the array should be in reverse chronological order. This allows the block editor to attempt to apply the most recent and likely deprecations first, avoiding unnecessary and expensive processing. -### Example: +**Example** ```js const v1 = {}; @@ -59,7 +59,7 @@ Deprecations are defined on a block type as its `deprecated` property, an array It's important to note that attributes, supports, and save are not automatically inherited from the current version, since they can impact parsing and serialization of a block, so they must be defined on the deprecated object in order to be processed during a migration. -### Example: +**Example** ```js const { registerBlockType } = wp.blocks; @@ -104,7 +104,7 @@ In the example above we updated the markup of the block to use a `div` instead o Sometimes, you need to update the attributes set to rename or modify old attributes. -### Example: +**Example** ```js @@ -155,7 +155,7 @@ In the example above we updated the markup of the block to use a `div` instead o Situations may exist where when migrating the block we may need to add or remove innerBlocks. E.g: a block wants to migrate a title attribute to a paragraph innerBlock. -### Example: +**Example** ```js const { registerBlockType } = wp.blocks; diff --git a/docs/reference-guides/block-api/block-metadata.md b/docs/reference-guides/block-api/block-metadata.md index 09ab571ba68476..1b0925513b3a8d 100644 --- a/docs/reference-guides/block-api/block-metadata.md +++ b/docs/reference-guides/block-api/block-metadata.md @@ -70,7 +70,7 @@ From a performance perspective, when themes support lazy loading assets, blocks Furthermore, because the [Block Type REST API Endpoint](https://developer.wordpress.org/rest-api/reference/block-types/) can only list blocks registered on the server, registering blocks server-side is recommended; using the `block.json` file simplifies this registration. -The [WordPress Plugins Directory](https://wordpress.org/plugins/) can detect `block.json` files, highlight blocks included in plugins, and extract their metadata. If you wish to [submit your block(s) to the Block Directory](/docs/getting-started/create-block/submitting-to-block-directory.md), all blocks contained in your plugin must have a `block.json` file for the Block Directory to recognize them. +The [WordPress Plugins Directory](https://wordpress.org/plugins/) can detect `block.json` files, highlight blocks included in plugins, and extract their metadata. If you wish to submit your block(s) to the Block Directory all blocks contained in your plugin must have a `block.json` file for the Block Directory to recognize them. Development is improved by using a defined schema definition file. Supported editors can provide help like tooltips, autocomplete, and schema validation. To use the schema, add the following to the top of the `block.json`. @@ -543,7 +543,7 @@ Block type frontend script module definition. They will be enqueued only when vi It's possible to pass a script module ID registered with the [`wp_register_script_module`](https://developer.wordpress.org/reference/functions/wp_register_script_module/) function, a path to a JavaScript module relative to the `block.json` file, or a list with a mix of both ([learn more](#wpdefinedasset)). -WordPress scripts and WordPress script modules are not compatible at the moment. If frontend view assets depend on WordPress scripts, `viewScript` should be used. If they depend on WordPress script modules —the Interactivity API at this time— `viewScriptModule` should be used. In the future, it will be possible to depend on scripts from script modules. +WordPress scripts and WordPress script modules are not compatible at the moment. If frontend view assets depend on WordPress scripts, `viewScript` should be used. If they depend on WordPress script modules —the Interactivity API at this time— `viewScriptModule` should be used. [More functionality](https://core.trac.wordpress.org/ticket/60647) will gradually become available to Script Modules. _Note: Available since WordPress `6.5.0`._ diff --git a/docs/reference-guides/block-api/block-registration.md b/docs/reference-guides/block-api/block-registration.md index 57123b7b47093d..92be19ee48c9fa 100644 --- a/docs/reference-guides/block-api/block-registration.md +++ b/docs/reference-guides/block-api/block-registration.md @@ -98,7 +98,7 @@ icon: - This API was stabilized in Gutenberg 15.5 and is planned for core release - in WordPress 6.3. To use this prior to WordPress 6.3, you will need to - install and activate Gutenberg >= 15.5. - - Block Selectors is the API that allows blocks to customize the CSS selector used when their styles are generated. diff --git a/docs/reference-guides/block-api/block-supports.md b/docs/reference-guides/block-api/block-supports.md index d4b23b100984fc..b327cd0c03a9ee 100644 --- a/docs/reference-guides/block-api/block-supports.md +++ b/docs/reference-guides/block-api/block-supports.md @@ -7,30 +7,29 @@ Opting into any of these features will register additional attributes on the blo In order for the attribute to get applied to the block the generated properties get added to the wrapping element of the block. They get added to the object you get returned from the `useBlockProps` hook. `BlockEdit` function: + ```js function BlockEdit() { const blockProps = useBlockProps(); - return ( -
Hello World!
- ); + return
Hello World!
; } ``` `save` function: + ```js function BlockEdit() { const blockProps = useBlockProps.save(); - return ( -
Hello World!
- ); + return
Hello World!
; } ``` For dynamic blocks that get rendered via a `render_callback` in PHP you can use the `get_block_wrapper_attributes()` function. It returns a string containing all the generated properties and needs to get output in the opening tag of the wrapping block element. `render_callback` function: + ```php function render_block() { $wrapper_attributes = get_block_wrapper_attributes(); @@ -62,7 +61,7 @@ supports: { - Type: `boolean` or `array` - Default value: `false` -This property adds block controls which allow to change block's alignment. +This property adds block controls, which enable changes to a block's alignment. ```js supports: { @@ -80,7 +79,7 @@ supports: { } ``` -When the block declares support for `align`, the attributes definition is extended to include an align attribute with a `string` type. By default, no alignment is assigned. The block can apply a default alignment by specifying its own `align` attribute with a default e.g.: +When the block declares support for `align`, the attributes definition is extended to include an align attribute with a `string` type. By default, no alignment is assigned. The block can apply a default alignment by specifying its own `align` attribute with a default. For example: ```js attributes: { @@ -107,24 +106,80 @@ supports: { ## ariaLabel -- Type: `boolean` -- Default value: `false` +- Type: `boolean` +- Default value: `false` ARIA-labels let you define an accessible label for elements. This property allows enabling the definition of an aria-label for the block, without exposing a UI field. ```js supports: { - // Add the support for aria label. + // Add support for an aria label. ariaLabel: true } ``` +## background + +_**Note:** Since WordPress 6.5._ + +- Type: `Object` +- Default value: `null` +- Subproperties + - `backgroundImage`: type `boolean`, default value `false` + - `backgroundSize`: type `boolean`, default value `false` + +This value signals that a block supports some of the CSS style properties related to background. When it does, the block editor will show UI controls for the user to set their values if [the theme declares support](/docs/how-to-guides/themes/global-settings-and-styles.md#opt-in-into-ui-controls). + +`backgroundImage` adds UI controls which allow the user to select a background image. +`backgroundSize` adds the FocalPointPicker to pick the position of the background image and allow the user to select the background size (cover, contain, fixed). + +```js +supports: { + background: { + backgroundImage: true // Enable background image control. + backgroundSize: true // Enable background image + size control. + } +} +``` + +When a block declares support for a specific background property, its attributes definition is extended to include the `style` attribute. + +When a background image is selected, the image data is stored in the `style.background.backgroundImage`. + +When a background images is selected and its position or size are changed, the background-position is stored in the `style.background.backgroundPosition` and its background-size in `style.background.backgroundSize` attribute. + +- `style`: an attribute of `object` type with no default assigned. This is added when `backgroundImage` or `backgroundSize` support is declared. It stores the custom values set by the user. + - `background`: an attribute of `object` type. + - `backgroundImage`: an attribute of `object` type, containing information about the selected image + - `url`: type `string`, URL to the image + - `id`: type `int`, media attachment ID + - `source`: type `string`, at the moment the only value is `file` + - `title`: type `string`, title of the media attachment + - `backgroundPosition`: an attribute of `string` type, defining the background images position, selected by FocalPointPicker and used in CSS as the [`background-position`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position) value. + - `backgroundSize`: an attribute of `string` type. defining the CSS [`background-size`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size) value. + +The block can apply a default background image, position and size by specifying its own attribute with a default. For example: + +```js +attributes: { + style: { + background: { + backgroundImage: { + "url":"IMAGE_URL" + } + backgroundPosition:"50% 50%", + backgroundSize: "cover" + } + } +} +``` + ## className - Type: `boolean` - Default value: `true` -By default, the class `.wp-block-your-block-name` is added to the root element of your saved markup. This helps having a consistent mechanism for styling blocks that themes and plugins can rely on. If, for whatever reason, a class is not desired on the markup, this functionality can be disabled. +By default, the class `.wp-block-your-block-name` is added to the root element of your saved markup. This helps by providing a consistent mechanism for styling blocks that themes and plugins can rely on. If, for whatever reason, a class is not desired on the markup, this functionality can be disabled. ```js supports: { @@ -139,19 +194,22 @@ supports: { - Default value: null - Subproperties: - `background`: type `boolean`, default value `true` + - `button`: type `boolean`, default value `false` + - `enableContrastChecker`: type `boolean`, default value `true` - `gradients`: type `boolean`, default value `false` + - `heading`: type `boolean`, default value `false` - `link`: type `boolean`, default value `false` - `text`: type `boolean`, default value `true` -This value signals that a block supports some of the properties related to color. When it does, the block editor will show UI controls for the user to set their values. +This value signals that a block supports some of the properties related to color. When this value is present, the block editor will show UI controls for the user to set their values. -Note that the `background` and `text` keys have a default value of `true`, so if the `color` property is present they'll also be considered enabled: +Note that the `background` and `text` keys have a default value of `true`, so if the `color` property is present they will also be considered enabled: ```js supports: { color: { // This also enables text and background UI controls. - gradients: true // Enable gradients UI control. + gradients: true // Enables the gradients UI control. } } ``` @@ -161,8 +219,8 @@ It's possible to disable them individually: ```js supports: { color: { // Text UI control is enabled. - background: false, // Disable background UI control. - gradients: true // Enable gradients UI control. + background: false, // Disables the background UI control. + gradients: true // Enables the gradients UI control. } } ``` @@ -175,7 +233,7 @@ When color support is declared, this property is enabled by default (along with ```js supports: { - color: true // Enables background and text + color: true // Enables background and text color support. } ``` @@ -184,7 +242,7 @@ To disable background support while keeping other color supports enabled, set to ```js supports: { color: { - // Disable background support. Text color support is still enabled. + // Disables background support. Text color support is still enabled. background: false } } @@ -192,43 +250,103 @@ supports: { When the block declares support for `color.background`, the attributes definition is extended to include two new attributes: `backgroundColor` and `style`: -- `backgroundColor`: attribute of `string` type with no default assigned. +- `backgroundColor`: an attribute of `string` type with no default assigned. - When a user chooses from the list of preset background colors, the preset slug is stored in the `backgroundColor` attribute. + When a user chooses from the list of preset background colors, the preset slug is stored in the `backgroundColor` attribute. - Background color presets are sourced from the `editor-color-palette` [theme support](/docs/how-to-guides/themes/theme-support.md#block-color-palettes). + Background color presets are sourced from the `editor-color-palette` [theme support](/docs/how-to-guides/themes/theme-support.md#block-color-palettes). - The block can apply a default preset background color by specifying its own attribute with a default e.g.: + The block can apply a default preset background color by specifying its own attribute with a default. For example: - ```js - attributes: { - backgroundColor: { - type: 'string', - default: 'some-preset-background-slug', - } - } - ``` + ```js + attributes: { + backgroundColor: { + type: 'string', + default: 'some-preset-background-slug', + } + } + ``` -- `style`: attribute of `object` type with no default assigned. +- `style`: attribute of `object` type with no default assigned. - When a custom background color is selected (i.e. using the custom color picker), the custom color value is stored in the `style.color.background` attribute. + When a custom background color is selected (i.e. using the custom color picker), the custom color value is stored in the `style.color.background` attribute. - The block can apply a default custom background color by specifying its own attribute with a default e.g.: + The block can apply a default custom background color by specifying its own attribute with a default. For example: - ```js - attributes: { - style: { - type: 'object', - default: { - color: { - background: '#aabbcc', - } - } - } - } - ``` + ```js + attributes: { + style: { + type: 'object', + default: { + color: { + background: '#aabbcc', + } + } + } + } + ``` + +### color.button + +_**Note:** Since WordPress 6.5._ + +This property adds block controls which allow the user to set button colors (text, background) in a block. Button colors are disabled by default. + +To enable button color support, set `color.button` to `true`. + +```js +supports: { + color: { + button: true + } +} +``` + +Button color presets are sourced from the `editor-color-palette` [theme support](/docs/how-to-guides/themes/theme-support.md#block-color-palettes). + +When the block declares support for `color.button`, the attributes definition is extended to include the `style` attribute: + +- `style`: an attribute of `object` type with no default assigned. + + When a button color is selected, the color value is stored in the `style.elements.button.color.text` and `style.elements.button.color.background` attribute. + + The block can apply a default button colors by specifying its own attribute with a default. For example: + + ```js + attributes: { + style: { + type: 'object', + default: { + elements: { + button: { + color: { + text: 'var:preset|color|contrast', + background: '#000000', + } + } + } + } + } + } + ``` -### color.__experimentalDuotone +### color.enableContrastChecker + +_**Note:** Since WordPress 6.5._ + +Determines whether the contrast checker widget displays in the block editor UI. + +The contrast checker appears only if the block declares support for color. It tests the readability of color combinations and warns if there is a potential issue. The property is enabled by default. Set to `false` to explicitly disable: + +```js +supports: { + color: { + enableContrastChecker: false + } +} +``` + +### color.\_\_experimentalDuotone _**Note:** Deprecated since WordPress 6.3._ @@ -242,8 +360,7 @@ This property adds UI controls which allow the user to apply a gradient backgrou supports: { color: { gradients: true, - - // Default values must be disabled if you don't want to use them with gradient. + // Default values must be disabled if you don't want to use them with gradients. background: false, text: false } @@ -252,91 +369,132 @@ supports: { Gradient presets are sourced from `editor-gradient-presets` [theme support](/docs/how-to-guides/themes/theme-support.md#block-gradient-presets). - When the block declares support for `color.gradient`, the attributes definition is extended to include two new attributes: `gradient` and `style`: -- `gradient`: attribute of `string` type with no default assigned. +- `gradient`: an attribute of `string` type with no default assigned. - When a user chooses from the list of preset gradients, the preset slug is stored in the `gradient` attribute. + When a user chooses from the list of preset gradients, the preset slug is stored in the `gradient` attribute. - The block can apply a default preset gradient by specifying its own attribute with a default e.g.: + The block can apply a default preset gradient by specifying its own attribute with a default. For example: - ```js - attributes: { - gradient: { - type: 'string', - default: 'some-preset-gradient-slug', - } - } - ``` + ```js + attributes: { + gradient: { + type: 'string', + default: 'some-preset-gradient-slug', + } + } + ``` -- `style`: attribute of `object` type with no default assigned. +- `style`: an attribute of `object` type with no default assigned. - When a custom gradient is selected (i.e. using the custom gradient picker), the custom gradient value is stored in the `style.color.gradient` attribute. + When a custom gradient is selected (i.e. using the custom gradient picker), the custom gradient value is stored in the `style.color.gradient` attribute. - The block can apply a default custom gradient by specifying its own attribute with a default e.g.: + The block can apply a default custom gradient by specifying its own attribute with a default. For example: - ```js - attributes: { - style: { - type: 'object', - default: { - color: { - gradient: 'linear-gradient(135deg,rgb(170,187,204) 0%,rgb(17,34,51) 100%)', - } - } - } - } - ``` + ```js + attributes: { + style: { + type: 'object', + default: { + color: { + gradient: 'linear-gradient(135deg,rgb(170,187,204) 0%,rgb(17,34,51) 100%)', + } + } + } + } + ``` -### color.link +### color.heading -This property adds block controls which allow the user to set link color in a block, link color is disabled by default. +_**Note:** Since WordPress 6.5._ +This property adds block controls which allow the user to set heading colors in a block. Heading colors are disabled by default. + +To enable heading color support, set `color.heading` to `true`. ```js supports: { - color: true // Enables only background and text + color: { + // Enable heading color support. + heading: true + } } ``` -To enable link color support, set to `true`. +Heading color presets are sourced from the `editor-color-palette` [theme support](/docs/how-to-guides/themes/theme-support.md#block-color-palettes). + +When the block declares support for `color.heading`, the attributes definition is extended to include the `style` attribute: + +- `style`: an attribute of `object` type with no default assigned. + + When a heading color is selected, the color value is stored in the `style.elements.heading.color.text` and `style.elements.heading.color.background` attribute. + + The block can apply default heading colors by specifying its own attribute with a default. For example: + + ```js + attributes: { + style: { + type: 'object', + default: { + elements: { + heading: { + color: { + text: 'var:preset|color|contrast', + background: '#000000', + } + } + } + } + } + } + ``` + +### color.link + +This property adds block controls which allow the user to set link colors in a block. Link colors are disabled by default. + +To enable link color support, set `color.link` to `true`. ```js supports: { - color: { - link: true - } + color: { + link: true + } } ``` Link color presets are sourced from the `editor-color-palette` [theme support](/docs/how-to-guides/themes/theme-support.md#block-color-palettes). - When the block declares support for `color.link`, the attributes definition is extended to include the `style` attribute: -- `style`: attribute of `object` type with no default assigned. - - When a link color is selected, the color value is stored in the `style.elements.link.color.text` attribute. - - The block can apply a default link color by specifying its own attribute with a default e.g.: - - ```js - attributes: { - style: { - type: 'object', - default: { - elements: { - link: { - color: { - text: '#ff0000', - } - } - } - } - } - } - ``` +- `style`: an attribute of `object` type with no default assigned. + + When a link color is selected, the color value is stored in the `style.elements.link.color.text` and `style.elements.link.:hover.color.text` attribute. + + The block can apply default link colors by specifying its own attribute with a default. For example: + + ```js + attributes: { + style: { + type: 'object', + default: { + elements: { + link: { + color: { + text: 'var:preset|color|contrast', + }, + ":hover": { + color: { + text: "#000000" + } + } + } + } + } + } + } + ``` ### color.text @@ -346,59 +504,58 @@ When color support is declared, this property is enabled by default (along with ```js supports: { - color: true // Enables background and text, but not link. + color: true // Enables background and text, but not link. } ``` -To disable text color support while keeping other color supports enabled, set to `false`. +To disable text color support while keeping other color supports enabled, set `color.text` to `false`. ```js supports: { - color: { - // Disable text color support. - text: false - } + color: { + // Disable text color support. + text: false + } } ``` Text color presets are sourced from the `editor-color-palette` [theme support](/docs/how-to-guides/themes/theme-support.md#block-color-palettes). - When the block declares support for `color.text`, the attributes definition is extended to include two new attributes: `textColor` and `style`: -- `textColor`: attribute of `string` type with no default assigned. +- `textColor`: an attribute of `string` type with no default assigned. - When a user chooses from the list of preset text colors, the preset slug is stored in the `textColor` attribute. + When a user chooses from the list of preset text colors, the preset slug is stored in the `textColor` attribute. - The block can apply a default preset text color by specifying its own attribute with a default e.g.: + The block can apply a default preset text color by specifying its own attribute with a default. For example: - ```js - attributes: { - textColor: { - type: 'string', - default: 'some-preset-text-color-slug', - } - } - ``` + ```js + attributes: { + textColor: { + type: 'string', + default: 'some-preset-text-color-slug', + } + } + ``` -- `style`: attribute of `object` type with no default assigned. +- `style`: an attribute of `object` type with no default assigned. - When a custom text color is selected (i.e. using the custom color picker), the custom color value is stored in the `style.color.text` attribute. + When a custom text color is selected (i.e. using the custom color picker), the custom color value is stored in the `style.color.text` attribute. - The block can apply a default custom text color by specifying its own attribute with a default e.g.: + The block can apply a default custom text color by specifying its own attribute with a default. For example: - ```js - attributes: { - style: { - type: 'object', - default: { - color: { - text: '#aabbcc', - } - } - } - } - ``` + ```js + attributes: { + style: { + type: 'object', + default: { + color: { + text: '#aabbcc', + } + } + } + } + ``` ## customClassName @@ -427,16 +584,16 @@ This value signals that a block supports some of the CSS style properties relate ```js supports: { - dimensions: { - aspectRatio: true // Enable aspect ratio control. - minHeight: true // Enable min height control. - } + dimensions: { + aspectRatio: true // Enable aspect ratio control. + minHeight: true // Enable min height control. + } } ``` When a block declares support for a specific dimensions property, its attributes definition is extended to include the `style` attribute. -- `style`: attribute of `object` type with no default assigned. This is added when `aspectRatio` or `minHeight` support is declared. It stores the custom values set by the user, e.g.: +- `style`: an attribute of `object` type with no default assigned. This is added when `aspectRatio` or `minHeight` support is declared. It stores the custom values set by the user. For example: ```js attributes: { @@ -450,6 +607,7 @@ attributes: { ``` ## filter + - Type: `Object` - Default value: null - Subproperties: @@ -483,25 +641,25 @@ Duotone presets are sourced from `color.duotone` in [theme.json](/docs/how-to-gu When the block declares support for `filter.duotone`, the attributes definition is extended to include the attribute `style`: -- `style`: attribute of `object` type with no default assigned. - - The block can apply a default duotone color by specifying its own attribute with a default e.g.: - - ```js - attributes: { - style: { - type: 'object', - default: { - color: { - duotone: [ - '#FFF', - '#000' - ] - } - } - } - } - ``` +- `style`: an attribute of `object` type with no default assigned. + + The block can apply a default duotone color by specifying its own attribute with a default. For example: + + ```js + attributes: { + style: { + type: 'object', + default: { + color: { + duotone: [ + '#FFF', + '#000' + ] + } + } + } + } + ``` ## html @@ -568,7 +726,7 @@ This value only applies to blocks that are containers for inner blocks. If set t - Type: `Object` - Default value: null -Allows setting the `type` property to define what layout type is default for the block, and also default values for any properties inherent to that layout type, e.g., for a `flex` layout, a default value can be set for `flexWrap`. +Allows setting the `type` property to define what layout type is default for the block, and also default values for any properties inherent to that layout type. For example, for a `flex` layout, a default value can be set for `flexWrap`. ### layout.allowSwitching @@ -626,46 +784,31 @@ For the `flex` layout type only, determines display of the orientation control i For the `constrained` layout type only, determines display of the custom content and wide size controls in the block sidebar. - -## multiple - -- Type: `boolean` -- Default value: `true` - -A non-multiple block can be inserted into each post, one time only. For example, the built-in 'More' block cannot be inserted again if it already exists in the post being edited. A non-multiple block's icon is automatically dimmed (unclickable) to prevent multiple instances. - -```js -supports: { - // Use the block just once per post - multiple: false -} -``` - -## reusable +## lock - Type: `boolean` - Default value: `true` -A block may want to disable the ability of being converted into a reusable block. By default all blocks can be converted to a reusable block. If supports reusable is set to false, the option to convert the block into a reusable block will not appear. +A block may want to disable the ability to toggle the lock state. It can be locked/unlocked by a user from the block "Options" dropdown by default. To disable this behavior, set `lock` to `false`. ```js supports: { - // Don't allow the block to be converted into a reusable block. - reusable: false, + // Remove support for locking UI. + lock: false } ``` -## lock +## multiple - Type: `boolean` - Default value: `true` -A block may want to disable the ability to toggle the lock state. It can be locked/unlocked by a user from the block "Options" dropdown by default. To disable this behavior, set `lock` to `false`. +A non-multiple block can be inserted into each post, one time only. For example, the built-in 'More' block cannot be inserted again if it already exists in the post being edited. A non-multiple block's icon is automatically dimmed (unclickable) to prevent multiple instances. ```js supports: { - // Remove support for locking UI. - lock: false + // Use the block just once per post + multiple: false } ``` @@ -684,15 +827,15 @@ Note that sticky position controls are currently only available for blocks set a ```js supports: { - position: { - sticky: true // Enable selecting sticky position. - } + position: { + sticky: true // Enable selecting sticky position. + } } ``` When the block declares support for a specific position property, its attributes definition is extended to include the `style` attribute. -- `style`: attribute of `object` type with no default assigned. This is added when `sticky` support is declared. It stores the custom values set by the user, e.g.: +- `style`: an attribute of `object` type with no default assigned. This is added when `sticky` support is declared. It stores the custom values set by the user. For example: ```js attributes: { @@ -705,6 +848,72 @@ attributes: { } ``` +## renaming + +_**Note:** Since WordPress 6.5._ + +- Type: `boolean` +- Default value: `true` + +By default, a block can be renamed by a user from the block 'Options' dropdown or the 'Advanced' panel. To disable this behavior, set renaming to false. + +```js +supports: { + // Don't allow the block to be renamed in the editor. + renaming: false, +} +``` + +## reusable + +- Type: `boolean` +- Default value: `true` + +A block may want to disable the ability of being converted into a reusable block. By default all blocks can be converted to a reusable block. If supports reusable is set to false, the option to convert the block into a reusable block will not appear. + +```js +supports: { + // Don't allow the block to be converted into a reusable block. + reusable: false, +} +``` + +## shadow + +_**Note:** Since WordPress 6.5._ + +- Type: `boolean` +- Default value: `false` + +This property adds block controls which allow the user to set a box shadow for a block. Shadows are disabled by default. + +```js +supports: { + shadow: true // Enable the box-shadow picker. +} +``` + +Shadow presets are sourced from the shadow presets defined in `theme.json`. + +When the block declares support for `shadow`, the attributes definition is extended to include the `style` attribute: + +- `style`: an attribute of `object` type with no default assigned. + + When a shadow is selected, the color value is stored in the `style.shadow`. + + The block can apply a default shadow by specifying its own attribute with a default. For example: + + ```js + attributes: { + style: { + type: 'object', + default: { + shadow: "var:preset|shadow|deep" + } + } + } + ``` + ## spacing - Type: `Object` @@ -728,7 +937,7 @@ supports: { When the block declares support for a specific spacing property, its attributes definition is extended to include the `style` attribute. -- `style`: attribute of `object` type with no default assigned. This is added when `margin` or `padding` support is declared. It stores the custom values set by the user, e.g.: +- `style`: an attribute of `object` type with no default assigned. This is added when `margin` or `padding` support is declared. It stores the custom values set by the user. For example: ```js attributes: { @@ -762,8 +971,9 @@ supports: { - Type: `Object` - Default value: `null` - Subproperties: - - `fontSize`: type `boolean`, default value `false` - - `lineHeight`: type `boolean`, default value `false` + - `fontSize`: type `boolean`, default value `false` + - `lineHeight`: type `boolean`, default value `false` + - `textAlign`: type `boolean` or `array`, default value `false` The presence of this object signals that a block supports some typography related properties. When it does, the block editor will show a typography UI allowing the user to control their values. @@ -774,11 +984,14 @@ supports: { fontSize: true, // Enable support and UI control for line-height. lineHeight: true, + // Enable support and UI control for text alignment. + textAlign: true, }, } ``` ### typography.fontSize + - Type: `boolean` - Default value: `false` @@ -797,7 +1010,7 @@ supports: { When the block declares support for `fontSize`, the attributes definition is extended to include two new attributes: `fontSize` and `style`: -- `fontSize`: attribute of `string` type with no default assigned. It stores any preset value selected by the user. The block can apply a default fontSize by specifying its own `fontSize` attribute with a default e.g.: +- `fontSize`: an attribute of `string` type with no default assigned. It stores any preset value selected by the user. The block can apply a default fontSize by specifying its own `fontSize` attribute with a default. For example: ```js attributes: { @@ -808,7 +1021,7 @@ attributes: { } ``` -- `style`: attribute of `object` type with no default assigned. It stores the custom values set by the user and is shared with other block supports such as color. The block can apply a default style by specifying its own `style` attribute with a default e.g.: +- `style`: an attribute of `object` type with no default assigned. It stores the custom values set by the user and is shared with other block supports such as color. The block can apply a default style by specifying its own `style` attribute with a default. For example: ```js attributes: { @@ -839,7 +1052,7 @@ supports: { } ``` -When the block declares support for `lineHeight`, the attributes definition is extended to include a new attribute `style` of `object` type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own `style` attribute with a default e.g.: +When the block declares support for `lineHeight`, the attributes definition is extended to include a new attribute `style` of `object` type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own `style` attribute with a default. For example: ```js attributes: { @@ -853,3 +1066,47 @@ attributes: { } } ``` + +### typography.textAlign + +_**Note:** Since WordPress 6.6._ + +- Type: `boolean` or `array` +- Default value: `false` + +This property adds block toolbar controls which allow to change block's text alignment. + +```js +supports: { + typography: { + // Declare support for block's text alignment. + // This adds support for all the options: + // left, center, right. + textAlign: true + } +} +``` + +```js +supports: { + typography: { + // Declare support for specific text alignment options. + textAlign: [ 'left', 'right' ] + } +} +``` + +When the block declares support for `textAlign`, the attributes definition is extended to include a new attribute `style` of `object` type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own `style` attribute with a default. For example: + +```js +attributes: { + style: { + type: 'object', + default: { + typography: { + textAlign: 'value' + } + } + } +} +``` diff --git a/docs/reference-guides/block-api/block-variations.md b/docs/reference-guides/block-api/block-variations.md index 96930dc6b9b625..0440858810b65a 100644 --- a/docs/reference-guides/block-api/block-variations.md +++ b/docs/reference-guides/block-api/block-variations.md @@ -1,6 +1,6 @@ # Variations -The Block Variations API allows you to define multiple versions (variations) of a block. A block variation differs from the original block by a set of initial attributes or inner blocks. When you insert the block variation into the Editor, these attributes and/or inner blocks are applied. +The Block Variations API allows you to define multiple versions (variations) of a block. A block variation differs from the original block by a set of initial attributes or inner blocks. When you insert the block variation into the Editor, these attributes and/or inner blocks are applied. Variations are an excellent way to create iterations of existing blocks without building entirely new blocks from scratch. @@ -55,8 +55,8 @@ Block variations can be declared during a block's registration by providing the To create a variation for an existing block, such as a Core block, use `wp.blocks.registerBlockVariation()`. This function accepts the name of the block and the object defining the variation. ```js -wp.blocks.registerBlockVariation( - 'core/embed', +wp.blocks.registerBlockVariation( + 'core/embed', { name: 'custom-embed', attributes: { providerNameSlug: 'custom' }, @@ -66,7 +66,7 @@ wp.blocks.registerBlockVariation( ## Removing a block variation -Block variations can also be easily removed. To do so, use `wp.blocks.unregisterBlockVariation()`. This function accepts the name of the block and the `name` of the variation that should be unregistered. +Block variations can also be easily removed. To do so, use `wp.blocks.unregisterBlockVariation()`. This function accepts the name of the block and the `name` of the variation that should be unregistered. ```js wp.blocks.unregisterBlockVariation( 'core/embed', 'youtube' ); @@ -84,9 +84,9 @@ variations: [ name: 'blue', title: __( 'Blue Quote' ), isDefault: true, - attributes: { - color: 'blue', - className: 'is-style-blue-quote' + attributes: { + color: 'blue', + className: 'is-style-blue-quote' }, icon: 'format-quote', isActive: ( blockAttributes, variationAttributes ) => @@ -99,16 +99,16 @@ variations: [ By default, all variations will show up in the Inserter in addition to the original block type item. However, setting the `isDefault` flag for any variations listed will override the regular block type in the Inserter. This is a great tool for curating the Editor experience to your specific needs. -For example, if you want Media & Text block to display the image on the right by default, you could create a variation like this: +For example, if you want Media & Text block to display the image on the right by default, you could create a variation like this: ```js wp.blocks.registerBlockVariation( - 'core/media-text', + 'core/media-text', { name: 'media-text-media-right', title: __( 'Media & Text' ), isDefault: true, - attributes: { + attributes: { mediaPosition: 'right' } } @@ -125,20 +125,53 @@ The solution is to unregister the other variation before registering your variat ## Using `isActive` -While the `isActive` property is optional, you will often want to use it to display information about the block variation after the block has been inserted. For example, this API is used in `useBlockDisplayInformation` hook to fetch and display proper information in places like the `BlockCard` or `Breadcrumbs` components. +While the `isActive` property is optional, it's recommended. This API is used by the block editor to check which variation is active, and display the correct variation's title, icon and description when an instance of the variation is selected in the editor. + +If `isActive` is not set, the Editor cannot distinguish between an instance of the original block and your variation, so the original block information will be displayed. + +The property can be set to either a function or an array of strings (`string[]`). -If `isActive` is not set, the Editor cannot distinguish between the original block and your variation, so the original block information will be displayed. +The function version of this property accepts a block instance's `blockAttributes` as the first argument, and the `variationAttributes` declared for a variation as the second argument. These arguments can be used to determine if a variation is active by comparing them and returning a `true` or `false` (indicating whether this variation is inactive for this block instance). -The property can use either a function or an array of strings (`string[]`). The function accepts `blockAttributes` and `variationAttributes`, which can be used to determine if a variation is active. In the Embed block, the primary differentiator is the `providerNameSlug` attribute, so if you wanted to determine if the YouTube Embed variation was active, you could do something like this: +As an example, in the core Embed block, the `providerNameSlug` attribute is used to determine the embed provider (e.g. 'youtube' or 'twitter'). The variations may be declared like this: +```js +const variations = [ + { + name: 'twitter', + title: 'Twitter', + icon: embedTwitterIcon, + keywords: [ 'tweet', __( 'social' ) ], + description: __( 'Embed a tweet.' ), + patterns: [ /^https?:\/\/(www\.)?twitter\.com\/.+/i ], + attributes: { providerNameSlug: 'twitter', responsive: true }, + }, + { + name: 'youtube', + title: 'YouTube', + icon: embedYouTubeIcon, + keywords: [ __( 'music' ), __( 'video' ) ], + description: __( 'Embed a YouTube video.' ), + patterns: [ + /^https?:\/\/((m|www)\.)?youtube\.com\/.+/i, + /^https?:\/\/youtu\.be\/.+/i, + ], + attributes: { providerNameSlug: 'youtube', responsive: true }, + }, + // ... +] ``` + + The `isActive` function can compare the block instance value for `providerNameSlug` to the value declared in the variation's declaration (the values in the code snippet above) to determine which embed variation is active: + +```js isActive: ( blockAttributes, variationAttributes ) => blockAttributes.providerNameSlug === variationAttributes.providerNameSlug, ``` -You can also use a `string[]` to tell which attributes should be compared as a shorthand. Each attribute will be checked and the variation will be active if all of them match. Using the same example of the YouTube Embed variation, the string version would look like this: +The `string[]` version is used to declare which attributes should be compared as a shorthand. Each attribute will be checked and the variation will be active if all of them match. Using the same example for the embed block, the string version would look like this: -``` +```js isActive: [ 'providerNameSlug' ] ``` @@ -175,4 +208,4 @@ wp.blocks.registerBlockVariation( The `isActive` check on both variations tests the `textColor`, but each variations uses `vivid-red`. Since the `paragraph-red` variation is registered first, once the `paragraph-red-grey` variation is inserted into the Editor, it will have the title `Red Paragraph` instead of `Red/Grey Paragraph`. As soon as the Editor finds a match, it stops checking. -There have been [discussions](https://github.com/WordPress/gutenberg/issues/41303#issuecomment-1526193087) around how the API can be improved, but as of WordPress 6.3, this remains an issue to watch out for. \ No newline at end of file +There have been [discussions](https://github.com/WordPress/gutenberg/issues/41303#issuecomment-1526193087) around how the API can be improved, but as of WordPress 6.3, this remains an issue to watch out for. diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 3ca3ffddaa9c79..c08869db34b484 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -51,7 +51,7 @@ Prompt visitors to take action with a button-style link. ([Source](https://githu - **Name:** core/button - **Category:** design - **Parent:** core/buttons -- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), shadow (), spacing (padding), typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), shadow (), spacing (padding), splitting, typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~ - **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, tagName, text, textAlign, textColor, title, type, url, width ## Buttons @@ -359,7 +359,7 @@ Introduce new sections and organize content to help visitors (and search engines - **Name:** core/heading - **Category:** text -- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight) +- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fontSize, lineHeight) - **Attributes:** content, level, placeholder, textAlign ## Home Link @@ -415,7 +415,7 @@ Create a bulleted or numbered list. ([Source](https://github.com/WordPress/guten - **Name:** core/list - **Category:** text - **Allowed Blocks:** core/list-item -- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ +- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** ordered, placeholder, reversed, start, type, values ## List item @@ -426,7 +426,7 @@ Create a list item. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/ - **Category:** text - **Parent:** core/list - **Allowed Blocks:** core/list -- **Supports:** interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ +- **Supports:** interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fontSize, lineHeight), ~~className~~ - **Attributes:** content, placeholder ## Login/out @@ -445,7 +445,7 @@ Set media and words side-by-side for a richer layout. ([Source](https://github.c - **Name:** core/media-text - **Category:** media - **Supports:** align (full, wide), anchor, color (background, gradients, heading, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** align, allowedBlocks, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment +- **Attributes:** align, allowedBlocks, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, useFeaturedImage, verticalAlignment ## Unsupported @@ -531,7 +531,7 @@ Start with the basic building block of all narrative. ([Source](https://github.c - **Name:** core/paragraph - **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ +- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), splitting, typography (fontSize, lineHeight), ~~className~~ - **Attributes:** align, content, direction, dropCap, placeholder ## Pattern placeholder @@ -642,7 +642,7 @@ Display a post's featured image. ([Source](https://github.com/WordPress/gutenber - **Name:** core/post-featured-image - **Category:** theme -- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), interactivity (clientNavigation), spacing (margin, padding), ~~html~~ +- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), filter (duotone), interactivity (clientNavigation), shadow (), spacing (margin, padding), ~~html~~ - **Attributes:** aspectRatio, customGradient, customOverlayColor, dimRatio, gradient, height, isLink, linkTarget, overlayColor, rel, scale, sizeSlug, useFirstImageFromPost, width ## Post Navigation Link @@ -847,7 +847,7 @@ Describe in a few words what the site is about. The tagline can be used in searc - **Name:** core/site-tagline - **Category:** theme - **Supports:** align (full, wide), color (background, gradients, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Attributes:** level, textAlign ## Site Title @@ -860,7 +860,7 @@ Displays the name of this site. Update the block, and the changes apply everywhe ## Social Icon -Display an icon linking to a social media profile or site. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-link)) +Display an icon linking to a social profile or site. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-link)) - **Name:** core/social-link - **Category:** widgets @@ -870,7 +870,7 @@ Display an icon linking to a social media profile or site. ([Source](https://git ## Social Icons -Display icons linking to your social media profiles or sites. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-links)) +Display icons linking to your social profiles or sites. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-links)) - **Name:** core/social-links - **Category:** widgets diff --git a/docs/reference-guides/data/data-core-edit-post.md b/docs/reference-guides/data/data-core-edit-post.md index 0401734597d248..e3fb22a1a7afe0 100644 --- a/docs/reference-guides/data/data-core-edit-post.md +++ b/docs/reference-guides/data/data-core-edit-post.md @@ -306,6 +306,8 @@ _Returns_ ### isPublishSidebarOpened +> **Deprecated** + Returns true if the publish sidebar is opened. _Parameters_ @@ -350,6 +352,8 @@ _Returns_ ### closePublishSidebar +> **Deprecated** + Returns an action object used in signalling that the user closed the publish sidebar. _Returns_ @@ -408,6 +412,8 @@ _Returns_ ### openPublishSidebar +> **Deprecated** + Returns an action object used in signalling that the user opened the publish sidebar. _Returns_ @@ -532,6 +538,8 @@ _Parameters_ ### togglePublishSidebar +> **Deprecated** + Returns an action object used in signalling that the user toggles the publish sidebar. _Returns_ diff --git a/docs/reference-guides/data/data-core-edit-site.md b/docs/reference-guides/data/data-core-edit-site.md index a2bc9ea1bfb968..1f050ca98576a3 100644 --- a/docs/reference-guides/data/data-core-edit-site.md +++ b/docs/reference-guides/data/data-core-edit-site.md @@ -371,7 +371,7 @@ Resolves the template for a page and displays both. If no path is given, attempt _Returns_ -- `number`: The resolved template ID for the page route. +- `Object`: Action object. ### setTemplate diff --git a/docs/reference-guides/data/data-core-editor.md b/docs/reference-guides/data/data-core-editor.md index 2c4185d3a998fe..a7b5d37da84643 100644 --- a/docs/reference-guides/data/data-core-editor.md +++ b/docs/reference-guides/data/data-core-editor.md @@ -1058,6 +1058,18 @@ _Returns_ - `boolean`: Whether the pre-publish panel should be shown or not. +### isPublishSidebarOpened + +Returns true if the publish sidebar is opened. + +_Parameters_ + +- _state_ `Object`: Global application state + +_Returns_ + +- `boolean`: Whether the publish sidebar is open. + ### isSavingNonPostEntityChanges Returns true if non-post entities are currently being saved, or false otherwise. @@ -1120,6 +1132,14 @@ _Related_ - clearSelectedBlock in core/block-editor store. +### closePublishSidebar + +Returns an action object used in signalling that the user closed the publish sidebar. + +_Returns_ + +- `Object`: Action object. + ### createUndoLevel > **Deprecated** Since WordPress 6.0 @@ -1273,6 +1293,14 @@ _Related_ - multiSelect in core/block-editor store. +### openPublishSidebar + +Returns an action object used in signalling that the user opened the publish sidebar. + +_Returns_ + +- `Object`: Action object + ### receiveBlocks _Related_ @@ -1415,7 +1443,6 @@ _Returns_ Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes: -- `all`: This is the default mode. It renders the post editor with all the features available. If a template is provided, it's preferred over the post. - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template. - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable. @@ -1523,6 +1550,14 @@ _Parameters_ - _panelName_ `string`: A string that identifies the panel to open or close. +### togglePublishSidebar + +Returns an action object used in signalling that the user toggles the publish sidebar. + +_Returns_ + +- `Object`: Action object + ### toggleSelection _Related_ diff --git a/docs/reference-guides/data/data-core-keyboard-shortcuts.md b/docs/reference-guides/data/data-core-keyboard-shortcuts.md index 613c5e009e8b07..d7d5cf853f7865 100644 --- a/docs/reference-guides/data/data-core-keyboard-shortcuts.md +++ b/docs/reference-guides/data/data-core-keyboard-shortcuts.md @@ -22,7 +22,7 @@ const ExampleComponent = () => { const allShortcutKeyCombinations = useSelect( ( select ) => select( keyboardShortcutsStore ).getAllShortcutKeyCombinations( - 'core/edit-post/next-region' + 'core/editor/next-region' ), [] ); @@ -77,7 +77,7 @@ const ExampleComponent = () => { const allShortcutRawKeyCombinations = useSelect( ( select ) => select( keyboardShortcutsStore ).getAllShortcutRawKeyCombinations( - 'core/edit-post/next-region' + 'core/editor/next-region' ), [] ); @@ -168,7 +168,7 @@ const ExampleComponent = () => { const shortcutAliases = useSelect( ( select ) => select( keyboardShortcutsStore ).getShortcutAliases( - 'core/edit-post/next-region' + 'core/editor/next-region' ), [] ); @@ -219,7 +219,7 @@ const ExampleComponent = () => { const shortcutDescription = useSelect( ( select ) => select( keyboardShortcutsStore ).getShortcutDescription( - 'core/edit-post/next-region' + 'core/editor/next-region' ), [] ); @@ -256,7 +256,7 @@ const ExampleComponent = () => { const { character, modifier } = useSelect( ( select ) => select( keyboardShortcutsStore ).getShortcutKeyCombination( - 'core/edit-post/next-region' + 'core/editor/next-region' ), [] ); @@ -302,16 +302,16 @@ const ExampleComponent = () => { const { display, raw, ariaLabel } = useSelect( ( select ) => { return { display: select( keyboardShortcutsStore ).getShortcutRepresentation( - 'core/edit-post/next-region' + 'core/editor/next-region' ), raw: select( keyboardShortcutsStore ).getShortcutRepresentation( - 'core/edit-post/next-region', + 'core/editor/next-region', 'raw' ), ariaLabel: select( keyboardShortcutsStore ).getShortcutRepresentation( - 'core/edit-post/next-region', + 'core/editor/next-region', 'ariaLabel' ), }; @@ -410,13 +410,13 @@ const ExampleComponent = () => { const { unregisterShortcut } = useDispatch( keyboardShortcutsStore ); useEffect( () => { - unregisterShortcut( 'core/edit-post/next-region' ); + unregisterShortcut( 'core/editor/next-region' ); }, [] ); const shortcut = useSelect( ( select ) => select( keyboardShortcutsStore ).getShortcutKeyCombination( - 'core/edit-post/next-region' + 'core/editor/next-region' ), [] ); diff --git a/docs/reference-guides/data/data-core.md b/docs/reference-guides/data/data-core.md index b80703dcc67b18..88db705f23f122 100644 --- a/docs/reference-guides/data/data-core.md +++ b/docs/reference-guides/data/data-core.md @@ -150,7 +150,7 @@ _Parameters_ _Returns_ -- `undefined< 'edit' >`: Current user object. +- `ET.User< 'edit' >`: Current user object. ### getDefaultTemplateId @@ -178,7 +178,7 @@ _Parameters_ _Returns_ -- `undefined< EntityRecord > | undefined`: The entity record, merged with its edits. +- `ET.Updatable< EntityRecord > | false`: The entity record, merged with its edits. ### getEmbedPreview @@ -504,7 +504,7 @@ _Parameters_ _Returns_ -- `undefined< 'edit' >[]`: Users list. +- `ET.User< 'edit' >[]`: Users list. ### hasEditsForEntityRecord diff --git a/docs/reference-guides/filters/block-filters.md b/docs/reference-guides/filters/block-filters.md index 35a041052889c0..ee100431eb512e 100644 --- a/docs/reference-guides/filters/block-filters.md +++ b/docs/reference-guides/filters/block-filters.md @@ -1,61 +1,76 @@ # Block Filters -To modify the behavior of existing blocks, WordPress exposes several APIs. +WordPress exposes several APIs that allow you to modify the behavior of existing blocks. ## Registration -The following filters are available to extend the settings for blocks during their registration. +The following filters are available to extend block settings during their registration. ### `block_type_metadata` -Filters the raw metadata loaded from the `block.json` file when registering a block type on the server with PHP. It allows applying modifications before the metadata gets processed. +Filters the raw metadata loaded from the `block.json` file when registering a block type on the server with PHP. It allows modifications to be applied before the metadata gets processed. -The filter takes one param: +The filter takes one parameter: -- `$metadata` (`array`) – metadata loaded from `block.json` for registering a block type. +- `$metadata` (`array`) – metadata loaded from `block.json` for registering a block type. -_Example_: +The following example sets the `apiVersion` of all blocks to `2`. ```php - { @@ -218,11 +229,11 @@ const withMyPluginControls = createHigherOrderComponent( ( BlockEdit ) => { return ( <> - { props.isSelected && { + { props.isSelected && ( My custom control - }} + ) } ); }; @@ -233,7 +244,7 @@ const withMyPluginControls = createHigherOrderComponent( ( BlockEdit ) => { Used to modify the block's wrapper component containing the block's `edit` component and all toolbars. It receives the original `BlockListBlock` component and returns a new wrapped component. -_Example:_ +The following example adds a unique class name. ```js const { createHigherOrderComponent } = wp.compose; @@ -259,10 +270,7 @@ wp.hooks.addFilter( ); ``` -Adding new properties to the block's wrapper component can be achieved by adding them to the `wrapperProps` property of the returned component. - -_Example:_ - +You can add new properties to the block's wrapper component using the `wrapperProps` property of the returned component as shown in the following example. ```js const { createHigherOrderComponent } = wp.compose; @@ -275,6 +283,7 @@ const withMyWrapperProp = createHigherOrderComponent( ( BlockListBlock ) => { return ; }; }, 'withMyWrapperProp' ); + wp.hooks.addFilter( 'editor.BlockListBlock', 'my-plugin/with-my-wrapper-prop', @@ -282,13 +291,31 @@ wp.hooks.addFilter( ); ``` +### `editor.postContentBlockTypes` + +Used to modify the list of blocks that should be enabled even when used inside a locked template. Any block that saves data to a post should be added here. An example of this is the Post Featured Image block. Often used in templates, this block should still allow selecting the image even when the template is locked. + +The following example enables the fictitious block `namespace/example`. + +```js +const addExampleBlockToPostContentBlockTypes = ( blockTypes ) => { + return [ ...blockTypes, 'namespace/example' ]; +}; + +wp.hooks.addFilter( + 'editor.postContentBlockTypes', + 'my-plugin/post-content-block-types', + addExampleBlockToPostContentBlockTypes +); +``` ## Removing Blocks ### Using a deny list -Adding blocks is easy enough, removing them is as easy. Plugin or theme authors have the possibility to "unregister" blocks. +Adding blocks is easy enough, and removing them is as easy. Plugin or theme authors can "unregister" blocks using a deny list in JavaScript. +Place the following code in a `my-plugin.js` file. ```js // my-plugin.js @@ -300,8 +327,7 @@ domReady( function () { } ); ``` - -and load this script in the Editor +Then, load this script in the Editor using the following function. ```php + When unregistering a block, there can be a race condition on which code runs first: registering the block or unregistering the block. You want your unregister code to run last. To do this, you must specify the component that is registering the block as a dependency, in this case, wp-edit-post. Additionally, using wp.domReady() ensures the unregister code runs once the dom is loaded. + ### Using an allow list @@ -344,37 +372,37 @@ wp.blocks.getBlockTypes().forEach( function ( blockType ) { ### `allowed_block_types_all` -_**Note:** Before WordPress 5.8 known as `allowed_block_types`. In the case when you want to support older versions of WordPress you might need a way to detect which filter should be used – the deprecated one vs the new one. The recommended way to proceed is to check if the `WP_Block_Editor_Context` class exists._ +
+ Before WordPress 5.8, this hook was known as allowed_block_types, which is now deprecated. If you need to support older versions of WordPress, you might need a way to detect which filter should be used. You can check if allowed_block_types is safe to use by seeing if the WP_Block_Editor_Context class exists, which was introduced in 5.8. +
-On the server, you can filter the list of blocks shown in the inserter using the `allowed_block_types_all` filter. You can return either true (all block types supported), false (no block types supported), or an array of block type names to allow. You can also use the second provided param `$editor_context` to filter block types based on its content. +On the server, you can filter the list of blocks shown in the inserter using the `allowed_block_types_all` filter. You can return either true (all block types supported), false (no block types supported), or an array of block type names to allow. You can also use the second provided parameter `$editor_context` to filter block types based on their content. ```php post ) ) { return array( 'core/paragraph', 'core/heading' ); } return $allowed_block_types; } - -add_filter( 'allowed_block_types_all', 'wpdocs_filter_allowed_block_types_when_post_provided', 10, 2 ); +add_filter( 'allowed_block_types_all', 'example_filter_allowed_block_types_when_post_provided', 10, 2 ); ``` ## Managing block categories ### `block_categories_all` -_**Note:** Before WordPress 5.8 known as `block_categories`. In the case when you want to support older versions of WordPress you might need a way to detect which filter should be used – the deprecated one vs the new one. The recommended way to proceed is to check if the `WP_Block_Editor_Context` class exists._ +
+ Before WordPress 5.8, this hook was known as block_categories, which is now deprecated. If you need to support older versions of WordPress, you might need a way to detect which filter should be used. You can check if block_categories is safe to use by seeing if the WP_Block_Editor_Context class exists, which was introduced in 5.8. +
-It is possible to filter the list of default block categories using the `block_categories_all` filter. You can do it on the server by implementing a function which returns a list of categories. It is going to be used during blocks registration and to group blocks in the inserter. You can also use the second provided param `$editor_context` to filter the based on its content. +It is possible to filter the list of default block categories using the `block_categories_all` filter. You can do it on the server by implementing a function which returns a list of categories. It is going to be used during block registration and to group blocks in the inserter. You can also use the second provided parameter `$editor_context` to filter the based on its content. ```php -post ) ) { array_push( $block_categories, @@ -387,8 +415,7 @@ function wpdocs_filter_block_categories_when_post_provided( $block_categories, $ } return $block_categories; } - -add_filter( 'block_categories_all', 'wpdocs_filter_block_categories_when_post_provided', 10, 2 ); +add_filter( 'block_categories_all', 'example_filter_block_categories_when_post_provided', 10, 2 ); ``` ### `wp.blocks.updateCategory` diff --git a/docs/reference-guides/filters/editor-filters.md b/docs/reference-guides/filters/editor-filters.md index 943e161a1df49d..a27a989dbc7884 100644 --- a/docs/reference-guides/filters/editor-filters.md +++ b/docs/reference-guides/filters/editor-filters.md @@ -1,23 +1,166 @@ # Editor Hooks -To modify the behavior of the editor experience, WordPress exposes several APIs. +WordPress exposes several APIs that allow you to modify the editor experience. + +## Editor settings + +One of the most common ways to modify the Editor is through the [`block_editor_settings_all`](https://developer.wordpress.org/reference/hooks/block_editor_settings_all/) PHP filter, which is applied before settings are sent to the initialized Editor. This filter allows plugin and theme authors extensive control over how the Editor behaves. + +
+ Before WordPress 5.8, this hook was known as block_editor_settings, which is now deprecated. If you need to support older versions of WordPress, you might need a way to detect which filter should be used. You can check if block_editor_settings is safe to use by seeing if the WP_Block_Editor_Context class exists, which was introduced in 5.8. +
+ +The `block_editor_settings_all` hook passes two parameters to the callback function: + +- `$settings` – An array of configurable settings for the Editor. +- `$context` – An instance of [`WP_Block_Editor_Context`](https://developer.wordpress.org/reference/classes/wp_block_editor_context/), an object that contains information about the current Editor. + +The following example modifies the maximum upload file size. Add this to a plugin or your theme's `functions.php` file to test it. + +```php +add_filter( 'block_editor_settings_all', 'example_filter_block_editor_settings_when_post_provided', 10, 2 ); + +function example_filter_block_editor_settings_when_post_provided( $editor_settings, $editor_context ) { + if ( ! empty( $editor_context->post ) ) { + $editor_settings['maxUploadFileSize'] = 12345; + } + return $editor_settings; +} +``` + +There are dozens of editor settings, too many to list in this documentation article, but here are a few examples of what you can do with the `block_editor_settings_all` filter. + +
+ To view all available settings, open the Editor and then open the console in your browser's Developer Tools. Enter the command wp.data.select( 'core/block-editor' ).getSettings() to display the current values for all Editor settings. +
+ +### Restrict code editor access + +The `codeEditingEnabled`, which defaults to `true`, controls whether the user can access the code editor **in addition** to the visual editor. There may be instances where you don't want certain users to be able to access this view. + +If this setting is set to `false`, the user will not be able to switch between visual and code editor. The option in the settings menu will not be available, and the keyboard shortcut for switching editor types will not fire. Here's an example: + +```php +add_filter( 'block_editor_settings_all', 'example_restrict_code_editor' ); + +function example_restrict_code_editor( $settings ) { + $can_active_plugins = current_user_can( 'activate_plugins' ); + + // Disable the Code Editor for users that cannot activate plugins (Administrators). + if ( ! $can_active_plugins ) { + $settings[ 'codeEditingEnabled' ] = false; + } + + return $settings; +} +``` + +### Restrict visual editor access + +Similar to the `codeEditingEnabled` setting, `richEditingEnabled` allows you to control who can access the visual editor. If `true`, the user can edit the content using the visual editor. + +The setting defaults to the returned value of the [`user_can_richedit`](https://developer.wordpress.org/reference/functions/user_can_richedit/) function. It checks whether the user can access the visual editor and whether the user's browser supports it. + +### Set a default image size + +Images are set to the `large` image size by default in the Editor. You can modify this using the `imageDefaultSize` setting, which is especially useful if you have configured your own custom image sizes. The following example changes the default image size to `medium`. + +```php +add_filter( 'block_editor_settings_all', 'example_set_default_image_size' ); + +function example_set_default_image_size( $settings ) { + $settings['imageDefaultSize'] = 'medium'; + return $settings; +} +``` + +### Disable Openverse + +The [Openverse](https://openverse.org/) integration is enabled for all WordPress sites by default and is controlled by the `enableOpenverseMediaCategory` setting. To disable Openverse, apply the following filter: + +```php +add_filter( 'block_editor_settings_all', 'example_disable_openverse' ); + +function example_disable_openverse( $settings ) { + $settings['enableOpenverseMediaCategory'] = false; + return $settings; +} +``` + +### Disable the Font Library + +The Font Library allows users to install new fonts on their site, which is enabled by default and is controlled by the `fontLibraryEnabled` setting. To disable the Font Library, apply the following filter: + +```php +add_filter( 'block_editor_settings_all', 'example_disable_font_library' ); + +function example_disable_font_library( $settings ) { + $settings['fontLibraryEnabled'] = false; + return $settings; +} +``` + +### Disable block inspector tabs + +Most blocks display [two tabs](https://make.wordpress.org/core/2023/03/07/introduction-of-block-inspector-tabs/) in the Inspector, one for Settings and another for Styles. You can disable these tabs using the `blockInspectorTabs` setting. + +```php +add_filter( 'block_editor_settings_all', 'example_disable_inspector_tabs_by_default' ); + +function example_disable_inspector_tabs_by_default( $settings ) { + $settings['blockInspectorTabs'] = array( 'default' => false ); + return $settings; +} +``` + +You can also modify which blocks have inspector tabs. Here's an example that disables tabs for a specific block. + +```php +add_filter( 'block_editor_settings_all', 'example_disable_tabs_for_my_custom_block' ); + +function example_disable_tabs_for_my_custom_block( $settings ) { + $current_tab_settings = _wp_array_get( $settings, array( 'blockInspectorTabs' ), array() ); + $settings['blockInspectorTabs'] = array_merge( + $current_tab_settings, + array( 'my-plugin/my-custom-block' => false ) + ); + + return $settings; +} +``` + +## Block Directory + +The Block Directory allows users to install new block plugins directly in the Editor from the WordPress.org [Plugin Directory](https://wordpress.org/plugins/browse/block/). You can disable this functionality by removing the action that enqueues it, which is `wp_enqueue_editor_block_directory_assets`. To do so, use [`remove_action`](https://developer.wordpress.org/reference/functions/remove_action/) like this: + +```php +remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' ); +``` + +## Block patterns + +Remote patterns, such as those from the WordPress.org [Pattern Directory](https://wordpress.org/patterns/), are available to users by default in the Editor. This functionality is controlled by `should_load_remote_block_patterns`, which defaults to `true`. You can disable remote patterns by setting the filter to false (`__return_false`). + +```php +add_filter( 'should_load_remote_block_patterns', '__return_false' ); +``` ## Editor features -The following filters are available to extend the editor features. +The following filters are available to extend features in the Editor. ### `editor.PostFeaturedImage.imageSize` -Used to modify the image size displayed in the Post Featured Image component. It defaults to `'post-thumbnail'`, and will fail back to the `full` image size when the specified image size doesn't exist in the media object. It's modeled after the `admin_post_thumbnail_size` filter in the classic editor. - -_Example:_ +You can use this filter to modify the image size displayed in the Post Featured Image component. It defaults to `'post-thumbnail'` and will fail back to the `full` image size when the specified image size doesn't exist in the media object. It's modeled after the `admin_post_thumbnail_size` filter in the Classic Editor. ```js -var withImageSize = function ( size, mediaId, postId ) { +import { addFilter } from '@wordpress/hooks'; + +const withImageSize = function ( size, mediaId, postId ) { return 'large'; }; -wp.hooks.addFilter( +addFilter( 'editor.PostFeaturedImage.imageSize', 'my-plugin/with-image-size', withImageSize @@ -26,16 +169,16 @@ wp.hooks.addFilter( ### `editor.PostPreview.interstitialMarkup` -Filters the interstitial message shown when generating previews. - -_Example:_ +You can also filter the interstitial message shown when generating previews. Here's an example: ```js -var customPreviewMessage = function () { +import { addFilter } from '@wordpress/hooks'; + +const customPreviewMessage = function () { return 'Post preview is being generated!'; }; -wp.hooks.addFilter( +addFilter( 'editor.PostPreview.interstitialMarkup', 'my-plugin/custom-preview-message', customPreviewMessage @@ -44,13 +187,13 @@ wp.hooks.addFilter( ### `media.crossOrigin` -Used to set or modify the `crossOrigin` attribute for foreign-origin media elements (i.e `