Repository navigation
Support pasted files in CloudUploader - #211
Draft
brandonkelly wants to merge 1 commit into
Draft
brandonkelly wants to merge 1 commit into
brandonkelly wants to merge 1 commit into
Conversation
Implement Craft.BaseUploader::addFiles(), which Craft 5.12 calls with files pasted into an Assets field, and call the base destroy() so its paste listener gets removed. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-337a4ca6-6db4-4b70-9d96-a975fa2a035b
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the clipboard-file support change.
No open issues 🎉
What changed in this PR
Adds clipboard-file support to Craft.CloudUploader, integrating with the BaseUploader paste handling introduced in craftcms/cms#20212.
Changes:
- Adds
addFiles()to route pasted files through the existing upload pipeline. - Calls the base
destroy()method to remove its paste listener. - Updates the compiled uploader and source map.
| File | Description |
|---|---|
src/web/assets/uploader/src/Uploader.js |
Adds pasted-file handling and base cleanup. |
src/web/assets/uploader/dist/Uploader.js.map |
Updates source mappings for the uploader changes. |
src/web/assets/uploader/dist/Uploader.js |
Includes the changes in the compiled browser asset. |
Review effort: Balanced
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.
Summary
craftcms/cms#20212 lets people paste files into Assets fields.
Craft.BaseUploaderhandles the paste and passes the files to a newaddFiles()method, which each uploader class implements. This adds it toCloudUploader:On Craft versions before 5.12,
addFiles()is never called and the basedestroy()is a no-op, so the change is safe there too.Evidence
Tested in Chromium on a Craft install running craftcms/cms#20212.
CloudUploaderwas created with apasteZone,uploadFile()was stubbed to record what it received, and a real PNG was pasted with Ctrl+V:Draft until craftcms/cms#20212 is merged.
Related issues