Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable back dropCap for paragraph #24930

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/block-editor/src/components/use-editor-feature/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,24 @@ export default function useEditorFeature( featurePath ) {
const setting = useSelect(
( select ) => {
const path = `__experimentalFeatures.${ featurePath }`;
const { getSettings } = select( 'core/block-editor' );
const settings = getSettings();

// 1 - Use block.json, if available.
const { getBlockSupport } = select( 'core/blocks' );
const blockSupportValue = getBlockSupport( blockName, path );
if ( blockSupportValue !== undefined ) {
return blockSupportValue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to check block support here? I think we should remove that check entirely from here. the useEditorFeature should be just about theme.json and block-editor setting and the hook should check for block support. At least that's my reasoning for the change.

Copy link
Contributor

@youknowriad youknowriad Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think the issue is on Core's experimental-default-theme.json. It should be "true" there and not disabled. This fil e corresponds to the default value for Core if I'm not wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative at #24932


// 2 - 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;
}

// 3 - Use global __experimentalFeatures otherwise.
return get( settings, path );
},
[ blockName, featurePath ]
Expand Down