Skip to content

Commit

Permalink
Merge branch 'trunk' into focalpointpicker-align-items
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Dec 20, 2022
2 parents 87accf9 + b1234a7 commit 11a6814
Show file tree
Hide file tree
Showing 76 changed files with 6,870 additions and 1,274 deletions.
5 changes: 2 additions & 3 deletions docs/reference-guides/filters/block-filters.md
Expand Up @@ -179,19 +179,18 @@ _Example:_

```js
const { createHigherOrderComponent } = wp.compose;
const { Fragment } = wp.element;
const { InspectorControls } = wp.blockEditor;
const { PanelBody } = wp.components;

const withInspectorControls = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
return (
<Fragment>
<>
<BlockEdit { ...props } />
<InspectorControls>
<PanelBody>My custom control</PanelBody>
</InspectorControls>
</Fragment>
</>
);
};
}, 'withInspectorControl' );
Expand Down
4 changes: 2 additions & 2 deletions docs/reference-guides/slotfills/README.md
Expand Up @@ -75,7 +75,7 @@ const PostStatus = ( { isOpened, onTogglePanel } ) => (
>
<PluginPostStatusInfo.Slot>
{ ( fills ) => (
<Fragment>
<>
<PostVisibility />
<PostSchedule />
<PostFormat />
Expand All @@ -84,7 +84,7 @@ const PostStatus = ( { isOpened, onTogglePanel } ) => (
<PostAuthor />
{ fills }
<PostTrash />
</Fragment>
</>
) }
</PluginPostStatusInfo.Slot>
</PanelBody>
Expand Down
Expand Up @@ -9,17 +9,16 @@ This is done by setting the `target` on `<PluginSidebarMoreMenuItem>` to match t
import { registerPlugin } from '@wordpress/plugins';
import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
import { image } from '@wordpress/icons';
import { Fragment } from '@wordpress/element';

const PluginSidebarMoreMenuItemTest = () => (
<Fragment>
<>
<PluginSidebarMoreMenuItem target="sidebar-name" icon={ image }>
Expanded Sidebar - More item
</PluginSidebarMoreMenuItem>
<PluginSidebar name="sidebar-name" icon={ image } title="My Sidebar">
Content of the sidebar
</PluginSidebar>
</Fragment>
</>
);

registerPlugin( 'plugin-sidebar-expanded-test', {
Expand Down
35 changes: 22 additions & 13 deletions lib/block-supports/typography.php
Expand Up @@ -168,27 +168,34 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) {
}

/**
* Note: this method is for backwards compatibility.
* It mostly replaces `gutenberg_typography_get_css_variable_inline_style()`.
*
* Generates an inline style value for a typography feature e.g. text decoration,
* text transform, and font style.
*
* @param string $style_value A raw style value for a single typography feature from a block's style attribute.
* @param string $css_property Slug for the CSS property the inline style sets.
* Note: This function is for backwards compatibility.
* * It is necessary to parse older blocks whose typography styles contain presets.
* * It mostly replaces the deprecated `wp_typography_get_css_variable_inline_style()`,
* but skips compiling a CSS declaration as the style engine takes over this role.
*
* @link https://github.com/wordpress/gutenberg/pull/27555
*
* @since 6.1.0
*
* @return string? A CSS inline style value.
* @param string $style_value A raw style value for a single typography feature from a block's style attribute.
* @param string $css_property Slug for the CSS property the inline style sets.
* @return string A CSS inline style value.
*/
function gutenberg_typography_get_preset_inline_style_value( $style_value, $css_property ) {
// If the style value is not a preset CSS variable go no further.
if ( empty( $style_value ) || ! str_contains( $style_value, "var:preset|{$css_property}|" ) ) {
return $style_value;
}

// For backwards compatibility.
// Presets were removed in https://github.com/WordPress/gutenberg/pull/27555.
// We have a preset CSS variable as the style.
// Get the style value from the string and return CSS style.
/*
* For backwards compatibility.
* Presets were removed in WordPress/gutenberg#27555.
* We have a preset CSS variable as the style.
* Get the style value from the string and return CSS style.
*/
$index_to_splice = strrpos( $style_value, '|' ) + 1;
$slug = _wp_to_kebab_case( substr( $style_value, $index_to_splice ) );

Expand All @@ -197,14 +204,16 @@ function gutenberg_typography_get_preset_inline_style_value( $style_value, $css_
}

/**
* Deprecated.
* This method is no longer used and will have to be deprecated in Core.
* This method is no longer used and has been deprecated in Core since 6.1.0.
*
* It can be deleted once migrated to the next WordPress version.
* It can be deleted once Gutenberg's minimum supported WordPress version is >= 6.1
*
* Generates an inline style for a typography feature e.g. text decoration,
* text transform, and font style.
*
* @since 5.8.0
* @deprecated 6.1.0
*
* @param array $attributes Block's attributes.
* @param string $feature Key for the feature within the typography styles.
* @param string $css_property Slug for the CSS property the inline style sets.
Expand Down
27 changes: 26 additions & 1 deletion lib/compat/wordpress-6.2/script-loader.php
Expand Up @@ -127,6 +127,30 @@ function gutenberg_resolve_assets_override() {

$scripts = ob_get_clean();

/*
* Generate web font @font-face styles for the site editor iframe.
* Use the registered font families for printing.
*/
if ( class_exists( 'WP_Web_Fonts' ) ) {
$wp_webfonts = wp_webfonts();
$registered = $wp_webfonts->get_registered_font_families();
if ( ! empty( $registered ) ) {
$queue = $wp_webfonts->queue;
$done = $wp_webfonts->done;

$wp_webfonts->done = array();
$wp_webfonts->queue = $registered;

ob_start();
$wp_webfonts->do_items();
$styles .= ob_get_clean();

// Reset the Web Fonts API.
$wp_webfonts->done = $done;
$wp_webfonts->queue = $queue;
}
}

return array(
'styles' => $styles,
'scripts' => $scripts,
Expand All @@ -137,7 +161,8 @@ function gutenberg_resolve_assets_override() {
'block_editor_settings_all',
function( $settings ) {
// We must override what core is passing now.
$settings['__unstableResolvedAssets'] = gutenberg_resolve_assets_override();
$settings['__unstableResolvedAssets'] = gutenberg_resolve_assets_override();
$settings['__unstableIsBlockBasedTheme'] = wp_is_block_theme();
return $settings;
},
100
Expand Down

1 comment on commit 11a6814

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3737309257
📝 Reported issues:

Please sign in to comment.