From 6750167b31557445457ea1a833377a64710628a4 Mon Sep 17 00:00:00 2001 From: lipemat Date: Wed, 19 May 2021 11:25:30 -0400 Subject: [PATCH] Support passing an array of attribute keys to block variation isActive Instead of a callback, you may pass an array of attributes which are checked against the block to see if this variation is active. https://github.com/WordPress/gutenberg/pull/30913 --- wordpress__blocks/index.d.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wordpress__blocks/index.d.ts b/wordpress__blocks/index.d.ts index ee72a1a..4380356 100644 --- a/wordpress__blocks/index.d.ts +++ b/wordpress__blocks/index.d.ts @@ -34,6 +34,7 @@ declare module '@wordpress/blocks' { } } }; + /** * Shape and retrieval type for block data. * @@ -48,7 +49,6 @@ declare module '@wordpress/blocks' { } } - export type BlockEditProps = { className: string; setAttributes: ( newValue: { @@ -58,6 +58,11 @@ declare module '@wordpress/blocks' { isSelected: boolean } + /** + * Block Variation shape. + * + * @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/ + */ export type BlockVariation = { name: string; title: string; @@ -70,7 +75,7 @@ declare module '@wordpress/blocks' { example?: BlockExample; scope?: Array<'block' | 'inserter' | 'transform'>; keywords?: string[]; - isActive?: ( attr: BlockAttributes, variation: BlockAttributes ) => boolean; + isActive?: ( ( attr: BlockAttributes, variation: BlockAttributes ) => boolean ) | Array; } export type BlockExample = { @@ -233,7 +238,7 @@ declare module '@wordpress/blocks' { /** * Registers a new block variation for an existing block type. * - * @link https://make.wordpress.org/core/2020/02/27/introduce-block-variations-api/ + * @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/ * * @param blockName - Name of the block (example: “core/columns”). * @param variation - Object describing a block variation.