Update @wordpress packages
Update packages to include these bug fixes from Gutenberg: - Site Logo: Add option to set site icon from Site Logo block - Navigation: Enable even more compact setup state. - Remove template parts from post content inserter an __unstable filter - Template Editor Mode: Hide editor mode switcher - Avoid using CSS variables for block gap styles - Try to fix auto resizing in template part focus mode - Lower the specificity of font size CSS Custom Properties in the editor - Site icon: Fix site icon styling to display non-square site icons within a square button - [Site Editor]: Register block editor shortcuts - Update regex to handle 404 template slug - Site Editor: Remove dead code - [Block Editor]: Restrict delete multi selected blocks shortcut - Fix: Gradients are not being applied by class - Update: Make the global styles subtitles font smaller - Post Content/Title: Reflect changes when previewing post - ServerSideRender: Fix loading state - [Block Library]: Fix editable post blocks in Query Loop with zero queryId - Post Excerpt: Fix previews - WP59: Contextualize "Export" string to differentiate it from other occurrences in WP Core - Tools Panel: Fix race conditions caused by conditionally displayed ToolsPanelItems - ToolsPanel: Allow items to register when panelId is null - Font Size Picker: Allow non-integers as simple CSS values and in hints - [Components - FontSizePicker]: Use incremental sequence of numbers as labels for the available font-sizes at the segmented control (conditionally) See #54487. Built from https://develop.svn.wordpress.org/trunk@52434 git-svn-id: http://core.svn.wordpress.org/trunk@52026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -39,9 +39,10 @@ function wp_register_layout_support( $block_type ) {
|
||||
* @param array $layout Layout object. The one that is passed has already checked
|
||||
* the existence of default block layout.
|
||||
* @param bool $has_block_gap_support Whether the theme has support for the block gap.
|
||||
* @param string $gap_value The block gap value to apply.
|
||||
* @return string CSS style.
|
||||
*/
|
||||
function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false ) {
|
||||
function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false, $gap_value = null ) {
|
||||
$layout_type = isset( $layout['type'] ) ? $layout['type'] : 'default';
|
||||
|
||||
$style = '';
|
||||
@@ -72,8 +73,9 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
$style .= "$selector .alignleft { float: left; margin-right: 2em; }";
|
||||
$style .= "$selector .alignright { float: right; margin-left: 2em; }";
|
||||
if ( $has_block_gap_support ) {
|
||||
$style .= "$selector > * { margin-top: 0; margin-bottom: 0; }";
|
||||
$style .= "$selector > * + * { margin-top: var( --wp--style--block-gap ); margin-bottom: 0; }";
|
||||
$gap_style = $gap_value ? $gap_value : 'var( --wp--style--block-gap )';
|
||||
$style .= "$selector > * { margin-top: 0; margin-bottom: 0; }";
|
||||
$style .= "$selector > * + * { margin-top: $gap_style; margin-bottom: 0; }";
|
||||
}
|
||||
} elseif ( 'flex' === $layout_type ) {
|
||||
$layout_orientation = isset( $layout['orientation'] ) ? $layout['orientation'] : 'horizontal';
|
||||
@@ -96,7 +98,8 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
|
||||
$style = "$selector {";
|
||||
$style .= 'display: flex;';
|
||||
if ( $has_block_gap_support ) {
|
||||
$style .= 'gap: var( --wp--style--block-gap, 0.5em );';
|
||||
$gap_style = $gap_value ? $gap_value : 'var( --wp--style--block-gap, 0.5em )';
|
||||
$style .= "gap: $gap_style;";
|
||||
} else {
|
||||
$style .= 'gap: 0.5em;';
|
||||
}
|
||||
@@ -156,8 +159,13 @@ function wp_render_layout_support_flag( $block_content, $block ) {
|
||||
$used_layout = $default_layout;
|
||||
}
|
||||
|
||||
$id = uniqid();
|
||||
$style = wp_get_layout_style( ".wp-container-$id", $used_layout, $has_block_gap_support );
|
||||
$id = uniqid();
|
||||
$gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) );
|
||||
// Skip if gap value contains unsupported characters.
|
||||
// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
|
||||
// because we only want to match against the value, not the CSS attribute.
|
||||
$gap_value = preg_match( '%[\\\(&=}]|/\*%', $gap_value ) ? null : $gap_value;
|
||||
$style = wp_get_layout_style( ".wp-container-$id", $used_layout, $has_block_gap_support, $gap_value );
|
||||
// This assumes the hook only applies to blocks with a single wrapper.
|
||||
// I think this is a reasonable limitation for that particular hook.
|
||||
$content = preg_replace(
|
||||
|
||||
Reference in New Issue
Block a user