Media Utils: Add support for passing an onSuccess callback within uploadMedia#70641
Media Utils: Add support for passing an onSuccess callback within uploadMedia#70641yogeshbhutkar wants to merge 1 commit intoWordPress:trunkfrom
onSuccess callback within uploadMedia#70641Conversation
|
I think |
|
^ That is correct. This is something that will be introduced as part of the whole client-side media processing work, which is ongoing. See #61447 |
|
I just wanted to understand if passing |
|
Not at the moment. Like I said, it's still work in progress, so not all of the pieces are currently there. The way it will work is that You can see the intended functionality in https://github.com/swissspidy/media-experiments or #64278 (a bit outdated) |
What?
Closes #70639
This PR introduces support for an
onSuccesscallback in theuploadMediafunction. The callback is intended to execute after the upload process completes successfully and all related promises are resolved, allowing for post-upload handling or additional operations.Why?
onSuccessis already being passed bymediaUpload, which is a wrapper overuploadMedia.Ref.
gutenberg/packages/editor/src/utils/media-upload/index.js
Line 77 in 7a48764
How?
By simply wrapping the upload calls within a
Promise.alland executingonSuccesspost resolution.Testing Instructions
N/A
Testing Instructions for Keyboard
N/A