diff --git a/backport-changelog/6.8/7903.md b/backport-changelog/6.8/7903.md
index cb20d8d2dd2b1b..60703831a8e391 100644
--- a/backport-changelog/6.8/7903.md
+++ b/backport-changelog/6.8/7903.md
@@ -1,3 +1,5 @@
https://github.com/WordPress/wordpress-develop/pull/7903
* https://github.com/WordPress/gutenberg/pull/67199
+* https://github.com/WordPress/gutenberg/pull/68971
+
diff --git a/backport-changelog/6.8/8245.md b/backport-changelog/6.8/8245.md
new file mode 100644
index 00000000000000..ca9bc3588c5cec
--- /dev/null
+++ b/backport-changelog/6.8/8245.md
@@ -0,0 +1,3 @@
+https://github.com/WordPress/wordpress-develop/pull/8245
+
+* https://github.com/WordPress/gutenberg/pull/68983
diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md
index 7ac8591cd19318..6a8f3255297c46 100644
--- a/docs/reference-guides/core-blocks.md
+++ b/docs/reference-guides/core-blocks.md
@@ -14,7 +14,7 @@ Display a date archive of your posts. ([Source](https://github.com/WordPress/gut
- **Name:** core/archives
- **Category:** widgets
-- **Supports:** align, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
+- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** displayAsDropdown, showLabel, showPostCounts, type
## Audio
@@ -811,7 +811,7 @@ Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPres
- **Name:** core/rss
- **Category:** widgets
-- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), ~~html~~
+- **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), ~~html~~
- **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow
## Search
diff --git a/lib/compat/wordpress-6.8/blocks.php b/lib/compat/wordpress-6.8/blocks.php
index 90be78cd1457fb..1d27215762fe42 100644
--- a/lib/compat/wordpress-6.8/blocks.php
+++ b/lib/compat/wordpress-6.8/blocks.php
@@ -217,3 +217,20 @@ function gutenberg_update_ignored_hooked_blocks_postmeta( $post ) {
add_filter( 'rest_pre_insert_page', 'gutenberg_update_ignored_hooked_blocks_postmeta' );
add_filter( 'rest_pre_insert_post', 'gutenberg_update_ignored_hooked_blocks_postmeta' );
add_filter( 'rest_pre_insert_wp_block', 'gutenberg_update_ignored_hooked_blocks_postmeta' );
+
+/**
+ * Update Query `parents` argument validation for hierarchical post types.
+ * A zero is a valid parent ID for hierarchical post types. Used to display top-level items.
+ *
+ * @param array $query The query vars.
+ * @param WP_Block $block Block instance.
+ * @return array The filtered query vars.
+ */
+function gutenberg_parents_query_vars_from_query_block( $query, $block ) {
+ if ( ! empty( $block->context['query']['parents'] ) && is_post_type_hierarchical( $query['post_type'] ) ) {
+ $query['post_parent__in'] = array_unique( array_map( 'intval', $block->context['query']['parents'] ) );
+ }
+
+ return $query;
+}
+add_filter( 'query_loop_block_query_vars', 'gutenberg_parents_query_vars_from_query_block', 10, 2 );
diff --git a/lib/compat/wordpress-6.8/site-editor.php b/lib/compat/wordpress-6.8/site-editor.php
index 9b2575676047d1..82ac118b013c16 100644
--- a/lib/compat/wordpress-6.8/site-editor.php
+++ b/lib/compat/wordpress-6.8/site-editor.php
@@ -15,6 +15,16 @@ function ( $settings ) {
}
);
+/**
+ * Maps old site editor urls to the new updated ones.
+ *
+ * @since 6.8.0
+ * @access private
+ *
+ * @global string $pagenow The filename of the current screen.
+ *
+ * @return string|false The new URL to redirect to, or false if no redirection is needed.
+ */
function gutenberg_get_site_editor_redirection() {
global $pagenow;
if ( 'site-editor.php' !== $pagenow || isset( $_REQUEST['p'] ) || ! $_SERVER['QUERY_STRING'] ) {
@@ -96,10 +106,13 @@ function gutenberg_get_site_editor_redirection() {
return add_query_arg( array( 'p' => '/' ) );
}
+/**
+ * Redirect old site editor urls to the new updated ones.
+ */
function gutenberg_redirect_site_editor_deprecated_urls() {
$redirection = gutenberg_get_site_editor_redirection();
if ( false !== $redirection ) {
- wp_redirect( $redirection, 301 );
+ wp_safe_redirect( $redirection );
exit;
}
}
diff --git a/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js b/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js
index f2344061f95660..e4d04cd244687d 100644
--- a/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js
+++ b/packages/block-directory/src/components/downloadable-blocks-panel/no-results.js
@@ -2,17 +2,12 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import { Icon, blockDefault } from '@wordpress/icons';
import { Tip, ExternalLink } from '@wordpress/components';
function DownloadableBlocksNoResults() {
return (
<>
-
{ __( 'No results found.' ) }
diff --git a/packages/block-editor/src/components/block-list/index.js b/packages/block-editor/src/components/block-list/index.js
index d3a2f0ae0795c8..61c5cc277c1355 100644
--- a/packages/block-editor/src/components/block-list/index.js
+++ b/packages/block-editor/src/components/block-list/index.js
@@ -201,6 +201,11 @@ function Items( {
getDefaultBlockName(),
rootClientId
) );
+ const hasSelectedRoot = !! (
+ rootClientId &&
+ selectedBlockClientId &&
+ rootClientId === selectedBlockClientId
+ );
return {
order: _order,
@@ -214,8 +219,8 @@ function Items( {
hasAppender &&
! _isZoomOut() &&
( hasCustomAppender ||
- showRootAppender ||
- rootClientId === selectedBlockClientId ),
+ hasSelectedRoot ||
+ showRootAppender ),
};
},
[ rootClientId, hasAppender, hasCustomAppender ]
diff --git a/packages/block-editor/src/components/global-styles/shadow-panel-components.js b/packages/block-editor/src/components/global-styles/shadow-panel-components.js
index 1cfdff0be286ee..c335ef29384f4d 100644
--- a/packages/block-editor/src/components/global-styles/shadow-panel-components.js
+++ b/packages/block-editor/src/components/global-styles/shadow-panel-components.js
@@ -13,8 +13,8 @@ import {
Composite,
Tooltip,
} from '@wordpress/components';
-import { useMemo } from '@wordpress/element';
-import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
+import { useMemo, useRef } from '@wordpress/element';
+import { shadow as shadowIcon, Icon, check, reset } from '@wordpress/icons';
/**
* External dependencies
@@ -119,7 +119,7 @@ export function ShadowPopover( { shadow, onShadowChange, settings } ) {
(
{
+ const shadowButtonRef = useRef( undefined );
+
const toggleProps = {
onClick: onToggle,
className: clsx( { 'is-open': isOpen } ),
'aria-expanded': isOpen,
+ ref: shadowButtonRef,
+ };
+
+ const removeButtonProps = {
+ onClick: () => {
+ if ( isOpen ) {
+ onToggle();
+ }
+ onShadowChange( undefined );
+ // Return focus to parent button.
+ shadowButtonRef.current?.focus();
+ },
+ className: clsx(
+ 'block-editor-global-styles__shadow-editor__remove-button',
+ { 'is-open': isOpen }
+ ),
+ label: __( 'Remove' ),
};
return (
-
+ ) }
+ >
);
};
}
diff --git a/packages/block-editor/src/components/global-styles/style.scss b/packages/block-editor/src/components/global-styles/style.scss
index c51ffa3116d9f0..5684cf9c0d3034 100644
--- a/packages/block-editor/src/components/global-styles/style.scss
+++ b/packages/block-editor/src/components/global-styles/style.scss
@@ -24,6 +24,7 @@
.block-editor-global-styles__shadow-dropdown {
display: block;
padding: 0;
+ position: relative;
button {
width: 100%;
@@ -35,6 +36,28 @@
}
}
+.block-editor-global-styles__shadow-editor__remove-button {
+ position: absolute;
+ right: 0;
+ top: $grid-unit;
+ margin: auto $grid-unit auto;
+ opacity: 0;
+ @media not (prefers-reduced-motion) {
+ transition: opacity 0.1s ease-in-out;
+ }
+
+ .block-editor-global-styles__shadow-dropdown:hover &,
+ &:focus,
+ &:hover {
+ opacity: 1;
+ }
+
+ @media (hover: none) {
+ // Show reset button on devices that do not support hover.
+ opacity: 1;
+ }
+}
+
// These styles are similar to the color palette.
.block-editor-global-styles__shadow-indicator {
appearance: none;
diff --git a/packages/block-editor/src/components/inner-blocks/index.js b/packages/block-editor/src/components/inner-blocks/index.js
index ae587720278200..58faf9f9a34e1a 100644
--- a/packages/block-editor/src/components/inner-blocks/index.js
+++ b/packages/block-editor/src/components/inner-blocks/index.js
@@ -174,11 +174,11 @@ const ForwardedInnerBlocks = forwardRef( ( props, ref ) => {
* returns. Optionally, you can also pass any other props through this hook, and
* they will be merged and returned.
*
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
+ *
* @param {Object} props Optional. Props to pass to the element. Must contain
* the ref if one is defined.
* @param {Object} options Optional. Inner blocks options.
- *
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
*/
export function useInnerBlocksProps( props = {}, options = {} ) {
const {
diff --git a/packages/block-editor/src/components/inner-blocks/index.native.js b/packages/block-editor/src/components/inner-blocks/index.native.js
index 1398a5abd51e4b..635c44d2e085c5 100644
--- a/packages/block-editor/src/components/inner-blocks/index.native.js
+++ b/packages/block-editor/src/components/inner-blocks/index.native.js
@@ -35,11 +35,11 @@ import { MAX_NESTING_DEPTH } from './constants';
* returns. Optionally, you can also pass any other props through this hook, and
* they will be merged and returned.
*
+ * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md
+ *
* @param {Object} props Optional. Props to pass to the element. Must contain
* the ref if one is defined.
* @param {Object} options Optional. Inner blocks options.
- *
- * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md
*/
export function useInnerBlocksProps( props = {}, options = {} ) {
const fallbackRef = useRef();
diff --git a/packages/block-editor/src/components/inserter/no-results.js b/packages/block-editor/src/components/inserter/no-results.js
index 3ca6569dc14ea4..e005622f3cf3dc 100644
--- a/packages/block-editor/src/components/inserter/no-results.js
+++ b/packages/block-editor/src/components/inserter/no-results.js
@@ -2,15 +2,10 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import { Icon, blockDefault } from '@wordpress/icons';
function InserterNoResults() {
return (
-
{ __( 'No results found.' ) }
);
diff --git a/packages/block-editor/src/hooks/aria-label.js b/packages/block-editor/src/hooks/aria-label.js
index 7f93aa4ff8c8b2..89de261a169385 100644
--- a/packages/block-editor/src/hooks/aria-label.js
+++ b/packages/block-editor/src/hooks/aria-label.js
@@ -4,13 +4,6 @@
import { addFilter } from '@wordpress/hooks';
import { hasBlockSupport } from '@wordpress/blocks';
-const ARIA_LABEL_SCHEMA = {
- type: 'string',
- source: 'attribute',
- attribute: 'aria-label',
- selector: '*',
-};
-
/**
* Filters registered block settings, extending attributes with ariaLabel using aria-label
* of the first node.
@@ -28,7 +21,9 @@ export function addAttribute( settings ) {
// Gracefully handle if settings.attributes is undefined.
settings.attributes = {
...settings.attributes,
- ariaLabel: ARIA_LABEL_SCHEMA,
+ ariaLabel: {
+ type: 'string',
+ },
};
}
diff --git a/packages/block-library/src/archives/block.json b/packages/block-library/src/archives/block.json
index 7fe956a994ed5a..0351a4b694c002 100644
--- a/packages/block-library/src/archives/block.json
+++ b/packages/block-library/src/archives/block.json
@@ -54,6 +54,15 @@
"fontSize": true
}
},
+ "color": {
+ "gradients": true,
+ "link": true,
+ "__experimentalDefaultControls": {
+ "background": true,
+ "text": true,
+ "link": true
+ }
+ },
"interactivity": {
"clientNavigation": true
}
diff --git a/packages/block-library/src/rss/block.json b/packages/block-library/src/rss/block.json
index 844104b7d8113d..112dec4a32c78b 100644
--- a/packages/block-library/src/rss/block.json
+++ b/packages/block-library/src/rss/block.json
@@ -47,6 +47,20 @@
"interactivity": {
"clientNavigation": true
},
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ },
+ "spacing": {
+ "margin": true,
+ "padding": true,
+ "__experimentalDefaultControls": {
+ "padding": false,
+ "margin": false
+ }
+ },
"color": {
"background": true,
"text": true,
diff --git a/packages/block-library/src/rss/edit.js b/packages/block-library/src/rss/edit.js
index 39564da79b16e5..d931bc8cb01d87 100644
--- a/packages/block-library/src/rss/edit.js
+++ b/packages/block-library/src/rss/edit.js
@@ -119,6 +119,19 @@ export default function RSSEdit( { attributes, setAttributes } ) {
},
];
+ /*
+ * This function merges the existing attributes with additional style properties.
+ * The `border` and `spacing` properties are set to `undefined` to ensure that
+ * these styles are reset and not applied on the server side.
+ */
+ const serverSideAttributes = {
+ ...attributes,
+ style: {
+ ...attributes?.style,
+ border: undefined,
+ spacing: undefined,
+ },
+ };
return (
<>
@@ -190,7 +203,7 @@ export default function RSSEdit( { attributes, setAttributes } ) {
diff --git a/packages/block-library/src/rss/editor.scss b/packages/block-library/src/rss/editor.scss
index c5e79d6254460b..83fef1d73f4f37 100644
--- a/packages/block-library/src/rss/editor.scss
+++ b/packages/block-library/src/rss/editor.scss
@@ -5,3 +5,10 @@
.wp-block-rss__placeholder-form .wp-block-rss__placeholder-input {
flex: 1 1 auto;
}
+// Reset all styles when skipping block supports while server-side rendering.
+// This prevents issues such as duplicate padding, borders etc.
+.wp-block-rss .wp-block-rss {
+ all: inherit;
+ margin: 0;
+ padding: 0;
+}
diff --git a/packages/block-library/src/rss/style.scss b/packages/block-library/src/rss/style.scss
index f7360ec76f85ac..76cc232044ff30 100644
--- a/packages/block-library/src/rss/style.scss
+++ b/packages/block-library/src/rss/style.scss
@@ -1,11 +1,4 @@
ul.wp-block-rss { // The ul is needed for specificity to override the reset styles in the editor.
- list-style: none;
- padding: 0;
-
- // This needs extra specificity due to the reset mixin on the parent: https://github.com/WordPress/gutenberg/blob/a250e9e5fe00dd5195624f96a3d924e7078951c3/packages/edit-post/src/style.scss#L54
- &.wp-block-rss {
- box-sizing: border-box;
- }
&.alignleft {
/*rtl:ignore*/
@@ -19,7 +12,6 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styl
display: flex;
flex-wrap: wrap;
padding: 0;
- list-style: none;
li {
margin: 0 1em 1em 0;
@@ -41,3 +33,9 @@ ul.wp-block-rss { // The ul is needed for specificity to override the reset styl
display: block;
font-size: 0.8125em;
}
+.wp-block-rss {
+ // This block has customizable padding, border-box makes that more predictable.
+ box-sizing: border-box;
+ list-style: none;
+ padding: 0;
+}
diff --git a/packages/block-library/src/social-link/icons/discord.js b/packages/block-library/src/social-link/icons/discord.js
new file mode 100644
index 00000000000000..6cb6165515369c
--- /dev/null
+++ b/packages/block-library/src/social-link/icons/discord.js
@@ -0,0 +1,10 @@
+/**
+ * WordPress dependencies
+ */
+import { Path, SVG } from '@wordpress/primitives';
+
+export const DiscordIcon = () => (
+
+);
diff --git a/packages/block-library/src/social-link/icons/index.js b/packages/block-library/src/social-link/icons/index.js
index 422ff6f02dd20e..bcc1976a7efb03 100644
--- a/packages/block-library/src/social-link/icons/index.js
+++ b/packages/block-library/src/social-link/icons/index.js
@@ -5,6 +5,7 @@ export * from './bluesky';
export * from './chain';
export * from './codepen';
export * from './deviantart';
+export * from './discord';
export * from './dribbble';
export * from './dropbox';
export * from './etsy';
diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php
index f241daff2a11a8..9775f6dece5d7d 100644
--- a/packages/block-library/src/social-link/index.php
+++ b/packages/block-library/src/social-link/index.php
@@ -169,6 +169,10 @@ function block_core_social_link_services( $service = '', $field = '' ) {
'name' => 'DeviantArt',
'icon' => '',
),
+ 'discord' => array(
+ 'name' => 'Discord',
+ 'icon' => '',
+ ),
'dribbble' => array(
'name' => 'Dribbble',
'icon' => '',
diff --git a/packages/block-library/src/social-link/socials-with-bg.scss b/packages/block-library/src/social-link/socials-with-bg.scss
index 35420fc624c0e6..b51b718459739d 100644
--- a/packages/block-library/src/social-link/socials-with-bg.scss
+++ b/packages/block-library/src/social-link/socials-with-bg.scss
@@ -33,6 +33,11 @@
color: #fff;
}
+.wp-social-link-discord {
+ background-color: #5865f2;
+ color: #fff;
+}
+
.wp-social-link-dribbble {
background-color: #e94c89;
color: #fff;
diff --git a/packages/block-library/src/social-link/socials-without-bg.scss b/packages/block-library/src/social-link/socials-without-bg.scss
index 24538b29824b17..12b8620efb9f7f 100644
--- a/packages/block-library/src/social-link/socials-without-bg.scss
+++ b/packages/block-library/src/social-link/socials-without-bg.scss
@@ -22,6 +22,10 @@
color: #02e49b;
}
+.wp-social-link-discord {
+ color: #5865f2;
+}
+
.wp-social-link-dribbble {
color: #e94c89;
}
diff --git a/packages/block-library/src/social-link/variations.js b/packages/block-library/src/social-link/variations.js
index a97a396882d761..59fb469181449d 100644
--- a/packages/block-library/src/social-link/variations.js
+++ b/packages/block-library/src/social-link/variations.js
@@ -9,6 +9,7 @@ import {
ChainIcon,
CodepenIcon,
DeviantArtIcon,
+ DiscordIcon,
DribbbleIcon,
DropboxIcon,
EtsyIcon,
@@ -108,6 +109,12 @@ const variations = [
title: 'DeviantArt',
icon: DeviantArtIcon,
},
+ {
+ name: 'discord',
+ attributes: { service: 'discord' },
+ title: 'Discord',
+ icon: DiscordIcon,
+ },
{
name: 'dribbble',
attributes: { service: 'dribbble' },
diff --git a/packages/block-library/src/social-links/editor.scss b/packages/block-library/src/social-links/editor.scss
index 11f1ed86d11220..54a4154659eb2d 100644
--- a/packages/block-library/src/social-links/editor.scss
+++ b/packages/block-library/src/social-links/editor.scss
@@ -89,7 +89,6 @@
// Unconfigured placeholder links are semitransparent.
.wp-social-link.wp-social-link__is-incomplete {
opacity: 0.5;
- @include reduce-motion("transition");
}
.wp-block-social-links .is-selected .wp-social-link__is-incomplete,
diff --git a/packages/blocks/src/api/parser/apply-built-in-validation-fixes.js b/packages/blocks/src/api/parser/apply-built-in-validation-fixes.js
index 13dbb1e6825c96..52d6583265e6b9 100644
--- a/packages/blocks/src/api/parser/apply-built-in-validation-fixes.js
+++ b/packages/blocks/src/api/parser/apply-built-in-validation-fixes.js
@@ -2,6 +2,7 @@
* Internal dependencies
*/
import { fixCustomClassname } from './fix-custom-classname';
+import { fixAriaLabel } from './fix-aria-label';
/**
* Attempts to fix block invalidation by applying build-in validation fixes
@@ -15,11 +16,22 @@ import { fixCustomClassname } from './fix-custom-classname';
* @return {WPBlock} Fixed block object
*/
export function applyBuiltInValidationFixes( block, blockType ) {
- const updatedBlockAttributes = fixCustomClassname(
- block.attributes,
+ const { attributes, originalContent } = block;
+ let updatedBlockAttributes = attributes;
+
+ // Fix block invalidation for className attribute.
+ updatedBlockAttributes = fixCustomClassname(
+ attributes,
+ blockType,
+ originalContent
+ );
+ // Fix block invalidation for ariaLabel attribute.
+ updatedBlockAttributes = fixAriaLabel(
+ updatedBlockAttributes,
blockType,
- block.originalContent
+ originalContent
);
+
return {
...block,
attributes: updatedBlockAttributes,
diff --git a/packages/blocks/src/api/parser/fix-aria-label.js b/packages/blocks/src/api/parser/fix-aria-label.js
new file mode 100644
index 00000000000000..79fa30c713da20
--- /dev/null
+++ b/packages/blocks/src/api/parser/fix-aria-label.js
@@ -0,0 +1,51 @@
+/**
+ * Internal dependencies
+ */
+import { hasBlockSupport } from '../registration';
+import { parseWithAttributeSchema } from './get-block-attributes';
+
+const ARIA_LABEL_ATTR_SCHEMA = {
+ type: 'string',
+ source: 'attribute',
+ selector: '[data-aria-label] > *',
+ attribute: 'aria-label',
+};
+
+/**
+ * Given an HTML string, returns the aria-label attribute assigned to
+ * the root element in the markup.
+ *
+ * @param {string} innerHTML Markup string from which to extract the aria-label.
+ *
+ * @return {string} The aria-label assigned to the root element.
+ */
+export function getHTMLRootElementAriaLabel( innerHTML ) {
+ const parsed = parseWithAttributeSchema(
+ `${ innerHTML }
`,
+ ARIA_LABEL_ATTR_SCHEMA
+ );
+ return parsed;
+}
+
+/**
+ * Given a parsed set of block attributes, if the block supports ariaLabel
+ * and an aria-label attribute is found, the aria-label attribute is assigned
+ * to the block attributes.
+ *
+ * @param {Object} blockAttributes Original block attributes.
+ * @param {Object} blockType Block type settings.
+ * @param {string} innerHTML Original block markup.
+ *
+ * @return {Object} Filtered block attributes.
+ */
+export function fixAriaLabel( blockAttributes, blockType, innerHTML ) {
+ if ( ! hasBlockSupport( blockType, 'ariaLabel', false ) ) {
+ return blockAttributes;
+ }
+ const modifiedBlockAttributes = { ...blockAttributes };
+ const ariaLabel = getHTMLRootElementAriaLabel( innerHTML );
+ if ( ariaLabel ) {
+ modifiedBlockAttributes.ariaLabel = ariaLabel;
+ }
+ return modifiedBlockAttributes;
+}
diff --git a/packages/blocks/src/api/parser/test/index.js b/packages/blocks/src/api/parser/test/index.js
index 42923a7d3eeb35..452fca329af76b 100644
--- a/packages/blocks/src/api/parser/test/index.js
+++ b/packages/blocks/src/api/parser/test/index.js
@@ -82,6 +82,39 @@ describe( 'block parser', () => {
} );
} );
+ it( 'should apply aria-label block validation fixes', () => {
+ registerBlockType( 'core/test-block', {
+ ...defaultBlockSettings,
+ attributes: {
+ fruit: {
+ type: 'string',
+ source: 'text',
+ selector: 'div',
+ },
+ },
+ supports: {
+ ariaLabel: true,
+ },
+ save: ( { attributes } ) => (
+
+ { attributes.fruit }
+
+ ),
+ } );
+
+ const block = parseRawBlock( {
+ blockName: 'core/test-block',
+ innerHTML: 'Bananas
',
+ attrs: { fruit: 'Bananas' },
+ } );
+
+ expect( block.name ).toEqual( 'core/test-block' );
+ expect( block.attributes ).toEqual( {
+ fruit: 'Bananas',
+ ariaLabel: 'custom-label',
+ } );
+ } );
+
it( 'should create the requested block if it exists', () => {
registerBlockType( 'core/test-block', defaultBlockSettings );
diff --git a/packages/edit-site/src/components/media/index.js b/packages/edit-site/src/components/media/index.js
index e103e6bcddb5b2..0e0c7abaae4644 100644
--- a/packages/edit-site/src/components/media/index.js
+++ b/packages/edit-site/src/components/media/index.js
@@ -6,11 +6,11 @@ import { useEntityRecord } from '@wordpress/core-data';
function Media( { id, size = [ 'large', 'medium', 'thumbnail' ], ...props } ) {
const { record: media } = useEntityRecord( 'root', 'media', id );
const currentSize = size.find(
- ( s ) => !! media?.media_details?.sizes[ s ]
+ ( s ) => !! media?.media_details?.sizes?.[ s ]
);
const mediaUrl =
- media?.media_details?.sizes[ currentSize ]?.source_url ||
+ media?.media_details?.sizes?.[ currentSize ]?.source_url ||
media?.source_url;
if ( ! mediaUrl ) {
diff --git a/packages/edit-site/src/components/resizable-frame/index.js b/packages/edit-site/src/components/resizable-frame/index.js
index ecb7204f9f05ba..fee65fbd9dfff8 100644
--- a/packages/edit-site/src/components/resizable-frame/index.js
+++ b/packages/edit-site/src/components/resizable-frame/index.js
@@ -254,7 +254,7 @@ function ResizableFrame( {
}
} }
whileHover={
- canvas === 'view'
+ canvas === 'view' && isBlockTheme
? {
scale: 1.005,
transition: {
diff --git a/packages/editor/src/components/editor/index.js b/packages/editor/src/components/editor/index.js
index 21becea43cd7ee..80c5419caf9975 100644
--- a/packages/editor/src/components/editor/index.js
+++ b/packages/editor/src/components/editor/index.js
@@ -31,12 +31,17 @@ function Editor( {
extraSidebarPanels,
...props
} ) {
- const { post, template, hasLoadedPost } = useSelect(
+ const { post, template, hasLoadedPost, error } = useSelect(
( select ) => {
- const { getEntityRecord, hasFinishedResolution } =
- select( coreStore );
+ const {
+ getEntityRecord,
+ getResolutionError,
+ hasFinishedResolution,
+ } = select( coreStore );
+
+ const postArgs = [ 'postType', postType, postId ];
return {
- post: getEntityRecord( 'postType', postType, postId ),
+ post: getEntityRecord( ...postArgs ),
template: templateId
? getEntityRecord(
'postType',
@@ -44,11 +49,12 @@ function Editor( {
templateId
)
: undefined,
- hasLoadedPost: hasFinishedResolution( 'getEntityRecord', [
- 'postType',
- postType,
- postId,
- ] ),
+ hasLoadedPost: hasFinishedResolution(
+ 'getEntityRecord',
+ postArgs
+ ),
+ error: getResolutionError( 'getEntityRecord', postArgs )
+ ?.message,
};
},
[ postType, postId, templateId ]
@@ -57,10 +63,15 @@ function Editor( {
return (
<>
{ hasLoadedPost && ! post && (
-
- { __(
- "You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
- ) }
+
+ { ! error
+ ? __(
+ "You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
+ )
+ : error }
) }
{ !! post && (
diff --git a/test/integration/fixtures/blocks/core__separator-color.json b/test/integration/fixtures/blocks/core__separator-color.json
index d66a8b2e1a242e..d53b7287428038 100644
--- a/test/integration/fixtures/blocks/core__separator-color.json
+++ b/test/integration/fixtures/blocks/core__separator-color.json
@@ -4,8 +4,8 @@
"isValid": true,
"attributes": {
"opacity": "alpha-channel",
- "backgroundColor": "accent",
- "tagName": "hr"
+ "tagName": "hr",
+ "backgroundColor": "accent"
},
"innerBlocks": []
}
diff --git a/test/integration/fixtures/blocks/core__separator-custom-color.json b/test/integration/fixtures/blocks/core__separator-custom-color.json
index 9b126f2b5be6c7..444cf3cf9b19b4 100644
--- a/test/integration/fixtures/blocks/core__separator-custom-color.json
+++ b/test/integration/fixtures/blocks/core__separator-custom-color.json
@@ -4,12 +4,12 @@
"isValid": true,
"attributes": {
"opacity": "alpha-channel",
+ "tagName": "hr",
"style": {
"color": {
"background": "#5da54c"
}
- },
- "tagName": "hr"
+ }
},
"innerBlocks": []
}
diff --git a/test/integration/fixtures/blocks/core__social-link-discord.html b/test/integration/fixtures/blocks/core__social-link-discord.html
new file mode 100644
index 00000000000000..e060dec0d1673f
--- /dev/null
+++ b/test/integration/fixtures/blocks/core__social-link-discord.html
@@ -0,0 +1 @@
+
diff --git a/test/integration/fixtures/blocks/core__social-link-discord.json b/test/integration/fixtures/blocks/core__social-link-discord.json
new file mode 100644
index 00000000000000..fa5ce3ebf051d3
--- /dev/null
+++ b/test/integration/fixtures/blocks/core__social-link-discord.json
@@ -0,0 +1,11 @@
+[
+ {
+ "name": "core/social-link",
+ "isValid": true,
+ "attributes": {
+ "url": "https://example.com/",
+ "service": "discord"
+ },
+ "innerBlocks": []
+ }
+]
diff --git a/test/integration/fixtures/blocks/core__social-link-discord.parsed.json b/test/integration/fixtures/blocks/core__social-link-discord.parsed.json
new file mode 100644
index 00000000000000..7904c03b69d9d8
--- /dev/null
+++ b/test/integration/fixtures/blocks/core__social-link-discord.parsed.json
@@ -0,0 +1,11 @@
+[
+ {
+ "blockName": "core/social-link-discord",
+ "attrs": {
+ "url": "https://example.com/"
+ },
+ "innerBlocks": [],
+ "innerHTML": "",
+ "innerContent": []
+ }
+]
diff --git a/test/integration/fixtures/blocks/core__social-link-discord.serialized.html b/test/integration/fixtures/blocks/core__social-link-discord.serialized.html
new file mode 100644
index 00000000000000..c61b5ffcb46a57
--- /dev/null
+++ b/test/integration/fixtures/blocks/core__social-link-discord.serialized.html
@@ -0,0 +1 @@
+