Skip to content

Commit

Permalink
Mark FSE blocks as non experimental (#35979)
Browse files Browse the repository at this point in the history
* Fix duplicate function declaration error

* Mark blocks used by Twenty Twenty-two as stable

* Don't mark Post Comments as non-experimental
  • Loading branch information
noisysocks authored Nov 1, 2021
1 parent 816660e commit 86dcf7c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 96 deletions.
167 changes: 80 additions & 87 deletions packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,74 +12,41 @@ import {
/**
* Internal dependencies
*/
import * as paragraph from './paragraph';
import * as image from './image';
import * as heading from './heading';
import * as quote from './quote';
import * as gallery from './gallery';
import * as archives from './archives';
import * as audio from './audio';
import * as buttons from './buttons';
import * as button from './button';
import * as buttons from './buttons';
import * as calendar from './calendar';
import * as categories from './categories';
import * as classic from './freeform';
import * as code from './code';
import * as columns from './columns';
import * as column from './column';
import * as columns from './columns';
import * as commentTemplate from './comment-template';
import * as commentsQueryLoop from './comments-query-loop';
import * as cover from './cover';
import * as embed from './embed';
import * as file from './file';
import * as html from './html';
import * as mediaText from './media-text';
import * as navigation from './navigation';
import * as navigationLink from './navigation-link';
import * as navigationSubmenu from './navigation-submenu';
import * as gallery from './gallery';
import * as group from './group';
import * as heading from './heading';
import * as homeLink from './home-link';
import * as html from './html';
import * as image from './image';
import * as latestComments from './latest-comments';
import * as latestPosts from './latest-posts';
import * as logInOut from './loginout';
import * as list from './list';
import * as logInOut from './loginout';
import * as mediaText from './media-text';
import * as missing from './missing';
import * as more from './more';
import * as navigation from './navigation';
import * as navigationLink from './navigation-link';
import * as navigationSubmenu from './navigation-submenu';
import * as nextpage from './nextpage';
import * as pattern from './pattern';
import * as pageList from './page-list';
import * as preformatted from './preformatted';
import * as pullquote from './pullquote';
import * as reusableBlock from './block';
import * as rss from './rss';
import * as search from './search';
import * as group from './group';
import * as separator from './separator';
import * as shortcode from './shortcode';
import * as spacer from './spacer';
import * as table from './table';
// import * as tableOfContents from './table-of-contents';
import * as textColumns from './text-columns';
import * as verse from './verse';
import * as video from './video';
import * as tagCloud from './tag-cloud';
import * as classic from './freeform';
import * as socialLinks from './social-links';
import * as socialLink from './social-link';

// Full Site Editing Blocks
import * as commentsQueryLoop from './comments-query-loop';
import * as commentTemplate from './comment-template';
import * as siteLogo from './site-logo';
import * as siteTagline from './site-tagline';
import * as siteTitle from './site-title';
import * as templatePart from './template-part';
import * as query from './query';
import * as postTemplate from './post-template';
import * as queryTitle from './query-title';
import * as queryPagination from './query-pagination';
import * as queryPaginationNext from './query-pagination-next';
import * as queryPaginationNumbers from './query-pagination-numbers';
import * as queryPaginationPrevious from './query-pagination-previous';
import * as postNavigationLink from './post-navigation-link';
import * as postTitle from './post-title';
import * as postContent from './post-content';
import * as paragraph from './paragraph';
import * as postAuthor from './post-author';
import * as postComment from './post-comment';
import * as postCommentAuthor from './post-comment-author';
Expand All @@ -92,11 +59,42 @@ import * as postComments from './post-comments';
import * as postCommentsCount from './post-comments-count';
import * as postCommentsForm from './post-comments-form';
import * as postCommentsLink from './post-comments-link';
import * as postContent from './post-content';
import * as postDate from './post-date';
import * as postExcerpt from './post-excerpt';
import * as postFeaturedImage from './post-featured-image';
import * as postNavigationLink from './post-navigation-link';
import * as postTemplate from './post-template';
import * as postTerms from './post-terms';
import * as postTitle from './post-title';
import * as preformatted from './preformatted';
import * as pullquote from './pullquote';
import * as query from './query';
import * as queryPagination from './query-pagination';
import * as queryPaginationNext from './query-pagination-next';
import * as queryPaginationNumbers from './query-pagination-numbers';
import * as queryPaginationPrevious from './query-pagination-previous';
import * as queryTitle from './query-title';
import * as quote from './quote';
import * as reusableBlock from './block';
import * as rss from './rss';
import * as search from './search';
import * as separator from './separator';
import * as shortcode from './shortcode';
import * as siteLogo from './site-logo';
import * as siteTagline from './site-tagline';
import * as siteTitle from './site-title';
import * as socialLink from './social-link';
import * as socialLinks from './social-links';
import * as spacer from './spacer';
import * as table from './table';
// import * as tableOfContents from './table-of-contents';
import * as tagCloud from './tag-cloud';
import * as templatePart from './template-part';
import * as termDescription from './term-description';
import * as textColumns from './text-columns';
import * as verse from './verse';
import * as video from './video';

/**
* Function to register an individual block.
Expand Down Expand Up @@ -133,70 +131,69 @@ export const __experimentalGetCoreBlocks = () => [
quote,

// Register all remaining core blocks.
shortcode,
archives,
audio,
button,
buttons,
calendar,
categories,
window.wp && window.wp.oldEditor ? classic : null, // Only add the classic block in WP Context
code,
columns,
column,
columns,
commentTemplate,
commentsQueryLoop,
cover,
embed,
file,
group,
window.wp && window.wp.oldEditor ? classic : null, // Only add the classic block in WP Context
html,
mediaText,
latestComments,
latestPosts,
logInOut,
mediaText,
missing,
more,
navigation,
navigationLink,
navigationSubmenu,
nextpage,
pageList,
pattern,
postAuthor,
postContent,
postDate,
postExcerpt,
postFeaturedImage,
postTemplate,
postTerms,
postTitle,
preformatted,
pullquote,
query,
queryPagination,
queryPaginationNext,
queryPaginationNumbers,
queryPaginationPrevious,
queryTitle,
reusableBlock,
rss,
search,
separator,
reusableBlock,
socialLinks,
shortcode,
siteLogo,
siteTagline,
siteTitle,
socialLink,
socialLinks,
spacer,
table,
// tableOfContents,
tagCloud,
templatePart,
textColumns,
verse,
video,

// Theme blocks
commentsQueryLoop,
commentTemplate,

siteLogo,
siteTagline,
siteTitle,

query,
postTemplate,
queryTitle,
queryPagination,
queryPaginationNext,
queryPaginationNumbers,
queryPaginationPrevious,

postTitle,
postContent,
postDate,
postExcerpt,
postFeaturedImage,
postTerms,

logInOut,
pattern,
];

/**
Expand Down Expand Up @@ -239,16 +236,12 @@ export const __experimentalRegisterExperimentalCoreBlocks =
process.env.GUTENBERG_PHASE === 2
? ( { enableFSEBlocks } = {} ) => {
[
navigation,
navigationLink,
// Experimental blocks.
homeLink,
navigationSubmenu,

// Register Full Site Editing Blocks.
// Full Site Editing blocks.
...( enableFSEBlocks
? [
templatePart,
postAuthor,
postComment,
postCommentAuthor,
postCommentAuthorAvatar,
Expand Down
10 changes: 8 additions & 2 deletions packages/customize-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ import './filters';

const { wp } = window;

const DISABLED_BLOCKS = [ 'core/more', 'core/block', 'core/freeform' ];
const DISABLED_BLOCKS = [
'core/more',
'core/block',
'core/freeform',
'core/template-part',
];
const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;

/**
Expand All @@ -50,7 +55,8 @@ export function initialize( editorName, blockEditorSettings ) {
DISABLED_BLOCKS.includes( block.name ) ||
block.name.startsWith( 'core/post' ) ||
block.name.startsWith( 'core/query' ) ||
block.name.startsWith( 'core/site' )
block.name.startsWith( 'core/site' ) ||
block.name.startsWith( 'core/navigation' )
);
} );
registerCoreBlocks( coreBlocks );
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
const disabledBlocks = [
'core/more',
'core/freeform',
'core/template-part',
...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),
];

Expand Down Expand Up @@ -72,7 +73,8 @@ export function initialize( id, settings ) {
disabledBlocks.includes( block.name ) ||
block.name.startsWith( 'core/post' ) ||
block.name.startsWith( 'core/query' ) ||
block.name.startsWith( 'core/site' )
block.name.startsWith( 'core/site' ) ||
block.name.startsWith( 'core/navigation' )
);
} );

Expand Down
12 changes: 6 additions & 6 deletions tools/webpack/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ module.exports = {
// Within content, search for any function definitions. For
// each, replace every other reference to it in the file.
return (
content
.match( /^function [^\(]+/gm )
.reduce( ( result, functionName ) => {
// Trim leading "function " prefix from match.
functionName = functionName.slice( 9 );

Array.from(
content.matchAll(
/^\s*function ([^\(]+)/gm
)
)
.reduce( ( result, [ , functionName ] ) => {
// Prepend the Gutenberg prefix, substituting any
// other core prefix (e.g. "wp_").
return result.replace(
Expand Down

0 comments on commit 86dcf7c

Please sign in to comment.