From 6f99a824f1322f96ea72181b408beadb9c0a33e4 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Fri, 4 Jun 2021 11:18:41 +0300 Subject: [PATCH 01/22] Fix site-logo not getting removed on remove_theme_mod (#32370) * change site-logo sync hook * Don't pollute the global variables Co-authored-by: Weston Ruter * cs * Hook in setup_theme Co-authored-by: Weston Ruter --- .../block-library/src/site-logo/index.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/site-logo/index.php b/packages/block-library/src/site-logo/index.php index 46af15ad6dbc66..44d63505cc4ffb 100644 --- a/packages/block-library/src/site-logo/index.php +++ b/packages/block-library/src/site-logo/index.php @@ -111,24 +111,35 @@ function _override_custom_logo_theme_mod( $custom_logo ) { /** * Updates the site_logo option when the custom_logo theme-mod gets updated. * - * @param string $custom_logo The custom logo set by a theme. + * This function is hooked on "update_option_theme_mods_$theme" and not + * "pre_set_theme_mod_custom_logo" because by hooking in `update_option` + * the function accounts for remove_theme_mod() as well. * - * @return string The custom logo. + * @param mixed $old_value The old option value. + * @param mixed $value The new option value. */ -function _sync_custom_logo_to_site_logo( $custom_logo ) { +function _sync_custom_logo_to_site_logo( $old_value, $value ) { // Delete the option when the custom logo does not exist or was removed. // This step ensures the option stays in sync. - if ( empty( $custom_logo ) ) { + if ( empty( $value['custom_logo'] ) ) { delete_option( 'site_logo' ); } else { remove_action( 'update_option_site_logo', '_sync_site_logo_to_custom_logo' ); - update_option( 'site_logo', $custom_logo ); + update_option( 'site_logo', $value['custom_logo'] ); add_action( 'update_option_site_logo', '_sync_site_logo_to_custom_logo', 10, 2 ); } - return $custom_logo; } -add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' ); +/** + * Hooks `_sync_custom_logo_to_site_logo` in `update_option_theme_mods_$theme`. + * + * Runs on `setup_theme` to account for dynamically-switched themes in the Customizer. + */ +function _sync_custom_logo_to_site_logo_on_setup_theme() { + $theme = get_option( 'stylesheet' ); + add_action( "update_option_theme_mods_$theme", '_sync_custom_logo_to_site_logo', 10, 2 ); +} +add_action( 'setup_theme', '_sync_custom_logo_to_site_logo_on_setup_theme', 11 ); /** * Updates the custom_logo theme-mod when the site_logo option gets updated. From 7274601e437226d93f73d4dbcce821ad098ef810 Mon Sep 17 00:00:00 2001 From: Filipe Varela Date: Fri, 4 Jun 2021 09:45:35 +0100 Subject: [PATCH 02/22] Icons: add new icons (#32371) * Icons: tweak people icon * Add new icons Adds the following icons: - `add-card` - `bug`/`no-bug` - `key` - `post-author` - `security` * Remove old post author icon * Rename `security` icon to `shield` * Rename `noBug` to `removeBug` * Remove unnecessary attributes from `addCard` * Update shield shape * Linting. * More linting. Co-authored-by: jasmussen --- packages/block-library/src/post-author/icon.js | 10 ---------- packages/block-library/src/post-author/index.js | 6 +++++- .../src/post-comment-author/icon.js | 10 ---------- .../src/post-comment-author/index.js | 6 +++++- packages/icons/src/index.js | 8 +++++++- packages/icons/src/library/add-card.js | 12 ++++++++++++ packages/icons/src/library/bug.js | 16 ++++++++++++++++ packages/icons/src/library/key.js | 16 ++++++++++++++++ packages/icons/src/library/people.js | 2 +- packages/icons/src/library/post-author.js | 16 ++++++++++++++++ packages/icons/src/library/remove-bug.js | 12 ++++++++++++ packages/icons/src/library/shield.js | 16 ++++++++++++++++ 12 files changed, 106 insertions(+), 24 deletions(-) delete mode 100644 packages/block-library/src/post-author/icon.js delete mode 100644 packages/block-library/src/post-comment-author/icon.js create mode 100644 packages/icons/src/library/add-card.js create mode 100644 packages/icons/src/library/bug.js create mode 100644 packages/icons/src/library/key.js create mode 100644 packages/icons/src/library/post-author.js create mode 100644 packages/icons/src/library/remove-bug.js create mode 100644 packages/icons/src/library/shield.js diff --git a/packages/block-library/src/post-author/icon.js b/packages/block-library/src/post-author/icon.js deleted file mode 100644 index 87fa4ecf2a52fb..00000000000000 --- a/packages/block-library/src/post-author/icon.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * WordPress dependencies - */ -import { Path, SVG } from '@wordpress/components'; - -export default ( - - - -); diff --git a/packages/block-library/src/post-author/index.js b/packages/block-library/src/post-author/index.js index d3c19ddabf1116..68fb2c2f737c25 100644 --- a/packages/block-library/src/post-author/index.js +++ b/packages/block-library/src/post-author/index.js @@ -3,7 +3,11 @@ */ import metadata from './block.json'; import edit from './edit'; -import icon from './icon'; + +/** + * WordPress dependencies + */ +import { postAuthor as icon } from '@wordpress/icons'; const { name } = metadata; export { metadata, name }; diff --git a/packages/block-library/src/post-comment-author/icon.js b/packages/block-library/src/post-comment-author/icon.js deleted file mode 100644 index 87fa4ecf2a52fb..00000000000000 --- a/packages/block-library/src/post-comment-author/icon.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * WordPress dependencies - */ -import { Path, SVG } from '@wordpress/components'; - -export default ( - - - -); diff --git a/packages/block-library/src/post-comment-author/index.js b/packages/block-library/src/post-comment-author/index.js index d3c19ddabf1116..68fb2c2f737c25 100644 --- a/packages/block-library/src/post-comment-author/index.js +++ b/packages/block-library/src/post-comment-author/index.js @@ -3,7 +3,11 @@ */ import metadata from './block.json'; import edit from './edit'; -import icon from './icon'; + +/** + * WordPress dependencies + */ +import { postAuthor as icon } from '@wordpress/icons'; const { name } = metadata; export { metadata, name }; diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index 7e65e59008b533..29e656324f076c 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -1,5 +1,6 @@ export { default as Icon } from './icon'; +export { default as addCard } from './library/add-card'; export { default as addSubmenu } from './library/add-submenu'; export { default as alignCenter } from './library/align-center'; export { default as alignJustify } from './library/align-justify'; @@ -19,6 +20,7 @@ export { default as blockDefault } from './library/block-default'; export { default as blockTable } from './library/block-table'; export { default as box } from './library/box'; export { default as brush } from './library/brush'; +export { default as bug } from './library/bug'; export { default as button } from './library/button'; export { default as buttons } from './library/buttons'; export { default as calendar } from './library/calendar'; @@ -94,6 +96,7 @@ export { default as justifyLeft } from './library/justify-left'; export { default as justifyCenter } from './library/justify-center'; export { default as justifyRight } from './library/justify-right'; export { default as justifySpaceBetween } from './library/justify-space-between'; +export { default as key } from './library/key'; export { default as keyboardClose } from './library/keyboard-close'; export { default as keyboardReturn } from './library/keyboard-return'; export { default as layout } from './library/layout'; @@ -136,6 +139,7 @@ export { default as plugins } from './library/plugins'; export { default as plusCircleFilled } from './library/plus-circle-filled'; export { default as plusCircle } from './library/plus-circle'; export { default as plus } from './library/plus'; +export { default as postAuthor } from './library/post-author'; export { default as postCategories } from './library/post-categories'; export { default as postContent } from './library/post-content'; export { default as postComments } from './library/post-comments'; @@ -159,6 +163,7 @@ export { default as queryPaginationPrevious } from './library/query-pagination-p export { default as quote } from './library/quote'; export { default as receipt } from './library/receipt'; export { default as redo } from './library/redo'; +export { default as removeBug } from './library/remove-bug'; export { default as replace } from './library/replace'; export { default as resizeCornerNE } from './library/resize-corner-n-e'; export { default as reusableBlock } from './library/reusable-block'; @@ -169,8 +174,9 @@ export { default as search } from './library/search'; export { default as separator } from './library/separator'; export { default as settings } from './library/settings'; export { default as share } from './library/share'; -export { default as siteLogo } from './library/site-logo'; +export { default as shield } from './library/shield'; export { default as shortcode } from './library/shortcode'; +export { default as siteLogo } from './library/site-logo'; export { default as stack } from './library/stack'; export { default as starEmpty } from './library/star-empty'; export { default as starFilled } from './library/star-filled'; diff --git a/packages/icons/src/library/add-card.js b/packages/icons/src/library/add-card.js new file mode 100644 index 00000000000000..17610fbe31b407 --- /dev/null +++ b/packages/icons/src/library/add-card.js @@ -0,0 +1,12 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const addCard = ( + + + +); + +export default addCard; diff --git a/packages/icons/src/library/bug.js b/packages/icons/src/library/bug.js new file mode 100644 index 00000000000000..1837ab47749adc --- /dev/null +++ b/packages/icons/src/library/bug.js @@ -0,0 +1,16 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const bug = ( + + + +); + +export default bug; diff --git a/packages/icons/src/library/key.js b/packages/icons/src/library/key.js new file mode 100644 index 00000000000000..6eb7a4a40065aa --- /dev/null +++ b/packages/icons/src/library/key.js @@ -0,0 +1,16 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const key = ( + + + +); + +export default key; diff --git a/packages/icons/src/library/people.js b/packages/icons/src/library/people.js index a521af10f3b77b..a91164f2a7cae3 100644 --- a/packages/icons/src/library/people.js +++ b/packages/icons/src/library/people.js @@ -5,7 +5,7 @@ import { SVG, Path } from '@wordpress/primitives'; const people = ( - + ); diff --git a/packages/icons/src/library/post-author.js b/packages/icons/src/library/post-author.js new file mode 100644 index 00000000000000..fc0567f146b01c --- /dev/null +++ b/packages/icons/src/library/post-author.js @@ -0,0 +1,16 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const postAuthor = ( + + + +); + +export default postAuthor; diff --git a/packages/icons/src/library/remove-bug.js b/packages/icons/src/library/remove-bug.js new file mode 100644 index 00000000000000..d92fc76d3dda4d --- /dev/null +++ b/packages/icons/src/library/remove-bug.js @@ -0,0 +1,12 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const removeBug = ( + + + +); + +export default removeBug; diff --git a/packages/icons/src/library/shield.js b/packages/icons/src/library/shield.js new file mode 100644 index 00000000000000..3dc11ab96a1313 --- /dev/null +++ b/packages/icons/src/library/shield.js @@ -0,0 +1,16 @@ +/** + * WordPress dependencies + */ +import { SVG, Path } from '@wordpress/primitives'; + +const shield = ( + + + +); + +export default shield; From 036799626a845aa7e286a4d0f43437b1608267e8 Mon Sep 17 00:00:00 2001 From: Filipe Varela Date: Fri, 4 Jun 2021 10:15:20 +0100 Subject: [PATCH 03/22] Icons: tweak people icon (#32354) * Icons: tweak people icon * Add fillRule attribute --- packages/icons/src/library/people.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/icons/src/library/people.js b/packages/icons/src/library/people.js index a91164f2a7cae3..cda1f9128a445e 100644 --- a/packages/icons/src/library/people.js +++ b/packages/icons/src/library/people.js @@ -5,7 +5,10 @@ import { SVG, Path } from '@wordpress/primitives'; const people = ( - + ); From 3c5e72e50cddb118b85220d50f1b7919c4df67c6 Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Fri, 4 Jun 2021 03:48:59 -0600 Subject: [PATCH 04/22] Fix duotone support docs (#32440) --- docs/reference-guides/block-api/block-supports.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reference-guides/block-api/block-supports.md b/docs/reference-guides/block-api/block-supports.md index 5b920ab3b5adf5..3a5e4be2c761e8 100644 --- a/docs/reference-guides/block-api/block-supports.md +++ b/docs/reference-guides/block-api/block-supports.md @@ -86,7 +86,7 @@ supports: { - Default value: null - Subproperties: - `background`: type `boolean`, default value `true` - - `duotone`: type `string`, default value undefined + - `__experimentalDuotone`: type `string`, default value undefined - `gradients`: type `boolean`, default value `false` - `text`: type `boolean`, default value `true` @@ -196,7 +196,7 @@ supports: { Duotone presets are sourced from `color.duotone` in [theme.json](/docs/how-to-guides/themes/theme-json.md). -When the block declares support for `color.duotone`, the attributes definition is extended to include the attribute `style`: +When the block declares support for `color.__experimentalDuotone`, the attributes definition is extended to include the attribute `style`: - `style`: attribute of `object` type with no default assigned. @@ -210,7 +210,7 @@ When the block declares support for `color.duotone`, the attributes definition i color: { duotone: [ '#FFF', - '#000 + '#000' ] } } From 9ef56be827766d06fb0ca5a3cebaf97073491b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Fri, 4 Jun 2021 12:13:30 +0200 Subject: [PATCH 05/22] Make syntax errors in `theme.json` visible to users (#32404) --- lib/class-wp-theme-json-resolver-gutenberg.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 987f3e5400fc26..bcdedda86f30b7 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -74,7 +74,7 @@ private static function read_json_file( $file_path ) { $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE !== $json_decoding_error ) { - error_log( 'Error when decoding file schema: ' . json_last_error_msg() ); + trigger_error( "Error when decoding a theme.json schema at path $file_path " . json_last_error_msg() ); return $config; } @@ -367,7 +367,7 @@ public static function get_user_data() { $json_decoding_error = json_last_error(); if ( JSON_ERROR_NONE !== $json_decoding_error ) { - error_log( 'Error when decoding user schema: ' . json_last_error_msg() ); + trigger_error( 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() ); return new WP_Theme_JSON_Gutenberg( $config ); } From 2e6423fed721c8d13fa403f37f9965b77f7763de Mon Sep 17 00:00:00 2001 From: Gerardo Pacheco Date: Fri, 4 Jun 2021 12:14:26 +0200 Subject: [PATCH 06/22] Mobile - Floating Toolbar - Disable touch events when its hidden (#32396) --- .../src/components/floating-toolbar/index.native.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/block-editor/src/components/floating-toolbar/index.native.js b/packages/block-editor/src/components/floating-toolbar/index.native.js index 1f71ac7c28684c..50fce7857ff59a 100644 --- a/packages/block-editor/src/components/floating-toolbar/index.native.js +++ b/packages/block-editor/src/components/floating-toolbar/index.native.js @@ -7,7 +7,7 @@ import { Animated, Easing, View, Platform } from 'react-native'; * WordPress dependencies */ import { ToolbarButton, Toolbar } from '@wordpress/components'; -import { useEffect, useState } from '@wordpress/element'; +import { useEffect, useState, useRef } from '@wordpress/element'; import { withSelect, withDispatch } from '@wordpress/data'; import { compose } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; @@ -24,8 +24,6 @@ const EASE_IN_DURATION = 250; const EASE_OUT_DURATION = 80; const TRANSLATION_RANGE = 8; -const opacity = new Animated.Value( 0 ); - const FloatingToolbar = ( { selectedClientId, parentId, @@ -33,6 +31,7 @@ const FloatingToolbar = ( { onNavigateUp, isRTL, } ) => { + const opacity = useRef( new Animated.Value( 0 ) ).current; // Sustain old selection for proper block selection button rendering when exit animation is ongoing. const [ previousSelection, setPreviousSelection ] = useState( {} ); @@ -79,7 +78,10 @@ const FloatingToolbar = ( { return ( !! opacity && ( - + { showNavUpButton && ( Date: Fri, 4 Jun 2021 12:24:30 +0000 Subject: [PATCH 07/22] Update Changelog for 10.7.2 --- changelog.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog.txt b/changelog.txt index 2262dee883f9af..0ed5d3cff9b040 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,12 @@ == Changelog == += 10.7.2 = + +### Bug Fixes + +- Fix Logic to enable custom colors, gradients, and font sizes. ([32200](https://github.com/WordPress/gutenberg/pull/32200)) + + = 10.8.0-rc.1 = From e24947929f31b34459a85d31b9c5372f50cdce01 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 4 Jun 2021 14:50:17 +0100 Subject: [PATCH 08/22] Update: Skip typography serialization (#32444) --- lib/block-supports/typography.php | 8 +++---- packages/block-editor/src/hooks/font-size.js | 7 ++++-- packages/block-editor/src/hooks/style.js | 23 +++++++------------ packages/block-editor/src/hooks/typography.js | 1 + 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php index fe68605f475607..c22d70e147e1a0 100644 --- a/lib/block-supports/typography.php +++ b/lib/block-supports/typography.php @@ -88,13 +88,11 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) { $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false ); $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false ); - $skip_font_size_support_serialization = _wp_array_get( $block_type->supports, array( '__experimentalSkipFontSizeSerialization' ), false ); - - // Covers all typography features _except_ font size. - $skip_typography_serialization = _wp_array_get( $block_type->supports, array( '__experimentalSkipTypographySerialization' ), false ); + // Covers all typography features. + $skip_typography_serialization = _wp_array_get( $typography_supports, array( '__experimentalSkipSerialization' ), false ); // Font Size. - if ( $has_font_size_support && ! $skip_font_size_support_serialization ) { + if ( $has_font_size_support && ! $skip_typography_serialization ) { $has_named_font_size = array_key_exists( 'fontSize', $block_attributes ); $has_custom_font_size = isset( $block_attributes['style']['typography']['fontSize'] ); diff --git a/packages/block-editor/src/hooks/font-size.js b/packages/block-editor/src/hooks/font-size.js index 498ea20769fac0..e678f31abd48cf 100644 --- a/packages/block-editor/src/hooks/font-size.js +++ b/packages/block-editor/src/hooks/font-size.js @@ -58,7 +58,10 @@ function addSaveProps( props, blockType, attributes ) { } if ( - hasBlockSupport( blockType, '__experimentalSkipFontSizeSerialization' ) + hasBlockSupport( + blockType, + 'typography.__experimentalSkipSerialization' + ) ) { return props; } @@ -182,7 +185,7 @@ const withFontSizeInlineStyles = createHigherOrderComponent( ! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || hasBlockSupport( blockName, - '__experimentalSkipFontSizeSerialization' + 'typography.__experimentalSkipSerialization' ) || ! fontSize || style?.typography?.fontSize diff --git a/packages/block-editor/src/hooks/style.js b/packages/block-editor/src/hooks/style.js index 859bde72addcfb..601ceb6791f7d0 100644 --- a/packages/block-editor/src/hooks/style.js +++ b/packages/block-editor/src/hooks/style.js @@ -3,18 +3,15 @@ */ import { capitalize, - find, first, forEach, get, has, isEmpty, - isEqual, kebabCase, map, omit, startsWith, - without, } from 'lodash'; import classnames from 'classnames'; @@ -35,8 +32,11 @@ import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose'; */ import { BORDER_SUPPORT_KEY, BorderPanel } from './border'; import { COLOR_SUPPORT_KEY, ColorEdit } from './color'; -import { FONT_SIZE_SUPPORT_KEY } from './font-size'; -import { TypographyPanel, TYPOGRAPHY_SUPPORT_KEYS } from './typography'; +import { + TypographyPanel, + TYPOGRAPHY_SUPPORT_KEY, + TYPOGRAPHY_SUPPORT_KEYS, +} from './typography'; import { SPACING_SUPPORT_KEY, SpacingPanel } from './spacing'; import useDisplayBlockControls from '../components/use-display-block-controls'; @@ -140,19 +140,12 @@ const skipSerializationPaths = { [ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ COLOR_SUPPORT_KEY, ], + [ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ + TYPOGRAPHY_SUPPORT_KEY, + ], [ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'spacing', ], - [ `__experimentalSkipFontSizeSerialization` ]: [ 'typography', 'fontSize' ], - [ `__experimentalSkipTypographySerialization` ]: without( - TYPOGRAPHY_SUPPORT_KEYS, - FONT_SIZE_SUPPORT_KEY - ).map( - ( feature ) => - find( STYLE_PROPERTY, ( property ) => - isEqual( property.support, [ feature ] ) - )?.value - ), }; /** diff --git a/packages/block-editor/src/hooks/typography.js b/packages/block-editor/src/hooks/typography.js index 3038fab9662149..1b961990acaaae 100644 --- a/packages/block-editor/src/hooks/typography.js +++ b/packages/block-editor/src/hooks/typography.js @@ -50,6 +50,7 @@ import { useIsLetterSpacingDisabled, } from './letter-spacing'; +export const TYPOGRAPHY_SUPPORT_KEY = 'typography'; export const TYPOGRAPHY_SUPPORT_KEYS = [ LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, From e9f09838360909fe795351771a4fafc6fef13513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Fri, 4 Jun 2021 19:29:14 +0200 Subject: [PATCH 09/22] Letter spacing should also respect skip serialization flag (#32459) --- lib/block-supports/typography.php | 42 ++++++++++++------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/lib/block-supports/typography.php b/lib/block-supports/typography.php index c22d70e147e1a0..811c96b9083d0b 100644 --- a/lib/block-supports/typography.php +++ b/lib/block-supports/typography.php @@ -70,15 +70,20 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) { return array(); } - $attributes = array(); - $classes = array(); - $styles = array(); - $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false ); if ( ! $typography_supports ) { return array(); } + $skip_typography_serialization = _wp_array_get( $typography_supports, array( '__experimentalSkipSerialization' ), false ); + if ( $skip_typography_serialization ) { + return array(); + } + + $attributes = array(); + $classes = array(); + $styles = array(); + $has_font_family_support = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false ); $has_font_size_support = _wp_array_get( $typography_supports, array( 'fontSize' ), false ); $has_font_style_support = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false ); @@ -88,15 +93,10 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) { $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false ); $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false ); - // Covers all typography features. - $skip_typography_serialization = _wp_array_get( $typography_supports, array( '__experimentalSkipSerialization' ), false ); - - // Font Size. - if ( $has_font_size_support && ! $skip_typography_serialization ) { + if ( $has_font_size_support ) { $has_named_font_size = array_key_exists( 'fontSize', $block_attributes ); $has_custom_font_size = isset( $block_attributes['style']['typography']['fontSize'] ); - // Apply required class or style. if ( $has_named_font_size ) { $classes[] = sprintf( 'has-%s-font-size', $block_attributes['fontSize'] ); } elseif ( $has_custom_font_size ) { @@ -104,10 +104,8 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) { } } - // Font Family. - if ( $has_font_family_support && ! $skip_typography_serialization ) { + if ( $has_font_family_support ) { $has_font_family = isset( $block_attributes['style']['typography']['fontFamily'] ); - // Apply required class and style. if ( $has_font_family ) { $font_family = $block_attributes['style']['typography']['fontFamily']; if ( strpos( $font_family, 'var:preset|font-family' ) !== false ) { @@ -121,43 +119,35 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) { } } - // Font style. - if ( $has_font_style_support && ! $skip_typography_serialization ) { - // Apply font style. + if ( $has_font_style_support ) { $font_style = gutenberg_typography_get_css_variable_inline_style( $block_attributes, 'fontStyle', 'font-style' ); if ( $font_style ) { $styles[] = $font_style; } } - // Font weight. - if ( $has_font_weight_support && ! $skip_typography_serialization ) { - // Apply font weight. + if ( $has_font_weight_support ) { $font_weight = gutenberg_typography_get_css_variable_inline_style( $block_attributes, 'fontWeight', 'font-weight' ); if ( $font_weight ) { $styles[] = $font_weight; } } - // Line Height. - if ( $has_line_height_support && ! $skip_typography_serialization ) { + if ( $has_line_height_support ) { $has_line_height = isset( $block_attributes['style']['typography']['lineHeight'] ); - // Add the style (no classes for line-height). if ( $has_line_height ) { $styles[] = sprintf( 'line-height: %s;', $block_attributes['style']['typography']['lineHeight'] ); } } - // Text Decoration. - if ( $has_text_decoration_support && ! $skip_typography_serialization ) { + if ( $has_text_decoration_support ) { $text_decoration_style = gutenberg_typography_get_css_variable_inline_style( $block_attributes, 'textDecoration', 'text-decoration' ); if ( $text_decoration_style ) { $styles[] = $text_decoration_style; } } - // Text Transform. - if ( $has_text_transform_support && ! $skip_typography_serialization ) { + if ( $has_text_transform_support ) { $text_transform_style = gutenberg_typography_get_css_variable_inline_style( $block_attributes, 'textTransform', 'text-transform' ); if ( $text_transform_style ) { $styles[] = $text_transform_style; From d4e9c65517d728177459c0458adbe4ceb2889def Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Mon, 7 Jun 2021 16:04:22 +1000 Subject: [PATCH 10/22] Block Support: Update border support to allow non-pixel units (#31483) * Update border support to allow non-pixel units * Fix search block to work with non-pixel border radius units --- lib/block-supports/border.php | 20 +++++++-- .../block-editor/src/hooks/border-radius.js | 24 ++++++++--- .../block-editor/src/hooks/border-width.js | 30 +++++++++---- packages/block-editor/src/hooks/border.js | 43 ++++++++++++++++++- packages/block-editor/src/hooks/border.scss | 10 +++++ packages/block-editor/src/hooks/test/style.js | 8 ++-- packages/block-editor/src/style.scss | 1 + packages/block-library/src/button/edit.js | 4 +- packages/block-library/src/button/save.js | 2 +- packages/block-library/src/search/edit.js | 14 ++++-- packages/block-library/src/search/index.php | 14 +++--- 11 files changed, 133 insertions(+), 37 deletions(-) create mode 100644 packages/block-editor/src/hooks/border.scss diff --git a/lib/block-supports/border.php b/lib/block-supports/border.php index e400a89fc0119d..9d8d97c690a7b8 100644 --- a/lib/block-supports/border.php +++ b/lib/block-supports/border.php @@ -56,8 +56,14 @@ function gutenberg_apply_border_support( $block_type, $block_attributes ) { gutenberg_has_border_feature_support( $block_type, 'radius' ) && isset( $block_attributes['style']['border']['radius'] ) ) { - $border_radius = (int) $block_attributes['style']['border']['radius']; - $styles[] = sprintf( 'border-radius: %dpx;', $border_radius ); + $border_radius = $block_attributes['style']['border']['radius']; + + // This check handles original unitless implementation. + if ( is_numeric( $border_radius ) ) { + $border_radius .= 'px'; + } + + $styles[] = sprintf( 'border-radius: %s;', $border_radius ); } // Border style. @@ -74,8 +80,14 @@ function gutenberg_apply_border_support( $block_type, $block_attributes ) { gutenberg_has_border_feature_support( $block_type, 'width' ) && isset( $block_attributes['style']['border']['width'] ) ) { - $border_width = intval( $block_attributes['style']['border']['width'] ); - $styles[] = sprintf( 'border-width: %dpx;', $border_width ); + $border_width = $block_attributes['style']['border']['width']; + + // This check handles original unitless implementation. + if ( is_numeric( $border_width ) ) { + $border_width .= 'px'; + } + + $styles[] = sprintf( 'border-width: %s;', $border_width ); } // Border color. diff --git a/packages/block-editor/src/hooks/border-radius.js b/packages/block-editor/src/hooks/border-radius.js index 50e9dece97eaf6..a301f0570725ad 100644 --- a/packages/block-editor/src/hooks/border-radius.js +++ b/packages/block-editor/src/hooks/border-radius.js @@ -1,16 +1,17 @@ /** * WordPress dependencies */ -import { RangeControl } from '@wordpress/components'; +import { __experimentalUnitControl as UnitControl } from '@wordpress/components'; +import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ +import { CSS_UNITS, parseUnit } from './border'; import { cleanEmptyObject } from './utils'; const MIN_BORDER_RADIUS_VALUE = 0; -const MAX_BORDER_RADIUS_VALUE = 50; /** * Inspector control panel containing the border radius related configuration. @@ -24,6 +25,15 @@ export function BorderRadiusEdit( props ) { setAttributes, } = props; + // Step value is maintained in state so step is appropriate for current unit + // even when current radius value is undefined. + const initialStep = parseUnit( style?.border?.radius ) === 'px' ? 1 : 0.25; + const [ step, setStep ] = useState( initialStep ); + + const onUnitChange = ( newUnit ) => { + setStep( newUnit === 'px' ? 1 : 0.25 ); + }; + const onChange = ( newRadius ) => { let newStyle = { ...style, @@ -33,7 +43,7 @@ export function BorderRadiusEdit( props ) { }, }; - if ( newRadius === undefined ) { + if ( newRadius === undefined || newRadius === '' ) { newStyle = cleanEmptyObject( newStyle ); } @@ -41,14 +51,14 @@ export function BorderRadiusEdit( props ) { }; return ( - ); } diff --git a/packages/block-editor/src/hooks/border-width.js b/packages/block-editor/src/hooks/border-width.js index 24e25f6a063850..341fca06fdc5bc 100644 --- a/packages/block-editor/src/hooks/border-width.js +++ b/packages/block-editor/src/hooks/border-width.js @@ -1,16 +1,17 @@ /** * WordPress dependencies */ -import { RangeControl } from '@wordpress/components'; +import { __experimentalUnitControl as UnitControl } from '@wordpress/components'; +import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ +import { CSS_UNITS, parseUnit } from './border'; import { cleanEmptyObject } from './utils'; const MIN_BORDER_WIDTH = 0; -const MAX_BORDER_WIDTH = 50; /** * Inspector control for configuring border width property. @@ -24,8 +25,17 @@ export const BorderWidthEdit = ( props ) => { setAttributes, } = props; + // Step value is maintained in state so step is appropriate for current unit + // even when current radius value is undefined. + const initialStep = parseUnit( style?.border?.width ) === 'px' ? 1 : 0.25; + const [ step, setStep ] = useState( initialStep ); + + const onUnitChange = ( newUnit ) => { + setStep( newUnit === 'px' ? 1 : 0.25 ); + }; + const onChange = ( newWidth ) => { - const newStyle = { + let newStyle = { ...style, border: { ...style?.border, @@ -33,18 +43,22 @@ export const BorderWidthEdit = ( props ) => { }, }; - setAttributes( { style: cleanEmptyObject( newStyle ) } ); + if ( newWidth === undefined || newWidth === '' ) { + newStyle = cleanEmptyObject( newStyle ); + } + + setAttributes( { style: newStyle } ); }; return ( - ); }; diff --git a/packages/block-editor/src/hooks/border.js b/packages/block-editor/src/hooks/border.js index 6749afa663482f..f7db904d666aa1 100644 --- a/packages/block-editor/src/hooks/border.js +++ b/packages/block-editor/src/hooks/border.js @@ -16,7 +16,44 @@ import { BorderRadiusEdit } from './border-radius'; import { BorderStyleEdit } from './border-style'; import { BorderWidthEdit } from './border-width'; +const isWeb = Platform.OS === 'web'; + export const BORDER_SUPPORT_KEY = '__experimentalBorder'; +export const CSS_UNITS = [ + { + value: 'px', + label: isWeb ? 'px' : __( 'Pixels (px)' ), + default: '', + a11yLabel: __( 'Pixels (px)' ), + }, + { + value: 'em', + label: isWeb ? 'em' : __( 'Relative to parent font size (em)' ), + default: '', + a11yLabel: __( 'Relative to parent font size (em)' ), + }, + { + value: 'rem', + label: isWeb ? 'rem' : __( 'Relative to root font size (rem)' ), + default: '', + a11yLabel: __( 'Relative to root font size (rem)' ), + }, +]; + +/** + * Parses a CSS unit from a border CSS value. + * + * @param {string} cssValue CSS value to parse e.g. `10px` or `1.5em`. + * @return {string} CSS unit from provided value or default 'px'. + */ +export function parseUnit( cssValue ) { + const value = String( cssValue ).trim(); + const unitMatch = value.match( /[\d.\-\+]*\s*(.*)/ )[ 1 ]; + const unit = unitMatch !== undefined ? unitMatch.toLowerCase() : ''; + const currentUnit = CSS_UNITS.find( ( item ) => item.value === unit ); + + return currentUnit?.value || 'px'; +} export function BorderPanel( props ) { const isDisabled = useIsBorderDisabled( props ); @@ -44,7 +81,11 @@ export function BorderPanel( props ) { return ( - + { isStyleSupported && } { isWidthSupported && } { isRadiusSupported && } diff --git a/packages/block-editor/src/hooks/border.scss b/packages/block-editor/src/hooks/border.scss new file mode 100644 index 00000000000000..61d75c59454635 --- /dev/null +++ b/packages/block-editor/src/hooks/border.scss @@ -0,0 +1,10 @@ +.block-editor-hooks__border-controls { + .components-unit-control-wrapper { + margin-bottom: $grid-unit-30; + + &:last-child { + margin-bottom: $grid-unit-10; + } + } +} + diff --git a/packages/block-editor/src/hooks/test/style.js b/packages/block-editor/src/hooks/test/style.js index 75a520b14ec6f5..85adb56c802e19 100644 --- a/packages/block-editor/src/hooks/test/style.js +++ b/packages/block-editor/src/hooks/test/style.js @@ -18,8 +18,8 @@ describe( 'getInlineStyles', () => { color: { text: 'red', background: 'black' }, typography: { lineHeight: 1.5, fontSize: 10 }, border: { - radius: 10, - width: 3, + radius: '10px', + width: '1em', style: 'dotted', color: '#21759b', }, @@ -31,9 +31,9 @@ describe( 'getInlineStyles', () => { ).toEqual( { backgroundColor: 'black', borderColor: '#21759b', - borderRadius: 10, + borderRadius: '10px', borderStyle: 'dotted', - borderWidth: 3, + borderWidth: '1em', color: 'red', lineHeight: 1.5, fontSize: 10, diff --git a/packages/block-editor/src/style.scss b/packages/block-editor/src/style.scss index 0d9b9b01cbde18..92fc673e65ccf5 100644 --- a/packages/block-editor/src/style.scss +++ b/packages/block-editor/src/style.scss @@ -58,6 +58,7 @@ @import "./components/warning/style.scss"; @import "./hooks/anchor.scss"; @import "./hooks/layout.scss"; +@import "./hooks/border.scss"; // This tag marks the end of the styles that apply to editing canvas contents and need to be manipulated when we resize the editor. #end-resizable-editor-section { diff --git a/packages/block-library/src/button/edit.js b/packages/block-library/src/button/edit.js index 70ce701138999b..15235369b2ee05 100644 --- a/packages/block-library/src/button/edit.js +++ b/packages/block-library/src/button/edit.js @@ -225,9 +225,7 @@ function ButtonEdit( props ) { } ) } style={ { - borderRadius: borderRadius - ? borderRadius + 'px' - : undefined, + borderRadius: borderRadius ? borderRadius : undefined, ...colorProps.style, } } onSplit={ ( value ) => diff --git a/packages/block-library/src/button/save.js b/packages/block-library/src/button/save.js index 695e27e07b5b40..af4f4e6f566f35 100644 --- a/packages/block-library/src/button/save.js +++ b/packages/block-library/src/button/save.js @@ -38,7 +38,7 @@ export default function save( { attributes, className } ) { } ); const buttonStyle = { - borderRadius: borderRadius ? borderRadius + 'px' : undefined, + borderRadius: borderRadius ? borderRadius : undefined, ...colorProps.style, }; diff --git a/packages/block-library/src/search/edit.js b/packages/block-library/src/search/edit.js index ec794a60e44aca..8301ca2c0616be 100644 --- a/packages/block-library/src/search/edit.js +++ b/packages/block-library/src/search/edit.js @@ -50,7 +50,7 @@ import { // Used to calculate border radius adjustment to avoid "fat" corners when // button is placed inside wrapper. -const DEFAULT_INNER_PADDING = 4; +const DEFAULT_INNER_PADDING = '4px'; export default function SearchEdit( { className, @@ -323,10 +323,16 @@ export default function SearchEdit( { if ( 'button-inside' === buttonPosition && style?.border?.radius ) { // We have button inside wrapper and a border radius value to apply. // Add default padding so we don't get "fat" corners. - const outerRadius = - parseInt( style?.border?.radius, 10 ) + DEFAULT_INNER_PADDING; + // + // CSS calc() is used here to support non-pixel units. The inline + // style using calc() will only apply if both values have units. + const radius = Number.isInteger( borderRadius ) + ? `${ borderRadius }px` + : borderRadius; - return { borderRadius: `${ outerRadius }px` }; + return { + borderRadius: `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`, + }; } return undefined; diff --git a/packages/block-library/src/search/index.php b/packages/block-library/src/search/index.php index eba67deeecdce6..faf8741ce7e8bc 100644 --- a/packages/block-library/src/search/index.php +++ b/packages/block-library/src/search/index.php @@ -190,7 +190,8 @@ function styles_for_block_core_search( $attributes ) { if ( $has_border_radius ) { // Shared style for button and input radius values. $border_radius = $attributes['style']['border']['radius']; - $shared_styles[] = sprintf( 'border-radius: %spx;', esc_attr( $border_radius ) ); + $border_radius = is_numeric( $border_radius ) ? $border_radius . 'px' : $border_radius; + $shared_styles[] = sprintf( 'border-radius: %s;', esc_attr( $border_radius ) ); // Apply wrapper border radius if button placed inside. $button_inside = ! empty( $attributes['buttonPosition'] ) && @@ -199,10 +200,13 @@ function styles_for_block_core_search( $attributes ) { if ( $button_inside ) { // We adjust the border radius value for the outer wrapper element // to make it visually consistent with the radius applied to inner - // elements. - $default_padding = 4; - $adjusted_radius = $border_radius + $default_padding; - $wrapper_styles[] = sprintf( 'border-radius: %dpx;', esc_attr( $adjusted_radius ) ); + // elements. calc() is used to support non-pixel CSS units. + $default_padding = '4px'; + $wrapper_styles[] = sprintf( + 'border-radius: calc(%s + %s);', + esc_attr( $border_radius ), + esc_attr( $default_padding ) + ); } } From 4c3300c148a6398f7ab03fb71ad5f635268c8605 Mon Sep 17 00:00:00 2001 From: Udit Desai Date: Mon, 7 Jun 2021 16:46:24 +1000 Subject: [PATCH 11/22] Fix different typos in inline comments, deprecation warnings and variable names. (#32474) --- .../editor/src/components/local-autosave-monitor/index.js | 4 ++-- packages/editor/src/components/provider/index.js | 2 +- packages/editor/src/store/actions.js | 2 +- packages/editor/src/store/selectors.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/editor/src/components/local-autosave-monitor/index.js b/packages/editor/src/components/local-autosave-monitor/index.js index 4ecc69dc431f10..33230486750ed4 100644 --- a/packages/editor/src/components/local-autosave-monitor/index.js +++ b/packages/editor/src/components/local-autosave-monitor/index.js @@ -168,7 +168,7 @@ function useAutosavePurge() { function LocalAutosaveMonitor() { const { autosave } = useDispatch( editorStore ); - const deferedAutosave = useCallback( () => { + const deferredAutosave = useCallback( () => { requestIdleCallback( () => autosave( { local: true } ) ); }, [] ); useAutosaveNotice(); @@ -185,7 +185,7 @@ function LocalAutosaveMonitor() { return ( ); } diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index 894596819e68a8..a204aed8465222 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -60,7 +60,7 @@ function EditorProvider( { } = useDispatch( editorStore ); const { createWarningNotice } = useDispatch( noticesStore ); - // Iniitialize and tear down the editor. + // Initialize and tear down the editor. // Ideally this should be synced on each change and not just something you do once. useLayoutEffect( () => { // Assume that we don't need to initialize in the case of an error recovery. diff --git a/packages/editor/src/store/actions.js b/packages/editor/src/store/actions.js index 64f9a6362d53af..dcd47548b09d48 100644 --- a/packages/editor/src/store/actions.js +++ b/packages/editor/src/store/actions.js @@ -169,7 +169,7 @@ export function __experimentalRequestPostUpdateFinish( options = {} ) { export function updatePost() { deprecated( "wp.data.dispatch( 'core/editor' ).updatePost", { since: '5.7', - alternative: 'User the core entitires store instead', + alternative: 'Use the core entities store instead', } ); return { type: 'DO_NOTHING', diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js index aded0dbc2ae410..5f8a5492f86e28 100644 --- a/packages/editor/src/store/selectors.js +++ b/packages/editor/src/store/selectors.js @@ -772,7 +772,7 @@ export function isEditedPostDateFloating( state ) { // This should be the status of the persisted post // It shouldn't use the "edited" status otherwise it breaks the - // infered post data floating status + // inferred post data floating status // See https://github.com/WordPress/gutenberg/issues/28083 const status = getCurrentPost( state ).status; if ( From 108da99ded460687a81ec987943bcd6829fd8655 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 7 Jun 2021 10:01:53 +0100 Subject: [PATCH 12/22] Fix alligned blocks (#32454) --- packages/block-editor/src/components/block-list/block.js | 1 + .../src/components/block-list/use-block-props/index.js | 6 ++++-- packages/block-editor/src/utils/dom.js | 4 +--- packages/block-library/src/navigation/edit.js | 5 +++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/components/block-list/block.js b/packages/block-editor/src/components/block-list/block.js index 0923dcb99adcc0..d06c286e430f50 100644 --- a/packages/block-editor/src/components/block-list/block.js +++ b/packages/block-editor/src/components/block-list/block.js @@ -161,6 +161,7 @@ function BlockListBlock( { clientId, className, wrapperProps: omit( wrapperProps, [ 'data-align' ] ), + isAligned, }; const memoizedValue = useMemo( () => value, Object.values( value ) ); diff --git a/packages/block-editor/src/components/block-list/use-block-props/index.js b/packages/block-editor/src/components/block-list/use-block-props/index.js index bbffe084d575c7..4c4c5a6612ad9e 100644 --- a/packages/block-editor/src/components/block-list/use-block-props/index.js +++ b/packages/block-editor/src/components/block-list/use-block-props/index.js @@ -58,7 +58,7 @@ const BLOCK_ANIMATION_THRESHOLD = 200; * @return {Object} Props to pass to the element to mark as a block. */ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) { - const { clientId, className, wrapperProps = {} } = useContext( + const { clientId, className, wrapperProps = {}, isAligned } = useContext( BlockListBlockContext ); const { @@ -141,7 +141,9 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) { 'data-title': blockTitle, className: classnames( // The wp-block className is important for editor styles. - 'wp-block block-editor-block-list__block', + classnames( 'block-editor-block-list__block', { + 'wp-block': ! isAligned, + } ), className, props.className, wrapperProps.className, diff --git a/packages/block-editor/src/utils/dom.js b/packages/block-editor/src/utils/dom.js index 3a6db1685aebb1..4416f8eb4861e8 100644 --- a/packages/block-editor/src/utils/dom.js +++ b/packages/block-editor/src/utils/dom.js @@ -1,6 +1,4 @@ -// Consider the block appender to be a child block of its own, which also has -// this class. -const BLOCK_SELECTOR = '.wp-block'; +const BLOCK_SELECTOR = '.block-editor-block-list__block'; /** * Returns true if two elements are contained within the same block. diff --git a/packages/block-library/src/navigation/edit.js b/packages/block-library/src/navigation/edit.js index 0796971e8f9a1a..d4b6cd57b497b5 100644 --- a/packages/block-library/src/navigation/edit.js +++ b/packages/block-library/src/navigation/edit.js @@ -197,10 +197,15 @@ export default compose( [ const selectedBlockHasDescendants = !! getClientIdsOfDescendants( [ selectedBlockId, ] )?.length; + return { isImmediateParentOfSelectedBlock, selectedBlockHasDescendants, hasExistingNavItems: !! innerBlocks.length, + + // This prop is already available but computing it here ensures it's + // fresh compared to isImmediateParentOfSelectedBlock + isSelected: selectedBlockId === clientId, }; } ), withDispatch( ( dispatch, { clientId } ) => { From ee11c0b143f05f6a5f63973a19ee22bea81e8f5e Mon Sep 17 00:00:00 2001 From: mrleemon Date: Mon, 7 Jun 2021 11:58:46 +0200 Subject: [PATCH 13/22] Fix typos (#32480) --- packages/core-data/src/resolvers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index 4b61b8f0b63631..e9aabbae6ce0d0 100644 --- a/packages/core-data/src/resolvers.js +++ b/packages/core-data/src/resolvers.js @@ -92,7 +92,7 @@ export function* getEntityRecord( kind, name, key = '', query ) { ); try { if ( query !== undefined && query._fields ) { - // If requesting specific fields, items and query assocation to said + // If requesting specific fields, items and query association to said // records are stored by ID reference. Thus, fields must always include // the ID. query = { @@ -181,7 +181,7 @@ export function* getEntityRecords( kind, name, query = {} ) { ); try { if ( query._fields ) { - // If requesting specific fields, items and query assocation to said + // If requesting specific fields, items and query association to said // records are stored by ID reference. Thus, fields must always include // the ID. query = { From 152420f8d3b49163d46be9e42111dbb1893eab3f Mon Sep 17 00:00:00 2001 From: Hiroshi Urabe Date: Mon, 7 Jun 2021 19:03:09 +0900 Subject: [PATCH 14/22] Fixed loss of list content when switching list types. (#32432) * add `value` to dependencies * Add the variables used in setRecordFromProps to dependencies. * use _value.current instead of value * revert change * add tagName to __unstableDependencies * add e2e test. * format * fix snapshot --- .../src/components/rich-text/index.js | 2 +- .../blocks/__snapshots__/list.test.js.snap | 4 +++ .../specs/editor/blocks/list.test.js | 32 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index d0a98d61566a65..34e5a3f963aaab 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -229,7 +229,7 @@ function RichTextWrapper( __unstableMultilineTag: multilineTag, __unstableDisableFormats: disableFormats, preserveWhiteSpace, - __unstableDependencies: dependencies, + __unstableDependencies: [ ...dependencies, tagName ], __unstableAfterParse: addEditorOnlyFormats, __unstableBeforeSerialize: removeEditorOnlyFormats, __unstableAddInvisibleFormats: addInvisibleFormats, diff --git a/packages/e2e-tests/specs/editor/blocks/__snapshots__/list.test.js.snap b/packages/e2e-tests/specs/editor/blocks/__snapshots__/list.test.js.snap index c2421bc8c80e2f..a07d125536586f 100644 --- a/packages/e2e-tests/specs/editor/blocks/__snapshots__/list.test.js.snap +++ b/packages/e2e-tests/specs/editor/blocks/__snapshots__/list.test.js.snap @@ -200,6 +200,10 @@ exports[`List should insert a line break on shift+enter in a non trailing list i " `; +exports[`List should not change the contents when you change the list type to Unordered 1`] = `"
  • a
  • b
  • c
  • "`; + +exports[`List should not change the contents when you change the list type to Ordered 1`] = `"
  • 1
  • 2
  • 3
  • "`; + exports[`List should not indent list on space with modifier 1`] = ` "
    • 1
    diff --git a/packages/e2e-tests/specs/editor/blocks/list.test.js b/packages/e2e-tests/specs/editor/blocks/list.test.js index ddc115e2195c45..b75f79bb7af532 100644 --- a/packages/e2e-tests/specs/editor/blocks/list.test.js +++ b/packages/e2e-tests/specs/editor/blocks/list.test.js @@ -507,4 +507,36 @@ describe( 'List', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); } ); + + it( 'should not change the contents when you change the list type to Ordered', async () => { + await clickBlockAppender(); + await page.keyboard.type( '* 1' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( '2' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( '3' ); + await clickBlockToolbarButton( 'Ordered' ); + + const content = await page.$eval( + '.wp-block-list', + ( el ) => el.innerHTML + ); + expect( content ).toMatchSnapshot(); + } ); + + it( 'should not change the contents when you change the list type to Unordered', async () => { + await clickBlockAppender(); + await page.keyboard.type( '1. a' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( 'b' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( 'c' ); + await clickBlockToolbarButton( 'Unordered' ); + + const content = await page.$eval( + '.wp-block-list', + ( el ) => el.innerHTML + ); + expect( content ).toMatchSnapshot(); + } ); } ); From 75e26262eb29e4350faf3b55908085d77bc00fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Bi=C5=88ovec?= Date: Mon, 7 Jun 2021 12:10:40 +0200 Subject: [PATCH 15/22] Fix the docblock in core/loginout package (#32158) The docblock related to `register_block_core_loginout` function refers to `core/latest-posts`, while it should be using the `core/loginout` similarly to the `render_block_core_loginout` function in the same file. This comit updates the reference the way it matches the block in question. --- packages/block-library/src/loginout/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/loginout/index.php b/packages/block-library/src/loginout/index.php index c9c23cf90b7b96..ac10ced20f3d1b 100644 --- a/packages/block-library/src/loginout/index.php +++ b/packages/block-library/src/loginout/index.php @@ -38,7 +38,7 @@ function render_block_core_loginout( $attributes ) { } /** - * Registers the `core/latest-posts` block on server. + * Registers the `core/loginout` block on server. */ function register_block_core_loginout() { register_block_type_from_metadata( From eff93de3859cc02719937701a7a93c7a1bde4dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor?= <27339341+priethor@users.noreply.github.com> Date: Mon, 7 Jun 2021 12:30:20 +0200 Subject: [PATCH 16/22] Handbook: Detail the Gutenberg release post process (#32429) * Handbook: Detail the Gutenberg release post process * Fix typo. --- docs/contributors/code/release.md | 32 ++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/docs/contributors/code/release.md b/docs/contributors/code/release.md index 07bee7bd6f7a2b..e3bbb225e7e1fa 100644 --- a/docs/contributors/code/release.md +++ b/docs/contributors/code/release.md @@ -50,22 +50,44 @@ Once released, all that's left to do is writing a release post on [make.wordpres ### Writing the Release Notes and Post +Documenting the release is comprised of the following steps: +1. Curating the changelog +2. Selecting the release highlights +3. Drafting the release post +4. Running the performance tests +5. Publishing the post + +#### 1. Curating the changelog The release notes draft is auto-generated by a script that looks for pull requests for the current milestone, and groups them by pull request label. -This is intended to be a starting point for release notes; you will still want to manually review and curate the changelog entries. +This is intended to be a starting point for release notes; you will still want to manually review and curate the changelog entries. Because the release candidate changelog is reused in the stable release and it can be a time-consuming process, it is recommended to start this process as soon as the milestone is closed and the release candidate is published. Guidelines for proof-reading include: -- Fix spelling errors or clarify wording. Phrasing should be easy to understand where the intended audience are those who use the plugin or are keeping up with ongoing development. +- Fix spelling errors or clarify wording. Phrasing should be easy to understand where the intended audience is those who use the plugin or are keeping up with ongoing development. - Create new groupings as applicable, and move pull requests between. - When multiple pull requests relate to the same task (such as a follow-up pull request), try to combine them to a single entry. - If subtasks of a related set of pull requests are substantial, consider organizing as entries in a nested list. +- If one or more pull requests revert one or more pull requests in the same release netting a zero-sum of code changes, remove them. - Remove mobile app pull request entries. -Once you have cleaned up the changelog, choose a few features to highlight in the release post and record an animation of them in use. +#### 2. Selecting the release highlights +Once you have cleaned up the changelog, the next step is to choose a few changes to highlight in the release post. These highlights usually focus on new features and enhancements, including performance and accessibility ones, but can also include important API changes or critical bug fixes. -You should also include a performance audit at the end of the release post. You can use `bin/plugin/cli.js perf` to automatically do this. +Given the big scope of Gutenberg and the high number of pull requests merged in each milestone, it is not uncommon to overlook impactful changes worth highlighting; it is recommended to make this step a collaborative effort and share your picks with the Gutenberg Core team. -Compile this to a draft post on [make.wordpress.org/core](https://make.wordpress.org/core/); this post should be published after the actual release. +#### 3. Drafting the release post + +When possible, the highlighted changes in the release post should include an animation (video or GIF) or a static image of them in use. Choosing between an animation or a static image will depend on the best way to showcase each highlight: while animations are better to demonstrate workflows, more direct highlights can be shown with an image; having too many video players adds a layer of friction for users to see the highlight, whereas too many simultaneous animated GIFs can distract and overwhelm the reader. + +These visual assets should maintain consistency with previous release posts; using lean, white themes helps in this regard and visually integrate well with the [make.wordpress.org/core](https://make.wordpress.org/core/) blog aesthetics. Including copyrighted material should be avoided, and browser plugins that can be seen in the browser canvas (spell checkers, form fillers, etc.) disabled when capturing the assets. If you would like help creating the visual assets, please ping somebody in the Gutenberg Core team in advance so that it can be planned for. + +#### 4. Running the performance tests + +Your post should also include a performance audit at the end, comparing the current Gutenberg release with both the previous one and the latest WordPress major version. You can use `bin/plugin/cli.js perf` to automatically do this for you by passing as parameters the tags to run the performance suite against, such as `bin/plugin/cli.js perf release/x.y release/x.z wp/a.b` + +#### 5. Publishing the post + +Compile this to a draft post on [make.wordpress.org/core](https://make.wordpress.org/core/); this post should be published after the actual release. Remember asking for peer review is encouraged by the [make/core posting guidelines](https://make.wordpress.org/core/handbook/best-practices/post-comment-guidelines/#peer-review)! If you don't have access to [make.wordpress.org/core](https://make.wordpress.org/core/), ping someone on the Gutenberg Core team in the [WordPress #core-editor Slack channel](https://wordpress.slack.com/messages/C02QB2JS7) to publish the post. From 0389b5ae74c741e967dbd02a28e2833a4266c039 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Mon, 7 Jun 2021 10:31:19 +0000 Subject: [PATCH 17/22] Update Changelog for 10.7.3 --- changelog.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog.txt b/changelog.txt index 0ed5d3cff9b040..51206319e5aa21 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,12 @@ == Changelog == += 10.7.3 = + +### Bug Fixes + +- Fix alligned blocks. ([32454](https://github.com/WordPress/gutenberg/pull/32454)) + + = 10.7.2 = ### Bug Fixes From 15b3da661673e1ae811aa65c323b80d3d2b361cd Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Mon, 7 Jun 2021 20:48:51 +1000 Subject: [PATCH 18/22] Fix inspector opening on click outside widget area (#32450) --- .../edit-widgets/src/components/sidebar/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/edit-widgets/src/components/sidebar/index.js b/packages/edit-widgets/src/components/sidebar/index.js index 9f643c2ad9852d..7101d2daca1532 100644 --- a/packages/edit-widgets/src/components/sidebar/index.js +++ b/packages/edit-widgets/src/components/sidebar/index.js @@ -78,17 +78,17 @@ export default function Sidebar() { const selectedBlock = getSelectedBlock(); - let activeArea = getActiveComplementaryArea( editWidgetsStore.name ); - if ( ! activeArea ) { + const activeArea = getActiveComplementaryArea( editWidgetsStore.name ); + + let currentSelection = activeArea; + if ( ! currentSelection ) { if ( selectedBlock ) { - activeArea = BLOCK_INSPECTOR_IDENTIFIER; + currentSelection = BLOCK_INSPECTOR_IDENTIFIER; } else { - activeArea = WIDGET_AREAS_IDENTIFIER; + currentSelection = WIDGET_AREAS_IDENTIFIER; } } - const isSidebarOpen = !! activeArea; - let widgetAreaBlock; if ( selectedBlock ) { if ( selectedBlock.name === 'core/widget-area' ) { @@ -104,11 +104,11 @@ export default function Sidebar() { } return { - currentArea: activeArea, + currentArea: currentSelection, hasSelectedNonAreaBlock: !! ( selectedBlock && selectedBlock.name !== 'core/widget-area' ), - isGeneralSidebarOpen: isSidebarOpen, + isGeneralSidebarOpen: !! activeArea, selectedWidgetAreaBlock: widgetAreaBlock, }; }, [] ); From 2cae3a541b62bf8cc513764d09d9e5a480580c59 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Mon, 7 Jun 2021 14:00:28 +0300 Subject: [PATCH 19/22] Show all heading levels in toolbar group (#32483) --- packages/block-library/src/heading/editor.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/block-library/src/heading/editor.scss b/packages/block-library/src/heading/editor.scss index 051a2827139f5d..a1af2ba3702442 100644 --- a/packages/block-library/src/heading/editor.scss +++ b/packages/block-library/src/heading/editor.scss @@ -14,4 +14,7 @@ // level toolbar. .block-library-heading-level-toolbar { border: none; + .components-toolbar-group { + flex-wrap: nowrap; + } } From a85275013f16d56b910a20672d9a7367fd7e783f Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 7 Jun 2021 12:07:53 +0100 Subject: [PATCH 20/22] Avoid keeping the same client ID when transforming blocks (#32453) * Avoid keeping the same client ID when transforming blocks * Fix unit tests --- packages/blocks/src/api/factory.js | 22 +++++++--------------- packages/blocks/src/api/test/factory.js | 4 ---- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/packages/blocks/src/api/factory.js b/packages/blocks/src/api/factory.js index f01edef37f4f48..a0fab5c32cd39c 100644 --- a/packages/blocks/src/api/factory.js +++ b/packages/blocks/src/api/factory.js @@ -5,7 +5,7 @@ import { v4 as uuid } from 'uuid'; import { every, castArray, - findIndex, + some, isObjectLike, filter, first, @@ -538,28 +538,18 @@ export function switchToBlockType( blocks, name ) { return null; } - const firstSwitchedBlock = findIndex( + const hasSwitchedBlock = some( transformationResults, ( result ) => result.name === name ); // Ensure that at least one block object returned by the transformation has // the expected "destination" block type. - if ( firstSwitchedBlock < 0 ) { + if ( ! hasSwitchedBlock ) { return null; } - return transformationResults.map( ( result, index ) => { - const transformedBlock = { - ...result, - // The first transformed block whose type matches the "destination" - // type gets to keep the existing client ID of the first block. - clientId: - index === firstSwitchedBlock - ? firstBlock.clientId - : result.clientId, - }; - + const ret = transformationResults.map( ( result ) => { /** * Filters an individual transform result from block transformation. * All of the original blocks are passed, since transformations are @@ -570,10 +560,12 @@ export function switchToBlockType( blocks, name ) { */ return applyFilters( 'blocks.switchToBlockType.transformedBlock', - transformedBlock, + result, blocks ); } ); + + return ret; } /** diff --git a/packages/blocks/src/api/test/factory.js b/packages/blocks/src/api/test/factory.js index a840f65135cc61..fc38d753e997b6 100644 --- a/packages/blocks/src/api/test/factory.js +++ b/packages/blocks/src/api/test/factory.js @@ -1537,15 +1537,11 @@ describe( 'block factory', () => { // to keep the existing block's client ID. expect( transformedBlocks ).toHaveLength( 2 ); expect( transformedBlocks[ 0 ] ).toHaveProperty( 'clientId' ); - expect( transformedBlocks[ 0 ].clientId ).not.toBe( - block.clientId - ); expect( transformedBlocks[ 0 ].name ).toBe( 'core/text-block' ); expect( transformedBlocks[ 0 ].isValid ).toBe( true ); expect( transformedBlocks[ 0 ].attributes ).toEqual( { value: 'chicken ribs', } ); - expect( transformedBlocks[ 1 ].clientId ).toBe( block.clientId ); expect( transformedBlocks[ 1 ] ).toHaveProperty( 'clientId' ); expect( transformedBlocks[ 1 ].name ).toBe( 'core/updated-text-block' From 175a08fa64a17436cb341b82adaf482a26431a05 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 7 Jun 2021 13:23:27 +0100 Subject: [PATCH 21/22] chore(release): publish - @wordpress/base-styles@3.5.2 - @wordpress/block-directory@2.1.4 - @wordpress/block-editor@6.1.2 - @wordpress/block-library@3.2.3 - @wordpress/blocks@9.1.2 - @wordpress/components@14.1.2 - @wordpress/core-data@3.1.3 - @wordpress/customize-widgets@1.0.3 - @wordpress/e2e-tests@2.2.3 - @wordpress/edit-navigation@1.9.2 - @wordpress/edit-post@4.1.4 - @wordpress/edit-site@2.1.4 - @wordpress/edit-widgets@2.1.4 - @wordpress/editor@10.1.3 - @wordpress/format-library@2.1.2 - @wordpress/interface@3.1.2 - @wordpress/list-reusable-blocks@2.1.2 - @wordpress/nux@4.1.2 - @wordpress/postcss-plugins-preset@3.1.2 - @wordpress/react-native-editor@1.53.3 - @wordpress/reusable-blocks@2.1.3 - @wordpress/scripts@16.1.2 - @wordpress/server-side-render@2.1.2 - @wordpress/widgets@1.1.3 --- packages/base-styles/package.json | 2 +- packages/block-directory/package.json | 2 +- packages/block-editor/package.json | 2 +- packages/block-library/package.json | 2 +- packages/blocks/package.json | 2 +- packages/components/package.json | 2 +- packages/core-data/package.json | 2 +- packages/customize-widgets/package.json | 2 +- packages/e2e-tests/package.json | 2 +- packages/edit-navigation/package.json | 2 +- packages/edit-post/package.json | 2 +- packages/edit-site/package.json | 2 +- packages/edit-widgets/package.json | 2 +- packages/editor/package.json | 2 +- packages/format-library/package.json | 2 +- packages/interface/package.json | 2 +- packages/list-reusable-blocks/package.json | 2 +- packages/nux/package.json | 2 +- packages/postcss-plugins-preset/package.json | 2 +- packages/reusable-blocks/package.json | 2 +- packages/scripts/package.json | 2 +- packages/server-side-render/package.json | 2 +- packages/widgets/package.json | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index a35b05ea285d1e..53dd9b775e74e5 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "3.5.1", + "version": "3.5.2", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index 52c904e753c0f9..93412110696ec3 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "2.1.3", + "version": "2.1.4", "description": "Extend editor with block directory features to search, download and install blocks.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index 0b850af2432190..08b2584a502619 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "6.1.1", + "version": "6.1.2", "description": "Generic block editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 5c0010b0ec52ec..367c3b9c450a0a 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "3.2.2", + "version": "3.2.3", "description": "Block library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blocks/package.json b/packages/blocks/package.json index 2ecb3a5b03f9f5..a48af0e56d5ea7 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "9.1.1", + "version": "9.1.2", "description": "Block API for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/components/package.json b/packages/components/package.json index e0e932c2639716..b84b3d70ca9d95 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "14.1.1", + "version": "14.1.2", "description": "UI components for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/core-data/package.json b/packages/core-data/package.json index c16e50e9dfec32..43bdc29d2d8f19 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "3.1.2", + "version": "3.1.3", "description": "Access to and manipulation of core WordPress entities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json index 4663c747a20e01..20230c41a918c4 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "1.0.2", + "version": "1.0.3", "description": "Widgets blocks in Customizer Module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index bce64afc3de1e9..e1015a74fc8be5 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "2.2.2", + "version": "2.2.3", "description": "End-To-End (E2E) tests for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-navigation/package.json b/packages/edit-navigation/package.json index 8ef55c65a754e2..3d9fe367b8be6c 100644 --- a/packages/edit-navigation/package.json +++ b/packages/edit-navigation/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-navigation", - "version": "1.9.1", + "version": "1.9.2", "private": true, "description": "Module for the Navigation page in WordPress.", "author": "The WordPress Contributors", diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json index c48754808c516a..393a7aa95415bd 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-post", - "version": "4.1.3", + "version": "4.1.4", "description": "Edit Post module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json index 28ed0b1c76f35a..adc02a0b2504e6 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-site", - "version": "2.1.3", + "version": "2.1.4", "description": "Edit Site Page module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json index 947f4123aa0610..4368a805fab6fe 100644 --- a/packages/edit-widgets/package.json +++ b/packages/edit-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-widgets", - "version": "2.1.3", + "version": "2.1.4", "description": "Widgets Page module for WordPress..", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/editor/package.json b/packages/editor/package.json index f6649d63309b61..74e9b3dd5491eb 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/editor", - "version": "10.1.2", + "version": "10.1.3", "description": "Enhanced block editor for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/format-library/package.json b/packages/format-library/package.json index 3288b46fb25ca6..57ae566a838398 100644 --- a/packages/format-library/package.json +++ b/packages/format-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/format-library", - "version": "2.1.1", + "version": "2.1.2", "description": "Format library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/interface/package.json b/packages/interface/package.json index a8b7c50fe29737..d787f3df8a7729 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/interface", - "version": "3.1.1", + "version": "3.1.2", "description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json index 606990ffd8da93..5b23f96d369cb1 100644 --- a/packages/list-reusable-blocks/package.json +++ b/packages/list-reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/list-reusable-blocks", - "version": "2.1.1", + "version": "2.1.2", "description": "Adding Export/Import support to the reusable blocks listing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/nux/package.json b/packages/nux/package.json index 416194b1bfbdfd..5bfc0cdecfee4c 100644 --- a/packages/nux/package.json +++ b/packages/nux/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/nux", - "version": "4.1.1", + "version": "4.1.2", "description": "NUX (New User eXperience) module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/postcss-plugins-preset/package.json b/packages/postcss-plugins-preset/package.json index 59bb26a2d09d33..dd98955ad5c603 100644 --- a/packages/postcss-plugins-preset/package.json +++ b/packages/postcss-plugins-preset/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-plugins-preset", - "version": "3.1.1", + "version": "3.1.2", "description": "PostCSS sharable plugins preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json index db980f985e56d4..8263dd6527dbb6 100644 --- a/packages/reusable-blocks/package.json +++ b/packages/reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/reusable-blocks", - "version": "2.1.2", + "version": "2.1.3", "description": "Reusable blocks utilities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/scripts/package.json b/packages/scripts/package.json index bd00e1ac37598f..60a7aa53ab6b85 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/scripts", - "version": "16.1.1", + "version": "16.1.2", "description": "Collection of reusable scripts for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json index 36be72ac1f7a64..2887a7fd7372fe 100644 --- a/packages/server-side-render/package.json +++ b/packages/server-side-render/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/server-side-render", - "version": "2.1.1", + "version": "2.1.2", "description": "The component used with WordPress to server-side render a preview of dynamic blocks to display in the editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/widgets/package.json b/packages/widgets/package.json index 1bbf7d0d64de5a..d43d74297013d0 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/widgets", - "version": "1.1.2", + "version": "1.1.3", "description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", From 45525b391d394a2d41cf1ec841a1cf237d453737 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Fri, 4 Jun 2021 10:56:45 +0300 Subject: [PATCH 22/22] fix conditionally adding skipLink --- lib/full-site-editing/templates.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/full-site-editing/templates.php b/lib/full-site-editing/templates.php index 13e9885eafd0d2..418b534a3eaf6a 100644 --- a/lib/full-site-editing/templates.php +++ b/lib/full-site-editing/templates.php @@ -188,10 +188,16 @@ function gutenberg_the_skip_link() { return; } - // Early exit if not an FSE theme. + // Early exit if not a block theme. if ( ! gutenberg_supports_block_templates() ) { return; } + + // Early exit if not a block template. + global $_wp_current_template_content; + if ( ! $_wp_current_template_content ) { + return; + } ?>