From 27283442e3fd8f0ea98d9a45fff4a7f9bb399413 Mon Sep 17 00:00:00 2001 From: priethor <27339341+priethor@users.noreply.github.com> Date: Mon, 29 Dec 2025 12:34:01 +0100 Subject: [PATCH] Use new HtmlRenderer for PHP-only blocks, disable ref --- packages/block-library/src/index.js | 17 +++++++++++------ .../block-library/src/utils/html-renderer.js | 5 +++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index 718e83a0bf8e8d..72ba6486407266 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -9,11 +9,17 @@ import { registerBlockType, store as blocksStore, } from '@wordpress/blocks'; +import { useDisabled } from '@wordpress/compose'; import { select } from '@wordpress/data'; import { useBlockProps } from '@wordpress/block-editor'; import { useServerSideRender } from '@wordpress/server-side-render'; import { __, sprintf } from '@wordpress/i18n'; +/** + * Internal dependencies + */ +import HtmlRenderer from './utils/html-renderer'; + /** * Internal dependencies */ @@ -351,7 +357,8 @@ export const registerCoreBlocks = ( apiVersion: 3, } ), edit: function Edit( { attributes } ) { - const blockProps = useBlockProps(); + const disabledRef = useDisabled(); + const blockProps = useBlockProps( { ref: disabledRef } ); const { content, status, error } = useServerSideRender( { block: blockName, attributes, @@ -376,11 +383,9 @@ export const registerCoreBlocks = ( } return ( -
); }, diff --git a/packages/block-library/src/utils/html-renderer.js b/packages/block-library/src/utils/html-renderer.js index b6cb42e3ade565..6bb5b538d4a5cf 100644 --- a/packages/block-library/src/utils/html-renderer.js +++ b/packages/block-library/src/utils/html-renderer.js @@ -1,6 +1,7 @@ /** * External dependencies */ +import clsx from 'clsx'; import parse, { attributesToProps, domToReact } from 'html-react-parser'; /** @@ -26,6 +27,10 @@ const HtmlRenderer = ( { wrapperProps = {}, html = '' } ) => { const mergedProps = { ...parsedProps, ...wrapperProps, + className: clsx( + parsedProps.className, + wrapperProps.className + ), }; return (