Skip to content
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

Gutenberg - Fix Gallery block uploads when the editor is closed #15457

Merged
merged 4 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [*] For DotCom and Jetpack sites, you can now subscribe to comments by tapping the "Follow conversation" button in the Comments view. [#15424]
* [**] Reader: Added 'P2s' stream. [#15442]
* [*] Add a new P2 default site icon to replace the generic default site icon. [#15430]
* [*] Block Editor: Fix Gallery block uploads when the editor is closed. [#15457]

16.3
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ class GutenbergGalleryUploadProcessor: Processor {
updatedBlock += jsonString
}
updatedBlock += " -->"
if let linkTo = block.attributes[GalleryBlockKeys.linkTo] as? String {
if linkTo == "media" {
if let linkTo = block.attributes[GalleryBlockKeys.linkTo] as? String, linkTo != "none" {
if linkTo == "file" {
self.linkToURL = self.remoteURLString
} else if linkTo == "attachment" {
} else if linkTo == "post" {
self.linkToURL = self.mediaLink
}
updatedBlock += self.linkPostMediaUploadProcessor.process(block.content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class GutenbergGalleryUploadProcessorTests: XCTestCase {

let idVariations = [
"""
<!-- wp:gallery {"ids":[-708,-415,-701],"columns":3,"linkTo":"media"} -->
<!-- wp:gallery {"ids":[-708,-415,-701],"columns":3,"linkTo":"file"} -->
""",
"""
<!-- wp:gallery {"ids":["-708","-415","-701"],"columns":3,"linkTo":"media"} -->
<!-- wp:gallery {"ids":["-708","-415","-701"],"columns":3,"linkTo":"file"} -->
""",
"""
<!-- wp:gallery {"ids":[-708,-415,"-701"],"columns":3,"linkTo":"media"} -->
<!-- wp:gallery {"ids":[-708,-415,"-701"],"columns":3,"linkTo":"file"} -->
""",
]

Expand Down Expand Up @@ -55,7 +55,7 @@ class GutenbergGalleryUploadProcessorTests: XCTestCase {
"""

let postResultContent = """
<!-- wp:gallery {"columns":3,"ids":[708,415,701],"linkTo":"media"} -->
<!-- wp:gallery {"columns":3,"ids":[708,415,701],"linkTo":"file"} -->
<figure class="wp-block-gallery columns-3 is-cropped">
<ul class="blocks-gallery-grid">
<li class="blocks-gallery-item">
Expand Down