-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add new private upload-media
package
#66290
Conversation
ad143dc
to
1851a20
Compare
Size Change: +4.19 kB (+0.23%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
1851a20
to
b99c449
Compare
b99c449
to
8a57140
Compare
package.json
Outdated
@@ -310,7 +311,7 @@ | |||
"lint:pkg-json": "wp-scripts lint-pkg-json . 'packages/*/package.json'", | |||
"native": "npm run --prefix packages/react-native-editor", | |||
"other:changelog": "node ./bin/plugin/cli.js changelog", | |||
"other:check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2 --ignore=@react-native-community/cli,@react-native-community/cli-platform-ios,@ampproject/remapping,human-signals,fb-watchman,walker,chrome-launcher,lighthouse-logger,chromium-edge-launcher\" \"wp-scripts check-licenses --dev\"", | |||
"other:check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2 --ignore=@react-native-community/cli,@react-native-community/cli-platform-ios,@ampproject/remapping,human-signals,fb-watchman,walker,chrome-launcher,lighthouse-logger,chromium-edge-launcher,webpack\" \"wp-scripts check-licenses --dev\"", |
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.
For some reason the Apache-licensed @webassemblyjs/leb128
and @xtuc/long
packages, which are dependencies of webpack
, were being flagged. No idea why this happened only when working on this PR.
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. |
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.
Is it possible to add a README to this package, to clarify how it can be used ...
An oversight. Added now. FWIW this is all coming from https://github.com/swissspidy/media-experiments if anyone wants to see the full context of how everything works together. |
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.
Great progress here. I think we're not very far for me personally at least.
settings = useMemo( | ||
() => ( { | ||
..._settings, | ||
mediaUpload: mediaUpload.bind( null, registry ), |
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.
What's a bit confusing for me here, is that if you use the selector to retrieve the settings, you'll get a different "mediaUpload" than the one you passed as a setting.
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.
Right, but it's the only way to ensure backward compatibility.
You pass mediaUpload
to block-editor
settings as the function to upload media to a server.
Other users of block-editor
(such as block-library
) also use this function to upload media.
The (worse) alternative would be to tell everyone to use addItems()
action instead and stop using getSettings().mediaUpload
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.
I didn't check the code of the package itself fully. But I think in terms of architecture, this is the right way forward.
I don't have a strong opinion on whether this should be an experiment or not.
Co-authored-by: ndiego <[email protected]> Co-authored-by: fabiankaegy <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: Jon Surrell <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: sirreal <[email protected]> Co-authored-by: Andrew Serong <[email protected]> Co-authored-by: stokesman <[email protected]> Co-authored-by: andrewserong <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: ntsekouras <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: Nick Diego <[email protected]> Co-authored-by: Ella <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: Mitchell Austin <[email protected]> Co-authored-by: Nik Tsekouras <[email protected]> Co-authored-by: George Mamadashvili <[email protected]>
Co-authored-by: ndiego <[email protected]> Co-authored-by: fabiankaegy <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: Jon Surrell <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: sirreal <[email protected]> Co-authored-by: Andrew Serong <[email protected]> Co-authored-by: stokesman <[email protected]> Co-authored-by: andrewserong <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: ntsekouras <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: Nick Diego <[email protected]> Co-authored-by: Ella <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: Mitchell Austin <[email protected]> Co-authored-by: Nik Tsekouras <[email protected]> Co-authored-by: George Mamadashvili <[email protected]>
{ "path": "../element" }, | ||
{ "path": "../i18n" }, | ||
{ "path": "../private-apis" }, | ||
{ "path": "../url" } |
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.
Looks like the indentation with spaces on these lines (they should use tabs) is causing problems for other PRs because the pre-commit hook auto-fixes them so that it results in an unrelated changed file in other PRs. See for example #67433 (comment)
I'll try a quick PR if @swissspidy doesn't beat me to it.
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.
Good catch. Feel free to.
I think this PR seems to cause a critical error when using In fact, errors are occurring in Storybook when using the
Perhaps undefined checks are needed here? |
Thanks for pointing that out, looks like a simple fix. I'll make a PR. |
What?
This is a new package for client-side media processing, see #61447 for full context.
It implements a queue-like system for processing media items prior to uploading them to the server. This will be used for things like resizing, cropping, compressing, thumbnail generation, poster generation, subtitle generation, etc.
See also https://github.com/swissspidy/media-experiments/blob/7b91599369f1d3ae412e3e18a4afe2f62257b4dc/docs/technical-overview.md.
This logic has been tested extensively as part of https://github.com/swissspidy/media-experiments, but for this initial PR several features have been removed. They will be reintroduced later in separate PRs to make reviews easier.
The package is private and shall not be published until later on when all of the subsequent PRs are merged.
Why?
Required for a new era of upload handling in Gutenberg
How?
Adds a new package to facilitate integration in the block-editor package
Testing Instructions
CI should be green.
Enable the client-side media processing experiment and upload media to the editor. Everything should still work as usual.
Testing Instructions for Keyboard
N/A
Screenshots or screencast
N/A