Conversation
|
@youknowriad - I committed a checkpoint for the upload button abstracted out to confirm it looks ok. I figured in the utils section made the most sense. I'm working on the multiple upload now. |
|
See below. |
21033eb to
4388396
Compare
|
I think I might of solved a couple of issues with this one now, previous open questions are no longer relevant, sorry for the pings. The latest update switches out the edit to use the MediaUploadButton which was updated to support This PR will also close #1986 The test data needs to be updated which is why the build is failing, I'll update that shortly |
youknowriad
left a comment
There was a problem hiding this comment.
Left some notes, but this PR is huge improvement for the gallery block
utils/fileupload.js
Outdated
There was a problem hiding this comment.
Can we add some JSDocs to these two functions?
I wonder if we can test them too, maybe by mocking wp.api.models, I understand it's not straightforward tough
blocks/library/gallery/index.js
Outdated
blocks/library/gallery/index.js
Outdated
There was a problem hiding this comment.
Can't we avoid the ="true" for these two props: multiple and gallery, seems like boolean props to me?
blocks/library/gallery/index.js
Outdated
There was a problem hiding this comment.
same here multiple should be enough
utils/fileupload.js
Outdated
There was a problem hiding this comment.
Could we rename these functions and the inner variables mediaUpload and media instead of fileUpload and img? I'm assuming these are generic functions to upload any media.
There was a problem hiding this comment.
I refactored so image and gallery block use the same function, renamed variables and added some comments so hopefully is a bit cleaner
9c1902a to
0e2c54b
Compare
95daed0 to
2d88d13
Compare
Codecov Report
@@ Coverage Diff @@
## master #2294 +/- ##
==========================================
+ Coverage 25.74% 25.82% +0.08%
==========================================
Files 155 156 +1
Lines 4821 4829 +8
Branches 812 815 +3
==========================================
+ Hits 1241 1247 +6
Misses 3024 3024
- Partials 556 558 +2
Continue to review full report at Codecov.
|
Abstract the media upload button being used for images to utility function and add the same upload button for Gallery block.
Closes #2131