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

Global Styles: Defer revisions for font activation until explicit save #69176

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

himanshupathak95
Copy link
Contributor

@himanshupathak95 himanshupathak95 commented Feb 13, 2025

What?

Closes #67270

Modifies font management to control when typography settings changes create revisions.

Why?

Currently, every font activation/deactivation operation triggers an immediate save and creates a new revision, even while users are still making changes. This results in multiple unexpected revisions being created during a single editing session, making it harder for users to restore their changes coherently. Users expect revisions to be created only when they explicitly click the Save button.

How?

Modified the saveFontFamilies function to accept a shouldAutoSave parameter that controls when changes are immediately saved to the database. Font installation and uninstallation operations (which require filesystem changes) continue to save immediately, while font activation and deactivation changes are deferred until the user explicitly saves.

Testing Instructions

  • Go to the Site editor > Styles
  • Install a new font family (verify a revision is created immediately)
  • Activate/deactivate different font variants of the installed font
  • Verify no new revisions are created during activation/deactivation
  • Click the Save button at the top right of the editor
  • Go to Styles > Revisions and verify that only two revisions exist:
    • One from the initial font installation
    • One containing all your font activation/deactivation changes

Screencast

Screen.Recording.2025-02-13.at.13.00.41.mov

@himanshupathak95 himanshupathak95 marked this pull request as draft February 13, 2025 07:33
Copy link

github-actions bot commented Feb 13, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: himanshupathak95 <[email protected]>
Co-authored-by: matiasbenedetto <[email protected]>
Co-authored-by: afercia <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@himanshupathak95 himanshupathak95 marked this pull request as ready for review February 13, 2025 08:50
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Feature] Font Library labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Font Library Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typography settings changes create unexpected revisions
2 participants