From 0040be0e9d960d1c466097665c98ba69a05e89e0 Mon Sep 17 00:00:00 2001 From: benazeer1909 Date: Tue, 31 Dec 2024 17:08:38 +0530 Subject: [PATCH 1/2] Adding block description settings in preference --- packages/block-editor/src/components/block-card/index.js | 7 +++++-- packages/edit-post/src/index.js | 1 + packages/edit-site/src/index.js | 1 + packages/editor/src/components/preferences-modal/index.js | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/block-card/index.js b/packages/block-editor/src/components/block-card/index.js index 525a594702e30..ef9555646725b 100644 --- a/packages/block-editor/src/components/block-card/index.js +++ b/packages/block-editor/src/components/block-card/index.js @@ -16,6 +16,7 @@ import { useDispatch, useSelect } from '@wordpress/data'; import deprecated from '@wordpress/deprecated'; import { __, isRTL } from '@wordpress/i18n'; import { chevronLeft, chevronRight } from '@wordpress/icons'; +import { store as preferencesStore } from '@wordpress/preferences'; /** * Internal dependencies @@ -78,7 +79,9 @@ function BlockCard( { title, icon, description, blockType, className, name } ) { )[ 0 ], }; }, [] ); - + const showBlockDescription = useSelect( ( select ) => { + return select( preferencesStore ).get( 'core', 'showBlockDescription' ); + }, [] ); const { selectBlock } = useDispatch( blockEditorStore ); return ( @@ -104,7 +107,7 @@ function BlockCard( { title, icon, description, blockType, className, name } ) { { !! name?.length && { title } } - { description && ( + { description && showBlockDescription && ( { description } diff --git a/packages/edit-post/src/index.js b/packages/edit-post/src/index.js index b01fa693ed5a7..b4e2ca067e6ce 100644 --- a/packages/edit-post/src/index.js +++ b/packages/edit-post/src/index.js @@ -72,6 +72,7 @@ export function initializeEditor( showListViewByDefault: false, enableChoosePatternModal: true, isPublishSidebarEnabled: true, + showBlockDescription: true, } ); if ( window.__experimentalMediaProcessing ) { diff --git a/packages/edit-site/src/index.js b/packages/edit-site/src/index.js index b96ce5cb67f5e..e18f8e269bd6e 100644 --- a/packages/edit-site/src/index.js +++ b/packages/edit-site/src/index.js @@ -74,6 +74,7 @@ export function initializeEditor( id, settings ) { showBlockBreadcrumbs: true, showListViewByDefault: false, enableChoosePatternModal: true, + showBlockDescription: true, } ); if ( window.__experimentalMediaProcessing ) { diff --git a/packages/editor/src/components/preferences-modal/index.js b/packages/editor/src/components/preferences-modal/index.js index fba60405e7e4b..28147b3192a36 100644 --- a/packages/editor/src/components/preferences-modal/index.js +++ b/packages/editor/src/components/preferences-modal/index.js @@ -232,6 +232,12 @@ function PreferencesModalContents( { extraSections = {} } ) { label={ __( 'Spotlight mode' ) } /> { extraSections?.appearance } + ), }, From b1d233ff1d8e2c19546ddf3ca9dc40d7413f7c7c Mon Sep 17 00:00:00 2001 From: benazeer1909 Date: Tue, 31 Dec 2024 17:15:22 +0530 Subject: [PATCH 2/2] Updating help text --- packages/editor/src/components/preferences-modal/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/editor/src/components/preferences-modal/index.js b/packages/editor/src/components/preferences-modal/index.js index 28147b3192a36..134154fcd77e2 100644 --- a/packages/editor/src/components/preferences-modal/index.js +++ b/packages/editor/src/components/preferences-modal/index.js @@ -235,8 +235,10 @@ function PreferencesModalContents( { extraSections = {} } ) { ),