-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Paragraph: conditionally render inspector controls in drop cap component #61342
Paragraph: conditionally render inspector controls in drop cap component #61342
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
e05298f
to
314beb7
Compare
> | ||
<ToggleControl | ||
__nextHasNoMarginBottom | ||
<InspectorControls group="typography"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR doesn't work as it doesn't respect the comments above. Sorry, I was too optimistic.
// Please do not add a useSelect call to the paragraph block unconditionally.
// Every useSelect added to a (frequently used) block will degrade load
// and type performance. By moving it within InspectorControls, the subscription is
// now only added for the selected block(s).
Closing because the change doesn't satisfy the requirements in the comments:
|
Size Change: -1 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
Thanks :) |
What?
(Maybe) fixes #61231
Thanks to @kraftner's debugging, this PR takes a stab at rendering
<InspectorControls />
inside<DropCapControl />
so thatisDropCapFeatureEnabled
takes into account theme settings.Why?
<InspectorControls />
will render even if the theme has set all typography settings, includingdropCap
tofalse
because it's outside theconst [ isDropCapFeatureEnabled ] = useSettings( 'typography.dropCap' );
check.How?
Shuffling stuff around.
Testing Instructions
Here's some test theme.json. By explicitly setting every individual typography setting to
false
themes should be able to disable the typography tools panel in the block editor's block settings sidebar.