-
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
File block: Do not persist blob urls and fix undo #63282
Conversation
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. |
Size Change: +57 B (0%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
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.
Nice. How many of these are there? 😅
} ); | ||
setTemporaryURL(); |
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 wonder if it might make sense to have a helper util for this
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 think there's a lot of duplication between how these media blocks are setup, a lot could be share but there are also some things that are to explain: some use "url" others "href" and others "src" for the uploaded files
This is the last one :) |
The Cover and Media & Text block might need an audit as well. I've not worked on these blocks in a while, but anything using |
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Related #39223
Similar to #63076 and #63238
What?
In #63076, we introduced the concept of local attributes to allow setting attributes that won't be persisted. It's useful during file uploads for instance where we want immediate user feedback but without impacting the saved post.
In the previous PR, we implemented it for image, audio and video blocks and this PR does the same for the file block. This PR also fixes an undo bug in the file block.
Testing Instructions
1- Throttle your network speed (that way uploading file will take a long time)
2- Drag and drop a pdf file into the post editor.
3- Save the post immediately.
4- Open the post in a new tab and notice that the inserted file block is actually empty.
5- Go back to the old tab, and wait until the upload completes.
6- Notice that the file block has been updated properly with the right URL.
You can also try undoing uploads and it should results in empty file blocks.