From c406f7473ff86a9b7443b6983c94138b6a78f424 Mon Sep 17 00:00:00 2001
From: Andrew Duthie
Date: Fri, 20 Dec 2019 10:54:42 -0500
Subject: [PATCH 1/7] Blocks: Update default block categories
---
.../developers/data/data-core-blocks.md | 16 +-
.../applying-styles-with-stylesheets.md | 4 +-
.../block-controls-toolbar-and-sidebar.md | 4 +-
...roducing-attributes-and-editable-fields.md | 4 +-
.../nested-blocks-inner-blocks.md | 2 +-
.../writing-your-first-block-type.md | 4 +-
.../tutorials/javascript/js-build-setup.md | 2 +-
.../tutorials/metabox/meta-block-3-add.md | 4 +-
docs/rfc/block-registration.md | 6 +-
lib/compat.php | 49 +++++
.../src/autocompleters/test/block.js | 8 +-
.../src/components/block-edit/test/edit.js | 10 +-
.../components/block-switcher/test/index.js | 4 +-
.../src/components/inner-blocks/test/index.js | 4 +-
.../components/inserter/test/block-list.js | 32 +--
.../inserter/test/fixtures/index.js | 44 ++---
.../components/inserter/test/search-items.js | 16 +-
.../components/inspector-controls/README.md | 4 +-
packages/block-editor/src/hooks/test/align.js | 2 +-
.../src/hooks/test/custom-class-name.js | 4 +-
.../src/hooks/test/generated-class-name.js | 2 +-
packages/block-editor/src/hooks/test/utils.js | 2 +-
.../block-editor/src/store/test/effects.js | 10 +-
.../block-editor/src/store/test/reducer.js | 6 +-
.../block-editor/src/store/test/selectors.js | 12 +-
packages/block-library/src/audio/block.json | 2 +-
packages/block-library/src/button/block.json | 2 +-
packages/block-library/src/buttons/block.json | 2 +-
packages/block-library/src/classic/block.json | 2 +-
packages/block-library/src/code/block.json | 2 +-
packages/block-library/src/column/block.json | 2 +-
packages/block-library/src/columns/block.json | 2 +-
packages/block-library/src/cover/block.json | 2 +-
packages/block-library/src/file/block.json | 2 +-
packages/block-library/src/gallery/block.json | 2 +-
packages/block-library/src/group/block.json | 2 +-
packages/block-library/src/heading/block.json | 2 +-
packages/block-library/src/html/block.json | 2 +-
packages/block-library/src/image/block.json | 2 +-
packages/block-library/src/list/block.json | 2 +-
.../block-library/src/media-text/block.json | 2 +-
packages/block-library/src/missing/block.json | 2 +-
packages/block-library/src/more/block.json | 2 +-
.../src/navigation-link/block.json | 2 +-
.../block-library/src/navigation/block.json | 2 +-
.../block-library/src/nextpage/block.json | 2 +-
.../block-library/src/paragraph/block.json | 2 +-
.../block-library/src/post-author/block.json | 2 +-
.../src/post-comments-count/block.json | 2 +-
.../src/post-comments-form/block.json | 2 +-
.../src/post-comments/block.json | 2 +-
.../block-library/src/post-content/block.json | 2 +-
.../block-library/src/post-date/block.json | 2 +-
.../block-library/src/post-excerpt/block.json | 2 +-
.../src/post-featured-image/block.json | 2 +-
.../block-library/src/post-tags/block.json | 2 +-
.../block-library/src/post-title/block.json | 2 +-
.../block-library/src/preformatted/block.json | 2 +-
.../block-library/src/pullquote/block.json | 2 +-
.../block-library/src/query-loop/block.json | 2 +-
.../src/query-pagination/block.json | 2 +-
packages/block-library/src/query/block.json | 2 +-
packages/block-library/src/quote/block.json | 2 +-
.../block-library/src/separator/block.json | 2 +-
.../block-library/src/site-title/block.json | 2 +-
packages/block-library/src/spacer/block.json | 2 +-
packages/block-library/src/subhead/block.json | 2 +-
packages/block-library/src/table/block.json | 2 +-
.../src/template-part/block.json | 2 +-
.../block-library/src/text-columns/block.json | 2 +-
packages/block-library/src/verse/block.json | 2 +-
packages/block-library/src/video/block.json | 2 +-
packages/blocks/README.md | 2 +-
packages/blocks/src/api/registration.js | 17 +-
packages/blocks/src/api/test/factory.js | 76 +++----
packages/blocks/src/api/test/parser.js | 10 +-
packages/blocks/src/api/test/registration.js | 58 +++---
packages/blocks/src/api/test/serializer.js | 10 +-
packages/blocks/src/api/test/templates.js | 4 +-
packages/blocks/src/api/test/utils.js | 8 +-
packages/blocks/src/api/test/validation.js | 2 +-
packages/blocks/src/store/reducer.js | 23 ++-
packages/blocks/src/store/selectors.js | 35 +++-
packages/blocks/src/store/test/selectors.js | 41 +++-
packages/create-block/lib/prompts.js | 2 +-
.../e2e-tests/plugins/align-hook/index.js | 8 +-
.../e2e-tests/plugins/block-context/index.js | 4 +-
.../e2e-tests/plugins/block-icons/index.js | 187 ++++++++++++------
.../container-without-paragraph/index.js | 16 +-
.../plugins/custom-grouping-block/index.js | 40 ++--
.../plugins/deprecated-node-matcher/index.js | 12 +-
.../inner-blocks-allowed-blocks/index.js | 6 +-
.../inner-blocks-locking-all-embed/index.js | 24 +--
.../inner-blocks-render-appender/index.js | 81 +++++---
.../plugins/inner-blocks-templates/index.js | 87 ++++----
.../plugins/meta-attribute-block/early.js | 2 +-
.../plugins/meta-attribute-block/late.js | 2 +-
.../components/document-outline/test/index.js | 6 +-
.../src/store/effects/test/reusable-blocks.js | 4 +-
packages/editor/src/store/test/selectors.js | 12 +-
test/integration/blocks-raw-handling.test.js | 4 +-
test/integration/shortcode-converter.test.js | 6 +-
102 files changed, 693 insertions(+), 445 deletions(-)
diff --git a/docs/designers-developers/developers/data/data-core-blocks.md b/docs/designers-developers/developers/data/data-core-blocks.md
index 8d577f4fca040c..443abc4a631ba5 100644
--- a/docs/designers-developers/developers/data/data-core-blocks.md
+++ b/docs/designers-developers/developers/data/data-core-blocks.md
@@ -83,7 +83,21 @@ _Parameters_
_Returns_
-- `Array`: Categories list.
+- `Array`: Categories list.
+
+# **getCategory**
+
+Returns a single category by slug. Canonicalizes category by slug, using
+internal mapping of legacy category slugs to their updated normal form.
+
+_Parameters_
+
+- _state_ `Object`: Blocks state.
+- _slug_ `string`: Category slug.
+
+_Returns_
+
+- `(WPBlockCategory|undefined)`: Block category, if exists.
# **getChildBlockNames**
diff --git a/docs/designers-developers/developers/tutorials/block-tutorial/applying-styles-with-stylesheets.md b/docs/designers-developers/developers/tutorials/block-tutorial/applying-styles-with-stylesheets.md
index 05d78586ef0985..b8a4a94996b014 100644
--- a/docs/designers-developers/developers/tutorials/block-tutorial/applying-styles-with-stylesheets.md
+++ b/docs/designers-developers/developers/tutorials/block-tutorial/applying-styles-with-stylesheets.md
@@ -14,7 +14,7 @@ registerBlockType( 'gutenberg-examples/example-02-stylesheets', {
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
example: {},
@@ -35,7 +35,7 @@ registerBlockType( 'gutenberg-examples/example-02-stylesheets', {
blocks.registerBlockType( 'gutenberg-examples/example-02-stylesheets', {
title: 'Example: Stylesheets',
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
example: {},
edit: function( props ) {
return el(
diff --git a/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md b/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md
index 423a3b6aa8248d..6d9268c3d225fe 100644
--- a/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md
+++ b/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md
@@ -24,7 +24,7 @@ import {
registerBlockType( 'gutenberg-examples/example-04-controls-esnext', {
title: 'Example: Controls (esnext)',
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
attributes: {
content: {
type: 'array',
@@ -101,7 +101,7 @@ registerBlockType( 'gutenberg-examples/example-04-controls-esnext', {
blocks.registerBlockType( 'gutenberg-examples/example-04-controls', {
title: 'Example: Controls',
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
attributes: {
content: {
diff --git a/docs/designers-developers/developers/tutorials/block-tutorial/introducing-attributes-and-editable-fields.md b/docs/designers-developers/developers/tutorials/block-tutorial/introducing-attributes-and-editable-fields.md
index d3000cc9c4c993..0956c6bdd9fa2e 100644
--- a/docs/designers-developers/developers/tutorials/block-tutorial/introducing-attributes-and-editable-fields.md
+++ b/docs/designers-developers/developers/tutorials/block-tutorial/introducing-attributes-and-editable-fields.md
@@ -61,7 +61,7 @@ import { RichText } from '@wordpress/block-editor';
registerBlockType( 'gutenberg-examples/example-03-editable-esnext', {
title: 'Example: Editable (esnext)',
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
attributes: {
content: {
type: 'array',
@@ -102,7 +102,7 @@ registerBlockType( 'gutenberg-examples/example-03-editable-esnext', {
blocks.registerBlockType( 'gutenberg-examples/example-03-editable', {
title: 'Example: Editable',
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
attributes: {
content: {
diff --git a/docs/designers-developers/developers/tutorials/block-tutorial/nested-blocks-inner-blocks.md b/docs/designers-developers/developers/tutorials/block-tutorial/nested-blocks-inner-blocks.md
index 41748c56995bfe..27d6087cabfb2a 100644
--- a/docs/designers-developers/developers/tutorials/block-tutorial/nested-blocks-inner-blocks.md
+++ b/docs/designers-developers/developers/tutorials/block-tutorial/nested-blocks-inner-blocks.md
@@ -15,7 +15,7 @@ Here is the basic InnerBlocks usage.
blocks.registerBlockType( 'gutenberg-examples/example-06', {
title: 'Example: Inner Blocks',
- category: 'layout',
+ category: 'design',
edit: function( props ) {
return el(
diff --git a/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md b/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md
index c25943645c50d2..6ba06f0981009a 100644
--- a/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md
+++ b/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md
@@ -61,7 +61,7 @@ const blockStyle = {
registerBlockType( 'gutenberg-examples/example-01-basic-esnext', {
title: 'Example: Basic (esnext)',
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
example: {},
edit() {
return Hello World, step 1 (from the editor).
;
@@ -85,7 +85,7 @@ registerBlockType( 'gutenberg-examples/example-01-basic-esnext', {
blocks.registerBlockType( 'gutenberg-examples/example-01-basic', {
title: 'Example: Basic',
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
example: {},
edit: function() {
return el(
diff --git a/docs/designers-developers/developers/tutorials/javascript/js-build-setup.md b/docs/designers-developers/developers/tutorials/javascript/js-build-setup.md
index c1a9214ee5e754..c917d1e59e7965 100644
--- a/docs/designers-developers/developers/tutorials/javascript/js-build-setup.md
+++ b/docs/designers-developers/developers/tutorials/javascript/js-build-setup.md
@@ -107,7 +107,7 @@ import { registerBlockType } from '@wordpress/blocks';
registerBlockType( 'myguten/test-block', {
title: 'Basic Example',
icon: 'smiley',
- category: 'layout',
+ category: 'design',
edit: () => Hola, mundo!
,
save: () => Hola, mundo!
,
} );
diff --git a/docs/designers-developers/developers/tutorials/metabox/meta-block-3-add.md b/docs/designers-developers/developers/tutorials/metabox/meta-block-3-add.md
index 9d5eaf2e403e5c..726731f234f065 100644
--- a/docs/designers-developers/developers/tutorials/metabox/meta-block-3-add.md
+++ b/docs/designers-developers/developers/tutorials/metabox/meta-block-3-add.md
@@ -21,7 +21,7 @@ Add this code to your JavaScript file (this tutorial will call the file `myguten
registerBlockType( 'myguten/meta-block', {
title: 'Meta Block',
icon: 'smiley',
- category: 'common',
+ category: 'text',
edit: function( props ) {
var className = props.className;
@@ -82,7 +82,7 @@ import { useEntityProp } from '@wordpress/core-data';
registerBlockType( 'myguten/meta-block', {
title: 'Meta Block',
icon: 'smiley',
- category: 'common',
+ category: 'text',
edit( { className, setAttributes, attributes } ) {
const postType = useSelect(
diff --git a/docs/rfc/block-registration.md b/docs/rfc/block-registration.md
index 7455ed6b2f0398..4ade195f11b3b5 100644
--- a/docs/rfc/block-registration.md
+++ b/docs/rfc/block-registration.md
@@ -64,7 +64,7 @@ To register a new block type, start by creating a `block.json` file. This file:
{
"name": "my-plugin/notice",
"title": "Notice",
- "category": "common",
+ "category": "text",
"parent": [ "core/group" ],
"icon": "star",
"description": "Shows warning, error or success notices ...",
@@ -134,7 +134,7 @@ This is the display title for your block, which can be translated with our trans
* Property: `category`
```json
-{ "category": "common" }
+{ "category": "text" }
```
Blocks are grouped into categories to help users browse and discover them.
@@ -149,7 +149,7 @@ The core provided categories are:
Plugins and Themes can also register [custom block categories](/docs/designers-developers/developers/filters/block-filters.md#managing-block-categories).
-An implementation should expect and tolerate unknown categories, providing some reasonable fallback behavior (e.g. a "common" category).
+An implementation should expect and tolerate unknown categories, providing some reasonable fallback behavior (e.g. a "text" category).
### Parent
diff --git a/lib/compat.php b/lib/compat.php
index 420cec1d39649d..650074bdfe3b48 100644
--- a/lib/compat.php
+++ b/lib/compat.php
@@ -168,6 +168,55 @@ function gutenberg_get_post_from_context() {
return get_post();
}
+/**
+ * Filters default block categories to substitute legacy category names with new
+ * block categories.
+ *
+ * This can be removed when plugin support requires WordPress 5.4.0+.
+ *
+ * @see Trac Ticket TBD
+ *
+ * @param array[] $default_categories Array of block categories.
+ *
+ * @return array[] Filtered block categories.
+ */
+function gutenberg_replace_default_block_categories( $default_categories ) {
+ $substitution = array(
+ 'common' => array(
+ 'slug' => 'text',
+ 'title' => __( 'Text', 'gutenberg' ),
+ 'icon' => null,
+ ),
+ 'formatting' => array(
+ 'slug' => 'media',
+ 'title' => __( 'Media', 'gutenberg' ),
+ 'icon' => null,
+ ),
+ 'layout' => array(
+ 'slug' => 'design',
+ 'title' => __( 'Design', 'gutenberg' ),
+ 'icon' => null,
+ ),
+ );
+
+ // Loop default categories to perform in-place substitution by legacy slug.
+ foreach ( $default_categories as $i => $default_category ) {
+ $slug = $default_category['slug'];
+ if ( isset( $substitution[ $slug ] ) ) {
+ $default_categories[ $i ] = $substitution[ $slug ];
+ unset( $substitution[ $slug ] );
+ }
+ }
+
+ /*
+ * At this point, `$substitution` should contain only the categories which
+ * could not be in-place substituted with a default category, presumably due
+ * to earlier filtering of the default categories. These should be appended.
+ */
+ return array_merge( $default_categories, array_values( $substitution ) );
+}
+add_filter( 'block_categories', 'gutenberg_replace_default_block_categories' );
+
/**
* Shim that hooks into `pre_render_block` so as to override `render_block` with
* a function that assigns block context.
diff --git a/packages/block-editor/src/autocompleters/test/block.js b/packages/block-editor/src/autocompleters/test/block.js
index 91a7c164cf396e..11437cf1714984 100644
--- a/packages/block-editor/src/autocompleters/test/block.js
+++ b/packages/block-editor/src/autocompleters/test/block.js
@@ -73,14 +73,14 @@ describe( 'block', () => {
name: 'core/foo',
title: 'foo',
keywords: [ 'foo-keyword-1', 'foo-keyword-2' ],
- category: 'formatting',
+ category: 'design',
};
const inserterItemWithTitleAndEmptyKeywords = {
name: 'core/bar',
title: 'bar',
// Intentionally empty keyword list
keywords: [],
- category: 'common',
+ category: 'text',
};
const inserterItemWithTitleAndUndefinedKeywords = {
name: 'core/baz',
@@ -91,12 +91,12 @@ describe( 'block', () => {
expect(
blockCompleter.getOptionKeywords( inserterItemWithTitleAndKeywords )
- ).toEqual( [ 'formatting', 'foo-keyword-1', 'foo-keyword-2', 'foo' ] );
+ ).toEqual( [ 'design', 'foo-keyword-1', 'foo-keyword-2', 'foo' ] );
expect(
blockCompleter.getOptionKeywords(
inserterItemWithTitleAndEmptyKeywords
)
- ).toEqual( [ 'common', 'bar' ] );
+ ).toEqual( [ 'text', 'bar' ] );
expect(
blockCompleter.getOptionKeywords(
inserterItemWithTitleAndUndefinedKeywords
diff --git a/packages/block-editor/src/components/block-edit/test/edit.js b/packages/block-editor/src/components/block-edit/test/edit.js
index 6c273de2351961..8c8c312bbe7c3a 100644
--- a/packages/block-editor/src/components/block-edit/test/edit.js
+++ b/packages/block-editor/src/components/block-edit/test/edit.js
@@ -36,7 +36,7 @@ describe( 'Edit', () => {
const edit = () => ;
registerBlockType( 'core/test-block', {
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
edit,
} );
@@ -50,7 +50,7 @@ describe( 'Edit', () => {
const save = () => ;
registerBlockType( 'core/test-block', {
save,
- category: 'common',
+ category: 'text',
title: 'block title',
} );
@@ -67,7 +67,7 @@ describe( 'Edit', () => {
registerBlockType( 'core/test-block', {
edit,
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
} );
@@ -84,7 +84,7 @@ describe( 'Edit', () => {
it( 'should assign context', () => {
const edit = ( { context } ) => context.value;
registerBlockType( 'core/test-block', {
- category: 'common',
+ category: 'text',
title: 'block title',
context: [ 'value' ],
edit,
@@ -104,7 +104,7 @@ describe( 'Edit', () => {
it( 'should assign context', () => {
const edit = ( { context } ) => context.value;
registerBlockType( 'core/test-block', {
- category: 'common',
+ category: 'text',
title: 'block title',
context: [ 'value' ],
supports: {
diff --git a/packages/block-editor/src/components/block-switcher/test/index.js b/packages/block-editor/src/components/block-switcher/test/index.js
index ce4d0246a60901..5bef2c5a52ff45 100644
--- a/packages/block-editor/src/components/block-switcher/test/index.js
+++ b/packages/block-editor/src/components/block-switcher/test/index.js
@@ -49,7 +49,7 @@ describe( 'BlockSwitcher', () => {
beforeAll( () => {
registerBlockType( 'core/heading', {
- category: 'common',
+ category: 'text',
title: 'Heading',
edit: () => {},
save: () => {},
@@ -71,7 +71,7 @@ describe( 'BlockSwitcher', () => {
} );
registerBlockType( 'core/paragraph', {
- category: 'common',
+ category: 'text',
title: 'Paragraph',
edit: () => {},
save: () => {},
diff --git a/packages/block-editor/src/components/inner-blocks/test/index.js b/packages/block-editor/src/components/inner-blocks/test/index.js
index ac242fe9ddb112..04018b65eda35c 100644
--- a/packages/block-editor/src/components/inner-blocks/test/index.js
+++ b/packages/block-editor/src/components/inner-blocks/test/index.js
@@ -25,7 +25,7 @@ describe( 'InnerBlocks', () => {
it( 'should return element as string, with inner blocks', () => {
registerBlockType( 'core/fruit', {
- category: 'common',
+ category: 'text',
title: 'fruit',
@@ -88,7 +88,7 @@ describe( 'InnerBlocks', () => {
);
},
- category: 'common',
+ category: 'text',
title: 'block title',
};
registerBlockType( 'core/test-block', blockType );
diff --git a/packages/block-editor/src/components/inserter/test/block-list.js b/packages/block-editor/src/components/inserter/test/block-list.js
index 5e51597c4c64b6..2e3bf78b3ffb5f 100644
--- a/packages/block-editor/src/components/inserter/test/block-list.js
+++ b/packages/block-editor/src/components/inserter/test/block-list.js
@@ -104,7 +104,7 @@ describe( 'InserterMenu', () => {
expect( embedTabTitle.textContent ).toBe( 'Embeds' );
expect( blocks ).toHaveLength( 2 );
expect( blocks[ 0 ].textContent ).toBe( 'YouTube' );
- expect( blocks[ 1 ].textContent ).toBe( 'A Text Embed' );
+ expect( blocks[ 1 ].textContent ).toBe( 'A Paragraph Embed' );
assertNoResultsMessageNotToBePresent( container );
} );
@@ -140,10 +140,10 @@ describe( 'InserterMenu', () => {
'.block-editor-block-types-list__item-title'
);
- expect( commonTabTitle.textContent ).toBe( 'Common blocks' );
+ expect( commonTabTitle.textContent ).toBe( 'Text' );
expect( blocks ).toHaveLength( 3 );
- expect( blocks[ 0 ].textContent ).toBe( 'Text' );
- expect( blocks[ 1 ].textContent ).toBe( 'Advanced Text' );
+ expect( blocks[ 0 ].textContent ).toBe( 'Paragraph' );
+ expect( blocks[ 1 ].textContent ).toBe( 'Advanced Paragraph' );
expect( blocks[ 2 ].textContent ).toBe( 'Some Other Block' );
assertNoResultsMessageNotToBePresent( container );
@@ -164,7 +164,7 @@ describe( 'InserterMenu', () => {
it( 'should allow searching for items', () => {
const { container } = render(
-
+
);
const matchingCategories = container.querySelectorAll(
@@ -172,7 +172,7 @@ describe( 'InserterMenu', () => {
);
expect( matchingCategories ).toHaveLength( 3 );
- expect( matchingCategories[ 0 ].textContent ).toBe( 'Common blocks' );
+ expect( matchingCategories[ 0 ].textContent ).toBe( 'Text' );
expect( matchingCategories[ 1 ].textContent ).toBe( 'Embeds' );
expect( matchingCategories[ 2 ].textContent ).toBe( 'Core' ); // "Core" namespace collection
@@ -186,13 +186,13 @@ describe( 'InserterMenu', () => {
expect( debouncedSpeak ).toHaveBeenCalledWith( '3 results found.' );
// Default block results.
- expect( blocks[ 0 ].textContent ).toBe( 'Text' );
- expect( blocks[ 1 ].textContent ).toBe( 'Advanced Text' );
- expect( blocks[ 2 ].textContent ).toBe( 'A Text Embed' );
+ expect( blocks[ 0 ].textContent ).toBe( 'Paragraph' );
+ expect( blocks[ 1 ].textContent ).toBe( 'Advanced Paragraph' );
+ expect( blocks[ 2 ].textContent ).toBe( 'A Paragraph Embed' );
// Collection results.
- expect( blocks[ 3 ].textContent ).toBe( 'Text' );
- expect( blocks[ 4 ].textContent ).toBe( 'Advanced Text' );
+ expect( blocks[ 3 ].textContent ).toBe( 'Paragraph' );
+ expect( blocks[ 4 ].textContent ).toBe( 'Advanced Paragraph' );
assertNoResultsMessageNotToBePresent( container );
} );
@@ -243,7 +243,7 @@ describe( 'InserterMenu', () => {
it( 'should trim whitespace of search terms', () => {
const { container } = render(
-
+
);
const matchingCategories = container.querySelectorAll(
@@ -251,7 +251,7 @@ describe( 'InserterMenu', () => {
);
expect( matchingCategories ).toHaveLength( 3 );
- expect( matchingCategories[ 0 ].textContent ).toBe( 'Common blocks' );
+ expect( matchingCategories[ 0 ].textContent ).toBe( 'Text' );
expect( matchingCategories[ 1 ].textContent ).toBe( 'Embeds' );
const blocks = container.querySelectorAll(
@@ -259,9 +259,9 @@ describe( 'InserterMenu', () => {
);
expect( blocks ).toHaveLength( 5 );
- expect( blocks[ 0 ].textContent ).toBe( 'Text' );
- expect( blocks[ 1 ].textContent ).toBe( 'Advanced Text' );
- expect( blocks[ 2 ].textContent ).toBe( 'A Text Embed' );
+ expect( blocks[ 0 ].textContent ).toBe( 'Paragraph' );
+ expect( blocks[ 1 ].textContent ).toBe( 'Advanced Paragraph' );
+ expect( blocks[ 2 ].textContent ).toBe( 'A Paragraph Embed' );
assertNoResultsMessageNotToBePresent( container );
} );
diff --git a/packages/block-editor/src/components/inserter/test/fixtures/index.js b/packages/block-editor/src/components/inserter/test/fixtures/index.js
index e0290fa8bed3ce..061d2948d675dd 100644
--- a/packages/block-editor/src/components/inserter/test/fixtures/index.js
+++ b/packages/block-editor/src/components/inserter/test/fixtures/index.js
@@ -1,7 +1,7 @@
export const categories = [
- { slug: 'common', title: 'Common blocks' },
- { slug: 'formatting', title: 'Formatting' },
- { slug: 'layout', title: 'Layout elements' },
+ { slug: 'text', title: 'Text' },
+ { slug: 'media', title: 'Media' },
+ { slug: 'design', title: 'Design' },
{ slug: 'widgets', title: 'Widgets' },
{ slug: 'embed', title: 'Embeds' },
{ slug: 'reusable', title: 'Reusable blocks' },
@@ -14,12 +14,12 @@ export const collections = {
},
};
-export const textItem = {
- id: 'core/text-block',
- name: 'core/text-block',
+export const paragraphItem = {
+ id: 'core/paragraph-block',
+ name: 'core/paragraph-block',
initialAttributes: {},
- title: 'Text',
- category: 'common',
+ title: 'Paragraph',
+ category: 'text',
isDisabled: false,
utility: 1,
};
@@ -48,12 +48,12 @@ export const withVariationsItem = {
],
};
-export const advancedTextItem = {
- id: 'core/advanced-text-block',
- name: 'core/advanced-text-block',
+export const advancedParagraphItem = {
+ id: 'core/advanced-paragraph-block',
+ name: 'core/advanced-paragraph-block',
initialAttributes: {},
- title: 'Advanced Text',
- category: 'common',
+ title: 'Advanced Paragraph',
+ category: 'text',
isDisabled: false,
utility: 1,
};
@@ -63,7 +63,7 @@ export const someOtherItem = {
name: 'core/some-other-block',
initialAttributes: {},
title: 'Some Other Block',
- category: 'common',
+ category: 'text',
isDisabled: false,
utility: 1,
};
@@ -73,7 +73,7 @@ export const moreItem = {
name: 'core/more-block',
initialAttributes: {},
title: 'More',
- category: 'layout',
+ category: 'design',
isDisabled: true,
utility: 1,
};
@@ -89,11 +89,11 @@ export const youtubeItem = {
utility: 1,
};
-export const textEmbedItem = {
- id: 'core-embed/a-text-embed',
- name: 'core-embed/a-text-embed',
+export const paragraphEmbedItem = {
+ id: 'core-embed/a-paragraph-embed',
+ name: 'core-embed/a-paragraph-embed',
initialAttributes: {},
- title: 'A Text Embed',
+ title: 'A Paragraph Embed',
category: 'embed',
isDisabled: false,
utility: 1,
@@ -110,12 +110,12 @@ export const reusableItem = {
};
export default [
- textItem,
withVariationsItem,
- advancedTextItem,
+ paragraphItem,
+ advancedParagraphItem,
someOtherItem,
moreItem,
youtubeItem,
- textEmbedItem,
+ paragraphEmbedItem,
reusableItem,
];
diff --git a/packages/block-editor/src/components/inserter/test/search-items.js b/packages/block-editor/src/components/inserter/test/search-items.js
index f4b24b14a28a46..1db4578daedfd8 100644
--- a/packages/block-editor/src/components/inserter/test/search-items.js
+++ b/packages/block-editor/src/components/inserter/test/search-items.js
@@ -4,11 +4,11 @@
import items, {
categories,
collections,
- textItem,
- advancedTextItem,
+ paragraphItem,
+ advancedParagraphItem,
moreItem,
youtubeItem,
- textEmbedItem,
+ paragraphEmbedItem,
} from './fixtures';
import { normalizeSearchTerm, searchBlockItems } from '../search-items';
@@ -45,8 +45,12 @@ describe( 'searchBlockItems', () => {
it( 'should search items using the title ignoring case', () => {
expect(
- searchBlockItems( items, categories, collections, 'TEXT' )
- ).toEqual( [ textItem, advancedTextItem, textEmbedItem ] );
+ searchBlockItems( items, categories, collections, 'paragraph' )
+ ).toEqual( [
+ paragraphItem,
+ advancedParagraphItem,
+ paragraphEmbedItem,
+ ] );
} );
it( 'should search items using the keywords and partial terms', () => {
@@ -57,7 +61,7 @@ describe( 'searchBlockItems', () => {
it( 'should search items using the categories', () => {
expect(
- searchBlockItems( items, categories, collections, 'LAYOUT' )
+ searchBlockItems( items, categories, collections, 'DESIGN' )
).toEqual( [ moreItem ] );
} );
diff --git a/packages/block-editor/src/components/inspector-controls/README.md b/packages/block-editor/src/components/inspector-controls/README.md
index 50719c8ab672a5..b43a4fbe7fd267 100644
--- a/packages/block-editor/src/components/inspector-controls/README.md
+++ b/packages/block-editor/src/components/inspector-controls/README.md
@@ -25,7 +25,7 @@ registerBlockType( 'my-plugin/inspector-controls-example', {
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
attributes: {
content: {
@@ -253,7 +253,7 @@ registerBlockType( 'my-plugin/inspector-controls-example', {
icon: 'universal-access-alt',
- category: 'layout',
+ category: 'design',
attributes: {
content: {
diff --git a/packages/block-editor/src/hooks/test/align.js b/packages/block-editor/src/hooks/test/align.js
index 9242cff172eabb..3feb9473433b34 100644
--- a/packages/block-editor/src/hooks/test/align.js
+++ b/packages/block-editor/src/hooks/test/align.js
@@ -28,7 +28,7 @@ import {
describe( 'align', () => {
const blockSettings = {
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
};
diff --git a/packages/block-editor/src/hooks/test/custom-class-name.js b/packages/block-editor/src/hooks/test/custom-class-name.js
index 8429a657859bde..d01e1a965a8744 100644
--- a/packages/block-editor/src/hooks/test/custom-class-name.js
+++ b/packages/block-editor/src/hooks/test/custom-class-name.js
@@ -11,13 +11,13 @@ import { getHTMLRootElementClasses } from '../custom-class-name';
describe( 'custom className', () => {
const blockSettings = {
save: () => ,
- category: 'common',
+ category: 'text',
title: 'block title',
};
const dynamicBlockSettings = {
save: () => null,
- category: 'common',
+ category: 'text',
title: 'block title',
};
diff --git a/packages/block-editor/src/hooks/test/generated-class-name.js b/packages/block-editor/src/hooks/test/generated-class-name.js
index 1bf447c48ce12c..7de89032719da5 100644
--- a/packages/block-editor/src/hooks/test/generated-class-name.js
+++ b/packages/block-editor/src/hooks/test/generated-class-name.js
@@ -17,7 +17,7 @@ describe( 'generated className', () => {
const blockSettings = {
name: 'chicken/ribs',
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
};
diff --git a/packages/block-editor/src/hooks/test/utils.js b/packages/block-editor/src/hooks/test/utils.js
index bb4d496ff477b2..adaa37f4816c63 100644
--- a/packages/block-editor/src/hooks/test/utils.js
+++ b/packages/block-editor/src/hooks/test/utils.js
@@ -16,7 +16,7 @@ import '../anchor';
describe( 'anchor', () => {
const blockSettings = {
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
};
diff --git a/packages/block-editor/src/store/test/effects.js b/packages/block-editor/src/store/test/effects.js
index 9b8702bb3342c5..1832e7fe2a8292 100644
--- a/packages/block-editor/src/store/test/effects.js
+++ b/packages/block-editor/src/store/test/effects.js
@@ -39,7 +39,7 @@ describe( 'effects', () => {
content: {},
},
save: () => 'Saved',
- category: 'common',
+ category: 'text',
title: 'block title',
};
@@ -93,7 +93,7 @@ describe( 'effects', () => {
};
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
const blockA = deepFreeze( {
@@ -165,7 +165,7 @@ describe( 'effects', () => {
};
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
registerBlockType( 'core/test-block-2', defaultBlockSettings );
@@ -216,7 +216,7 @@ describe( 'effects', () => {
};
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
registerBlockType( 'core/test-block-2', {
@@ -239,7 +239,7 @@ describe( 'effects', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block 2',
} );
const blockA = deepFreeze( {
diff --git a/packages/block-editor/src/store/test/reducer.js b/packages/block-editor/src/store/test/reducer.js
index fadf7b3f34ba9a..aa1b9fe8bcee97 100644
--- a/packages/block-editor/src/store/test/reducer.js
+++ b/packages/block-editor/src/store/test/reducer.js
@@ -169,7 +169,7 @@ describe( 'state', () => {
registerBlockType( 'core/test-block', {
save: noop,
edit: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
} );
@@ -183,13 +183,13 @@ describe( 'state', () => {
registerBlockType( 'core/test-parent-block', {
save: noop,
edit: noop,
- category: 'common',
+ category: 'text',
title: 'test parent block',
} );
registerBlockType( 'core/test-child-block', {
save: noop,
edit: noop,
- category: 'common',
+ category: 'text',
title: 'test child block 1',
attributes: {
attr: {
diff --git a/packages/block-editor/src/store/test/selectors.js b/packages/block-editor/src/store/test/selectors.js
index ad2311344b9ba1..9953f1c1188585 100644
--- a/packages/block-editor/src/store/test/selectors.js
+++ b/packages/block-editor/src/store/test/selectors.js
@@ -84,7 +84,7 @@ describe( 'selectors', () => {
registerBlockType( 'core/test-block-a', {
save: ( props ) => props.attributes.text,
- category: 'formatting',
+ category: 'design',
title: 'Test Block A',
icon: 'test',
keywords: [ 'testing' ],
@@ -92,7 +92,7 @@ describe( 'selectors', () => {
registerBlockType( 'core/test-block-b', {
save: ( props ) => props.attributes.text,
- category: 'common',
+ category: 'text',
title: 'Test Block B',
icon: 'test',
keywords: [ 'testing' ],
@@ -103,7 +103,7 @@ describe( 'selectors', () => {
registerBlockType( 'core/test-block-c', {
save: ( props ) => props.attributes.text,
- category: 'common',
+ category: 'text',
title: 'Test Block C',
icon: 'test',
keywords: [ 'testing' ],
@@ -112,7 +112,7 @@ describe( 'selectors', () => {
registerBlockType( 'core/test-freeform', {
save: ( props ) => { props.attributes.content },
- category: 'common',
+ category: 'text',
title: 'Test Freeform Content Handler',
icon: 'test',
attributes: {
@@ -124,7 +124,7 @@ describe( 'selectors', () => {
registerBlockType( 'core/post-content-child', {
save: () => null,
- category: 'common',
+ category: 'text',
title: 'Test Block Post Content Child',
icon: 'test',
keywords: [ 'testing' ],
@@ -2316,7 +2316,7 @@ describe( 'selectors', () => {
icon: {
src: 'test',
},
- category: 'formatting',
+ category: 'design',
keywords: [ 'testing' ],
variations: [],
isDisabled: false,
diff --git a/packages/block-library/src/audio/block.json b/packages/block-library/src/audio/block.json
index 685610017ad260..7ae7a1f3330737 100644
--- a/packages/block-library/src/audio/block.json
+++ b/packages/block-library/src/audio/block.json
@@ -1,6 +1,6 @@
{
"name": "core/audio",
- "category": "common",
+ "category": "text",
"attributes": {
"src": {
"type": "string",
diff --git a/packages/block-library/src/button/block.json b/packages/block-library/src/button/block.json
index a342ad63c9ff21..b2af0f5a4c4c15 100644
--- a/packages/block-library/src/button/block.json
+++ b/packages/block-library/src/button/block.json
@@ -1,6 +1,6 @@
{
"name": "core/button",
- "category": "layout",
+ "category": "design",
"parent": [
"core/buttons"
],
diff --git a/packages/block-library/src/buttons/block.json b/packages/block-library/src/buttons/block.json
index 93c7eea7015a16..4004a9591a99e6 100644
--- a/packages/block-library/src/buttons/block.json
+++ b/packages/block-library/src/buttons/block.json
@@ -1,6 +1,6 @@
{
"name": "core/buttons",
- "category": "layout",
+ "category": "design",
"supports": {
"align": true,
"alignWide": false,
diff --git a/packages/block-library/src/classic/block.json b/packages/block-library/src/classic/block.json
index 7cbeb054412929..63d2c9f37ee566 100644
--- a/packages/block-library/src/classic/block.json
+++ b/packages/block-library/src/classic/block.json
@@ -1,6 +1,6 @@
{
"name": "core/freeform",
- "category": "formatting",
+ "category": "text",
"attributes": {
"content": {
"type": "string",
diff --git a/packages/block-library/src/code/block.json b/packages/block-library/src/code/block.json
index 439190819d0118..d7cab6cf3424be 100644
--- a/packages/block-library/src/code/block.json
+++ b/packages/block-library/src/code/block.json
@@ -1,6 +1,6 @@
{
"name": "core/code",
- "category": "formatting",
+ "category": "text",
"attributes": {
"content": {
"type": "string",
diff --git a/packages/block-library/src/column/block.json b/packages/block-library/src/column/block.json
index a0a6514998cb90..328dbb6201e6a1 100644
--- a/packages/block-library/src/column/block.json
+++ b/packages/block-library/src/column/block.json
@@ -1,6 +1,6 @@
{
"name": "core/column",
- "category": "common",
+ "category": "text",
"parent": [
"core/columns"
],
diff --git a/packages/block-library/src/columns/block.json b/packages/block-library/src/columns/block.json
index 32081f92b1a484..a27c693b8134b8 100644
--- a/packages/block-library/src/columns/block.json
+++ b/packages/block-library/src/columns/block.json
@@ -1,6 +1,6 @@
{
"name": "core/columns",
- "category": "layout",
+ "category": "design",
"attributes": {
"verticalAlignment": {
"type": "string"
diff --git a/packages/block-library/src/cover/block.json b/packages/block-library/src/cover/block.json
index c0ef0dcd5eb086..13d4293e83c7dd 100644
--- a/packages/block-library/src/cover/block.json
+++ b/packages/block-library/src/cover/block.json
@@ -1,6 +1,6 @@
{
"name": "core/cover",
- "category": "common",
+ "category": "text",
"attributes": {
"url": {
"type": "string"
diff --git a/packages/block-library/src/file/block.json b/packages/block-library/src/file/block.json
index 55e2f9114be0a7..27f83b5bf918b6 100644
--- a/packages/block-library/src/file/block.json
+++ b/packages/block-library/src/file/block.json
@@ -1,6 +1,6 @@
{
"name": "core/file",
- "category": "common",
+ "category": "text",
"attributes": {
"id": {
"type": "number"
diff --git a/packages/block-library/src/gallery/block.json b/packages/block-library/src/gallery/block.json
index b5f6115187ec51..6bae6b8b41792a 100644
--- a/packages/block-library/src/gallery/block.json
+++ b/packages/block-library/src/gallery/block.json
@@ -1,6 +1,6 @@
{
"name": "core/gallery",
- "category": "common",
+ "category": "text",
"attributes": {
"images": {
"type": "array",
diff --git a/packages/block-library/src/group/block.json b/packages/block-library/src/group/block.json
index c9e6415e1342f2..ab4e81aa334426 100644
--- a/packages/block-library/src/group/block.json
+++ b/packages/block-library/src/group/block.json
@@ -1,6 +1,6 @@
{
"name": "core/group",
- "category": "layout",
+ "category": "design",
"attributes": {
"tagName": {
"type": "string",
diff --git a/packages/block-library/src/heading/block.json b/packages/block-library/src/heading/block.json
index 0068d10d793dfc..eb367c9c4bf735 100644
--- a/packages/block-library/src/heading/block.json
+++ b/packages/block-library/src/heading/block.json
@@ -1,6 +1,6 @@
{
"name": "core/heading",
- "category": "common",
+ "category": "text",
"attributes": {
"align": {
"type": "string"
diff --git a/packages/block-library/src/html/block.json b/packages/block-library/src/html/block.json
index 9b713268b265f7..52a5079cd2e3f9 100644
--- a/packages/block-library/src/html/block.json
+++ b/packages/block-library/src/html/block.json
@@ -1,6 +1,6 @@
{
"name": "core/html",
- "category": "formatting",
+ "category": "text",
"attributes": {
"content": {
"type": "string",
diff --git a/packages/block-library/src/image/block.json b/packages/block-library/src/image/block.json
index 797f17822d790e..4f7a519b192955 100644
--- a/packages/block-library/src/image/block.json
+++ b/packages/block-library/src/image/block.json
@@ -1,6 +1,6 @@
{
"name": "core/image",
- "category": "common",
+ "category": "text",
"attributes": {
"align": {
"type": "string"
diff --git a/packages/block-library/src/list/block.json b/packages/block-library/src/list/block.json
index 201c6ab4749375..e195a1b6f4c191 100644
--- a/packages/block-library/src/list/block.json
+++ b/packages/block-library/src/list/block.json
@@ -1,6 +1,6 @@
{
"name": "core/list",
- "category": "common",
+ "category": "text",
"attributes": {
"ordered": {
"type": "boolean",
diff --git a/packages/block-library/src/media-text/block.json b/packages/block-library/src/media-text/block.json
index ab046cb09c38ca..cfcd8b12f15994 100644
--- a/packages/block-library/src/media-text/block.json
+++ b/packages/block-library/src/media-text/block.json
@@ -1,6 +1,6 @@
{
"name": "core/media-text",
- "category": "layout",
+ "category": "design",
"attributes": {
"align": {
"type": "string",
diff --git a/packages/block-library/src/missing/block.json b/packages/block-library/src/missing/block.json
index 5b5677b06934d1..57a246966d713c 100644
--- a/packages/block-library/src/missing/block.json
+++ b/packages/block-library/src/missing/block.json
@@ -1,6 +1,6 @@
{
"name": "core/missing",
- "category": "common",
+ "category": "text",
"attributes": {
"originalName": {
"type": "string"
diff --git a/packages/block-library/src/more/block.json b/packages/block-library/src/more/block.json
index bed9393f543886..7697b06ac403e8 100644
--- a/packages/block-library/src/more/block.json
+++ b/packages/block-library/src/more/block.json
@@ -1,6 +1,6 @@
{
"name": "core/more",
- "category": "layout",
+ "category": "design",
"attributes": {
"customText": {
"type": "string"
diff --git a/packages/block-library/src/navigation-link/block.json b/packages/block-library/src/navigation-link/block.json
index bf3b04e5884e77..b6be7a4206e4a8 100644
--- a/packages/block-library/src/navigation-link/block.json
+++ b/packages/block-library/src/navigation-link/block.json
@@ -1,6 +1,6 @@
{
"name": "core/navigation-link",
- "category": "layout",
+ "category": "design",
"parent": [
"core/navigation"
],
diff --git a/packages/block-library/src/navigation/block.json b/packages/block-library/src/navigation/block.json
index 8eb6f9a0d74e72..2da6cd5b3fa207 100644
--- a/packages/block-library/src/navigation/block.json
+++ b/packages/block-library/src/navigation/block.json
@@ -1,6 +1,6 @@
{
"name": "core/navigation",
- "category": "layout",
+ "category": "design",
"attributes": {
"orientation": {
"type": "string"
diff --git a/packages/block-library/src/nextpage/block.json b/packages/block-library/src/nextpage/block.json
index 1344807727186b..ed9293b2a9b95a 100644
--- a/packages/block-library/src/nextpage/block.json
+++ b/packages/block-library/src/nextpage/block.json
@@ -1,6 +1,6 @@
{
"name": "core/nextpage",
- "category": "layout",
+ "category": "design",
"parent": [ "core/post-content" ],
"supports": {
"customClassName": false,
diff --git a/packages/block-library/src/paragraph/block.json b/packages/block-library/src/paragraph/block.json
index 4454e09926a216..ae17bc373f2062 100644
--- a/packages/block-library/src/paragraph/block.json
+++ b/packages/block-library/src/paragraph/block.json
@@ -1,6 +1,6 @@
{
"name": "core/paragraph",
- "category": "common",
+ "category": "text",
"attributes": {
"align": {
"type": "string"
diff --git a/packages/block-library/src/post-author/block.json b/packages/block-library/src/post-author/block.json
index ee77d2aff0e0fa..6a59b0fe5f1b32 100644
--- a/packages/block-library/src/post-author/block.json
+++ b/packages/block-library/src/post-author/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-author",
- "category": "layout",
+ "category": "design",
"attributes": {
"align": {
"type": "string"
diff --git a/packages/block-library/src/post-comments-count/block.json b/packages/block-library/src/post-comments-count/block.json
index d975f4a0a9f79a..f41d613f2e6b44 100644
--- a/packages/block-library/src/post-comments-count/block.json
+++ b/packages/block-library/src/post-comments-count/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-comments-count",
- "category": "layout",
+ "category": "design",
"context": [
"postId"
],
diff --git a/packages/block-library/src/post-comments-form/block.json b/packages/block-library/src/post-comments-form/block.json
index ab6fb1a89d7dce..cbf6c6b7199b56 100644
--- a/packages/block-library/src/post-comments-form/block.json
+++ b/packages/block-library/src/post-comments-form/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-comments-form",
- "category": "layout",
+ "category": "design",
"context": [
"postId"
],
diff --git a/packages/block-library/src/post-comments/block.json b/packages/block-library/src/post-comments/block.json
index 5dd415e52f047d..ae0e5317336c5c 100644
--- a/packages/block-library/src/post-comments/block.json
+++ b/packages/block-library/src/post-comments/block.json
@@ -1,5 +1,5 @@
{
"name": "core/post-comments",
- "category": "layout",
+ "category": "design",
"context": [ "postId" ]
}
diff --git a/packages/block-library/src/post-content/block.json b/packages/block-library/src/post-content/block.json
index 3d978ec2f8baa5..c67f01f5054048 100644
--- a/packages/block-library/src/post-content/block.json
+++ b/packages/block-library/src/post-content/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-content",
- "category": "layout",
+ "category": "design",
"context": [
"postId",
"postType"
diff --git a/packages/block-library/src/post-date/block.json b/packages/block-library/src/post-date/block.json
index 85e26c63edd835..95bb439c0b33f8 100644
--- a/packages/block-library/src/post-date/block.json
+++ b/packages/block-library/src/post-date/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-date",
- "category": "layout",
+ "category": "design",
"attributes": {
"format": {
"type": "string"
diff --git a/packages/block-library/src/post-excerpt/block.json b/packages/block-library/src/post-excerpt/block.json
index 62d67975a9628c..764d519bb5b037 100644
--- a/packages/block-library/src/post-excerpt/block.json
+++ b/packages/block-library/src/post-excerpt/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-excerpt",
- "category": "layout",
+ "category": "design",
"attributes": {
"wordCount": {
"type": "number",
diff --git a/packages/block-library/src/post-featured-image/block.json b/packages/block-library/src/post-featured-image/block.json
index 12001131982e9f..29fb3d2141cec7 100644
--- a/packages/block-library/src/post-featured-image/block.json
+++ b/packages/block-library/src/post-featured-image/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-featured-image",
- "category": "layout",
+ "category": "design",
"context": [
"postId"
],
diff --git a/packages/block-library/src/post-tags/block.json b/packages/block-library/src/post-tags/block.json
index 974a7cb42995ba..a3c624b012d74f 100644
--- a/packages/block-library/src/post-tags/block.json
+++ b/packages/block-library/src/post-tags/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-tags",
- "category": "layout",
+ "category": "design",
"context": [
"postId"
],
diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json
index a136fc1cc36211..4142f4cb1d887c 100644
--- a/packages/block-library/src/post-title/block.json
+++ b/packages/block-library/src/post-title/block.json
@@ -1,6 +1,6 @@
{
"name": "core/post-title",
- "category": "layout",
+ "category": "design",
"context": [
"postId",
"postType"
diff --git a/packages/block-library/src/preformatted/block.json b/packages/block-library/src/preformatted/block.json
index 9c5728fe07fb19..8220666e29b470 100644
--- a/packages/block-library/src/preformatted/block.json
+++ b/packages/block-library/src/preformatted/block.json
@@ -1,6 +1,6 @@
{
"name": "core/preformatted",
- "category": "formatting",
+ "category": "text",
"attributes": {
"content": {
"type": "string",
diff --git a/packages/block-library/src/pullquote/block.json b/packages/block-library/src/pullquote/block.json
index 91a7d738ee9e83..08ebd960d5e282 100644
--- a/packages/block-library/src/pullquote/block.json
+++ b/packages/block-library/src/pullquote/block.json
@@ -1,6 +1,6 @@
{
"name": "core/pullquote",
- "category": "formatting",
+ "category": "text",
"attributes": {
"value": {
"type": "string",
diff --git a/packages/block-library/src/query-loop/block.json b/packages/block-library/src/query-loop/block.json
index d3ba95c748cc58..a3f8beb410c292 100644
--- a/packages/block-library/src/query-loop/block.json
+++ b/packages/block-library/src/query-loop/block.json
@@ -1,6 +1,6 @@
{
"name": "core/query-loop",
- "category": "layout",
+ "category": "design",
"context": [
"queryId",
"query",
diff --git a/packages/block-library/src/query-pagination/block.json b/packages/block-library/src/query-pagination/block.json
index 6ac6538e601188..f18886c44e2781 100644
--- a/packages/block-library/src/query-pagination/block.json
+++ b/packages/block-library/src/query-pagination/block.json
@@ -1,6 +1,6 @@
{
"name": "core/query-pagination",
- "category": "layout",
+ "category": "design",
"context": [
"queryId",
"query",
diff --git a/packages/block-library/src/query/block.json b/packages/block-library/src/query/block.json
index 598f5e970a167c..0fdba78eee4132 100644
--- a/packages/block-library/src/query/block.json
+++ b/packages/block-library/src/query/block.json
@@ -1,6 +1,6 @@
{
"name": "core/query",
- "category": "layout",
+ "category": "design",
"attributes": {
"queryId": {
"type": "number"
diff --git a/packages/block-library/src/quote/block.json b/packages/block-library/src/quote/block.json
index 05b07ad5bb2d19..fe0ebe158638f5 100644
--- a/packages/block-library/src/quote/block.json
+++ b/packages/block-library/src/quote/block.json
@@ -1,6 +1,6 @@
{
"name": "core/quote",
- "category": "common",
+ "category": "text",
"attributes": {
"value": {
"type": "string",
diff --git a/packages/block-library/src/separator/block.json b/packages/block-library/src/separator/block.json
index 98bcbb9150609f..be78a415d8d0ec 100644
--- a/packages/block-library/src/separator/block.json
+++ b/packages/block-library/src/separator/block.json
@@ -1,6 +1,6 @@
{
"name": "core/separator",
- "category": "layout",
+ "category": "design",
"attributes": {
"color": {
"type": "string"
diff --git a/packages/block-library/src/site-title/block.json b/packages/block-library/src/site-title/block.json
index 8b72dd854e4b24..7087b059fa0f1e 100644
--- a/packages/block-library/src/site-title/block.json
+++ b/packages/block-library/src/site-title/block.json
@@ -1,6 +1,6 @@
{
"name": "core/site-title",
- "category": "layout",
+ "category": "design",
"attributes": {
"level": {
"type": "number",
diff --git a/packages/block-library/src/spacer/block.json b/packages/block-library/src/spacer/block.json
index c8240f036ca774..4719c6305b78ae 100644
--- a/packages/block-library/src/spacer/block.json
+++ b/packages/block-library/src/spacer/block.json
@@ -1,6 +1,6 @@
{
"name": "core/spacer",
- "category": "layout",
+ "category": "design",
"attributes": {
"height": {
"type": "number",
diff --git a/packages/block-library/src/subhead/block.json b/packages/block-library/src/subhead/block.json
index 2c212d0db960e1..b79fdf6a8f9abd 100644
--- a/packages/block-library/src/subhead/block.json
+++ b/packages/block-library/src/subhead/block.json
@@ -1,6 +1,6 @@
{
"name": "core/subhead",
- "category": "common",
+ "category": "text",
"attributes": {
"align": {
"type": "string"
diff --git a/packages/block-library/src/table/block.json b/packages/block-library/src/table/block.json
index 0d4b05794a74d1..81583f20508cbb 100644
--- a/packages/block-library/src/table/block.json
+++ b/packages/block-library/src/table/block.json
@@ -1,6 +1,6 @@
{
"name": "core/table",
- "category": "formatting",
+ "category": "text",
"attributes": {
"hasFixedLayout": {
"type": "boolean",
diff --git a/packages/block-library/src/template-part/block.json b/packages/block-library/src/template-part/block.json
index 86807ca749e084..bd381e4dd073dc 100644
--- a/packages/block-library/src/template-part/block.json
+++ b/packages/block-library/src/template-part/block.json
@@ -1,6 +1,6 @@
{
"name": "core/template-part",
- "category": "layout",
+ "category": "design",
"attributes": {
"postId": {
"type": "number"
diff --git a/packages/block-library/src/text-columns/block.json b/packages/block-library/src/text-columns/block.json
index 066d5ddc47da4d..32f1651d4044cb 100644
--- a/packages/block-library/src/text-columns/block.json
+++ b/packages/block-library/src/text-columns/block.json
@@ -1,7 +1,7 @@
{
"name": "core/text-columns",
"icon": "columns",
- "category": "layout",
+ "category": "design",
"attributes": {
"content": {
"type": "array",
diff --git a/packages/block-library/src/verse/block.json b/packages/block-library/src/verse/block.json
index f6c4191456e560..88fc168d452061 100644
--- a/packages/block-library/src/verse/block.json
+++ b/packages/block-library/src/verse/block.json
@@ -1,6 +1,6 @@
{
"name": "core/verse",
- "category": "formatting",
+ "category": "text",
"attributes": {
"content": {
"type": "string",
diff --git a/packages/block-library/src/video/block.json b/packages/block-library/src/video/block.json
index 7b28b024d19e6e..4b8253414deca4 100644
--- a/packages/block-library/src/video/block.json
+++ b/packages/block-library/src/video/block.json
@@ -1,6 +1,6 @@
{
"name": "core/video",
- "category": "common",
+ "category": "text",
"attributes": {
"autoplay": {
"type": "boolean",
diff --git a/packages/blocks/README.md b/packages/blocks/README.md
index d6cf2684deaea6..b879358305fa1c 100644
--- a/packages/blocks/README.md
+++ b/packages/blocks/README.md
@@ -99,7 +99,7 @@ add_action( 'enqueue_block_editor_assets', 'random_image_enqueue_block_editor_as
icon: 'format-image',
- category: 'common',
+ category: 'text',
attributes: {
category: {
diff --git a/packages/blocks/src/api/registration.js b/packages/blocks/src/api/registration.js
index d20af322af4fd2..9cbe9d418331df 100644
--- a/packages/blocks/src/api/registration.js
+++ b/packages/blocks/src/api/registration.js
@@ -3,7 +3,7 @@
/**
* External dependencies
*/
-import { get, isFunction, isPlainObject, omit, pick, some } from 'lodash';
+import { get, omit, pick, isFunction, isPlainObject } from 'lodash';
/**
* WordPress dependencies
@@ -203,12 +203,9 @@ export function registerBlockType( name, settings ) {
console.error( 'The "edit" property must be a valid function.' );
return;
}
- if (
- 'category' in settings &&
- ! some( select( 'core/blocks' ).getCategories(), {
- slug: settings.category,
- } )
- ) {
+
+ const category = select( 'core/blocks' ).getCategory( settings.category );
+ if ( ! category ) {
console.warn(
'The block "' +
name +
@@ -218,6 +215,12 @@ export function registerBlockType( name, settings ) {
);
delete settings.category;
}
+
+ // `getCategory` handles canonicalization of a category, which may yield a
+ // different slug from the provided settings. Ensure that the settings value
+ // references the normalized value.
+ settings.category = category?.slug;
+
if ( ! ( 'title' in settings ) || settings.title === '' ) {
console.error( 'The block "' + name + '" must have a title.' );
return;
diff --git a/packages/blocks/src/api/test/factory.js b/packages/blocks/src/api/test/factory.js
index 641745ddeeb3cc..767ddd761b0a7e 100644
--- a/packages/blocks/src/api/test/factory.js
+++ b/packages/blocks/src/api/test/factory.js
@@ -34,7 +34,7 @@ describe( 'block factory', () => {
},
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
};
@@ -66,7 +66,7 @@ describe( 'block factory', () => {
},
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
const block = createBlock( 'core/test-block', { align: 'left' }, [
@@ -174,7 +174,7 @@ describe( 'block factory', () => {
},
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
const block = deepFreeze(
@@ -209,7 +209,7 @@ describe( 'block factory', () => {
},
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
const block = deepFreeze(
@@ -241,7 +241,7 @@ describe( 'block factory', () => {
},
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
const block = deepFreeze(
@@ -293,7 +293,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -329,7 +329,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -363,7 +363,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -401,7 +401,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType(
@@ -443,7 +443,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -485,7 +485,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType(
@@ -536,7 +536,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -578,7 +578,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/another-text-block', {
@@ -598,7 +598,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'another text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -640,7 +640,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -682,7 +682,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -719,7 +719,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -753,7 +753,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -788,7 +788,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -824,7 +824,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -859,7 +859,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -898,7 +898,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'A block that groups other blocks.',
} );
} );
@@ -987,7 +987,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -1037,7 +1037,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'text-block',
} );
@@ -1096,7 +1096,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -1129,7 +1129,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -1168,7 +1168,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -1212,7 +1212,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/text-block', defaultBlockSettings );
@@ -1253,7 +1253,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'text block',
} );
@@ -1298,7 +1298,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'text block',
} );
@@ -1344,7 +1344,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'text block',
} );
@@ -1408,7 +1408,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated columns block',
} );
registerBlockType( 'core/columns-block', defaultBlockSettings );
@@ -1467,7 +1467,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated columns block',
} );
registerBlockType( 'core/columns-block', defaultBlockSettings );
@@ -1532,7 +1532,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'Test Group Block',
} );
@@ -1593,7 +1593,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'Test Group Block',
} );
@@ -1629,7 +1629,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
registerBlockType( 'core/transform-from-text-block-2', {
@@ -1641,7 +1641,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'updated text block',
} );
} );
@@ -1811,7 +1811,7 @@ describe( 'block factory', () => {
],
},
save: noop,
- category: 'common',
+ category: 'text',
title: 'A Block with InnerBlocks that supports grouping',
} );
} );
diff --git a/packages/blocks/src/api/test/parser.js b/packages/blocks/src/api/test/parser.js
index be377dd956da0a..add399395072bd 100644
--- a/packages/blocks/src/api/test/parser.js
+++ b/packages/blocks/src/api/test/parser.js
@@ -39,12 +39,12 @@ describe( 'block parser', () => {
},
},
save: ( { attributes } ) => attributes.fruit || null,
- category: 'common',
+ category: 'text',
title: 'block title',
};
const unknownBlockSettings = {
- category: 'common',
+ category: 'text',
title: 'unknown block',
attributes: {
content: {
@@ -892,7 +892,7 @@ describe( 'block parser', () => {
chicken: { type: 'string' },
},
save: ( { attributes } ) => attributes.content,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
@@ -928,7 +928,7 @@ describe( 'block parser', () => {
},
},
save: ( { attributes } ) => attributes.content,
- category: 'common',
+ category: 'text',
title: 'test block',
} );
@@ -1054,7 +1054,7 @@ describe( 'block parser', () => {
it( 'should parse with unicode escaped returned to original representation', () => {
registerBlockType( 'core/code', {
- category: 'common',
+ category: 'text',
title: 'Code Block',
attributes: {
content: {
diff --git a/packages/blocks/src/api/test/registration.js b/packages/blocks/src/api/test/registration.js
index 08e4c11153e347..377f3d139b2d9e 100644
--- a/packages/blocks/src/api/test/registration.js
+++ b/packages/blocks/src/api/test/registration.js
@@ -41,7 +41,7 @@ import { DEPRECATED_ENTRY_KEYS } from '../constants';
describe( 'blocks', () => {
const defaultBlockSettings = {
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
};
@@ -126,7 +126,7 @@ describe( 'blocks', () => {
attributes: {},
keywords: [],
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
} );
} );
@@ -160,7 +160,7 @@ describe( 'blocks', () => {
const blockType = {
save: noop,
edit: 'not-a-function',
- category: 'common',
+ category: 'text',
title: 'block title',
},
block = registerBlockType(
@@ -194,7 +194,7 @@ describe( 'blocks', () => {
const blockType = {
settingName: 'settingValue',
save: noop,
- category: 'common',
+ category: 'text',
},
block = registerBlockType(
'my-plugin/fancy-block-9',
@@ -210,7 +210,7 @@ describe( 'blocks', () => {
const blockType = {
settingName: 'settingValue',
save: noop,
- category: 'common',
+ category: 'text',
title: '',
},
block = registerBlockType(
@@ -227,7 +227,7 @@ describe( 'blocks', () => {
const blockType = {
settingName: 'settingValue',
save: noop,
- category: 'common',
+ category: 'text',
title: 12345,
},
block = registerBlockType(
@@ -243,13 +243,13 @@ describe( 'blocks', () => {
it( 'should assign default settings', () => {
registerBlockType( 'core/test-block-with-defaults', {
title: 'block title',
- category: 'common',
+ category: 'text',
} );
expect( getBlockType( 'core/test-block-with-defaults' ) ).toEqual( {
name: 'core/test-block-with-defaults',
title: 'block title',
- category: 'common',
+ category: 'text',
icon: {
src: blockIcon,
},
@@ -268,7 +268,7 @@ describe( 'blocks', () => {
const blockType = {
settingName: 'settingValue',
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
};
registerBlockType( 'core/test-block-with-attributes', blockType );
@@ -277,7 +277,7 @@ describe( 'blocks', () => {
name: 'core/test-block-with-attributes',
settingName: 'settingValue',
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
icon: {
src: blockIcon,
@@ -295,7 +295,7 @@ describe( 'blocks', () => {
it( 'should validate the icon', () => {
const blockType = {
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
icon: { chicken: 'ribs' },
};
@@ -310,7 +310,7 @@ describe( 'blocks', () => {
it( 'should normalize the icon containing an element', () => {
const blockType = {
save: noop,
- category: 'common',
+ category: 'text',
title: 'block title',
icon: (