Repository navigation
Foundation + Color tab fully wired #838
Copy link
Copy link
Open
Labels
Description
Part of #836. First feature PR after the endpoint lands. Wires the modal's Color tab end-to-end so users can persist palette / gradient / duotone / default-toggle changes to theme.json. Other tabs continue rendering but their Update is a no-op until subsequent PRs.
Depends on #837.
Scope
Files
src/resolvers.js— addpostUpdateThemeSettings(payload)mirroringpostUpdateThemeMetadata.src/editor-sidebar/edit-theme-settings-modal.js— lift Color-tab state to modal level, wirehandleUpdateClickto call the resolver, add loading / success-notice / error-notice / refresh.src/plugin-styles.scss— any save-state styling adjustments (loading indicator on the footer button).
Behavior
- Update button enabled when there are pending changes; disabled + spinner during save.
- Success: surface
createSuccessNotice, refresh the theme entity record (panels'useEffectresets local state from new server data automatically). Modal stays open by default. - Error: surface
createErrorNoticewith theWP_Errormessage.
State lifting
Modal owns:
colorSettings(defaults flags + custom flags + link)palette/gradients/duotonearrays
Passed to ColorSettingsPanel / PalettePanel / GradientPanel / DuotonePanel as value + onChange. Tabs other than Color keep their existing local state for now.
Acceptance criteria
- Edit any Color sub-panel value, click Update — value persists to theme.json on disk.
- Reload editor — change is reflected.
- Failure (e.g. 500) surfaces an error notice; modal stays open.
- Update button shows loading state during save and is disabled when there are no pending changes.
- Other tabs (Dimensions / Typography / Shadows / Templates) still render and do not error.
- e2e smoke test for the Color save path (if e2e infra is in place per Add basic e2e tests #811).
Out of scope
- Other tabs' persistence (subsequent PRs, see [Tracking] Edit Theme Settings: phased implementation #836).
- WP-CLI command.
- Documentation in
readme.txt— fold into this PR if user-visible documentation is desired before further tabs land; otherwise the final per-tab PR.
References
- Tracking issue: [Tracking] Edit Theme Settings: phased implementation #836
- Endpoint sub-issue: REST endpoint + CBT_Theme_Settings_Save service #837
- Pattern mirrored for save UX:
metadata-editor-modal.js.
Reactions are currently unavailable
Activity
[-]Edit Theme Settings: foundation + Color tab fully wired[/-][+]Foundation + Color tab fully wired[/+]Color Settings: 2-column layout + per-toggle help copy
Color Settings: top-align the two columns
Sidebar: use pencil icon for Edit Theme Metadata
Color tab: rename first PanelBody header to "Default and custom presets"
Palette panel: replace "Color presets" label with "Add a color" button
Color tab: add Palette summary card with "Edit palette" entry
Color tab: always scroll Palette into view on "Edit palette" click
Color tab: borderless palette summary, link next to swatches
Color tab: force Palette accordion open when palette is empty
Palette panel: scroll new row into view after Add
Color tab: keep Palette open when adding the first color
Sync small polish from upstream prototype direction
Modal: reseed local state and snapshot from the save response
View theme.json: force a fresh fetch on every modal open
Modal: unwrap theme_json from save response
View theme.json: bypass core-data cache, fetch via apiFetch directly
Address review feedback batch (correctness, i18n, safety)