From ffcf4eb379e68f03699382539bc90c1ba4ad2ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20=28Greg=29=20Zi=C3=B3=C5=82kowski?= Date: Wed, 13 Feb 2019 09:37:03 +0100 Subject: [PATCH] Remove the limit of 3 keywords for the block registration (#13848) * Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords. * Fixes #11949: Error: The block "xxx" can have a maximum of 3 keywords. * Fixes #11949: Error: The block xxx can have a maximum of 3 keywords. --- .../developers/block-api/block-registration.md | 2 +- packages/blocks/src/api/registration.js | 6 ------ packages/blocks/src/api/test/registration.js | 7 ------- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/docs/designers-developers/developers/block-api/block-registration.md b/docs/designers-developers/developers/block-api/block-registration.md index 4bc32fb9f4e0fa..f4a214b741fbe2 100644 --- a/docs/designers-developers/developers/block-api/block-registration.md +++ b/docs/designers-developers/developers/block-api/block-registration.md @@ -104,7 +104,7 @@ icon: { * **Type:** `Array` -Sometimes a block could have aliases that help users discover it while searching. For example, an `image` block could also want to be discovered by `photo`. You can do so by providing an array of terms (which can be translated). It is only allowed to add as much as three terms per block. +Sometimes a block could have aliases that help users discover it while searching. For example, an `image` block could also want to be discovered by `photo`. You can do so by providing an array of terms (which can be translated). ```js // Make it easier to discover a block with keyword aliases. diff --git a/packages/blocks/src/api/registration.js b/packages/blocks/src/api/registration.js index 14cf00652b728c..d32a49f8b7ff00 100644 --- a/packages/blocks/src/api/registration.js +++ b/packages/blocks/src/api/registration.js @@ -103,12 +103,6 @@ export function registerBlockType( name, settings ) { ); return; } - if ( 'keywords' in settings && settings.keywords.length > 3 ) { - console.error( - 'The block "' + name + '" can have a maximum of 3 keywords.' - ); - return; - } if ( ! ( 'category' in settings ) ) { console.error( 'The block "' + name + '" must have a category.' diff --git a/packages/blocks/src/api/test/registration.js b/packages/blocks/src/api/test/registration.js index e881943d5168ee..f7b20bcda9db07 100644 --- a/packages/blocks/src/api/test/registration.js +++ b/packages/blocks/src/api/test/registration.js @@ -119,13 +119,6 @@ describe( 'blocks', () => { expect( block ).toBeUndefined(); } ); - it( 'should reject blocks with more than 3 keywords', () => { - const blockType = { save: noop, keywords: [ 'apple', 'orange', 'lemon', 'pineapple' ], category: 'common', title: 'block title' }, - block = registerBlockType( 'my-plugin/fancy-block-7', blockType ); - expect( console ).toHaveErroredWith( 'The block "my-plugin/fancy-block-7" can have a maximum of 3 keywords.' ); - expect( block ).toBeUndefined(); - } ); - it( 'should reject blocks without category', () => { const blockType = { settingName: 'settingValue', save: noop, title: 'block title' }, block = registerBlockType( 'my-plugin/fancy-block-8', blockType );