From 00f038bd41d7391207e088834849711b29bf7d43 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Fri, 2 Jul 2021 11:44:34 +0100 Subject: [PATCH] Set html block as freeform content handler --- packages/customize-widgets/src/index.js | 7 +++++++ packages/edit-widgets/src/index.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/packages/customize-widgets/src/index.js b/packages/customize-widgets/src/index.js index bf3b8eef0c862..e578b491adbb9 100644 --- a/packages/customize-widgets/src/index.js +++ b/packages/customize-widgets/src/index.js @@ -11,6 +11,7 @@ import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, } from '@wordpress/widgets'; +import { setFreeformContentHandlerName } from '@wordpress/blocks'; /** * Internal dependencies @@ -49,6 +50,12 @@ export function initialize( editorName, blockEditorSettings ) { } registerLegacyWidgetVariations( blockEditorSettings ); + // As we are unregistering `core/freeform` to avoid the Classic block, we must + // replace it with something as the default freeform content handler. Failure to + // do this will result in errors in the default block parser. + // see: https://github.com/WordPress/gutenberg/issues/33097 + setFreeformContentHandlerName( 'core/html' ); + const SidebarControl = getSidebarControl( blockEditorSettings ); wp.customize.sectionConstructor.sidebar = getSidebarSection(); diff --git a/packages/edit-widgets/src/index.js b/packages/edit-widgets/src/index.js index 7ed910113e7e8..7527529dbb4ed 100644 --- a/packages/edit-widgets/src/index.js +++ b/packages/edit-widgets/src/index.js @@ -4,6 +4,7 @@ import { registerBlockType, unstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase + setFreeformContentHandlerName, } from '@wordpress/blocks'; import { render } from '@wordpress/element'; import { @@ -63,6 +64,11 @@ export function initialize( id, settings ) { settings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) => fetchLinkSuggestions( search, searchOptions, settings ); + // As we are unregistering `core/freeform` to avoid the Classic block, we must + // replace it with something as the default freeform content handler. Failure to + // do this will result in errors in the default block parser. + // see: https://github.com/WordPress/gutenberg/issues/33097 + setFreeformContentHandlerName( 'core/html' ); render( , document.getElementById( id )