-
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 media upload button to Galleries #2294
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
13b6b35
Add initial abstraction for File Upload
mkaz cb9acac
Use abstracted fileUpload function
mkaz 726fe5c
Remove console debug
mkaz 35f8a61
Add image upload button for gallery
mkaz b075215
Checkpoint: files uploading, but not editable in modal
mkaz 6dbe9d0
Add link and id to img object
mkaz 732c4b7
Add id to gallery image
mkaz cbaa1ef
Switch media modal to use MediaUploadButton on edit
mkaz 7629485
Value for MediaUploadButton needs to be array of ids
mkaz 3ac5392
Fix core gallery test fixtures with simplified data
mkaz 6a600a2
Add core gallery test for columns parameter
mkaz 7b14eca
Lint fix trailing comma
mkaz 0d6a4dc
Can just use parameter, dont need ="true"
mkaz d335497
Rename fileupload.js to mediaupload.js
mkaz d050713
Refactor so image and gallery use same function, clean up variable na…
mkaz 937026d
Remove tracking include, rebase error
mkaz 2d88d13
Add initial test for mediaupload.js
mkaz 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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!-- wp:core/gallery {"images":[{"sizes":{"full":{"url":"https://cldup.com/uuUqE_dXzy.jpg","height":1080,"width":810,"orientation":"portrait"}},"mime":"image/jpeg","type":"image","subtype":"jpeg","id":1,"url":"https://cldup.com/uuUqE_dXzy.jpg","alt":"title"},{"sizes":{"full":{"url":"http://google.com/hi.png","height":1080,"width":1440,"orientation":"landscape"}},"mime":"image/jpeg","type":"image","subtype":"jpeg","id":2,"url":"http://google.com/hi.png","alt":"title"}]} --> | ||
<!-- wp:core/gallery --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome 👍 |
||
<div class="wp-block-gallery"> | ||
<figure class="blocks-gallery-image"> | ||
<img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title" /> | ||
|
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
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 @@ | ||
<!-- wp:core/gallery {"columns":"1"} --> | ||
<div class="wp-block-gallery columns-1 "> | ||
<figure class="blocks-gallery-image"> | ||
<img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title" /> | ||
</figure> | ||
<figure class="blocks-gallery-image"> | ||
<img src="http://google.com/hi.png" alt="title" /> | ||
</figure> | ||
</div> | ||
<!-- /wp:core/gallery --> |
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,24 @@ | ||
[ | ||
{ | ||
"uid": "_uid_0", | ||
"name": "core/gallery", | ||
"isValid": false, | ||
"attributes": { | ||
"align": "none", | ||
"images": [ | ||
{ | ||
"url": "https://cldup.com/uuUqE_dXzy.jpg", | ||
"alt": "title" | ||
}, | ||
{ | ||
"url": "http://google.com/hi.png", | ||
"alt": "title" | ||
} | ||
], | ||
"columns": 1, | ||
"imageCrop": true, | ||
"linkTo": "none" | ||
}, | ||
"originalContent": "<div class=\"wp-block-gallery columns-1 \">\n\t<figure class=\"blocks-gallery-image\">\n\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t</figure>\n\t<figure class=\"blocks-gallery-image\">\n\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t</figure>\n</div>" | ||
} | ||
] |
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,13 @@ | ||
[ | ||
{ | ||
"blockName": "core/gallery", | ||
"attrs": { | ||
"columns": "1" | ||
}, | ||
"rawContent": "\n<div class=\"wp-block-gallery columns-1 \">\n\t<figure class=\"blocks-gallery-image\">\n\t\t<img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"title\" />\n\t</figure>\n\t<figure class=\"blocks-gallery-image\">\n\t\t<img src=\"http://google.com/hi.png\" alt=\"title\" />\n\t</figure>\n</div>\n" | ||
}, | ||
{ | ||
"attrs": {}, | ||
"rawContent": "\n" | ||
} | ||
] |
10 changes: 10 additions & 0 deletions
10
blocks/test/fixtures/core__gallery__columns.serialized.html
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 @@ | ||
<!-- wp:core/gallery {"columns":1} --> | ||
<div class="wp-block-gallery columns-1 "> | ||
<figure class="blocks-gallery-image"> | ||
<img src="https://cldup.com/uuUqE_dXzy.jpg" alt="title" /> | ||
</figure> | ||
<figure class="blocks-gallery-image"> | ||
<img src="http://google.com/hi.png" alt="title" /> | ||
</figure> | ||
</div> | ||
<!-- /wp:core/gallery --> |
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
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.
same here
multiple
should be enoughThere 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.
👍