-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Font Library: Include a "Select All" options to activate/deactivate all fonts #63531
Conversation
Size Change: +243 B (+0.01%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
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. |
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.
Thanks for the PR!
I think the important thing here is not to add new contexts.
This is because the existing contexts are not used in their intended way, and the aim is for them to all be deleted eventually.
For details, see #58428.
We can probably use the existing isFontActivated
and toggleActivateFont
contexts.
packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/font-library-modal/style.scss
Outdated
Show resolved
Hide resolved
To do this, we would need to run |
Thanks for the PR! Behavior wise, this will be a big win. Thank you! |
The current implementation also uses forEach, so I don't think there will be much difference in terms of performance. Or you can handle it ad-hoc without using toggleActivateFont. Either way, we should avoid adding a new context. |
Here is update work flow of selection all option Blog-Home-.-Template-.-gutenberg-.-Editor-.-WordPress.webm |
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.
Thanks for the update!
Overall, it seems to work pretty well. Let's get some feedback from @WordPress/gutenberg-design on the design of the "Select All" checkbox.
packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js
Outdated
Show resolved
Hide resolved
packages/edit-site/src/components/global-styles/font-library-modal/context.js
Outdated
Show resolved
Hide resolved
Thanks @t-hamano, I have updated PR as per your suggestions. Blog-Home-.-Template-.-gutenberg-.-Editor-.-WordPress.1.webm |
Thanks for the update! When I tested it again, I found some unexpected behavior with certain fonts. Enable TT4 and open "System Sans-serif" or "System Serif". These fonts have only one variation, but the initial state of the "Select all" checkbox is "indeterminate." And clicking the checkbox does not seem to do what you expect. However, this problem does not occur with "Inter" fonts, which have only one variation. c5ece7d620a28e91408abd9776578242.mp4 |
That's odd. let me check. |
Its fine now. Blog-Home-.-Template-.-gutenberg-.-Editor-.-WordPress.4.webm |
@t-hamano Please check video attached in PR description for final work flow and design of |
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.
LGTM!
I have one final suggested code change.
.font-library-modal__select-all { | ||
width: 100%; | ||
height: auto; | ||
padding: $grid-unit-20; | ||
|
||
.components-checkbox-control__label { | ||
padding-left: $grid-unit-20; | ||
} | ||
} |
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.
.font-library-modal__select-all { | |
width: 100%; | |
height: auto; | |
padding: $grid-unit-20; | |
.components-checkbox-control__label { | |
padding-left: $grid-unit-20; | |
} | |
} | |
.font-library-modal__select-all { | |
padding: $grid-unit-20 $grid-unit-20 $grid-unit-20 $grid-unit-20 + $border-width; | |
.components-checkbox-control__label { | |
padding-left: $grid-unit-20; | |
} | |
} |
To properly align the vertical position of the checkboxes, let's add a 1px border width to the left side.
I've also removed styles that we don't need.
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.
Good catch!
Flaky tests detected in 8d41f54. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10072425295
|
What?
Fixes #59704
Why?
Because there was no option to pick all fonts, choosing fonts one by one in the font manager was a time-consuming process.
How?
This PR add
Select all
option to font manager.Screenshots or screencast
font-library-select-all-toggle-function.webm