From c321de0a29d459a2ec682ae0bc4288575faa50ca Mon Sep 17 00:00:00 2001 From: Antony Agrios Date: Fri, 2 Jun 2023 17:50:44 +0300 Subject: [PATCH 1/6] Block manager: Add an enable all button for hidden blocks --- .../src/components/block-manager/index.js | 83 ++++++++++++------- .../src/components/block-manager/style.scss | 3 + 2 files changed, 55 insertions(+), 31 deletions(-) diff --git a/packages/edit-post/src/components/block-manager/index.js b/packages/edit-post/src/components/block-manager/index.js index 3adc2e3e91848f..a35c2c37de9953 100644 --- a/packages/edit-post/src/components/block-manager/index.js +++ b/packages/edit-post/src/components/block-manager/index.js @@ -2,11 +2,11 @@ * WordPress dependencies */ import { store as blocksStore } from '@wordpress/blocks'; -import { withSelect } from '@wordpress/data'; -import { SearchControl } from '@wordpress/components'; +import { withSelect, withDispatch } from '@wordpress/data'; +import { SearchControl, Button } from '@wordpress/components'; import { __, _n, sprintf } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; -import { useDebounce } from '@wordpress/compose'; +import { useDebounce, compose } from '@wordpress/compose'; import { speak } from '@wordpress/a11y'; /** @@ -21,6 +21,7 @@ function BlockManager( { hasBlockSupport, isMatchingSearchTerm, numberOfHiddenBlocks, + enableAllBlockTypes, } ) { const debouncedSpeak = useDebounce( speak, 500 ); const [ search, setSearch ] = useState( '' ); @@ -63,6 +64,13 @@ function BlockManager( { ), numberOfHiddenBlocks ) } + ) } { - const { - getBlockTypes, - getCategories, - hasBlockSupport, - isMatchingSearchTerm, - } = select( blocksStore ); - const { getHiddenBlockTypes } = select( editPostStore ); +export default compose( [ + withSelect( ( select ) => { + const { + getBlockTypes, + getCategories, + hasBlockSupport, + isMatchingSearchTerm, + } = select( blocksStore ); + const { getHiddenBlockTypes } = select( editPostStore ); - // Some hidden blocks become unregistered - // by removing for instance the plugin that registered them, yet - // they're still remain as hidden by the user's action. - // We consider "hidden", blocks which were hidden and - // are still registered. - const blockTypes = getBlockTypes(); - const hiddenBlockTypes = getHiddenBlockTypes().filter( ( hiddenBlock ) => { - return blockTypes.some( - ( registeredBlock ) => registeredBlock.name === hiddenBlock + // Some hidden blocks become unregistered + // by removing for instance the plugin that registered them, yet + // they're still remain as hidden by the user's action. + // We consider "hidden", blocks which were hidden and + // are still registered. + const blockTypes = getBlockTypes(); + const hiddenBlockTypes = getHiddenBlockTypes().filter( + ( hiddenBlock ) => { + return blockTypes.some( + ( registeredBlock ) => registeredBlock.name === hiddenBlock + ); + } ); - } ); - const numberOfHiddenBlocks = - Array.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length; + const numberOfHiddenBlocks = + Array.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length; - return { - blockTypes, - categories: getCategories(), - hasBlockSupport, - isMatchingSearchTerm, - numberOfHiddenBlocks, - }; -} )( BlockManager ); + return { + blockTypes, + categories: getCategories(), + hasBlockSupport, + isMatchingSearchTerm, + numberOfHiddenBlocks, + }; + } ), + withDispatch( ( dispatch ) => { + const { showBlockTypes } = dispatch( editPostStore ); + return { + enableAllBlockTypes: ( blockTypes ) => { + const blockNames = blockTypes.map( ( { name } ) => name ); + showBlockTypes( blockNames ); + }, + }; + } ), +] )( BlockManager ); diff --git a/packages/edit-post/src/components/block-manager/style.scss b/packages/edit-post/src/components/block-manager/style.scss index d8f9b78fe5a391..ac2124930cc34b 100644 --- a/packages/edit-post/src/components/block-manager/style.scss +++ b/packages/edit-post/src/components/block-manager/style.scss @@ -26,6 +26,9 @@ ~ .edit-post-block-manager__results .edit-post-block-manager__category-title { top: 35px; } + button { + margin-left: 18px; + } } .edit-post-block-manager__category { From 2e60dfe328e13f52ad75fa3ea371ff2673904847 Mon Sep 17 00:00:00 2001 From: Antony Agrios Date: Wed, 7 Jun 2023 12:30:31 +0300 Subject: [PATCH 2/6] Update packages/edit-post/src/components/block-manager/index.js Co-authored-by: Daniel Bachhuber --- packages/edit-post/src/components/block-manager/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-post/src/components/block-manager/index.js b/packages/edit-post/src/components/block-manager/index.js index a35c2c37de9953..dfe18cdfeb79e6 100644 --- a/packages/edit-post/src/components/block-manager/index.js +++ b/packages/edit-post/src/components/block-manager/index.js @@ -65,7 +65,7 @@ function BlockManager( { numberOfHiddenBlocks ) } From eade862bb865e2d7253957e2799878673f5ed3d0 Mon Sep 17 00:00:00 2001 From: Antony Agrios Date: Wed, 7 Jun 2023 19:50:11 +0300 Subject: [PATCH 4/6] Update: Change button text --- packages/edit-post/src/components/block-manager/index.js | 4 ++-- packages/edit-post/src/components/block-manager/style.scss | 4 ++-- packages/report-flaky-tests/src/markdown.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/edit-post/src/components/block-manager/index.js b/packages/edit-post/src/components/block-manager/index.js index 8c8076bb6f64bb..685c274f03a846 100644 --- a/packages/edit-post/src/components/block-manager/index.js +++ b/packages/edit-post/src/components/block-manager/index.js @@ -65,10 +65,10 @@ function BlockManager( { numberOfHiddenBlocks ) } ) } diff --git a/packages/edit-post/src/components/block-manager/style.scss b/packages/edit-post/src/components/block-manager/style.scss index ac2124930cc34b..1e5ceef2fa64b2 100644 --- a/packages/edit-post/src/components/block-manager/style.scss +++ b/packages/edit-post/src/components/block-manager/style.scss @@ -26,8 +26,8 @@ ~ .edit-post-block-manager__results .edit-post-block-manager__category-title { top: 35px; } - button { - margin-left: 18px; + .is-link { + margin-left: 12px; } } diff --git a/packages/report-flaky-tests/src/markdown.ts b/packages/report-flaky-tests/src/markdown.ts index 0f55c12a247130..6512b663447867 100644 --- a/packages/report-flaky-tests/src/markdown.ts +++ b/packages/report-flaky-tests/src/markdown.ts @@ -96,6 +96,7 @@ function formatTestErrorMessage( flakyTestResult: FlakyTestResult ) { default: { return stripAnsi( formatResultsErrors( + // @ts-ignore flakyTestResult.results, { rootDir: path.join( From 61f4d4134bce803795711358ef0bb9942d0a0d3b Mon Sep 17 00:00:00 2001 From: Antony Agrios Date: Thu, 8 Jun 2023 14:10:55 +0300 Subject: [PATCH 5/6] Update: remove @ts-ignore --- packages/report-flaky-tests/src/markdown.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/report-flaky-tests/src/markdown.ts b/packages/report-flaky-tests/src/markdown.ts index 6512b663447867..0f55c12a247130 100644 --- a/packages/report-flaky-tests/src/markdown.ts +++ b/packages/report-flaky-tests/src/markdown.ts @@ -96,7 +96,6 @@ function formatTestErrorMessage( flakyTestResult: FlakyTestResult ) { default: { return stripAnsi( formatResultsErrors( - // @ts-ignore flakyTestResult.results, { rootDir: path.join( From e64ba72fcad8822125e88fd0ebae5369e2b0d774 Mon Sep 17 00:00:00 2001 From: Antony Agrios Date: Mon, 12 Jun 2023 10:16:26 +0300 Subject: [PATCH 6/6] Update: remove italics font size --- packages/edit-post/src/components/block-manager/style.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/edit-post/src/components/block-manager/style.scss b/packages/edit-post/src/components/block-manager/style.scss index 1e5ceef2fa64b2..2568856be41ab5 100644 --- a/packages/edit-post/src/components/block-manager/style.scss +++ b/packages/edit-post/src/components/block-manager/style.scss @@ -16,7 +16,6 @@ padding: $grid-unit-10; background-color: $white; text-align: center; - font-style: italic; position: sticky; // When sticking, tuck the top border beneath the modal header border top: -1px;