diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 69fd34d709bdc5..1a2094cce578e8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,6 +2,9 @@ https://github.com/WordPress/gutenberg/blob/trunk/CONTRIBUTING.md --> ## What? + +Closes + ## Why? diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 76d1e45e3c6ce8..a3a2b1214f7835 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,16 +11,16 @@ updates: labels: - 'GitHub Actions' - '[Type] Build Tooling' + ignore: + - dependency-name: 'actions/setup-java' + versions: ['*'] + - dependency-name: 'gradle/*' + versions: ['*'] + - dependency-name: 'reactivecircus/*' + versions: ['*'] + - dependency-name: 'ruby/setup-ruby' + versions: ['*'] groups: github-actions: patterns: - '*' - exclude-patterns: - - 'actions/setup-java' - - 'gradle/*' - - 'reactivecircus/*' - react-native: - patterns: - - 'actions/setup-java' - - 'gradle/*' - - 'reactivecircus/*' diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml index 7ed57c5c5865ac..281146b63f2909 100644 --- a/.github/workflows/build-plugin-zip.yml +++ b/.github/workflows/build-plugin-zip.yml @@ -174,7 +174,7 @@ jobs: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Use desired version of Node.js - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: '.nvmrc' check-latest: true @@ -336,7 +336,7 @@ jobs: git config user.email gutenberg@wordpress.org - name: Setup Node.js - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: 'main/.nvmrc' registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml index 3d95e7aa92bc16..b967157836a4de 100644 --- a/.github/workflows/bundle-size.yml +++ b/.github/workflows/bundle-size.yml @@ -43,7 +43,7 @@ jobs: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Use desired version of Node.js - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: '.nvmrc' check-latest: true diff --git a/.github/workflows/publish-npm-packages.yml b/.github/workflows/publish-npm-packages.yml index 11cff85f4717a7..7a354ed819dfce 100644 --- a/.github/workflows/publish-npm-packages.yml +++ b/.github/workflows/publish-npm-packages.yml @@ -67,7 +67,7 @@ jobs: - name: Setup Node.js if: ${{ github.event.inputs.release_type != 'wp' }} - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: 'cli/.nvmrc' registry-url: 'https://registry.npmjs.org' @@ -75,7 +75,7 @@ jobs: - name: Setup Node.js (for WP major version) if: ${{ github.event.inputs.release_type == 'wp' && github.event.inputs.wp_version }} - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: 'publish/.nvmrc' registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index 855d8a3e5067a6..4d6b310e60f977 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -28,7 +28,7 @@ jobs: with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0 + - uses: ruby/setup-ruby@1287d2b408066abada82d5ad1c63652e758428d9 # v1.214.0 with: # `.ruby-version` file location working-directory: packages/react-native-editor/ios diff --git a/.github/workflows/stale-issue-gardening.yml b/.github/workflows/stale-issue-gardening.yml index c73fe7a19b24b3..6b8c7e82d1ca7b 100644 --- a/.github/workflows/stale-issue-gardening.yml +++ b/.github/workflows/stale-issue-gardening.yml @@ -36,7 +36,7 @@ jobs: steps: - name: Update issues - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: ${{ matrix.message }} diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml index baf97e8d390e91..9281158aab8331 100644 --- a/.github/workflows/static-checks.yml +++ b/.github/workflows/static-checks.yml @@ -27,7 +27,7 @@ jobs: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Use desired version of Node.js - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version-file: '.nvmrc' check-latest: true diff --git a/.github/workflows/upload-release-to-plugin-repo.yml b/.github/workflows/upload-release-to-plugin-repo.yml index 4d2b0a66a7e7d6..7d2c780599cddf 100644 --- a/.github/workflows/upload-release-to-plugin-repo.yml +++ b/.github/workflows/upload-release-to-plugin-repo.yml @@ -167,6 +167,10 @@ jobs: VERSION: ${{ github.event.release.name }} steps: + - name: Install Subversion + run: | + sudo apt-get update -y && sudo apt-get install -y subversion + - name: Check out Gutenberg trunk from WP.org plugin repo run: | svn checkout "$PLUGIN_REPO_URL/trunk" --username "$SVN_USERNAME" --password "$SVN_PASSWORD" @@ -222,6 +226,10 @@ jobs: VERSION: ${{ github.event.release.name }} steps: + - name: Install Subversion + run: | + sudo apt-get update -y && sudo apt-get install -y subversion + - name: Download and unzip Gutenberg plugin asset into tags folder env: PLUGIN_URL: ${{ github.event.release.assets[0].browser_download_url }} diff --git a/backport-changelog/6.8/7488.md b/backport-changelog/6.8/7488.md deleted file mode 100644 index a588bef0e01796..00000000000000 --- a/backport-changelog/6.8/7488.md +++ /dev/null @@ -1,3 +0,0 @@ -https://github.com/WordPress/wordpress-develop/pull/7488 - -* https://github.com/WordPress/gutenberg/pull/60622 \ No newline at end of file diff --git a/backport-changelog/6.8/7498.md b/backport-changelog/6.8/7498.md deleted file mode 100644 index 6c903246166b64..00000000000000 --- a/backport-changelog/6.8/7498.md +++ /dev/null @@ -1,3 +0,0 @@ -https://github.com/WordPress/wordpress-develop/pull/7498 - -* https://github.com/WordPress/gutenberg/pull/60622 \ No newline at end of file diff --git a/backport-changelog/6.8/7903.md b/backport-changelog/6.8/7903.md index cb20d8d2dd2b1b..60703831a8e391 100644 --- a/backport-changelog/6.8/7903.md +++ b/backport-changelog/6.8/7903.md @@ -1,3 +1,5 @@ https://github.com/WordPress/wordpress-develop/pull/7903 * https://github.com/WordPress/gutenberg/pull/67199 +* https://github.com/WordPress/gutenberg/pull/68971 + diff --git a/backport-changelog/6.8/8123.md b/backport-changelog/6.8/8123.md index bfb291a55f15e9..7955ec77416853 100644 --- a/backport-changelog/6.8/8123.md +++ b/backport-changelog/6.8/8123.md @@ -1,3 +1,4 @@ https://github.com/WordPress/wordpress-develop/pull/8123 * https://github.com/WordPress/gutenberg/pull/68549 +* https://github.com/WordPress/gutenberg/pull/68745 diff --git a/backport-changelog/6.8/8212.md b/backport-changelog/6.8/8212.md new file mode 100644 index 00000000000000..a4488d2da99f2b --- /dev/null +++ b/backport-changelog/6.8/8212.md @@ -0,0 +1,3 @@ +https://github.com/WordPress/wordpress-develop/pull/8212 + +* https://github.com/WordPress/gutenberg/pull/68926 diff --git a/backport-changelog/6.8/8228.md b/backport-changelog/6.8/8228.md new file mode 100644 index 00000000000000..0b3774ffffa5ba --- /dev/null +++ b/backport-changelog/6.8/8228.md @@ -0,0 +1,3 @@ +https://github.com/WordPress/wordpress-develop/pull/8228 + +* https://github.com/WordPress/gutenberg/pull/68970 diff --git a/backport-changelog/6.8/8245.md b/backport-changelog/6.8/8245.md new file mode 100644 index 00000000000000..ca9bc3588c5cec --- /dev/null +++ b/backport-changelog/6.8/8245.md @@ -0,0 +1,3 @@ +https://github.com/WordPress/wordpress-develop/pull/8245 + +* https://github.com/WordPress/gutenberg/pull/68983 diff --git a/backport-changelog/6.8/8265.md b/backport-changelog/6.8/8265.md new file mode 100644 index 00000000000000..46fa3f01810514 --- /dev/null +++ b/backport-changelog/6.8/8265.md @@ -0,0 +1,3 @@ +https://github.com/WordPress/wordpress-develop/pull/8265 + +* https://github.com/WordPress/gutenberg/pull/69057 diff --git a/backport-changelog/6.8/6910.md b/backport-changelog/6.9/6910.md similarity index 100% rename from backport-changelog/6.8/6910.md rename to backport-changelog/6.9/6910.md diff --git a/bin/generate-php-sync-issue.mjs b/bin/generate-php-sync-issue.mjs index bd627aeb65107c..9ea79c4f165e92 100644 --- a/bin/generate-php-sync-issue.mjs +++ b/bin/generate-php-sync-issue.mjs @@ -156,17 +156,6 @@ async function main() { fs.writeFileSync( nodePath.join( __dirname, 'issueContent.md' ), content ); } -/** - * Checks if the first date is after the second date. - * - * @param {string} date1 - The first date. - * @param {string} date2 - The second date. - * @return {boolean} - Returns true if the first date is after the second date, false otherwise. - */ -function isAfter( date1, date2 ) { - return new Date( date1 ) > new Date( date2 ); -} - function validateDate( sinceArg ) { const sinceDate = new Date( sinceArg ); const maxPreviousDate = new Date(); diff --git a/changelog.txt b/changelog.txt index fa1e1cdcb6a0c7..e791d102a6b773 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,159 @@ == Changelog == -= 20.1.0-rc.1 = += 20.0.1 = +## Changelog + +### Bug Fixes + +- iAPI Router: add missing changelog entry for [#68923](https://github.com/WordPress/gutenberg/pull/68945) + + += 20.2.0 = + +## Changelog + +### Enhancements + +#### Block Library +- Details block: Add name attribute for exclusive accordion. ([56971](https://github.com/WordPress/gutenberg/pull/56971)) +- Details block: Add placeholder attribute. ([68917](https://github.com/WordPress/gutenberg/pull/68917)) +- Home Link: Enable all non-interactive formats. ([68737](https://github.com/WordPress/gutenberg/pull/68737)) +- Latest Comments: Refactor settings panel to use ToolsPanel. ([67951](https://github.com/WordPress/gutenberg/pull/67951)) +- Latest Post Block: Refactor settings panel to use ToolsPanel. ([67956](https://github.com/WordPress/gutenberg/pull/67956)) +- Read More: Refactor settings panel to use ToolsPanel. ([67925](https://github.com/WordPress/gutenberg/pull/67925)) +- Search Block: Refactoring settings panel. ([67907](https://github.com/WordPress/gutenberg/pull/67907)) +- Search Results Title Block: Add dropdown menu props to Tools Panel component. ([68763](https://github.com/WordPress/gutenberg/pull/68763)) +- Spacer: Add dropdown menu props to Tools Panel component. ([68761](https://github.com/WordPress/gutenberg/pull/68761)) +- Term List Block: Refactor settings panel to use ToolsPanel. ([67955](https://github.com/WordPress/gutenberg/pull/67955)) + +#### Design Tools +- Position: Refactor "Position" controls panel to use `ToolsPanel` instead of `PanelBody`. ([67967](https://github.com/WordPress/gutenberg/pull/67967)) +- Post-content block header color support. ([67783](https://github.com/WordPress/gutenberg/pull/67783)) + +#### Block Editor +- Improve grid visualizer resize observation. ([68842](https://github.com/WordPress/gutenberg/pull/68842)) + +#### Style Book +- Navigation Submenu Block: Add example preview. ([68378](https://github.com/WordPress/gutenberg/pull/68378)) + + +### Bug Fixes + +- Fix: Invalid `_doing_it_wrong()` for `experimental-link-color`. ([68408](https://github.com/WordPress/gutenberg/pull/68408)) + +#### Block Library +- Archives Block: Fix reset button display state. ([68757](https://github.com/WordPress/gutenberg/pull/68757)) +- Fix: Add `rel="tag"` to individual anchor links in editor markup of the post terms block. ([68722](https://github.com/WordPress/gutenberg/pull/68722)) +- Fix: Linked featured image block cannot be selected correctly. ([68775](https://github.com/WordPress/gutenberg/pull/68775)) +- Page List Block: Fix empty settings panel. ([68756](https://github.com/WordPress/gutenberg/pull/68756)) +- Post Date Block: Fix reset button display state. ([68758](https://github.com/WordPress/gutenberg/pull/68758)) +- Query Page Numbers Block: Fix reset button display state. ([68759](https://github.com/WordPress/gutenberg/pull/68759)) +- Spacer block: Fix dimension control when no spacing presets are available. ([68818](https://github.com/WordPress/gutenberg/pull/68818)) +- Spacer: Fix flex layout unit reset. ([68815](https://github.com/WordPress/gutenberg/pull/68815)) +- `Spacer`: Fix changes being marked as persistent to `undo`. ([68869](https://github.com/WordPress/gutenberg/pull/68869)) + +#### Patterns +- Editor: Improve conditions for displaying new page assembler. ([68852](https://github.com/WordPress/gutenberg/pull/68852)) + +#### Style Book +- Disable the device preview button in the header. ([68841](https://github.com/WordPress/gutenberg/pull/68841)) + +#### Block Editor +- Fix block color contrast checker. ([68799](https://github.com/WordPress/gutenberg/pull/68799)) + +#### DataViews +- Fixed Incorrect Text Position issue in Dataviews. ([68767](https://github.com/WordPress/gutenberg/pull/68767)) + +#### Block Transforms +- Embed: Remove aspect ratio classes when transforming into Paragraph. ([68721](https://github.com/WordPress/gutenberg/pull/68721)) + +#### Media +- Upload Media: Fix package dependencies. ([68718](https://github.com/WordPress/gutenberg/pull/68718)) + + +### Accessibility + +#### Block Library +- Navigation Link: Improve accessibility by removing non-interactive tooltips. ([68628](https://github.com/WordPress/gutenberg/pull/68628)) +- Use the term menu instead of navigation in nav elements labels. ([68683](https://github.com/WordPress/gutenberg/pull/68683)) + +#### Post Editor +- Update text description of the "Contain text cursor inside block" preference. ([68132](https://github.com/WordPress/gutenberg/pull/68132)) + + +### Performance + +#### Block Editor +- Fix 'isBlockVisibleInTheInserter' selector helper performance. ([68898](https://github.com/WordPress/gutenberg/pull/68898)) + +#### Block Library +- Paragraph: Use CSS to hide placeholders in Zoom out mode. ([68690](https://github.com/WordPress/gutenberg/pull/68690)) + + +### Documentation + +- Block Editor: Add documentation for SpacingSizesControl component. ([68581](https://github.com/WordPress/gutenberg/pull/68581)) +- Changed Inline Documentation Order. ([68879](https://github.com/WordPress/gutenberg/pull/68879)) +- Docs: Update links to HTTPS. ([68888](https://github.com/WordPress/gutenberg/pull/68888)) +- Lint: Fix broken URL reference for `stylelint` user guide configuration. ([68706](https://github.com/WordPress/gutenberg/pull/68706)) +- Updated Typo in Constants.js. ([68765](https://github.com/WordPress/gutenberg/pull/68765)) +- Used https in main-dashboard-button.md file. ([68883](https://github.com/WordPress/gutenberg/pull/68883)) +- wp-env: Add phpMyAdmin and multisite support to the documentation. ([68125](https://github.com/WordPress/gutenberg/pull/68125)) + + +### Code Quality + +- Inline Commenting: Change the PHP compat directory. ([68846](https://github.com/WordPress/gutenberg/pull/68846)) +- Fix: Remove invalid param from wp_register_style() in gutenberg_enqueue_stored_styles(). ([68409](https://github.com/WordPress/gutenberg/pull/68409)) +- Fix: setcookie() $value must be string in Gutenberg_HTTP_Signaling_Server::Handle_read_pending_messages(). ([68411](https://github.com/WordPress/gutenberg/pull/68411)) + +#### Block Library +- Gallery: Remove unused inline menu styles. ([68776](https://github.com/WordPress/gutenberg/pull/68776)) +- Move HTML element help messages to the block library utils. ([68708](https://github.com/WordPress/gutenberg/pull/68708)) +- Navigation Submenu: Classname trailing spaces. ([68880](https://github.com/WordPress/gutenberg/pull/68880)) +- Unify block title with a strict title case. ([51912](https://github.com/WordPress/gutenberg/pull/51912)) +- Video: Fix react component warning error. ([68762](https://github.com/WordPress/gutenberg/pull/68762)) + +#### Post Editor +- Editor: Children prop to accept `ReactNode`. ([68839](https://github.com/WordPress/gutenberg/pull/68839)) +- Editor: Combine selectors in the 'Header' component. ([68697](https://github.com/WordPress/gutenberg/pull/68697)) +- Editor: Standardize reduced motion handling using media queries. ([68424](https://github.com/WordPress/gutenberg/pull/68424)) + +#### Components +- Box Control: Add Runtime Check & Conditional Types for `presets` and `presetKey` Props. ([68385](https://github.com/WordPress/gutenberg/pull/68385)) +- Remove unnecessary `Tooltip` component from linked `button`. ([68498](https://github.com/WordPress/gutenberg/pull/68498)) + +#### Block Editor +- Clean up unused utils of spacing size control. ([68794](https://github.com/WordPress/gutenberg/pull/68794)) + +#### Template Editor +- Editor: Update post-type support key for new default rendering mode. ([68745](https://github.com/WordPress/gutenberg/pull/68745)) + + +### Tools + +#### Build Tooling +- Fix Duplicate Entries for 19.7.0 in changelog.txt. ([68836](https://github.com/WordPress/gutenberg/pull/68836)) +- Release Workflow: Install Subversion. ([68837](https://github.com/WordPress/gutenberg/pull/68837)) + +#### Testing +- E2E: Fix WP Editor Meta Boxes test. ([68872](https://github.com/WordPress/gutenberg/pull/68872)) + +#### Env +- Add WP_ENV_MULTISITE envoriment variable. ([68792](https://github.com/WordPress/gutenberg/pull/68792)) + + +## Contributors + +The following contributors merged PRs in this release: + +@afercia @benazeer-ben @fabiankaegy @himanshupathak95 @im3dabasia @Infinite-Null @justlevine @karthick-murugan @Mamaduka @Mayank-Tripathi32 @SainathPoojary @shail-mehta @shimotmk @Soean @spacedmonkey @stokesman @Sukhendu2002 @t-hamano @yogeshbhutkar + + + + += 20.1.0 = ## Changelog @@ -205,6 +357,8 @@ The following contributors merged PRs in this release: @afercia @AhmarZaidi @atachibana @benazeer-ben @carolinan @ciampo @dhananjaykuber @ellatrix @geriux @himanipanchal @himanshupathak95 @im3dabasia @Infinite-Null @jeryj @jorgefilipecosta @juanfra @justlevine @karthick-murugan @luisherranz @Mamaduka @manzoorwanijk @mirka @ramonjd @SainathPoojary @shail-mehta @shimotmk @sirreal @stokesman @Sukhendu2002 @szepeviktor @t-hamano @vipul0425 @Vrishabhsk @yogeshbhutkar + + = 20.0.0 = ## Changelog @@ -1833,298 +1987,6 @@ The following contributors merged PRs in this release: @aaronrobertshaw @afercia @ajlende @akasunil @AKSHAT2802 @benazeer-ben @benniledl @carolinan @cbravobernal @desrosj @dhruvang21 @dougwollison @ellatrix @getdave @gigitux @gziolo @hbhalodia @himanshupathak95 @Infinite-Null @jeryj @jsnajdr @juanfra @louwie17 @Mamaduka @manzoorwanijk @matiasbenedetto @mcsf @michalczaplinski @miminari @mirka @ndiego @ntsekouras @oandregal @ockham @PARTHVATALIYA @ramonjd @SainathPoojary @SantosGuillamot @sarthaknagoshe2002 @snehapatil2001 @Soean @Sukhendu2002 @t-hamano @talldan @tellthemachines @TylerB24890 @tyxla @up1512001 @vipul0425 @yogeshbhutkar @youknowriad - -= 19.7.0 = - -## Changelog - -### Enhancements - -- Add "show template" to preview dropdown. ([66514](https://github.com/WordPress/gutenberg/pull/66514)) -- Iframe: Always enable for block themes, in core too. ([66800](https://github.com/WordPress/gutenberg/pull/66800)) -- Media Utils: Add experimental `sideloadMedia`. ([66378](https://github.com/WordPress/gutenberg/pull/66378)) -- Post fields: Clean up. ([66941](https://github.com/WordPress/gutenberg/pull/66941)) -- Post fields: Extract `title` from `edit-site` to `fields` package. ([66940](https://github.com/WordPress/gutenberg/pull/66940)) -- Post fields: Move `comment_status` from edit-site to fields package. ([66934](https://github.com/WordPress/gutenberg/pull/66934)) -- Post fields: Move `date` fields from `edit-site` to `fields` package. ([66938](https://github.com/WordPress/gutenberg/pull/66938)) -- Post fields: Move `status` from `edit-site` to `fields`. ([66937](https://github.com/WordPress/gutenberg/pull/66937)) -- Relocate “View” external link to end of editor header controls. ([66785](https://github.com/WordPress/gutenberg/pull/66785)) - -#### Block Library -- Added toggle control to set any image as feature image if no feature image is set for post. ([65896](https://github.com/WordPress/gutenberg/pull/65896)) -- Improve cover z-index solution. ([66249](https://github.com/WordPress/gutenberg/pull/66249)) -- Post Content: Add border and spacing support. ([66366](https://github.com/WordPress/gutenberg/pull/66366)) -- Query Loop: Use templateSlug and postType for more context. ([65820](https://github.com/WordPress/gutenberg/pull/65820)) -- Update text case of "Starter Content". ([66954](https://github.com/WordPress/gutenberg/pull/66954)) -- [Details Block]: Adds anchor support in details block. ([66734](https://github.com/WordPress/gutenberg/pull/66734)) - -#### Components -- Guide: Use small size button for page controls. ([66607](https://github.com/WordPress/gutenberg/pull/66607)) -- MenuItem: Add 40px size prop on Button. ([66596](https://github.com/WordPress/gutenberg/pull/66596)) -- Notice: Add appropriate size props to Buttons. ([66593](https://github.com/WordPress/gutenberg/pull/66593)) -- PaletteEdit: Add appropriate size props to Buttons. ([66590](https://github.com/WordPress/gutenberg/pull/66590)) -- Popover: Add small size prop to close button. ([66587](https://github.com/WordPress/gutenberg/pull/66587)) - -#### Global Styles -- Global styles revisions: Move focus and active state to list item. ([66780](https://github.com/WordPress/gutenberg/pull/66780)) -- Site editor: Integrate global styles controls and style book preview into the styles panel. ([65619](https://github.com/WordPress/gutenberg/pull/65619)) - -#### DataViews -- DataViews Fields API: Default getValueFromId supports nested objects. ([66890](https://github.com/WordPress/gutenberg/pull/66890)) - -#### Block Editor -- Inserter: Add 'Starter Content' category to the inserter. ([66819](https://github.com/WordPress/gutenberg/pull/66819)) - -#### Zoom Out -- Enable zoom out mode for non-iframe editor. ([66789](https://github.com/WordPress/gutenberg/pull/66789)) - -#### Themes -- Theme JSON Resolver: Remove theme json merge in resolve_theme_file_uris. ([66662](https://github.com/WordPress/gutenberg/pull/66662)) - -#### Edit Mode -- Image block: Add support for "more" dropdown for additional tools in Write mode. ([66605](https://github.com/WordPress/gutenberg/pull/66605)) - -#### Style Book -- Add a landing section to stylebook tabs. ([66545](https://github.com/WordPress/gutenberg/pull/66545)) - -#### Media -- Media Library: Expose filters dropdown for individual images, such as with the Image block. ([65965](https://github.com/WordPress/gutenberg/pull/65965)) - - -### Bug Fixes - -- Block toolbar: Restrict visible child calculation to known blocks. ([66702](https://github.com/WordPress/gutenberg/pull/66702)) -- ComplementaryArea: Fix button position. ([66677](https://github.com/WordPress/gutenberg/pull/66677)) -- Fix Paragraph appender layout shift (building on 66061). ([66779](https://github.com/WordPress/gutenberg/pull/66779)) -- Fix: Set the `fit-content` width for images that are not `.svg`. ([66643](https://github.com/WordPress/gutenberg/pull/66643)) -- Preference modal: Avoid fetching all reusable blocks when the site editor loads. ([66621](https://github.com/WordPress/gutenberg/pull/66621)) -- Revert "Set image width to `fit-content` to solve aspect ratio problems in Firefox. (#66217)". ([66804](https://github.com/WordPress/gutenberg/pull/66804)) -- Safari: Fix site editor template error. ([66647](https://github.com/WordPress/gutenberg/pull/66647)) -- Safari: Prevent focus capturing caused by flex display. ([66402](https://github.com/WordPress/gutenberg/pull/66402)) -- Select Mode: Hide tool selector in the post editor and force design mode. ([66784](https://github.com/WordPress/gutenberg/pull/66784)) -- Shadow panel: Make the delete modal text translatable. ([66712](https://github.com/WordPress/gutenberg/pull/66712)) -- Site Editor: Fix template for page-on-front option. ([66739](https://github.com/WordPress/gutenberg/pull/66739)) -- WP Scripts: Make watch mode more resilient for developer errors. ([66752](https://github.com/WordPress/gutenberg/pull/66752)) -- getDefaultTemplateId: Ensure entity configuration is loaded. ([66650](https://github.com/WordPress/gutenberg/pull/66650)) -- Comments controller: fix issue where comments are allowed when closed (https://github.com/WordPress/gutenberg/pull/66976) - -#### Block Library -- Cover: Fix media library image selection. ([66782](https://github.com/WordPress/gutenberg/pull/66782)) -- Cover: Show DropZone only when dragging withing the block. ([66912](https://github.com/WordPress/gutenberg/pull/66912)) -- Media & Text: Set `.wp-block-media-text__media a` display to block. ([66915](https://github.com/WordPress/gutenberg/pull/66915)) -- Prevent duplicate post format taxonomy queries. ([66627](https://github.com/WordPress/gutenberg/pull/66627)) -- Query Loop: Check for postTypeFromContext before using it. ([66655](https://github.com/WordPress/gutenberg/pull/66655)) -- Query Loop: Remove postTypeFromContext. ([66681](https://github.com/WordPress/gutenberg/pull/66681)) - -#### Block Editor -- Appender: Fix initial position. ([66711](https://github.com/WordPress/gutenberg/pull/66711)) -- Appender: Fix outside canvas styles. ([66630](https://github.com/WordPress/gutenberg/pull/66630)) -- Block Inspector: Restore bottom margin for RadioControl. ([66688](https://github.com/WordPress/gutenberg/pull/66688)) -- Iframed editor: Fix relative wp-content URLs. ([66751](https://github.com/WordPress/gutenberg/pull/66751)) - -#### Global Styles -- Section Styles: Fix insecure properties removal for inner block types and elements. ([66896](https://github.com/WordPress/gutenberg/pull/66896)) -- Style book: Reduce margin selector specificity so that it doesn't override global block styles. ([66895](https://github.com/WordPress/gutenberg/pull/66895)) -- Theme JSON: Replace top-level background style objects on merge. ([66656](https://github.com/WordPress/gutenberg/pull/66656)) - -#### Components -- FormTokenField: Fix token styles. ([66640](https://github.com/WordPress/gutenberg/pull/66640)) -- Storybook: Fix DataViews action modals. ([66727](https://github.com/WordPress/gutenberg/pull/66727)) -- ToggleGroupControl: Fix active background for `zero` value. ([66855](https://github.com/WordPress/gutenberg/pull/66855)) - -#### Post Editor -- Disable device preview button in pattern/template part/navitation editor. ([65970](https://github.com/WordPress/gutenberg/pull/65970)) -- PostTaxonomiesFlatTermSelector: Abstract wrapper component. ([66625](https://github.com/WordPress/gutenberg/pull/66625)) -- VisualEditor: Always output has-global-padding classname when in post only mode. ([66626](https://github.com/WordPress/gutenberg/pull/66626)) - -#### DataViews -- Fix TypeError when duplicating uncategorized theme patterns. ([66889](https://github.com/WordPress/gutenberg/pull/66889)) -- Tweak primary field in patterns grid layout. ([66733](https://github.com/WordPress/gutenberg/pull/66733)) - -#### Meta Boxes -- Fix: Show Meta Boxes at the bottom of the screen regardless of the current rendering mode. ([66508](https://github.com/WordPress/gutenberg/pull/66508)) -- Hide metaboxes in Zoom Out. ([66886](https://github.com/WordPress/gutenberg/pull/66886)) - -#### Site Editor -- DataViews: Fix 'aria-label' for pattern preview element. ([66601](https://github.com/WordPress/gutenberg/pull/66601)) -- Site Hub: Fixed navigation redirect on mobile devices for classic themes. ([66867](https://github.com/WordPress/gutenberg/pull/66867)) - -#### Media -- Add `x-wav` mime type for wav files in Firefox. ([66850](https://github.com/WordPress/gutenberg/pull/66850)) -- Ensure HEIC files selectable from “Upload” button. ([66292](https://github.com/WordPress/gutenberg/pull/66292)) - -#### Patterns -- Fix uncategorized pattern browsing when pattern has no categories. ([66945](https://github.com/WordPress/gutenberg/pull/66945)) - -#### Interactivity API -- Fix property modification from inherited context two or more levels above. ([66872](https://github.com/WordPress/gutenberg/pull/66872)) - -#### Block API -- Process Block Type: Copy deprecation to a new object instead of mutating when stabilizing supports. ([66849](https://github.com/WordPress/gutenberg/pull/66849)) - -#### Design Tools -- Block Gap: Fix block spacing control for axial gap supported blocks. ([66783](https://github.com/WordPress/gutenberg/pull/66783)) - -#### Document Settings -- Editor: Restore the 'PluginPostStatusInfo' slot position. ([66665](https://github.com/WordPress/gutenberg/pull/66665)) - -#### Templates API -- Fix flash when clicking template name in the editor when a plugin registered template matches a default WP theme template. ([66359](https://github.com/WordPress/gutenberg/pull/66359)) - -#### Block bindings -- Fix unset array key warning in block-bindings.php. ([66337](https://github.com/WordPress/gutenberg/pull/66337)) - - -### Accessibility - -- Fix : Snackbar Notice Inconsistency. ([66405](https://github.com/WordPress/gutenberg/pull/66405)) -- Image: Add `aria-haspopup` prop write mode `more` tools menu items. ([66815](https://github.com/WordPress/gutenberg/pull/66815)) -- Site Icon Focus fix. ([66952](https://github.com/WordPress/gutenberg/pull/66952)) - -#### Components -- Popover: Fix missing label of the headerTitle Close button. ([66813](https://github.com/WordPress/gutenberg/pull/66813)) - -#### Post Editor -- Fix inconsistent sidebars close buttons sizes. ([66756](https://github.com/WordPress/gutenberg/pull/66756)) - -#### Block Library -- Remove unnecessary tooltip from Video block Text tracks button. ([66716](https://github.com/WordPress/gutenberg/pull/66716)) - -#### Block Editor -- Speak 'Block moved up/down' after using keyboard actions to move up/down. ([64966](https://github.com/WordPress/gutenberg/pull/64966)) - -#### Patterns -- Block Patterns List: Fix visual title and tooltip inconsistencies. ([64815](https://github.com/WordPress/gutenberg/pull/64815)) - - -### Performance - -- Inline Commenting: Avoid querying comments on editor load. ([66670](https://github.com/WordPress/gutenberg/pull/66670)) -- Patterns: Receive intermediate responses while unbound request is resolving. ([66713](https://github.com/WordPress/gutenberg/pull/66713)) -- Perf metrics: Update select and other metrics to use non-empty paragraphs. ([66762](https://github.com/WordPress/gutenberg/pull/66762)) -- Site Editor: Preload settings requests. ([66488](https://github.com/WordPress/gutenberg/pull/66488)) -- Site Editor: Speed up load by preloading home and front-page templates. ([66579](https://github.com/WordPress/gutenberg/pull/66579)) -- Site editor: Preload post if needed. ([66631](https://github.com/WordPress/gutenberg/pull/66631)) - -#### Global Styles -- Preload user global styles based on user caps. ([66541](https://github.com/WordPress/gutenberg/pull/66541)) - - -### Experiments - -- Add `isVisible` option to fields within DataForm. ([65826](https://github.com/WordPress/gutenberg/pull/65826)) -- DataViews: Implement `isItemClickable` and `onClickItem` props. ([66365](https://github.com/WordPress/gutenberg/pull/66365)) - -#### DataViews -- Quick Edit - Slug Field: Improve slug preview. ([66559](https://github.com/WordPress/gutenberg/pull/66559)) -- QuickEdit: Add password field data to the pages quick edit. ([66567](https://github.com/WordPress/gutenberg/pull/66567)) - - -### Documentation - -- Add 6.6.2 to Version in WordPress. ([66870](https://github.com/WordPress/gutenberg/pull/66870)) -- Add missing properties for DataViews/DataForm components. ([66749](https://github.com/WordPress/gutenberg/pull/66749)) -- Add section about the Fields API. ([66761](https://github.com/WordPress/gutenberg/pull/66761)) -- Block Bindings: Documentation API reference. ([66251](https://github.com/WordPress/gutenberg/pull/66251)) -- Docs: Include a note about supported licenses in WordPress packages. ([66562](https://github.com/WordPress/gutenberg/pull/66562)) -- Document `filterSortAndPaginate` & `isItemValid` utilities. ([66738](https://github.com/WordPress/gutenberg/pull/66738)) -- Feat: Storybook: Improve component organisation - Navigation Category - Issue #66275. ([66658](https://github.com/WordPress/gutenberg/pull/66658)) -- Feat: Storybook: Improve component organisation - Overlays Category - Issue #66275. ([66657](https://github.com/WordPress/gutenberg/pull/66657)) -- Feat: Storybook: Improve component organisation - Selection & Input Category - Issue #66275. ([66660](https://github.com/WordPress/gutenberg/pull/66660)) -- Feat: Storybook: Improve component organisation - Typography - Issue #66275. ([66633](https://github.com/WordPress/gutenberg/pull/66633)) -- Improve readability of DataViews documentation. ([66766](https://github.com/WordPress/gutenberg/pull/66766)) -- Move documentation for filter operators to proper place. ([66743](https://github.com/WordPress/gutenberg/pull/66743)) -- Reorganize to bootstrap DataForm API section. ([66729](https://github.com/WordPress/gutenberg/pull/66729)) -- Storybook: Improve component organisation - Actions. ([66680](https://github.com/WordPress/gutenberg/pull/66680)) -- Storybook: Log `warning()` when in dev mode. ([66568](https://github.com/WordPress/gutenberg/pull/66568)) -- Update Commands documentation with the existing contexts. ([66860](https://github.com/WordPress/gutenberg/pull/66860)) - - -### Code Quality - -- BlockPatternsList: Use the Async component. ([66744](https://github.com/WordPress/gutenberg/pull/66744)) -- Core Commands: Fix add new post URL assignment. ([66830](https://github.com/WordPress/gutenberg/pull/66830)) -- Inline Commenting: Optimize store selector and misc changes. ([66592](https://github.com/WordPress/gutenberg/pull/66592)) -- Remove unnecessary boolean assignments. ([66857](https://github.com/WordPress/gutenberg/pull/66857)) -- TypeScript: Fix and improve types for private-apis. ([66667](https://github.com/WordPress/gutenberg/pull/66667)) - -#### Block Editor -- Fix 'useSelect' dependencies for the 'RichText' component. ([66964](https://github.com/WordPress/gutenberg/pull/66964)) -- Fix ESLint warning for 'useBlockTypesState' hook. ([66757](https://github.com/WordPress/gutenberg/pull/66757)) -- Fix React Compiler error for 'BlockProps' util component. ([66809](https://github.com/WordPress/gutenberg/pull/66809)) -- Optimize `getVisibleElementBounds` in scrollable cases. ([66546](https://github.com/WordPress/gutenberg/pull/66546)) -- Revert: Fix unable to remove empty blocks on merge (#65262) + alternative. ([66564](https://github.com/WordPress/gutenberg/pull/66564)) -- URLInput: Fix incorrect classname for suggestions. ([66714](https://github.com/WordPress/gutenberg/pull/66714)) - -#### Site Editor -- Avoid using edited entity state in site editor loading hook. ([66924](https://github.com/WordPress/gutenberg/pull/66924)) -- Avoid using edited post selectors in welcome guide. ([66926](https://github.com/WordPress/gutenberg/pull/66926)) -- Edit Site: Refactor to remove usage of edited entity state. ([66922](https://github.com/WordPress/gutenberg/pull/66922)) -- Edit Site: Remove leftover 'priority-queue' dependency. ([66773](https://github.com/WordPress/gutenberg/pull/66773)) -- Remove useEditedEntityRecord hook. ([66955](https://github.com/WordPress/gutenberg/pull/66955)) - -#### Components -- Fix React Compiler error for 'useScrollRectIntoView'. ([66498](https://github.com/WordPress/gutenberg/pull/66498)) -- Panel: Add 40px size prop to Button. ([66589](https://github.com/WordPress/gutenberg/pull/66589)) -- Radio: Deprecate 36px default size. ([66572](https://github.com/WordPress/gutenberg/pull/66572)) -- Snackbar: Use `link` variant for action Button. ([66560](https://github.com/WordPress/gutenberg/pull/66560)) - -#### Data Layer -- Convert the emitter module in data package to TS. ([66669](https://github.com/WordPress/gutenberg/pull/66669)) -- Data: Rename useSelect internals to fix React Compiler violations. ([66807](https://github.com/WordPress/gutenberg/pull/66807)) -- Data: Upgrade Redux to v5.0.1. ([66966](https://github.com/WordPress/gutenberg/pull/66966)) - -#### Post Editor -- ESLint: Fix React Compiler violations in various commands. ([66787](https://github.com/WordPress/gutenberg/pull/66787)) -- Fix TS types for editor package. ([66754](https://github.com/WordPress/gutenberg/pull/66754)) - -#### Zoom Out -- Zoom-out: Move default background to the iframe component. ([66284](https://github.com/WordPress/gutenberg/pull/66284)) - -#### Design Tools -- Typography: Stabilize typography block supports within block processing. ([63401](https://github.com/WordPress/gutenberg/pull/63401)) - - -### Tools - -#### Testing -- Media: Check for `wav` mime type using isset. ([66947](https://github.com/WordPress/gutenberg/pull/66947)) - -#### Build Tooling -- Enforce the same order of fields in `package.json` files. ([66239](https://github.com/WordPress/gutenberg/pull/66239)) -- Introduce React Scanner for component usage stats. ([65463](https://github.com/WordPress/gutenberg/pull/65463)) - - -### Various - -- Style engine: Wrap array_merge in conditionals to prevent unnecessary merging. ([66661](https://github.com/WordPress/gutenberg/pull/66661)) - -#### Block Library -- Update placeholder text for blocks that support drag and drop. ([66842](https://github.com/WordPress/gutenberg/pull/66842)) -- update: Add Media to Add media in cover block. ([66835](https://github.com/WordPress/gutenberg/pull/66835)) - - -## First-time contributors - -The following PRs were merged by first-time contributors: - -- @benharri: Fix unset array key warning in block-bindings.php. ([66337](https://github.com/WordPress/gutenberg/pull/66337)) -- @benniledl: Add 6.6.2 to Version in WordPress. ([66870](https://github.com/WordPress/gutenberg/pull/66870)) -- @Infinite-Null: Media & Text: Set `.wp-block-media-text__media a` display to block. ([66915](https://github.com/WordPress/gutenberg/pull/66915)) -- @karthick-murugan: Site Icon Focus fix. ([66952](https://github.com/WordPress/gutenberg/pull/66952)) -- @rinkalpagdar: Post Content: Add border and spacing support. ([66366](https://github.com/WordPress/gutenberg/pull/66366)) -- @yogeshbhutkar: Site Hub: Fixed navigation redirect on mobile devices for classic themes. ([66867](https://github.com/WordPress/gutenberg/pull/66867)) - - -## Contributors - -The following contributors merged PRs in this release: - -@aaronrobertshaw @adamsilverstein @afercia @Aljullu @amitraj2203 @andrewserong @benharri @benniledl @carolinan @cbravobernal @DAreRodz @dcalhoun @ellatrix @fabiankaegy @gigitux @gziolo @hbhalodia @Infinite-Null @jasmussen @jorgefilipecosta @jsnajdr @juanfra @karthick-murugan @kevin940726 @louwie17 @Mamaduka @manzoorwanijk @matiasbenedetto @mikachan @mirka @n2erjo00 @ntsekouras @oandregal @ramonjd @renatho @rinkalpagdar @Soean @stokesman @swissspidy @t-hamano @tellthemachines @tyxla @up1512001 @Vrishabhsk @yogeshbhutkar @youknowriad - - - - = 19.6.4 = - PostTaxonomiesFlatTermSelector: abstract wrapper component (#66625) @@ -5481,7 +5343,7 @@ The following contributors merged PRs in this release: - Fix: DataViews: Layout resets for patterns each time a new pattern category is selected. ([63711](https://github.com/WordPress/gutenberg/pull/63711)) - Fix: Inconsistent field spacing in Grid layout. ([63363](https://github.com/WordPress/gutenberg/pull/63363)) - Templates DataViews: Set the right context for the preview field. ([63488](https://github.com/WordPress/gutenberg/pull/63488)) -- +- #### Block Editor - Fix user patterns disabling sync filter. ([63828](https://github.com/WordPress/gutenberg/pull/63828)) - ImageURLInputUI: Make onSetLightbox and resetLightbox optional. ([63573](https://github.com/WordPress/gutenberg/pull/63573)) @@ -6364,7 +6226,7 @@ The following contributors merged PRs in this release: The following contributors merged PRs in this release: -@luisherranz @aaronjorbin @gziolo @westonruter @cbravobernal +@luisherranz @aaronjorbin @gziolo @westonruter @cbravobernal = 18.6.0 = diff --git a/docs/contributors/code/coding-guidelines.md b/docs/contributors/code/coding-guidelines.md index d8a5220c70ca24..e8e55921f56fae 100644 --- a/docs/contributors/code/coding-guidelines.md +++ b/docs/contributors/code/coding-guidelines.md @@ -607,7 +607,7 @@ Many third-party dependencies will distribute their own TypeScript typings. For If you use a [TypeScript integration](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Editor-Support) for your editor, you can typically see that this works if the type resolves to anything other than the fallback `any` type. -For packages which do not distribute their own TypeScript types, you are welcomed to install and use the [DefinitelyTyped](http://definitelytyped.org/) community-maintained types definitions, if one exists. +For packages which do not distribute their own TypeScript types, you are welcomed to install and use the [DefinitelyTyped](https://definitelytyped.org/) community-maintained types definitions, if one exists. ### Generic types diff --git a/docs/contributors/code/getting-started-with-code-contribution.md b/docs/contributors/code/getting-started-with-code-contribution.md index df6b305f35983e..9afcc3e46ca1bd 100644 --- a/docs/contributors/code/getting-started-with-code-contribution.md +++ b/docs/contributors/code/getting-started-with-code-contribution.md @@ -104,7 +104,9 @@ You can access the Dashboard at: `http://localhost:8888/wp-admin/` using **Usern #### Accessing the MySQL Database -To access the MySQL database on the `wp-env` instance you will first need the connection details. To do this: +phpMyAdmin is available by default for the Gutenberg project. You can access the MySQL Database at: `http://localhost:9000/`. + +If you want to access the database through another tool, you will first need the connection details. To do this: 1. In a terminal, navigate to your local Gutenberg repo. 2. Run `npm run wp-env start` - various information about the `wp-env` environment should be logged into the terminal. diff --git a/docs/contributors/code/testing-overview.md b/docs/contributors/code/testing-overview.md index 6afa5aed865b7d..8b487c00166350 100644 --- a/docs/contributors/code/testing-overview.md +++ b/docs/contributors/code/testing-overview.md @@ -29,7 +29,7 @@ Assuming you've followed the [instructions](/docs/contributors/code/getting-star npm test ``` -Linting is static code analysis used to enforce coding standards and to avoid potential errors. This project uses [ESLint](http://eslint.org/) and [TypeScript's JavaScript type-checking](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html) to capture these issues. While the above `npm test` will execute both unit tests and code linting, code linting can be verified independently by running `npm run lint`. Some JavaScript issues can be fixed automatically by running `npm run lint:js:fix`. +Linting is static code analysis used to enforce coding standards and to avoid potential errors. This project uses [ESLint](https://eslint.org/) and [TypeScript's JavaScript type-checking](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html) to capture these issues. While the above `npm test` will execute both unit tests and code linting, code linting can be verified independently by running `npm run lint`. Some JavaScript issues can be fixed automatically by running `npm run lint:js:fix`. To improve your developer workflow, you should setup an editor linting integration. See the [getting started documentation](/docs/contributors/code/getting-started-with-code-contribution.md) for additional information. diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 3b251813e41c0a..6a8f3255297c46 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -14,7 +14,7 @@ Display a date archive of your posts. ([Source](https://github.com/WordPress/gut - **Name:** core/archives - **Category:** widgets -- **Supports:** align, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** displayAsDropdown, showLabel, showPostCounts, type ## Audio @@ -78,7 +78,7 @@ Display a list of all terms of a given taxonomy. ([Source](https://github.com/Wo - **Name:** core/categories - **Category:** widgets -- **Supports:** align, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** displayAsDropdown, label, showEmpty, showHierarchy, showLabel, showOnlyTopLevel, showPostCounts, taxonomy ## Code @@ -255,7 +255,7 @@ Hide and show additional content. ([Source](https://github.com/WordPress/gutenbe - **Name:** core/details - **Category:** text - **Supports:** align (full, wide), anchor, color (background, gradients, link, text), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** allowedBlocks, showContent, summary +- **Attributes:** allowedBlocks, name, placeholder, showContent, summary ## Embed @@ -418,7 +418,7 @@ An organized collection of items displayed in a specific order. ([Source](https: - **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 +## List Item An individual item within a list. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list-item)) @@ -534,7 +534,7 @@ Start with the basic building block of all narrative. ([Source](https://github.c - **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 +## Pattern Placeholder Show a block pattern. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/pattern)) @@ -616,7 +616,7 @@ Displays the contents of a post or page. ([Source](https://github.com/WordPress/ - **Name:** core/post-content - **Category:** theme -- **Supports:** align (full, wide), background (backgroundImage, backgroundSize), color (background, gradients, link, text), dimensions (minHeight), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), background (backgroundImage, backgroundSize), color (background, gradients, heading, link, text), dimensions (minHeight), layout, spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ ## Date @@ -672,7 +672,7 @@ Post terms. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages - **Supports:** color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** prefix, separator, suffix, term, textAlign -## Time To Read +## Time to Read Show minutes required to finish reading the post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-time-to-read)) @@ -718,7 +718,7 @@ An advanced block that allows displaying post types based on different query par - **Supports:** align (full, wide), interactivity, layout, ~~html~~ - **Attributes:** enhancedPagination, namespace, query, queryId, tagName -## No results +## No Results Contains the block elements used to render content when no query results are found. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-no-results)) @@ -811,7 +811,7 @@ Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPres - **Name:** core/rss - **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), ~~html~~ +- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), ~~html~~ - **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow ## Search diff --git a/docs/reference-guides/interactivity-api/README.md b/docs/reference-guides/interactivity-api/README.md index 3a5bbb84ff159c..5504f8fd19fafe 100644 --- a/docs/reference-guides/interactivity-api/README.md +++ b/docs/reference-guides/interactivity-api/README.md @@ -113,7 +113,7 @@ Here you have some more resources to learn/read more about the Interactivity API - [Merge announcement](https://make.wordpress.org/core/2024/02/19/merge-announcement-interactivity-api/) - [Proposal: The Interactivity API – A better developer experience in building interactive blocks](https://make.wordpress.org/core/2023/03/30/proposal-the-interactivity-api-a-better-developer-experience-in-building-interactive-blocks/) - [Interactivity API Discussions](https://github.com/WordPress/gutenberg/discussions/52882), especially the [showcase](https://github.com/WordPress/gutenberg/discussions/55642#discussioncomment-9667164) discussions. -- [wpmovies.dev](http://wpmovies.dev/) demo and its [wp-movies-demo](https://github.com/WordPress/wp-movies-demo) repo +- [wpmovies.dev](https://wpmovies.dev/) demo and its [wp-movies-demo](https://github.com/WordPress/wp-movies-demo) repo - Examples using the Interactivity API at [block-development-examples](https://github.com/WordPress/block-development-examples): - [`interactivity-api-block-833d15`](https://github.com/WordPress/block-development-examples/tree/trunk/plugins/interactivity-api-block-833d15) - [`interactivity-api-countdown-3cd73e`](https://github.com/WordPress/block-development-examples/tree/trunk/plugins/interactivity-api-countdown-3cd73e) diff --git a/docs/reference-guides/slotfills/main-dashboard-button.md b/docs/reference-guides/slotfills/main-dashboard-button.md index b55ed50648db15..593c5c57ca2973 100644 --- a/docs/reference-guides/slotfills/main-dashboard-button.md +++ b/docs/reference-guides/slotfills/main-dashboard-button.md @@ -33,7 +33,7 @@ registerPlugin( 'main-dashboard-button-test', { ### Change the icon and link -This example will change the icon in the header to indicate an external link that will take the user to http://wordpress.org when clicked. +This example will change the icon in the header to indicate an external link that will take the user to https://wordpress.org when clicked. ```js import { registerPlugin } from '@wordpress/plugins'; @@ -45,7 +45,7 @@ import { external } from '@wordpress/icons'; const MainDashboardButtonIconTest = () => ( - + ); @@ -54,4 +54,4 @@ registerPlugin( 'main-dashboard-button-icon-test', { } ); ``` -![The edit post screen in fullscreen mode displaying an external link icon instead of the default W](https://developer.wordpress.org/files/2024/08/main-dashboard-button-external-link-example.png 'Change the icon in the header to indicate an external link that will take the user to http://wordpress.org when clicked') +![The edit post screen in fullscreen mode displaying an external link icon instead of the default W](https://developer.wordpress.org/files/2024/08/main-dashboard-button-external-link-example.png 'Change the icon in the header to indicate an external link that will take the user to https://wordpress.org when clicked') diff --git a/gutenberg.php b/gutenberg.php index e3f4c81ef808f3..de187b8d13af90 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality. * Requires at least: 6.6 * Requires PHP: 7.2 - * Version: 20.1.0-rc.1 + * Version: 20.2.0 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 1f45d897a77cc0..ddba48f88483d8 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -359,7 +359,7 @@ public static function get_theme_data( $deprecated = array(), $options = array() } if ( current_theme_supports( 'experimental-link-color' ) ) { _doing_it_wrong( - current_theme_supports( 'experimental-link-color' ), + "add_theme_support( 'experimental-link-color' )", __( '`experimental-link-color` is no longer supported. Use `link-color` instead.', 'gutenberg' ), '6.3.0' ); diff --git a/lib/client-assets.php b/lib/client-assets.php index f95ac27f81d010..4a94ca212c3422 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -539,7 +539,7 @@ function gutenberg_enqueue_stored_styles( $options = array() ) { // Combines Core styles. if ( ! empty( $compiled_core_stylesheet ) ) { - wp_register_style( $style_tag_id, false, array(), true, true ); + wp_register_style( $style_tag_id, false, array(), true ); wp_add_inline_style( $style_tag_id, $compiled_core_stylesheet ); wp_enqueue_style( $style_tag_id ); } @@ -562,7 +562,7 @@ function gutenberg_enqueue_stored_styles( $options = array() ) { $styles = gutenberg_style_engine_get_stylesheet_from_context( $store_name, $options ); if ( ! empty( $styles ) ) { $key = "wp-style-engine-$store_name"; - wp_register_style( $key, false, array(), true, true ); + wp_register_style( $key, false, array(), true ); wp_add_inline_style( $key, $styles ); wp_enqueue_style( $key ); } diff --git a/lib/compat/wordpress-6.8/blocks.php b/lib/compat/wordpress-6.8/blocks.php index 6cfa98691020ef..2b0fcd19e200e1 100644 --- a/lib/compat/wordpress-6.8/blocks.php +++ b/lib/compat/wordpress-6.8/blocks.php @@ -5,14 +5,79 @@ * @package gutenberg */ -function gutenberg_apply_block_hooks_to_post_content( $content ) { - // The `the_content` filter does not provide the post that the content is coming from. - // However, we can infer it by calling `get_post()`, which will return the current post - // if no post ID is provided. - return apply_block_hooks_to_content( $content, get_post(), 'insert_hooked_blocks' ); +if ( ! function_exists( 'apply_block_hooks_to_content_from_post_object' ) ) { + /** + * Run the Block Hooks algorithm on a post object's content. + * + * This function is different from `apply_block_hooks_to_content` in that + * it takes ignored hooked block information from the post's metadata into + * account. This ensures that any blocks hooked as first or last child + * of the block that corresponds to the post type are handled correctly. + * + * @since 6.8.0 + * @access private + * + * @param string $content Serialized content. + * @param WP_Post|null $post A post object that the content belongs to. If set to `null`, + * `get_post()` will be called to use the current post as context. + * Default: `null`. + * @param callable $callback A function that will be called for each block to generate + * the markup for a given list of blocks that are hooked to it. + * Default: 'insert_hooked_blocks'. + * @return string The serialized markup. + */ + function apply_block_hooks_to_content_from_post_object( $content, WP_Post $post = null, $callback = 'insert_hooked_blocks' ) { + // Default to the current post if no context is provided. + if ( null === $post ) { + $post = get_post(); + } + + if ( ! $post instanceof WP_Post ) { + return apply_block_hooks_to_content( $content, $post, $callback ); + } + + $attributes = array(); + + // If context is a post object, `ignoredHookedBlocks` information is stored in its post meta. + $ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true ); + if ( ! empty( $ignored_hooked_blocks ) ) { + $ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true ); + $attributes['metadata'] = array( + 'ignoredHookedBlocks' => $ignored_hooked_blocks, + ); + } + + // We need to wrap the content in a temporary wrapper block with that metadata + // so the Block Hooks algorithm can insert blocks that are hooked as first or last child + // of the wrapper block. + // To that end, we need to determine the wrapper block type based on the post type. + if ( 'wp_navigation' === $post->post_type ) { + $wrapper_block_type = 'core/navigation'; + } elseif ( 'wp_block' === $post->post_type ) { + $wrapper_block_type = 'core/block'; + } else { + $wrapper_block_type = 'core/post-content'; + } + + $content = get_comment_delimited_block_content( + $wrapper_block_type, + $attributes, + $content + ); + + // Apply Block Hooks. + $content = apply_block_hooks_to_content( $content, $post, $callback ); + + // Finally, we need to remove the temporary wrapper block. + $content = remove_serialized_parent_block( $content ); + + return $content; + } + // We need to apply this filter before `do_blocks` (which is hooked to `the_content` at priority 9). + add_filter( 'the_content', 'apply_block_hooks_to_content_from_post_object', 8 ); + // Remove apply_block_hooks_to_content filter (previously added in Core). + remove_filter( 'the_content', 'apply_block_hooks_to_content', 8 ); } -// We need to apply this filter before `do_blocks` (which is hooked to `the_content` at priority 9). -add_filter( 'the_content', 'gutenberg_apply_block_hooks_to_post_content', 8 ); /** * Hooks into the REST API response for the Posts endpoint and adds the first and last inner blocks. @@ -29,57 +94,32 @@ function gutenberg_insert_hooked_blocks_into_rest_response( $response, $post ) { return $response; } - $attributes = array(); - $ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true ); - if ( ! empty( $ignored_hooked_blocks ) ) { - $ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true ); - $attributes['metadata'] = array( - 'ignoredHookedBlocks' => $ignored_hooked_blocks, - ); - } - - if ( 'wp_navigation' === $post->post_type ) { - $wrapper_block_type = 'core/navigation'; - } elseif ( 'wp_block' === $post->post_type ) { - $wrapper_block_type = 'core/block'; - } else { - $wrapper_block_type = 'core/post-content'; - } - - $content = get_comment_delimited_block_content( - $wrapper_block_type, - $attributes, - $response->data['content']['raw'] - ); - - $content = apply_block_hooks_to_content( - $content, + $response->data['content']['raw'] = apply_block_hooks_to_content_from_post_object( + $response->data['content']['raw'], $post, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' ); - // Remove mock block wrapper. - $content = remove_serialized_parent_block( $content ); - - $response->data['content']['raw'] = $content; - // If the rendered content was previously empty, we leave it like that. if ( empty( $response->data['content']['rendered'] ) ) { return $response; } // No need to inject hooked blocks twice. - $priority = has_filter( 'the_content', 'apply_block_hooks_to_content' ); + $priority = has_filter( 'the_content', 'apply_block_hooks_to_content_from_post_object' ); if ( false !== $priority ) { - remove_filter( 'the_content', 'apply_block_hooks_to_content', $priority ); + remove_filter( 'the_content', 'apply_block_hooks_to_content_from_post_object', $priority ); } /** This filter is documented in wp-includes/post-template.php */ - $response->data['content']['rendered'] = apply_filters( 'the_content', $content ); + $response->data['content']['rendered'] = apply_filters( + 'the_content', + $response->data['content']['raw'] + ); // Add back the filter. if ( false !== $priority ) { - add_filter( 'the_content', 'apply_block_hooks_to_content', $priority ); + add_filter( 'the_content', 'apply_block_hooks_to_content_from_post_object', $priority ); } return $response; @@ -177,3 +217,35 @@ function gutenberg_update_ignored_hooked_blocks_postmeta( $post ) { add_filter( 'rest_pre_insert_page', 'gutenberg_update_ignored_hooked_blocks_postmeta' ); add_filter( 'rest_pre_insert_post', 'gutenberg_update_ignored_hooked_blocks_postmeta' ); add_filter( 'rest_pre_insert_wp_block', 'gutenberg_update_ignored_hooked_blocks_postmeta' ); + +/** + * Update Query `parents` argument validation for hierarchical post types. + * A zero is a valid parent ID for hierarchical post types. Used to display top-level items. + * + * Add new handler for `sticky` query argument. + * + * @param array $query The query vars. + * @param WP_Block $block Block instance. + * @return array The filtered query vars. + */ +function gutenberg_update_query_vars_from_query_block_6_8( $query, $block ) { + if ( ! empty( $block->context['query']['parents'] ) && is_post_type_hierarchical( $query['post_type'] ) ) { + $query['post_parent__in'] = array_unique( array_map( 'intval', $block->context['query']['parents'] ) ); + } + + if ( isset( $block->context['query']['sticky'] ) && ! empty( $block->context['query']['sticky'] ) ) { + if ( 'ignore' === $block->context['query']['sticky'] ) { + $sticky = get_option( 'sticky_posts' ); + + /** + * The core will set `post__not_in` because it asserts that any sticky value other than `only` is `exclude`. + * Let's override that while supporting any `post__not_in` values outside sticky post logic. + */ + $query['post__not_in'] = array_diff( $query['post__not_in'], ! empty( $sticky ) ? $sticky : array() ); + $query['ignore_sticky_posts'] = 1; + } + } + + return $query; +} +add_filter( 'query_loop_block_query_vars', 'gutenberg_update_query_vars_from_query_block_6_8', 10, 2 ); diff --git a/lib/compat/wordpress-6.8/post.php b/lib/compat/wordpress-6.8/post.php index 50324766488992..2477e94f7393c6 100644 --- a/lib/compat/wordpress-6.8/post.php +++ b/lib/compat/wordpress-6.8/post.php @@ -17,7 +17,7 @@ function gutenberg_update_page_editor_support( $args ) { if ( false !== $editor_support_key ) { unset( $args['supports'][ $editor_support_key ] ); $args['supports']['editor'] = array( - 'default_mode' => 'template-locked', + 'default-mode' => 'template-locked', ); } diff --git a/lib/compat/wordpress-6.8/rest-api.php b/lib/compat/wordpress-6.8/rest-api.php index cc3d3e89014e93..fc68077b67f765 100644 --- a/lib/compat/wordpress-6.8/rest-api.php +++ b/lib/compat/wordpress-6.8/rest-api.php @@ -48,7 +48,6 @@ function gutenberg_add_default_template_part_areas_to_index( WP_REST_Response $r $response->data['default_template_part_areas'] = get_allowed_block_template_part_areas(); return $response; } - add_filter( 'rest_index', 'gutenberg_add_default_template_part_areas_to_index' ); /** @@ -70,5 +69,48 @@ function gutenberg_add_default_template_types_to_index( WP_REST_Response $respon $response->data['default_template_types'] = $indexed_template_types; return $response; } - add_filter( 'rest_index', 'gutenberg_add_default_template_types_to_index' ); + +/** + * Adds `ignore_sticky` parameter to the post collection endpoint. + * + * Note: Backports into the wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php file. + * + * @param array $query_params JSON Schema-formatted collection parameters. + * @param WP_Post_Type $post_type Post type object. + * @return array + */ +function gutenberg_modify_post_collection_paramt( $query_params, WP_Post_Type $post_type ) { + if ( 'post' === $post_type->name && ! isset( $query_params['ignore_sticky'] ) ) { + $query_params['ignore_sticky'] = array( + 'description' => __( 'Whether to ignore sticky posts or not.' ), + 'type' => 'boolean', + 'default' => false, + ); + } + + return $query_params; +} +add_filter( 'rest_post_collection_params', 'gutenberg_modify_post_collection_paramt', 10, 2 ); + +/** + * Modify posts query based on `ignore_sticky` parameter. + * + * Note: Backports into the wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php file. + * + * @param array $prepared_args Array of arguments for WP_User_Query. + * @param WP_REST_Request $request The REST API request. + * @return array Modified arguments + */ +function gutenberg_modify_post_collection_query( $args, WP_REST_Request $request ) { + /* + * Honor the original REST API `post__in` behavior. Don't prepend sticky posts + * when `post__in` has been specified. + */ + if ( isset( $request['ignore_sticky'] ) && empty( $args['post__in'] ) ) { + $args['ignore_sticky_posts'] = $request['ignore_sticky']; + } + + return $args; +} +add_filter( 'rest_post_query', 'gutenberg_modify_post_collection_query', 10, 2 ); diff --git a/lib/compat/wordpress-6.8/site-editor.php b/lib/compat/wordpress-6.8/site-editor.php index 9b2575676047d1..82ac118b013c16 100644 --- a/lib/compat/wordpress-6.8/site-editor.php +++ b/lib/compat/wordpress-6.8/site-editor.php @@ -15,6 +15,16 @@ function ( $settings ) { } ); +/** + * Maps old site editor urls to the new updated ones. + * + * @since 6.8.0 + * @access private + * + * @global string $pagenow The filename of the current screen. + * + * @return string|false The new URL to redirect to, or false if no redirection is needed. + */ function gutenberg_get_site_editor_redirection() { global $pagenow; if ( 'site-editor.php' !== $pagenow || isset( $_REQUEST['p'] ) || ! $_SERVER['QUERY_STRING'] ) { @@ -96,10 +106,13 @@ function gutenberg_get_site_editor_redirection() { return add_query_arg( array( 'p' => '/' ) ); } +/** + * Redirect old site editor urls to the new updated ones. + */ function gutenberg_redirect_site_editor_deprecated_urls() { $redirection = gutenberg_get_site_editor_redirection(); if ( false !== $redirection ) { - wp_redirect( $redirection, 301 ); + wp_safe_redirect( $redirection ); exit; } } diff --git a/lib/compat/wordpress-6.8/block-comments.php b/lib/experimental/block-comments.php similarity index 85% rename from lib/compat/wordpress-6.8/block-comments.php rename to lib/experimental/block-comments.php index ff9f03b69aa1c3..3381882589ef6d 100644 --- a/lib/compat/wordpress-6.8/block-comments.php +++ b/lib/experimental/block-comments.php @@ -1,6 +1,6 @@ query_vars['type'] ) && '' === $query->query_vars['type'] ) { diff --git a/lib/compat/wordpress-6.8/class-gutenberg-rest-comment-controller-6-8.php b/lib/experimental/class-gutenberg-rest-comment-controller.php similarity index 87% rename from lib/compat/wordpress-6.8/class-gutenberg-rest-comment-controller-6-8.php rename to lib/experimental/class-gutenberg-rest-comment-controller.php index 60b45b1a63adef..8409c595032961 100644 --- a/lib/compat/wordpress-6.8/class-gutenberg-rest-comment-controller-6-8.php +++ b/lib/experimental/class-gutenberg-rest-comment-controller.php @@ -7,7 +7,7 @@ */ // Create a new class that extends WP_REST_Comments_Controller -class Gutenberg_REST_Comment_Controller_6_8 extends WP_REST_Comments_Controller { +class Gutenberg_REST_Comment_Controller extends WP_REST_Comments_Controller { public function create_item_permissions_check( $request ) { if ( empty( $request['comment_type'] ) || 'comment' === $request['comment_type'] ) { @@ -18,7 +18,7 @@ public function create_item_permissions_check( $request ) { if ( get_option( 'comment_registration' ) ) { return new WP_Error( 'rest_comment_login_required', - __( 'Sorry, you must be logged in to comment.' ), + __( 'Sorry, you must be logged in to comment.', 'gutenberg' ), array( 'status' => 401 ) ); } @@ -40,7 +40,7 @@ public function create_item_permissions_check( $request ) { if ( ! $allow_anonymous ) { return new WP_Error( 'rest_comment_login_required', - __( 'Sorry, you must be logged in to comment.' ), + __( 'Sorry, you must be logged in to comment.', 'gutenberg' ), array( 'status' => 401 ) ); } @@ -51,7 +51,7 @@ public function create_item_permissions_check( $request ) { return new WP_Error( 'rest_comment_invalid_author', /* translators: %s: Request parameter. */ - sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ), + sprintf( __( "Sorry, you are not allowed to edit '%s' for comments.", 'gutenberg' ), 'author' ), array( 'status' => rest_authorization_required_code() ) ); } @@ -61,7 +61,7 @@ public function create_item_permissions_check( $request ) { return new WP_Error( 'rest_comment_invalid_author_ip', /* translators: %s: Request parameter. */ - sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author_ip' ), + sprintf( __( "Sorry, you are not allowed to edit '%s' for comments.", 'gutenberg' ), 'author_ip' ), array( 'status' => rest_authorization_required_code() ) ); } @@ -71,7 +71,7 @@ public function create_item_permissions_check( $request ) { return new WP_Error( 'rest_comment_invalid_status', /* translators: %s: Request parameter. */ - sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'status' ), + sprintf( __( "Sorry, you are not allowed to edit '%s' for comments.", 'gutenberg' ), 'status' ), array( 'status' => rest_authorization_required_code() ) ); } @@ -79,7 +79,7 @@ public function create_item_permissions_check( $request ) { if ( empty( $request['post'] ) ) { return new WP_Error( 'rest_comment_invalid_post_id', - __( 'Sorry, you are not allowed to create this comment without a post.' ), + __( 'Sorry, you are not allowed to create this comment without a post.', 'gutenberg' ), array( 'status' => 403 ) ); } @@ -89,7 +89,7 @@ public function create_item_permissions_check( $request ) { if ( ! $post ) { return new WP_Error( 'rest_comment_invalid_post_id', - __( 'Sorry, you are not allowed to create this comment without a post.' ), + __( 'Sorry, you are not allowed to create this comment without a post.', 'gutenberg' ), array( 'status' => 403 ) ); } @@ -97,7 +97,7 @@ public function create_item_permissions_check( $request ) { if ( 'trash' === $post->post_status ) { return new WP_Error( 'rest_comment_trash_post', - __( 'Sorry, you are not allowed to create a comment on this post.' ), + __( 'Sorry, you are not allowed to create a comment on this post.', 'gutenberg' ), array( 'status' => 403 ) ); } @@ -105,7 +105,7 @@ public function create_item_permissions_check( $request ) { if ( ! $this->check_read_post_permission( $post, $request ) ) { return new WP_Error( 'rest_cannot_read_post', - __( 'Sorry, you are not allowed to read the post for this comment.' ), + __( 'Sorry, you are not allowed to read the post for this comment.', 'gutenberg' ), array( 'status' => rest_authorization_required_code() ) ); } @@ -117,7 +117,7 @@ public function create_item_permissions_check( $request ) { add_action( 'rest_api_init', function () { - $controller = new Gutenberg_REST_Comment_Controller_6_8(); + $controller = new Gutenberg_REST_Comment_Controller(); $controller->register_routes(); } ); diff --git a/lib/experimental/navigation-theme-opt-in.php b/lib/experimental/navigation-theme-opt-in.php index 547aa8b88ea7d1..27dbabaf234486 100644 --- a/lib/experimental/navigation-theme-opt-in.php +++ b/lib/experimental/navigation-theme-opt-in.php @@ -29,6 +29,8 @@ * * @see https://core.trac.wordpress.org/ticket/50544 * + * @global WP_Customize_Manager $wp_customize + * * @param int $menu_id ID of the updated menu. * @param int $menu_item_db_id ID of the new menu item. * @param array $args An array of arguments used to update/add the menu item. diff --git a/lib/experimental/sync/class-gutenberg-http-signaling-server.php b/lib/experimental/sync/class-gutenberg-http-signaling-server.php index a41e26fdac163a..3448e82a4c31d0 100644 --- a/lib/experimental/sync/class-gutenberg-http-signaling-server.php +++ b/lib/experimental/sync/class-gutenberg-http-signaling-server.php @@ -172,7 +172,7 @@ private static function handle_read_pending_messages( $subscriber_to_messages_pa if ( ! $fd ) { $retries = isset( $_COOKIE['signaling_server_retries'] ) ? intval( $_COOKIE['signaling_server_retries'] ) : 0; $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); - setcookie( 'signaling_server_retries', $retries + 1, time() + DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); + setcookie( 'signaling_server_retries', (string) ( $retries + 1 ), time() + DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); echo 'id: ' . time() . PHP_EOL; echo 'event: error' . PHP_EOL; echo 'data: ' . 'Could not open required file.' . PHP_EOL . PHP_EOL; @@ -183,7 +183,7 @@ private static function handle_read_pending_messages( $subscriber_to_messages_pa if ( isset( $_COOKIE['signaling_server_retries'] ) ) { $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); // unset the cookie using a past expiration date. - setcookie( 'signaling_server_retries', 0, time() - DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); + setcookie( 'signaling_server_retries', '0', time() - DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure ); } echo 'retry: 3000' . PHP_EOL; diff --git a/lib/load.php b/lib/load.php index 69ba59e3718842..789c9f9980e9a3 100644 --- a/lib/load.php +++ b/lib/load.php @@ -42,8 +42,6 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/compat/wordpress-6.7/rest-api.php'; // WordPress 6.8 compat. - require __DIR__ . '/compat/wordpress-6.8/block-comments.php'; - require __DIR__ . '/compat/wordpress-6.8/class-gutenberg-rest-comment-controller-6-8.php'; require __DIR__ . '/compat/wordpress-6.8/class-gutenberg-hierarchical-sort.php'; require __DIR__ . '/compat/wordpress-6.8/rest-api.php'; @@ -54,6 +52,12 @@ function gutenberg_is_experiment_enabled( $name ) { require_once __DIR__ . '/experimental/rest-api.php'; require_once __DIR__ . '/experimental/kses-allowed-html.php'; + + // Block Comments. + if ( gutenberg_is_experiment_enabled( 'gutenberg-block-comment' ) ) { + require __DIR__ . '/experimental/block-comments.php'; + require __DIR__ . '/experimental/class-gutenberg-rest-comment-controller.php'; + } } // Experimental signaling server. diff --git a/package-lock.json b/package-lock.json index 294f0ed6f2b090..54d67ffa3089ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gutenberg", - "version": "20.1.0-rc.1", + "version": "20.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gutenberg", - "version": "20.1.0-rc.1", + "version": "20.2.0", "hasInstallScript": true, "license": "GPL-2.0-or-later", "workspaces": [ @@ -46085,9 +46085,9 @@ } }, "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "version": "5.28.5", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz", + "integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==", "license": "MIT", "dependencies": { "@fastify/busboy": "^2.0.0" @@ -49468,7 +49468,7 @@ }, "packages/a11y": { "name": "@wordpress/a11y", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -49482,7 +49482,7 @@ }, "packages/annotations": { "name": "@wordpress/annotations", - "version": "3.16.0", + "version": "3.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -49510,7 +49510,7 @@ }, "packages/api-fetch": { "name": "@wordpress/api-fetch", - "version": "7.16.0", + "version": "7.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -49524,7 +49524,7 @@ }, "packages/autop": { "name": "@wordpress/autop", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -49536,7 +49536,7 @@ }, "packages/babel-plugin-import-jsx-pragma": { "name": "@wordpress/babel-plugin-import-jsx-pragma", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -49548,7 +49548,7 @@ }, "packages/babel-plugin-makepot": { "name": "@wordpress/babel-plugin-makepot", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "dependencies": { "deepmerge": "^4.3.0", @@ -49565,7 +49565,7 @@ }, "packages/babel-preset-default": { "name": "@wordpress/babel-preset-default", - "version": "8.16.0", + "version": "8.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/core": "7.25.7", @@ -50696,7 +50696,7 @@ }, "packages/base-styles": { "name": "@wordpress/base-styles", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -50705,7 +50705,7 @@ }, "packages/blob": { "name": "@wordpress/blob", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -50717,7 +50717,7 @@ }, "packages/block-directory": { "name": "@wordpress/block-directory", - "version": "5.16.0", + "version": "5.17.1", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -50753,7 +50753,7 @@ }, "packages/block-editor": { "name": "@wordpress/block-editor", - "version": "14.11.0", + "version": "14.12.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -50854,7 +50854,7 @@ }, "packages/block-library": { "name": "@wordpress/block-library", - "version": "9.16.0", + "version": "9.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -50920,7 +50920,7 @@ }, "packages/block-serialization-default-parser": { "name": "@wordpress/block-serialization-default-parser", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -50932,7 +50932,7 @@ }, "packages/block-serialization-spec-parser": { "name": "@wordpress/block-serialization-spec-parser", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "pegjs": "^0.10.0", @@ -50945,7 +50945,7 @@ }, "packages/blocks": { "name": "@wordpress/blocks", - "version": "14.5.0", + "version": "14.6.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -50999,7 +50999,7 @@ }, "packages/browserslist-config": { "name": "@wordpress/browserslist-config", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -51008,7 +51008,7 @@ }, "packages/commands": { "name": "@wordpress/commands", - "version": "1.16.0", + "version": "1.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51247,7 +51247,7 @@ }, "packages/components": { "name": "@wordpress/components", - "version": "29.2.0", + "version": "29.3.0", "license": "GPL-2.0-or-later", "dependencies": { "@ariakit/react": "^0.4.15", @@ -51338,7 +51338,7 @@ }, "packages/compose": { "name": "@wordpress/compose", - "version": "7.16.0", + "version": "7.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51375,7 +51375,7 @@ }, "packages/core-commands": { "name": "@wordpress/core-commands", - "version": "1.16.0", + "version": "1.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51404,7 +51404,7 @@ }, "packages/core-data": { "name": "@wordpress/core-data", - "version": "7.16.0", + "version": "7.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51449,7 +51449,7 @@ }, "packages/create-block": { "name": "@wordpress/create-block", - "version": "4.59.0", + "version": "4.60.0", "license": "GPL-2.0-or-later", "dependencies": { "@inquirer/prompts": "^7.2.0", @@ -51476,7 +51476,7 @@ }, "packages/create-block-interactive-template": { "name": "@wordpress/create-block-interactive-template", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -51485,7 +51485,7 @@ }, "packages/create-block-tutorial-template": { "name": "@wordpress/create-block-tutorial-template", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -51494,7 +51494,7 @@ }, "packages/customize-widgets": { "name": "@wordpress/customize-widgets", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51532,7 +51532,7 @@ }, "packages/data": { "name": "@wordpress/data", - "version": "10.16.0", + "version": "10.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51561,7 +51561,7 @@ }, "packages/data-controls": { "name": "@wordpress/data-controls", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51579,7 +51579,7 @@ }, "packages/dataviews": { "name": "@wordpress/dataviews", - "version": "4.12.0", + "version": "4.13.0", "license": "GPL-2.0-or-later", "dependencies": { "@ariakit/react": "^0.4.15", @@ -51606,7 +51606,7 @@ }, "packages/date": { "name": "@wordpress/date", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51621,7 +51621,7 @@ }, "packages/dependency-extraction-webpack-plugin": { "name": "@wordpress/dependency-extraction-webpack-plugin", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "dependencies": { "json2php": "^0.0.7" @@ -51636,7 +51636,7 @@ }, "packages/deprecated": { "name": "@wordpress/deprecated", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51649,7 +51649,7 @@ }, "packages/docgen": { "name": "@wordpress/docgen", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/core": "7.25.7", @@ -51670,7 +51670,7 @@ }, "packages/dom": { "name": "@wordpress/dom", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51683,7 +51683,7 @@ }, "packages/dom-ready": { "name": "@wordpress/dom-ready", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -51695,7 +51695,7 @@ }, "packages/e2e-test-utils": { "name": "@wordpress/e2e-test-utils", - "version": "11.16.0", + "version": "11.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51717,7 +51717,7 @@ }, "packages/e2e-test-utils-playwright": { "name": "@wordpress/e2e-test-utils-playwright", - "version": "1.16.0", + "version": "1.17.0", "license": "GPL-2.0-or-later", "dependencies": { "change-case": "^4.1.2", @@ -51743,7 +51743,7 @@ }, "packages/e2e-tests": { "name": "@wordpress/e2e-tests", - "version": "8.16.0", + "version": "8.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/e2e-test-utils": "file:../e2e-test-utils", @@ -51781,7 +51781,7 @@ }, "packages/edit-post": { "name": "@wordpress/edit-post", - "version": "8.16.0", + "version": "8.17.1", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51828,7 +51828,7 @@ }, "packages/edit-site": { "name": "@wordpress/edit-site", - "version": "6.16.0", + "version": "6.17.1", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51891,7 +51891,7 @@ }, "packages/edit-widgets": { "name": "@wordpress/edit-widgets", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51934,7 +51934,7 @@ }, "packages/editor": { "name": "@wordpress/editor", - "version": "14.16.0", + "version": "14.17.1", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51996,7 +51996,7 @@ }, "packages/element": { "name": "@wordpress/element", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52015,7 +52015,7 @@ }, "packages/env": { "name": "@wordpress/env", - "version": "10.16.0", + "version": "10.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@inquirer/prompts": "^7.2.0", @@ -52064,7 +52064,7 @@ }, "packages/escape-html": { "name": "@wordpress/escape-html", - "version": "3.16.0", + "version": "3.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -52076,7 +52076,7 @@ }, "packages/eslint-plugin": { "name": "@wordpress/eslint-plugin", - "version": "22.2.0", + "version": "22.3.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/eslint-parser": "7.25.7", @@ -52145,7 +52145,7 @@ }, "packages/fields": { "name": "@wordpress/fields", - "version": "0.8.0", + "version": "0.9.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52187,7 +52187,7 @@ }, "packages/format-library": { "name": "@wordpress/format-library", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52215,7 +52215,7 @@ }, "packages/hooks": { "name": "@wordpress/hooks", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -52227,7 +52227,7 @@ }, "packages/html-entities": { "name": "@wordpress/html-entities", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -52239,7 +52239,7 @@ }, "packages/i18n": { "name": "@wordpress/i18n", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52259,7 +52259,7 @@ }, "packages/icons": { "name": "@wordpress/icons", - "version": "10.16.0", + "version": "10.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52273,7 +52273,7 @@ }, "packages/interactivity": { "name": "@wordpress/interactivity", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@preact/signals": "^1.3.0", @@ -52286,7 +52286,7 @@ }, "packages/interactivity-router": { "name": "@wordpress/interactivity-router", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/a11y": "file:../a11y", @@ -52299,7 +52299,7 @@ }, "packages/interface": { "name": "@wordpress/interface", - "version": "9.1.0", + "version": "9.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52327,7 +52327,7 @@ }, "packages/is-shallow-equal": { "name": "@wordpress/is-shallow-equal", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -52339,7 +52339,7 @@ }, "packages/jest-console": { "name": "@wordpress/jest-console", - "version": "8.16.0", + "version": "8.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52355,7 +52355,7 @@ }, "packages/jest-preset-default": { "name": "@wordpress/jest-preset-default", - "version": "12.16.0", + "version": "12.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/jest-console": "file:../jest-console", @@ -52372,7 +52372,7 @@ }, "packages/jest-puppeteer-axe": { "name": "@wordpress/jest-puppeteer-axe", - "version": "7.16.0", + "version": "7.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@axe-core/puppeteer": "^4.0.0", @@ -52394,7 +52394,7 @@ }, "packages/keyboard-shortcuts": { "name": "@wordpress/keyboard-shortcuts", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52412,7 +52412,7 @@ }, "packages/keycodes": { "name": "@wordpress/keycodes", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52425,7 +52425,7 @@ }, "packages/lazy-import": { "name": "@wordpress/lazy-import", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "dependencies": { "execa": "^4.0.2", @@ -52439,7 +52439,7 @@ }, "packages/list-reusable-blocks": { "name": "@wordpress/list-reusable-blocks", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52462,7 +52462,7 @@ }, "packages/media-utils": { "name": "@wordpress/media-utils", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52479,7 +52479,7 @@ }, "packages/notices": { "name": "@wordpress/notices", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52496,7 +52496,7 @@ }, "packages/npm-package-json-lint-config": { "name": "@wordpress/npm-package-json-lint-config", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -52508,7 +52508,7 @@ }, "packages/nux": { "name": "@wordpress/nux", - "version": "9.16.0", + "version": "9.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52531,7 +52531,7 @@ }, "packages/patterns": { "name": "@wordpress/patterns", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52561,7 +52561,7 @@ }, "packages/plugins": { "name": "@wordpress/plugins", - "version": "7.16.0", + "version": "7.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52585,7 +52585,7 @@ }, "packages/postcss-plugins-preset": { "name": "@wordpress/postcss-plugins-preset", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/base-styles": "file:../base-styles", @@ -52654,7 +52654,7 @@ }, "packages/postcss-themes": { "name": "@wordpress/postcss-themes", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -52666,7 +52666,7 @@ }, "packages/preferences": { "name": "@wordpress/preferences", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52692,7 +52692,7 @@ }, "packages/preferences-persistence": { "name": "@wordpress/preferences-persistence", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52705,7 +52705,7 @@ }, "packages/prettier-config": { "name": "@wordpress/prettier-config", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -52717,7 +52717,7 @@ }, "packages/primitives": { "name": "@wordpress/primitives", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52734,7 +52734,7 @@ }, "packages/priority-queue": { "name": "@wordpress/priority-queue", - "version": "3.16.0", + "version": "3.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52747,7 +52747,7 @@ }, "packages/private-apis": { "name": "@wordpress/private-apis", - "version": "1.16.0", + "version": "1.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -52759,7 +52759,7 @@ }, "packages/project-management-automation": { "name": "@wordpress/project-management-automation", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@actions/core": "1.9.1", @@ -52787,7 +52787,7 @@ }, "packages/react-i18n": { "name": "@wordpress/react-i18n", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52943,7 +52943,7 @@ }, "packages/readable-js-assets-webpack-plugin": { "name": "@wordpress/readable-js-assets-webpack-plugin", - "version": "3.16.0", + "version": "3.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -52955,7 +52955,7 @@ }, "packages/redux-routine": { "name": "@wordpress/redux-routine", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52998,7 +52998,7 @@ }, "packages/reusable-blocks": { "name": "@wordpress/reusable-blocks", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53025,7 +53025,7 @@ }, "packages/rich-text": { "name": "@wordpress/rich-text", - "version": "7.16.0", + "version": "7.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53049,7 +53049,7 @@ }, "packages/router": { "name": "@wordpress/router", - "version": "1.16.0", + "version": "1.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53070,7 +53070,7 @@ }, "packages/scripts": { "name": "@wordpress/scripts", - "version": "30.9.0", + "version": "30.10.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/core": "7.25.7", @@ -53208,7 +53208,7 @@ }, "packages/server-side-render": { "name": "@wordpress/server-side-render", - "version": "5.16.0", + "version": "5.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53234,7 +53234,7 @@ }, "packages/shortcode": { "name": "@wordpress/shortcode", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53247,7 +53247,7 @@ }, "packages/style-engine": { "name": "@wordpress/style-engine", - "version": "2.16.0", + "version": "2.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53260,7 +53260,7 @@ }, "packages/stylelint-config": { "name": "@wordpress/stylelint-config", - "version": "23.8.0", + "version": "23.9.0", "license": "MIT", "dependencies": { "@stylistic/stylelint-plugin": "^3.0.1", @@ -53371,7 +53371,7 @@ }, "packages/sync": { "name": "@wordpress/sync", - "version": "1.16.0", + "version": "1.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53392,7 +53392,7 @@ }, "packages/token-list": { "name": "@wordpress/token-list", - "version": "3.16.0", + "version": "3.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -53404,7 +53404,7 @@ }, "packages/undo-manager": { "name": "@wordpress/undo-manager", - "version": "1.16.0", + "version": "1.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53417,9 +53417,10 @@ }, "packages/upload-media": { "name": "@wordpress/upload-media", - "version": "0.1.0", + "version": "0.2.0", "license": "GPL-2.0-or-later", "dependencies": { + "@babel/runtime": "7.25.7", "@shopify/web-worker": "^6.4.0", "@wordpress/api-fetch": "file:../api-fetch", "@wordpress/blob": "file:../blob", @@ -53435,11 +53436,15 @@ "engines": { "node": ">=18.12.0", "npm": ">=8.19.2" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" } }, "packages/url": { "name": "@wordpress/url", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53452,7 +53457,7 @@ }, "packages/viewport": { "name": "@wordpress/viewport", - "version": "6.16.0", + "version": "6.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53482,7 +53487,7 @@ }, "packages/warning": { "name": "@wordpress/warning", - "version": "3.16.0", + "version": "3.17.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -53491,7 +53496,7 @@ }, "packages/widgets": { "name": "@wordpress/widgets", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53519,7 +53524,7 @@ }, "packages/wordcount": { "name": "@wordpress/wordcount", - "version": "4.16.0", + "version": "4.17.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" diff --git a/package.json b/package.json index 1dbf7d44df4055..3d0194fb941bb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "20.1.0-rc.1", + "version": "20.2.0", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", @@ -181,7 +181,7 @@ "build": "npm run build:packages && wp-scripts build", "build:analyze-bundles": "npm run build -- --webpack-bundle-analyzer", "build:package-types": "node ./bin/packages/validate-typescript-version.js && ( tsc --build || ( echo 'tsc failed. Try cleaning up first: `npm run clean:package-types`'; exit 1 ) ) && node ./bin/packages/check-build-type-declaration-files.js", - "build:profile-types": "rimraf ./ts-traces && npm run clean:package-types && node ./bin/packages/validate-typescript-version.js && ( tsc --build --extendedDiagnostics --generateTrace ./ts-traces || ( echo 'tsc failed.'; exit 1 ) ) && node ./bin/packages/check-build-type-declaration-files.js && npx --yes @typescript/analyze-trace ts-traces > ts-traces/analysis.txt && echo $'\n\nDone! Build traces saved to ts-traces/ directory.\nTrace analysis saved to ts-traces/analysis.txt.'", + "build:profile-types": "rimraf ./ts-traces && npm run clean:package-types && node ./bin/packages/validate-typescript-version.js && ( tsc --build --extendedDiagnostics --generateTrace ./ts-traces || ( echo 'tsc failed.'; exit 1 ) ) && node ./bin/packages/check-build-type-declaration-files.js && npx --yes @typescript/analyze-trace ts-traces > ts-traces/analysis.txt && node -p \"'\\n\\nDone! Build traces saved to ts-traces/ directory.\\nTrace analysis saved to ts-traces/analysis.txt.'\"", "prebuild:packages": "npm run clean:packages && npm run --if-present --workspaces build", "build:packages": "npm run --silent build:package-types && node ./bin/packages/build.js", "postbuild:packages": " npm run --if-present --workspaces build:wp", diff --git a/packages/README.md b/packages/README.md index 79f07af29382c0..9a3d077ba671b9 100644 --- a/packages/README.md +++ b/packages/README.md @@ -214,7 +214,7 @@ If you are publishing new versions of packages, note that there are versioning r ## TypeScript -The [TypeScript](http://www.typescriptlang.org/) language is a typed superset of JavaScript that compiles to plain JavaScript. +The [TypeScript](https://www.typescriptlang.org/) language is a typed superset of JavaScript that compiles to plain JavaScript. Gutenberg does not use the TypeScript language, however TypeScript has powerful tooling that can be applied to JavaScript projects. Gutenberg uses TypeScript for several reasons, including: diff --git a/packages/a11y/CHANGELOG.md b/packages/a11y/CHANGELOG.md index 036d332c5a0b0e..1d1cd67af3f9b1 100644 --- a/packages/a11y/CHANGELOG.md +++ b/packages/a11y/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.17.0 (2025-01-29) + ## 4.16.0 (2025-01-15) ## 4.15.0 (2025-01-02) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index 8bc6e23a461263..a3a82f38284b3a 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "4.16.0", + "version": "4.17.0", "description": "Accessibility (a11y) utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/annotations/CHANGELOG.md b/packages/annotations/CHANGELOG.md index 6b3bc3564d58d6..fdcd5be5577ae5 100644 --- a/packages/annotations/CHANGELOG.md +++ b/packages/annotations/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.17.0 (2025-01-29) + ## 3.16.0 (2025-01-15) ## 3.15.0 (2025-01-02) diff --git a/packages/annotations/package.json b/packages/annotations/package.json index a426bfa3d6ef7a..70af684c11b3d9 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "3.16.0", + "version": "3.17.0", "description": "Annotate content in the Gutenberg editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/api-fetch/CHANGELOG.md b/packages/api-fetch/CHANGELOG.md index 47cfb75849ce99..9e53a807885700 100644 --- a/packages/api-fetch/CHANGELOG.md +++ b/packages/api-fetch/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.17.0 (2025-01-29) + ## 7.16.0 (2025-01-15) ## 7.15.0 (2025-01-02) diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index 44e5968e0b1b49..43a52dc89fe36f 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "7.16.0", + "version": "7.17.0", "description": "Utility to make WordPress REST API requests.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/api-fetch/src/middlewares/preloading.js b/packages/api-fetch/src/middlewares/preloading.js index ac293738513bd3..3eaab48dc8392c 100644 --- a/packages/api-fetch/src/middlewares/preloading.js +++ b/packages/api-fetch/src/middlewares/preloading.js @@ -68,15 +68,40 @@ function createPreloadingMiddleware( preloadedData ) { * @return {Promise} Promise with the response. */ function prepareResponse( responseData, parse ) { - return Promise.resolve( - parse - ? responseData.body - : new window.Response( JSON.stringify( responseData.body ), { - status: 200, - statusText: 'OK', - headers: responseData.headers, - } ) - ); + if ( parse ) { + return Promise.resolve( responseData.body ); + } + + try { + return Promise.resolve( + new window.Response( JSON.stringify( responseData.body ), { + status: 200, + statusText: 'OK', + headers: responseData.headers, + } ) + ); + } catch { + // See: https://github.com/WordPress/gutenberg/issues/67358#issuecomment-2621163926. + Object.entries( responseData.headers ).forEach( ( [ key, value ] ) => { + if ( key.toLowerCase() === 'link' ) { + responseData.headers[ key ] = value.replace( + /<([^>]+)>/, + ( /** @type {any} */ _, /** @type {string} */ url ) => + `<${ encodeURI( url ) }>` + ); + } + } ); + + return Promise.resolve( + parse + ? responseData.body + : new window.Response( JSON.stringify( responseData.body ), { + status: 200, + statusText: 'OK', + headers: responseData.headers, + } ) + ); + } } export default createPreloadingMiddleware; diff --git a/packages/api-fetch/src/middlewares/test/preloading.js b/packages/api-fetch/src/middlewares/test/preloading.js index 696d8a37648651..a3ffedbdef46d5 100644 --- a/packages/api-fetch/src/middlewares/test/preloading.js +++ b/packages/api-fetch/src/middlewares/test/preloading.js @@ -265,6 +265,57 @@ describe( 'Preloading Middleware', () => { expect( secondMiddleware ).toHaveBeenCalledTimes( 1 ); } ); + it( 'should not throw an error when non-ASCII headers are present', async () => { + const noResponseMock = 'undefined' === typeof window.Response; + if ( noResponseMock ) { + window.Response = class { + constructor( body, options ) { + this.body = JSON.parse( body ); + this.headers = options.headers; + + // Check for non-ASCII characters in headers + for ( const [ key, value ] of Object.entries( + this.headers || {} + ) ) { + if ( /[^\x00-\x7F]/.test( value ) ) { + throw new Error( + `Invalid non-ASCII character found in header: ${ key }` + ); + } + } + } + }; + } + + const data = { + body: 'Hello', + headers: { + Link: '; rel="alternate"; type=text/html', + }, + }; + + const preloadedData = { + 'wp/v2/example': data, + }; + + const preloadingMiddleware = + createPreloadingMiddleware( preloadedData ); + + const requestOptions = { + method: 'GET', + path: 'wp/v2/example', + parse: false, + }; + + await expect( + preloadingMiddleware( requestOptions, () => {} ) + ).resolves.not.toThrow(); + + if ( noResponseMock ) { + delete window.Response; + } + } ); + describe.each( [ [ 'GET' ], [ 'OPTIONS' ] ] )( '%s', ( method ) => { describe.each( [ [ 'all empty', {} ], diff --git a/packages/autop/CHANGELOG.md b/packages/autop/CHANGELOG.md index 9b73fe7ecaaead..edba622956be3e 100644 --- a/packages/autop/CHANGELOG.md +++ b/packages/autop/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.17.0 (2025-01-29) + ## 4.16.0 (2025-01-15) ## 4.15.0 (2025-01-02) diff --git a/packages/autop/package.json b/packages/autop/package.json index b334be020f6f97..8c187d2ecedeee 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "4.16.0", + "version": "4.17.0", "description": "WordPress's automatic paragraph functions `autop` and `removep`.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md index 1c4e5fa416687a..d74cc123def452 100644 --- a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md +++ b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.17.0 (2025-01-29) + ## 5.16.0 (2025-01-15) ## 5.15.0 (2025-01-02) diff --git a/packages/babel-plugin-import-jsx-pragma/README.md b/packages/babel-plugin-import-jsx-pragma/README.md index ebc260277b21ab..7c8ad8c6ac3168 100644 --- a/packages/babel-plugin-import-jsx-pragma/README.md +++ b/packages/babel-plugin-import-jsx-pragma/README.md @@ -1,6 +1,6 @@ # Babel Plugin Import JSX Pragma -Babel transform plugin for automatically injecting an import to be used as the pragma for the [React JSX Transform plugin](http://babeljs.io/docs/en/babel-plugin-transform-react-jsx). +Babel transform plugin for automatically injecting an import to be used as the pragma for the [React JSX Transform plugin](https://babeljs.io/docs/babel-plugin-transform-react-jsx). [JSX](https://reactjs.org/docs/jsx-in-depth.html) is merely a syntactic sugar for a function call, typically to `React.createElement` when used with [React](https://reactjs.org/). As such, it requires that the function referenced by this transform be within the scope of the file where the JSX occurs. In a typical React project, this means React must be imported in any file where JSX exists. @@ -18,9 +18,9 @@ npm install @wordpress/babel-plugin-import-jsx-pragma ## Usage -Refer to the [Babel Plugins documentation](http://babeljs.io/docs/en/plugins) if you don't yet have experience working with Babel plugins. +Refer to the [Babel Plugins documentation](https://babeljs.io/docs/plugins) if you don't yet have experience working with Babel plugins. -Include `@wordpress/babel-plugin-import-jsx-pragma` (and [@babel/plugin-transform-react-jsx](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx/)) as plugins in your Babel configuration. If you don't include both you will receive errors when encountering JSX tokens. +Include `@wordpress/babel-plugin-import-jsx-pragma` (and [@babel/plugin-transform-react-jsx](https://babeljs.io/docs/babel-plugin-transform-react-jsx/)) as plugins in your Babel configuration. If you don't include both you will receive errors when encountering JSX tokens. ```js // .babelrc.js diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json index f27d527c84c697..a0003205b6b6b6 100644 --- a/packages/babel-plugin-import-jsx-pragma/package.json +++ b/packages/babel-plugin-import-jsx-pragma/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-import-jsx-pragma", - "version": "5.16.0", + "version": "5.17.0", "description": "Babel transform plugin for automatically injecting an import to be used as the pragma for the React JSX Transform plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-makepot/CHANGELOG.md b/packages/babel-plugin-makepot/CHANGELOG.md index 73b357e78768dd..b3a1bafe646f6e 100644 --- a/packages/babel-plugin-makepot/CHANGELOG.md +++ b/packages/babel-plugin-makepot/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.17.0 (2025-01-29) + ## 6.16.0 (2025-01-15) ## 6.15.0 (2025-01-02) diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json index 56dc01c4fa9ac6..20c3957796c3b5 100644 --- a/packages/babel-plugin-makepot/package.json +++ b/packages/babel-plugin-makepot/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-makepot", - "version": "6.16.0", + "version": "6.17.0", "description": "WordPress Babel internationalization (i18n) plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-preset-default/CHANGELOG.md b/packages/babel-preset-default/CHANGELOG.md index 08633f5903d957..aa827876828c52 100644 --- a/packages/babel-preset-default/CHANGELOG.md +++ b/packages/babel-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.17.0 (2025-01-29) + ## 8.16.0 (2025-01-15) ## 8.15.0 (2025-01-02) diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index db0aad976eea5a..e1e43984e69f24 100644 --- a/packages/babel-preset-default/package.json +++ b/packages/babel-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-preset-default", - "version": "8.16.0", + "version": "8.17.0", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-preset-default/polyfill-exclusions.js b/packages/babel-preset-default/polyfill-exclusions.js index ca8c045d124146..9d0d18737540cb 100644 --- a/packages/babel-preset-default/polyfill-exclusions.js +++ b/packages/babel-preset-default/polyfill-exclusions.js @@ -28,4 +28,9 @@ module.exports = [ // // @see https://github.com/WordPress/gutenberg/pull/67230 /^es(next)?\.set\./, + // Remove Iterator feature polyfills. + // For the same reasoning as for Set exlusion above, we're excluding all iterator helper polyfills. + // + // @see https://github.com/WordPress/wordpress-develop/pull/8224#issuecomment-2636390007. + /^es(next)?\.iterator\./, ]; diff --git a/packages/base-styles/CHANGELOG.md b/packages/base-styles/CHANGELOG.md index 51a6d9500efe90..e4aceae936710d 100644 --- a/packages/base-styles/CHANGELOG.md +++ b/packages/base-styles/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.17.0 (2025-01-29) + ## 5.16.0 (2025-01-15) ## 5.15.0 (2025-01-02) diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss index af679edb910642..6f7e3f2f13c309 100644 --- a/packages/base-styles/_z-index.scss +++ b/packages/base-styles/_z-index.scss @@ -25,7 +25,6 @@ $z-layers: ( ".components-popover__close": 5, ".block-editor-block-list__insertion-point": 6, ".block-editor-warning": 5, - ".block-library-gallery-item__inline-menu": 20, ".block-editor-url-input__suggestions": 30, ".edit-post-layout__footer": 30, ".interface-interface-skeleton__header": 30, diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index 2ff26eb2f475d2..63590daa9c178e 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "5.16.0", + "version": "5.17.0", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blob/CHANGELOG.md b/packages/blob/CHANGELOG.md index 126b56cd813503..be1d924dd45760 100644 --- a/packages/blob/CHANGELOG.md +++ b/packages/blob/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.17.0 (2025-01-29) + ## 4.16.0 (2025-01-15) ## 4.15.0 (2025-01-02) diff --git a/packages/blob/package.json b/packages/blob/package.json index d2dd0c206892f7..9a0b10a416bec3 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "4.16.0", + "version": "4.17.0", "description": "Blob utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/CHANGELOG.md b/packages/block-directory/CHANGELOG.md index 80b139c9a966d0..0ac19bd45c8647 100644 --- a/packages/block-directory/CHANGELOG.md +++ b/packages/block-directory/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.17.0 (2025-01-29) + ## 5.16.0 (2025-01-15) ## 5.15.0 (2025-01-02) diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index e1f4cc0cefa988..f7750c2e49f170 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "5.16.0", + "version": "5.17.1", "description": "Extend editor with block directory features to search, download and install blocks.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js b/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js index f2344061f95660..e4d04cd244687d 100644 --- a/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js +++ b/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js @@ -2,17 +2,12 @@ * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { Icon, blockDefault } from '@wordpress/icons'; import { Tip, ExternalLink } from '@wordpress/components'; function DownloadableBlocksNoResults() { return ( <>
-

{ __( 'No results found.' ) }

diff --git a/packages/block-directory/src/plugins/index.js b/packages/block-directory/src/plugins/index.js index 283ff0ea4d2715..50418a9944d311 100644 --- a/packages/block-directory/src/plugins/index.js +++ b/packages/block-directory/src/plugins/index.js @@ -13,6 +13,9 @@ import InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel import getInstallMissing from './get-install-missing'; registerPlugin( 'block-directory', { + // The icon is explicitly set to undefined to prevent PluginPrePublishPanel + // from rendering the fallback icon pluginIcon. + icon: undefined, render() { return ( <> diff --git a/packages/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js b/packages/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js index 17630c9904e8bd..233f3261c79fc5 100644 --- a/packages/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js +++ b/packages/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js @@ -3,7 +3,6 @@ */ import { _n, sprintf } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; -import { blockDefault } from '@wordpress/icons'; import { PluginPrePublishPanel } from '@wordpress/editor'; /** @@ -24,7 +23,6 @@ export default function InstalledBlocksPrePublishPanel() { return ( { - if ( ! scrollableRef ) { - return; - } - function onWheel( event ) { const { deltaX, deltaY } = event; - scrollableRef.current.scrollBy( deltaX, deltaY ); + const contentEl = contentRef.current; + let scrollContainer = scrollContainerCache.get( contentEl ); + if ( ! scrollContainer ) { + scrollContainer = getScrollContainer( contentEl ); + scrollContainerCache.set( contentEl, scrollContainer ); + } + scrollContainer.scrollBy( deltaX, deltaY ); } // Tell the browser that we do not call event.preventDefault // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners @@ -29,7 +34,7 @@ function usePopoverScroll( scrollableRef ) { node.removeEventListener( 'wheel', onWheel, options ); }; }, - [ scrollableRef ] + [ contentRef ] ); } diff --git a/packages/block-editor/src/components/block-switcher/style.scss b/packages/block-editor/src/components/block-switcher/style.scss index 62a7bebe95d278..2762308eec961e 100644 --- a/packages/block-editor/src/components/block-switcher/style.scss +++ b/packages/block-editor/src/components/block-switcher/style.scss @@ -129,7 +129,9 @@ .block-editor-block-switcher__preview-patterns-container-list__item { height: 100%; border-radius: $radius-small; - transition: all 0.05s ease-in-out; + @media not ( prefers-reduced-motion ) { + transition: all 0.05s ease-in-out; + } position: relative; border: $border-width solid transparent; diff --git a/packages/block-editor/src/components/block-toolbar/style.scss b/packages/block-editor/src/components/block-toolbar/style.scss index 26bf71356925e9..2a3543f5ec7977 100644 --- a/packages/block-editor/src/components/block-toolbar/style.scss +++ b/packages/block-editor/src/components/block-toolbar/style.scss @@ -12,9 +12,11 @@ overflow-y: hidden; overflow-x: auto; - // Animation - transition: border-color 0.1s linear, box-shadow 0.1s linear; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + + // Animation + transition: border-color 0.1s linear, box-shadow 0.1s linear; + } @include break-small() { overflow: inherit; diff --git a/packages/block-editor/src/components/block-tools/block-toolbar-popover.js b/packages/block-editor/src/components/block-tools/block-toolbar-popover.js index c6378130b7da42..0724928cfeacb2 100644 --- a/packages/block-editor/src/components/block-tools/block-toolbar-popover.js +++ b/packages/block-editor/src/components/block-tools/block-toolbar-popover.js @@ -11,7 +11,7 @@ import { useShortcut } from '@wordpress/keyboard-shortcuts'; /** * Internal dependencies */ -import BlockPopover from '../block-popover'; +import { PrivateBlockPopover } from '../block-popover'; import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props'; import useSelectedBlockToolProps from './use-selected-block-tool-props'; import { store as blockEditorStore } from '../../store'; @@ -58,7 +58,7 @@ export default function BlockToolbarPopover( { return ( ! isTyping && ( - - + ) ); } diff --git a/packages/block-editor/src/components/block-tools/style.scss b/packages/block-editor/src/components/block-tools/style.scss index 35d075c1a99b78..35d0f99c827b67 100644 --- a/packages/block-editor/src/components/block-tools/style.scss +++ b/packages/block-editor/src/components/block-tools/style.scss @@ -191,9 +191,12 @@ .is-dragging-components-draggable & { opacity: 0; - // Use a minimal duration to delay hiding the element, see hide-during-dragging animation for more details. - // It's essential to hide the toolbar/popover so that `dragEnter` events can pass through them to the underlying elements. - animation: hide-during-dragging 1ms linear forwards; + @media not ( prefers-reduced-motion ) { + + // Use a minimal duration to delay hiding the element, see hide-during-dragging animation for more details. + // It's essential to hide the toolbar/popover so that `dragEnter` events can pass through them to the underlying elements. + animation: hide-during-dragging 1ms linear forwards; + } } .block-editor-block-parent-selector { diff --git a/packages/block-editor/src/components/button-block-appender/content.scss b/packages/block-editor/src/components/button-block-appender/content.scss index f5486d3f6f6086..dd6f0924835677 100644 --- a/packages/block-editor/src/components/button-block-appender/content.scss +++ b/packages/block-editor/src/components/button-block-appender/content.scss @@ -79,10 +79,8 @@ background-color: var(--wp-admin-theme-color); box-shadow: inset 0 0 0 $border-width $light-gray-placeholder; color: $light-gray-placeholder; - transition: background-color 0.2s ease-in-out; - - @media ( prefers-reduced-motion: reduce ) { - transition: none; + @media not ( prefers-reduced-motion ) { + transition: background-color 0.2s ease-in-out; } } } diff --git a/packages/block-editor/src/components/colors-gradients/style.scss b/packages/block-editor/src/components/colors-gradients/style.scss index 661318e5582414..6a882c4b1883ce 100644 --- a/packages/block-editor/src/components/colors-gradients/style.scss +++ b/packages/block-editor/src/components/colors-gradients/style.scss @@ -129,8 +129,9 @@ $swatch-gap: 12px; top: $grid-unit; margin: auto $grid-unit auto; opacity: 0; - transition: opacity 0.1s ease-in-out; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: opacity 0.1s ease-in-out; + } &.block-editor-panel-color-gradient-settings__reset { border-radius: $radius-small; diff --git a/packages/block-editor/src/components/global-styles/filters-panel.js b/packages/block-editor/src/components/global-styles/filters-panel.js index 64322d0fd5d5c9..3aed7255e411b4 100644 --- a/packages/block-editor/src/components/global-styles/filters-panel.js +++ b/packages/block-editor/src/components/global-styles/filters-panel.js @@ -9,8 +9,6 @@ import clsx from 'clsx'; import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, - __experimentalItemGroup as ItemGroup, - __experimentalItem as Item, __experimentalHStack as HStack, __experimentalZStack as ZStack, __experimentalDropdownContentWrapper as DropdownContentWrapper, @@ -21,9 +19,11 @@ import { Dropdown, Flex, FlexItem, + Button, } from '@wordpress/components'; import { __, _x } from '@wordpress/i18n'; -import { useCallback, useMemo } from '@wordpress/element'; +import { useCallback, useMemo, useRef } from '@wordpress/element'; +import { reset as resetIcon } from '@wordpress/icons'; /** * Internal dependencies @@ -117,6 +117,50 @@ const LabeledColorIndicator = ( { indicator, label } ) => ( ); +const renderToggle = + ( duotone, resetDuotone ) => + ( { onToggle, isOpen } ) => { + const duotoneButtonRef = useRef( undefined ); + + const toggleProps = { + onClick: onToggle, + className: clsx( { 'is-open': isOpen } ), + 'aria-expanded': isOpen, + ref: duotoneButtonRef, + }; + + const removeButtonProps = { + onClick: () => { + if ( isOpen ) { + onToggle(); + } + resetDuotone(); + // Return focus to parent button. + duotoneButtonRef.current?.focus(); + }, + className: 'block-editor-panel-duotone-settings__reset', + label: __( 'Reset' ), + }; + + return ( + <> + + { duotone && ( + @@ -119,7 +121,7 @@ export function ShadowPopover( { shadow, onShadowChange, settings } ) { ( { + const shadowButtonRef = useRef( undefined ); + const toggleProps = { onClick: onToggle, className: clsx( { 'is-open': isOpen } ), 'aria-expanded': isOpen, + ref: shadowButtonRef, + }; + + const removeButtonProps = { + onClick: () => { + if ( isOpen ) { + onToggle(); + } + onShadowChange( undefined ); + // Return focus to parent button. + shadowButtonRef.current?.focus(); + }, + className: clsx( + 'block-editor-global-styles__shadow-editor__remove-button', + { 'is-open': isOpen } + ), + label: __( 'Remove' ), }; return ( - + { !! shadow && ( + + ) } + ); }; } diff --git a/packages/block-editor/src/components/global-styles/style.scss b/packages/block-editor/src/components/global-styles/style.scss index e0782fdb01b1d0..3645586f283115 100644 --- a/packages/block-editor/src/components/global-styles/style.scss +++ b/packages/block-editor/src/components/global-styles/style.scss @@ -24,6 +24,7 @@ .block-editor-global-styles__shadow-dropdown { display: block; padding: 0; + position: relative; button { width: 100%; @@ -35,6 +36,33 @@ } } +.block-editor-global-styles__shadow-editor__remove-button { + position: absolute; + right: 0; + top: $grid-unit; + margin: auto $grid-unit auto; + opacity: 0; + @media not (prefers-reduced-motion) { + transition: opacity 0.1s ease-in-out; + } + + .block-editor-global-styles__shadow-dropdown:hover &, + &:focus, + &:hover { + opacity: 1; + } + + @media (hover: none) { + // Show reset button on devices that do not support hover. + opacity: 1; + } +} + +.block-editor-global-styles-filters-panel__dropdown { + border: 1px solid $gray-300; + border-radius: $radius-small; +} + // These styles are similar to the color palette. .block-editor-global-styles__shadow-indicator { appearance: none; @@ -53,7 +81,9 @@ box-sizing: border-box; transform: scale(1); - transition: transform 0.1s ease; + @media not ( prefers-reduced-motion ) { + transition: transform 0.1s ease; + } will-change: transform; &:focus { @@ -75,3 +105,25 @@ /*rtl:ignore*/ direction: ltr; } + +.block-editor-panel-duotone-settings__reset { + position: absolute; + right: 0; + top: $grid-unit; + margin: auto $grid-unit auto; + opacity: 0; + @media not (prefers-reduced-motion) { + transition: opacity 0.1s ease-in-out; + } + + .block-editor-global-styles-filters-panel__dropdown:hover &, + &:focus, + &:hover { + opacity: 1; + } + + @media (hover: none) { + // Show reset button on devices that do not support hover. + opacity: 1; + } +} diff --git a/packages/block-editor/src/components/grid/grid-visualizer.js b/packages/block-editor/src/components/grid/grid-visualizer.js index 9d89866bbff5f7..c272691ab56561 100644 --- a/packages/block-editor/src/components/grid/grid-visualizer.js +++ b/packages/block-editor/src/components/grid/grid-visualizer.js @@ -54,29 +54,18 @@ const GridVisualizerGrid = forwardRef( const [ isDroppingAllowed, setIsDroppingAllowed ] = useState( false ); useEffect( () => { - const observers = []; - for ( const element of [ gridElement, ...gridElement.children ] ) { - const observer = new window.ResizeObserver( () => { - setGridInfo( getGridInfo( gridElement ) ); - } ); - observer.observe( element ); - observers.push( observer ); - } - - const mutationObserver = new window.MutationObserver( () => { + const resizeCallback = () => setGridInfo( getGridInfo( gridElement ) ); - } ); - mutationObserver.observe( gridElement, { - attributeFilter: [ 'style', 'class' ], - childList: true, - subtree: true, - } ); - observers.push( mutationObserver ); - + // Both border-box and content-box are observed as they may change + // independently. This requires two observers because a single one + // can’t be made to monitor both on the same element. + const borderBoxSpy = new window.ResizeObserver( resizeCallback ); + borderBoxSpy.observe( gridElement, { box: 'border-box' } ); + const contentBoxSpy = new window.ResizeObserver( resizeCallback ); + contentBoxSpy.observe( gridElement ); return () => { - for ( const observer of observers ) { - observer.disconnect(); - } + borderBoxSpy.disconnect(); + contentBoxSpy.disconnect(); }; }, [ gridElement ] ); diff --git a/packages/block-editor/src/components/grid/style.scss b/packages/block-editor/src/components/grid/style.scss index 3a04eb006e7910..ab36ed12984bd7 100644 --- a/packages/block-editor/src/components/grid/style.scss +++ b/packages/block-editor/src/components/grid/style.scss @@ -20,6 +20,7 @@ .block-editor-grid-visualizer__grid { display: grid; + position: absolute; } .block-editor-grid-visualizer__cell { @@ -125,10 +126,11 @@ right: $grid-unit-10; z-index: -1; - // Animate in. - animation: components-button__appear-animation 0.1s ease; - animation-fill-mode: forwards; - @include reduce-motion("animation"); + @media not ( prefers-reduced-motion ) { + // Animate in. + animation: components-button__appear-animation 0.1s ease; + animation-fill-mode: forwards; + } } // Don't show the focus inherited by the Button component. diff --git a/packages/block-editor/src/components/grid/utils.js b/packages/block-editor/src/components/grid/utils.js index 21014108085423..ada02755f26092 100644 --- a/packages/block-editor/src/components/grid/utils.js +++ b/packages/block-editor/src/components/grid/utils.js @@ -187,10 +187,12 @@ export function getGridInfo( gridElement ) { gridTemplateColumns, gridTemplateRows, gap: getComputedCSS( gridElement, 'gap' ), - paddingTop: `calc(${ paddingTop } + ${ borderTopWidth })`, - paddingRight: `calc(${ paddingRight } + ${ borderRightWidth })`, - paddingBottom: `calc(${ paddingBottom } + ${ borderBottomWidth })`, - paddingLeft: `calc(${ paddingLeft } + ${ borderLeftWidth })`, + inset: ` + calc(${ paddingTop } + ${ borderTopWidth }) + calc(${ paddingRight } + ${ borderRightWidth }) + calc(${ paddingBottom } + ${ borderBottomWidth }) + calc(${ paddingLeft } + ${ borderLeftWidth }) + `, }, }; } diff --git a/packages/block-editor/src/components/iframe/content.scss b/packages/block-editor/src/components/iframe/content.scss index 05bbdb25c2dc63..8a85ea186b2e64 100644 --- a/packages/block-editor/src/components/iframe/content.scss +++ b/packages/block-editor/src/components/iframe/content.scss @@ -4,8 +4,11 @@ .block-editor-iframe__html { transform-origin: top center; - // Prevents a flash of background color change when entering/exiting zoom out - transition: background-color 400ms; + + @media not ( prefers-reduced-motion ) { + // Prevents a flash of background color change when entering/exiting zoom out + transition: background-color 400ms; + } &.zoom-out-animation { $scroll-top: var(--wp-block-editor-iframe-zoom-out-scroll-top, 0); diff --git a/packages/block-editor/src/components/inner-blocks/index.js b/packages/block-editor/src/components/inner-blocks/index.js index ae587720278200..58faf9f9a34e1a 100644 --- a/packages/block-editor/src/components/inner-blocks/index.js +++ b/packages/block-editor/src/components/inner-blocks/index.js @@ -174,11 +174,11 @@ const ForwardedInnerBlocks = forwardRef( ( props, ref ) => { * returns. Optionally, you can also pass any other props through this hook, and * they will be merged and returned. * + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md + * * @param {Object} props Optional. Props to pass to the element. Must contain * the ref if one is defined. * @param {Object} options Optional. Inner blocks options. - * - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md */ export function useInnerBlocksProps( props = {}, options = {} ) { const { diff --git a/packages/block-editor/src/components/inner-blocks/index.native.js b/packages/block-editor/src/components/inner-blocks/index.native.js index 1398a5abd51e4b..635c44d2e085c5 100644 --- a/packages/block-editor/src/components/inner-blocks/index.native.js +++ b/packages/block-editor/src/components/inner-blocks/index.native.js @@ -35,11 +35,11 @@ import { MAX_NESTING_DEPTH } from './constants'; * returns. Optionally, you can also pass any other props through this hook, and * they will be merged and returned. * + * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md + * * @param {Object} props Optional. Props to pass to the element. Must contain * the ref if one is defined. * @param {Object} options Optional. Inner blocks options. - * - * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md */ export function useInnerBlocksProps( props = {}, options = {} ) { const fallbackRef = useRef(); diff --git a/packages/block-editor/src/components/inserter-list-item/style.scss b/packages/block-editor/src/components/inserter-list-item/style.scss index 435f60ed9e2f14..68d4059340f5c9 100644 --- a/packages/block-editor/src/components/inserter-list-item/style.scss +++ b/packages/block-editor/src/components/inserter-list-item/style.scss @@ -43,8 +43,9 @@ cursor: pointer; background: transparent; word-break: break-word; - transition: all 0.05s ease-in-out; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: all 0.05s ease-in-out; + } position: relative; height: auto; @@ -97,8 +98,9 @@ .block-editor-block-types-list__item-icon { padding: 12px 20px; color: $gray-900; - transition: all 0.05s ease-in-out; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: all 0.05s ease-in-out; + } .block-editor-block-icon { margin-left: auto; @@ -106,8 +108,9 @@ } svg { - transition: all 0.15s ease-out; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: all 0.15s ease-out; + } } .block-editor-block-types-list__list-item[draggable="true"] & { diff --git a/packages/block-editor/src/components/inserter/no-results.js b/packages/block-editor/src/components/inserter/no-results.js index 3ca6569dc14ea4..e005622f3cf3dc 100644 --- a/packages/block-editor/src/components/inserter/no-results.js +++ b/packages/block-editor/src/components/inserter/no-results.js @@ -2,15 +2,10 @@ * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { Icon, blockDefault } from '@wordpress/icons'; function InserterNoResults() { return (
-

{ __( 'No results found.' ) }

); diff --git a/packages/block-editor/src/components/inserter/quick-inserter.js b/packages/block-editor/src/components/inserter/quick-inserter.js index 498030a0019dcc..baedf91b87a906 100644 --- a/packages/block-editor/src/components/inserter/quick-inserter.js +++ b/packages/block-editor/src/components/inserter/quick-inserter.js @@ -21,6 +21,7 @@ import { store as blockEditorStore } from '../../store'; const SEARCH_THRESHOLD = 6; const SHOWN_BLOCK_TYPES = 6; +const SHOWN_BLOCK_PATTERNS = 2; export default function QuickInserter( { onSelect, @@ -106,7 +107,9 @@ export default function QuickInserter( { rootClientId={ rootClientId } clientId={ clientId } isAppender={ isAppender } - maxBlockPatterns={ 0 } + maxBlockPatterns={ + !! filterValue ? SHOWN_BLOCK_PATTERNS : 0 + } maxBlockTypes={ SHOWN_BLOCK_TYPES } isDraggable={ false } selectBlockOnInsert={ selectBlockOnInsert } diff --git a/packages/block-editor/src/components/inserter/search-results.js b/packages/block-editor/src/components/inserter/search-results.js index 5a5725a3bb08cd..c020e86f99a638 100644 --- a/packages/block-editor/src/components/inserter/search-results.js +++ b/packages/block-editor/src/components/inserter/search-results.js @@ -84,7 +84,9 @@ function InserterSearchResults( { ] = useBlockTypesState( destinationRootClientId, onInsertBlocks, isQuick ); const [ patterns, , onClickPattern ] = usePatternsState( onInsertBlocks, - destinationRootClientId + destinationRootClientId, + undefined, + isQuick ); const filteredBlockPatterns = useMemo( () => { diff --git a/packages/block-editor/src/components/inserter/style.scss b/packages/block-editor/src/components/inserter/style.scss index c6522671f938d7..20aa1c288103d4 100644 --- a/packages/block-editor/src/components/inserter/style.scss +++ b/packages/block-editor/src/components/inserter/style.scss @@ -83,8 +83,9 @@ $block-inserter-tabs-height: 44px; border: none; outline: none; padding: 0; - transition: color 0.2s ease; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: color 0.2s ease; + } } .block-editor-inserter__menu { @@ -167,10 +168,6 @@ $block-inserter-tabs-height: 44px; text-align: center; } -.block-editor-inserter__no-results-icon { - fill: $gray-600; -} - .block-editor-inserter__child-blocks { padding: 0 $grid-unit-20; } @@ -563,8 +560,9 @@ $block-inserter-tabs-height: 44px; outline-color: var(--wp-admin-theme-color); outline-width: var(--wp-admin-border-width-focus); outline-offset: calc((-1 * var(--wp-admin-border-width-focus))); - transition: outline 0.1s linear; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: outline 0.1s linear; + } } } diff --git a/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js b/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js index 42a8597227dee9..17f65d58b8f74b 100644 --- a/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js +++ b/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js @@ -2,11 +2,11 @@ * WordPress dependencies */ import { - PanelBody, __experimentalUseSlotFills as useSlotFills, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; -import { useSelect } from '@wordpress/data'; -import { useLayoutEffect, useState } from '@wordpress/element'; +import { useDispatch, useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; /** @@ -15,40 +15,75 @@ import { __ } from '@wordpress/i18n'; import InspectorControlsGroups from '../inspector-controls/groups'; import { default as InspectorControls } from '../inspector-controls'; import { store as blockEditorStore } from '../../store'; +import { useToolsPanelDropdownMenuProps } from '../global-styles/utils'; +import { cleanEmptyObject } from '../../hooks/utils'; const PositionControlsPanel = () => { - const [ initialOpen, setInitialOpen ] = useState(); + const { selectedClientIds, selectedBlocks, hasPositionAttribute } = + useSelect( ( select ) => { + const { getBlocksByClientId, getSelectedBlockClientIds } = + select( blockEditorStore ); - // Determine whether the panel should be expanded. - const { multiSelectedBlocks } = useSelect( ( select ) => { - const { getBlocksByClientId, getSelectedBlockClientIds } = - select( blockEditorStore ); - const clientIds = getSelectedBlockClientIds(); - return { - multiSelectedBlocks: getBlocksByClientId( clientIds ), - }; - }, [] ); + const selectedBlockClientIds = getSelectedBlockClientIds(); + const _selectedBlocks = getBlocksByClientId( + selectedBlockClientIds + ); - useLayoutEffect( () => { - // If any selected block has a position set, open the panel by default. - // The first block's value will still be used within the control though. - if ( initialOpen === undefined ) { - setInitialOpen( - multiSelectedBlocks.some( + return { + selectedClientIds: selectedBlockClientIds, + selectedBlocks: _selectedBlocks, + hasPositionAttribute: _selectedBlocks?.some( ( { attributes } ) => !! attributes?.style?.position?.type - ) - ); + ), + }; + }, [] ); + + const { updateBlockAttributes } = useDispatch( blockEditorStore ); + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); + + function resetPosition() { + if ( ! selectedClientIds?.length || ! selectedBlocks?.length ) { + return; } - }, [ initialOpen, multiSelectedBlocks, setInitialOpen ] ); + + const attributesByClientId = Object.fromEntries( + selectedBlocks?.map( ( { clientId, attributes } ) => [ + clientId, + { + style: cleanEmptyObject( { + ...attributes?.style, + position: { + ...attributes?.style?.position, + type: undefined, + top: undefined, + right: undefined, + bottom: undefined, + left: undefined, + }, + } ), + }, + ] ) + ); + + updateBlockAttributes( selectedClientIds, attributesByClientId, true ); + } return ( - - - + hasPositionAttribute } + onDeselect={ resetPosition } + > + + + ); }; diff --git a/packages/block-editor/src/components/link-control/style.scss b/packages/block-editor/src/components/link-control/style.scss index 16493e1a5aa7f0..c10135f8e441a7 100644 --- a/packages/block-editor/src/components/link-control/style.scss +++ b/packages/block-editor/src/components/link-control/style.scss @@ -289,8 +289,10 @@ $block-editor-link-control-number-of-actions: 1; right: 0; bottom: 0; border-radius: 100%; - animation: loadingpulse 1s linear infinite; - animation-delay: 0.5s; // avoid animating for fast network responses + @media not ( prefers-reduced-motion ) { + animation: loadingpulse 1s linear infinite; + animation-delay: 0.5s; // avoid animating for fast network responses + } } } } @@ -381,16 +383,19 @@ $block-editor-link-control-number-of-actions: 1; // Point downwards when open (same as list view expander) &[aria-expanded="true"] svg { visibility: visible; - transition: transform 0.1s ease; + @media not ( prefers-reduced-motion ) { + transition: transform 0.1s ease; + } transform: rotate(90deg); - @include reduce-motion("transition"); + } // Point rightwards when closed (same as list view expander) &[aria-expanded="false"] svg { visibility: visible; transform: rotate(0deg); - transition: transform 0.1s ease; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: transform 0.1s ease; + } } } } diff --git a/packages/block-editor/src/components/list-view/style.scss b/packages/block-editor/src/components/list-view/style.scss index 138029262cd7f5..bc68cb26637905 100644 --- a/packages/block-editor/src/components/list-view/style.scss +++ b/packages/block-editor/src/components/list-view/style.scss @@ -158,21 +158,27 @@ // without attaching the transition to the list view leaf itself. This prevents rows // from animating too much once the user has dropped the block. &.is-displacement-normal { - transition: transform 0.2s; + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s; + } transform: translateY(0); - @include reduce-motion("transition"); + } &.is-displacement-up { - transition: transform 0.2s; + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s; + } transform: translateY(-32px); - @include reduce-motion("transition"); + } &.is-displacement-down { - transition: transform 0.2s; + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s; + } transform: translateY(32px); - @include reduce-motion("transition"); + } // Collapse multi-selections down into a single row space while dragging. The following @@ -180,23 +186,30 @@ // when displacing up and down. The result is that there should only ever be a single row's // worth of space for the visual indicator of where a block will be placed when dropped. &.is-after-dragged-blocks { - transition: transform 0.2s; + + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s; + } transform: translateY(calc(var(--wp-admin--list-view-dragged-items-height, 32px) * -1)); - @include reduce-motion("transition"); + } &.is-after-dragged-blocks.is-displacement-up { - transition: transform 0.2s; + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s; + } transform: translateY(calc(-32px + var(--wp-admin--list-view-dragged-items-height, 32px) * -1)); - @include reduce-motion("transition"); + } &.is-after-dragged-blocks.is-displacement-down { - transition: transform 0.2s; + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s; + } transform: translateY(calc(32px + var(--wp-admin--list-view-dragged-items-height, 32px) * -1)); - @include reduce-motion("transition"); + } // To ensure displaced rows behave correctly, ensure that blocks that are currently being dragged @@ -233,7 +246,9 @@ font-weight: 400; margin: 0; text-decoration: none; - transition: box-shadow 0.1s linear; + @media not ( prefers-reduced-motion ) { + transition: box-shadow 0.1s linear; + } .components-modal__content & { padding-left: 0; @@ -496,9 +511,10 @@ $block-navigation-max-indent: 8; .block-editor-list-view__expander svg { visibility: visible; - transition: transform 0.2s ease; + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s ease; + } transform: rotate(90deg); - @include reduce-motion("transition"); } // Point rightwards when closed @@ -507,8 +523,9 @@ svg { svg { visibility: visible; transform: rotate(0deg); - transition: transform 0.2s ease; - @include reduce-motion("transition"); + @media not ( prefers-reduced-motion ) { + transition: transform 0.2s ease; + } } .block-editor-list-view-drop-indicator { diff --git a/packages/block-editor/src/components/spacing-sizes-control/README.md b/packages/block-editor/src/components/spacing-sizes-control/README.md new file mode 100644 index 00000000000000..c8e280c6807120 --- /dev/null +++ b/packages/block-editor/src/components/spacing-sizes-control/README.md @@ -0,0 +1,93 @@ +# Spacing Sizes Control + +The SpacingSizesControl component provides a flexible user interface for controlling spacing values in blocks, allowing users to modify values for different sides. It supports three viewing modes: + +1. Single: Control one side at a time. +2. Axial: Control horizontal and vertical sides together. +3. Custom: Control each side separately. + +## Usage + +```jsx +import { __experimentalSpacingSizesControl as SpacingSizesControl } from '@wordpress/block-editor'; +import { useState } from '@wordpress/element'; + +function Example() { + const [ sides, setSides ] = useState( { + top: '0px', + right: '0px', + bottom: '0px', + left: '0px', + } ); + + return ( + + ); +} +``` + +## Props + +### `inputProps` + +- Type: `Object` +- Required: No +- Description: Additional props to pass to the input controls. + +### `label` + +- Type: `String` +- Required: Yes +- Description: Label for the control. + +### `minimumCustomValue` + +- Type: `Number` +- Default: 0 +- Description: Minimum value allowed for custom input. + +### `onChange` + +- Type: `Function` +- Required: Yes +- Description: Callback function called when spacing values change. Receives an object containing the updated values. + +### `onMouseOut` + +- Type: `Function` +- Required: No +- Description: Callback function called when mouse leaves the control. + +### `onMouseOver` + +- Type: `Function` +- Required: No +- Description: Callback function called when mouse enters the control. + +### `showSideInLabel` + +- Type: `Boolean` +- Default: true +- Description: Whether to show the side (top, right, etc.) in the control label. + +### `sides` + +- Type: `Array` +- Default: ALL_SIDES (top, right, bottom, left) +- Description: Array of sides that can be controlled. + +### `useSelect` + +- Type: `Boolean` +- Required: No +- Description: Whether to use a select control for predefined values. + +### `values` + +- Type: `Object` +- Required: No +- Description: Object containing the current spacing values for each side. diff --git a/packages/block-editor/src/components/spacing-sizes-control/index.js b/packages/block-editor/src/components/spacing-sizes-control/index.js index 458b0abee60f2e..5adbe5548556ff 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/index.js +++ b/packages/block-editor/src/components/spacing-sizes-control/index.js @@ -12,11 +12,11 @@ import { _x, sprintf } from '@wordpress/i18n'; /** * Internal dependencies */ +import useSpacingSizes from './hooks/use-spacing-sizes'; import AxialInputControls from './input-controls/axial'; import SeparatedInputControls from './input-controls/separated'; import SingleInputControl from './input-controls/single'; import LinkedButton from './linked-button'; -import useSpacingSizes from './hooks/use-spacing-sizes'; import { ALL_SIDES, DEFAULT_VALUES, @@ -25,6 +25,49 @@ import { getInitialView, } from './utils'; +/** + * A flexible control for managing spacing values in the block editor. Supports single, axial, + * and separated input controls for different spacing configurations with automatic view selection + * based on current values and available sides. + * + * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/spacing-sizes-control/README.md + * + * @example + * ```jsx + * import { __experimentalSpacingSizesControl as SpacingSizesControl } from '@wordpress/block-editor'; + * import { useState } from '@wordpress/element'; + * + * function Example() { + * const [ sides, setSides ] = useState( { + * top: '0px', + * right: '0px', + * bottom: '0px', + * left: '0px', + * } ); + * + * return ( + * + * ); + * } + * ``` + * + * @param {Object} props Component props. + * @param {Object} props.inputProps Additional props for input controls. + * @param {string} props.label Label for the control. + * @param {number} props.minimumCustomValue Minimum value for custom input. + * @param {Function} props.onChange Called when spacing values change. + * @param {Function} props.onMouseOut Called when mouse leaves the control. + * @param {Function} props.onMouseOver Called when mouse enters the control. + * @param {boolean} props.showSideInLabel Show side in control label. + * @param {Array} props.sides Available sides for control. + * @param {boolean} props.useSelect Use select control for predefined values. + * @param {Object} props.values Current spacing values. + * @return {Element} Spacing sizes control component. + */ export default function SpacingSizesControl( { inputProps, label: labelProp, diff --git a/packages/block-editor/src/components/spacing-sizes-control/linked-button.js b/packages/block-editor/src/components/spacing-sizes-control/linked-button.js index f6d56be66072ad..413dc88a52e9b9 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/linked-button.js +++ b/packages/block-editor/src/components/spacing-sizes-control/linked-button.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { Button, Tooltip } from '@wordpress/components'; +import { Button } from '@wordpress/components'; import { link, linkOff } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; @@ -9,14 +9,12 @@ export default function LinkedButton( { isLinked, ...props } ) { const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' ); return ( - -
diff --git a/packages/block-library/src/latest-comments/edit.js b/packages/block-library/src/latest-comments/edit.js index 85e66cf2e9dc60..432cd389efacc3 100644 --- a/packages/block-library/src/latest-comments/edit.js +++ b/packages/block-library/src/latest-comments/edit.js @@ -4,13 +4,19 @@ import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; import { Disabled, - PanelBody, RangeControl, ToggleControl, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import ServerSideRender from '@wordpress/server-side-render'; import { __ } from '@wordpress/i18n'; +/** + * Internal dependencies + */ +import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; + /** * Minimum number of comments a user can show using this block. * @@ -36,49 +42,103 @@ export default function LatestComments( { attributes, setAttributes } ) { }, }; + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); + return (
- - { + setAttributes( { + commentsToShow: 5, + displayAvatar: true, + displayDate: true, + displayExcerpt: true, + } ); + } } + dropdownMenuProps={ dropdownMenuProps } + > + ! displayAvatar } label={ __( 'Display avatar' ) } - checked={ displayAvatar } - onChange={ () => - setAttributes( { displayAvatar: ! displayAvatar } ) + onDeselect={ () => + setAttributes( { displayAvatar: true } ) } - /> - + + setAttributes( { + displayAvatar: ! displayAvatar, + } ) + } + /> + + + ! displayDate } label={ __( 'Display date' ) } - checked={ displayDate } - onChange={ () => - setAttributes( { displayDate: ! displayDate } ) + onDeselect={ () => + setAttributes( { displayDate: true } ) } - /> - + + setAttributes( { displayDate: ! displayDate } ) + } + /> + + + ! displayExcerpt } label={ __( 'Display excerpt' ) } - checked={ displayExcerpt } - onChange={ () => - setAttributes( { - displayExcerpt: ! displayExcerpt, - } ) + onDeselect={ () => + setAttributes( { displayExcerpt: true } ) } - /> - + + setAttributes( { + displayExcerpt: ! displayExcerpt, + } ) + } + /> + + + commentsToShow !== 5 } label={ __( 'Number of comments' ) } - value={ commentsToShow } - onChange={ ( value ) => - setAttributes( { commentsToShow: value } ) + onDeselect={ () => + setAttributes( { commentsToShow: 5 } ) } - min={ MIN_COMMENTS } - max={ MAX_COMMENTS } - required - /> - + isShownByDefault + > + + setAttributes( { commentsToShow: value } ) + } + min={ MIN_COMMENTS } + max={ MAX_COMMENTS } + required + /> + + - - + setAttributes( { + displayPostContent: false, + displayPostContentRadio: 'excerpt', + excerptLength: DEFAULT_EXCERPT_LENGTH, + } ) + } + dropdownMenuProps={ dropdownMenuProps } + > + !! displayPostContent } label={ __( 'Post content' ) } - checked={ displayPostContent } - onChange={ ( value ) => - setAttributes( { displayPostContent: value } ) + onDeselect={ () => + setAttributes( { displayPostContent: false } ) } - /> + isShownByDefault + > + + setAttributes( { displayPostContent: value } ) + } + /> + { displayPostContent && ( - displayPostContentRadio !== 'excerpt' } label={ __( 'Show' ) } - selected={ displayPostContentRadio } - options={ [ - { label: __( 'Excerpt' ), value: 'excerpt' }, - { - label: __( 'Full post' ), - value: 'full_post', - }, - ] } - onChange={ ( value ) => + onDeselect={ () => setAttributes( { - displayPostContentRadio: value, + displayPostContentRadio: 'excerpt', } ) } - /> + isShownByDefault + > + + setAttributes( { + displayPostContentRadio: value, + } ) + } + /> + ) } { displayPostContent && displayPostContentRadio === 'excerpt' && ( - + excerptLength !== DEFAULT_EXCERPT_LENGTH + } label={ __( 'Max number of words' ) } - value={ excerptLength } - onChange={ ( value ) => - setAttributes( { excerptLength: value } ) + onDeselect={ () => + setAttributes( { + excerptLength: DEFAULT_EXCERPT_LENGTH, + } ) } - min={ MIN_EXCERPT_LENGTH } - max={ MAX_EXCERPT_LENGTH } - /> + isShownByDefault + > + + setAttributes( { excerptLength: value } ) + } + min={ MIN_EXCERPT_LENGTH } + max={ MAX_EXCERPT_LENGTH } + /> + ) } - + - - + setAttributes( { + displayAuthor: false, + displayPostDate: false, + } ) + } + dropdownMenuProps={ dropdownMenuProps } + > + !! displayAuthor } label={ __( 'Display author name' ) } - checked={ displayAuthor } - onChange={ ( value ) => - setAttributes( { displayAuthor: value } ) + onDeselect={ () => + setAttributes( { displayAuthor: false } ) } - /> - + + setAttributes( { displayAuthor: value } ) + } + /> + + !! displayPostDate } label={ __( 'Display post date' ) } - checked={ displayPostDate } - onChange={ ( value ) => - setAttributes( { displayPostDate: value } ) + onDeselect={ () => + setAttributes( { displayPostDate: false } ) } - /> - - + isShownByDefault + > + + setAttributes( { displayPostDate: value } ) + } + /> + + { await triggerBlockListLayout( listBlock ); // Get List item - const listItemBlock = await getBlock( screen, 'List item' ); + const listItemBlock = await getBlock( screen, 'List Item' ); fireEvent.press( listItemBlock ); expect( listItemBlock ).toBeVisible(); @@ -75,7 +75,7 @@ describe( 'List block', () => { // Select List Item block const [ listItemBlock ] = screen.getAllByLabelText( - /List item Block\. Row 1/ + /List Item Block\. Row 1/ ); fireEvent.press( listItemBlock ); @@ -124,7 +124,7 @@ describe( 'List block', () => { // Select List Item block const [ firstNestedLevelBlock ] = within( listBlock ).getAllByLabelText( - /List item Block\. Row 2/ + /List Item Block\. Row 2/ ); fireEvent.press( firstNestedLevelBlock ); await triggerBlockListLayout( firstNestedLevelBlock ); @@ -159,7 +159,7 @@ describe( 'List block', () => { // Select Second List Item block const [ listItemBlock ] = screen.getAllByLabelText( - /List item Block\. Row 2/ + /List Item Block\. Row 2/ ); fireEvent.press( listItemBlock ); @@ -169,7 +169,7 @@ describe( 'List block', () => { // Await recently indented list item layout const [ listItemBlock1 ] = screen.getAllByLabelText( - /List item Block\. Row 1/ + /List Item Block\. Row 1/ ); await triggerBlockListLayout( listItemBlock1 ); @@ -203,7 +203,7 @@ describe( 'List block', () => { // Select List Item block const [ firstNestedLevelBlock ] = within( listBlock ).getAllByLabelText( - /List item Block\. Row 1/ + /List Item Block\. Row 1/ ); fireEvent.press( firstNestedLevelBlock ); await triggerBlockListLayout( firstNestedLevelBlock ); @@ -217,7 +217,7 @@ describe( 'List block', () => { // Select nested List Item block const [ listItemBlock ] = within( innerBlockList ).getAllByLabelText( - /List item Block\. Row 1/ + /List Item Block\. Row 1/ ); fireEvent.press( listItemBlock ); @@ -500,7 +500,7 @@ describe( 'List block', () => { // Select List Item block const [ listItemBlock ] = within( listBlock ).getAllByLabelText( - /List item Block\. Row 1/ + /List Item Block\. Row 1/ ); fireEvent.press( listItemBlock ); @@ -560,7 +560,7 @@ describe( 'List block', () => { // Select List Item block const [ listItemBlock ] = within( listBlock ).getAllByLabelText( - /List item Block\. Row 1/ + /List Item Block\. Row 1/ ); fireEvent.press( listItemBlock ); diff --git a/packages/block-library/src/navigation-link/edit.js b/packages/block-library/src/navigation-link/edit.js index 8ff438dc20abef..11a281a44a76d7 100644 --- a/packages/block-library/src/navigation-link/edit.js +++ b/packages/block-library/src/navigation-link/edit.js @@ -14,7 +14,6 @@ import { TextControl, TextareaControl, ToolbarButton, - Tooltip, ToolbarGroup, } from '@wordpress/components'; import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes'; @@ -490,10 +489,6 @@ export default function NavigationLinkEdit( { const placeholderText = `(${ isInvalid ? __( 'Invalid' ) : __( 'Draft' ) })`; - const tooltipText = - isInvalid || isDraft - ? __( 'This item has been deleted, or is a draft' ) - : __( 'This item is missing a link' ); return ( <> @@ -533,9 +528,7 @@ export default function NavigationLinkEdit( { { /* eslint-enable */ } { ! url ? (
- - { missingText } - + { missingText }
) : ( <> @@ -578,27 +571,30 @@ export default function NavigationLinkEdit( { { ( isInvalid || isDraft || isLabelFieldFocused ) && ( -
- - - { - // Some attributes are stored in an escaped form. It's a legacy issue. - // Ideally they would be stored in a raw, unescaped form. - // Unescape is used here to "recover" the escaped characters - // so they display without encoding. - // See `updateAttributes` for more details. - `${ decodeEntities( label ) } ${ - isInvalid || isDraft - ? placeholderText - : '' - }`.trim() - } - - +
+ + { + // Some attributes are stored in an escaped form. It's a legacy issue. + // Ideally they would be stored in a raw, unescaped form. + // Unescape is used here to "recover" the escaped characters + // so they display without encoding. + // See `updateAttributes` for more details. + `${ decodeEntities( label ) } ${ + isInvalid || isDraft + ? placeholderText + : '' + }`.trim() + } +
) } diff --git a/packages/block-library/src/navigation-link/editor.scss b/packages/block-library/src/navigation-link/editor.scss index 84cd6f6d4ee363..b27c4520921fd4 100644 --- a/packages/block-library/src/navigation-link/editor.scss +++ b/packages/block-library/src/navigation-link/editor.scss @@ -80,24 +80,33 @@ background-image: none !important; // Draw a wavy underline. - .wp-block-navigation-link__placeholder-text span { - $blur: 10%; - $width: 6%; - $stop1: 30%; - $stop2: 64%; - - --wp-underline-color: var(--wp-admin-theme-color); - - background-image: - linear-gradient(45deg, transparent ($stop1 - $blur), var(--wp-underline-color) $stop1, var(--wp-underline-color) ($stop1 + $width), transparent ($stop1 + $width + $blur)), - linear-gradient(135deg, transparent ($stop2 - $blur), var(--wp-underline-color) $stop2, var(--wp-underline-color) ($stop2 + $width), transparent ($stop2 + $width + $blur)); - background-position: 0 100%; - background-size: 6px 3px; - background-repeat: repeat-x; - - // Since applied to a span, it doesn't change the footprint of the item, - // but it does vertically shift the underline to better align. - padding-bottom: 0.1em; + .wp-block-navigation-link__placeholder-text { + span { + $blur: 10%; + $width: 6%; + $stop1: 30%; + $stop2: 64%; + + --wp-underline-color: var(--wp-admin-theme-color); + + background-image: + linear-gradient(45deg, transparent ($stop1 - $blur), var(--wp-underline-color) $stop1, var(--wp-underline-color) ($stop1 + $width), transparent ($stop1 + $width + $blur)), + linear-gradient(135deg, transparent ($stop2 - $blur), var(--wp-underline-color) $stop2, var(--wp-underline-color) ($stop2 + $width), transparent ($stop2 + $width + $blur)); + background-position: 0 100%; + background-size: 6px 3px; + background-repeat: repeat-x; + + // Since applied to a span, it doesn't change the footprint of the item, + // but it does vertically shift the underline to better align. + padding-bottom: 0.1em; + } + + &.is-invalid, + &.is-draft { + span { + --wp-underline-color: #{$alert-red}; + } + } } // This needs extra specificity. diff --git a/packages/block-library/src/navigation-submenu/index.js b/packages/block-library/src/navigation-submenu/index.js index 69e97fb85325a5..f5eb1e2346d76e 100644 --- a/packages/block-library/src/navigation-submenu/index.js +++ b/packages/block-library/src/navigation-submenu/index.js @@ -2,6 +2,7 @@ * WordPress dependencies */ import { page, addSubmenu } from '@wordpress/icons'; +import { _x } from '@wordpress/i18n'; /** * Internal dependencies @@ -37,6 +38,12 @@ export const settings = { return label; }, edit, + example: { + attributes: { + label: _x( 'About', 'Example link text for Navigation Submenu' ), + type: 'page', + }, + }, save, transforms, }; diff --git a/packages/block-library/src/navigation-submenu/index.php b/packages/block-library/src/navigation-submenu/index.php index 0f560e2849fac2..016e708c3256e6 100644 --- a/packages/block-library/src/navigation-submenu/index.php +++ b/packages/block-library/src/navigation-submenu/index.php @@ -82,7 +82,6 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { $font_sizes = block_core_navigation_submenu_build_css_font_sizes( $block->context ); $style_attribute = $font_sizes['inline_styles']; - $css_classes = trim( implode( ' ', $font_sizes['css_classes'] ) ); $has_submenu = count( $block->inner_blocks ) > 0; $kind = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] ); $is_active = ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->$kind ); @@ -99,11 +98,29 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) { $open_on_hover_and_click = isset( $block->context['openSubmenusOnClick'] ) && ! $block->context['openSubmenusOnClick'] && $show_submenu_indicators; + $classes = array( + 'wp-block-navigation-item', + ); + $classes = array_merge( + $classes, + $font_sizes['css_classes'] + ); + if ( $has_submenu ) { + $classes[] = 'has-child'; + } + if ( $open_on_click ) { + $classes[] = 'open-on-click'; + } + if ( $open_on_hover_and_click ) { + $classes[] = 'open-on-hover-click'; + } + if ( $is_active ) { + $classes[] = 'current-menu-item'; + } + $wrapper_attributes = get_block_wrapper_attributes( array( - 'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) . - ( $open_on_click ? ' open-on-click' : '' ) . ( $open_on_hover_and_click ? ' open-on-hover-click' : '' ) . - ( $is_active ? ' current-menu-item' : '' ), + 'class' => implode( ' ', $classes ), 'style' => $style_attribute, ) ); diff --git a/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js b/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js index 300672fa91e8ad..0984f601959a05 100644 --- a/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +++ b/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js @@ -47,7 +47,7 @@ function useConvertClassicToBlockMenu( } catch ( err ) { throw new Error( sprintf( - // translators: %s: the name of a menu (e.g. Header navigation). + // translators: %s: The name of a menu (e.g. Header menu). __( `Unable to fetch classic menu "%s" from API.` ), menuName ), @@ -61,7 +61,7 @@ function useConvertClassicToBlockMenu( if ( classicMenuItems === null ) { throw new Error( sprintf( - // translators: %s: the name of a menu (e.g. Header navigation). + // translators: %s: The name of a menu (e.g. Header menu). __( `Unable to fetch classic menu "%s" from API.` ), menuName ) @@ -98,7 +98,7 @@ function useConvertClassicToBlockMenu( } catch ( err ) { throw new Error( sprintf( - // translators: %s: the name of a menu (e.g. Header navigation). + // translators: %s: The name of a menu (e.g. Header menu). __( `Unable to create Navigation Menu "%s".` ), menuName ), @@ -155,7 +155,7 @@ function useConvertClassicToBlockMenu( if ( throwOnError ) { throw new Error( sprintf( - // translators: %s: the name of a menu (e.g. Header navigation). + // translators: %s: The name of a menu (e.g. Header menu). __( `Unable to create Navigation Menu "%s".` ), menuName ), diff --git a/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js b/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js index 0a134a256e6646..9784a5fd75a6b4 100644 --- a/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js +++ b/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js @@ -50,12 +50,12 @@ export default function useGenerateDefaultNavigationTitle( clientId ) { const title = area ? sprintf( - // translators: %s: the name of a menu (e.g. Header navigation). - __( '%s navigation' ), + // translators: %s: the name of a menu (e.g. Header menu). + __( '%s menu' ), area ) - : // translators: 'navigation' as in website navigation. - __( 'Navigation' ); + : // translators: 'menu' as in website navigation menu. + __( 'Menu' ); // Determine how many menus start with the automatic title. const matchingMenuTitleCount = [ diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index 43ca8331534275..d52b67b7e1958c 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -241,11 +241,12 @@ private static function get_inner_blocks_from_navigation_post( $attributes ) { // it encounters whitespace. This code strips it. $blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks ); - // Run Block Hooks algorithm to inject hooked blocks. - $markup = block_core_navigation_insert_hooked_blocks( $blocks, $navigation_post ); - $root_nav_block = parse_blocks( $markup )[0]; - - $blocks = isset( $root_nav_block['innerBlocks'] ) ? $root_nav_block['innerBlocks'] : $blocks; + // Re-serialize, and run Block Hooks algorithm to inject hooked blocks. + // TODO: See if we can move the apply_block_hooks_to_content_from_post_object() call + // before the parse_blocks() call further above, to avoid the extra serialization/parsing. + $markup = serialize_blocks( $blocks ); + $markup = apply_block_hooks_to_content_from_post_object( $markup, $navigation_post ); + $blocks = parse_blocks( $markup ); // TODO - this uses the full navigation block attributes for the // context which could be refined. @@ -1077,12 +1078,11 @@ function block_core_navigation_get_fallback_blocks() { // Run Block Hooks algorithm to inject hooked blocks. // We have to run it here because we need the post ID of the Navigation block to track ignored hooked blocks. - $markup = block_core_navigation_insert_hooked_blocks( $fallback_blocks, $navigation_post ); - $blocks = parse_blocks( $markup ); - - if ( isset( $blocks[0]['innerBlocks'] ) ) { - $fallback_blocks = $blocks[0]['innerBlocks']; - } + // TODO: See if we can move the apply_block_hooks_to_content_from_post_object() call + // before the parse_blocks() call further above, to avoid the extra serialization/parsing. + $markup = serialize_blocks( $fallback_blocks ); + $markup = apply_block_hooks_to_content_from_post_object( $markup, $navigation_post ); + $fallback_blocks = parse_blocks( $markup ); } /** @@ -1436,61 +1436,3 @@ function block_core_navigation_get_most_recently_published_navigation() { return null; } - -/** - * Mock a parsed block for the Navigation block given its inner blocks and the `wp_navigation` post object. - * The `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is queried to add the `metadata.ignoredHookedBlocks` attribute. - * - * @since 6.5.0 - * - * @param array $inner_blocks Parsed inner blocks of a Navigation block. - * @param WP_Post $post `wp_navigation` post object corresponding to the block. - * - * @return array the normalized parsed blocks. - */ -function block_core_navigation_mock_parsed_block( $inner_blocks, $post ) { - $attributes = array(); - - if ( isset( $post->ID ) ) { - $ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true ); - if ( ! empty( $ignored_hooked_blocks ) ) { - $ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true ); - $attributes['metadata'] = array( - 'ignoredHookedBlocks' => $ignored_hooked_blocks, - ); - } - } - - $mock_anchor_parent_block = array( - 'blockName' => 'core/navigation', - 'attrs' => $attributes, - 'innerBlocks' => $inner_blocks, - 'innerContent' => array_fill( 0, count( $inner_blocks ), null ), - ); - - return $mock_anchor_parent_block; -} - -/** - * Insert hooked blocks into a Navigation block. - * - * Given a Navigation block's inner blocks and its corresponding `wp_navigation` post object, - * this function inserts hooked blocks into it, and returns the serialized inner blocks in a - * mock Navigation block wrapper. - * - * If there are any hooked blocks that need to be inserted as the Navigation block's first or last - * children, the `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is checked to see if any - * of those hooked blocks should be exempted from insertion. - * - * @since 6.5.0 - * - * @param array $inner_blocks Parsed inner blocks of a Navigation block. - * @param WP_Post $post `wp_navigation` post object corresponding to the block. - * @return string Serialized inner blocks in mock Navigation block wrapper, with hooked blocks inserted, if any. - */ -function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) { - $mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post ); - - $mock_navigation_block_markup = serialize_block( $mock_navigation_block ); - return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' ); -} diff --git a/packages/block-library/src/page-list/edit.js b/packages/block-library/src/page-list/edit.js index 8f1409f864f9b9..458b8075749e5d 100644 --- a/packages/block-library/src/page-list/edit.js +++ b/packages/block-library/src/page-list/edit.js @@ -322,58 +322,60 @@ export default function PageListEdit( { return ( <> - - { - setAttributes( { parentPageID: 0 } ); - } } - dropdownMenuProps={ dropdownMenuProps } - > - { pagesTree.length > 0 && ( - parentPageID !== 0 } - onDeselect={ () => - setAttributes( { parentPageID: 0 } ) - } - isShownByDefault - > - - setAttributes( { - parentPageID: value ?? 0, - } ) + { ( pagesTree.length > 0 || allowConvertToLinks ) && ( + + { + setAttributes( { parentPageID: 0 } ); + } } + dropdownMenuProps={ dropdownMenuProps } + > + { pagesTree.length > 0 && ( + parentPageID !== 0 } + onDeselect={ () => + setAttributes( { parentPageID: 0 } ) } - help={ __( - 'Choose a page to show only its subpages.' - ) } - /> - - ) } - - { allowConvertToLinks && ( -
-

{ convertDescription }

- -
- ) } -
-
+ + setAttributes( { + parentPageID: value ?? 0, + } ) + } + help={ __( + 'Choose a page to show only its subpages.' + ) } + /> +
+ ) } + + { allowConvertToLinks && ( +
+

{ convertDescription }

+ +
+ ) } +
+
+ ) } { allowConvertToLinks && ( <> diff --git a/packages/block-library/src/paragraph/edit.js b/packages/block-library/src/paragraph/edit.js index f1c2e15537b99b..9e625a8bdd0041 100644 --- a/packages/block-library/src/paragraph/edit.js +++ b/packages/block-library/src/paragraph/edit.js @@ -20,16 +20,13 @@ import { useBlockProps, useSettings, useBlockEditingMode, - store as blockEditorStore, } from '@wordpress/block-editor'; -import { useSelect } from '@wordpress/data'; import { getBlockSupport } from '@wordpress/blocks'; import { formatLtr } from '@wordpress/icons'; /** * Internal dependencies */ import { useOnEnter } from './use-enter'; -import { unlock } from '../lock-unlock'; function ParagraphRTLControl( { direction, setDirection } ) { return ( @@ -111,11 +108,7 @@ function ParagraphBlock( { isSelected: isSingleSelected, name, } ) { - const isZoomOut = useSelect( ( select ) => - unlock( select( blockEditorStore ) ).isZoomOut() - ); - - const { align, content, direction, dropCap } = attributes; + const { align, content, direction, dropCap, placeholder } = attributes; const blockProps = useBlockProps( { ref: useOnEnter( { clientId, content } ), className: clsx( { @@ -125,12 +118,6 @@ function ParagraphBlock( { style: { direction }, } ); const blockEditingMode = useBlockEditingMode(); - let { placeholder } = attributes; - if ( isZoomOut ) { - placeholder = ''; - } else if ( ! placeholder ) { - placeholder = __( 'Type / to choose a block' ); - } return ( <> @@ -182,10 +169,8 @@ function ParagraphBlock( { : __( 'Block: Paragraph' ) } data-empty={ RichText.isEmpty( content ) } - placeholder={ placeholder } - data-custom-placeholder={ - placeholder && ! isZoomOut ? true : undefined - } + placeholder={ placeholder || __( 'Type / to choose a block' ) } + data-custom-placeholder={ placeholder ? true : undefined } __unstableEmbedURLOnPaste __unstableAllowPrefixTransformations /> diff --git a/packages/block-library/src/paragraph/editor.scss b/packages/block-library/src/paragraph/editor.scss index 369cc5cb1d63a9..ad4043bee610ad 100644 --- a/packages/block-library/src/paragraph/editor.scss +++ b/packages/block-library/src/paragraph/editor.scss @@ -22,3 +22,10 @@ .block-editor-block-list__block[data-type="core/paragraph"].has-text-align-left[style*="writing-mode: vertical-lr"] { rotate: 180deg; } + +// Hide the placeholder when the editor is in zoomed out mode. +.is-zoomed-out .block-editor-block-list__block[data-empty="true"] { + [data-rich-text-placeholder] { + opacity: 0; + } +} diff --git a/packages/block-library/src/pattern/block.json b/packages/block-library/src/pattern/block.json index 13fc9d154b15a4..c30be8458e6360 100644 --- a/packages/block-library/src/pattern/block.json +++ b/packages/block-library/src/pattern/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "core/pattern", - "title": "Pattern placeholder", + "title": "Pattern Placeholder", "category": "theme", "description": "Show a block pattern.", "supports": { diff --git a/packages/block-library/src/post-content/block.json b/packages/block-library/src/post-content/block.json index e5d455b97a8a3d..1348cb296af083 100644 --- a/packages/block-library/src/post-content/block.json +++ b/packages/block-library/src/post-content/block.json @@ -35,6 +35,7 @@ }, "color": { "gradients": true, + "heading": true, "link": true, "__experimentalDefaultControls": { "background": false, diff --git a/packages/block-library/src/post-content/index.php b/packages/block-library/src/post-content/index.php index e0a06b7217eebe..25be880cc47887 100644 --- a/packages/block-library/src/post-content/index.php +++ b/packages/block-library/src/post-content/index.php @@ -46,33 +46,10 @@ function render_block_core_post_content( $attributes, $content, $block ) { $content .= wp_link_pages( array( 'echo' => 0 ) ); } - $ignored_hooked_blocks = get_post_meta( $post_id, '_wp_ignored_hooked_blocks', true ); - if ( ! empty( $ignored_hooked_blocks ) ) { - $ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true ); - $attributes['metadata'] = array( - 'ignoredHookedBlocks' => $ignored_hooked_blocks, - ); - } - - // Wrap in Post Content block so the Block Hooks algorithm can insert blocks - // that are hooked as first or last child of `core/post-content`. - $content = get_comment_delimited_block_content( - 'core/post-content', - $attributes, - $content - ); - - // We need to remove the `core/post-content` block wrapper after the Block Hooks algorithm, - // but before `do_blocks` runs, as it would otherwise attempt to render the same block again -- - // thus recursing infinitely. - add_filter( 'the_content', 'remove_serialized_parent_block', 8 ); - /** This filter is documented in wp-includes/post-template.php */ $content = apply_filters( 'the_content', str_replace( ']]>', ']]>', $content ) ); unset( $seen_ids[ $post_id ] ); - remove_filter( 'the_content', 'remove_serialized_parent_block', 8 ); - if ( empty( $content ) ) { return ''; } diff --git a/packages/block-library/src/post-date/edit.js b/packages/block-library/src/post-date/edit.js index 36de2f7e5d7255..0599e860904652 100644 --- a/packages/block-library/src/post-date/edit.js +++ b/packages/block-library/src/post-date/edit.js @@ -179,9 +179,7 @@ export default function PostDateEdit( { dropdownMenuProps={ dropdownMenuProps } > - format !== undefined && format !== siteFormat - } + hasValue={ () => !! format } label={ __( 'Date Format' ) } onDeselect={ () => setAttributes( { format: undefined } ) diff --git a/packages/block-library/src/post-featured-image/dimension-controls.js b/packages/block-library/src/post-featured-image/dimension-controls.js index 9a71a96b2db846..4bc343635f2f93 100644 --- a/packages/block-library/src/post-featured-image/dimension-controls.js +++ b/packages/block-library/src/post-featured-image/dimension-controls.js @@ -10,19 +10,7 @@ import { __experimentalUseCustomUnits as useCustomUnits, __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; -import { - useSettings, - privateApis as blockEditorPrivateApis, - store as blockEditorStore, -} from '@wordpress/block-editor'; -import { useSelect } from '@wordpress/data'; - -/** - * Internal dependencies - */ -import { unlock } from '../lock-unlock'; - -const { ResolutionTool } = unlock( blockEditorPrivateApis ); +import { useSettings } from '@wordpress/block-editor'; const SCALE_OPTIONS = ( <> @@ -45,7 +33,6 @@ const SCALE_OPTIONS = ( ); const DEFAULT_SCALE = 'cover'; -const DEFAULT_SIZE = 'full'; const scaleHelp = { cover: __( @@ -61,9 +48,8 @@ const scaleHelp = { const DimensionControls = ( { clientId, - attributes: { aspectRatio, width, height, scale, sizeSlug }, + attributes: { aspectRatio, width, height, scale }, setAttributes, - media, } ) => { const [ availableUnits, defaultRatios, themeRatios, showDefaultRatios ] = useSettings( @@ -75,18 +61,6 @@ const DimensionControls = ( { const units = useCustomUnits( { availableUnits: availableUnits || [ 'px', '%', 'vw', 'em', 'rem' ], } ); - const imageSizes = useSelect( - ( select ) => select( blockEditorStore ).getSettings().imageSizes, - [] - ); - const imageSizeOptions = imageSizes - .filter( ( { slug } ) => { - return media?.media_details?.sizes?.[ slug ]?.source_url; - } ) - .map( ( { name, slug } ) => ( { - value: slug, - label: name, - } ) ); const onDimensionChange = ( dimension, nextValue ) => { const parsedValue = parseFloat( nextValue ); @@ -230,21 +204,6 @@ const DimensionControls = ( { ) } - { !! imageSizeOptions.length && ( - - setAttributes( { sizeSlug: nextSizeSlug } ) - } - isShownByDefault={ false } - resetAllFilter={ () => ( { - sizeSlug: DEFAULT_SIZE, - } ) } - /> - ) } ); }; diff --git a/packages/block-library/src/post-featured-image/edit.js b/packages/block-library/src/post-featured-image/edit.js index 05888c41fecf23..9fd64b29908e42 100644 --- a/packages/block-library/src/post-featured-image/edit.js +++ b/packages/block-library/src/post-featured-image/edit.js @@ -27,6 +27,8 @@ import { __experimentalUseBorderProps as useBorderProps, __experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles, useBlockEditingMode, + privateApis as blockEditorPrivateApis, + store as blockEditorStore, } from '@wordpress/block-editor'; import { useMemo, useEffect, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; @@ -40,20 +42,40 @@ import DimensionControls from './dimension-controls'; import OverlayControls from './overlay-controls'; import Overlay from './overlay'; import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; +import { unlock } from '../lock-unlock'; const ALLOWED_MEDIA_TYPES = [ 'image' ]; +const { ResolutionTool } = unlock( blockEditorPrivateApis ); +const DEFAULT_MEDIA_SIZE_SLUG = 'full'; + +function FeaturedImageResolutionTool( { image, value, onChange } ) { + const { imageSizes } = useSelect( ( select ) => { + const { getSettings } = select( blockEditorStore ); + return { + imageSizes: getSettings().imageSizes, + }; + }, [] ); + + if ( ! imageSizes?.length ) { + return null; + } + + const imageSizeOptions = imageSizes + .filter( + ( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url + ) + .map( ( { name, slug } ) => ( { value: slug, label: name } ) ); -function getMediaSourceUrlBySizeSlug( media, slug ) { return ( - media?.media_details?.sizes?.[ slug ]?.source_url || media?.source_url + ); } -const disabledClickProps = { - onClick: ( event ) => event.preventDefault(), - 'aria-disabled': true, -}; - export default function PostFeaturedImageEdit( { clientId, attributes, @@ -130,7 +152,9 @@ export default function PostFeaturedImageEdit( { [ featuredImage, postTypeSlug, postId ] ); - const mediaUrl = getMediaSourceUrlBySizeSlug( media, sizeSlug ); + const mediaUrl = + media?.media_details?.sizes?.[ sizeSlug ]?.source_url || + media?.source_url; const blockProps = useBlockProps( { style: { width, height, aspectRatio }, @@ -296,6 +320,13 @@ export default function PostFeaturedImageEdit( { /> ) } + + setAttributes( { sizeSlug: nextSizeSlug } ) + } + /> @@ -318,11 +349,7 @@ export default function PostFeaturedImageEdit( { { controls }
{ !! isLink ? ( - + { placeholder() } ) : ( @@ -430,11 +457,7 @@ export default function PostFeaturedImageEdit( {
{ /* If the featured image is linked, wrap in an tag to trigger any inherited link element styles */ } { !! isLink ? ( - + { image } ) : ( diff --git a/packages/block-library/src/post-featured-image/editor.scss b/packages/block-library/src/post-featured-image/editor.scss index 5fab62c571b1cf..3295fe14e62ac2 100644 --- a/packages/block-library/src/post-featured-image/editor.scss +++ b/packages/block-library/src/post-featured-image/editor.scss @@ -100,9 +100,9 @@ // When the Post Featured Image block is linked, // it's wrapped with a disabled tag. - // Restore cursor style so it doesn't appear 'clickable'. + // Ensure that the link is not clickable. > a { - cursor: default; + pointer-events: none; } // When the Post Featured Image block is linked, diff --git a/packages/block-library/src/post-navigation-link/variations.js b/packages/block-library/src/post-navigation-link/variations.js index e49be1542685e7..125f10942cd15e 100644 --- a/packages/block-library/src/post-navigation-link/variations.js +++ b/packages/block-library/src/post-navigation-link/variations.js @@ -8,7 +8,7 @@ const variations = [ { isDefault: true, name: 'post-next', - title: __( 'Next post' ), + title: __( 'Next Post' ), description: __( 'Displays the post link that follows the current post.' ), @@ -24,7 +24,7 @@ const variations = [ }, { name: 'post-previous', - title: __( 'Previous post' ), + title: __( 'Previous Post' ), description: __( 'Displays the post link that precedes the current post.' ), diff --git a/packages/block-library/src/post-template/edit.js b/packages/block-library/src/post-template/edit.js index c58990233f3615..35d0a95501a1b2 100644 --- a/packages/block-library/src/post-template/edit.js +++ b/packages/block-library/src/post-template/edit.js @@ -177,18 +177,27 @@ export default function PostTemplateEdit( { query.format = format; } - // If sticky is not set, it will return all posts in the results. - // If sticky is set to `only`, it will limit the results to sticky posts only. - // If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`. - if ( sticky ) { + /* + * Handle cases where sticky is set to `exclude` or `only`. + * Which works as a `post__in/post__not_in` query for sticky posts. + */ + if ( sticky && sticky !== 'ignore' ) { query.sticky = sticky === 'only'; } + + if ( sticky === 'ignore' ) { + // Remove any leftover sticky query parameter. + delete query.sticky; + query.ignore_sticky = true; + } + // If `inherit` is truthy, adjust conditionally the query to create a better preview. + let currentPostType = postType; if ( inherit ) { // Change the post-type if needed. if ( templateSlug?.startsWith( 'archive-' ) ) { query.postType = templateSlug.replace( 'archive-', '' ); - postType = query.postType; + currentPostType = query.postType; } else if ( templateCategory ) { query.categories = templateCategory[ 0 ]?.id; } else if ( templateTag ) { @@ -205,7 +214,7 @@ export default function PostTemplateEdit( { } // When we preview Query Loop blocks we should prefer the current // block's postType, which is passed through block context. - const usedPostType = previewPostType || postType; + const usedPostType = previewPostType || currentPostType; return { posts: getEntityRecords( 'postType', usedPostType, { ...query, diff --git a/packages/block-library/src/post-terms/edit.js b/packages/block-library/src/post-terms/edit.js index 13d5b61ad13d6b..802e5ab5898b47 100644 --- a/packages/block-library/src/post-terms/edit.js +++ b/packages/block-library/src/post-terms/edit.js @@ -122,6 +122,7 @@ export default function PostTermsEdit( { key={ postTerm.id } href={ postTerm.link } onClick={ ( event ) => event.preventDefault() } + rel="tag" > { decodeEntities( postTerm.name ) } diff --git a/packages/block-library/src/post-time-to-read/block.json b/packages/block-library/src/post-time-to-read/block.json index ce0ab2be6c02f3..a9f09895556c74 100644 --- a/packages/block-library/src/post-time-to-read/block.json +++ b/packages/block-library/src/post-time-to-read/block.json @@ -3,7 +3,7 @@ "apiVersion": 3, "__experimental": true, "name": "core/post-time-to-read", - "title": "Time To Read", + "title": "Time to Read", "category": "theme", "description": "Show minutes required to finish reading the post.", "textdomain": "default", diff --git a/packages/block-library/src/query-no-results/block.json b/packages/block-library/src/query-no-results/block.json index c2b7224aa40b14..44d2ceef987e2f 100644 --- a/packages/block-library/src/query-no-results/block.json +++ b/packages/block-library/src/query-no-results/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "core/query-no-results", - "title": "No results", + "title": "No Results", "category": "theme", "description": "Contains the block elements used to render content when no query results are found.", "ancestor": [ "core/query" ], diff --git a/packages/block-library/src/query-pagination-numbers/edit.js b/packages/block-library/src/query-pagination-numbers/edit.js index cf2f92f41791ff..a03ed8419bb086 100644 --- a/packages/block-library/src/query-pagination-numbers/edit.js +++ b/packages/block-library/src/query-pagination-numbers/edit.js @@ -67,7 +67,7 @@ export default function QueryPaginationNumbersEdit( { > midSize !== undefined } + hasValue={ () => midSize !== 2 } onDeselect={ () => setAttributes( { midSize: 2 } ) } isShownByDefault > diff --git a/packages/block-library/src/query-title/edit.js b/packages/block-library/src/query-title/edit.js index 3b739e2b20b4f9..0da6da47ef6147 100644 --- a/packages/block-library/src/query-title/edit.js +++ b/packages/block-library/src/query-title/edit.js @@ -141,6 +141,7 @@ export default function QueryTitleEdit( { showSearchTerm: true, } ) } + dropdownMenuProps={ dropdownMenuProps } > ! showSearchTerm } diff --git a/packages/block-library/src/query/edit/inspector-controls/sticky-control.js b/packages/block-library/src/query/edit/inspector-controls/sticky-control.js index ee7ee31ba977a9..f478337998f388 100644 --- a/packages/block-library/src/query/edit/inspector-controls/sticky-control.js +++ b/packages/block-library/src/query/edit/inspector-controls/sticky-control.js @@ -6,6 +6,7 @@ import { __ } from '@wordpress/i18n'; const stickyOptions = [ { label: __( 'Include' ), value: '' }, + { label: __( 'Ignore' ), value: 'ignore' }, { label: __( 'Exclude' ), value: 'exclude' }, { label: __( 'Only' ), value: 'only' }, ]; diff --git a/packages/block-library/src/query/edit/query-content.js b/packages/block-library/src/query/edit/query-content.js index a608f20bbeb001..459ce2af018c2a 100644 --- a/packages/block-library/src/query/edit/query-content.js +++ b/packages/block-library/src/query/edit/query-content.js @@ -23,6 +23,7 @@ import QueryInspectorControls from './inspector-controls'; import EnhancedPaginationModal from './enhanced-pagination-modal'; import { getQueryContextFromTemplate } from '../utils'; import QueryToolbar from './query-toolbar'; +import { htmlElementMessages } from '../../utils/messages'; const DEFAULTS_POSTS_PER_PAGE = 3; @@ -132,17 +133,6 @@ export default function QueryContent( { setAttributes( { displayLayout: { ...displayLayout, ...newDisplayLayout }, } ); - const htmlElementMessages = { - main: __( - 'The
element should be used for the primary content of your document only.' - ), - section: __( - "The
element should represent a standalone portion of the document that can't be better represented by another element." - ), - aside: __( - "The
diff --git a/packages/block-library/src/rss/editor.scss b/packages/block-library/src/rss/editor.scss index c5e79d6254460b..83fef1d73f4f37 100644 --- a/packages/block-library/src/rss/editor.scss +++ b/packages/block-library/src/rss/editor.scss @@ -5,3 +5,10 @@ .wp-block-rss__placeholder-form .wp-block-rss__placeholder-input { flex: 1 1 auto; } +// Reset all styles when skipping block supports while server-side rendering. +// This prevents issues such as duplicate padding, borders etc. +.wp-block-rss .wp-block-rss { + all: inherit; + margin: 0; + padding: 0; +} diff --git a/packages/block-library/src/rss/style.scss b/packages/block-library/src/rss/style.scss index f7360ec76f85ac..76cc232044ff30 100644 --- a/packages/block-library/src/rss/style.scss +++ b/packages/block-library/src/rss/style.scss @@ -1,11 +1,4 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styles in the editor. - list-style: none; - padding: 0; - - // This needs extra specificity due to the reset mixin on the parent: https://github.com/WordPress/gutenberg/blob/a250e9e5fe00dd5195624f96a3d924e7078951c3/packages/edit-post/src/style.scss#L54 - &.wp-block-rss { - box-sizing: border-box; - } &.alignleft { /*rtl:ignore*/ @@ -19,7 +12,6 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styl display: flex; flex-wrap: wrap; padding: 0; - list-style: none; li { margin: 0 1em 1em 0; @@ -41,3 +33,9 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styl display: block; font-size: 0.8125em; } +.wp-block-rss { + // This block has customizable padding, border-box makes that more predictable. + box-sizing: border-box; + list-style: none; + padding: 0; +} diff --git a/packages/block-library/src/search/edit.js b/packages/block-library/src/search/edit.js index ed8edf4a5aca8c..16eb62daa6abbf 100644 --- a/packages/block-library/src/search/edit.js +++ b/packages/block-library/src/search/edit.js @@ -25,12 +25,13 @@ import { ToolbarGroup, ToolbarButton, ResizableBox, - PanelBody, - __experimentalVStack as VStack, __experimentalUseCustomUnits as useCustomUnits, __experimentalUnitControl as UnitControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, + __experimentalVStack as VStack, } from '@wordpress/components'; import { useInstanceId } from '@wordpress/compose'; import { Icon, search } from '@wordpress/icons'; @@ -54,6 +55,7 @@ import { MIN_WIDTH, isPercentageUnit, } from './utils.js'; +import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; // Used to calculate border radius adjustment to avoid "fat" corners when // button is placed inside wrapper. @@ -370,6 +372,7 @@ export default function SearchEdit( { ); }; + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const controls = ( <> @@ -408,79 +411,101 @@ export default function SearchEdit( {
- - { + setAttributes( { + width: undefined, + widthUnit: undefined, + } ); + } } + dropdownMenuProps={ dropdownMenuProps } + > + !! width } + label={ __( 'Width' ) } + onDeselect={ () => { + setAttributes( { + width: undefined, + widthUnit: undefined, + } ); + } } + isShownByDefault > - { - const parsedNewWidth = - newWidth === '' - ? undefined - : parseInt( newWidth, 10 ); - setAttributes( { - width: parsedNewWidth, - } ); - } } - onUnitChange={ ( newUnit ) => { - setAttributes( { - width: - '%' === newUnit - ? PC_WIDTH_DEFAULT - : PX_WIDTH_DEFAULT, - widthUnit: newUnit, - } ); - } } - __unstableInputWidth="80px" - value={ `${ width }${ widthUnit }` } - units={ units } - /> - { - setAttributes( { - width: newWidth, - widthUnit: '%', - } ); - } } - isBlock - __next40pxDefaultSize - __nextHasNoMarginBottom - > - { PERCENTAGE_WIDTHS.map( ( widthValue ) => { - return ( - - ); - } ) } - - - + + { + const parsedNewWidth = + newWidth === '' + ? undefined + : parseInt( newWidth, 10 ); + setAttributes( { + width: parsedNewWidth, + } ); + } } + onUnitChange={ ( newUnit ) => { + setAttributes( { + width: + '%' === newUnit + ? PC_WIDTH_DEFAULT + : PX_WIDTH_DEFAULT, + widthUnit: newUnit, + } ); + } } + __unstableInputWidth="80px" + value={ `${ width }${ widthUnit }` } + units={ units } + /> + { + setAttributes( { + width: newWidth, + widthUnit: '%', + } ); + } } + isBlock + __next40pxDefaultSize + __nextHasNoMarginBottom + > + { PERCENTAGE_WIDTHS.map( ( widthValue ) => { + return ( + + ); + } ) } + + + + ); diff --git a/packages/block-library/src/separator/edit.js b/packages/block-library/src/separator/edit.js index c4b832c66158d0..ca94ef41f1d8ad 100644 --- a/packages/block-library/src/separator/edit.js +++ b/packages/block-library/src/separator/edit.js @@ -19,12 +19,7 @@ import { __ } from '@wordpress/i18n'; * Internal dependencies */ import useDeprecatedOpacity from './use-deprecated-opacity'; - -const htmlElementMessages = { - div: __( - 'The
element should only be used if the separator is a design element that should not be announced.' - ), -}; +import { htmlElementMessages } from '../utils/messages'; export default function SeparatorEdit( { attributes, setAttributes } ) { const { backgroundColor, opacity, style, tagName } = attributes; diff --git a/packages/block-library/src/social-link/icons/discord.js b/packages/block-library/src/social-link/icons/discord.js new file mode 100644 index 00000000000000..6cb6165515369c --- /dev/null +++ b/packages/block-library/src/social-link/icons/discord.js @@ -0,0 +1,10 @@ +/** + * WordPress dependencies + */ +import { Path, SVG } from '@wordpress/primitives'; + +export const DiscordIcon = () => ( + + + +); diff --git a/packages/block-library/src/social-link/icons/index.js b/packages/block-library/src/social-link/icons/index.js index 422ff6f02dd20e..bcc1976a7efb03 100644 --- a/packages/block-library/src/social-link/icons/index.js +++ b/packages/block-library/src/social-link/icons/index.js @@ -5,6 +5,7 @@ export * from './bluesky'; export * from './chain'; export * from './codepen'; export * from './deviantart'; +export * from './discord'; export * from './dribbble'; export * from './dropbox'; export * from './etsy'; diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index f241daff2a11a8..9775f6dece5d7d 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -169,6 +169,10 @@ function block_core_social_link_services( $service = '', $field = '' ) { 'name' => 'DeviantArt', 'icon' => '', ), + 'discord' => array( + 'name' => 'Discord', + 'icon' => '', + ), 'dribbble' => array( 'name' => 'Dribbble', 'icon' => '', diff --git a/packages/block-library/src/social-link/socials-with-bg.scss b/packages/block-library/src/social-link/socials-with-bg.scss index 35420fc624c0e6..b51b718459739d 100644 --- a/packages/block-library/src/social-link/socials-with-bg.scss +++ b/packages/block-library/src/social-link/socials-with-bg.scss @@ -33,6 +33,11 @@ color: #fff; } +.wp-social-link-discord { + background-color: #5865f2; + color: #fff; +} + .wp-social-link-dribbble { background-color: #e94c89; color: #fff; diff --git a/packages/block-library/src/social-link/socials-without-bg.scss b/packages/block-library/src/social-link/socials-without-bg.scss index 24538b29824b17..12b8620efb9f7f 100644 --- a/packages/block-library/src/social-link/socials-without-bg.scss +++ b/packages/block-library/src/social-link/socials-without-bg.scss @@ -22,6 +22,10 @@ color: #02e49b; } +.wp-social-link-discord { + color: #5865f2; +} + .wp-social-link-dribbble { color: #e94c89; } diff --git a/packages/block-library/src/social-link/variations.js b/packages/block-library/src/social-link/variations.js index a97a396882d761..59fb469181449d 100644 --- a/packages/block-library/src/social-link/variations.js +++ b/packages/block-library/src/social-link/variations.js @@ -9,6 +9,7 @@ import { ChainIcon, CodepenIcon, DeviantArtIcon, + DiscordIcon, DribbbleIcon, DropboxIcon, EtsyIcon, @@ -108,6 +109,12 @@ const variations = [ title: 'DeviantArt', icon: DeviantArtIcon, }, + { + name: 'discord', + attributes: { service: 'discord' }, + title: 'Discord', + icon: DiscordIcon, + }, { name: 'dribbble', attributes: { service: 'dribbble' }, diff --git a/packages/block-library/src/social-links/editor.scss b/packages/block-library/src/social-links/editor.scss index 11f1ed86d11220..6b1286c94757d8 100644 --- a/packages/block-library/src/social-links/editor.scss +++ b/packages/block-library/src/social-links/editor.scss @@ -89,7 +89,6 @@ // Unconfigured placeholder links are semitransparent. .wp-social-link.wp-social-link__is-incomplete { opacity: 0.5; - @include reduce-motion("transition"); } .wp-block-social-links .is-selected .wp-social-link__is-incomplete, @@ -101,6 +100,10 @@ .wp-block-social-links .block-list-appender { position: static; // display inline. + .block-editor-inserter { + font-size: inherit; + } + .block-editor-button-block-appender { height: 1.5em; width: 1.5em; diff --git a/packages/block-library/src/spacer/controls.js b/packages/block-library/src/spacer/controls.js index fde06d3ee8c339..8ebc2b825bee08 100644 --- a/packages/block-library/src/spacer/controls.js +++ b/packages/block-library/src/spacer/controls.js @@ -24,6 +24,7 @@ import { View } from '@wordpress/primitives'; */ import { unlock } from '../lock-unlock'; import { MIN_SPACER_SIZE } from './constants'; +import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; const { useSpacingSizes } = unlock( blockEditorPrivateApis ); @@ -43,10 +44,6 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) { defaultValues: { px: 100, em: 10, rem: 10, vw: 10, vh: 25 }, } ); - const handleOnChange = ( unprocessedValue ) => { - onChange( unprocessedValue.all ); - }; - // Force the unit to update to `px` when the Spacer is being resized. const [ parsedQuantity, parsedUnit ] = parseQuantityAndUnitFromRawValue( value ); @@ -56,23 +53,24 @@ function DimensionInput( { label, onChange, isResizing, value = '' } ) { return ( <> - { ( ! spacingSizes || spacingSizes?.length === 0 ) && ( + { spacingSizes?.length < 2 ? ( - ) } - { spacingSizes?.length > 0 && ( + ) : ( { + onChange( all ); + } } label={ label } sides={ [ 'all' ] } units={ units } @@ -93,6 +91,8 @@ export default function SpacerControls( { width, isResizing, } ) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); + return ( { orientation === 'horizontal' && ( toggleSelection( false ); const onResizeStop = () => toggleSelection( true ); + const { __unstableMarkNextChangeAsNotPersistent } = + useDispatch( blockEditorStore ); + const handleOnVerticalResizeStop = ( newHeight ) => { onResizeStop(); @@ -256,11 +259,19 @@ const SpacerEdit = ( { }; useEffect( () => { + // To avoid interfering with undo/redo operations any changes in this + // effect must not make history and should be preceded by + // `__unstableMarkNextChangeAsNotPersistent()`. + const setAttributesCovertly = ( nextAttributes ) => { + __unstableMarkNextChangeAsNotPersistent(); + setAttributes( nextAttributes ); + }; + if ( isFlexLayout && selfStretch !== 'fill' && selfStretch !== 'fit' && - ! flexSize + flexSize === undefined ) { if ( inheritedOrientation === 'horizontal' ) { // If spacer is moving from a vertical container to a horizontal container, @@ -269,7 +280,7 @@ const SpacerEdit = ( { getCustomValueFromPreset( width, spacingSizes ) || getCustomValueFromPreset( height, spacingSizes ) || '100px'; - setAttributes( { + setAttributesCovertly( { width: '0px', style: { ...blockStyle, @@ -285,7 +296,7 @@ const SpacerEdit = ( { getCustomValueFromPreset( height, spacingSizes ) || getCustomValueFromPreset( width, spacingSizes ) || '100px'; - setAttributes( { + setAttributesCovertly( { height: '0px', style: { ...blockStyle, @@ -301,26 +312,16 @@ const SpacerEdit = ( { isFlexLayout && ( selfStretch === 'fill' || selfStretch === 'fit' ) ) { - if ( inheritedOrientation === 'horizontal' ) { - setAttributes( { - width: undefined, - } ); - } else { - setAttributes( { - height: undefined, - } ); - } + setAttributesCovertly( + inheritedOrientation === 'horizontal' + ? { width: undefined } + : { height: undefined } + ); } else if ( ! isFlexLayout && ( selfStretch || flexSize ) ) { - if ( inheritedOrientation === 'horizontal' ) { - setAttributes( { - width: flexSize, - } ); - } else { - setAttributes( { - height: flexSize, - } ); - } - setAttributes( { + setAttributesCovertly( { + ...( inheritedOrientation === 'horizontal' + ? { width: flexSize } + : { height: flexSize } ), style: { ...blockStyle, layout: { @@ -342,6 +343,7 @@ const SpacerEdit = ( { setAttributes, spacingSizes, width, + __unstableMarkNextChangeAsNotPersistent, ] ); return ( diff --git a/packages/block-library/src/template-part/edit/advanced-controls.js b/packages/block-library/src/template-part/edit/advanced-controls.js index 04c6d3387346ac..f63c01b71be02c 100644 --- a/packages/block-library/src/template-part/edit/advanced-controls.js +++ b/packages/block-library/src/template-part/edit/advanced-controls.js @@ -10,27 +10,7 @@ import { useSelect } from '@wordpress/data'; * Internal dependencies */ import { TemplatePartImportControls } from './import-controls'; - -const htmlElementMessages = { - header: __( - 'The
element should represent introductory content, typically a group of introductory or navigational aids.' - ), - main: __( - 'The
element should be used for the primary content of your document only.' - ), - section: __( - "The
element should represent a standalone portion of the document that can't be better represented by another element." - ), - article: __( - 'The
element should represent a self-contained, syndicatable portion of the document.' - ), - aside: __( - "The