From 7b4ca4f9ce05523e1d889356dfd2617cdfc75e52 Mon Sep 17 00:00:00 2001 From: thisissandip Date: Fri, 28 May 2021 15:37:00 +0530 Subject: [PATCH 1/2] Add Convert to Regular Blocks button to ellipsis Dropdown --- .../reusable-blocks-manage-button.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js index cb478855c757a..e68dc155d42bf 100644 --- a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js +++ b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js @@ -4,7 +4,7 @@ import { MenuItem } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { isReusableBlock } from '@wordpress/blocks'; -import { useSelect } from '@wordpress/data'; +import { useSelect, useDispatch } from '@wordpress/data'; import { BlockSettingsMenuControls, store as blockEditorStore, @@ -12,6 +12,11 @@ import { import { addQueryArgs } from '@wordpress/url'; import { store as coreStore } from '@wordpress/core-data'; +/** + * Internal dependencies + */ +import { store as reusableBlocksStore } from '../../store'; + function ReusableBlocksManageButton( { clientId } ) { const { isVisible } = useSelect( ( select ) => { @@ -33,6 +38,10 @@ function ReusableBlocksManageButton( { clientId } ) { [ clientId ] ); + const { + __experimentalConvertBlockToStatic: convertBlockToStatic, + } = useDispatch( reusableBlocksStore ); + if ( ! isVisible ) { return null; } @@ -44,6 +53,9 @@ function ReusableBlocksManageButton( { clientId } ) { > { __( 'Manage Reusable blocks' ) } + convertBlockToStatic( clientId ) }> + { __( 'Convert to Regular Blocks' ) } + ); } From 940b144e88ea237db0ca64c557f41ff564246ade Mon Sep 17 00:00:00 2001 From: thisissandip <69596988+thisissandip@users.noreply.github.com> Date: Fri, 28 May 2021 19:41:25 +0530 Subject: [PATCH 2/2] Update title to "Convert to regular blocks" Co-authored-by: Nik Tsekouras --- .../reusable-blocks-menu-items/reusable-blocks-manage-button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js index e68dc155d42bf..94e1e1d2f1735 100644 --- a/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js +++ b/packages/reusable-blocks/src/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js @@ -54,7 +54,7 @@ function ReusableBlocksManageButton( { clientId } ) { { __( 'Manage Reusable blocks' ) } convertBlockToStatic( clientId ) }> - { __( 'Convert to Regular Blocks' ) } + { __( 'Convert to regular blocks' ) } );