diff --git a/changelog.txt b/changelog.txt
index cc3c407c76d77..bd7375a67e9d8 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,23 @@
== Changelog ==
+= 17.0.1 =
+
+## Changelog
+
+### Bug Fixes
+
+- Fix a fatal error in `WP_Fonts_Resolver::get_settings()`. ([55981](https://github.com/WordPress/gutenberg/pull/55981))
+
+## Contributors
+
+@anton-vlasenko
+
+
+= 16.9.1 =
+
+Fixes a PHP fatal error in `WP_Fonts_Resolver::get_settings()`: https://github.com/WordPress/gutenberg/pull/55981
+
+
= 17.0.0 =
diff --git a/lib/experimental/fonts-api/class-wp-fonts-resolver.php b/lib/experimental/fonts-api/class-wp-fonts-resolver.php
index 144f7b30acc15..f2299c7c36831 100644
--- a/lib/experimental/fonts-api/class-wp-fonts-resolver.php
+++ b/lib/experimental/fonts-api/class-wp-fonts-resolver.php
@@ -200,12 +200,22 @@ private static function get_settings() {
if ( $set_theme_structure ) {
$set_theme_structure = false;
$settings = static::set_tyopgraphy_settings_array_structure( $settings );
+
+ // Initialize the font families from settings if set and is an array, otherwise default to an empty array.
+ if ( ! isset( $settings['typography']['fontFamilies']['theme'] ) || ! is_array( $settings['typography']['fontFamilies']['theme'] ) ) {
+ $settings['typography']['fontFamilies']['theme'] = array();
+ }
}
+ // Initialize the font families from variation if set and is an array, otherwise default to an empty array.
+ $variation_font_families = ( isset( $variation['settings']['typography']['fontFamilies']['theme'] ) && is_array( $variation['settings']['typography']['fontFamilies']['theme'] ) )
+ ? $variation['settings']['typography']['fontFamilies']['theme']
+ : array();
+
// Merge the variation settings with the global settings.
$settings['typography']['fontFamilies']['theme'] = array_merge(
$settings['typography']['fontFamilies']['theme'],
- $variation['settings']['typography']['fontFamilies']['theme']
+ $variation_font_families
);
// Make sure there are no duplicates.
diff --git a/package-lock.json b/package-lock.json
index 601de49933680..8b64b911fae9f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "gutenberg",
- "version": "17.0.0",
+ "version": "17.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "gutenberg",
- "version": "17.0.0",
+ "version": "17.0.1",
"hasInstallScript": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -56141,7 +56141,7 @@
},
"packages/react-native-aztec": {
"name": "@wordpress/react-native-aztec",
- "version": "1.107.0",
+ "version": "1.108.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/element": "file:../element",
@@ -56154,7 +56154,7 @@
},
"packages/react-native-bridge": {
"name": "@wordpress/react-native-bridge",
- "version": "1.107.0",
+ "version": "1.108.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/react-native-aztec": "file:../react-native-aztec"
@@ -56165,7 +56165,7 @@
},
"packages/react-native-editor": {
"name": "@wordpress/react-native-editor",
- "version": "1.107.0",
+ "version": "1.108.0",
"hasInstallScript": true,
"license": "GPL-2.0-or-later",
"dependencies": {
diff --git a/package.json b/package.json
index a22544aa9b6a2..266cbcc802d14 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "17.0.0",
+ "version": "17.0.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss
index cbe495d3787cd..536d07ec4da34 100644
--- a/packages/base-styles/_z-index.scss
+++ b/packages/base-styles/_z-index.scss
@@ -127,6 +127,7 @@ $z-layers: (
".block-editor-template-part__selection-modal": 1000001,
".block-editor-block-rename-modal": 1000001,
".edit-site-list__rename-modal": 1000001,
+ ".dataviews-action-modal": 1000001,
".edit-site-swap-template-modal": 1000001,
".edit-site-template-panel__replace-template-modal": 1000001,
diff --git a/packages/block-editor/src/components/block-toolbar/style.scss b/packages/block-editor/src/components/block-toolbar/style.scss
index eef1678e2dfab..3f8a7057aef84 100644
--- a/packages/block-editor/src/components/block-toolbar/style.scss
+++ b/packages/block-editor/src/components/block-toolbar/style.scss
@@ -56,6 +56,14 @@
}
}
+.block-editor-block-contextual-toolbar.is-fixed {
+ position: sticky;
+ top: 0;
+ z-index: z-index(".block-editor-block-popover");
+ display: block;
+ width: 100%;
+}
+
// on desktop browsers the fixed toolbar has tweaked borders
@include break-medium() {
.block-editor-block-contextual-toolbar.is-fixed {
diff --git a/packages/block-editor/src/components/block-tools/block-contextual-toolbar.js b/packages/block-editor/src/components/block-tools/block-contextual-toolbar.js
index deac140f412ca..b24a25ee60ed4 100644
--- a/packages/block-editor/src/components/block-tools/block-contextual-toolbar.js
+++ b/packages/block-editor/src/components/block-tools/block-contextual-toolbar.js
@@ -7,22 +7,8 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import {
- forwardRef,
- useLayoutEffect,
- useEffect,
- useRef,
- useState,
-} from '@wordpress/element';
import { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';
import { useSelect } from '@wordpress/data';
-import {
- ToolbarItem,
- ToolbarButton,
- ToolbarGroup,
-} from '@wordpress/components';
-import { next, previous } from '@wordpress/icons';
-import { useViewportMatch } from '@wordpress/compose';
/**
* Internal dependencies
@@ -32,15 +18,11 @@ import BlockToolbar from '../block-toolbar';
import { store as blockEditorStore } from '../../store';
import { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';
-function UnforwardedBlockContextualToolbar(
- { focusOnMount, isFixed, ...props },
- ref
-) {
- // When the toolbar is fixed it can be collapsed
- const [ isCollapsed, setIsCollapsed ] = useState( false );
- const toolbarButtonRef = useRef();
-
- const isLargeViewport = useViewportMatch( 'medium' );
+export default function BlockContextualToolbar( {
+ focusOnMount,
+ isFixed,
+ ...props
+} ) {
const {
blockType,
blockEditingMode,
@@ -82,92 +64,6 @@ function UnforwardedBlockContextualToolbar(
};
}, [] );
- useEffect( () => {
- setIsCollapsed( false );
- }, [ selectedBlockClientId ] );
-
- const isLargerThanTabletViewport = useViewportMatch( 'large', '>=' );
- const isFullscreen =
- document.body.classList.contains( 'is-fullscreen-mode' );
-
- /**
- * The following code is a workaround to fix the width of the toolbar
- * it should be removed when the toolbar will be rendered inline
- * FIXME: remove this layout effect when the toolbar is no longer
- * absolutely positioned
- */
- useLayoutEffect( () => {
- // don't do anything if not fixed toolbar
- if ( ! isFixed ) {
- return;
- }
-
- const blockToolbar = document.querySelector(
- '.block-editor-block-contextual-toolbar'
- );
-
- if ( ! blockToolbar ) {
- return;
- }
-
- if ( ! blockType ) {
- blockToolbar.style.width = 'initial';
- return;
- }
-
- if ( ! isLargerThanTabletViewport ) {
- // set the width of the toolbar to auto
- blockToolbar.style = {};
- return;
- }
-
- if ( isCollapsed ) {
- // set the width of the toolbar to auto
- blockToolbar.style.width = 'auto';
- return;
- }
-
- // get the width of the pinned items in the post editor or widget editor
- const pinnedItems = document.querySelector(
- '.edit-post-header__settings, .edit-widgets-header__actions'
- );
- // get the width of the left header in the site editor
- const leftHeader = document.querySelector(
- '.edit-site-header-edit-mode__end'
- );
-
- const computedToolbarStyle = window.getComputedStyle( blockToolbar );
- const computedPinnedItemsStyle = pinnedItems
- ? window.getComputedStyle( pinnedItems )
- : false;
- const computedLeftHeaderStyle = leftHeader
- ? window.getComputedStyle( leftHeader )
- : false;
-
- const marginLeft = parseFloat( computedToolbarStyle.marginLeft );
- const pinnedItemsWidth = computedPinnedItemsStyle
- ? parseFloat( computedPinnedItemsStyle.width )
- : 0;
- const leftHeaderWidth = computedLeftHeaderStyle
- ? parseFloat( computedLeftHeaderStyle.width )
- : 0;
-
- // set the new witdth of the toolbar
- blockToolbar.style.width = `calc(100% - ${
- leftHeaderWidth +
- pinnedItemsWidth +
- marginLeft +
- ( pinnedItems || leftHeader ? 2 : 0 ) + // Prevents button focus border from being cut off
- ( isFullscreen ? 0 : 160 ) // the width of the admin sidebar expanded
- }px)`;
- }, [
- isFixed,
- isLargerThanTabletViewport,
- isCollapsed,
- isFullscreen,
- blockType,
- ] );
-
const isToolbarEnabled =
blockType &&
hasBlockSupport( blockType, '__experimentalToolbar', true );
@@ -183,51 +79,22 @@ function UnforwardedBlockContextualToolbar(
const classes = classnames( 'block-editor-block-contextual-toolbar', {
'has-parent': hasParents && showParentSelector,
'is-fixed': isFixed,
- 'is-collapsed': isCollapsed,
} );
return (
Example text
+"
+`;
+
exports[`Paragraph block transforms to Columns block 1`] = `
"