-
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
Open
swissspidy
wants to merge
46
commits into
trunk
Choose a base branch
from
add/61447-upload-media-pkg
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
8a57140
Add new private `upload-media` package
swissspidy 808700e
Add missing readme
swissspidy 7a9a762
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 6022cf0
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 3f30935
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 91f7687
Make `updateSettings` private
swissspidy b1b0cb5
Remove empty line
swissspidy 5d00adb
Add back some of the missing utils
swissspidy 72d474f
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 07680ca
Update docs now
swissspidy 38c3df6
Remove meetings (#66421)
ndiego 06e345e
Site editor: remove "default" admin CSS (#66431)
ellatrix 8f99999
Fix: JSON Schema Docgen doesn't work on Windows OS (#66414)
t-hamano a198bd2
Revise zoom layout shift fix (#66390)
stokesman 4d4142c
Zoom out: Add keyboard shortcut in editor (#66400)
ntsekouras 7f2549c
Compose: Fix React Complier error for 'useCopyToClipboard' (#66444)
Mamaduka f0b988c
Style Book: Fix React Compiler error (#66445)
Mamaduka 0b066a9
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 3cfa25a
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy a1f044f
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 57135d8
Add `ts-ignore`
swissspidy a76fcc7
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 5b3c022
Block editor: Add `MediaUploadProvider` (#66380)
swissspidy 1dc086d
Change order in `package.json`
swissspidy 845cf78
Rip out most code
swissspidy 8cd6177
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy a1f0282
A bunch of fixes
swissspidy bae3e67
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 93e9ec9
Fixes
swissspidy 6176a66
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 17dc47e
Move to folder for RN compat
swissspidy 8b6f249
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 4f5a0d0
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy c772bd5
Remove default value
swissspidy addc7ff
Pass to `privateSettings` instead
swissspidy d2e8255
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy d423b45
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy d3ec207
Move validation to block-editor/upload-media
swissspidy 9e73bd5
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy ad01ff2
Use non-empty files in test
swissspidy e498986
fix api reference
swissspidy b77e527
Update readme a little bit
swissspidy 00f7466
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy 4c1c576
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy ba97bbf
Undo change to privateSettings
swissspidy e8b3755
Merge branch 'trunk' into add/61447-upload-media-pkg
swissspidy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
|
||
## Unreleased | ||
|
||
Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "@wordpress/upload-media", | ||
"version": "1.0.0-prerelease", | ||
"private": true, | ||
"description": "Core media upload logic.", | ||
"author": "The WordPress Contributors", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"media" | ||
], | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/packages/upload-media/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WordPress/gutenberg.git", | ||
"directory": "packages/upload-media" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/gutenberg/issues" | ||
}, | ||
"engines": { | ||
"node": ">=18.12.0", | ||
"npm": ">=8.19.2" | ||
}, | ||
"main": "build/index.js", | ||
"module": "build-module/index.js", | ||
"types": "build-types", | ||
"dependencies": { | ||
"@shopify/web-worker": "^6.4.0", | ||
"@wordpress/api-fetch": "file:../api-fetch", | ||
"@wordpress/blob": "file:../blob", | ||
"@wordpress/data": "file:../data", | ||
"@wordpress/i18n": "file:../i18n", | ||
"@wordpress/preferences": "file:../preferences", | ||
"@wordpress/private-apis": "file:../private-apis", | ||
"@wordpress/url": "file:../url", | ||
"@wordpress/vips": "file:../vips", | ||
"uuid": "^9.0.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const PREFERENCES_NAME = 'core/media'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* ImageFile class. | ||
* | ||
* Small wrapper around the `File` class to hold | ||
* information about current dimensions and original | ||
* dimensions, in case the image was resized. | ||
*/ | ||
export class ImageFile extends File { | ||
swissspidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
width = 0; | ||
height = 0; | ||
originalWidth? = 0; | ||
originalHeight? = 0; | ||
|
||
get wasResized() { | ||
return ( | ||
( this.originalWidth || 0 ) > this.width || | ||
( this.originalHeight || 0 ) > this.height | ||
); | ||
} | ||
|
||
constructor( | ||
file: File, | ||
width: number, | ||
height: number, | ||
originalWidth?: number, | ||
originalHeight?: number | ||
) { | ||
super( [ file ], file.name, { | ||
type: file.type, | ||
lastModified: file.lastModified, | ||
} ); | ||
|
||
this.width = width; | ||
this.height = height; | ||
this.originalWidth = originalWidth; | ||
this.originalHeight = originalHeight; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { store as uploadStore } from './store'; | ||
swissspidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export { uploadStore as store }; | ||
|
||
export { UploadError } from './upload-error'; | ||
|
||
export type { | ||
ImageFormat, | ||
ImageSizeCrop, | ||
ThumbnailGeneration, | ||
VideoFormat, | ||
AudioFormat, | ||
} from './store/types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; | ||
|
||
export const { lock, unlock } = | ||
__dangerousOptInToUnstableAPIsOnlyForCoreModules( | ||
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', | ||
'@wordpress/upload-media' | ||
); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ofwebpack
, were being flagged. No idea why this happened only when working on this PR.