Skip to content

Commit

Permalink
Remove the limit of 3 keywords for the block registration (#13848)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
gziolo authored and youknowriad committed Mar 6, 2019
1 parent 72b85d7 commit ffcf4eb
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 0 additions & 6 deletions packages/blocks/src/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
7 changes: 0 additions & 7 deletions packages/blocks/src/api/test/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit ffcf4eb

Please sign in to comment.