Skip to content

Commit

Permalink
Prepare for adding the Widgets block editor to Core (#32136)
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks authored and gziolo committed May 24, 2021
1 parent 3290f61 commit c424caf
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
6 changes: 2 additions & 4 deletions packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export const __experimentalGetCoreBlocks = () => [
mediaText,
latestComments,
latestPosts,
legacyWidget,
missing,
more,
nextpage,
Expand Down Expand Up @@ -229,15 +230,12 @@ export const registerCoreBlocks = (
*/
export const __experimentalRegisterExperimentalCoreBlocks =
process.env.GUTENBERG_PHASE === 2
? ( { enableLegacyWidgetBlock, enableFSEBlocks } = {} ) => {
? ( { enableFSEBlocks } = {} ) => {
[
navigation,
navigationLink,
homeLink,

// Register Legacy Widget block.
...( enableLegacyWidgetBlock ? [ legacyWidget ] : [] ),

// Register Full Site Editing Blocks.
...( enableFSEBlocks
? [
Expand Down
6 changes: 1 addition & 5 deletions packages/customize-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ export function initialize( editorName, blockEditorSettings ) {
);
registerCoreBlocks( coreBlocks );

if ( process.env.GUTENBERG_PHASE === 2 ) {
__experimentalRegisterExperimentalCoreBlocks( {
enableLegacyWidgetBlock: true,
} );
}
__experimentalRegisterExperimentalCoreBlocks();

registerLegacyWidgetVariations( blockEditorSettings );

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- wp:legacy-widget {"idBase":"search","instance":{"encoded":"YTowOnt9","hash":"b9b82f721929717273108125217fbcd9","raw":{}}} /-->
18 changes: 18 additions & 0 deletions packages/e2e-tests/fixtures/blocks/core__legacy-widget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"clientId": "_clientId_0",
"name": "core/legacy-widget",
"isValid": true,
"attributes": {
"id": null,
"idBase": "search",
"instance": {
"encoded": "YTowOnt9",
"hash": "b9b82f721929717273108125217fbcd9",
"raw": {}
}
},
"innerBlocks": [],
"originalContent": ""
}
]
16 changes: 16 additions & 0 deletions packages/e2e-tests/fixtures/blocks/core__legacy-widget.parsed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"blockName": "core/legacy-widget",
"attrs": {
"idBase": "search",
"instance": {
"encoded": "YTowOnt9",
"hash": "b9b82f721929717273108125217fbcd9",
"raw": {}
}
},
"innerBlocks": [],
"innerHTML": "",
"innerContent": []
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- wp:legacy-widget {"idBase":"search","instance":{"encoded":"YTowOnt9","hash":"b9b82f721929717273108125217fbcd9","raw":{}}} /-->
6 changes: 1 addition & 5 deletions packages/edit-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ export function initialize( id, settings ) {
( block ) => ! [ 'core/more' ].includes( block.name )
);
registerCoreBlocks( coreBlocks );
if ( process.env.GUTENBERG_PHASE === 2 ) {
__experimentalRegisterExperimentalCoreBlocks( {
enableLegacyWidgetBlock: true,
} );
}
__experimentalRegisterExperimentalCoreBlocks();
registerLegacyWidgetVariations( settings );
registerBlock( widgetArea );
settings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>
Expand Down

0 comments on commit c424caf

Please sign in to comment.