Files
wordpress/wp-includes/blocks/gallery.php
ellatrix ec44501020 Gutenberg ref update.
Developed in https://github.com/WordPress/wordpress-develop/pull/10968.

Props ellatrix, adamsilverstein, youknowriad.
See #64595.

---

I've included a log of the Gutenberg changes with the following command:

git log --reverse --format="- %s" 59a08c5496008ca88f4b6b86f38838c3612d88c8..7a11a53377a95cba4d3786d71cadd4c2f0c5ac52 | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy

- Remove unnecessary block deprecation from experimental tabs (https://github.com/WordPress/gutenberg/pull/75208)
- Block Editor: The insertBlock(s) actions should receive the same arguments (https://github.com/WordPress/gutenberg/pull/75197)
- Storybook: Always load design tokens in Design System section (https://github.com/WordPress/gutenberg/pull/74899)
- Default all initial suggested results to 20 for navigation link ui (https://github.com/WordPress/gutenberg/pull/75186)
- Navigation overlay: remove experiment (https://github.com/WordPress/gutenberg/pull/74968)
- Move AwarenessState to @wordpress/core-data (https://github.com/WordPress/gutenberg/pull/75216)
- RichText: Avoid stale active formats when deleting the text (https://github.com/WordPress/gutenberg/pull/75227)
- Fix <CollaboratorsPresence> type imports (https://github.com/WordPress/gutenberg/pull/75232)
- Block Editor: Add l10n context to 'Manage allowed blocks' string (https://github.com/WordPress/gutenberg/pull/75239)
- Fixed: Custom colors are now reflected in the editor for heading blocks (https://github.com/WordPress/gutenberg/pull/75234)
- Real-time Collaboration: Fix revision restore bug (https://github.com/WordPress/gutenberg/pull/75233)
- Real-time collaboration: Update 'sync.providers' filter inline comments (https://github.com/WordPress/gutenberg/pull/75248)
- Real-time collaboration: Make the collaborators presense button translatable (https://github.com/WordPress/gutenberg/pull/75252)
- Fix: Navigation Overlay Close Block: Add missing @since tag https://github.com/WordPress/gutenberg/pull/75247 (https://github.com/WordPress/gutenberg/pull/75250)
- Cover: Add new "fullheight" icon, and use for Cover (https://github.com/WordPress/gutenberg/pull/75240)
- Real-time collaboration: Remove @wordpress/sync from bundled packages and add private APIs (https://github.com/WordPress/gutenberg/pull/74671)
- Navigation Link: Clarify Link To invalid and draft state messages (https://github.com/WordPress/gutenberg/pull/74054)
- Docs: Simplifying Gutenberg versions table (https://github.com/WordPress/gutenberg/pull/75209)
- UI: Remove Box component abstraction (https://github.com/WordPress/gutenberg/pull/74986)
- Docs: Remove private GitHub team links in repository management (https://github.com/WordPress/gutenberg/pull/75255)
- UI: Add `Textarea` primitive (https://github.com/WordPress/gutenberg/pull/74707)
- Components: Add usage guidance for agents and Storybook (https://github.com/WordPress/gutenberg/pull/74815)
- Theme: Update elevation tokens to use abbreviated size names (https://github.com/WordPress/gutenberg/pull/75103)
- Navigation link: fix resetting link from the tools panel (https://github.com/WordPress/gutenberg/pull/75228)
- List View Support: Only render list view on top level block with support (https://github.com/WordPress/gutenberg/pull/75166)
- Gallery: Add lightbox support (https://github.com/WordPress/gutenberg/pull/62906)
- Workflows: Ignore icons manifest for manual backports (https://github.com/WordPress/gutenberg/pull/75245)
- Add new `adaptiveSelect` DataForm control (https://github.com/WordPress/gutenberg/pull/74937)
- Site Editor Pages: QuickEdit as a modal (https://github.com/WordPress/gutenberg/pull/75173)
- Add block rename keyboard shortcut (https://github.com/WordPress/gutenberg/pull/74454)
- Playlist block: Remove border (https://github.com/WordPress/gutenberg/pull/75202)
- Widget Area: Disable renaming and visibility support (https://github.com/WordPress/gutenberg/pull/75279)
- @wordpress/theme: add missing CHANGELOG entries (https://github.com/WordPress/gutenberg/pull/75281)
- Storybook: Add Stories for LetterSpacingControl component (https://github.com/WordPress/gutenberg/pull/73480)
- Remove the client from the awareness state when they disconnect (https://github.com/WordPress/gutenberg/pull/75253)
- Fix awareness timeout documentation unit (https://github.com/WordPress/gutenberg/pull/75284)
- Add global setting to enable real-time collaboration (https://github.com/WordPress/gutenberg/pull/75286)
- Notes: Pressing Escape should cancel adding a note (https://github.com/WordPress/gutenberg/pull/75288)
- Real-time Collaboration: Change users to collaborators (https://github.com/WordPress/gutenberg/pull/75237)
- Add timestamp when publishing next versions (https://github.com/WordPress/gutenberg/pull/75293)
- Storybook: Preserve export order for stories (https://github.com/WordPress/gutenberg/pull/75295)
- ToggleControl: Prevent console warning for `__nextHasNoMarginBottom` (https://github.com/WordPress/gutenberg/pull/75296)
- Quick edit: Make footer sticky (https://github.com/WordPress/gutenberg/pull/75297)
- DataForm Regular layout: label always uppercase (https://github.com/WordPress/gutenberg/pull/75292)
- @wordpress/ui: add Dialog component (https://github.com/WordPress/gutenberg/pull/75183)
- Navigation Link: Go to page link and edit page for inspector sidebar (https://github.com/WordPress/gutenberg/pull/75262)
- SiteEditor Pages: prevent QuickEdit modal from being triggered in list layout via URL param (https://github.com/WordPress/gutenberg/pull/75300)
- Link Control: Fix validation timing (https://github.com/WordPress/gutenberg/pull/75267)
- Publishing packages: fix next timestamp (https://github.com/WordPress/gutenberg/pull/75301)
- Add storybook for ColorPaletteControl (https://github.com/WordPress/gutenberg/pull/74425)
- Post Comments Form: Migrate to text-align block support (https://github.com/WordPress/gutenberg/pull/75322)
- Post Comments Count: Migrate to text-align block support (https://github.com/WordPress/gutenberg/pull/75321)
- Optimize tabsList computation with useRef for comparison (https://github.com/WordPress/gutenberg/pull/75219)
- Accordion block: Add list view support (https://github.com/WordPress/gutenberg/pull/75271)
- Media Fields: Filter author field to only show users with authoring capabilities (https://github.com/WordPress/gutenberg/pull/75328)
- Fields: Fix `authorField` query (https://github.com/WordPress/gutenberg/pull/75298)
- Slot: fix ref forwarding (https://github.com/WordPress/gutenberg/pull/75274)
- wp-env: Add --config option for custom config files (https://github.com/WordPress/gutenberg/pull/75087)
- Update Emotion for React 19 compat (https://github.com/WordPress/gutenberg/pull/75324)
- Block Visibility: Show keyboard shortcut hint in context menu (https://github.com/WordPress/gutenberg/pull/75334)
- Updated Typo in template-activate file (https://github.com/WordPress/gutenberg/pull/75333)
- wp-env: fix status command (https://github.com/WordPress/gutenberg/pull/75325)
- Playlist block:Inherit more CSS (https://github.com/WordPress/gutenberg/pull/75256)
- DataViews: Add onReset prop for view persistence reset (https://github.com/WordPress/gutenberg/pull/75093)
- Notes: Add a keyboard shortcut for creating a new note (https://github.com/WordPress/gutenberg/pull/75287)
- Storybook: Fix missing props on certain components (https://github.com/WordPress/gutenberg/pull/75316)
- Pattern Editing: Allow click through to List View (https://github.com/WordPress/gutenberg/pull/75246)
- Block Bindings: Have block fields panel reflects bound attribute value (https://github.com/WordPress/gutenberg/pull/72096)
- Fix: ISO 8601 compliant year formatting in TimePicker (https://github.com/WordPress/gutenberg/pull/75343)
- Prevent fatal error when the inline CSS duotone variable is an array (https://github.com/WordPress/gutenberg/pull/75283)
- Bugfix: Set the removed users to empty for awareness (https://github.com/WordPress/gutenberg/pull/75337)
- Button: prevent outline flicker when focused and active at the same time (https://github.com/WordPress/gutenberg/pull/75346)
- Real-time collaboration: Always target autosave revision (https://github.com/WordPress/gutenberg/pull/75105)
- In-editor revisions: add visual diffing (https://github.com/WordPress/gutenberg/pull/75049)
- iAPI Router: Update cached styles for re-fetched pages (https://github.com/WordPress/gutenberg/pull/75097)
- Add tests for the awareness code in core-data (https://github.com/WordPress/gutenberg/pull/75074)
- Add tests for the awareness code in sync (https://github.com/WordPress/gutenberg/pull/75077)
- Lock save button during Client Side Media processing and uploading (https://github.com/WordPress/gutenberg/pull/74951)
- Real-time Collaboration: Fix broken unit tests for awareness (https://github.com/WordPress/gutenberg/pull/75362)
- Boot: Fix mobile admin bar covering single-page mode headers (https://github.com/WordPress/gutenberg/pull/75339)
- Design System: Add guidelines for save and submit UX (https://github.com/WordPress/gutenberg/pull/74811)
- Featured Image: fix select-default-value (https://github.com/WordPress/gutenberg/pull/75358)
- Breadcrumbs: Improve loading state rendering (https://github.com/WordPress/gutenberg/pull/75383)
- Block Editor: Remove formatting controls restriction private API (https://github.com/WordPress/gutenberg/pull/75382)
- Link Control: Validate on submit (https://github.com/WordPress/gutenberg/pull/75310)
- Rich Text: Remove min-width inline style causing flex layout issues (https://github.com/WordPress/gutenberg/pull/75370)
- Tabs: Tidy up UI for controls (https://github.com/WordPress/gutenberg/pull/75309)
- Core Block Reference: Fix object empty inner key processing (https://github.com/WordPress/gutenberg/pull/75391)
- Improve sync performance metrics (https://github.com/WordPress/gutenberg/pull/75029)
- DataForm: update panel trigger (https://github.com/WordPress/gutenberg/pull/75290)
- Block Editor: Fix Columns block horizontal spacing when setting vertical gap (https://github.com/WordPress/gutenberg/pull/75355)
- DataViews Filters: Fix styling of long values in filter dropdown (https://github.com/WordPress/gutenberg/pull/75369)
- Try swapping tabs (https://github.com/WordPress/gutenberg/pull/75194)
- RichText: move useFormatTypes to rich-text package (https://github.com/WordPress/gutenberg/pull/75387)
- Make all navigation overlay close buttons work (https://github.com/WordPress/gutenberg/pull/75384)
- Block Editor: Improve Background panel UI in Global Styles (https://github.com/WordPress/gutenberg/pull/75230)
- Tabs: Update Tabs block icons (https://github.com/WordPress/gutenberg/pull/75376)
- Accordion: Move Accordion icons to Icon library (https://github.com/WordPress/gutenberg/pull/75380)
- Fix: Changing URL in link after changing text outside the popover resets it (https://github.com/WordPress/gutenberg/pull/75342)
- Update icon manifest acronyms. (https://github.com/WordPress/gutenberg/pull/75418)
- Code Modernization: Use null coalescing operator in additional `isset() ternaries. (https://github.com/WordPress/gutenberg/pull/75419)
- Pattern Editing: Move List View selectors to private-selectors (https://github.com/WordPress/gutenberg/pull/75414)
- DataViews: Use public ColorPicker instead of internal Picker export (https://github.com/WordPress/gutenberg/pull/75394)
- Abilities: Allow nested namespace ability names (2-4 segments) (https://github.com/WordPress/gutenberg/pull/75393)
- Fix: Remove backport changelog committed by mistake (https://github.com/WordPress/gutenberg/pull/75441)
- Block Visibility: Simplify toolbar for hidden blocks (https://github.com/WordPress/gutenberg/pull/75335)
- Block Visibility: Centralize modal state in block-editor store (https://github.com/WordPress/gutenberg/pull/75367)
- Allow grid to use style variation blockGap values for columns calculation (https://github.com/WordPress/gutenberg/pull/75360)
- Langauge Format: Add missing attribute definiton (https://github.com/WordPress/gutenberg/pull/75422)
- Block transform command: pass the block icon src rather than a BlockIcon component (https://github.com/WordPress/gutenberg/pull/75365)
- Note: Remove block highlight when deleting parent note (https://github.com/WordPress/gutenberg/pull/75453)
- Core Data: Improve blocks cache in useEntityBlockEditor (https://github.com/WordPress/gutenberg/pull/75400)
- MediaEdit: Support ordered values and reordering of items (https://github.com/WordPress/gutenberg/pull/75207)
- Writing flow: fix select all with full formatting (https://github.com/WordPress/gutenberg/pull/64934)
- Filter navigation category patterns to only show in navigation-overlay template part context (https://github.com/WordPress/gutenberg/pull/75276)
- Update Testing Library for React 19 compat (https://github.com/WordPress/gutenberg/pull/75340)
- Writing Flow: Fix block selection from partially selected RichText (https://github.com/WordPress/gutenberg/pull/75449)
- Notes: Fix sidebar display logic for small screens (https://github.com/WordPress/gutenberg/pull/75454)
- Post editor: iframe: check inserted rather than registered block versions (https://github.com/WordPress/gutenberg/pull/75187)
- Block Visibility: Disable visibility toggle for children of sections (https://github.com/WordPress/gutenberg/pull/75447)
- Notes: Update shortcut category (https://github.com/WordPress/gutenberg/pull/75461)
- Add dedicated navigation-overlay icon (https://github.com/WordPress/gutenberg/pull/75249) (https://github.com/WordPress/gutenberg/pull/75426)
- Docs: Rename Interactivity API's 'API Reference' to 'Directives and Store' (https://github.com/WordPress/gutenberg/pull/74974)
- DataForm: Fix color picker styles (https://github.com/WordPress/gutenberg/pull/75427)
- Post Excerpt Block: Remove REST API filter for excerpt length in post excerpt block (https://github.com/WordPress/gutenberg/pull/75299)
- Move experimental PR out of backport log (https://github.com/WordPress/gutenberg/pull/75465)
- Add paste logging to writing flow (https://github.com/WordPress/gutenberg/pull/73885)
- Real-time collaboration: Sync post content and undefined `blocks` value (https://github.com/WordPress/gutenberg/pull/75437)
- Gutenberg plugin: always enforce the iframe in the post editor (https://github.com/WordPress/gutenberg/pull/75475)
- New Block: Icon Block (https://github.com/WordPress/gutenberg/pull/71227)
- Tabs: Improve tab keyboard nav (https://github.com/WordPress/gutenberg/pull/75471)
- Pre-populate Navigation Page Creator with Search Text  (https://github.com/WordPress/gutenberg/pull/75154)
- Block Library: Hide navigation-overlay template parts from inserter (https://github.com/WordPress/gutenberg/pull/75478)
- Tabs: Add text and background color support (https://github.com/WordPress/gutenberg/pull/75482)
- Preserve existing URLInput defaults (https://github.com/WordPress/gutenberg/pull/75392)
- UI: Remove unnecessary jest.setTimeout from Select test (https://github.com/WordPress/gutenberg/pull/75444)
- Fix missed dimension token migration in UI package (https://github.com/WordPress/gutenberg/pull/75446)
- Render default density selector last in design tokens CSS (https://github.com/WordPress/gutenberg/pull/75474)
- Navigation: Improved help text in create a page flow (https://github.com/WordPress/gutenberg/pull/75349)
- Fix gap token migration guide in changelog (https://github.com/WordPress/gutenberg/pull/75492)
- Block Visibility: Disable Apply button on non-dirty state (https://github.com/WordPress/gutenberg/pull/75494)
- Real-time Collaboration: Use Y.text for title, content and excerpt (https://github.com/WordPress/gutenberg/pull/75448)
- DataForm: Style SummaryButton in panel layout with `is-disabled` classname (https://github.com/WordPress/gutenberg/pull/75470)
- Gallery: Add list view block support (https://github.com/WordPress/gutenberg/pull/75407)
- Types: consistently use the React namespace (https://github.com/WordPress/gutenberg/pull/75499)
- Enhance block appender labels to reflect default block type (https://github.com/WordPress/gutenberg/pull/71502)
- Import Yjs correctly (https://github.com/WordPress/gutenberg/pull/75500)
- Add testsEnvironment option and split Gutenberg wp-env configs (https://github.com/WordPress/gutenberg/pull/75341)
- Add `clearEntityRecordEdits` action to core-data (https://github.com/WordPress/gutenberg/pull/75397)
- Tabs: Stabilize Tabs blocks (https://github.com/WordPress/gutenberg/pull/75424)
- Simplify Tabs Menu Item editing (https://github.com/WordPress/gutenberg/pull/75416)
- Fix LinkControl URL Normalization (https://github.com/WordPress/gutenberg/pull/75488)
- Navigation Submenu: Restore openSubmenusOnClick to usesContext for backward compatibility. (https://github.com/WordPress/gutenberg/pull/75435)
- Tabs: Add `@since 7.0.0` annotations (https://github.com/WordPress/gutenberg/pull/75521)
- Story types: fix StoryFns used as React components (https://github.com/WordPress/gutenberg/pull/75472)
- Tabs: fix incorrect fixtures (https://github.com/WordPress/gutenberg/pull/75523)
- AGENTS.md: Add CLAUDE.md symlinks, architecture decisions, and common pitfalls (https://github.com/WordPress/gutenberg/pull/75507)
- Use contextual snackbar text when activating a theme from preview (https://github.com/WordPress/gutenberg/pull/75385)
- Pick user fields instead of spreading the entire object (https://github.com/WordPress/gutenberg/pull/75528)
- Real-time collaboration: Move PHP code to compat / backports directory (https://github.com/WordPress/gutenberg/pull/75366)
- Icons: Fix incorrect attributes for SVG (https://github.com/WordPress/gutenberg/pull/75273)
- Icons: Make full height icon label title case (https://github.com/WordPress/gutenberg/pull/75524)
- Respect deprecated openSubmenusOnClick value on frontend rendering (https://github.com/WordPress/gutenberg/pull/75439)
- useRef: always supply initial value (https://github.com/WordPress/gutenberg/pull/75513)
- Code Modernization: Replace isset() checks with null coalescing operator (https://github.com/WordPress/gutenberg/pull/75425)
- Prefix usages of JSX namespaces with React.JSX (https://github.com/WordPress/gutenberg/pull/75508)
- Cleanup: Remove unnecessary array check in `WP_Theme_JSON_Gutenberg` (https://github.com/WordPress/gutenberg/pull/75515)
- Real-time collaboration: Add collaborators cursor awareness (https://github.com/WordPress/gutenberg/pull/75398)
- Post Comments Link: Migrate to Text-Align Block Support (https://github.com/WordPress/gutenberg/pull/75332)
- Post time to read: Migrate to Text-Align Block Support (https://github.com/WordPress/gutenberg/pull/75541)
- ExternalLink: Prevent Twemoji from replacing arrow (https://github.com/WordPress/gutenberg/pull/75538)
- Duotone: add sgomes as owner (https://github.com/WordPress/gutenberg/pull/75519)
- Use null coalescing operator for common isset patterns (https://github.com/WordPress/gutenberg/pull/75487)
- Term Description: Migrate to Text-Align Block Support (https://github.com/WordPress/gutenberg/pull/75542)
- Create sub-sized images (https://github.com/WordPress/gutenberg/pull/74566)
- Add EXIF metadata tests for Client Side Media (https://github.com/WordPress/gutenberg/pull/74909)
- Add AVIF, WebP and MozJPEG output encoding support (https://github.com/WordPress/gutenberg/pull/75081)
- Post Terms: Migrate to Text-Align Block Support (https://github.com/WordPress/gutenberg/pull/75545)
- Tabs: Make Example preview translatable (https://github.com/WordPress/gutenberg/pull/75555)
- List View tab: Ensure it's populated when first selecting a container block (https://github.com/WordPress/gutenberg/pull/75558)
- Fix auto draft bug for Y.text titles (https://github.com/WordPress/gutenberg/pull/75560)
- Border Support: Fix editor split border style fallback (https://github.com/WordPress/gutenberg/pull/75546)
- Block Editor: Avoid unnecessary state churn in controlled inner blocks reducers (https://github.com/WordPress/gutenberg/pull/75458)
- Block Lock: Disable Apply button on non-dirty state (https://github.com/WordPress/gutenberg/pull/75495)
- Post Terms: Avoid unbound queries when the post context isn't available (https://github.com/WordPress/gutenberg/pull/75536)
- wp-env Playground: improve mapping and core source handling (https://github.com/WordPress/gutenberg/pull/75527)
- DataForm: add edit variant (https://github.com/WordPress/gutenberg/pull/75462)
- Tabs: Improve Tab Panel accessibility (https://github.com/WordPress/gutenberg/pull/75484)
- Tabs: Remove name editing UI (https://github.com/WordPress/gutenberg/pull/75554)
- useBlockSync: stop reconstructing controlled inner blocks (https://github.com/WordPress/gutenberg/pull/75562)
- Notes: Fix new note creation from the List View (https://github.com/WordPress/gutenberg/pull/75566)
- Navigation: Update overlay template part naming to "Navigation Overlay" (https://github.com/WordPress/gutenberg/pull/75564)
- Update usage of RefObject types (React 19 compat) (https://github.com/WordPress/gutenberg/pull/75567)
- useMergeRefs: migrate to TypeScript (https://github.com/WordPress/gutenberg/pull/75569)
- Improve link preview badges (https://github.com/WordPress/gutenberg/pull/75318)
- Add getDimensionsClassesAndStyles function and related tests (https://github.com/WordPress/gutenberg/pull/74524)
- Informational Parity between Inspector Link Preview and on Canvas Link Preview (https://github.com/WordPress/gutenberg/pull/75399)
- Icons Registry: Don't expose "internal" icons (https://github.com/WordPress/gutenberg/pull/75526)
- ui/Button: fix disabled styles and variable composition (https://github.com/WordPress/gutenberg/pull/75568)
- Tabs: Set explicit font-family on tab buttons (https://github.com/WordPress/gutenberg/pull/75537)
- Interactivity API: Export `watch` from `@preact/signals`'s `effect` (https://github.com/WordPress/gutenberg/pull/75563)
- iAPI router: Move internal properties to a private store (https://github.com/WordPress/gutenberg/pull/70882)
- Post Excerpt: Add text columns support (https://github.com/WordPress/gutenberg/pull/75587)
- Update gutenberg to match core after https://github.com/WordPress/gutenberg/pull/75360 sync (https://github.com/WordPress/gutenberg/pull/75594)
- Block Visibility: Show viewport icons and tooltip in list view for hidden blocks (https://github.com/WordPress/gutenberg/pull/75404)
- [Real-time collaboration] Refine collaborator overlay with Avatar component integration (https://github.com/WordPress/gutenberg/pull/75595)
- Media Utils: Auto-select uploaded files in media modal experiment (https://github.com/WordPress/gutenberg/pull/75597)
- Try enabling paragraphs to be added to contentOnly patterns (https://github.com/WordPress/gutenberg/pull/73222)
- Implement WebAssembly support detection and fallbacks (https://github.com/WordPress/gutenberg/pull/74827)
- Icon block: Skip serialization and increase default size (https://github.com/WordPress/gutenberg/pull/75553)
- In-editor Revisions: Update success notice message (https://github.com/WordPress/gutenberg/pull/75411)
- Stabilize PHP-Only Block Registration (https://github.com/WordPress/gutenberg/pull/75543)
- Add comments around expandRevision functionality (https://github.com/WordPress/gutenberg/pull/75573)
- Tab Block: Ensure label formatting works correctly (https://github.com/WordPress/gutenberg/pull/75548)
- Tabs: Fix saved HTML (https://github.com/WordPress/gutenberg/pull/75580)
- [Real-time collaboration] Fix <CollaboratorsPresence> layout issue (https://github.com/WordPress/gutenberg/pull/75599)
- Notes: Fix block toolbar click action (https://github.com/WordPress/gutenberg/pull/75614)
- Commands: Add category property to command registration (https://github.com/WordPress/gutenberg/pull/75612)
- fix tab color-reset-all-filter (https://github.com/WordPress/gutenberg/pull/75606)
- Fix selection restoration after entity navigation (https://github.com/WordPress/gutenberg/pull/75371)
- Tabs: Sanitize tab_id (https://github.com/WordPress/gutenberg/pull/75615)
- Inherit text color for tabs-menu-item blocks (https://github.com/WordPress/gutenberg/pull/75621)
- Auto-switch viewport based on Overlay Visibility setting when entering overlay editor (https://github.com/WordPress/gutenberg/pull/75386)
- Fix: Show and hook up submenu visibility for Page Lists within Navigation Blocks (https://github.com/WordPress/gutenberg/pull/75531)
- Remove useEffect guard rail to enforce minimum width. (https://github.com/WordPress/gutenberg/pull/75624)
- Navigation: select list view tab on contentOnly. Alternative with explicit solution (https://github.com/WordPress/gutenberg/pull/75578)
- Navigation overlay: added basic e2e tests (https://github.com/WordPress/gutenberg/pull/75581)
- Revert Tabs block to experimental block (https://github.com/WordPress/gutenberg/pull/75572)
- List Block: Prevent content loss when merging into a fresh empty list item (https://github.com/WordPress/gutenberg/pull/74382)
- Fix Overlay core patterns not showing on design tab (https://github.com/WordPress/gutenberg/pull/75618)
- Rename Verse block to Poetry (https://github.com/WordPress/gutenberg/pull/74121)
- Fix Navigation block button showing "View custom" instead of "View link" for external URLs (https://github.com/WordPress/gutenberg/pull/75571)
- Removed Unused Global Documentation (https://github.com/WordPress/gutenberg/pull/75631)
- Real-time collaboration: Add sync connection status handling (https://github.com/WordPress/gutenberg/pull/75066)
- Add e2e test for selection restoration after pattern entity navigation (https://github.com/WordPress/gutenberg/pull/75575)
- Remove the Icon Block and Icon SVG API from experiments (https://github.com/WordPress/gutenberg/pull/75576)
- Block editor cross origin isolation: attempt to gracefully deal with race conditions (https://github.com/WordPress/gutenberg/pull/75600)
- Update diff package (https://github.com/WordPress/gutenberg/pull/75644)
- Upload Media: rebase of 75547 (https://github.com/WordPress/gutenberg/pull/75646)
- Block Editor: Allow disabling content-only editing for unsynced patterns (https://github.com/WordPress/gutenberg/pull/75457)
- Real-Time Collaboration: Add e2e tests for RTC (https://github.com/WordPress/gutenberg/pull/75598)
- Update the y-protocols versin and remove the unncessary types (https://github.com/WordPress/gutenberg/pull/75657)
- Pattern Editing: Add "Edit section" button to unsynced pattern toolbar (https://github.com/WordPress/gutenberg/pull/75602)
- PHP-Only Block Registration: Remove client-side schema validation (https://github.com/WordPress/gutenberg/pull/75623)
- Navigation: Add 'expectedDeprecated' annotations (https://github.com/WordPress/gutenberg/pull/75659)
- Site Editor: make QuickEdit stable + change template to select (https://github.com/WordPress/gutenberg/pull/75565)
- Icon Block: Move default width rule to theme.json instead of block.json (https://github.com/WordPress/gutenberg/pull/75653)
- Add e2e test for loading settings in site editor preload spec (https://github.com/WordPress/gutenberg/pull/75661)
- Update Ariakit packages (https://github.com/WordPress/gutenberg/pull/75620)
- Upgrade Playwright to v1.58 (https://github.com/WordPress/gutenberg/pull/75632)
- GitHub actions: Exclude lib/theme.json from backport changelog check (https://github.com/WordPress/gutenberg/pull/75666)
- theme.json: Enable width support for icon block by default (https://github.com/WordPress/gutenberg/pull/75665)
- Icons: Trim list of public icons further (https://github.com/WordPress/gutenberg/pull/75630)
- Update Navigation block tests to use non-deprecated API (https://github.com/WordPress/gutenberg/pull/75660)
- Update navigation block tests to use gutenberg version of block_core_navigation_block_tree_has_block_type - works on old wp versions (https://github.com/WordPress/gutenberg/pull/75673)
- Update copy (https://github.com/WordPress/gutenberg/pull/75663)
- Commands: Display category labels and enforce category icons (https://github.com/WordPress/gutenberg/pull/75669)
- Heading Block: Fix preview display (https://github.com/WordPress/gutenberg/pull/75675)
- Iframe: memoize src URL globally keyed by resolvedAssets (https://github.com/WordPress/gutenberg/pull/75619)
- ContrastChecker: Fix check for button block colors (https://github.com/WordPress/gutenberg/pull/71959)
- Writing flow: skip non-empty blocks on arrow key nav (https://github.com/WordPress/gutenberg/pull/75141)
- Comments Link: fix transforms textAlign (https://github.com/WordPress/gutenberg/pull/75676)
- Add initialSearchState to avoid console warnings from LinkControl inputValue change (https://github.com/WordPress/gutenberg/pull/75643)
- Migrate `EditorSnackbar` and `EditorNotices` components to the `@wordpress/notices` package (https://github.com/WordPress/gutenberg/pull/74384)
- Add minimum cap check to sync endpoint (https://github.com/WordPress/gutenberg/pull/75681)
- Fix: Hide link controls in sidebar when submenus open on click (https://github.com/WordPress/gutenberg/pull/75637)
- Set snackbar position to center  (https://github.com/WordPress/gutenberg/pull/75294)
- Gallery: Fix PHP warning in random order image reordering (https://github.com/WordPress/gutenberg/pull/75678)
- DateCalendar, DateRangeCalendar: use lighter gray for disabled dates (https://github.com/WordPress/gutenberg/pull/75683)
- Pass unsupported formats directly to the server (https://github.com/WordPress/gutenberg/pull/74910)
- RTC: Compact on request with encodeStateAsUpdate (https://github.com/WordPress/gutenberg/pull/75682)
- Icons: Generate manifest PHP file based on JSON file (https://github.com/WordPress/gutenberg/pull/75684)
- ui/IconButton: make icon always 24px regardless of `size` prop (https://github.com/WordPress/gutenberg/pull/75677)
- Gallery: Skip interactivity directives when no images have lightbox enabled (https://github.com/WordPress/gutenberg/pull/75680)
- DataForm: Fix focus loss and refactor Card layout (https://github.com/WordPress/gutenberg/pull/75689)
- Remove IS_GUTENBERG_PLUGIN checks for collaborative editing (https://github.com/WordPress/gutenberg/pull/75699)

Built from https://develop.svn.wordpress.org/trunk@61680


git-svn-id: http://core.svn.wordpress.org/trunk@60988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-18 20:56:33 +00:00

252 lines
8.9 KiB
PHP

<?php
/**
* Server-side rendering of the `core/gallery` block.
*
* @package WordPress
*/
/**
* Handles backwards compatibility for Gallery Blocks,
* whose images feature a `data-id` attribute.
*
* Now that the Gallery Block contains inner Image Blocks,
* we add a custom `data-id` attribute before rendering the gallery
* so that the Image Block can pick it up in its render_callback.
*
* @since 5.9.0
*
* @param array $parsed_block The block being rendered.
* @return array The migrated block object.
*/
function block_core_gallery_data_id_backcompatibility( $parsed_block ) {
if ( 'core/gallery' === $parsed_block['blockName'] ) {
foreach ( $parsed_block['innerBlocks'] as $key => $inner_block ) {
if ( 'core/image' === $inner_block['blockName'] ) {
if ( ! isset( $parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] ) && isset( $inner_block['attrs']['id'] ) ) {
$parsed_block['innerBlocks'][ $key ]['attrs']['data-id'] = esc_attr( $inner_block['attrs']['id'] );
}
}
}
}
return $parsed_block;
}
add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility' );
/**
* Adds a unique ID to the gallery block context.
*
* @since 7.0.0
*
* @param array $context Default context.
* @param array $parsed_block Block being rendered, filtered by render_block_data.
* @return array Filtered context.
*/
function block_core_gallery_render_context( $context, $parsed_block ) {
if ( 'core/gallery' === $parsed_block['blockName'] ) {
$context['galleryId'] = uniqid();
}
return $context;
}
add_filter( 'render_block_context', 'block_core_gallery_render_context', 10, 2 );
/**
* Renders the `core/gallery` block on the server.
*
* @since 6.0.0
*
* @param array $attributes Attributes of the block being rendered.
* @param string $content Content of the block being rendered.
* @param array $block The block instance being rendered.
* @return string The content of the block being rendered.
*/
function block_core_gallery_render( $attributes, $content, $block ) {
// Adds a style tag for the --wp--style--unstable-gallery-gap var.
// The Gallery block needs to recalculate Image block width based on
// the current gap setting in order to maintain the number of flex columns
// so a css var is added to allow this.
$gap = $attributes['style']['spacing']['blockGap'] ?? null;
// Skip if gap value contains unsupported characters.
// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
// because we only want to match against the value, not the CSS attribute.
if ( is_array( $gap ) ) {
foreach ( $gap as $key => $value ) {
// Make sure $value is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null.
$value = is_string( $value ) ? $value : '';
$value = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value;
// Get spacing CSS variable from preset value if provided.
if ( is_string( $value ) && str_contains( $value, 'var:preset|spacing|' ) ) {
$index_to_splice = strrpos( $value, '|' ) + 1;
$slug = _wp_to_kebab_case( substr( $value, $index_to_splice ) );
$value = "var(--wp--preset--spacing--$slug)";
}
$gap[ $key ] = $value;
}
} else {
// Make sure $gap is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null.
$gap = is_string( $gap ) ? $gap : '';
$gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap;
// Get spacing CSS variable from preset value if provided.
if ( is_string( $gap ) && str_contains( $gap, 'var:preset|spacing|' ) ) {
$index_to_splice = strrpos( $gap, '|' ) + 1;
$slug = _wp_to_kebab_case( substr( $gap, $index_to_splice ) );
$gap = "var(--wp--preset--spacing--$slug)";
}
}
$unique_gallery_classname = wp_unique_id( 'wp-block-gallery-' );
$processed_content = new WP_HTML_Tag_Processor( $content );
$processed_content->next_tag();
$processed_content->add_class( $unique_gallery_classname );
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
// gap on the gallery.
$fallback_gap = 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
$gap_value = $gap ? $gap : $fallback_gap;
$gap_column = $gap_value;
if ( is_array( $gap_value ) ) {
$gap_row = $gap_value['top'] ?? $fallback_gap;
$gap_column = $gap_value['left'] ?? $fallback_gap;
$gap_value = $gap_row === $gap_column ? $gap_row : $gap_row . ' ' . $gap_column;
}
// The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`.
if ( '0' === $gap_column ) {
$gap_column = '0px';
}
// Set the CSS variable to the column value, and the `gap` property to the combined gap value.
$gallery_styles = array(
array(
'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
'declarations' => array(
'--wp--style--unstable-gallery-gap' => $gap_column,
'gap' => $gap_value,
),
),
);
wp_style_engine_get_stylesheet_from_css_rules(
$gallery_styles,
array( 'context' => 'block-supports' )
);
// The WP_HTML_Tag_Processor class calls get_updated_html() internally
// when the instance is treated as a string, but here we explicitly
// convert it to a string.
$updated_content = $processed_content->get_updated_html();
/*
* Randomize the order of image blocks. Ideally we should shuffle
* the `$parsed_block['innerBlocks']` via the `render_block_data` hook.
* However, this hook doesn't apply inner block updates when blocks are
* nested.
* @todo In the future, if this hook supports updating innerBlocks in
* nested blocks, it should be refactored.
*
* @see: https://github.com/WordPress/gutenberg/pull/58733
*/
if ( ! empty( $attributes['randomOrder'] ) ) {
// This pattern matches figure elements with the `wp-block-image`
// class to avoid the gallery's wrapping `figure` element and
// extract images only.
$pattern = '/<figure[^>]*\bwp-block-image\b[^>]*>.*?<\/figure>/s';
preg_match_all( $pattern, $updated_content, $matches );
if ( $matches ) {
$image_blocks = $matches[0];
shuffle( $image_blocks );
$i = 0;
$updated_content = preg_replace_callback(
$pattern,
static function () use ( $image_blocks, &$i ) {
return $image_blocks[ $i++ ];
},
$updated_content
);
}
}
// Gets all image IDs from the state that match this gallery's ID.
$state = wp_interactivity_state( 'core/image' );
$gallery_id = $block->context['galleryId'] ?? null;
$image_ids = array();
// Extracts image IDs from state metadata that match the current gallery ID.
if ( isset( $gallery_id ) && isset( $state['metadata'] ) ) {
foreach ( $state['metadata'] as $image_id => $metadata ) {
if ( isset( $metadata['galleryId'] ) && $metadata['galleryId'] === $gallery_id ) {
$image_ids[] = $image_id;
}
}
}
// If there are image IDs associated with this gallery, set interactivity
// attributes and order metadata for lightbox navigation.
if ( ! empty( $image_ids ) ) {
$total = count( $image_ids );
$lightbox_index = 0;
$processor = new WP_HTML_Tag_Processor( $updated_content );
$processor->next_tag();
$processor->set_attribute( 'data-wp-interactive', 'core/gallery' );
$processor->set_attribute(
'data-wp-context',
wp_json_encode(
array( 'galleryId' => $gallery_id ),
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
)
);
while ( $processor->next_tag( 'figure' ) ) {
$wp_key = $processor->get_attribute( 'data-wp-key' );
if ( $wp_key && isset( $state['metadata'][ $wp_key ] ) ) {
$alt = $state['metadata'][ $wp_key ]['alt'];
wp_interactivity_state(
'core/image',
array(
'metadata' => array(
$wp_key => array(
'customAriaLabel' => empty( $alt )
/* translators: %1$s: current image index, %2$s: total number of images */
? sprintf( __( 'Enlarged image %1$s of %2$s' ), $lightbox_index + 1, $total )
/* translators: %1$s: current image index, %2$s: total number of images, %3$s: Image alt text */
: sprintf( __( 'Enlarged image %1$s of %2$s: %3$s' ), $lightbox_index + 1, $total, $alt ),
/* translators: %1$s: current image index, %2$s: total number of images */
'triggerButtonAriaLabel' => sprintf( __( 'Enlarge %1$s of %2$s' ), $lightbox_index + 1, $total ),
'order' => $lightbox_index,
),
),
)
);
++$lightbox_index;
}
}
return $processor->get_updated_html();
}
return $updated_content;
}
/**
* Registers the `core/gallery` block on server.
*
* @since 5.9.0
*/
function register_block_core_gallery() {
register_block_type_from_metadata(
__DIR__ . '/gallery',
array(
'render_callback' => 'block_core_gallery_render',
)
);
}
add_action( 'init', 'register_block_core_gallery' );