-
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
Add new private upload-media
package
#66290
base: trunk
Are you sure you want to change the base?
Conversation
ad143dc
to
1851a20
Compare
Size Change: +7.52 kB (+0.42%) Total Size: 1.81 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 ...
/** | ||
* Internal dependencies | ||
*/ | ||
import { store as uploadStore } from './store'; |
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.
Hey @swissspidy Didn't we discuss moving the store to the block-editor store instead to avoid the need to create substores? What's the status there?
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.
We discussed that this whole client-side media functionality should be added through the block-editor package, but it makes sense to be in its own package (which will be added as a dependency). At least that's how I understood it.
Are you saying you want the whole functionality merged into to the block-editor package instead? I don't think that's a good idea. It's a lot of code and would just create a maintenance and reusability mess, with zero separation of concerns.
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.
yes, my preference is that it's a sub reducer of the block-editor package as otherwise, we'll have actually more complexity to deal with. For every block editor instance, we'd have to create a block editor store instance and a a media upload store instance. It's doable but for me unnecessary. Reducers can be combined to create separate concerns in general.
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.
In the future I'd want to expand client-side media processing to other areas of WordPress, like the media library, settings pages, or in plugins. If it's just a reducer in the block-editor store then that's not really possible.
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.
Ok, that's a good argument, in that case, I would suggest adding g a MediaUploadProvider
component (similar to BlockEditorProvider
that is responsible for initializing the specific store instance and also have support for useSubRegistry
prop if we want to allow plugins to access this store.
You can see how we do that for the block editor store using this utility (we can just copy it almost) https://github.com/WordPress/gutenberg/blob/0b76a258213bde016726e16949d76fed12c5a34d/packages/block-editor/src/components/provider/with-registry-provider.js
--
Then we'd probably have to render MediaUploadProvider
within BlockEditorProvider
(just like we do BlockEditorProvider
within EditorProvider
now)
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.
OK. I'll try to do that in a separate sub-PR for easier reviewing.
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.
Just opened #66380 for this now so to unblock this PR.
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. |
What?
This is a new package for client-side media processing, see #61447.
This package has been tested extensively as part of https://github.com/swissspidy/media-experiments, but for this PR several features have been removed. They will be reintroduced at a later stage 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
Unit tests should pass.
Testing Instructions for Keyboard
N/A
Screenshots or screencast
N/A