Repository navigation
Allow setting viewport tablet and mobile values in theme.json #79104
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
2913b8c
Allow setting viewport tablet and mobile values in theme.json
tellthemachines 1f20bca
restrict allowed units
tellthemachines f9f7e29
adjust device preview to use theme.json viewports where available
tellthemachines 9eec829
Accept and process em/rem values for block preview
tellthemachines b027cc5
remove old constant and rename new one
tellthemachines aa3290e
remove order check
tellthemachines 40895ab
dedupe sanitization
tellthemachines 9e30e7e
allow $responsive_media_queries to be null
tellthemachines 8cb7b52
use get_responsive_media_queries instead of get_viewport_breakpoints
tellthemachines 50d9cf6
fix grid visualiser visibility with custom breakpoints
tellthemachines 46cd3ed
fix conflict resolution booboo
tellthemachines 02fdda7
ensure device preview works with custom breakpoints
tellthemachines bd9abee
Process invalid or absent viewport values consistently.
tellthemachines c5b589c
document em and rem to px conversion
tellthemachines 30eb14d
clarify invalid breakpoint handling
tellthemachines 51aaa2b
change function name
tellthemachines 532a447
rearrange sanitization logic
tellthemachines 8a7abd2
dedupe value check
tellthemachines 483ceb5
add docs to theme json functions
tellthemachines 23143ef
add some more tests
tellthemachines 82515c7
remove test file deleted on trunk
tellthemachines face46c
update viewport_settings type
tellthemachines b664302
simplify sanitization and docs update
tellthemachines b31e166
don't export const
tellthemachines 72cbf48
make viewport APIs private
tellthemachines f2dc7f2
avoid unnecessary rerenders in states hook
tellthemachines 5571cc7
remove effect
tellthemachines 1d1abef
simplify type
tellthemachines 334f202
remove dead schema
tellthemachines b782190
add missing path
tellthemachines c5aa21c
add changelog
tellthemachines 5c6a864
ensure single tablet value is exposed as tablet in the UI
tellthemachines 75c7407
fix spacinggg
tellthemachines 1f5523c
add private api changelog
tellthemachines 8953b73
add pr link
tellthemachines f07ced1
update docs with tablet behaviour
tellthemachines 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 hidden or 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,3 @@ | ||
| https://github.com/WordPress/wordpress-develop/pull/12395 | ||
|
|
||
| * https://github.com/WordPress/gutenberg/pull/79104 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -513,12 +513,14 @@ function gutenberg_render_block_states_support( $block_content, $block ) { | |
| return $block_content; | ||
| } | ||
|
|
||
| $supported_pseudo_states = WP_Theme_JSON_Gutenberg::VALID_BLOCK_PSEUDO_SELECTORS[ $block_name ] ?? array(); | ||
| $style = gutenberg_resolve_style_state_aliases( | ||
| $supported_pseudo_states = WP_Theme_JSON_Gutenberg::VALID_BLOCK_PSEUDO_SELECTORS[ $block_name ] ?? array(); | ||
| $style = gutenberg_resolve_style_state_aliases( | ||
| $block['attrs']['style'] ?? array(), | ||
| $block_name | ||
| ); | ||
| $css_rules = array(); | ||
| $css_rules = array(); | ||
|
Contributor
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. How I hate this Ok, "hide whitespace" now active for the rest of the review. |
||
| $viewport_settings = gutenberg_get_global_settings( array( 'viewport' ) ); | ||
| $responsive_media_queries = WP_Theme_JSON_Gutenberg::get_viewport_media_queries( $viewport_settings ); | ||
|
|
||
| foreach ( $supported_pseudo_states as $pseudo_state ) { | ||
| if ( empty( $style[ $pseudo_state ] ) || ! is_array( $style[ $pseudo_state ] ) ) { | ||
|
|
@@ -534,7 +536,7 @@ function gutenberg_render_block_states_support( $block_content, $block ) { | |
| ); | ||
| } | ||
|
|
||
| foreach ( WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS as $breakpoint => $media_query ) { | ||
| foreach ( $responsive_media_queries as $breakpoint => $media_query ) { | ||
| if ( empty( $style[ $breakpoint ] ) || ! is_array( $style[ $breakpoint ] ) ) { | ||
| continue; | ||
| } | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.