Feature/client side media testing new#75224
Draft
adamsilverstein wants to merge 334 commits intotrunkfrom
Draft
Conversation
This addresses PR feedback by relocating the upload save lock logic to maintain proper architectural dependency direction (editor imports from block-editor, not vice versa). The hook now lives in the editor package where it can directly use the editorStore without dynamic store detection workarounds. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…upload media types
…n, transparency check and resizing
Pass the big image size threshold (default 2560) from the REST API through the settings chain to the upload-media store. This enables client-side scaling of large images before upload, matching WordPress core's behavior. Co-Authored-By: Claude Opus 4.5 <[email protected]>
When an image exceeds the big image size threshold (default 2560px), scale it down before upload with a '-scaled' suffix. This matches WordPress core's behavior in wp_create_image_subsizes(). - Add isThresholdResize flag to ResizeCrop operation args - Update vipsResizeImage to support '-scaled' suffix - Update resizeCropItem to pass through threshold flag - prepareItem now adds ResizeCrop operation for threshold scaling Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add tests to verify that: - Images larger than the threshold (default 2560) are scaled down - The -scaled suffix is added to scaled images - Images smaller than the threshold are not modified Tests skip when cross-origin isolation is not enabled, as the vips library requires SharedArrayBuffer. Co-Authored-By: Claude Opus 4.5 <[email protected]>
This logging was added for debugging but is not needed in the final implementation. The debug-logger already has DEBUG_ENABLED set to false, but removing the call keeps the diff cleaner.
Add tab character at beginning of comment line to fix prettier/prettier lint error. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Wrap vips operations in try/finally blocks to guarantee inProgressOperations.delete(id) is always called, even when errors occur during image processing.
The selector checks for existence of items in the queue, not their upload status. The new name better reflects its purpose.
Properly restore the original fetch function in afterEach to prevent test pollution.
Remove unused $mime_type variable in REST attachments controller, clarify comments in types, and use local file reference for the @wordpress/vips package during development.
FileList objects from input elements are not true arrays. Using Array.from() ensures compatibility with store actions that expect array methods to be available.
The upload-media package is bundled into multiple packages (block-editor, editor). This prevents errors when both bundles are loaded on the same page by checking if the store is already registered before calling register().
|
Size Change: +12.3 kB (+0.41%) Total Size: 3 MB
ℹ️ View Unchanged
|
The worker-code.ts file is auto-generated during full builds and is gitignored. Since unit tests don't run a full build, provide a stub with mock implementations to prevent test failures. Co-Authored-By: Claude Opus 4.5 <[email protected]>
The test was mocking @wordpress/vips but the actual code imports from @wordpress/vips/worker, causing mock functions to not be used. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…media-testing-new
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
Closes
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast