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

Editor Sidebar: Persist "Save Changes" panel settings #607

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Editor Sidebar: Persist "Save Changes" panel settings #607

merged 2 commits into from
Apr 30, 2024

Conversation

t-hamano
Copy link
Contributor

Closes #597

This PR persists the checked state of the "Save Changes" panel.

To make settings persistent, use the @wordpress/preferences package. This package is also used in Gutenberg to persist various settings, which are stored in a database. This ensures that the same settings remain the same for the same user even if the user reloads the browser or uses a different browser.

database-info

Testing Instructions

  • By default, the following four items should be checked.
    • Save Fonts
    • Save Style Changes
    • Save Template Changes
    • Process Only Modified Templates
  • When the "Save template Changes" is unchecked, the four checkboxes below it will be disabled as before.
  • Reload your browser and confirm that the settings persist.
  • Confirm that when you click "Save Changes" the theme will update according to your settings as before.

About Initializing Settings

To restart the test from the beginning, perform the following two operations.

Chrome Dev Tools > Apprication > Storage > Local storage > Right click "http://localhost:8888" > Clear

local-storage

Connect to database > wp_usermeta table > Delete wp_persisted_preferences record

database

Copy link
Contributor

@pbking pbking left a comment

Choose a reason for hiding this comment

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

Nicely done. Works as expected. Simple change.

It's a nice cleanup for the effected view code too.

A great addition!

@pbking pbking merged commit 089c616 into WordPress:trunk Apr 30, 2024
2 checks passed
@t-hamano t-hamano deleted the persist-save-changes-options branch May 1, 2024 01:21
@bacoords
Copy link

bacoords commented May 3, 2024

Yes! Thanks @t-hamano (I came here to open an issue for this functionality and of course you already did it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Improve 'Save Changes' panel with persisted options or a "select all" option.
3 participants