From d37120d9c718c2fd33cfb5c1b63294817ae72d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=20Andr=C3=A9?= Date: Mon, 31 Aug 2020 13:47:04 +0200 Subject: [PATCH] Enable back dropCap for paragraph (#24932) --- lib/experimental-default-theme.json | 2 +- .../src/components/use-editor-feature/index.js | 7 ++++--- packages/block-library/src/paragraph/block.json | 5 ----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/experimental-default-theme.json b/lib/experimental-default-theme.json index 2cf63a73b00106..484c8b3cc38564 100644 --- a/lib/experimental-default-theme.json +++ b/lib/experimental-default-theme.json @@ -126,7 +126,7 @@ }, "features": { "typography": { - "dropCap": false + "dropCap": true }, "colors": { "custom": true diff --git a/packages/block-editor/src/components/use-editor-feature/index.js b/packages/block-editor/src/components/use-editor-feature/index.js index 90115fa05be2e5..902df3591dbf4f 100644 --- a/packages/block-editor/src/components/use-editor-feature/index.js +++ b/packages/block-editor/src/components/use-editor-feature/index.js @@ -39,16 +39,17 @@ export default function useEditorFeature( featurePath ) { const setting = useSelect( ( select ) => { const path = `__experimentalFeatures.${ featurePath }`; - const { getSettings } = select( 'core/block-editor' ); - const settings = getSettings(); + // 1 - Use deprecated settings, if available. + const settings = select( 'core/block-editor' ).getSettings(); const deprecatedSettingsValue = deprecatedFlags[ featurePath ] ? deprecatedFlags[ featurePath ]( settings ) : undefined; - if ( deprecatedSettingsValue !== undefined ) { return deprecatedSettingsValue; } + + // 2 - Use global __experimentalFeatures otherwise. return get( settings, path ); }, [ blockName, featurePath ] diff --git a/packages/block-library/src/paragraph/block.json b/packages/block-library/src/paragraph/block.json index 24df851e88011b..91d8ad357f7ebf 100644 --- a/packages/block-library/src/paragraph/block.json +++ b/packages/block-library/src/paragraph/block.json @@ -35,11 +35,6 @@ }, "__experimentalFontSize": true, "__experimentalLineHeight": true, - "__experimentalFeatures": { - "typography": { - "dropCap": true - } - }, "__experimentalSelector": "p", "__unstablePasteTextInline": true }