-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Sync packages for WP 6.1 RC 1 (with Fluid Typography) #3437
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -98,7 +98,14 @@ function block_core_navigation_submenu_build_css_font_sizes( $context ) { | |||||
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); | ||||||
} elseif ( $has_custom_font_size ) { | ||||||
// Add the custom font size inline style. | ||||||
$font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] ); | ||||||
$font_sizes['inline_styles'] = sprintf( | ||||||
'font-size: %s;', | ||||||
gutenberg_get_typography_font_size_value( | ||||||
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.
Suggested change
|
||||||
array( | ||||||
'size' => $context['style']['typography']['fontSize'], | ||||||
) | ||||||
) | ||||||
); | ||||||
} | ||||||
|
||||||
return $font_sizes; | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -119,7 +119,14 @@ function block_core_page_list_build_css_font_sizes( $context ) { | |||||
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); | ||||||
} elseif ( $has_custom_font_size ) { | ||||||
// Add the custom font size inline style. | ||||||
$font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] ); | ||||||
$font_sizes['inline_styles'] = sprintf( | ||||||
'font-size: %s;', | ||||||
gutenberg_get_typography_font_size_value( | ||||||
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.
Suggested change
|
||||||
array( | ||||||
'size' => $context['style']['typography']['fontSize'], | ||||||
) | ||||||
) | ||||||
); | ||||||
} | ||||||
|
||||||
return $font_sizes; | ||||||
|
@@ -299,11 +306,6 @@ function render_block_core_page_list( $attributes, $content, $block ) { | |||||
|
||||||
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children ); | ||||||
|
||||||
// Limit the number of items to be visually displayed. | ||||||
if ( ! empty( $attributes['__unstableMaxPages'] ) ) { | ||||||
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] ); | ||||||
} | ||||||
|
||||||
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context ); | ||||||
|
||||||
$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false; | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -381,7 +381,7 @@ function styles_for_block_core_search( $attributes ) { | |||||
} | ||||||
|
||||||
// Get typography styles to be shared across inner elements. | ||||||
$typography_styles = get_typography_styles_for_block_core_search( $attributes ); | ||||||
$typography_styles = esc_attr( get_typography_styles_for_block_core_search( $attributes ) ); | ||||||
if ( ! empty( $typography_styles ) ) { | ||||||
$label_styles [] = $typography_styles; | ||||||
$button_styles[] = $typography_styles; | ||||||
|
@@ -442,31 +442,39 @@ function get_typography_styles_for_block_core_search( $attributes ) { | |||||
|
||||||
// Add typography styles. | ||||||
if ( ! empty( $attributes['style']['typography']['fontSize'] ) ) { | ||||||
$typography_styles[] = sprintf( 'font-size: %s;', esc_attr( $attributes['style']['typography']['fontSize'] ) ); | ||||||
$typography_styles[] = sprintf( | ||||||
'font-size: %s;', | ||||||
gutenberg_get_typography_font_size_value( | ||||||
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.
Suggested change
|
||||||
array( | ||||||
'size' => $attributes['style']['typography']['fontSize'], | ||||||
) | ||||||
) | ||||||
); | ||||||
|
||||||
} | ||||||
|
||||||
if ( ! empty( $attributes['style']['typography']['fontFamily'] ) ) { | ||||||
$typography_styles[] = sprintf( 'font-family: %s;', esc_attr( $attributes['style']['typography']['fontFamily'] ) ); | ||||||
$typography_styles[] = sprintf( 'font-family: %s;', $attributes['style']['typography']['fontFamily'] ); | ||||||
} | ||||||
|
||||||
if ( ! empty( $attributes['style']['typography']['letterSpacing'] ) ) { | ||||||
$typography_styles[] = sprintf( 'letter-spacing: %s;', esc_attr( $attributes['style']['typography']['letterSpacing'] ) ); | ||||||
$typography_styles[] = sprintf( 'letter-spacing: %s;', $attributes['style']['typography']['letterSpacing'] ); | ||||||
} | ||||||
|
||||||
if ( ! empty( $attributes['style']['typography']['fontWeight'] ) ) { | ||||||
$typography_styles[] = sprintf( 'font-weight: %s;', esc_attr( $attributes['style']['typography']['fontWeight'] ) ); | ||||||
$typography_styles[] = sprintf( 'font-weight: %s;', $attributes['style']['typography']['fontWeight'] ); | ||||||
} | ||||||
|
||||||
if ( ! empty( $attributes['style']['typography']['fontStyle'] ) ) { | ||||||
$typography_styles[] = sprintf( 'font-style: %s;', esc_attr( $attributes['style']['typography']['fontStyle'] ) ); | ||||||
$typography_styles[] = sprintf( 'font-style: %s;', $attributes['style']['typography']['fontStyle'] ); | ||||||
} | ||||||
|
||||||
if ( ! empty( $attributes['style']['typography']['lineHeight'] ) ) { | ||||||
$typography_styles[] = sprintf( 'line-height: %s;', esc_attr( $attributes['style']['typography']['lineHeight'] ) ); | ||||||
$typography_styles[] = sprintf( 'line-height: %s;', $attributes['style']['typography']['lineHeight'] ); | ||||||
} | ||||||
|
||||||
if ( ! empty( $attributes['style']['typography']['textTransform'] ) ) { | ||||||
$typography_styles[] = sprintf( 'text-transform: %s;', esc_attr( $attributes['style']['typography']['textTransform'] ) ); | ||||||
$typography_styles[] = sprintf( 'text-transform: %s;', $attributes['style']['typography']['textTransform'] ); | ||||||
Comment on lines
456
to
+477
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. I feel like this code could be simplified to one loop over all elements in Inside the loop, we could abstract out the building of the inline styles to another function. Also, if there are more style props added, this code would only need to be changed if there's some sort of unique transform needed on the value, e.g. Example:
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. Edited to add an allowlist of known keys, to avoid parsing bad ones. |
||||||
} | ||||||
|
||||||
return implode( '', $typography_styles ); | ||||||
|
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.