-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block Library: Introduce the 'useUploadMediaFromBlobURL' utility hook #59350
Conversation
Size Change: -6 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If 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. |
|
||
useEffect( () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to move the default downloadButtonText
value handling to a server-side render function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. The Home Link block takes such an approach: #58387
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior remains the same in all blocks and looks like the correct approach to me.
What?
PR introduces the
useUploadMediaFromBlobURL
utility hook, which can be reused across the media blocks.Note
PR doesn't include a change for the Image block; it's more nuanced, and I would like to handle it separately.
Why?
Each block implements the same logic for "upload on mount". Extracting this pattern into a hook should make it more maintainable.
Testing Instructions
Emulate upload failure.
Testing Instructions for Keyboard
Same.