Skip to content

Commit

Permalink
Widget screens: set html block as freeform content handler (#33164)
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave authored and youknowriad committed Jul 6, 2021
1 parent d1c0103 commit c357957
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/customize-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
registerLegacyWidgetBlock,
registerLegacyWidgetVariations,
} from '@wordpress/widgets';
import { setFreeformContentHandlerName } from '@wordpress/blocks';

/**
* Internal dependencies
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions packages/edit-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import {
registerBlockType,
unstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase
setFreeformContentHandlerName,
} from '@wordpress/blocks';
import { render } from '@wordpress/element';
import {
Expand Down Expand Up @@ -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(
<Layout blockEditorSettings={ settings } />,
document.getElementById( id )
Expand Down

0 comments on commit c357957

Please sign in to comment.