-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Check required WordPress version to set galleryWithImageBlocks flag #20736
Check required WordPress version to set galleryWithImageBlocks flag #20736
Conversation
WordPress/Classes/Models/BlockEditorSettings+GutenbergEditorSettings.swift
Outdated
Show resolved
Hide resolved
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
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.
Thanks Derek for tackling this PR! 🚀
Results of my testing on a self-hosted site:
5.8 - trunk |
5.9 - trunk |
5.8 - this PR | 5.9 - this PR |
---|---|---|---|
From my understanding of the difference between v1
and v2
Gallery blocks (thanks to this PR), this change appears to pass the tests in this PR. ✅
Comments / observations
- We should add an internal release note
- A
bug
label should be added as well asPosting/Editing
- A milestone should be added
- Consider adding expected output (e.g. what is shown in HTML mode). Readers outside of the Gutenberg world may not easily understand what inner blocks are or other differences between
v1
andv2
(I struggled myself) - The four items in the PR submission checklist should be checked before getting reviews
- Consider a note about what research you did regarding tests (since one isn't added)
Thanks!
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've tested different scenarios and confirmed the change works as expected 🎊 .
- WP 5.8.7 + Gutenberg plugin disabled => Gallery v1 ✅
- WP 5.8.7 + Gutenberg plugin 13.6.0 => Gallery v1 ✅
- WP 5.9 + Gutenberg plugin disabled => Gallery v2 (test case that this PR aims to fix) ✅
- WP 5.9 + Gutenberg plugin 13.6.0 => Gallery v2 ✅
NOTE: The latest version of the Gutenberg plugin that supports WP 5.8 is version 13.6.0 (The minimum supported WP version was set to 5.9 in Gutenberg plugin version 13.7).
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.
LGTM 🎊 ! I re-tested what I did in the last review and confirmed this change works as expected ✅.
However, as I mentioned here, seems we still have an issue when using Gallery v1 and setting a caption that would be great to investigate.
Thanks for reviewing @fluiddot! I've addressed the Caption issue separately here: |
Fixes WordPress/gutenberg#47782:
galleryWithImageBlocks
prop value based on the WordPress version of the site when value is unknown WordPress/gutenberg#47782The
galleryWithImageBlocks
param determines which version of the Gallery block should be used in the editor (v1 or v2). Gallery block v2 is supported in WordPress 5.9+ and should be used for all sites on WordPress 5.9 and above. This fix addresses an edge-case for self-hosted sites on WP 5.9+ that do not have the Gutenberg plugin installed. In this case, Gallery block v1 is the default, but Gallery block v2 should actually be used.This code change checks the WordPress version and sets the param to true for any site using WP 5.9+, and keeps the original logic for sites not using WP 5.9+. Once WordPress 5.9 becomes the minimum supported version, this change can be removed.
An easy way to verify which version of the Gallery block is being used is to switch to HTML mode and check the tags in the markup:
Gallery block v2 syntax (
figure
+image
):Gallery block v1 syntax (
figure
+ul
+li
+image
):To test:
Bonus testing:
Alternatively, when running locally, the value of
galleryWithImageBlocks
can be logged in the editor to verify.Regression Notes
What I did to test those areas of impact (or what existing automated tests I relied on)
Manual testing
What automated tests I added (or what prevented me from doing so)
Determined manual testing and CI checks would provide an adequate amount of testing coverage for this edge case.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist:
N/A