Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for adding the Widgets block editor to Core #32136

Merged
merged 4 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/block-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### New Features

- Marks the `core/legacy-widget` block as stable.

## 3.1.0 (2021-05-20)

## 3.0.0 (2021-05-14)
Expand Down
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
1 change: 0 additions & 1 deletion packages/customize-widgets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "@wordpress/customize-widgets",
"private": true,
"version": "1.0.0-prerelease",
"description": "Widgets blocks in Customizer Module for WordPress.",
"author": "The WordPress Contributors",
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,
} );
}
noisysocks marked this conversation as resolved.
Show resolved Hide resolved
__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": ""
}
]
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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noisysocks I think this should be behind the Gutenberg phase flag like it was before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we only needed to remove the enableLegacyWidgetBlock option (and options object) being passed as an argument.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see #32138 now, ignore this!

registerLegacyWidgetVariations( settings );
registerBlock( widgetArea );
settings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>
Expand Down