diff --git a/lib/compat/wordpress-5.9/default-editor-styles.php b/lib/compat/wordpress-5.9/default-editor-styles.php
new file mode 100644
index 00000000000000..9ad83c1b19f8e0
--- /dev/null
+++ b/lib/compat/wordpress-5.9/default-editor-styles.php
@@ -0,0 +1,38 @@
+ file_get_contents( $default_editor_styles_file ),
+ ),
+ );
+
+ // Remove the default font addition from Core Code.
+ $styles_without_core_styles = array();
+ if ( isset( $settings['styles'] ) ) {
+ foreach ( $settings['styles'] as $style ) {
+ if ( 'core' !== $style['__unstableType'] ) {
+ $styles_without_core_styles[] = $style;
+ }
+ }
+ }
+ $settings['styles'] = $styles_without_core_styles;
+
+ return $settings;
+}
+add_filter( 'block_editor_settings_all', 'gutenberg_extend_block_editor_settings_with_default_editor_styles' );
diff --git a/lib/global-styles.php b/lib/global-styles.php
index 9469b79d06448d..59e392830517bc 100644
--- a/lib/global-styles.php
+++ b/lib/global-styles.php
@@ -139,15 +139,17 @@ function_exists( 'gutenberg_is_edit_site_page' ) &&
}
// Reset existing global styles.
- foreach ( $settings['styles'] as $key => $style ) {
- if ( isset( $style['__unstableType'] ) && 'globalStyles' === $style['__unstableType'] ) {
- unset( $settings['styles'][ $key ] );
+ $styles_without_existing_global_styles = array();
+ foreach ( $settings['styles'] as $style ) {
+ if ( ! isset( $style['__unstableType'] ) || 'globalStyles' !== $style['__unstableType'] ) {
+ $styles_without_existing_global_styles[] = $style;
}
}
// Add the new ones.
- $settings['styles'][] = $css_variables;
- $settings['styles'][] = $block_styles;
+ $styles_without_existing_global_styles[] = $css_variables;
+ $styles_without_existing_global_styles[] = $block_styles;
+ $settings['styles'] = $styles_without_existing_global_styles;
}
// Copied from get_block_editor_settings() at wordpress-develop/block-editor.php.
diff --git a/lib/load.php b/lib/load.php
index 57692dc37319ca..096fe553d95e13 100644
--- a/lib/load.php
+++ b/lib/load.php
@@ -83,6 +83,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat.php';
require __DIR__ . '/compat/wordpress-5.8/index.php';
require __DIR__ . '/compat/wordpress-5.8.1/index.php';
+require __DIR__ . '/compat/wordpress-5.9/default-editor-styles.php';
require __DIR__ . '/utils.php';
require __DIR__ . '/editor-settings.php';
diff --git a/packages/base-styles/CHANGELOG.md b/packages/base-styles/CHANGELOG.md
index 7faa28d3063d59..cdb47947993e64 100644
--- a/packages/base-styles/CHANGELOG.md
+++ b/packages/base-styles/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### Breaking Change
+
+- Remove the background-colors, foreground-colors, and gradient-colors mixins.
+
## 2.0.0 (2020-07-07)
### Breaking Changes
diff --git a/packages/base-styles/_mixins.scss b/packages/base-styles/_mixins.scss
index fed727e4e4a6e1..f3e24b1f99d621 100644
--- a/packages/base-styles/_mixins.scss
+++ b/packages/base-styles/_mixins.scss
@@ -479,186 +479,48 @@
}
}
-@mixin background-colors() {
- .has-pale-pink-background-color {
- background-color: #f78da7;
- }
-
- .has-vivid-red-background-color {
- background-color: #cf2e2e;
- }
-
- .has-luminous-vivid-orange-background-color {
- background-color: #ff6900;
- }
-
- .has-luminous-vivid-amber-background-color {
- background-color: #fcb900;
- }
-
- .has-light-green-cyan-background-color {
- background-color: #7bdcb5;
- }
-
- .has-vivid-green-cyan-background-color {
- background-color: #00d084;
- }
-
- .has-pale-cyan-blue-background-color {
- background-color: #8ed1fc;
- }
-
- .has-vivid-cyan-blue-background-color {
- background-color: #0693e3;
- }
-
- .has-vivid-purple-background-color {
- background-color: #9b51e0;
- }
-
- .has-white-background-color {
- background-color: #fff;
- }
-
- // Deprecated from UI, kept for back-compat.
+// Deprecated from UI, kept for back-compat.
+@mixin background-colors-deprecated() {
.has-very-light-gray-background-color {
background-color: #eee;
}
- .has-cyan-bluish-gray-background-color {
- background-color: #abb8c3;
- }
-
- // Deprecated from UI, kept for back-compat.
.has-very-dark-gray-background-color {
background-color: #313131;
}
-
- .has-black-background-color {
- background-color: #000;
- }
}
-@mixin foreground-colors() {
- .has-pale-pink-color {
- color: #f78da7;
- }
-
- .has-vivid-red-color {
- color: #cf2e2e;
- }
-
- .has-luminous-vivid-orange-color {
- color: #ff6900;
- }
-
- .has-luminous-vivid-amber-color {
- color: #fcb900;
- }
-
- .has-light-green-cyan-color {
- color: #7bdcb5;
- }
-
- .has-vivid-green-cyan-color {
- color: #00d084;
- }
-
- .has-pale-cyan-blue-color {
- color: #8ed1fc;
- }
-
- .has-vivid-cyan-blue-color {
- color: #0693e3;
- }
-
- .has-vivid-purple-color {
- color: #9b51e0;
- }
-
- .has-white-color {
- color: #fff;
- }
-
- // Deprecated from UI, kept for back-compat.
+// Deprecated from UI, kept for back-compat.
+@mixin foreground-colors-deprecated() {
.has-very-light-gray-color {
color: #eee;
}
- .has-cyan-bluish-gray-color {
- color: #abb8c3;
- }
-
- // Deprecated from UI, kept for back-compat.
.has-very-dark-gray-color {
color: #313131;
}
-
- .has-black-color {
- color: #000;
- }
}
-@mixin gradient-colors() {
- // Our classes uses the same values we set for gradient value attributes, and we can not use spacing because of WP multi site kses rule.
+// Deprecated from UI, kept for back-compat.
+@mixin gradient-colors-deprecated() {
+ /*
+ * Our classes uses the same values we set for gradient value attributes,
+ * and we can not use spacing because of WP multi site kses rule.
+ */
/* stylelint-disable function-comma-space-after */
- .has-vivid-cyan-blue-to-vivid-purple-gradient-background {
- background: linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%);
- }
-
.has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background {
background: linear-gradient(135deg,rgba(0,208,132,1) 0%,rgba(6,147,227,1) 100%);
}
- .has-light-green-cyan-to-vivid-green-cyan-gradient-background {
- background: linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%);
- }
-
- .has-luminous-vivid-amber-to-luminous-vivid-orange-gradient-background {
- background: linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%);
- }
-
- .has-luminous-vivid-orange-to-vivid-red-gradient-background {
- background: linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%);
- }
-
- .has-very-light-gray-to-cyan-bluish-gray-gradient-background {
- background: linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%);
- }
-
- .has-cool-to-warm-spectrum-gradient-background {
- background: linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%);
- }
-
- .has-blush-light-purple-gradient-background {
- background: linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%);
- }
-
- .has-blush-bordeaux-gradient-background {
- background: linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%);
- }
-
.has-purple-crush-gradient-background {
background: linear-gradient(135deg,rgb(52,226,228) 0%,rgb(71,33,251) 50%,rgb(171,29,254) 100%);
}
- .has-luminous-dusk-gradient-background {
- background: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%);
- }
-
.has-hazy-dawn-gradient-background {
background: linear-gradient(135deg,rgb(250,172,168) 0%,rgb(218,208,236) 100%);
}
- .has-pale-ocean-gradient-background {
- background: linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%);
- }
-
- .has-electric-grass-gradient-background {
- background: linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%);
- }
-
.has-subdued-olive-gradient-background {
background: linear-gradient(135deg,rgb(250,250,225) 0%,rgb(103,166,113) 100%);
}
diff --git a/packages/block-editor/src/components/block-edit/edit.js b/packages/block-editor/src/components/block-edit/edit.js
index 0746699eb145dc..94b1adb4741095 100644
--- a/packages/block-editor/src/components/block-edit/edit.js
+++ b/packages/block-editor/src/components/block-edit/edit.js
@@ -51,10 +51,7 @@ export const Edit = ( props ) => {
// them preferentially as the render value for the block.
const Component = blockType.edit || blockType.save;
- if (
- blockType.apiVersion > 1 ||
- hasBlockSupport( blockType, 'lightBlockWrapper', false )
- ) {
+ if ( blockType.apiVersion > 1 ) {
return ;
}
diff --git a/packages/block-editor/src/components/block-list/block.js b/packages/block-editor/src/components/block-list/block.js
index c30921c4771347..960e3a6117297c 100644
--- a/packages/block-editor/src/components/block-list/block.js
+++ b/packages/block-editor/src/components/block-list/block.js
@@ -17,7 +17,6 @@ import {
getBlockType,
getSaveContent,
isUnmodifiedDefaultBlock,
- hasBlockSupport,
} from '@wordpress/blocks';
import { withFilters } from '@wordpress/components';
import { withDispatch, withSelect, useDispatch } from '@wordpress/data';
@@ -110,9 +109,6 @@ function BlockListBlock( {
);
const blockType = getBlockType( name );
- const lightBlockWrapper =
- blockType?.apiVersion > 1 ||
- hasBlockSupport( blockType, 'lightBlockWrapper', false );
// Determine whether the block has props to apply to the wrapper.
if ( blockType?.getEditWrapperProps ) {
@@ -159,7 +155,7 @@ function BlockListBlock( {
>
);
- } else if ( lightBlockWrapper ) {
+ } else if ( blockType?.apiVersion > 1 ) {
block = blockEdit;
} else {
block = { blockEdit };
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 ff6c46c7948f40..4801e52709c96b 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
@@ -11,7 +11,6 @@ import { __, sprintf } from '@wordpress/i18n';
import {
__unstableGetBlockProps as getBlockProps,
getBlockType,
- hasBlockSupport,
} from '@wordpress/blocks';
import { useMergeRefs } from '@wordpress/compose';
import { useSelect } from '@wordpress/data';
@@ -68,11 +67,11 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
index,
mode,
name,
+ blockApiVersion,
blockTitle,
isPartOfSelection,
adjustScrolling,
enableAnimation,
- lightBlockWrapper,
} = useSelect(
( select ) => {
const {
@@ -99,6 +98,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
index: getBlockIndex( clientId, rootClientId ),
mode: getBlockMode( clientId ),
name: blockName,
+ blockApiVersion: blockType?.apiVersion || 1,
blockTitle: blockType?.title,
isPartOfSelection: isSelected || isPartOfMultiSelection,
adjustScrolling:
@@ -106,9 +106,6 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
enableAnimation:
! isTyping() &&
getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
- lightBlockWrapper:
- blockType?.apiVersion > 1 ||
- hasBlockSupport( blockType, 'lightBlockWrapper', false ),
};
},
[ clientId ]
@@ -139,7 +136,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
const blockEditContext = useBlockEditContext();
// Ensures it warns only inside the `edit` implementation for the block.
- if ( ! lightBlockWrapper && clientId === blockEditContext.clientId ) {
+ if ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {
warning(
`Block type "${ name }" must support API version 2 or higher to work correctly with "useBlockProps" method.`
);
diff --git a/packages/block-editor/src/components/block-list/use-block-props/use-block-custom-class-name.js b/packages/block-editor/src/components/block-list/use-block-props/use-block-custom-class-name.js
index 9b1ea0dfa0953f..2bc250be56cb16 100644
--- a/packages/block-editor/src/components/block-list/use-block-props/use-block-custom-class-name.js
+++ b/packages/block-editor/src/components/block-list/use-block-props/use-block-custom-class-name.js
@@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { useSelect } from '@wordpress/data';
-import { hasBlockSupport, getBlockType } from '@wordpress/blocks';
+import { getBlockType } from '@wordpress/blocks';
/**
* Internal dependencies
@@ -32,9 +32,7 @@ export function useBlockCustomClassName( clientId ) {
}
const blockType = getBlockType( getBlockName( clientId ) );
- const hasLightBlockWrapper =
- blockType?.apiVersion > 1 ||
- hasBlockSupport( blockType, 'lightBlockWrapper', false );
+ const hasLightBlockWrapper = blockType?.apiVersion > 1;
if ( ! hasLightBlockWrapper ) {
return;
diff --git a/packages/block-editor/src/components/block-list/use-block-props/use-block-default-class-name.js b/packages/block-editor/src/components/block-list/use-block-props/use-block-default-class-name.js
index fa84fd8d0be1d7..7877ceb96490ca 100644
--- a/packages/block-editor/src/components/block-list/use-block-props/use-block-default-class-name.js
+++ b/packages/block-editor/src/components/block-list/use-block-props/use-block-default-class-name.js
@@ -2,11 +2,7 @@
* WordPress dependencies
*/
import { useSelect } from '@wordpress/data';
-import {
- hasBlockSupport,
- getBlockType,
- getBlockDefaultClassName,
-} from '@wordpress/blocks';
+import { getBlockType, getBlockDefaultClassName } from '@wordpress/blocks';
/**
* Internal dependencies
@@ -26,9 +22,7 @@ export function useBlockDefaultClassName( clientId ) {
( select ) => {
const name = select( blockEditorStore ).getBlockName( clientId );
const blockType = getBlockType( name );
- const hasLightBlockWrapper =
- blockType?.apiVersion > 1 ||
- hasBlockSupport( blockType, 'lightBlockWrapper', false );
+ const hasLightBlockWrapper = blockType?.apiVersion > 1;
if ( ! hasLightBlockWrapper ) {
return;
diff --git a/packages/block-editor/src/components/editor-styles/index.js b/packages/block-editor/src/components/editor-styles/index.js
index 4b0286d8eba71a..c2c5f77ff600b6 100644
--- a/packages/block-editor/src/components/editor-styles/index.js
+++ b/packages/block-editor/src/components/editor-styles/index.js
@@ -68,6 +68,7 @@ export default function EditorStyles( { styles } ) {
() => transformStyles( styles, EDITOR_STYLES_SELECTOR ),
[ styles ]
);
+
return (
<>
{ /* Use an empty style element to have a document reference,
diff --git a/packages/block-editor/src/components/font-appearance-control/index.js b/packages/block-editor/src/components/font-appearance-control/index.js
index 80b3b24357d660..711ded6b70835b 100644
--- a/packages/block-editor/src/components/font-appearance-control/index.js
+++ b/packages/block-editor/src/components/font-appearance-control/index.js
@@ -165,6 +165,10 @@ export default function FontAppearanceControl( props ) {
// Adjusts screen reader description based on styles or weights.
const getDescribedBy = () => {
+ if ( ! currentSelection ) {
+ return __( 'No selected font appearance' );
+ }
+
if ( ! hasFontStyles ) {
return sprintf(
// translators: %s: Currently selected font weight.
diff --git a/packages/block-editor/src/components/inserter/menu.native.js b/packages/block-editor/src/components/inserter/menu.native.js
index 82c8438421dcda..8b5f2b1919705e 100644
--- a/packages/block-editor/src/components/inserter/menu.native.js
+++ b/packages/block-editor/src/components/inserter/menu.native.js
@@ -201,7 +201,7 @@ function InserterMenu( {
>
}
hasNavigation
- setMinHeightToMaxHeight={ showSearchForm }
+ setMinHeightToMaxHeight={ true }
contentStyle={ styles[ 'inserter-menu__list' ] }
isFullScreen={ ! isIOS && showSearchForm }
allowDragIndicator={ true }
diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js
index fe4f20cf3d41d1..7ea9832740e4e9 100644
--- a/packages/block-editor/src/components/rich-text/index.js
+++ b/packages/block-editor/src/components/rich-text/index.js
@@ -224,7 +224,7 @@ function RichTextWrapper(
);
}
- const { value, onChange, onFocus, ref: richTextRef } = useRichText( {
+ const { value, onChange, ref: richTextRef } = useRichText( {
value: adjustedValue,
onChange( html, { __unstableFormats, __unstableText } ) {
adjustedOnChange( html );
@@ -297,6 +297,10 @@ function RichTextWrapper(
}
}
+ function onFocus() {
+ anchorRef.current.focus();
+ }
+
const TagName = tagName;
const content = (
<>
diff --git a/packages/block-editor/src/default-editor-styles.scss b/packages/block-editor/src/default-editor-styles.scss
new file mode 100644
index 00000000000000..e63291a30d7d1d
--- /dev/null
+++ b/packages/block-editor/src/default-editor-styles.scss
@@ -0,0 +1,24 @@
+/**
+ * Default editor styles.
+ *
+ * These styles are shown if a theme does not register its own editor style,
+ * a theme.json file, or has toggled off "Use theme styles" in preferences.
+ */
+
+body {
+ font-family: $default-font;
+ font-size: 18px;
+ line-height: 1.5;
+ --wp--style--block-gap: 2em;
+}
+
+p {
+ line-height: 1.8;
+}
+
+.editor-post-title__block {
+ margin-top: 2em;
+ margin-bottom: 1em;
+ font-size: 2.5em;
+ font-weight: 800;
+}
diff --git a/packages/block-editor/src/hooks/compat.js b/packages/block-editor/src/hooks/compat.js
new file mode 100644
index 00000000000000..515d26dae51645
--- /dev/null
+++ b/packages/block-editor/src/hooks/compat.js
@@ -0,0 +1,23 @@
+/**
+ * WordPress dependencies
+ */
+import { hasBlockSupport } from '@wordpress/blocks';
+import { addFilter } from '@wordpress/hooks';
+
+function migrateLightBlockWrapper( settings ) {
+ const { apiVersion = 1 } = settings;
+ if (
+ apiVersion < 2 &&
+ hasBlockSupport( settings, 'lightBlockWrapper', false )
+ ) {
+ settings.apiVersion = 2;
+ }
+
+ return settings;
+}
+
+addFilter(
+ 'blocks.registerBlockType',
+ 'core/compat/migrateLightBlockWrapper',
+ migrateLightBlockWrapper
+);
diff --git a/packages/block-editor/src/hooks/index.js b/packages/block-editor/src/hooks/index.js
index e8a976277f9702..7572b4792812fd 100644
--- a/packages/block-editor/src/hooks/index.js
+++ b/packages/block-editor/src/hooks/index.js
@@ -1,6 +1,7 @@
/**
* Internal dependencies
*/
+import './compat';
import './align';
import './anchor';
import './custom-class-name';
diff --git a/packages/block-editor/src/hooks/index.native.js b/packages/block-editor/src/hooks/index.native.js
index b0aac50354da6b..82312c905ce551 100644
--- a/packages/block-editor/src/hooks/index.native.js
+++ b/packages/block-editor/src/hooks/index.native.js
@@ -1,6 +1,7 @@
/**
* Internal dependencies
*/
+import './compat';
import './align';
import './anchor';
import './custom-class-name';
diff --git a/packages/block-editor/src/hooks/letter-spacing.js b/packages/block-editor/src/hooks/letter-spacing.js
index 6de6193fe4d814..25369ae9daaa81 100644
--- a/packages/block-editor/src/hooks/letter-spacing.js
+++ b/packages/block-editor/src/hooks/letter-spacing.js
@@ -14,7 +14,8 @@ import { cleanEmptyObject } from './utils';
* Key within block settings' supports array indicating support for letter-spacing
* e.g. settings found in `block.json`.
*/
-export const LETTER_SPACING_SUPPORT_KEY = '__experimentalLetterSpacing';
+export const LETTER_SPACING_SUPPORT_KEY =
+ 'typography.__experimentalLetterSpacing';
/**
* Inspector control panel containing the letter-spacing options.
diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md
index 709ed1182a2504..eccd2681c7d277 100644
--- a/packages/block-library/CHANGELOG.md
+++ b/packages/block-library/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### Breaking Change
+
+- Remove the background-colors, foreground-colors, and gradient-colors mixins.
+
## 5.0.0 (2021-07-29)
### Breaking Change
diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss
index 6cf9854943376d..de0dacc67815ed 100644
--- a/packages/block-library/src/common.scss
+++ b/packages/block-library/src/common.scss
@@ -3,15 +3,9 @@
// the colors override the added specificity by link states such as :hover.
:root {
- // Background colors.
- @include background-colors();
-
- // Foreground colors.
- @include foreground-colors();
-
- // Gradients
- @include gradient-colors();
-
+ @include background-colors-deprecated();
+ @include foreground-colors-deprecated();
+ @include gradient-colors-deprecated();
}
// Font sizes.
diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss
index 0b67ea4296b94c..b1919397804a24 100644
--- a/packages/block-library/src/editor.scss
+++ b/packages/block-library/src/editor.scss
@@ -48,14 +48,9 @@
@import "./term-description/editor.scss";
:root .editor-styles-wrapper {
- // Background colors.
- @include background-colors();
-
- // Foreground colors.
- @include foreground-colors();
-
- // Gradients
- @include gradient-colors();
+ @include background-colors-deprecated();
+ @include foreground-colors-deprecated();
+ @include gradient-colors-deprecated();
}
// Font sizes.
diff --git a/packages/block-library/src/site-logo/block.json b/packages/block-library/src/site-logo/block.json
index c40cfcdd2bab06..b2adec6911dc58 100644
--- a/packages/block-library/src/site-logo/block.json
+++ b/packages/block-library/src/site-logo/block.json
@@ -3,7 +3,7 @@
"name": "core/site-logo",
"title": "Site Logo",
"category": "layout",
- "description": "Useful for displaying a graphic mark, design, or symbol to represent the site. Once a site logo is set, it can be reused in different places and templates. It should not be confused with the site icon, which is the small image used in the dashboard, browser tabs, public search results, etc, to help recognize a site.",
+ "description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.",
"textdomain": "default",
"attributes": {
"align": {
diff --git a/packages/blocks/src/api/constants.js b/packages/blocks/src/api/constants.js
index ff8cf6fdb94249..2ca489dd609f51 100644
--- a/packages/blocks/src/api/constants.js
+++ b/packages/blocks/src/api/constants.js
@@ -110,7 +110,7 @@ export const __EXPERIMENTAL_STYLE_PROPERTY = {
},
letterSpacing: {
value: [ 'typography', 'letterSpacing' ],
- support: [ '__experimentalLetterSpacing' ],
+ support: [ 'typography', '__experimentalLetterSpacing' ],
},
'--wp--style--block-gap': {
value: [ 'spacing', 'blockGap' ],
diff --git a/packages/blocks/src/api/serializer.js b/packages/blocks/src/api/serializer.js
index c88828b9cda799..a5e8e679b45832 100644
--- a/packages/blocks/src/api/serializer.js
+++ b/packages/blocks/src/api/serializer.js
@@ -18,7 +18,6 @@ import {
getBlockType,
getFreeformContentHandlerName,
getUnregisteredTypeHandlerName,
- hasBlockSupport,
} from './registration';
import { isUnmodifiedDefaultBlock, normalizeBlockType } from './utils';
import BlockContentProvider from '../block-content-provider';
@@ -118,14 +117,10 @@ export function getSaveElement(
let element = save( { attributes, innerBlocks } );
- const hasLightBlockWrapper =
- blockType.apiVersion > 1 ||
- hasBlockSupport( blockType, 'lightBlockWrapper', false );
-
if (
isObject( element ) &&
hasFilter( 'blocks.getSaveContent.extraProps' ) &&
- ! hasLightBlockWrapper
+ ! ( blockType.apiVersion > 1 )
) {
/**
* Filters the props applied to the block save result element.
diff --git a/packages/components/src/custom-select-control/index.js b/packages/components/src/custom-select-control/index.js
index b1498938ab8bf4..560ac128218a34 100644
--- a/packages/components/src/custom-select-control/index.js
+++ b/packages/components/src/custom-select-control/index.js
@@ -84,7 +84,7 @@ export default function CustomSelectControl( {
const controlDescribedBy = describedBy
? describedBy
: // translators: %s: The selected option.
- sprintf( __( 'Currently selected: %s' ), selectedItem.name );
+ sprintf( __( 'Currently selected: %s' ), selectedItem?.name );
const menuProps = getMenuProps( {
className: 'components-custom-select-control__menu',
diff --git a/packages/components/src/menu-item/style.scss b/packages/components/src/menu-item/style.scss
index 0f5badd4ae3551..80f97da381947e 100644
--- a/packages/components/src/menu-item/style.scss
+++ b/packages/components/src/menu-item/style.scss
@@ -2,6 +2,15 @@
.components-menu-item__button.components-button {
width: 100%;
+ &[role="menuitemradio"],
+ &[role="menuitemcheckbox"] {
+ .components-menu-item__item:only-child {
+ // Ensure unchecked items have clearance for consistency
+ // with checked items containing an icon or shortcut.
+ padding-right: $grid-unit-60;
+ }
+ }
+
.components-menu-items__item-icon {
margin-right: -2px; // This optically balances the icon.
margin-left: $grid-unit-30;
diff --git a/packages/components/src/tools-panel/stories/index.js b/packages/components/src/tools-panel/stories/index.js
index 3f40051135857a..407b356089ed50 100644
--- a/packages/components/src/tools-panel/stories/index.js
+++ b/packages/components/src/tools-panel/stories/index.js
@@ -22,6 +22,7 @@ export default {
export const _default = () => {
const [ height, setHeight ] = useState();
+ const [ minHeight, setMinHeight ] = useState();
const [ width, setWidth ] = useState();
const resetAll = () => {
@@ -37,6 +38,18 @@ export const _default = () => {
label="Display options"
resetAll={ resetAll }
>
+ !! width }
+ label="Width"
+ onDeselect={ () => setWidth( undefined ) }
+ >
+ setWidth( next ) }
+ />
+
!! height }
@@ -50,15 +63,14 @@ export const _default = () => {
/>
!! width }
- label="Width"
- onDeselect={ () => setWidth( undefined ) }
+ hasValue={ () => !! minHeight }
+ label="Minimum height"
+ onDeselect={ () => setMinHeight( undefined ) }
>
setWidth( next ) }
+ label="Minimum height"
+ value={ minHeight }
+ onChange={ ( next ) => setMinHeight( next ) }
/>
diff --git a/packages/core-data/src/actions.js b/packages/core-data/src/actions.js
index 104cf63348a081..0cc8bdaa7aefeb 100644
--- a/packages/core-data/src/actions.js
+++ b/packages/core-data/src/actions.js
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
-import { castArray, get, isEqual, find } from 'lodash';
+import { castArray, isEqual, find } from 'lodash';
import { v4 as uuid } from 'uuid';
/**
@@ -425,8 +425,7 @@ export const saveEntityRecord = (
if (
[ 'title', 'excerpt', 'content' ].includes( key )
) {
- // Edits should be the "raw" attribute values.
- acc[ key ] = get( data[ key ], 'raw', data[ key ] );
+ acc[ key ] = data[ key ];
}
return acc;
},
@@ -461,12 +460,7 @@ export const saveEntityRecord = (
key
)
) {
- // Edits should be the "raw" attribute values.
- acc[ key ] = get(
- newRecord[ key ],
- 'raw',
- newRecord[ key ]
- );
+ acc[ key ] = newRecord[ key ];
} else if ( key === 'status' ) {
// Status is only persisted in autosaves when going from
// "auto-draft" to "draft".
@@ -477,11 +471,7 @@ export const saveEntityRecord = (
: persistedRecord.status;
} else {
// These properties are not persisted in autosaves.
- acc[ key ] = get(
- persistedRecord[ key ],
- 'raw',
- persistedRecord[ key ]
- );
+ acc[ key ] = persistedRecord[ key ];
}
return acc;
},
diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js
index e2781d1a6a4446..3f34c2a5f32bd2 100644
--- a/packages/edit-post/src/editor.js
+++ b/packages/edit-post/src/editor.js
@@ -156,7 +156,9 @@ function Editor( {
] );
const styles = useMemo( () => {
- return hasThemeStyles ? settings.styles : [];
+ return hasThemeStyles && settings.styles?.length
+ ? settings.styles
+ : settings.defaultEditorStyles;
}, [ settings, hasThemeStyles ] );
if ( ! post ) {
diff --git a/packages/edit-site/src/components/sidebar/border-panel.js b/packages/edit-site/src/components/sidebar/border-panel.js
index e7d5c801ff9355..46f8dbad535049 100644
--- a/packages/edit-site/src/components/sidebar/border-panel.js
+++ b/packages/edit-site/src/components/sidebar/border-panel.js
@@ -32,7 +32,7 @@ export function useHasBorderPanel( { supports, name } ) {
useHasBorderWidthControl( { supports, name } ),
];
- return controls.every( Boolean );
+ return controls.some( Boolean );
}
function useHasBorderColorControl( { supports, name } ) {
diff --git a/packages/rich-text/src/component/index.js b/packages/rich-text/src/component/index.js
index b10b509ef3b53f..b5c4f081490e57 100644
--- a/packages/rich-text/src/component/index.js
+++ b/packages/rich-text/src/component/index.js
@@ -120,6 +120,7 @@ export function useRichText( {
* @param {Object} newRecord The record to sync and apply.
*/
function handleChange( newRecord ) {
+ record.current = newRecord;
applyRecord( newRecord );
if ( disableFormats ) {
@@ -137,8 +138,6 @@ export function useRichText( {
} );
}
- record.current = newRecord;
-
const { start, end, formats, text } = newRecord;
// Selection must be updated first, so it is recorded in history when
@@ -178,11 +177,6 @@ export function useRichText( {
hadSelectionUpdate.current = false;
}, [ hadSelectionUpdate.current ] );
- function focus() {
- ref.current.focus();
- applyRecord( record.current );
- }
-
const mergedRefs = useMergeRefs( [
ref,
useDefaultStyle(),
@@ -218,7 +212,6 @@ export function useRichText( {
return {
value: record.current,
onChange: handleChange,
- onFocus: focus,
ref: mergedRefs,
};
}
diff --git a/packages/rich-text/src/component/use-input-and-selection.js b/packages/rich-text/src/component/use-input-and-selection.js
index 7f011f6ecb73ab..2e0eebea699112 100644
--- a/packages/rich-text/src/component/use-input-and-selection.js
+++ b/packages/rich-text/src/component/use-input-and-selection.js
@@ -224,7 +224,12 @@ export function useInputAndSelection( props ) {
}
function onFocus() {
- const { record, isSelected, onSelectionChange } = propsRef.current;
+ const {
+ record,
+ isSelected,
+ onSelectionChange,
+ applyRecord,
+ } = propsRef.current;
if ( ! isSelected ) {
// We know for certain that on focus, the old selection is invalid.
@@ -240,6 +245,7 @@ export function useInputAndSelection( props ) {
};
onSelectionChange( index, index );
} else {
+ applyRecord( record.current );
onSelectionChange( record.current.start, record.current.end );
}