diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index 65bb55e3f6320..a57b857aac623 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -49,28 +49,26 @@ jobs: - name: Gradle cache uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 - # AVD cache disabled as it caused emulator termination to hang indefinitely. - # https://github.com/ReactiveCircus/android-emulator-runner/issues/385 - # - name: AVD cache - # uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 - # id: avd-cache - # with: - # path: | - # ~/.android/avd/* - # ~/.android/adb* - # key: avd-${{ matrix.api-level }} - # - # - name: Create AVD and generate snapshot for caching - # if: steps.avd-cache.outputs.cache-hit != 'true' - # uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 - # with: - # api-level: ${{ matrix.api-level }} - # force-avd-creation: false - # emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - # disable-animations: false - # arch: x86_64 - # profile: Nexus 6 - # script: echo "Generated AVD snapshot for caching." + - name: AVD cache + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-level }} + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + arch: x86_64 + profile: Nexus 6 + script: echo "Generated AVD snapshot for caching." - name: Run tests uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0 diff --git a/backport-changelog/6.7/7676.md b/backport-changelog/6.7/7676.md deleted file mode 100644 index 19d9dc5904845..0000000000000 --- a/backport-changelog/6.7/7676.md +++ /dev/null @@ -1,3 +0,0 @@ -https://github.com/WordPress/wordpress-develop/pull/7676 - -* https://github.com/WordPress/gutenberg/pull/66359 diff --git a/backport-changelog/6.8/7265.md b/backport-changelog/6.8/7265.md deleted file mode 100644 index 44ba36053aa0d..0000000000000 --- a/backport-changelog/6.8/7265.md +++ /dev/null @@ -1,4 +0,0 @@ -https://github.com/WordPress/wordpress-develop/pull/7265 - -* https://github.com/WordPress/gutenberg/pull/66850 -* https://github.com/WordPress/gutenberg/pull/66947 diff --git a/backport-changelog/6.8/7759.md b/backport-changelog/6.8/7759.md deleted file mode 100644 index a0ad85b06e6b0..0000000000000 --- a/backport-changelog/6.8/7759.md +++ /dev/null @@ -1,4 +0,0 @@ -https://github.com/WordPress/wordpress-develop/pull/7759 - -* https://github.com/WordPress/gutenberg/pull/66896 - diff --git a/changelog.txt b/changelog.txt index 0dc99f5e205e3..ad860707a261f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,338 +1,23 @@ == Changelog == -= 19.6.1 = += 19.6.0-rc.3 = ## Changelog ### Bug Fixes -#### List View -- Block Editor: Fix stale dependencies of selectors depending on editorTool preference. ([66833](https://github.com/WordPress/gutenberg/pull/66833)) - - - - -## Contributors - -The following contributors merged PRs in this release: - -@mcsf - - -= 19.6.0 = - - -## Changelog - -### Enhancements - -#### Components -- Add elevation tokens to storybook. ([66122](https://github.com/WordPress/gutenberg/pull/66122)) -- Add foundations:Elevation to storybook. ([66124](https://github.com/WordPress/gutenberg/pull/66124)) -- Add radius foundation and tokens to storybook. ([66219](https://github.com/WordPress/gutenberg/pull/66219)) -- Combobox, FormTokenField: Show message when no matches found. ([66142](https://github.com/WordPress/gutenberg/pull/66142)) -- Storybook: Organizes components under 'Utilities'. ([66210](https://github.com/WordPress/gutenberg/pull/66210)) -- Tabs: Expose active tab item props, use ariakit prop types. ([66223](https://github.com/WordPress/gutenberg/pull/66223)) -- Tabs: Remove custom logic. ([66097](https://github.com/WordPress/gutenberg/pull/66097)) -- `DropdownMenuV2`: Rename to `Menu`. ([66289](https://github.com/WordPress/gutenberg/pull/66289)) - -#### Block Library -- Add Transformation from Separator to Spacer. ([66230](https://github.com/WordPress/gutenberg/pull/66230)) -- Add lightbox option in gallery block link control. ([64014](https://github.com/WordPress/gutenberg/pull/64014)) -- Archives: Add border block support. ([63400](https://github.com/WordPress/gutenberg/pull/63400)) -- Border support added to comments. ([66354](https://github.com/WordPress/gutenberg/pull/66354)) -- Cover Block: Add Image Resolution options. ([62926](https://github.com/WordPress/gutenberg/pull/62926)) -- HTML Block: Force HTML preview in view mode. ([66440](https://github.com/WordPress/gutenberg/pull/66440)) - -#### Zoom Out -- Add keyboard shortcut in editor. ([66400](https://github.com/WordPress/gutenberg/pull/66400)) -- Iterate zoom out shuffle into a more visual control. ([66194](https://github.com/WordPress/gutenberg/pull/66194)) -- Use the zoom-level value to scale the iframe. ([66280](https://github.com/WordPress/gutenberg/pull/66280)) - -#### Site Editor -- Remove synchronization of canvas mode into store. ([66213](https://github.com/WordPress/gutenberg/pull/66213)) -- Style Book: Clean up layout. ([66255](https://github.com/WordPress/gutenberg/pull/66255)) -- Update site icon and title position. ([66171](https://github.com/WordPress/gutenberg/pull/66171)) -- Editor Interface: Remove small header from global styles/plugin sidebar. ([64474](https://github.com/WordPress/gutenberg/pull/64474)) -- Remove purple coloring from DocumentBar and PostCard. ([66451](https://github.com/WordPress/gutenberg/pull/66451)) -- Core Data: Add the 'getEntitiesConfig' resolver. ([65871](https://github.com/WordPress/gutenberg/pull/65871)) -- BlockGroupToolbar: Better i18n context for toolbar labels. ([66211](https://github.com/WordPress/gutenberg/pull/66211)) -- Set `ResizableEditor` height based on border-box. ([66342](https://github.com/WordPress/gutenberg/pull/66342)) -- Add align-item related icons. ([66242](https://github.com/WordPress/gutenberg/pull/66242)) -- Stabilize isPreviewMode flag. ([66149](https://github.com/WordPress/gutenberg/pull/66149)) - -#### Data Views -- Fix alignment of action items in list layout. ([66273](https://github.com/WordPress/gutenberg/pull/66273)) -- Templates: Hide media field in list view. ([66573](https://github.com/WordPress/gutenberg/pull/66573)) - -#### Global Styles -- Backport: Caching of global styles for blocks from core. ([66349](https://github.com/WordPress/gutenberg/pull/66349)) -- Style Book: Add color tab. ([65692](https://github.com/WordPress/gutenberg/pull/65692)) - -#### Real-time Collaboration -- Inline Commenting: Disable comments on published posts for now. ([66583](https://github.com/WordPress/gutenberg/pull/66583)) - - -#### REST API -- Backport from WordPress core: Improvements for the post format query loop filter. ([66037](https://github.com/WordPress/gutenberg/pull/66037)) - -#### Build Tooling -- Create Block: Adds `--target-dir` flag to allow the tool to target where to scaffold. ([53781](https://github.com/WordPress/gutenberg/pull/53781)) -- Scripts: Add build-blocks-manifest command. ([65866](https://github.com/WordPress/gutenberg/pull/65866)) -- Scripts: Add BlueOak-1.0.0 license to GPL2 compatible. ([66139](https://github.com/WordPress/gutenberg/pull/66139)) -- WP Scripts: Add a `--root-folder` argument to the `plugin-zip` command. ([61375](https://github.com/WordPress/gutenberg/pull/61375)) - -### Bug Fixes - -#### Zoom Out -- Disable zoom out toggle button when Style Book is open. ([66228](https://github.com/WordPress/gutenberg/pull/66228)) -- Don't switch editor mode when changing entities. ([66452](https://github.com/WordPress/gutenberg/pull/66452)) -- Fix scaling animation for device previews. ([66132](https://github.com/WordPress/gutenberg/pull/66132)) -- Fix zoom out not persisting while switching between editor and code editor. ([65932](https://github.com/WordPress/gutenberg/pull/65932)) -- Fix zoom out shortcut on Windows. ([66506](https://github.com/WordPress/gutenberg/pull/66506)) -- Fix: Activate zoom out on large viewport. ([66308](https://github.com/WordPress/gutenberg/pull/66308)) -- Hide slots and grouping buttons. ([66243](https://github.com/WordPress/gutenberg/pull/66243)) -- Remove zoom-out toolbar. ([66039](https://github.com/WordPress/gutenberg/pull/66039)) -- Resets the Zoom on viewed/edited entity change. ([66232](https://github.com/WordPress/gutenberg/pull/66232)) -- Revise zoom layout shift fix. ([66390](https://github.com/WordPress/gutenberg/pull/66390)) -- Zoom Out: Rely on zoom-level instead of zoom-out mode. ([66141](https://github.com/WordPress/gutenberg/pull/66141)) -- Zoom Out: Fix bouncy drop zones. ([66399](https://github.com/WordPress/gutenberg/pull/66399)) - #### Block Editor -- Block inserter: Prevent editor from crashing if `blockType.parent` is a string. ([66234](https://github.com/WordPress/gutenberg/pull/66234)) -- Block toolbar: Account for scrollable blocks that affect the position of the block toolbar. ([66188](https://github.com/WordPress/gutenberg/pull/66188)) -- Fix extra scrollbar appearing when searching in the inserter. ([66229](https://github.com/WordPress/gutenberg/pull/66229)) -- Fix: Show paragraph block variations in rich text inserter. ([66318](https://github.com/WordPress/gutenberg/pull/66318)) -- Group: Fix padding select. ([65857](https://github.com/WordPress/gutenberg/pull/65857)) -- Link Shortcut: Only trigger the link shortcut if there's a text selection. ([66056](https://github.com/WordPress/gutenberg/pull/66056)) -- Remove relative position from sidebar tabpanel. ([66267](https://github.com/WordPress/gutenberg/pull/66267)) -- Rich text: Remove empty file. ([66553](https://github.com/WordPress/gutenberg/pull/66553)) - -- Block editor: Self nesting and circular nesting block fix. ([66121](https://github.com/WordPress/gutenberg/pull/66121)) - Post Editor: Set the default value of the editorTool to edit. ([66636](https://github.com/WordPress/gutenberg/pull/66636)) -#### Components -- ColorPalette: Prevent overflow of custom color button background. ([66152](https://github.com/WordPress/gutenberg/pull/66152)) -- Fix: Text overflow in Patterns filter. ([66504](https://github.com/WordPress/gutenberg/pull/66504)) -- RadioGroup: Fix arrow key navigation in RTL. ([66202](https://github.com/WordPress/gutenberg/pull/66202)) -- Tabs and TabPanel: Fix arrow key navigation in RTL. ([66201](https://github.com/WordPress/gutenberg/pull/66201)) -- Tabs and ToggleGroupControl: Round indicator size. ([66426](https://github.com/WordPress/gutenberg/pull/66426)) -- Tabs: Fix animation timings. ([66198](https://github.com/WordPress/gutenberg/pull/66198)) -- Tabs: Override tablist's tabindex only when necessary. ([66209](https://github.com/WordPress/gutenberg/pull/66209)) -- Tabs: Restore vertical alignment for tabs content. ([66215](https://github.com/WordPress/gutenberg/pull/66215)) -- Tabs: Update indicator more reactively. ([66207](https://github.com/WordPress/gutenberg/pull/66207)) -- SpacingSizesControl: Use generic label for linked button. ([66304](https://github.com/WordPress/gutenberg/pull/66304)) - -#### i18n -- Miscellaneous i18n fixes. ([66510](https://github.com/WordPress/gutenberg/pull/66510)) -- Remove most of the occurrences of the verb toggle. ([66371](https://github.com/WordPress/gutenberg/pull/66371)) - -#### Post Editor -- Always force iframe in pattern editor. ([65887](https://github.com/WordPress/gutenberg/pull/65887)) -- Editor: Multi-entity saving: Show correct count of entities to be saved. ([66482](https://github.com/WordPress/gutenberg/pull/66482)) -- Fix : "Set featured image" button border flashes on focus. ([66092](https://github.com/WordPress/gutenberg/pull/66092)) -- Fix Parent Check Condition in `buildTermsTree`. ([66006](https://github.com/WordPress/gutenberg/pull/66006)) -- Fix: Improve the DocumentBar post type label for the Homepage and Posts Page cases. ([66355](https://github.com/WordPress/gutenberg/pull/66355)) -- PostTaxonomiesFlatTermSelector: Restore space between tag list and most used tags. ([66566](https://github.com/WordPress/gutenberg/pull/66566)) -- Typo metabox pane is a meta box panel. ([66502](https://github.com/WordPress/gutenberg/pull/66502)) - -#### Block Library -- Block registration: Normalize blockType.parent to `array`. ([66250](https://github.com/WordPress/gutenberg/pull/66250)) -- Button Block: Apply Stretch Styles Correctly. ([64770](https://github.com/WordPress/gutenberg/pull/64770)) -- Buttons: Fix the initial white space in nofollow rel. ([66303](https://github.com/WordPress/gutenberg/pull/66303)) -- Fix - Image block: Aspect ratio not responding when dimensions are not set. ([66217](https://github.com/WordPress/gutenberg/pull/66217)) -- Navigation block: Fix block appender size. ([66153](https://github.com/WordPress/gutenberg/pull/66153)) -- Fix the navigation issue inside cover blocks. ([66093](https://github.com/WordPress/gutenberg/pull/66093)) - -#### Site Editor -- Edit Site: Fix canvasMode var. ([66316](https://github.com/WordPress/gutenberg/pull/66316)) -- Fix button hover style in sidebar navigation screen. ([66505](https://github.com/WordPress/gutenberg/pull/66505)) -- Remove toggle verb from post list data views 'Toggle details panel'. ([66334](https://github.com/WordPress/gutenberg/pull/66334)) -- Revert 66431 (Site editor: Remove "default" admin CSS). ([66540](https://github.com/WordPress/gutenberg/pull/66540)) -- Restore block-library editor.css outside canvas. ([66556](https://github.com/WordPress/gutenberg/pull/66556)) -- Fix extraneous scrollbar in device previews. ([66494](https://github.com/WordPress/gutenberg/pull/66494)) -- Global styles: Move preload paths filter to 6.7 (previously 6.8). ([66543](https://github.com/WordPress/gutenberg/pull/66543)) -- Fix comment output in styles. ([66439](https://github.com/WordPress/gutenberg/pull/66439)) -- Site editor: Fix save shortcut. ([66423](https://github.com/WordPress/gutenberg/pull/66423)) -- Preload: Fix multiple regressions around global styles. ([66468](https://github.com/WordPress/gutenberg/pull/66468)) - -#### Build tooling -- Create block: Ensure $slug is replaced with passed slug. ([66528](https://github.com/WordPress/gutenberg/pull/66528)) - -### Accessibility - -#### Post Editor -- Add featured image alt text. ([66189](https://github.com/WordPress/gutenberg/pull/66189)) -- Fix : Badge Color contrast. ([66360](https://github.com/WordPress/gutenberg/pull/66360)) - -#### Block Editor -- ImageSizeControls: Replace ButtonGroup with ToggleGroupControl. ([65386](https://github.com/WordPress/gutenberg/pull/65386)) -- Improve the link preview accessibility and labels. ([60908](https://github.com/WordPress/gutenberg/pull/60908)) - -#### Block Library -- Search: Replace ButtonGroup usage with ToggleGroupControl. ([65340](https://github.com/WordPress/gutenberg/pull/65340)) -- Remove clip & -webkit-clip-path for downloadable-block-list-item style.scss. ([66147](https://github.com/WordPress/gutenberg/pull/66147)) - -#### Global Styles -- Global styles menu: Avoid visible labels and accessible names mismatch. ([65124](https://github.com/WordPress/gutenberg/pull/65124)) - -#### Site Editor -- Fix Global styles panel header buttons text overlap for 'Show button text labels'. ([63243](https://github.com/WordPress/gutenberg/pull/63243)) -- Update the speak messages when switching editor modes. ([66278](https://github.com/WordPress/gutenberg/pull/66278)) - -### Performance - -#### Site Editor -- Remove "default" admin CSS. ([66431](https://github.com/WordPress/gutenberg/pull/66431)) -- Remove content styles outside canvas. ([66432](https://github.com/WordPress/gutenberg/pull/66432)) -- Block Style Variations: Reuse block metadata in WP_Theme_JSON::Get_valid_block_style_variations() for better performance. ([66539](https://github.com/WordPress/gutenberg/pull/66539)) -- Block Bindings: Use `getEntityConfig` instead of `getPostTypes` to get available slugs. ([66101](https://github.com/WordPress/gutenberg/pull/66101)) - -#### Build Tooling -- Fix/compare performance with correct branch. ([66196](https://github.com/WordPress/gutenberg/pull/66196)) -### Experiments - -- Add Inline comment experimental flag. ([60622](https://github.com/WordPress/gutenberg/pull/60622)) -- QuickEdit: Add slug field control. ([65196](https://github.com/WordPress/gutenberg/pull/65196)) - -#### Data Views -- Quick Edit: Fix JS error when bulk editing pages. ([66358](https://github.com/WordPress/gutenberg/pull/66358)) -- QuickEdit: Add Featured Image Control. ([64496](https://github.com/WordPress/gutenberg/pull/64496)) -- QuickEdit: Add Parent field. ([66527](https://github.com/WordPress/gutenberg/pull/66527)) - -### Documentation - -- BaseControl: Auto-generate readme. ([66500](https://github.com/WordPress/gutenberg/pull/66500)) -- Components: Prevent generated readmes duplicating h1 elements when published. ([66180](https://github.com/WordPress/gutenberg/pull/66180)) -- Correct documentation on display type in flow layouts. ([66224](https://github.com/WordPress/gutenberg/pull/66224)) -- Docs: Interactivity API - Add documentation for `getServerState()` and `getServerContext()`. ([66104](https://github.com/WordPress/gutenberg/pull/66104)) -- Fix undo/redo Button size in Storybook playground. ([66538](https://github.com/WordPress/gutenberg/pull/66538)) -- Fix: JSON Schema Docgen doesn't work on Windows OS. ([66414](https://github.com/WordPress/gutenberg/pull/66414)) -- ItemGroup: Improve stories to default to bordered and separated. ([66191](https://github.com/WordPress/gutenberg/pull/66191)) -- README: Add Storybook badge. ([66529](https://github.com/WordPress/gutenberg/pull/66529)) -- Remove meetings that no longer occur from Contributor Guide. ([66421](https://github.com/WordPress/gutenberg/pull/66421)) -- Site editor routes: Add documentation for areas and prevent `edit` area from rendering when canvas is `edit`. ([66309](https://github.com/WordPress/gutenberg/pull/66309)) -- Update documentation about build process changes. ([66428](https://github.com/WordPress/gutenberg/pull/66428)) -- Docs: Example for getSelectedBlock. ([66108](https://github.com/WordPress/gutenberg/pull/66108)) - -### Code Quality - -#### Block Editor -- ESLint: Remove explicit `react-hooks/exhaustive-deps` disabling. ([66461](https://github.com/WordPress/gutenberg/pull/66461)) -- ESLint: Remove various React Compiler mutation violations. ([66327](https://github.com/WordPress/gutenberg/pull/66327)) -- Fix 'useInstanceId' hook reference. ([66406](https://github.com/WordPress/gutenberg/pull/66406)) -- Fix React Compiler error for Duotone. ([66492](https://github.com/WordPress/gutenberg/pull/66492)) -- Fix React Complier error for 'useEventListeners'. ([66495](https://github.com/WordPress/gutenberg/pull/66495)) -- Import only the actually used PostCSS exports. ([66379](https://github.com/WordPress/gutenberg/pull/66379)) -- No need to unlock public actions. ([66260](https://github.com/WordPress/gutenberg/pull/66260)) -- Remove patterns UI stylesheet from iframe. ([66306](https://github.com/WordPress/gutenberg/pull/66306)) -- Remove unnecessary Tooltip component from radius control linked button. ([66274](https://github.com/WordPress/gutenberg/pull/66274)) -- Rich Text: Fix React Complier error for 'useEventListeners'. ([66460](https://github.com/WordPress/gutenberg/pull/66460)) -- Storybook: Add BlockPatternsList story. ([66227](https://github.com/WordPress/gutenberg/pull/66227)) -- Block editor: Remove reusable blocks stylesheet from iframe. ([66285](https://github.com/WordPress/gutenberg/pull/66285)) - - -#### Components -- BorderBoxControl: Deprecate 36px default size. ([65752](https://github.com/WordPress/gutenberg/pull/65752)) -- BorderControl: Deprecate 36px default size. ([65755](https://github.com/WordPress/gutenberg/pull/65755)) -- DrodownMenuV2: Rename folder to `menu`. ([66473](https://github.com/WordPress/gutenberg/pull/66473)) -- ESLint: Stop disabling `react-hooks/exhaustive-deps` rule. ([66324](https://github.com/WordPress/gutenberg/pull/66324)) -- Fix React Compiler error for 'useAutocomplete'. ([66496](https://github.com/WordPress/gutenberg/pull/66496)) -- PaletteEdit: Use `ItemGroup` and `Item`, and avoid custom styles. ([66164](https://github.com/WordPress/gutenberg/pull/66164)) -- TabPanel: Add 40px size prop to tab Button. ([66557](https://github.com/WordPress/gutenberg/pull/66557)) -- Tabs: Align to standard compound components structure. ([66225](https://github.com/WordPress/gutenberg/pull/66225)) -- Tabs: Simplify styled components code. ([66208](https://github.com/WordPress/gutenberg/pull/66208)) - -#### Compose -- Compose: Fix React Complier error for 'useCopyToClipboard'. ([66444](https://github.com/WordPress/gutenberg/pull/66444)) -- Composer: Fix React Compiler errors for 'useDropZone'. ([66469](https://github.com/WordPress/gutenberg/pull/66469)) - -#### Dataviews -- Fields: Fix React Compiler mutation errors. ([66464](https://github.com/WordPress/gutenberg/pull/66464)) -- Fields: Update a few function definitions. ([66315](https://github.com/WordPress/gutenberg/pull/66315)) -#### Interface -- Interface: Remove duplicate 'withComplementaryAreaContext' file. ([66348](https://github.com/WordPress/gutenberg/pull/66348)) -- Interface: Remove unused private API support. ([66565](https://github.com/WordPress/gutenberg/pull/66565)) -- Interface: Use plugin context hook instead of HoC. ([66362](https://github.com/WordPress/gutenberg/pull/66362)) - -#### Zoom Out -- Bundle behavior in block-editor and add story. ([66240](https://github.com/WordPress/gutenberg/pull/66240)) -- Editor: Handle zoom out state via the 'switchEditorMode' action. ([66262](https://github.com/WordPress/gutenberg/pull/66262)) -- Fix/html scale code quality. ([66181](https://github.com/WordPress/gutenberg/pull/66181)) -- Make useZoomOut hook private. ([66374](https://github.com/WordPress/gutenberg/pull/66374)) -- Remove double click to exit hook from the block-editor package. ([66335](https://github.com/WordPress/gutenberg/pull/66335)) -- Remove viewport check from useZoomOut hook. ([66341](https://github.com/WordPress/gutenberg/pull/66341)) - -#### Post Editor -- Editor: No need to reset mode when changing device preview types. ([66261](https://github.com/WordPress/gutenberg/pull/66261)) -- Editor: Use plugin context hook in 'PluginMoreMenuItem'. ([66351](https://github.com/WordPress/gutenberg/pull/66351)) -- Editor: Use plugin context hook in 'PluginPreviewMenuItem'. ([66350](https://github.com/WordPress/gutenberg/pull/66350)) -- Fix typo after #63669. ([66396](https://github.com/WordPress/gutenberg/pull/66396)) -- Remove leftover JS code from 66451. ([66472](https://github.com/WordPress/gutenberg/pull/66472)) - -#### Block Library -- Cleanup unnecessary notice removal. ([66409](https://github.com/WordPress/gutenberg/pull/66409)) -- ESLint: Fix a couple of React Compiler reassignment errors. ([66331](https://github.com/WordPress/gutenberg/pull/66331)) -- Footnotes: Remove extra callback when parsing content. ([66370](https://github.com/WordPress/gutenberg/pull/66370)) -- Gallery: Fix React Compiler reassignment error. ([66408](https://github.com/WordPress/gutenberg/pull/66408)) -- Table Block: Remove hasArrowIndicator prop. ([66204](https://github.com/WordPress/gutenberg/pull/66204)) - -#### Style Book -- Avoid state/effect combo when generating values. ([66446](https://github.com/WordPress/gutenberg/pull/66446)) -- Fix React Compiler error. ([66445](https://github.com/WordPress/gutenberg/pull/66445)) - -#### Global Styles -- Clean up: Adjust reusable-blocks dependencies. ([66302](https://github.com/WordPress/gutenberg/pull/66302)) -- Fix React Compiler variable mutation error. ([66410](https://github.com/WordPress/gutenberg/pull/66410)) -- Theme JSON: Get_block_nodes - relocate $selectors assignment. ([66265](https://github.com/WordPress/gutenberg/pull/66265)) - -#### Interactivity API -- Interactivity API: Add comments to the `deepMerge()` function. ([66220](https://github.com/WordPress/gutenberg/pull/66220)) -- Interactivity API: Add tests for handling arrays in `deepMerge()`. ([66218](https://github.com/WordPress/gutenberg/pull/66218)) -- Interactivity API: Delay block hydration to allow interactive block stores to initialize. ([66772])(https://github.com/WordPress/gutenberg/pull/66772) - -#### Site Editor -- Prepare route registration by refactoring the site editor router. ([66030](https://github.com/WordPress/gutenberg/pull/66030)) -- Navigation: Improve trigger for fallback navigation. ([66478](https://github.com/WordPress/gutenberg/pull/66478)) -#### Build Tooling -- Scripts: Refactor to extract license logic. ([66179](https://github.com/WordPress/gutenberg/pull/66179)) -- Plugins: Deprecate 'withPluginContext' HOC. ([66363](https://github.com/WordPress/gutenberg/pull/66363)) - -### Tools - -#### Testing -- Fix [Flaky Test] Entering zoomed out mode zooms the canvas. ([66212](https://github.com/WordPress/gutenberg/pull/66212)) -- Fix end-to-end test for padding appender. ([66080](https://github.com/WordPress/gutenberg/pull/66080)) -- Upgrade Playwright to v1.48. ([66296](https://github.com/WordPress/gutenberg/pull/66296)) - -#### Build Tooling -- Add new private `vips` package. ([64845](https://github.com/WordPress/gutenberg/pull/64845)) -- Revert "Use npm workspaces for packages". ([66270](https://github.com/WordPress/gutenberg/pull/66270)) -- Add theme type to the bug report issue template. ([63851](https://github.com/WordPress/gutenberg/pull/63851)) -- Pull request automation: Use full npm install. ([66314](https://github.com/WordPress/gutenberg/pull/66314)) -- Use npm workspaces for packages (second attempt). ([66272](https://github.com/WordPress/gutenberg/pull/66272)) - - -## First-time contributors - -The following PRs were merged by first-time contributors: - -- @AhmarZaidi: Remove toggle verb from post list data views 'Toggle details panel'. ([66334](https://github.com/WordPress/gutenberg/pull/66334)) -- @mediaformat: Remove clip & -webkit-clip-path for downloadable-block-list-item style.scss. ([66147](https://github.com/WordPress/gutenberg/pull/66147)) -- @nicolasgalvez: WP Scripts: Add a `--root-folder` argument to the `plugin-zip` command. ([61375](https://github.com/WordPress/gutenberg/pull/61375)) -- @poojabhimani12: Add Inline comment experimental flag. ([60622](https://github.com/WordPress/gutenberg/pull/60622)) -- @rinkalpagdar: Border support added to comments. ([66354](https://github.com/WordPress/gutenberg/pull/66354)) -- @rudrakshi-gupta: Add Transformation from Separator to Spacer. ([66230](https://github.com/WordPress/gutenberg/pull/66230)) -- @SH4LIN: GH-66090: Self nesting and circular nesting block fix. ([66121](https://github.com/WordPress/gutenberg/pull/66121)) ## Contributors The following contributors merged PRs in this release: -@aaronrobertshaw @afercia @AhmarZaidi @akasunil @andrewserong @arthur791004 @carolinan @cbravobernal @ciampo @dhruvang21 @ellatrix @getdave @gigitux @hbhalodia @jameskoster @jeryj @jsnajdr @juanfra @madhusudhand @MaggieCabrera @Mamaduka @mattrwalker @mcsf @mediaformat @michalczaplinski @mirka @mreishus @ndiego @nicolasgalvez @ntsekouras @oandregal @PARTHVATALIYA @peterwilsoncc @poojabhimani12 @prajapatisagar @ramonjd @renatho @rinkalpagdar @rudrakshi-gupta @ryanwelcher @SantosGuillamot @SH4LIN @sirreal @stokesman @swissspidy @t-hamano @talldan @tellthemachines @torounit @troychaplin @tyxla @vipul0425 @Vrishabhsk @vykes-mac @westonruter @youknowriad @zaguiini +@arthur791004 = 19.5.1 = diff --git a/docs/contributors/versions-in-wordpress.md b/docs/contributors/versions-in-wordpress.md index 4ba7b34da1555..62347f2d644a6 100644 --- a/docs/contributors/versions-in-wordpress.md +++ b/docs/contributors/versions-in-wordpress.md @@ -7,7 +7,6 @@ If anything looks incorrect here, please bring it up in #core-editor in [WordPre | Gutenberg Versions | WordPress Version | | ------------------ | ----------------- | | 18.6-19.3 | 6.7 | -| 17.8-18.5 | 6.6.2 | | 17.8-18.5 | 6.6.1 | | 17.8-18.5 | 6.6 | | 16.8-17.7 | 6.5.5 | diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index a27de8211c824..dd49d15685724 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -254,7 +254,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~~ +- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** showContent, summary ## Embed @@ -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, link, text), dimensions (minHeight), layout, spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~ ## Date diff --git a/docs/reference-guides/data/data-core-editor.md b/docs/reference-guides/data/data-core-editor.md index 9567d8e4b954f..713a247d88be2 100644 --- a/docs/reference-guides/data/data-core-editor.md +++ b/docs/reference-guides/data/data-core-editor.md @@ -786,7 +786,7 @@ Return true if the current post has already been published. _Parameters_ - _state_ `Object`: Global application state. -- _currentPost_ `[Object]`: Explicit current post for bypassing registry selector. +- _currentPost_ `Object?`: Explicit current post for bypassing registry selector. _Returns_ diff --git a/gutenberg.php b/gutenberg.php index eed059a15c9a3..128156a947b27 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.5 * Requires PHP: 7.2 - * Version: 19.6.1 + * Version: 19.6.0-rc.3 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index d505916450caf..dafa8b25f278f 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -3565,12 +3565,26 @@ public static function remove_insecure_properties( $theme_json, $origin = 'theme $variation_output = static::remove_insecure_styles( $variation_input ); - if ( isset( $variation_input['blocks'] ) ) { - $variation_output['blocks'] = static::remove_insecure_inner_block_styles( $variation_input['blocks'] ); - } - + // Process a variation's elements and element pseudo selector styles. if ( isset( $variation_input['elements'] ) ) { - $variation_output['elements'] = static::remove_insecure_element_styles( $variation_input['elements'] ); + foreach ( $valid_element_names as $element_name ) { + $element_input = $variation_input['elements'][ $element_name ] ?? null; + if ( $element_input ) { + $element_output = static::remove_insecure_styles( $element_input ); + + if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] ) ) { + foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] as $pseudo_selector ) { + if ( isset( $element_input[ $pseudo_selector ] ) ) { + $element_output[ $pseudo_selector ] = static::remove_insecure_styles( $element_input[ $pseudo_selector ] ); + } + } + } + + if ( ! empty( $element_output ) ) { + _wp_array_set( $variation_output, array( 'elements', $element_name ), $element_output ); + } + } + } } if ( ! empty( $variation_output ) ) { @@ -3608,59 +3622,6 @@ public static function remove_insecure_properties( $theme_json, $origin = 'theme return $theme_json; } - /** - * Remove insecure element styles within a variation or block. - * - * @since 6.8.0 - * - * @param array $elements The elements to process. - * @return array The sanitized elements styles. - */ - protected static function remove_insecure_element_styles( $elements ) { - $sanitized = array(); - $valid_element_names = array_keys( static::ELEMENTS ); - - foreach ( $valid_element_names as $element_name ) { - $element_input = $elements[ $element_name ] ?? null; - if ( $element_input ) { - $element_output = static::remove_insecure_styles( $element_input ); - - if ( isset( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] ) ) { - foreach ( static::VALID_ELEMENT_PSEUDO_SELECTORS[ $element_name ] as $pseudo_selector ) { - if ( isset( $element_input[ $pseudo_selector ] ) ) { - $element_output[ $pseudo_selector ] = static::remove_insecure_styles( $element_input[ $pseudo_selector ] ); - } - } - } - - $sanitized[ $element_name ] = $element_output; - } - } - return $sanitized; - } - - /** - * Remove insecure styles from inner blocks and their elements. - * - * @since 6.8.0 - * - * @param array $blocks The block styles to process. - * @return array Sanitized block type styles. - */ - protected static function remove_insecure_inner_block_styles( $blocks ) { - $sanitized = array(); - foreach ( $blocks as $block_type => $block_input ) { - $block_output = static::remove_insecure_styles( $block_input ); - - if ( isset( $block_input['elements'] ) ) { - $block_output['elements'] = static::remove_insecure_element_styles( $block_input['elements'] ); - } - - $sanitized[ $block_type ] = $block_output; - } - return $sanitized; - } - /** * Processes a setting node and returns the same node * without the insecure settings. diff --git a/lib/compat/wordpress-6.7/compat.php b/lib/compat/wordpress-6.7/compat.php index e58eca56ef71f..cd533a42cc528 100644 --- a/lib/compat/wordpress-6.7/compat.php +++ b/lib/compat/wordpress-6.7/compat.php @@ -40,13 +40,7 @@ function _gutenberg_add_block_templates_from_registry( $query_result, $query, $t } if ( ! isset( $query['wp_id'] ) ) { - // We need to unset the post_type query param because some templates - // would be excluded otherwise, like `page.html` when looking for - // `page` templates. - // See: https://github.com/WordPress/gutenberg/issues/65584 - $template_files_query = $query; - unset( $template_files_query['post_type'] ); - $template_files = _gutenberg_get_block_templates_files( $template_type, $template_files_query ); + $template_files = _gutenberg_get_block_templates_files( $template_type, $query ); /* * Add templates registered in the template registry. Filtering out the ones which have a theme file. diff --git a/lib/compat/wordpress-6.8/functions.php b/lib/compat/wordpress-6.8/functions.php deleted file mode 100644 index a4658d1a182c7..0000000000000 --- a/lib/compat/wordpress-6.8/functions.php +++ /dev/null @@ -1,35 +0,0 @@ - 'audio/wav'` - * - * @since 6.8.0 - * - * @param string[] $mime_types Mime types. - * @return string[] Mime types keyed by the file extension regex corresponding to those types. -*/ -function gutenberg_get_mime_types_6_8( $mime_types ) { - /* - * Only add support if there is existing support for 'wav'. - * Some plugins may have deliberately disabled it. - */ - if ( ! isset( $mime_types['wav'] ) && ! isset( $mime_types['wav|x-wav'] ) ) { - return $mime_types; - } - /* - * Also, given that other themes or plugins may have already - * tried to add x-wav type support, only - * add the mime type if it doesn't already exist - * to avoid overriding any customizations. - */ - if ( ! isset( $mime_types['x-wav'] ) && ! isset( $mime_types['wav|x-wav'] ) ) { - $mime_types['x-wav'] = 'audio/wav'; - } - return $mime_types; -} -add_filter( 'mime_types', 'gutenberg_get_mime_types_6_8', 99 ); diff --git a/lib/load.php b/lib/load.php index d7e4a33cd02c9..6236f0eb04b3c 100644 --- a/lib/load.php +++ b/lib/load.php @@ -119,7 +119,6 @@ function gutenberg_is_experiment_enabled( $name ) { // WordPress 6.8 compat. require __DIR__ . '/compat/wordpress-6.8/preload.php'; require __DIR__ . '/compat/wordpress-6.8/blocks.php'; -require __DIR__ . '/compat/wordpress-6.8/functions.php'; // Experimental features. require __DIR__ . '/experimental/block-editor-settings-mobile.php'; diff --git a/package-lock.json b/package-lock.json index 0bb48c55c5326..9d5b12e749d12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gutenberg", - "version": "19.6.1", + "version": "19.6.0-rc.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gutenberg", - "version": "19.6.1", + "version": "19.6.0-rc.3", "hasInstallScript": true, "license": "GPL-2.0-or-later", "workspaces": [ @@ -53169,7 +53169,6 @@ "@wordpress/keycodes": "*", "@wordpress/notices": "*", "@wordpress/preferences": "*", - "@wordpress/priority-queue": "*", "@wordpress/private-apis": "*", "@wordpress/rich-text": "*", "@wordpress/style-engine": "*", @@ -54310,6 +54309,7 @@ "@wordpress/plugins": "*", "@wordpress/preferences": "*", "@wordpress/primitives": "*", + "@wordpress/priority-queue": "*", "@wordpress/private-apis": "*", "@wordpress/reusable-blocks": "*", "@wordpress/router": "*", diff --git a/package.json b/package.json index 0fdb7ad563cd1..6e519e2f1070e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "19.6.1", + "version": "19.6.0-rc.3", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", diff --git a/packages/a11y/package.json b/packages/a11y/package.json index 008bd9088e077..09fa62a9d082b 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -27,9 +27,8 @@ "main": "build/index.js", "module": "build-module/index.js", "react-native": "src/index", - "wpScript": true, - "wpScriptModuleExports": "./build-module/module/index.js", "types": "build-types", + "wpScriptModuleExports": "./build-module/module/index.js", "dependencies": { "@babel/runtime": "7.25.7", "@wordpress/dom-ready": "*", @@ -37,5 +36,6 @@ }, "publishConfig": { "access": "public" - } + }, + "wpScript": true } diff --git a/packages/annotations/package.json b/packages/annotations/package.json index b1d6d210807a8..8a94b326a7819 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -25,7 +25,6 @@ "main": "build/index.js", "module": "build-module/index.js", "react-native": "src/index", - "wpScript": true, "dependencies": { "@babel/runtime": "7.25.7", "@wordpress/data": "*", @@ -39,5 +38,6 @@ }, "publishConfig": { "access": "public" - } + }, + "wpScript": true } diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index 7d5b8dfd58889..26f156a0aa7d7 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -26,7 +26,6 @@ "main": "build/index.js", "module": "build-module/index.js", "react-native": "src/index", - "wpScript": true, "types": "build-types", "dependencies": { "@babel/runtime": "7.25.7", @@ -35,5 +34,6 @@ }, "publishConfig": { "access": "public" - } + }, + "wpScript": true } diff --git a/packages/autop/package.json b/packages/autop/package.json index 336dda06edfe2..2169ff828da47 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -25,7 +25,6 @@ "main": "build/index.js", "module": "build-module/index.js", "react-native": "src/index", - "wpScript": true, "types": "build-types", "sideEffects": false, "dependencies": { @@ -33,5 +32,6 @@ }, "publishConfig": { "access": "public" - } + }, + "wpScript": true } diff --git a/packages/blob/package.json b/packages/blob/package.json index 0dc01ac7198f5..4b04d2ea2ddeb 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -25,7 +25,6 @@ "main": "build/index.js", "module": "build-module/index.js", "react-native": "src/index", - "wpScript": true, "types": "build-types", "sideEffects": false, "dependencies": { @@ -33,5 +32,6 @@ }, "publishConfig": { "access": "public" - } + }, + "wpScript": true } diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index 18a40824aa475..59025e1ad45c7 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -25,7 +25,6 @@ "main": "build/index.js", "module": "build-module/index.js", "react-native": "src/index", - "wpScript": true, "dependencies": { "@babel/runtime": "7.25.7", "@wordpress/a11y": "*", @@ -55,5 +54,6 @@ }, "publishConfig": { "access": "public" - } + }, + "wpScript": true } diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index b4672bc57690e..2b5cc8d6275e8 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -26,7 +26,6 @@ "main": "build/index.js", "module": "build-module/index.js", "react-native": "src/index", - "wpScript": true, "sideEffects": [ "build-style/**", "src/**/*.scss", @@ -60,7 +59,6 @@ "@wordpress/keycodes": "*", "@wordpress/notices": "*", "@wordpress/preferences": "*", - "@wordpress/priority-queue": "*", "@wordpress/private-apis": "*", "@wordpress/rich-text": "*", "@wordpress/style-engine": "*", @@ -89,5 +87,6 @@ }, "publishConfig": { "access": "public" - } + }, + "wpScript": true } diff --git a/packages/block-editor/src/components/block-canvas/style.scss b/packages/block-editor/src/components/block-canvas/style.scss index 8f6064de0b615..0b37b4dd1447e 100644 --- a/packages/block-editor/src/components/block-canvas/style.scss +++ b/packages/block-editor/src/components/block-canvas/style.scss @@ -3,7 +3,7 @@ iframe[name="editor-canvas"] { width: 100%; height: 100%; display: block; + background-color: transparent; // Handles transitions between device previews @include editor-canvas-resize-animation; - background-color: $gray-300; } diff --git a/packages/block-editor/src/components/block-list/block.js b/packages/block-editor/src/components/block-list/block.js index 6d4655189d972..2215625596dc5 100644 --- a/packages/block-editor/src/components/block-list/block.js +++ b/packages/block-editor/src/components/block-list/block.js @@ -24,8 +24,8 @@ import { isReusableBlock, getBlockDefaultClassName, hasBlockSupport, - createBlock, store as blocksStore, + privateApis as blocksPrivateApis, } from '@wordpress/blocks'; import { withFilters } from '@wordpress/components'; import { withDispatch, useDispatch, useSelect } from '@wordpress/data'; @@ -47,6 +47,8 @@ import { PrivateBlockContext } from './private-block-context'; import { unlock } from '../../lock-unlock'; +const { isUnmodifiedBlockContent } = unlock( blocksPrivateApis ); + /** * Merges wrapper props with special handling for classNames and styles. * @@ -311,7 +313,6 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { function switchToDefaultOrRemove() { const block = getBlock( clientId ); const defaultBlockName = getDefaultBlockName(); - const defaultBlockType = getBlockType( defaultBlockName ); if ( getBlockName( clientId ) !== defaultBlockName ) { const replacement = switchToBlockType( block, @@ -328,15 +329,6 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { selectBlock( nextBlockClientId ); } ); } - } else if ( defaultBlockType.merge ) { - const attributes = defaultBlockType.merge( - {}, - block.attributes - ); - replaceBlocks( - [ clientId ], - [ createBlock( defaultBlockName, attributes ) ] - ); } } @@ -350,9 +342,6 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { * to the moved block. */ function moveFirstItemUp( _clientId, changeSelection = true ) { - const wrapperBlockName = getBlockName( _clientId ); - const wrapperBlockType = getBlockType( wrapperBlockName ); - const isTextualWrapper = wrapperBlockType.category === 'text'; const targetRootClientId = getBlockRootClientId( _clientId ); const blockOrder = getBlockOrder( _clientId ); const [ firstClientId ] = blockOrder; @@ -362,14 +351,50 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { isUnmodifiedBlock( getBlock( firstClientId ) ) ) { removeBlock( _clientId ); - } else if ( isTextualWrapper ) { + } else { registry.batch( () => { + const firstBlock = getBlock( firstClientId ); + const isFirstBlockContentUnmodified = + isUnmodifiedBlockContent( firstBlock ); + const defaultBlockName = getDefaultBlockName(); + const replacement = switchToBlockType( + firstBlock, + defaultBlockName + ); + const canTransformToDefaultBlock = + !! replacement?.length && + replacement.every( ( block ) => + canInsertBlockType( block.name, _clientId ) + ); + if ( + isFirstBlockContentUnmodified && + canTransformToDefaultBlock + ) { + // Step 1: If the block is empty and can be transformed to the default block type. + replaceBlocks( + firstClientId, + replacement, + changeSelection + ); + } else if ( + isFirstBlockContentUnmodified && + firstBlock.name === defaultBlockName + ) { + // Step 2: If the block is empty and is already the default block type. + removeBlock( firstClientId ); + const nextBlockClientId = + getNextBlockClientId( clientId ); + if ( nextBlockClientId ) { + selectBlock( nextBlockClientId ); + } + } else if ( canInsertBlockType( - getBlockName( firstClientId ), + firstBlock.name, targetRootClientId ) ) { + // Step 3: If the block can be moved up. moveBlocksToPosition( [ firstClientId ], _clientId, @@ -377,21 +402,17 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { getBlockIndex( _clientId ) ); } else { - const replacement = switchToBlockType( - getBlock( firstClientId ), - getDefaultBlockName() - ); - - if ( - replacement && - replacement.length && + const canLiftAndTransformToDefaultBlock = + !! replacement?.length && replacement.every( ( block ) => canInsertBlockType( block.name, targetRootClientId ) - ) - ) { + ); + + if ( canLiftAndTransformToDefaultBlock ) { + // Step 4: If the block can be transformed to the default block type and moved up. insertBlocks( replacement, getBlockIndex( _clientId ), @@ -400,6 +421,7 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { ); removeBlock( firstClientId, false ); } else { + // Step 5: Continue the default behavior. switchToDefaultOrRemove(); } } @@ -411,8 +433,6 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { removeBlock( _clientId, false ); } } ); - } else { - switchToDefaultOrRemove(); } } diff --git a/packages/block-editor/src/components/block-patterns-list/README.md b/packages/block-editor/src/components/block-patterns-list/README.md index 18e7ead5d1805..f63ea44905957 100644 --- a/packages/block-editor/src/components/block-patterns-list/README.md +++ b/packages/block-editor/src/components/block-patterns-list/README.md @@ -18,6 +18,7 @@ import { BlockPatternsList } from '@wordpress/block-editor'; const MyBlockPatternsList = () => ( ); @@ -32,6 +33,13 @@ An array of block patterns that can be shown in the block patterns list. - Type: `Array` - Required: Yes +#### shownPatterns + +An array of shown block patterns objects. + +- Type: `Array` +- Required: Yes + #### onClickPattern The performed event after a click on a block pattern. In most cases, the pattern is inserted in the block editor. diff --git a/packages/block-editor/src/components/block-patterns-list/index.js b/packages/block-editor/src/components/block-patterns-list/index.js index 741a92ddf10df..2609cc2db97a1 100644 --- a/packages/block-editor/src/components/block-patterns-list/index.js +++ b/packages/block-editor/src/components/block-patterns-list/index.js @@ -134,14 +134,10 @@ function BlockPattern( { } } onMouseLeave={ () => onHover?.( null ) } > - } - > - - + { showTitle && ( + shownPatterns.includes( pattern ) + )?.name; setActiveCompositeId( firstCompositeItemId ); - }, [ blockPatterns ] ); + }, [ shownPatterns, blockPatterns ] ); return ( - { blockPatterns.map( ( pattern ) => ( - - ) ) } + { blockPatterns.map( ( pattern ) => { + const isShown = shownPatterns.includes( pattern ); + return isShown ? ( + + ) : ( + + ); + } ) } { pagingProps && } ); diff --git a/packages/block-editor/src/components/block-patterns-list/stories/index.story.js b/packages/block-editor/src/components/block-patterns-list/stories/index.story.js index 0ebb4520d98fd..9eb393ea13e76 100644 --- a/packages/block-editor/src/components/block-patterns-list/stories/index.story.js +++ b/packages/block-editor/src/components/block-patterns-list/stories/index.story.js @@ -3,6 +3,11 @@ */ import blockLibraryStyles from '!!raw-loader!../../../../../block-library/build-style/style.css'; +/** + * WordPress dependencies + */ +import { useAsyncList } from '@wordpress/compose'; + /** * Internal dependencies */ @@ -21,9 +26,13 @@ export default { export const Default = { render: function Template( props ) { + const shownPatterns = useAsyncList( props.blockPatterns ); return ( - + ); }, diff --git a/packages/block-editor/src/components/block-preview/index.js b/packages/block-editor/src/components/block-preview/index.js index 62b137ff37194..9eef0f1dc2abd 100644 --- a/packages/block-editor/src/components/block-preview/index.js +++ b/packages/block-editor/src/components/block-preview/index.js @@ -19,7 +19,6 @@ import AutoHeightBlockPreview from './auto'; import EditorStyles from '../editor-styles'; import { store as blockEditorStore } from '../../store'; import { BlockListItems } from '../block-list'; -import { Async } from './async'; const EMPTY_ADDITIONAL_STYLES = []; @@ -87,10 +86,6 @@ export function BlockPreview( { ); } -const MemoizedBlockPreview = memo( BlockPreview ); - -MemoizedBlockPreview.Async = Async; - /** * BlockPreview renders a preview of a block or array of blocks. * @@ -102,7 +97,7 @@ MemoizedBlockPreview.Async = Async; * * @return {Component} The component to be rendered. */ -export default MemoizedBlockPreview; +export default memo( BlockPreview ); /** * This hook is used to lightly mark an element as a block preview wrapper diff --git a/packages/block-editor/src/components/block-toolbar/change-design.js b/packages/block-editor/src/components/block-toolbar/change-design.js index 9da1affe4273c..ecfeff6cb1ed3 100644 --- a/packages/block-editor/src/components/block-toolbar/change-design.js +++ b/packages/block-editor/src/components/block-toolbar/change-design.js @@ -10,6 +10,7 @@ import { import { __ } from '@wordpress/i18n'; import { cloneBlock } from '@wordpress/blocks'; import { useMemo } from '@wordpress/element'; +import { useAsyncList } from '@wordpress/compose'; import { useSelect, useDispatch } from '@wordpress/data'; /** @@ -80,6 +81,10 @@ export default function ChangeDesign( { clientId } ) { .slice( 0, MAX_PATTERNS_TO_SHOW ); }, [ categories, currentPatternName, patterns ] ); + const currentShownPatterns = useAsyncList( + sameCategoryPatternsWithSingleWrapper + ); + if ( sameCategoryPatternsWithSingleWrapper.length < 2 ) { return null; } @@ -116,6 +121,7 @@ export default function ChangeDesign( { clientId } ) { paddingSize="none" > :first-child { + margin-block-start: 0; + margin-block-end: 0; + } - // The following prevents user agent styles from applying margins to the appender's inner paragraph. - // This in turn prevents layout shift due to layout styles removing margins from first and last children. - margin-block-start: 0; - margin-block-end: 0; + // Since this appender will only ever appear on an entirely empty document, we don't account for last-child. + // This is also because it will never be the last child, the block inserter that sits in this appender is the last child. } // Dropzone. diff --git a/packages/block-editor/src/components/global-styles/dimensions-panel.js b/packages/block-editor/src/components/global-styles/dimensions-panel.js index c19788ebfcb58..4c52de6a3d7d1 100644 --- a/packages/block-editor/src/components/global-styles/dimensions-panel.js +++ b/packages/block-editor/src/components/global-styles/dimensions-panel.js @@ -147,30 +147,24 @@ function splitStyleValue( value ) { return value; } -function splitGapValue( value, isAxialGap ) { - if ( ! value ) { - return value; +function splitGapValue( value ) { + // Check for shorthand value (a string value). + if ( value && typeof value === 'string' ) { + // If the value is a string, treat it as a single side (top) for the spacing controls. + return { + top: value, + }; } - // Check for shorthand value (a string value). - if ( typeof value === 'string' ) { - /* - * Map the string value to appropriate sides for the spacing control depending - * on whether the current block has axial gap support or not. - * - * Note: The axial value pairs must match for the spacing control to display - * the appropriate horizontal/vertical sliders. - */ - return isAxialGap - ? { top: value, right: value, bottom: value, left: value } - : { top: value }; + if ( value ) { + return { + ...value, + right: value?.left, + bottom: value?.top, + }; } - return { - ...value, - right: value?.left, - bottom: value?.top, - }; + return value; } function DimensionsToolsPanel( { @@ -331,13 +325,13 @@ export default function DimensionsPanel( { // Block Gap const showGapControl = useHasGap( settings ); + const gapValue = decodeValue( inheritedValue?.spacing?.blockGap ); + const gapValues = splitGapValue( gapValue ); const gapSides = Array.isArray( settings?.spacing?.blockGap ) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides; const isAxialGap = gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) ); - const gapValue = decodeValue( inheritedValue?.spacing?.blockGap ); - const gapValues = splitGapValue( gapValue, isAxialGap ); const setGapValue = ( newGapValue ) => { onChange( setImmutably( value, [ 'spacing', 'blockGap' ], newGapValue ) diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js index 76d2e09dfb7a3..85e1f12a7c0d6 100644 --- a/packages/block-editor/src/components/iframe/index.js +++ b/packages/block-editor/src/components/iframe/index.js @@ -191,22 +191,6 @@ function Iframe( { preventFileDropDefault, false ); - // Prevent clicks on links from navigating away. Note that links - // inside `contenteditable` are already disabled by the browser, so - // this is for links in blocks outside of `contenteditable`. - iFrameDocument.addEventListener( 'click', ( event ) => { - if ( event.target.tagName === 'A' ) { - event.preventDefault(); - - // Appending a hash to the current URL will not reload the - // page. This is useful for e.g. footnotes. - const href = event.target.getAttribute( 'href' ); - if ( href.startsWith( '#' ) ) { - iFrameDocument.defaultView.location.hash = - href.slice( 1 ); - } - } - } ); } node.addEventListener( 'load', onLoad ); @@ -288,7 +272,6 @@ function Iframe( { -