Repository navigation
Conversation
Add a "Track" control to the playlist track's Settings panel that shows the current audio file name and opens the media library to replace it, mirroring the "Track image" control below it. The control is only rendered for a single selected track, like the toolbar replace control, since swapping the source of every selected track with one file makes no sense. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfLcCffRKsyNqAWV8EYUvU
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. 📦 Bundle sizeSize Change: +6 B (0%) Total Size: 9.05 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|
Replace the hand-built file name and button with the shared `MediaControl` utility that the image, media & text, cover and site logo blocks use in their inspectors, so the track control looks and behaves the same: a replace flow dropdown with Media Library and Upload, plus a drop zone. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QfLcCffRKsyNqAWV8EYUvU
What?
Adds a Track control to the Playlist track block's Settings panel. It shows the current audio file name and opens the same replace flow as the block toolbar (Media Library or Upload, audio only), so the track can be swapped from the sidebar.
Why?
Replacing a track was only possible from the block toolbar. The sidebar already offers a media picker for the track image, so the track itself should be replaceable from the same place.
How?
MediaControlutility frompackages/block-library/src/utils/media-control.jsx, the same control the Image, Media & Text, Cover and Site Logo blocks render in their inspectors. No new component.MediaControlwrapsMediaReplaceFlowwithallowedTypes: [ 'audio' ]and the existingonSelectTrackandonUploadErrorhandlers, so a replacement goes through the same attribute mapping and error handling as the toolbar.isSelected), matching the toolbar replace control: a multi-selection renders the first track's inspector, and replacing the source of every selected track with one file is not meaningful.Testing Instructions
Automated:
Screenshots or screencast
The new control sits at the top of the track's Settings panel, above Title, and matches the Image control of the Image block.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QfLcCffRKsyNqAWV8EYUvU